caivega / ipfslib

Other
2 stars 1 forks source link

S3 - jt_getBalance, jt_getAccount,jt_getCurrency,查询原生币或global的代币时,如果有tag,且对应的issuer(jjjjjjjjjjjjjjjjjjjjjhoLvTp)没有填写会报错 #124

Closed foreso-GitHub closed 3 years ago

foreso-GitHub commented 3 years ago

版本:20201114-v0.5.2-dev jt_getBalance, jt_getAccount,jt_getCurrency,查询原生币或global的代币时,如果有tag,且对应的issuer(jjjjjjjjjjjjjjjjjjjjjhoLvTp)没有填写会报错。 上一个版本没有这个问题。

请求:

{
    "jsonrpc": "2.0",
    "method": "jt_getCurrency",
    "params": [
        "TSC_2",
        "current"
    ],
    "id": 1
}

结果:

{
    "id": 1,
    "jsonrpc": "2.0",
    "message": "Bad Base58 checksum: current [130 85 71 155 4 142 69 187 134 87 113 68 183 189 106 127 83 150 33 105 69 101 77 24 229 198 65 121 91 182 204 126] expected [72 165 117 191]",
    "result": "",
    "status": -269
}
caivega commented 3 years ago

看了重构之前的代码(之前的版本),第二个参数依然是issuer, 而不是current or validated(block tag), 看图片 屏幕快照 2020-11-17 09 53 10

(之前的代码,类型验证有bug, 如果上传的不是string参数就会报错,所以最近有时间把代码重构了一下,看下边图片) 如果这样改的话,rpc格式会有歧义,就是不知道第二个参数应该是帐号(issuer), 还是block tag, 而且block tag默认是validated, 如果不设置的话,大部分参数都是validated(已经验证过的区块及帐本)

caivega commented 3 years ago

这个是重构之后的代码,看图片 屏幕快照 2020-11-17 09 59 06

foreso-GitHub commented 3 years ago

By design.

如果要使用tag参数,就一定要有issuer参数。

更新文档: https://github.com/caivega/ipfslib/wiki/chain%E7%9A%84JSON_RPC%E6%89%8B%E5%86%8C#jt_getCurrency https://github.com/caivega/ipfslib/wiki/chain%E7%9A%84JSON_RPC%E6%89%8B%E5%86%8C#jt_getBalance https://github.com/caivega/ipfslib/wiki/chain%E7%9A%84JSON_RPC%E6%89%8B%E5%86%8C#jt_getAccount