@mysten/sui 2.23.2 → 2.25.0

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 (86) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +9 -9
  3. package/dist/bcs/bcs.d.mts +6 -6
  4. package/dist/client/core.d.mts +1 -0
  5. package/dist/client/core.d.mts.map +1 -1
  6. package/dist/client/core.mjs +4 -1
  7. package/dist/client/core.mjs.map +1 -1
  8. package/dist/client/mvr.d.mts.map +1 -1
  9. package/dist/client/mvr.mjs +1 -0
  10. package/dist/client/mvr.mjs.map +1 -1
  11. package/dist/client/types.d.mts +7 -0
  12. package/dist/client/types.d.mts.map +1 -1
  13. package/dist/cryptography/signature.d.mts +6 -6
  14. package/dist/graphql/client.d.mts +6 -1
  15. package/dist/graphql/client.d.mts.map +1 -1
  16. package/dist/graphql/client.mjs +18 -2
  17. package/dist/graphql/client.mjs.map +1 -1
  18. package/dist/graphql/core.d.mts +5 -4
  19. package/dist/graphql/core.d.mts.map +1 -1
  20. package/dist/graphql/core.mjs +60 -14
  21. package/dist/graphql/core.mjs.map +1 -1
  22. package/dist/graphql/generated/queries.d.mts.map +1 -1
  23. package/dist/graphql/generated/queries.mjs +8 -1
  24. package/dist/graphql/generated/queries.mjs.map +1 -1
  25. package/dist/graphql/generated/tada-env.d.mts +16 -0
  26. package/dist/grpc/client.d.mts +6 -1
  27. package/dist/grpc/client.d.mts.map +1 -1
  28. package/dist/grpc/client.mjs +17 -2
  29. package/dist/grpc/client.mjs.map +1 -1
  30. package/dist/grpc/core.d.mts +1 -0
  31. package/dist/grpc/core.d.mts.map +1 -1
  32. package/dist/grpc/core.mjs +20 -0
  33. package/dist/grpc/core.mjs.map +1 -1
  34. package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
  35. package/dist/grpc/proto/sui/rpc/v2/name_service.client.d.mts +4 -4
  36. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
  37. package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
  38. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
  39. package/dist/jsonRpc/client.d.mts.map +1 -1
  40. package/dist/jsonRpc/client.mjs +60 -15
  41. package/dist/jsonRpc/client.mjs.map +1 -1
  42. package/dist/jsonRpc/core.d.mts +6 -1
  43. package/dist/jsonRpc/core.d.mts.map +1 -1
  44. package/dist/jsonRpc/core.mjs +25 -7
  45. package/dist/jsonRpc/core.mjs.map +1 -1
  46. package/dist/version.mjs +1 -1
  47. package/dist/version.mjs.map +1 -1
  48. package/dist/zklogin/bcs.d.mts +14 -14
  49. package/docs/bcs.md +2 -2
  50. package/docs/clients/core.md +151 -690
  51. package/docs/clients/executing.md +113 -0
  52. package/docs/clients/graphql.md +91 -46
  53. package/docs/clients/grpc.md +239 -142
  54. package/docs/clients/index.md +87 -51
  55. package/docs/clients/querying.md +539 -0
  56. package/docs/executors.md +28 -13
  57. package/docs/index.md +1 -1
  58. package/docs/llms-index.md +18 -17
  59. package/docs/migrations/sui-2.0/dapp-kit.md +3 -3
  60. package/docs/migrations/sui-2.0/deepbook-v3.md +2 -2
  61. package/docs/migrations/sui-2.0/index.md +46 -25
  62. package/docs/migrations/sui-2.0/json-rpc-migration.md +462 -284
  63. package/docs/migrations/sui-2.0/kiosk.md +10 -9
  64. package/docs/migrations/sui-2.0/sdk-maintainers.md +17 -11
  65. package/docs/migrations/sui-2.0/sui.md +47 -29
  66. package/docs/migrations/sui-2.0/suins.md +2 -2
  67. package/docs/migrations/sui-2.0/walrus.md +3 -3
  68. package/docs/migrations/sui-2.0/zksend.md +9 -8
  69. package/docs/sdk-building.md +7 -5
  70. package/docs/transactions/signing-and-execution.md +8 -28
  71. package/package.json +1 -1
  72. package/src/client/core.ts +5 -0
  73. package/src/client/mvr.ts +6 -0
  74. package/src/client/types.ts +11 -0
  75. package/src/graphql/client.ts +35 -2
  76. package/src/graphql/core.ts +57 -10
  77. package/src/graphql/generated/queries.ts +14 -0
  78. package/src/graphql/generated/schema.graphql +11 -1
  79. package/src/graphql/generated/tada-env.ts +20 -0
  80. package/src/graphql/queries/nameService.graphql +6 -0
  81. package/src/grpc/client.ts +34 -2
  82. package/src/grpc/core.ts +35 -0
  83. package/src/jsonRpc/client.ts +15 -0
  84. package/src/jsonRpc/core.ts +31 -6
  85. package/src/version.ts +1 -1
  86. package/docs/clients/json-rpc.md +0 -239
@@ -3,11 +3,12 @@
3
3
 
4
4
  - [Sui TypeScript SDK](..md): TypeScript SDK for building on the Sui blockchain
5
5
  - [LLM Documentation](./llm-docs.md): Give AI agents access to Sui SDK documentation in your project.
6
- - [Sui Clients](./clients.md): Choose and configure gRPC, GraphQL, or JSON-RPC clients for the Sui network.
7
- - [Core API](./clients/core.md): Transport-agnostic Core API shared by all Sui clients.
8
- - [SuiGrpcClient](./clients/grpc.md): Connect to Sui through gRPC with SuiGrpcClient.
9
- - [SuiGraphQLClient](./clients/graphql.md): Connect to Sui through GraphQL with SuiGraphQLClient.
10
- - [SuiJsonRpcClient](./clients/json-rpc.md): Connect to Sui through JSON-RPC with SuiJsonRpcClient.
6
+ - [Sui Clients](./clients.md): Choose between SuiGrpcClient and SuiGraphQLClient and understand their shared API
7
+ - [Querying Data](./clients/querying.md): Read objects, coins, balances, dynamic fields, and history with any Sui client
8
+ - [Executing Transactions](./clients/executing.md): Simulate, execute, and wait for transactions with any Sui client
9
+ - [SuiGrpcClient](./clients/grpc.md): Connect to Sui over gRPC, with native service clients and real-time subscriptions
10
+ - [SuiGraphQLClient](./clients/graphql.md): Connect to Sui over GraphQL and write type-safe custom queries
11
+ - [Core API](./clients/core.md): The transport-agnostic client contract that SDKs and libraries build against
11
12
  - [Building Transactions](./transactions/basics.md): Construct programmable transaction blocks with the Transaction API
12
13
  - [Signing and Execution](./transactions/signing-and-execution.md): Sign transactions and execute them on the Sui network
13
14
  - [Coins and Balances](./transactions/coins-and-balances.md): Work with coin objects and address balances in transactions
@@ -26,21 +27,21 @@
26
27
  - [Derived Objects](./utils/derived_objects.md): Compute derived object IDs from parent objects for deterministic offline derivation.
27
28
  - [BCS](./bcs.md): Binary Canonical Serialization for encoding Sui Move types.
28
29
  - [ZkLogin](./zklogin.md): Zero-knowledge authentication with OAuth providers on Sui.
29
- - [Transaction Executors](./executors.md): Manage transaction execution with queuing and parallel strategies.
30
+ - [Transaction Executors](./executors.md): Manage transaction execution with queuing and parallel strategies
30
31
  - [Transaction Plugins](./plugins.md): Extend transaction building with reusable plugins.
31
- - [Building SDKs](./sdk-building.md): Build custom SDKs on top of the Sui TypeScript SDK.
32
- - [Migrate to 2.0](./migrations/sui-2.0.md): Migration guide for Sui TypeScript SDK 2.0 covering all @mysten packages.
32
+ - [Building SDKs](./sdk-building.md): Build custom SDKs on top of the Sui TypeScript SDK
33
+ - [Migrate to 2.0](./migrations/sui-2.0.md): Migration guide for Sui TypeScript SDK 2.0 covering all @mysten packages
33
34
  - [Agent Migration Prompt](./migrations/sui-2.0/agent-prompt.md): AI agent prompt for automated SDK 2.0 migration of your codebase.
34
- - [@mysten/sui](./migrations/sui-2.0/sui.md): Migrate @mysten/sui from 1.x to 2.0 with new client APIs and BCS changes.
35
- - [Migrating from JSON-RPC](./migrations/sui-2.0/json-rpc-migration.md): Migrate from JSON-RPC to the new Core API using SuiGrpcClient or SuiGraphQLClient.
36
- - [@mysten/dapp-kit](./migrations/sui-2.0/dapp-kit.md): Migrate @mysten/dapp-kit to the new dapp-kit-react package in 2.0.
37
- - [@mysten/kiosk](./migrations/sui-2.0/kiosk.md): Migrate @mysten/kiosk to 2.0 with client extension pattern and KioskTransaction.
38
- - [@mysten/zksend](./migrations/sui-2.0/zksend.md): Migrate @mysten/zksend to 2.0 with client extension pattern and simplified API.
39
- - [@mysten/suins](./migrations/sui-2.0/suins.md): Migrate @mysten/suins to 2.0 with client extension pattern.
40
- - [@mysten/deepbook-v3](./migrations/sui-2.0/deepbook-v3.md): Migrate @mysten/deepbook-v3 to 2.0 with client extension pattern.
41
- - [@mysten/walrus](./migrations/sui-2.0/walrus.md): Migrate @mysten/walrus to 2.0 with required client parameter and updated API.
35
+ - [@mysten/sui](./migrations/sui-2.0/sui.md): Migrate @mysten/sui from 1.x to 2.0 with gRPC clients, Core API, and BCS changes
36
+ - [Migrating from JSON-RPC](./migrations/sui-2.0/json-rpc-migration.md): Migrate deprecated JSON-RPC code to shared gRPC and GraphQL top-level methods
37
+ - [@mysten/dapp-kit](./migrations/sui-2.0/dapp-kit.md): Migrate @mysten/dapp-kit to the new dapp-kit-react package in 2.0
38
+ - [@mysten/kiosk](./migrations/sui-2.0/kiosk.md): Migrate @mysten/kiosk to 2.0 with client extension pattern and KioskTransaction
39
+ - [@mysten/zksend](./migrations/sui-2.0/zksend.md): Migrate @mysten/zksend to 2.0 with client extension pattern and simplified API
40
+ - [@mysten/suins](./migrations/sui-2.0/suins.md): Migrate @mysten/suins to 2.0 with client extension pattern
41
+ - [@mysten/deepbook-v3](./migrations/sui-2.0/deepbook-v3.md): Migrate @mysten/deepbook-v3 to 2.0 with client extension pattern
42
+ - [@mysten/walrus](./migrations/sui-2.0/walrus.md): Migrate @mysten/walrus to 2.0 with required client parameter and updated API
42
43
  - [@mysten/seal](./migrations/sui-2.0/seal.md): Migrate @mysten/seal to 2.0 with the new registration function pattern.
43
44
  - [Wallet Builders](./migrations/sui-2.0/wallet-builders.md): Migration guide for wallet extension developers upgrading to 2.0.
44
- - [SDK Maintainers](./migrations/sui-2.0/sdk-maintainers.md): Migration guide for SDK maintainers and library authors upgrading to 2.0.
45
+ - [SDK Maintainers](./migrations/sui-2.0/sdk-maintainers.md): Migration guide for SDK maintainers and library authors upgrading to 2.0
45
46
  - [Migrate to 1.0](./migrations/sui-1.0.md): Migrate to Sui TypeScript SDK 1.0 with new features and API changes.
46
47
  - [Migrate to 0.38.0](./migrations/0.38.md): Migrate from SDK version 0.37 to 0.38 with updated module structure and API changes.
@@ -1,6 +1,6 @@
1
1
  # @mysten/dapp-kit
2
2
 
3
- > Migrate @mysten/dapp-kit to the new dapp-kit-react package in 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.
@@ -271,7 +271,7 @@ The built-in data fetching hooks have been removed. Use TanStack Query's `useQue
271
271
  - });
272
272
  + const { data, isLoading, error } = useQuery({
273
273
  + queryKey: ['object', objectId],
274
- + queryFn: () => client.core.getObject({ objectId }),
274
+ + queryFn: () => client.getObject({ objectId }),
275
275
  + });
276
276
  // ...
277
277
  }
@@ -289,7 +289,7 @@ If you don't need React Query's caching and state management, you can fetch data
289
289
  const [error, setError] = useState<string | null>(null);
290
290
 
291
291
  useEffect(() => {
292
- client.core
292
+ client
293
293
  .getObject({ objectId })
294
294
  .then((result) => setData(result.object ?? null))
295
295
  .catch((err) => setError(err.message))
@@ -1,13 +1,13 @@
1
1
  # @mysten/deepbook-v3
2
2
 
3
- > Migrate @mysten/deepbook-v3 to 2.0 with client extension pattern.
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
 
7
7
  ```diff
8
8
  - import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
9
9
  - import { DeepBookClient } from '@mysten/deepbook-v3';
10
- + import { SuiGrpcClient } from '@mysten/sui/grpc'; // or SuiJsonRpcClient, SuiGraphQLClient
10
+ + import { SuiGrpcClient } from '@mysten/sui/grpc';
11
11
  + import { deepbook } from '@mysten/deepbook-v3';
12
12
 
13
13
  - const suiClient = new SuiClient({ url: getFullnodeUrl('mainnet') });
@@ -1,12 +1,12 @@
1
1
  # Migrate to 2.0
2
2
 
3
- > Migration guide for Sui TypeScript SDK 2.0 covering all @mysten packages.
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
 
7
- The primary goal of this release is to support the new GRPC and GraphQL APIs across all the mysten
8
- SDKs. These releases also include removals of deprecated APIs, some renaming for better consistency,
9
- and significant internal refactoring to improve maintainability. Starting with this release, Mysten
7
+ The primary goal of this release is to support the gRPC and GraphQL APIs across all Mysten SDKs.
8
+ These releases also include removals of deprecated APIs, some renaming for better consistency, and
9
+ 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
12
  ## Quick reference
@@ -65,39 +65,51 @@ updates.
65
65
 
66
66
  ### Client migration
67
67
 
68
- The most common change across all SDKs is migrating from `SuiClient` to `SuiJsonRpcClient`:
68
+ The recommended app migration is to create one `SuiGrpcClient` and use its top-level methods:
69
69
 
70
70
  ```diff
71
71
  - import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
72
- + import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc';
72
+ + import { SuiGrpcClient } from '@mysten/sui/grpc';
73
73
 
74
74
  - const client = new SuiClient({ url: getFullnodeUrl('mainnet') });
75
- + const client = new SuiJsonRpcClient({
76
- + url: getJsonRpcFullnodeUrl('mainnet'),
75
+ + const client = new SuiGrpcClient({
76
+ + baseUrl: 'https://fullnode.mainnet.sui.io:443',
77
77
  + network: 'mainnet',
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
+ Then migrate old JSON-RPC method names to the gRPC top-level methods:
82
82
 
83
83
  ```diff
84
- - import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
85
- + import { SuiGrpcClient } from '@mysten/sui/grpc';
84
+ - const coins = await client.getCoins({ owner });
85
+ + const coins = await client.listCoins({ owner });
86
+
87
+ - const txs = await client.queryTransactionBlocks({ filter, options });
88
+ + const txs = await client.listTransactions({ filter, include });
89
+
90
+ - const events = await client.queryEvents({ query, order: 'descending' });
91
+ + const events = await client.listEvents({ filter, order: 'descending' });
86
92
 
87
- - const client = new SuiJsonRpcClient({ url, network: 'mainnet' });
88
- + const client = new SuiGrpcClient({ baseUrl, network: 'mainnet' });
93
+ - const transaction = await client.getTransactionBlock({ digest, options });
94
+ + const transaction = await client.getTransaction({ digest, include });
89
95
  ```
90
96
 
91
- The gRPC runs on full nodes so in most cases you should be able to use the same URLs when migrating
92
- to gRPC.
97
+ The gRPC API runs on full nodes, so in most cases you can use the same full node host when migrating
98
+ from JSON-RPC to gRPC. Standard transaction and event queries are top-level methods on both
99
+ `SuiGrpcClient` and `SuiGraphQLClient`. Use custom GraphQL queries for indexed data, historical
100
+ object versions, or selection sets that are not covered by the shared methods.
101
+
102
+ `SuiJsonRpcClient` still exists under `@mysten/sui/jsonRpc` for legacy code, but JSON-RPC APIs are
103
+ deprecated in the Sui TypeScript SDK. See
104
+ [Migrating from JSON-RPC](/sui/migrations/sui-2.0/json-rpc-migration) for detailed replacements.
93
105
 
94
106
  ### Network parameter required
95
107
 
96
108
  All client constructors now require an explicit `network` parameter:
97
109
 
98
110
  ```ts
99
- const client = new SuiJsonRpcClient({
100
- url: getJsonRpcFullnodeUrl('mainnet'),
111
+ const grpcClient = new SuiGrpcClient({
112
+ baseUrl: 'https://fullnode.mainnet.sui.io:443',
101
113
  network: 'mainnet', // Required
102
114
  });
103
115
 
@@ -106,23 +118,32 @@ const graphqlClient = new SuiGraphQLClient({
106
118
  network: 'mainnet', // Required
107
119
  });
108
120
 
109
- const grpcClient = new SuiGrpcClient({
110
- baseUrl: 'https://fullnode.mainnet.sui.io:443',
121
+ const jsonRpcClient = new SuiJsonRpcClient({
122
+ url: 'https://fullnode.mainnet.sui.io:443',
111
123
  network: 'mainnet', // Required
112
124
  });
113
125
  ```
114
126
 
115
127
  ### `ClientWithCoreApi` Interface
116
128
 
117
- Many SDK methods now accept any client implementing `ClientWithCoreApi`, enabling use with JSON-RPC,
118
- GraphQL, or gRPC transports:
129
+ Many SDK methods now accept any client implementing `ClientWithCoreApi`. SDKs use
130
+ `client.core.<method>()` so they can work across `SuiGrpcClient`, `SuiGraphQLClient`, and the
131
+ deprecated `SuiJsonRpcClient` while apps keep using the top-level methods on their chosen client:
119
132
 
120
133
  ```ts
121
134
 
122
- // All of these work with APIs that accept ClientWithCoreApi
123
- const jsonRpcClient = new SuiJsonRpcClient({ url, network: 'mainnet' });
124
- const graphqlClient = new SuiGraphQLClient({ url, network: 'mainnet' });
125
- const grpcClient = new SuiGrpcClient({ baseUrl, network: 'mainnet' });
135
+ const client = new SuiGrpcClient({
136
+ baseUrl: 'https://fullnode.mainnet.sui.io:443',
137
+ network: 'mainnet',
138
+ });
139
+
140
+ // App code: use top-level methods.
141
+ const { balance } = await client.getBalance({ owner });
142
+
143
+ // SDK code: accept ClientWithCoreApi and use client.core.
144
+ async function readForSdk(client: ClientWithCoreApi, objectId: string) {
145
+ return client.core.getObject({ objectId });
146
+ }
126
147
  ```
127
148
 
128
149
  ## Package-specific guides