Skip to content

chore(admin): move admin reads to gRPC and drop the JSON-RPC client - #96

Open
11felix wants to merge 1 commit into
mainfrom
chore/drop-jsonrpc-from-admin-reads
Open

chore(admin): move admin reads to gRPC and drop the JSON-RPC client#96
11felix wants to merge 1 commit into
mainfrom
chore/drop-jsonrpc-from-admin-reads

Conversation

@11felix

@11felix 11felix commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Removes the JSON-RPC client from this SDK. Four admin helpers were the only remaining users; they now read over gRPC, so pythSuiClient and the @mysten/sui/jsonRpc dependency are gone.

Motivation: JSON-RPC is deprecated on Sui public fullnodes, and keeping it meant every consumer had to configure a second endpoint for these four functions alone.

Migrated

Function Was Now
getRebalanceCap getOwnedObjects({filter: {StructType}}) core.listOwnedObjects({owner, type})
addExternalRewardsWalLockedTxb getOwnedObjects({filter: {MoveModule}}) + client-side type filter core.listOwnedObjects on the exact AdminCap type
getWithdrawRequestsAndUnsuppliedAmount getObject({showContent}) core.getObject({include: {json}})
getWalLockedRewardInfo getObject({showContent}) core.getObject({include: {json}})

The two getObject sites needed re-parsing, not just a transport swap: JSON-RPC wraps nested Move structs as {type, fields: {...}} while gRPC renders them flat. Scalars are identical.

Verified against mainnet — both parsers run side by side on the live objects, output compared:

alphaVault requests: 4
alphaVault PARITY: IDENTICAL
WAL rewards PARITY: IDENTICAL

The AlphaVault pool had 4 real withdraw requests at the time, so the nested VecMap path (contents[].key / contents[].value.leftover_amount) is exercised rather than short-circuiting on an empty list — worth stating because the failure mode here is silent: the old ?.fields?.contents ?? [] against a flat payload yields [] and renders an empty screen with no error.

getWalLockedRewardInfo already had ?? fallbacks that tolerated both shapes, so it was correct either way; it is now written for the one shape it uses.

Also: grpcUrl is plumbed through AlphaFiSDKConfigStrategyContextBlockchain, so consumers can point object reads at their own endpoint instead of the built-in public-fullnode default. It was previously reachable only by mutating blockchain.suiGrpcClient after construction, and not at all through AlphaFiSDK, whose strategyContext is private.

graphqlUrl is untouched — rpcpool does not serve the Sui GraphQL schema, so gqlClient cannot move with the rest.

Breaking: Blockchain.pythSuiClient and BlockchainOptions.pythSuiClient are removed. alphafi-admin is the only consumer I found; its matching change is in alphafi-admin#33.

tsc --noEmit, npm run build and the pre-commit hooks are clean. npm test reports no tests configured.

@11felix
11felix requested a review from jangid as a code owner August 4, 2026 12:43
@11felix
11felix requested review from Zorag44 and rishikesh-chavan and removed request for rishikesh-chavan August 4, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants