@mysten/sui 2.16.0 → 2.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
  3. package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
  4. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
  5. package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
  6. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
  7. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
  8. package/dist/jsonRpc/http-transport.mjs +1 -2
  9. package/dist/jsonRpc/http-transport.mjs.map +1 -1
  10. package/dist/transactions/Transaction.d.mts +7 -7
  11. package/dist/transactions/data/internal.d.mts +109 -109
  12. package/dist/transactions/data/internal.d.mts.map +1 -1
  13. package/dist/transactions/data/v1.d.mts +220 -220
  14. package/dist/transactions/data/v1.d.mts.map +1 -1
  15. package/dist/transactions/data/v2.d.mts +16 -16
  16. package/dist/version.mjs +2 -3
  17. package/dist/version.mjs.map +1 -1
  18. package/docs/bcs.md +17 -14
  19. package/docs/clients/core.md +68 -62
  20. package/docs/clients/graphql.md +6 -4
  21. package/docs/clients/grpc.md +18 -13
  22. package/docs/clients/index.md +17 -15
  23. package/docs/clients/json-rpc.md +21 -17
  24. package/docs/cryptography/keypairs.md +16 -7
  25. package/docs/cryptography/multisig.md +7 -5
  26. package/docs/cryptography/passkey.md +16 -15
  27. package/docs/cryptography/webcrypto-signer.md +9 -9
  28. package/docs/executors.md +25 -22
  29. package/docs/faucet.md +4 -4
  30. package/docs/hello-sui.md +8 -7
  31. package/docs/index.md +20 -21
  32. package/docs/install.md +4 -4
  33. package/docs/llm-docs.md +10 -10
  34. package/docs/llms-index.md +41 -57
  35. package/docs/migrations/0.38.md +10 -9
  36. package/docs/migrations/sui-1.0.md +35 -33
  37. package/docs/migrations/sui-2.0/agent-prompt.md +4 -4
  38. package/docs/migrations/sui-2.0/dapp-kit.md +47 -47
  39. package/docs/migrations/sui-2.0/deepbook-v3.md +2 -2
  40. package/docs/migrations/sui-2.0/index.md +38 -37
  41. package/docs/migrations/sui-2.0/json-rpc-migration.md +59 -50
  42. package/docs/migrations/sui-2.0/kiosk.md +9 -9
  43. package/docs/migrations/sui-2.0/sdk-maintainers.md +8 -8
  44. package/docs/migrations/sui-2.0/seal.md +2 -2
  45. package/docs/migrations/sui-2.0/sui.md +17 -17
  46. package/docs/migrations/sui-2.0/suins.md +6 -4
  47. package/docs/migrations/sui-2.0/wallet-builders.md +6 -6
  48. package/docs/migrations/sui-2.0/walrus.md +4 -4
  49. package/docs/migrations/sui-2.0/zksend.md +7 -6
  50. package/docs/plugins.md +19 -16
  51. package/docs/sdk-building.md +37 -33
  52. package/docs/transaction-building/basics.md +16 -14
  53. package/docs/transaction-building/gas.md +3 -4
  54. package/docs/transaction-building/intents.md +6 -5
  55. package/docs/transaction-building/offline.md +11 -9
  56. package/docs/transaction-building/sponsored-transactions.md +2 -2
  57. package/docs/utils/derived_objects.md +13 -13
  58. package/docs/utils/index.md +2 -2
  59. package/docs/zklogin.md +7 -2
  60. package/package.json +4 -5
  61. package/src/jsonRpc/http-transport.ts +1 -2
  62. package/src/version.ts +1 -2
  63. package/src/transactions/__tests__/Transaction.test.ts +0 -184
  64. package/src/transactions/__tests__/bcs.test.ts +0 -205
@@ -1,30 +1,30 @@
1
1
  # @mysten/dapp-kit
2
2
 
3
- > Migrate @mysten/dapp-kit to 2.0
3
+ > Migrate @mysten/dapp-kit to the new dapp-kit-react package in 2.0.
4
4
 
5
5
  This guide helps you migrate from the original `@mysten/dapp-kit` (legacy) to the new
6
6
  `@mysten/dapp-kit-react` package.
7
7
 
8
- > **Note:** The legacy `@mysten/dapp-kit` package will continue to work with the latest SDK, but it
9
- > only supports JSON-RPC and will not receive further updates. We recommend migrating to
8
+ > **Note:** The legacy `@mysten/dapp-kit` package will continue to work with the latest SDK, but it only
9
+ > supports JSON-RPC and will not receive further updates. We recommend migrating to
10
10
  > `@mysten/dapp-kit-react` for new features and gRPC support.
11
11
 
12
12
  ## Overview
13
13
 
14
- The new dApp Kit SDK represents a complete rewrite with these key changes:
14
+ The new dApp kit SDK represents a complete rewrite with these key changes:
15
15
 
16
- - **Framework agnostic**: Split into `@mysten/dapp-kit-core` (framework-agnostic) and
16
+ - Framework agnostic: Split into `@mysten/dapp-kit-core` (framework-agnostic) and
17
17
  `@mysten/dapp-kit-react` (React bindings)
18
- - **No React Query dependency**: Direct promise-based API instead of mutation hooks
19
- - **Web Components**: UI components built with Lit Elements for cross-framework compatibility
20
- - **Smaller bundle size**: No React Query dependency, lighter state management with nanostores
21
- - **Better SSR support**: Compatible with SSR frameworks like Next.js
22
- - **Cross-framework compatibility**: Core functionality can be used in vanilla JS, Vue, React, and
23
- other frameworks
18
+ - No React Query dependency: Direct promise-based API instead of mutation hooks
19
+ - Web Components: UI components built with Lit Elements for cross-framework compatibility
20
+ - Smaller bundle size: No React Query dependency, lighter state management with nanostores
21
+ - Better SSR support: Compatible with SSR frameworks like Next.js
22
+ - Cross-framework compatibility: Core functionality can be used in vanilla JS, Vue, React, and other
23
+ frameworks
24
24
 
25
- ## Step-by-Step Migration
25
+ ## Step-by-step migration
26
26
 
27
- ### 1. Update Dependencies
27
+ ### Step 1: Update dependencies
28
28
 
29
29
  Remove the old package and install the new ones:
30
30
 
@@ -33,9 +33,9 @@ npm uninstall @mysten/dapp-kit
33
33
  npm i @mysten/dapp-kit-react @mysten/dapp-kit-core @mysten/sui
34
34
  ```
35
35
 
36
- ### 2. Create dApp Kit Instance
36
+ ### Step 2: Create dApp Kit instance
37
37
 
38
- Create a new instance of the dApp Kit using the `createDAppKit` function and register the global
38
+ Create a new instance of the dApp kit using the `createDAppKit` function and register the global
39
39
  type.
40
40
 
41
41
  ```tsx
@@ -59,12 +59,12 @@ declare module '@mysten/dapp-kit-react' {
59
59
  }
60
60
  ```
61
61
 
62
- ### 3. Register Types
62
+ ### Step 3: Register types
63
63
 
64
- The `declare module` block in the previous step registers your dApp Kit instance's type globally.
64
+ The `declare module` block in the previous step registers your dApp kit instance's type globally.
65
65
  This enables all hooks like `useDAppKit()`, `useCurrentNetwork()`, and `useCurrentClient()` to
66
- automatically infer the correct types based on your configuration (e.g., your specific networks and
67
- client type).
66
+ automatically infer the correct types based on your configuration (for example, your specific
67
+ networks and client type).
68
68
 
69
69
  ```tsx
70
70
  declare module '@mysten/dapp-kit-react' {
@@ -83,9 +83,9 @@ const connection = useWalletConnection({ dAppKit });
83
83
  const network = useCurrentNetwork({ dAppKit });
84
84
  ```
85
85
 
86
- ### 4. Replace Provider Setup
86
+ ### Step 4: Replace provider setup
87
87
 
88
- Replace the nested dApp Kit providers with a single unified provider. You can keep your existing
88
+ Replace the nested dApp kit providers with a single unified provider. You can keep your existing
89
89
  `QueryClientProvider` for data fetching.
90
90
 
91
91
  ```diff
@@ -117,7 +117,7 @@ Replace the nested dApp Kit providers with a single unified provider. You can ke
117
117
  }
118
118
  ```
119
119
 
120
- ### 5. Configuration Option Changes
120
+ ### Step 5: Configuration option changes
121
121
 
122
122
  The `createDAppKit` function has different configuration options than the old `WalletProvider`:
123
123
 
@@ -136,24 +136,24 @@ The `createDAppKit` function has different configuration options than the old `W
136
136
  | `theme` | - | Removed (UI components are now web components with built-in styling) |
137
137
  | - | `walletInitializers` | New option for registering custom wallets |
138
138
 
139
- ### 6. Update Hook Usage
139
+ ### Step 6: Update hook usage
140
140
 
141
- The new dApp Kit has a dramatically simplified hook API. Most hooks from the original version have
141
+ The new dApp kit has a dramatically simplified hook API. Most hooks from the original version have
142
142
  been replaced with direct action calls through `useDAppKit()`.
143
143
 
144
144
  **Available hooks in the new version:**
145
145
 
146
- - `useDAppKit()` - Access the dAppKit instance for calling actions
147
- - `useCurrentClient()` - Get the blockchain client (renamed from `useSuiClient`)
148
- - `useCurrentAccount()` - Get the current connected account
149
- - `useCurrentWallet()` - Get the current connected wallet
150
- - `useWallets()` - Get the list of available wallets
151
- - `useWalletConnection()` - Get the current wallet connection status
152
- - `useCurrentNetwork()` - Get the current network
146
+ - `useDAppKit()`: Access the dAppKit instance for calling actions
147
+ - `useCurrentClient()`: Get the blockchain client (renamed from `useSuiClient`)
148
+ - `useCurrentAccount()`: Get the current connected account
149
+ - `useCurrentWallet()`: Get the current connected wallet
150
+ - `useWallets()`: Get the list of available wallets
151
+ - `useWalletConnection()`: Get the current wallet connection status
152
+ - `useCurrentNetwork()`: Get the current network
153
153
 
154
154
  **Removed hooks:**
155
155
 
156
- All wallet action hooks have been replaced with direct action calls via `useDAppKit()`:
156
+ All wallet action hooks have been replaced with direct action calls through `useDAppKit()`:
157
157
 
158
158
  - `useConnectWallet` -> Use `dAppKit.connectWallet()`
159
159
  - `useDisconnectWallet` -> Use `dAppKit.disconnectWallet()`
@@ -176,16 +176,16 @@ Other removed hooks:
176
176
  - `useAccounts` -> Use `useWalletConnection()` to access `connection.wallet.accounts`
177
177
  - `useWalletStore` -> Use specific hooks like `useWalletConnection()` instead
178
178
 
179
- ### 7. Replace Mutation Patterns
179
+ ### Step 7: Replace mutation patterns
180
180
 
181
181
  The built-in mutation hooks have been removed. Use TanStack Query's `useMutation` with
182
182
  `useDAppKit()` to get similar functionality.
183
183
 
184
184
  **Chain parameter replaced with network:**
185
185
 
186
- In the old dapp-kit, you could optionally pass a `chain` parameter (e.g., `sui:mainnet`) to methods
187
- like `signTransaction` and `signAndExecuteTransaction`. In the new dapp-kit, use the `network`
188
- parameter instead - the chain is automatically derived from the network.
186
+ In the old dApp kit, you could optionally pass a `chain` parameter (for example, `sui:mainnet`) to
187
+ methods like `signTransaction` and `signAndExecuteTransaction`. In the new dApp kit, use the
188
+ `network` parameter instead - the chain is automatically derived from the network.
189
189
 
190
190
  ```diff
191
191
  - const { mutateAsync: signAndExecute } = useSignAndExecuteTransaction();
@@ -249,7 +249,7 @@ If you don't need React Query's state management, you can call `dAppKit` methods
249
249
  }
250
250
  ```
251
251
 
252
- ### 8. Replace Data Fetching Patterns
252
+ ### Step 8: Replace data fetching patterns
253
253
 
254
254
  The built-in data fetching hooks have been removed. Use TanStack Query's `useQuery` with
255
255
  `useCurrentClient()` to get similar functionality:
@@ -295,17 +295,17 @@ If you don't need React Query's caching and state management, you can fetch data
295
295
  }
296
296
  ```
297
297
 
298
- ### 9. Update The Remaining Code
298
+ ### Step 9: Update the remaining code
299
299
 
300
- The following hooks from the original dApp Kit are not available anymore:
300
+ The following hooks from the original dApp kit are not available anymore:
301
301
 
302
302
  - `useSuiClientQuery` → Use `useQuery` from `@tanstack/react-query`
303
303
  - `useSuiClientMutation` → Use `useMutation` from `@tanstack/react-query`
304
304
  - `useSuiClientInfiniteQuery` → Use `useInfiniteQuery` from `@tanstack/react-query`
305
305
  - `useResolveSuiNSNames` → Use `useCurrentClient()` with the suins extension
306
306
 
307
- > **Warning:** The `reportTransactionEffects` feature is planned for deprecation in the
308
- > [Wallet Standard](https://docs.sui.io/standards/wallet-standard) and so the dApp Kit provides no
307
+ > **Warning:** The `reportTransactionEffects` feature is planned for deprecation in the [Wallet
308
+ > Standard](https://docs.sui.io/standards/wallet-standard) and so the dApp kit provides no
309
309
  > replacement.
310
310
 
311
311
  The following have been removed:
@@ -314,18 +314,18 @@ The following have been removed:
314
314
  - `reportTransactionEffects` callback from `useSignTransaction`
315
315
  - Automatic transaction effects reporting from `useSignAndExecuteTransaction`
316
316
 
317
- ## CSS and Theming Changes
317
+ ## CSS and theming changes
318
318
 
319
- The new dApp Kit no longer bundles a CSS file. If you were importing the old CSS file, remove the
319
+ The new dApp kit no longer bundles a CSS file. If you were importing the old CSS file, remove the
320
320
  import:
321
321
 
322
322
  ```diff
323
323
  - import '@mysten/dapp-kit/dist/full/index.css';
324
324
  ```
325
325
 
326
- The new dApp Kit uses web components with built-in styling that can be customized using CSS custom
326
+ The new dApp kit uses web components with built-in styling that can be customized using CSS custom
327
327
  properties. See the [Theming documentation](/dapp-kit/theming) for details on customizing the
328
- appearance of dApp Kit components.
328
+ appearance of dApp kit components.
329
329
 
330
330
  **Quick theme setup:**
331
331
 
@@ -342,9 +342,9 @@ appearance of dApp Kit components.
342
342
 
343
343
  ## Removing TanStack Query
344
344
 
345
- If you were only using `@tanstack/react-query` for dApp Kit and don't need it for other parts of
345
+ If you were only using `@tanstack/react-query` for dApp kit and don't need it for other parts of
346
346
  your application, you can now remove it:
347
347
 
348
348
  ```bash
349
349
  npm uninstall @tanstack/react-query
350
- ```
350
+ ```
@@ -1,6 +1,6 @@
1
1
  # @mysten/deepbook-v3
2
2
 
3
- > Migrate @mysten/deepbook-v3 to 2.0
3
+ > Migrate @mysten/deepbook-v3 to 2.0 with client extension pattern.
4
4
 
5
5
  This package now exports a client extension that integrates with Sui clients.
6
6
 
@@ -30,4 +30,4 @@ This package now exports a client extension that integrates with Sui clients.
30
30
 
31
31
  - await deepBookClient.checkManagerBalance(manager, asset);
32
32
  + await client.deepbook.checkManagerBalance(manager, asset);
33
- ```
33
+ ```
@@ -1,6 +1,6 @@
1
1
  # Migrate to 2.0
2
2
 
3
- > Migration guide for Sui TypeScript SDK 2.0
3
+ > Migration guide for Sui TypeScript SDK 2.0 covering all @mysten packages.
4
4
 
5
5
  This guide covers the breaking changes across the latest release of all the `@mysten/*` packages.
6
6
 
@@ -9,24 +9,24 @@ SDKs. These releases also include removals of deprecated APIs, some renaming for
9
9
  and significant internal refactoring to improve maintainability. Starting with this release, Mysten
10
10
  packages will now be published as ESM only packages.
11
11
 
12
- ## Quick Reference
12
+ ## Quick reference
13
13
 
14
14
  | Package | Key Changes |
15
15
  | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
16
- | [@mysten/sui](/sui/migrations/sui-2.0/sui) | Client API stabilization, SuiClient removal, BCS schema alignment, transaction executors |
17
- | [@mysten/dapp-kit](/sui/migrations/sui-2.0/dapp-kit) | Complete rewrite with framework-agnostic core |
18
- | [@mysten/kiosk](/sui/migrations/sui-2.0/kiosk) | Client extension pattern, low-level helpers removed, KioskTransaction pattern |
19
- | [@mysten/zksend](/sui/migrations/sui-2.0/zksend) | Client extension pattern |
20
- | [@mysten/suins](/sui/migrations/sui-2.0/suins) | Client extension pattern |
21
- | [@mysten/deepbook-v3](/sui/migrations/sui-2.0/deepbook-v3) | Client extension pattern |
22
- | [@mysten/walrus](/sui/migrations/sui-2.0/walrus) | Client extension pattern, requires client instead of RPC URL |
23
- | [@mysten/seal](/sui/migrations/sui-2.0/seal) | Client extension pattern |
24
- | [@mysten/wallet-standard](/sui/migrations/sui-2.0/wallet-builders) | Removal of reportTransactionEffects, new core API response format |
16
+ | [`@mysten/sui`](/sui/migrations/sui-2.0/sui) | Client API stabilization, SuiClient removal, BCS schema alignment, transaction executors |
17
+ | [`@mysten/dapp-kit`](/sui/migrations/sui-2.0/dapp-kit) | Complete rewrite with framework-agnostic core |
18
+ | [`@mysten/kiosk`](/sui/migrations/sui-2.0/kiosk) | Client extension pattern, low-level helpers removed, KioskTransaction pattern |
19
+ | [`@mysten/zksend`](/sui/migrations/sui-2.0/zksend) | Client extension pattern |
20
+ | [`@mysten/suins`](/sui/migrations/sui-2.0/suins) | Client extension pattern |
21
+ | [`@mysten/deepbook-v3`](/sui/migrations/sui-2.0/deepbook-v3) | Client extension pattern |
22
+ | [`@mysten/walrus`](/sui/migrations/sui-2.0/walrus) | Client extension pattern, requires client instead of RPC URL |
23
+ | [`@mysten/seal`](/sui/migrations/sui-2.0/seal) | Client extension pattern |
24
+ | [`@mysten/wallet-standard`](/sui/migrations/sui-2.0/wallet-builders) | Removal of reportTransactionEffects, new core API response format |
25
25
  | [Migrating from JSON-RPC](/sui/migrations/sui-2.0/json-rpc-migration) | Migrate from deprecated JSON-RPC to gRPC and GraphQL |
26
26
 
27
- ## Common Migration Patterns
27
+ ## Common migration patterns
28
28
 
29
- ### ESM Migration
29
+ ### ESM migration
30
30
 
31
31
  All `@mysten/*` packages are now ESM only. If your project does not already use ESM, you will need
32
32
  to add `"type": "module"` to your `package.json`:
@@ -49,13 +49,13 @@ need to update your `tsconfig.json` to use `"NodeNext"`, `"Node16"`, or `"Bundle
49
49
  }
50
50
  ```
51
51
 
52
- This enables proper resolution of the SDK's subpath exports (e.g., `@mysten/sui/client`,
52
+ This enables proper resolution of the SDK's subpath exports (for example, `@mysten/sui/client`,
53
53
  `@mysten/sui/transactions`).
54
54
 
55
- If you maintain a library that depends on any of the `@mysten/*` packages, you may also need to
55
+ If you maintain a library that depends on any of the `@mysten/*` packages, you might also need to
56
56
  update your library to be ESM only to ensure it works correctly everywhere.
57
57
 
58
- Applications using bundlers and recent Node.js versions (>=22) may still work when using `require`
58
+ Applications using bundlers and recent Node.js versions (>=22) might still work when using `require`
59
59
  to load ESM packages, but we recommend migrating to ESM.
60
60
 
61
61
  **Why ESM only?** Many packages in the ecosystem (specifically critical cryptography dependencies)
@@ -63,7 +63,7 @@ are now published as ESM only. Supporting CommonJS has prevented us from using t
63
63
  of these dependencies, making our SDKs harder to maintain and risking missing critical security
64
64
  updates.
65
65
 
66
- ### Client Migration
66
+ ### Client migration
67
67
 
68
68
  The most common change across all SDKs is migrating from `SuiClient` to `SuiJsonRpcClient`:
69
69
 
@@ -78,7 +78,7 @@ The most common change across all SDKs is migrating from `SuiClient` to `SuiJson
78
78
  + });
79
79
  ```
80
80
 
81
- We also recommend moving from the deprecated JSON RPC Apis to the new gRPC API as soon as possible:
81
+ We also recommend moving from the deprecated JSON RPC APIs to the new gRPC API as soon as possible:
82
82
 
83
83
  ```diff
84
84
  - import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
@@ -91,7 +91,7 @@ We also recommend moving from the deprecated JSON RPC Apis to the new gRPC API a
91
91
  The gRPC runs on full nodes so in most cases you should be able to use the same URLs when migrating
92
92
  to gRPC.
93
93
 
94
- ### Network Parameter Required
94
+ ### Network parameter required
95
95
 
96
96
  All client constructors now require an explicit `network` parameter:
97
97
 
@@ -112,46 +112,47 @@ const grpcClient = new SuiGrpcClient({
112
112
  });
113
113
  ```
114
114
 
115
- ### ClientWithCoreApi Interface
115
+ ### `ClientWithCoreApi` Interface
116
116
 
117
117
  Many SDK methods now accept any client implementing `ClientWithCoreApi`, enabling use with JSON-RPC,
118
118
  GraphQL, or gRPC transports:
119
119
 
120
120
  ```ts
121
+
121
122
  // All of these work with APIs that accept ClientWithCoreApi
122
123
  const jsonRpcClient = new SuiJsonRpcClient({ url, network: 'mainnet' });
123
124
  const graphqlClient = new SuiGraphQLClient({ url, network: 'mainnet' });
124
125
  const grpcClient = new SuiGrpcClient({ baseUrl, network: 'mainnet' });
125
126
  ```
126
127
 
127
- ## Package-Specific Guides
128
+ ## Package-specific guides
128
129
 
129
130
  For detailed migration instructions, see the SDK-specific guides:
130
131
 
131
- - **[@mysten/sui](/sui/migrations/sui-2.0/sui)** - Core SDK changes including client API, BCS
132
+ - **[`@mysten/sui`](/sui/migrations/sui-2.0/sui):** Core SDK changes including client API, BCS
132
133
  schemas, transactions, zkLogin, and GraphQL
133
- - **[@mysten/dapp-kit](/sui/migrations/sui-2.0/dapp-kit)** - Complete migration guide for the new
134
- dApp Kit architecture
135
- - **[@mysten/kiosk](/sui/migrations/sui-2.0/kiosk)** - Kiosk SDK now exports a client extension,
134
+ - **[`@mysten/dapp-kit`](/sui/migrations/sui-2.0/dapp-kit):** Complete migration guide for the new
135
+ dApp kit architecture
136
+ - **[`@mysten/kiosk`](/sui/migrations/sui-2.0/kiosk):** Kiosk SDK now exports a client extension,
136
137
  low-level helpers removed
137
- - **[@mysten/zksend](/sui/migrations/sui-2.0/zksend)** - zkSend SDK now exports a client extension
138
- - **[@mysten/suins](/sui/migrations/sui-2.0/suins)** - SuiNS now exports a client extension
139
- - **[@mysten/deepbook-v3](/sui/migrations/sui-2.0/deepbook-v3)** - DeepBook DEX now exports a client
140
- extension
141
- - **[@mysten/walrus](/sui/migrations/sui-2.0/walrus)** - Walrus storage now exports a client
138
+ - **[`@mysten/zksend`](/sui/migrations/sui-2.0/zksend):** zkSend SDK now exports a client extension
139
+ - **[`@mysten/suins`](/sui/migrations/sui-2.0/suins):** SuiNS now exports a client extension
140
+ - **[`@mysten/deepbook-v3`](/sui/migrations/sui-2.0/deepbook-v3):** DeepBook DEX now exports a
141
+ client extension
142
+ - **[`@mysten/walrus`](/sui/migrations/sui-2.0/walrus):** Walrus storage now exports a client
142
143
  extension
143
- - **[@mysten/seal](/sui/migrations/sui-2.0/seal)** - Seal encryption now exports a client extension
144
+ - **[`@mysten/seal`](/sui/migrations/sui-2.0/seal):** Seal encryption now exports a client extension
144
145
 
145
- ## Transport Migration
146
+ ## Transport migration
146
147
 
147
- - **[Migrating from JSON-RPC](/sui/migrations/sui-2.0/json-rpc-migration)** - Migrate from the
148
+ - **[Migrating from JSON-RPC](/sui/migrations/sui-2.0/json-rpc-migration):** Migrate from the
148
149
  deprecated JSON-RPC client to gRPC and GraphQL
149
150
 
150
- ## Ecosystem Migration Guides
151
+ ## Ecosystem migration guides
151
152
 
152
153
  For wallet builders and SDK maintainers building on the Sui ecosystem:
153
154
 
154
- - **[Wallet Builders](/sui/migrations/sui-2.0/wallet-builders)** - Guide for wallet implementations
155
+ - **[Wallet builders](/sui/migrations/sui-2.0/wallet-builders):** Guide for wallet implementations
155
156
  adapting to `reportTransactionEffects` removal and new core API response format
156
- - **[SDK Maintainers](/sui/migrations/sui-2.0/sdk-maintainers)** - Guide for SDK authors migrating
157
- to `ClientWithCoreApi` and the new transport-agnostic architecture
157
+ - **[SDK maintainers](/sui/migrations/sui-2.0/sdk-maintainers):** Guide for SDK authors migrating to
158
+ `ClientWithCoreApi` and the new transport-agnostic architecture
@@ -1,21 +1,21 @@
1
1
  # Migrating from JSON-RPC
2
2
 
3
- > Migrate from JSON-RPC to the new Core API
3
+ > Migrate from JSON-RPC to the new Core API using SuiGrpcClient or SuiGraphQLClient.
4
4
 
5
5
  This guide covers migrating from `SuiJsonRpcClient` to the new client APIs. The JSON-RPC API is
6
6
  being deprecated in favor of `SuiGrpcClient` and `SuiGraphQLClient`.
7
7
 
8
- > **Note:** We recommend using `SuiGrpcClient` for most operations and `SuiGraphQLClient` for
9
- > complex queries like filtering transactions and events.
8
+ > **Note:** We recommend using `SuiGrpcClient` for most operations and `SuiGraphQLClient` for complex queries
9
+ > like filtering transactions and events.
10
10
 
11
- ## Choosing a Client
11
+ ## Choosing a client
12
12
 
13
13
  | Client | Best For |
14
14
  | ------------------ | --------------------------------------------------------------- |
15
15
  | `SuiGrpcClient` | Most operations, SDK integrations, real-time data |
16
16
  | `SuiGraphQLClient` | Complex queries, filtering transactions/events, historical data |
17
17
 
18
- ## Quick Migration to gRPC
18
+ ## Quick migration to gRPC
19
19
 
20
20
  For most use cases, migrate to `SuiGrpcClient`:
21
21
 
@@ -35,13 +35,13 @@ For most use cases, migrate to `SuiGrpcClient`:
35
35
 
36
36
  Both clients use the same full node URLs, so you can use the same endpoint when migrating.
37
37
 
38
- ## Core API Methods
38
+ ## Core API methods
39
39
 
40
40
  The gRPC client should work with almost all mysten SDKs as a drop in replacement for the JSON-RPC
41
41
  client. When using the client directly, the methods and data returned will not be exactly the same
42
42
  as what was available in JSON-RPC.
43
43
 
44
- ## Methods Replaced by Core API
44
+ ## Methods replaced by core API
45
45
 
46
46
  These JSON-RPC methods have direct replacements in the core API:
47
47
 
@@ -88,30 +88,31 @@ These JSON-RPC methods have direct replacements in the core API:
88
88
  + });
89
89
  ```
90
90
 
91
- ## Methods Replaced by gRPC Services
91
+ ## Methods replaced by gRPC services
92
92
 
93
93
  These JSON-RPC methods can be replaced by calling gRPC service clients directly:
94
94
 
95
- | JSON-RPC Method | gRPC Service Replacement |
96
- | ----------------------------------- | --------------------------------- |
97
- | `getCheckpoint` | `ledgerService.getCheckpoint` |
98
- | `getCheckpoints` | `ledgerService.listCheckpoints` |
99
- | `getLatestCheckpointSequenceNumber` | `ledgerService.getCheckpoint` |
100
- | `getEpochs` | `ledgerService.listEpochs` |
101
- | `getCurrentEpoch` | `ledgerService.getEpoch` |
102
- | `getLatestSuiSystemState` | `ledgerService.getSystemState` |
103
- | `getCommitteeInfo` | `ledgerService.getCommittee` |
104
- | `getValidatorsApy` | `ledgerService.getValidators` |
105
- | `getProtocolConfig` | `ledgerService.getProtocolConfig` |
106
- | `getNormalizedMoveModule` | `movePackageService.getModule` |
107
- | `getNormalizedMoveModulesByPackage` | `movePackageService.getPackage` |
108
- | `getNormalizedMoveStruct` | `movePackageService.getStruct` |
109
- | `resolveNameServiceAddress` | `nameService.lookupName` |
110
- | `resolveNameServiceNames` | `nameService.reverseLookupName` |
111
-
112
- ### Example: Using gRPC Service Clients
95
+ | JSON-RPC Method | gRPC Service Replacement |
96
+ | ----------------------------------- | --------------------------------------------------------------- |
97
+ | `getCheckpoint` | `ledgerService.getCheckpoint` |
98
+ | `getCheckpoints` | `ledgerService.listCheckpoints` |
99
+ | `getLatestCheckpointSequenceNumber` | `ledgerService.getCheckpoint` |
100
+ | `getEpochs` | `ledgerService.listEpochs` |
101
+ | `getCurrentEpoch` | `ledgerService.getEpoch` |
102
+ | `getLatestSuiSystemState` | `ledgerService.getSystemState` |
103
+ | `getCommitteeInfo` | `ledgerService.getCommittee` |
104
+ | `getValidatorsApy` | `ledgerService.getValidators` |
105
+ | `getProtocolConfig` | `ledgerService.getProtocolConfig` |
106
+ | `getNormalizedMoveModule` | `movePackageService.getPackage` (response includes all modules) |
107
+ | `getNormalizedMoveModulesByPackage` | `movePackageService.getPackage` |
108
+ | `getNormalizedMoveStruct` | `movePackageService.getDatatype` |
109
+ | `resolveNameServiceAddress` | `nameService.lookupName` |
110
+ | `resolveNameServiceNames` | `nameService.reverseLookupName` |
111
+
112
+ ### Example: using gRPC service clients
113
113
 
114
114
  ```typescript
115
+
115
116
  const client = new SuiGrpcClient({
116
117
  baseUrl: 'https://fullnode.mainnet.sui.io:443',
117
118
  network: 'mainnet',
@@ -125,10 +126,16 @@ const { response } = await client.ledgerService.getCheckpoint({
125
126
  // Get current epoch
126
127
  const { response: epoch } = await client.ledgerService.getEpoch({});
127
128
 
128
- // Get Move module information
129
- const { response: module } = await client.movePackageService.getModule({
129
+ // Get Move package information (includes all modules)
130
+ const { response: pkg } = await client.movePackageService.getPackage({
131
+ packageId: '0x2',
132
+ });
133
+
134
+ // Get a specific Move datatype (struct or enum)
135
+ const { response: datatype } = await client.movePackageService.getDatatype({
130
136
  packageId: '0x2',
131
137
  moduleName: 'coin',
138
+ name: 'Coin',
132
139
  });
133
140
 
134
141
  // Resolve SuiNS name
@@ -137,7 +144,7 @@ const { response: address } = await client.nameService.lookupName({
137
144
  });
138
145
  ```
139
146
 
140
- ## Methods Requiring GraphQL
147
+ ## Methods requiring GraphQL
141
148
 
142
149
  Some JSON-RPC methods don't have gRPC equivalents and require using `SuiGraphQLClient` instead:
143
150
 
@@ -155,16 +162,17 @@ Some JSON-RPC methods don't have gRPC equivalents and require using `SuiGraphQLC
155
162
  | `getAddressMetrics` | Use indexer |
156
163
  | `getMoveCallMetrics` | Use indexer |
157
164
 
158
- ### Setting Up GraphQL Client
165
+ ### Setting up GraphQL client
159
166
 
160
167
  ```typescript
168
+
161
169
  const graphqlClient = new SuiGraphQLClient({
162
170
  url: 'https://sui-mainnet.mystenlabs.com/graphql',
163
171
  network: 'mainnet',
164
172
  });
165
173
  ```
166
174
 
167
- ### Querying Transactions
175
+ ### Querying transactions
168
176
 
169
177
  Replace `queryTransactionBlocks` with a GraphQL query:
170
178
 
@@ -200,14 +208,14 @@ const result = await graphqlClient.query({
200
208
 
201
209
  **Available transaction filters:**
202
210
 
203
- - `sentAddress` - Filter by sender address
204
- - `affectedAddress` - Filter by any address involved in the transaction
205
- - `affectedObject` - Filter by object ID that was affected
206
- - `function` - Filter by Move function called (e.g., `0x2::coin::transfer`)
207
- - `kind` - Filter by transaction kind (`SYSTEM` or `PROGRAMMABLE`)
211
+ - `sentAddress`: Filter by sender address
212
+ - `affectedAddress`: Filter by any address involved in the transaction
213
+ - `affectedObject`: Filter by object ID that was affected
214
+ - `function`: Filter by Move function called (for example, `0x2::coin::transfer`)
215
+ - `kind`: Filter by transaction kind (`SYSTEM` or `PROGRAMMABLE`)
208
216
  - `atCheckpoint` / `beforeCheckpoint` / `afterCheckpoint` - Filter by checkpoint
209
217
 
210
- ### Querying Events
218
+ ### Querying events
211
219
 
212
220
  Replace `queryEvents` with a GraphQL query:
213
221
 
@@ -247,12 +255,12 @@ const result = await graphqlClient.query({
247
255
 
248
256
  **Available event filters:**
249
257
 
250
- - `type` - Filter by event type (package, package::module, or full type)
251
- - `module` - Filter by emitting module
252
- - `sender` - Filter by transaction sender
253
- - `atCheckpoint` / `beforeCheckpoint` / `afterCheckpoint` - Filter by checkpoint
258
+ - `type`: Filter by event type (package, package::module, or full type)
259
+ - `module`: Filter by emitting module
260
+ - `sender`: Filter by transaction sender
261
+ - `atCheckpoint` / `beforeCheckpoint` / `afterCheckpoint`: Filter by checkpoint
254
262
 
255
- ### Fetching Multiple Transactions
263
+ ### Fetching multiple transactions
256
264
 
257
265
  Replace `multiGetTransactionBlocks` with a GraphQL query:
258
266
 
@@ -276,7 +284,7 @@ const result = await graphqlClient.query({
276
284
  });
277
285
  ```
278
286
 
279
- ### Querying Historical Objects
287
+ ### Querying historical objects
280
288
 
281
289
  Replace `tryGetPastObject` with a GraphQL query specifying a version:
282
290
 
@@ -304,7 +312,7 @@ const result = await graphqlClient.query({
304
312
  });
305
313
  ```
306
314
 
307
- ### Querying Coin Metadata
315
+ ### Querying coin metadata
308
316
 
309
317
  Replace `getCoinMetadata` and `getTotalSupply` with a GraphQL query:
310
318
 
@@ -328,7 +336,7 @@ const result = await graphqlClient.query({
328
336
  });
329
337
  ```
330
338
 
331
- ### Querying Staked SUI
339
+ ### Querying staked SUI
332
340
 
333
341
  Replace `getStakes` with a GraphQL query:
334
342
 
@@ -356,10 +364,10 @@ const result = await graphqlClient.query({
356
364
  });
357
365
  ```
358
366
 
359
- ## Response Format Differences
367
+ ## Response format differences
360
368
 
361
369
  The gRPC client uses the core API response format, which differs from JSON-RPC responses. See the
362
- [@mysten/sui migration guide](/sui/migrations/sui-2.0/sui#transaction-executors-now-accept-any-client)
370
+ [`@mysten/sui` migration guide](/sui/migrations/sui-2.0/sui#transaction-executors-now-accept-any-client)
363
371
  for details on the new response format.
364
372
 
365
373
  Key differences:
@@ -375,11 +383,12 @@ Key differences:
375
383
  + { effects: true, events: true }
376
384
  ```
377
385
 
378
- ## Client Extensions
386
+ ## Client extensions
379
387
 
380
388
  Client extensions work the same way with both clients:
381
389
 
382
390
  ```typescript
391
+
383
392
  const client = new SuiGrpcClient({
384
393
  baseUrl: 'https://fullnode.mainnet.sui.io:443',
385
394
  network: 'mainnet',
@@ -390,10 +399,10 @@ await client.deepbook.checkManagerBalance(manager, asset);
390
399
  await client.suins.getName('0xabc...');
391
400
  ```
392
401
 
393
- ## See Also
402
+ ## See also
394
403
 
395
404
  - [SuiGrpcClient Documentation](/sui/clients/grpc) - Full gRPC client documentation
396
405
  - [SuiGraphQLClient Documentation](/sui/clients/graphql) - GraphQL client documentation
397
406
  - [Core API](/sui/clients/core) - Transport-agnostic API methods
398
407
  - [gRPC Overview](https://docs.sui.io/concepts/data-access/grpc-overview) - Sui gRPC API
399
- documentation
408
+ documentation