Skip to content

build(deps): bump @mysten/sui to 3.1.1 in sdk-coin-sui - #10325

Draft
arvind-bg wants to merge 1 commit into
scaas-12506-hbtc-mainnet-statics-sdk-coin-suifrom
scaas-12506-bump-mysten-sui-3.0.0
Draft

arvind-bg wants to merge 1 commit into
scaas-12506-hbtc-mainnet-statics-sdk-coin-suifrom
scaas-12506-bump-mysten-sui-3.0.0

Conversation

@arvind-bg

@arvind-bg arvind-bg commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Bumps @mysten/sui in modules/sdk-coin-sui from 2.20.0 to 3.1.1, keeping the exact pin.

@mysten/hashi is built against @mysten/sui 3.x. Moving the SDK onto the same line keeps the two libraries on the versions they are released together for, so later Sui and Hashi updates can be taken without a major upgrade in between.

sdk-coin-sui

  • package.json: @mysten/sui is pinned to 3.1.1.
  • src/lib/grpcClient.ts: Sui 3.x wraps the transport that is passed to its client. The SDK now builds the gRPC transport itself for the browser and Node paths, keeps a reference to it, and closes that reference in closeSuiGrpcClient.
  • test/unit/utils.ts: the browser transport test passes an https:// URL, because Sui 3.x rejects a bare host as the browser endpoint. The transport tests check the transport the SDK built.
  • yarn.lock: regenerated. Sui's own dependencies move with it (graphql 17, valibot 1.6, @mysten/bcs 2.1.4).

Behaviour changes that come with Sui 3.x

  • In browsers the node URL must be an absolute http(s) URL. The configured node URLs already are.
  • The browser transport sends the binary wire format by default. A proxy that only supports the base64 text format needs format: 'text'.
  • The client sends an x-sui-client-protocol-version header. The public testnet and mainnet nodes accepted it.

Issue Number

SCAAS-12511

Type of change

This is a dependency upgrade, so none of the standard types fits exactly. It is not marked as a breaking change: the SDK's public API is unchanged and the configured node URLs keep working. The one behaviour difference is the browser URL rule described above.

How Has This Been Tested?

  • npm run unit-test in modules/sdk-coin-sui: 281 passing, the same result as on 2.20.0. Two suites that need local test credentials (test/unit/sui.ts, test/unit/suiToken.ts) did not run.
  • npx tsc --noEmit, npx eslint on the changed files and npx prettier --check: clean.
  • Read-only calls (chain identifier, epoch and balance) against the public Sui testnet and mainnet nodes return the same values on 3.1.1 as on 2.20.0.
  • The Hashi address functions return the same results on 3.1.1 as on 2.20.0.
  • Not tested yet: the browser bundle build, and a real transaction on testnet through the SDK.

@mysten/hashi requires @mysten/sui ^3.0.0, which the previous 2.20.0 pin did
not satisfy.

Ticket: SCAAS-12511
@linear-code

linear-code Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

SCAAS-12511

SCAAS-12506

@arvind-bg

Copy link
Copy Markdown
Contributor Author

@claude review this pr

@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @arvind-bg's task in 24s —— View job


Review of #10325: bump @mysten/sui to 3.1.1

  • Read the diff (package.json, grpcClient.ts, test/unit/utils.ts)
  • Review for correctness and risk

I reviewed the diff only. node_modules isn't installed in this environment, so I didn't build or run tests, and I didn't check the 3.1.1 type declarations myself.

Overall: The change looks good. It's small, and the transport-reference approach is a sound replacement for reaching into transactionExecutionService._transport, which broke in Sui 3.x. I found no blocking issues.

What I checked

  • The exact pin 3.1.1 is kept, as the header comment in grpcClient.ts requires.
  • transport is created in both the browser and Node branches. The client is then built once and registered in the WeakMap, so the browser and Node paths no longer duplicate the construction.
  • closeSuiGrpcClient now uses transport?.close?.(). It tolerates a client that wasn't created through createSuiGrpcClient, where the old transportOf would have thrown.
  • The tests now assert on the transport the SDK built (instanceOf) instead of private fields, so they are less brittle.

Suggestions (non-blocking)

  1. Browser URL handling (grpcClient.ts, browser branch). GrpcWebFetchTransport now throws if baseUrl isn't an absolute http(s) URL. Callers that pass a bare host:443, as the Node path and the tests do, would fail in a browser. The PR says the configured node URLs already include a scheme. Normalizing here would make the browser path as forgiving as the Node path, which already strips the scheme. For example: const baseUrl = /^https?:\/\//i.test(url) ? url : \https://${url}``.
  2. Test helper in production exports. __getSuiGrpcTransportForTest is exported from src/lib/grpcClient.ts, next to the existing __resetSuiGrpcClientCacheForTest. That matches the file's convention, so I'm fine with it. It does leak the transport to anyone who imports the module, so keep it out of the package's public index.ts exports. I didn't check whether it's re-exported.
  3. Unsafe cast in closeSuiGrpcClient. transport is typed unknown and then cast to { close?: () => void }. A small type alias for the transport would be slightly cleaner. This is cosmetic.
  4. Resolved @mysten/sui versions. @mysten/hashi and @mysten/bcs are still declared in this package. The lockfile shows @mysten/bcs moving to 2.1.4, while package.json has @mysten/bcs ^0.7.0. Confirm that yarn why @mysten/sui and yarn why @mysten/bcs give one @mysten/sui copy and no unexpected duplicates. Also confirm that @mysten/hashi@0.7.1's peer range accepts 3.1.1. A duplicate copy would break instanceof and type checks across the two libraries.
  5. Untested paths, as the PR already says.
    • The browser bundle build is untested. The webpack/ESM build of @mysten/sui/grpc and the require() of an ESM-only subpath deserve a check, for example with yarn browser-tests or a bundle of bitgo.
    • A real transaction on testnet is untested. The read-only calls cover the client, but not transactionExecutionService.
    • sui.ts and suiToken.ts didn't run. These suites are the likeliest to touch the execution path, so please run them with credentials before merging.
  6. Binary wire format and proxies. The PR notes that the browser transport defaults to the binary format. If BitGo's own proxies (express or other environments) only handle the base64 text format, GrpcWebFetchTransport would need format: 'text'. Worth confirming for any deployment that fronts the node with a proxy.

Verdict: Approve once the browser build and the two skipped suites pass. Suggestion 1 is the one I'd apply before merging.

@claude claude Bot 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.

I reviewed this PR and didn't find any bugs. It moves sdk-coin-sui to a new major version of @ mysten/sui, and that path has a CODEOWNER, so a human look is still worthwhile.

What was reviewed:

  • The grpcClient.ts refactor. Both the browser and Node paths now build their transport and pass it to one SuiGrpcClient constructor. The transport is stored in a WeakMap keyed by client. closeSuiGrpcClient evicts the cache entry before it closes the transport, and it does nothing when no transport was recorded.
  • The tests now check the SDK-built transport with instanceOf instead of reading the private _transport field.
  • Not checked: whether the 3.1.1 constructor and the GrpcWebFetchTransport export match the structural types in grpcClient.ts. The package isn't installed in this checkout. The PR says the browser bundle build and a real testnet transaction weren't tested either.
Extended reasoning...

The change bumps @ mysten/sui from 2.20.0 to 3.1.1 (exact pin) in sdk-coin-sui and regenerates yarn.lock, pulling in graphql 17, valibot 1.6 and @ mysten/bcs 2.1.4. It reworks how grpcClient.ts builds and closes the gRPC transport. It touches no auth or crypto code directly, but this client is the module's node-interaction path. Browser callers must now pass an absolute http(s) URL. I deferred because CODEOWNERS assigns modules/sdk-coin-sui/ and package.json to specific teams, and because a major SDK upgrade can only be fully checked against the 3.x types and a browser build, which this checkout can't provide.

This branch has not been deployed

No deployments
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.

1 participant