caivega / ipfslib

Other
2 stars 1 forks source link

S3 - 发送交易,当value有货币单位时(比如SWT),无法发送带小数的货币 #118

Closed foreso-GitHub closed 3 years ago

foreso-GitHub commented 4 years ago

发送交易,当value有货币单位时(比如SWT),无法发送带小数的货币

请求:

{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "jt_sendTransaction",
    "params": [
        {
            "from": "j43x4vLAy6hW6AE3r9QqFqudmH2ajBzYm9",
            "secret": "ssPVnaMNNGpjo5b9TqARyGhMiqWZz",
            "to": "jLTnL6yUXwuhR1uL3FLTMwG1r4PxZaUECM",
            "value": "0.1/SWT",
            "fee": "10",
            "memos": [
                "AAAAAAAA"
            ]
        }
    ]
}

结果出错:

{
    "id": 2,
    "jsonrpc": "2.0",
    "message": {
        "reason": "1 errors",
        "result": [
            {
                "error": "value must be integer type and >= 0",
                "message": {
                    "fee": "10",
                    "from": "j43x4vLAy6hW6AE3r9QqFqudmH2ajBzYm9",
                    "memos": [
                        "AAAAAAAA"
                    ],
                    "to": "jLTnL6yUXwuhR1uL3FLTMwG1r4PxZaUECM",
                    "value": "0.1/SWT"
                },
                "status": -278
            }
        ]
    },
    "result": [
        ""
    ],
    "status": -278
}
caivega commented 3 years ago

为兼容以前功能,支持带原生币的符号的(比如0.1/SWT)这种,支持小数,实际为0.1 * 10^6 SWT, 不带SWT及非原生币,只支持非小数的大整数,已经修复,后续版本验证,另外后续根据需要可以统一成整数形式,以简化调用

foreso-GitHub commented 3 years ago

版本:20201114-v0.5.2-dev已经修复。