Skip to content

StateService.GetBalance ​

Get balance through sui.rpc.v2.StateService/GetBalance on Inodra's Sui gRPC endpoint.

Endpoint ​

NetworkHostAuthentication
Mainnetmainnet-grpc.inodra.com:443x-api-key metadata
Testnettestnet-grpc.inodra.com:443x-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.

FieldTypeDescription
ownerstringRequired. The owner's Sui address.
coin_typestringRequired. 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.

FieldTypeDescription
balanceBalanceThe balance information for the requested coin type.

Balance ​

Balance information for a specific coin type.

FieldTypeDescription
coin_typestringThe type of the coin (e.g., 0x2::sui::SUI).
balanceuint64The 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_balanceuint64The balance of Balance<T> in this address's Address Balance.
coin_balanceuint64The balance of all Coin<T> objects owned by this address.

grpcurl ​

bash
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/GetBalance

Server reflection is enabled, so no proto files are needed for grpcurl. Field masks are written as {"paths": [...]}.

TypeScript ​

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.

The full-stack Sui data layer.