caivega / ipfslib

Other
2 stars 1 forks source link

[enhancement] - 2个交易返回信息的改进建议 #176

Closed zyd82 closed 3 years ago

zyd82 commented 3 years ago

测试版本:v0.5.4-dev-20210126-6ab04a308a68135003beea7dee6b363e82c0d540

建议一:用例编号FCJT_sendTransaction_020070,发起一个发送代币的交易,如果交易额是负数,返回的提示信息是"value must be integer type and >= 0"。但实际上此处交易额是可以为正小数的,所以这个提示信息可以改为"value must be >= 0"。

{
    "jsonrpc": "2.0",
    "method": "jt_sendTransaction",
    "params": [
        {
            "from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
            "secret": "shhquPeZm7uQ6Rvjrqn6L2cR6H33u",
            "to": "js3MF5kQkTG6NBVj9HEiw9cFe4ckNvMYGg",
            "value": "-0.1/AAT1",
            "memos": [""]
        }
    ],
    "id": 1
}
{
    "error": {
        "count": 1,
        "description": "The compound error.",
        "information": "1 errors"
    },
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "error": {
                "description": "Invalid.",
                "information": "value must be integer type and >= 0",
                "message": {
                    "from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
                    "memos": [
                        ""
                    ],
                    "to": "js3MF5kQkTG6NBVj9HEiw9cFe4ckNvMYGg",
                    "value": "-0.1/AAT1"
                }
            },
            "status": -278,
            "type": "temINVALID"
        }
    ],
    "status": 1000,
    "type": "tedCOMPOUND"
}

建议二:用例编号FCJT_sendTransaction_031010,发行代币时,如果total_supply不是字符串,而是一个正整数,返回的提示信息是"total_supply must be integer type"。这种情况的提示信息可以改为"total_supply must be string type"。

{
    "jsonrpc": "2.0",
    "method": "jt_sendTransaction",
    "params": [
        { 
            "type": "IssueCoin",
            "from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
            "secret": "shhquPeZm7uQ6Rvjrqn6L2cR6H33u",
            "name": "slkjgs",
            "symbol": "AAT4",
            "decimals": "6",
            "total_supply": 9,  <== 非字符串
            "local": false,
            "flags": 65536
        }
    ],
    "id": 1
}
{
    "error": {
        "count": 1,
        "description": "The compound error.",
        "information": "1 errors"
    },
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "error": {
                "description": "Invalid.",
                "information": "total_supply must be integer type",
                "message": {
                    "decimals": "6",
                    "flags": 65536,
                    "from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
                    "local": false,
                    "name": "slkjgs",
                    "symbol": "AAT4",
                    "total_supply": 9,
                    "type": "IssueCoin"
                }
            },
            "status": -278,
            "type": "temINVALID"
        }
    ],
    "status": 1000,
    "type": "tedCOMPOUND"
}
caivega commented 3 years ago

已经修复,下一个build验证

zyd82 commented 3 years ago

v0.5.4-dev-20210202-95e57512b464d7595068a4dda3e2fe1cfae85d1b版本上验证通过