Skip to main content

GetBalance

gRPC
RPC Methodsui.rpc.v2.StateService/GetBalance

Retrieves the balance of a specific coin type for the specified address.

Proto files required

Running the examples below requires the official Sui proto files. Download the proto files, then set the example's -import-path relative to the proto root (the -proto path in the examples is relative to the proto root).

github.com/MystenLabs/sui-apis/tree/main/proto

Request Message
ownerstringrequired
Required. The owner's Sui address.
coin_typestringrequired
Required. The type name for the coin (e.g., 0x2::sui::SUI).
Response Message
Balance information for the requested coin type.
coin_typestring
Coin type.
balanceinteger
Total balance.
address_balanceinteger
Address balance portion.
coin_balanceinteger
Coin<T> balance portion.
grpcurl
grpcurl \
-import-path . \
-proto sui/rpc/v2/state_service.proto \
-H 'X-API-KEY: nodit-demo' \
-d '{
"coin_type": "0x2::sui::SUI"
}' \
sui-mainnet.nodit.io:443 \
sui.rpc.v2.StateService/GetBalance