用户账号相关 API


listaddr

查询当前钱包节点地址列表信息

Parameters

none

Returns

addr 地址

regid 地址对应的regid 主动发起交易后生成

tokens 币种列表,不限于 WICC、WUSD、WGRT 中的0种或多种

`free_amount` 币种对应的可自由操作金额,单位 `sawi`
`staked_amount` 币种对应的已抵押金额,单位 `sawi`
`frozen_amount` 币种对应的已冻结金额,单位 `sawi`
`voted_amount`  已投票的金额, 单位为`sawi`

haveminerkey 矿工标识 (可忽略)

Example

// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"listaddr","params":[]}' -H 'content-type:application/json;' http://127.0.0.1:6967

// Response
{
    "result": [
        {
            "addr": "waY9NrhBRQabw6bhKz9d11WWMnv4A1QYT3",
            "regid": "22345-2",
            "tokens": {
                "WICC": {
                    "free_amount": 99099993,
                    "staked_amount": 0,
                    "frozen_amount": 0,
                    "voted_amount": 0
                },
                "WUSD": {
                    "free_amount": 341036070,
                    "staked_amount": 0,
                    "frozen_amount": 0,
                    "voted_amount": 0
                }
            },
            "hasminerkey": false
        }
    ],
    "error": null,
    "id": "curltext"

getnewaddr

创建新地址 ,可通过账户模型与地址 查看更详细的信息

Parameters

IsMiner (bool, optional)

true : 将创建两组密钥对,一组用于交易签名,另一组用于收取矿工费用

false: 将创建一组密钥对,用于交易签名

Returns

addr 账户地址

minerpubkey 旷工pubkey,如果没有旷工pubkey,则为no

Example

// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"getnewaddr","params":[]}' -H 'content-type:application/json;' http://127.0.0.1:6967

// Response
{
    "result": {
        "addr": "weoPdSnVxqfcpnvBBphnBjEJ6ug8xS6Znr",
        "minerpubkey": "null"
    },
    "error": null,
    "id": "curltext"
}

getaccountinfo

获取普通账户或者合约账户地址详情 ,可通过账户模型与地址 查看更详细的信息

Parameters

address 普通账号/合约账号的地址/regid

Returns

address 地址

keyid 地址公钥两次sha之后得到的pubKeyHash

nickid 用户名,类EOS,仅支持小写字母a~z、数字 0~5,长度只允许为12字符

regid 地址对应的regid

regid_mature regid成熟度,用于判断regid是否永久可用,

true : 成熟;
false :未成熟

owner_pubkey 地址对应的公钥,只有普通账户地址有

miner_pubkey 可忽略

tokens 币种余额列表,可能包含 WICC、WUSD、WGRT 中的0种或多种

`free_amount`   可自由操作的金额 , 单位为`sawi`
`staked_amount` 已抵押的金额, 单位为`sawi`
`frozen_amount` 已冻结的金额, 单位为`sawi`
`voted_amount`  已投票的金额, 单位为`sawi`

received_votes 已收到的投票数量

vote_list 已发出的投票列表

`candidate_uid` 被投票人的信息
    `id_type` 被投票人的信息类型 ,"PubKey":公钥 ;"RegID":  regid
    `id`  被投票人公钥/regid
`voted_bcoins` 投票数量

position 地址所在位置,"inwallet":没有收到过币,链上无记录,"inblock":收到过币,链上有记录

cdp_list 稳定币相关 , cdp列表

`cdpid` cdp的唯一标识,目前每个地址仅限1个cdp
`regid` cdp创建者的regid
`last_height` 上一次操作cdp时的高度
`bcoin_symbol` 抵押所用的基础币种
`total_bcoin` 抵押的币数量,单位为`sawi`
`scoin_symbol` 贷出的币种
`total_scoin` 贷出的币种总额,单位为`sawi`
`collateral_ratio` 抵押率

Example

// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"getaccountinfo","params":["wSSyjfGB5wWSVuygb3DYxFiameHZJ2K3Ay"]}' -H 'content-type:application/json;' http://127.0.0.1:6967

// Response
{
    "result": {
        "address": "wSSyjfGB5wWSVuygb3DYxFiameHZJ2K3Ay",
        "keyid": "4acedbdda642eed93e203113534f976ef85ee5dd",
        "nickid": "",
        "regid": "22415-2",
        "regid_mature": true,
        "owner_pubkey": "033f7fa29a83a8ad46c0d52caa3b2e271e24e71f7d8cf328471d759f71ca5e4e2c",
        "miner_pubkey": "",
        "tokens": {
            "WICC": {
                "free_amount": 688899730000,
                "staked_amount": 0,
                "frozen_amount": 10100000000,
                "voted_amount": 0
            },
            "WUSD": {
                "free_amount": 9856999300,
                "staked_amount": 0,
                "frozen_amount": 12567000700,
                "voted_amount": 0
            }
        },
        "received_votes": 0,
        "vote_list": [],
        "position": "inblock",
        "cdp_list": [
            {
                "cdpid": "62107c9447a0b46a41873ac96e8b87facb876bee8e6e045ea489bbd70edfae23",
                "regid": "22415-2",
                "last_height": 22526,
                "bcoin_symbol": "WICC",
                "total_bcoin": 300000000000,
                "scoin_symbol": "WUSD",
                "total_scoin": 22710000000,
                "collateral_ratio": "2642.01%"
            }
        ]
    },
    "error": null,
    "id": "curltext"
}

dumpprivkey

获取地址对应的私钥(WIF格式)

Parameters

addr 本钱包里普通账户地址

Returns

privatekey 私钥(WIF格式)

minerkey 旷工标识(可忽略)

Example

// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"dumpprivkey","params":["wSSyjfGB5wWSVuygb3DYxFiameHZJ2K3Ay"]}' -H 'content-type:application/json;' http://127.0.0.1:6967

// Response
{
  "result":
  {
    "privkey":"Y8AwAUPqZp4WvuyenMC8FbrfsTNrH1bxt8raVSyVGkBwHTuhWELl",
    "minerkey":"null"
  },
  "error": null,
  "id": "curltext"
}

importprivkey

将私钥(WIF格式)导入钱包

Parameters

privkey 普通账户地址私钥(WIF格式)

Returns

imported_key_address 普通账户地址

Example

// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"importprivkey","params":["Y8AwAUPqZp4WvuyenMC8FbrfsTNrH1bxt8raVSyVGkBwHTuhWELl"]}' -H 'content-type:application/json;' http://127.0.0.1:6967

// Response
{
  "result":
  {
    "imorpt key address":"wSSyjfGB5wWSVuygb3DYxFiameHZJ2K3Ay"
  },
  "error": null,
  "id": "curltext"
}

dropprivkey

将地址对应的私钥从钱包中移除,非销毁

Parameters

address 普通账号地址

Returns

info 私钥移除结果

Example

// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"dropprivkey","params":["wSSyjfGB5wWSVuygb3DYxFiameHZJ2K3Ay"]}' -H 'content-type:application/json;' http://127.0.0.1:6967

// Response
{
    "result": {
        "info": "privkey is dropped from wallet."
    },
    "error": null,
    "id": "curltext"
}

validateaddr

校验普通地址或者合约地址是否有效

Parameters

address 普通账户/合约账户的地址/regid

Returns

is_valid

`true`:有效的 
`false` 无效的

Example

// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"validateaddr","params":["wSSyjfGB5wWSVuygb3DYxFiameHZJ2K3Ay"]}' -H 'content-type:application/json;' http://127.0.0.1:6967

// Response
{
    "result": {
        "is_valid": true
    },
    "error": null,
    "id": "curltext"
}