StateService.GetBalance
Get balance through sui.rpc.v2.StateService/GetBalance on Inodra's Sui gRPC endpoint.
Endpoint
| Network | Host | Authentication |
|---|---|---|
| Mainnet | mainnet-grpc.inodra.com:443 | x-api-key metadata |
| Testnet | testnet-grpc.inodra.com:443 | x-api-key metadata |
Full method name: sui.rpc.v2.StateService/GetBalance. Unary: one request, one response. Get a key from the dashboard; the same key works on every protocol.
Request: GetBalanceRequest
Request message for LiveDataService.GetBalance.
| Field | Type | Description |
|---|---|---|
owner | string | Required. The owner's Sui address. |
coin_type | string | Required. The type names for the coin (e.g., 0x2::sui::SUI). |
Response: GetBalanceResponse
Response message for LiveDataService.GetBalance. Return the total coin balance for one coin type, owned by the address owner.
| Field | Type | Description |
|---|---|---|
balance | Balance | The balance information for the requested coin type. |
Balance
Balance information for a specific coin type.
| Field | Type | Description |
|---|---|---|
coin_type | string | The type of the coin (e.g., 0x2::sui::SUI). |
balance | uint64 | The total balance of coin_type in its smallest unit. This is the sum of all spendable amounts of coin_type (address_balance and coin_balance). |
address_balance | uint64 | The balance of Balance<T> in this address's Address Balance. |
coin_balance | uint64 | The balance of all Coin<T> objects owned by this address. |
grpcurl
grpcurl -H "x-api-key: YOUR_API_KEY" \
-d '{
"owner": "0x0000000000000000000000000000000000000000000000000000000000000002",
"coin_type": "0x2::sui::SUI"
}' \
mainnet-grpc.inodra.com:443 \
sui.rpc.v2.StateService/GetBalanceServer reflection is enabled, so no proto files are needed for grpcurl. Field masks are written as {"paths": [...]}.
TypeScript
import { GrpcWebFetchTransport, SuiGrpcClient } from '@mysten/sui/grpc'
const transport = new GrpcWebFetchTransport({
baseUrl: 'https://mainnet-grpc.inodra.com',
meta: { 'x-api-key': process.env.INODRA_API_KEY! }
})
const client = new SuiGrpcClient({ network: 'mainnet', transport })
const { balance } = await client.getBalance({
owner: '0x0000000000000000000000000000000000000000000000000000000000000002',
coinType: '0x2::sui::SUI'
})
console.log(balance.balance)Uses the typed SuiGrpcClient method from @mysten/sui v2 that calls this RPC. Install with npm install @mysten/sui and set INODRA_API_KEY. The gRPC gateway guide covers native gRPC transport for backends.
Credits
1 credit per call. See credits and billing for the full table.
JSON-RPC equivalent
Replaces suix_getBalance. The JSON-RPC to gRPC migration guide has before and after code for the common calls.