suix_getAllBalances - Sui
Example code for the suix_getAllBalances JSON-RPC method. Complete guide on how to use suix_getAllBalances JSON-RPC in GetBlock Web3 documentation.
Parameters
Parameter
Type
Required
Description
Default/Supported Values
Request Example
curl --location --request POST https://go.getblock.io/<ACCESS-TOKEN>/ \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "suix_getAllBalances",
"params": [
"0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961"
],
"id": "getblock.io"
}'import requests
import json
url = "https://go.getblock.io/<ACCESS-TOKEN>/"
headers = {"Content-Type": "application/json"}
payload = {
"jsonrpc": "2.0",
"method": "suix_getAllBalances",
"params": [
"0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961"
],
"id": "getblock.io"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
print("Result:", response.json().get("result"))
else:
print("Error:", response.status_code, response.text)Sample Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": [
{
"coinType": "0x2::sui::SUI",
"coinObjectCount": 15,
"totalBalance": "3000000000",
"lockedBalance": {}
},
{
"coinType": "0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC",
"coinObjectCount": 3,
"totalBalance": "1500000000",
"lockedBalance": {}
}
]
}Response Parameters
Parameter
Type
Description
Use Cases
Error handling
Code
Description
Solution
SDK Integration
Last updated
Was this helpful?