Skip to content

Use gRPC client in ts sdk docs and examples (BFP-4993) - #295

Merged
NidaKarim merged 1 commit into
mainfrom
nida/bfp-4993-typescript-sdk-is-using-deprecated-json-rpc
Aug 31, 2026
Merged

NidaKarim merged 1 commit into
mainfrom
nida/bfp-4993-typescript-sdk-is-using-deprecated-json-rpc

Conversation

@NidaKarim

Copy link
Copy Markdown
Contributor

Closes #293 · BFP-4993

Context

The reported issue was half right. The SDK's runtime code was already transport-agnostic — BluefinProSdk takes a ClientWithCoreApi, and library-sui v3 only calls .core methods (executeTransaction, simulateTransaction, listCoins). There were no deprecated JSON-RPC calls in the SDK internals.

What was actually wrong is what users see: every doc and the example told them to construct a SuiJsonRpcClient against the deprecated endpoints.

Changes

  • Docs/exampleSuiJsonRpcClientSuiGrpcClient in README.md, example.ts, and docs/batch-claim-rewards-guide.md, plus a README note that JSON-RPC is deprecated and swapping the client is the only migration step users need.
  • Type cleanuprequest-signer.ts typed its client params as SuiClient imported from library-sui. That is just an alias for ClientWithCoreApi, so it was misleading rather than broken, but it made the public IBluefinSigner interface look JSON-RPC-bound. Now imports ClientWithCoreApi from @mysten/sui/client directly. Structurally identical → not a breaking change.
  • Removed the as any on this.suiClient at sdk.ts:905RewardsDistributorInteractor already accepts ClientWithCoreApi, so the cast was hiding nothing.

No new dependency: the gRPC transport (@protobuf-ts/grpcweb-transport) ships inside @mysten/sui, and the ./grpc export has existed since 1.42, so the existing ^2.13.0 peer range already covers it.

Verification

yarn build:types and yarn build:example (the two CI jobs) both pass.

Beyond typechecking, I ran a live gRPC call against testnet to confirm the migration works at runtime and not just at the type level:

core.listCoins ok, objects: 50 hasNextPage: true
referenceGasPrice: 1000

core.listCoins is the exact call the deposit path makes via CoinUtils.getCoins.

Note on versioning

No version bump here — #BFP-4644 already takes 2.0.02.1.0 and bumping in both places would collide. This change has no runtime behavior change, so it can fold into whichever release tag goes out next.

🤖 Generated with Claude Code

Sui's JSON-RPC interface is deprecated. The SDK internals were already
transport-agnostic (BluefinProSdk takes a ClientWithCoreApi, and
library-sui v3 only calls .core methods), but the README, example, and
batch-claim guide all told users to construct a SuiJsonRpcClient.

Switch those to SuiGrpcClient, and drop the misleading SuiClient type
alias from IBluefinSigner in favour of ClientWithCoreApi -- it resolves
to the same type, so this is not a breaking change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the TypeScript SDK’s public-facing docs/examples to use Sui’s gRPC client (instead of the deprecated JSON-RPC client) and aligns exposed signer/client typings to the transport-agnostic Core API used by the SDK internals.

Changes:

  • Swaps SuiJsonRpcClientSuiGrpcClient in the README, example, and batch-claim rewards guide.
  • Updates IBluefinSigner / BluefinRequestSigner method parameter types to ClientWithCoreApi.
  • Removes an unnecessary as any cast when creating RewardsDistributorInteractor.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ts/sdk/src/sdk.ts Removes an any cast when passing the Sui client into the rewards interactor.
ts/sdk/src/request-signer.ts Replaces SuiClient typing with ClientWithCoreApi to reflect transport-agnostic usage.
ts/sdk/README.md Updates quickstart snippet to construct a SuiGrpcClient and adds a deprecation note for JSON-RPC.
ts/sdk/example.ts Updates the runnable example to use SuiGrpcClient.
ts/sdk/docs/batch-claim-rewards-guide.md Updates guide snippets to use SuiGrpcClient.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +24 to 25
import { SuiGrpcClient } from "@mysten/sui/grpc";
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
@NidaKarim
NidaKarim merged commit d019acf into main Aug 31, 2026
6 checks passed
@NidaKarim
NidaKarim deleted the nida/bfp-4993-typescript-sdk-is-using-deprecated-json-rpc branch August 31, 2026 16:55
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.

Typescript SDK is using deprecated JSON-RPC.

3 participants