"getnep17balances" RPC vs "list asset" cli command have balance difference for GAS
RPC
curl -d '
{
"jsonrpc": "2.0",
"method": "getnep17balances",
"params": ["NQrEVKgpx2qEg6DpVMT5H8kFa7kc2DFgqS"],
"id": 3}' -H 'Content-Type: application/json' http://localhost:20332
{
"jsonrpc":"2.0",
"id":3,
"result":{
"balance":[
{
"assethash":"0xd2a4cff31913016155e38e474a2c06d08be276cf",
"amount":"1000",
"lastupdatedblock":9
},
{
"assethash":"0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
"amount":"1000",
"lastupdatedblock":9
}
],
"address":"NQrEVKgpx2qEg6DpVMT5H8kFa7kc2DFgqS"
}
}
neo-cli
neo> list asset
NQrEVKgpx2qEg6DpVMT5H8kFa7kc2DFgqS
NEO: 1000
GAS: 0.00001
Notice the GAS balance
I think it is right because getnep17balances is expressed with decimal.
@cloud8little thank you for the quick response. In preview5 to send 1000 NEO and 1000 GAS we used the following RPC command
curl -d '
{
"jsonrpc": "2.0",
"method": "sendmany",
"params": [
"NhxvE7rd27zdz3qTUdaBGpeckzd26VJHZr",
[
{
"asset":"0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
"value":"1000",
"address":"NQrEVKgpx2qEg6DpVMT5H8kFa7kc2DFgqS"
},
{
"asset":"0xd2a4cff31913016155e38e474a2c06d08be276cf",
"value":"1000",
"address":"NQrEVKgpx2qEg6DpVMT5H8kFa7kc2DFgqS"
}
]],"id": 3}' -H 'Content-Type: application/json' http://localhost:20332
This worked as intended. Are you saying that for RC1 we should now multiply the value field with the decimals of the token?
e.g. to send 1000 GAS we should do (1000 * pow(10, decimals)) ?
{
"asset":"0xd2a4cff31913016155e38e474a2c06d08be276cf",
"value":"100000000000",
"address":"NQrEVKgpx2qEg6DpVMT5H8kFa7kc2DFgqS"
}
because the documentation isn't clear on this
Related to neo-project/neo-modules#505.
Related to neo-project/neo-modules#505.
No, the request should be the same as before. no need to change the value in the request body, but only the neo-cli shows the asset with dividing by its decimal. and All query API(getnep17balance, getunclaimedgas) will show the result with decimal. We will update the documentation to clarify this.
@cloud8little it seems that I do have to change the amount in the request body. Only if I do sendmany with an amount of 100000000000 will I get 1000 GAS according to neo-cli.
@cloud8little it seems that I do have to change the amount in the request body. Only if I do
sendmanywith an amount of100000000000will I get 1000 GAS according to neo-cli.
Let me confirm.
@ixje it is fixed https://github.com/neo-project/neo-modules/pull/562, somehow it is changed by mistake and it should be good now.
@cloud8little that PR does not seem to fix the issue with sendmany RPC call. I still have to use 100000000000 in order to receive 1000 GAS 😕
00000000
It is intended since we use BigInteger (100000000000 ) rather than BigDecimal (1000) to ensure accuracy.
@cloud8little that PR does not seem to fix the issue with
sendmanyRPC call. I still have to use100000000000in order to receive1000GAS 😕
The PR fix sendfrom and sendtoaddress to keep consistent with sendmany. sorry for the confusion. keep the decimal in the input is correct.
Old, if remains, please re-open