Description
Deleted coins example
When you call getAllCoins for this address "0x5c39c34610d99a8139b0b82863969c0862dd400d679f96d97f10227915bbc27c"
it returns SUI coins that add up to 1630363926 MIST
.
curl https://fullnode.mainnet.sui.io/ \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"method":"suix_getAllCoins",
"params":[
"0x5c39c34610d99a8139b0b82863969c0862dd400d679f96d97f10227915bbc27c"
],
"id":1
}' | json_pp
If you loop through the coins and call getObject on them all, you find three that don't exist anymore:
{
code: 'notExists',
object_id: '0x93d550e5201ab108a0660358d5a31f3d3c5ab96a1564aa5f96ffc3a4544264d3'
}
{
code: 'notExists',
object_id: '0x1411272b278d3c19f6c73dadf1d21b070d3b94e029db6a97b18ae09111f93b33'
}
{
code: 'notExists',
object_id: '0x691e1a300ae3a4c05df2d52a93c87136f1c1f2a19958ca3ff75f65fce5215b9c'
}
and if you only add up the coins that exist, the total is 1375697499 MIST
. "hasNextPage" : false, so we are able to see all the account's coins.
Broken cursor example
The below request returns a cursor for a deleted object
curl https://fullnode.mainnet.sui.io/ \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "suix_getAllCoins",
"params": [
"0xc1ea060ce0739ca17c54b72fb09aceec0dfb43f0d2768bd822850acc03476313"
]
}' | json_pp
returns
{
coinType: '0x2::sui::SUI',
coinObjectId: '0xbefa0d4965c6bcb3a1b812d87980a1040a2cc6933f9ca1026847dba87cba4194',
version: '478515401',
digest: 'D5VJQHM2MSjYUybQzRa8YEpjomBWU6aRQfyrZpZ2oVNg',
balance: '691249184',
previousTransaction: '67ruzTnNogn4X3EZE1hopuhBYM2j8WBTku1oFgkYFVjT'
}
],
nextCursor: '0xbefa0d4965c6bcb3a1b812d87980a1040a2cc6933f9ca1026847dba87cba4194',
hasNextPage: true
but the next call following the cursor fails with error
JsonRpcError: cursor not found
at SuiHTTPTransport.request... {
code: -32602,
type: 'InvalidParams'
}
because the object was deleted
I believe the cursor error will be fixed by this PR - likely in the next Testnet version to roll out - allowing for successful paginating to get all the responses. However, as I understand it, deleted coins may still be returned (including as the cursor value).