suix_getAllCoins - Sui
Example code for the suix_getAllCoins JSON-RPC method. Complete guide on how to use suix_getAllCoins JSON-RPC in GetBlock Web3 documentation.
This method returns all Coin objects owned by an address on the SUI network with pagination support. Unlike suix_getAllBalances which returns aggregated totals, this method returns individual coin objects with their unique IDs, versions, and balances. This is essential for transaction building, coin selection algorithms, and detailed asset management.
Parameters
owner
SuiAddress
Yes
The owner's SUI address (0x prefixed hex string)
cursor
string
No
Optional paging cursor for pagination
limit
uint
No
Maximum number of items per page (default varies by node)
Returns
data
array
Array of Coin objects with detailed information
nextCursor
string
Cursor for fetching the next page of results
hasNextPage
boolean
Indicates if more results are available
Request Example
curl -X POST https://go.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "suix_getAllCoins",
"params": [
"0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961",
null,
10
]
}'const axios = require('axios');
const url = 'https://go.getblock.io/<ACCESS-TOKEN>/';
const payload = {
jsonrpc: '2.0',
id: 'getblock.io',
method: 'suix_getAllCoins',
params: [
'0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961',
null,
10
]
};
axios.post(url, payload, {
headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));Response Example
Response Parameters
coinType
string
The fully qualified coin type
coinObjectId
string
Unique identifier of the coin object
version
string
Current version number of the object
digest
string
Object digest hash for verification
balance
string
Balance held in this specific coin object
previousTransaction
string
Digest of the transaction that last modified this object
nextCursor
string
Cursor for pagination to fetch next page
hasNextPage
boolean
True if more results exist beyond this page
Use Cases
Select specific coin objects for transaction inputs
Implement coin selection algorithms for optimal gas usage
Display detailed coin inventory in wallets
Merge multiple small coin objects into larger ones
Track individual coin object history
Error Handling
-32602
Invalid params - malformed address or cursor
-32603
Internal error - node processing issues
-32000
Server error - RPC endpoint unavailable
SDK Integration
Last updated
Was this helpful?