Sui - Migration Guide from JSON-RPC to GraphQL
ui has officially deprecated JSON-RPC in favor of gRPC and GraphQL RPC.
GraphQL lets you fetch exactly the fields you need, join several resources (address → balances → objects → transactions) in a single request, and read multiple data types consistently at the same checkpoint. It is the best fit for frontends, wallets, explorers, developer tools, and clients written in dynamic languages. For backend pipelines, indexers, and streaming, see the gRPC migration guide.
This guide will help you transition your application to the Tatum Sui GraphQL Gateway.
NOTEFind Tatum Sui graphQL Docs HERE.
Method Mapping: JSON-RPC to GraphQL
There is no one-to-one method list in GraphQL — instead you query fields on a typed graph. The tables below show which GraphQL field replaces each JSON-RPC method.
The transition involves mapping your old method calls to the new graphQL Services. There is no one-to-one method list. Multiple methods can use same graphQL fields with different filters or fields in response
Checkpoint & Transaction Queries
| JSON-RPC Method | GraphQL Field |
|---|---|
sui_getLatestCheckpointSequenceNumber | Query.checkpoint → sequenceNumber |
sui_getCheckpoint | Query.checkpoint |
sui_getCheckpoints | Query.checkpoints |
sui_getTotalTransactionBlocks | Query.checkpoint → networkTotalTransactions |
sui_getTransactionBlock | Query.transaction |
sui_multiGetTransactionBlocks | Query.multiGetTransactions |
suix_queryTransactionBlocks | Query.transactions or Address.transactions |
suix_queryEvents | Query.events |
suix_getReferenceGasPrice | Query.epoch → referenceGasPrice |
sui_getChainIdentifier | Query.chainIdentifier |
sui_getProtocolConfig | Query.protocolConfigs |
Object Queries
| JSON-RPC Method | GraphQL Field |
|---|---|
sui_getObject | Query.object |
sui_tryGetPastObject | Query.object |
sui_multiGetObjects | Query.multiGetObjects |
suix_getOwnedObjects | Address.objects |
suix_getDynamicFields | Object.dynamicFields |
suix_getDynamicFieldObject | Object.dynamicObjectField / Object.dynamicField |
Balance & Coin Queries
| JSON-RPC Method | GraphQL Field |
|---|---|
suix_getBalance | Address.balance |
suix_getAllBalances | Address.balances |
suix_getCoins | Address.objects |
suix_getAllCoins | Address.objects |
suix_getCoinMetadata | Query.coinMetadata |
suix_getTotalSupply | Query.coinMetadata → supply |
Transaction Execution
| JSON-RPC Method | GraphQL Field |
|---|---|
sui_executeTransactionBlock | Mutation.executeTransaction |
sui_dryRunTransactionBlock | Query.simulateTransaction |
Name Service
| JSON-RPC Method | GraphQL Field |
|---|---|
suix_resolveNameServiceAddress | Query.address(name:) or Query.nameRecord(name:) → target |
suix_resolveNameServiceNames | Address.defaultNameRecord → domain |
Key Differences
1. Numbers and Scalars
BigIntvalues (balances, gas costs, supply,referenceGasPrice) are returned as Strings to prevent precision loss. Always parse them usingBigInt().UInt53values (checkpoint sequence numbers, versions, epoch IDs) are returned as JSON numbers and are safe for JavaScriptNumber.- Addresses (
SuiAddress) are returned in full 64-hex-character form (e.g.0x2→0x000…0002). Normalize before comparing.
2. Select Only the Fields You Need
JSON-RPC used options objects (showEffects, showEvents, showContent, …). In GraphQL, you simply list the fields you want. Smaller selections mean faster responses and lower query cost.
3. Typed Arguments Instead of Positional Params
JSON-RPC params arrays are replaced by named, typed arguments. Pass dynamic values through variables rather than string interpolation.
4. Cursor Pagination
All lists are Relay-style connections (first/after, last/before, pageInfo { hasNextPage endCursor })
5. Limits
The service enforces a maximum query depth, node count, page size, payload size, and timeout. Query them with:
{
serviceConfig {
maxQueryDepth
maxQueryNodes
maxMultiGetSize
queryTimeoutMs
maxPageSize(type: "Query", field: "transactions")
}
}7. No Subscriptions
GraphQL does not offer streaming. Poll events/transactions with cursors, or use the gRPC SubscriptionService for real-time data.
Testing the Migration
Use curl to quickly verify your Tatum connection from the terminal:
curl -X POST 'https://sui-mainnet.gateway.tatum.io/graphql' \
-H 'Content-Type: application/json' \
-H 'x-api-key: YOUR_API_KEY' \
-d '{ "query": "{ chainIdentifier checkpoint { sequenceNumber } }" }'A successful response returns the mainnet chain identifier 4btiuiMPvEENsttpZC7CZ53DruC3MAgfznDbASZ7DR6S and the latest checkpoint number.
Updated 22 days ago