@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
@@ -1,16 +1,17 @@
1
1
  # @mysten/kiosk
2
2
 
3
- > Migrate @mysten/kiosk to 2.0 with client extension pattern and KioskTransaction.
3
+ > Migrate @mysten/kiosk to 2.0 with client extension pattern and KioskTransaction
4
4
 
5
5
  This package now exports a client extension that integrates with Sui clients.
6
6
 
7
- > **Note:** The Kiosk SDK requires `SuiJsonRpcClient` or `SuiGraphQLClient`. It does not work with
8
- > `SuiGrpcClient` because it uses event queries that are not available in gRPC.
7
+ > **Note:** The Kiosk SDK accepts `SuiGrpcClient`, `SuiGraphQLClient`, and other clients that implement
8
+ > `ClientWithCoreApi`. Use `SuiGrpcClient` for new Kiosk code. The gRPC object API returns Display
9
+ > v2 metadata; use GraphQL or JSON-RPC for object types that still rely on legacy Display metadata.
9
10
 
10
11
  ```diff
11
12
  - import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
12
13
  - import { KioskClient, Network } from '@mysten/kiosk';
13
- + import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc'; // or SuiGraphQLClient
14
+ + import { SuiGrpcClient } from '@mysten/sui/grpc';
14
15
  + import { kiosk } from '@mysten/kiosk';
15
16
 
16
17
  - const suiClient = new SuiClient({ url: getFullnodeUrl('mainnet') });
@@ -18,8 +19,8 @@ This package now exports a client extension that integrates with Sui clients.
18
19
  - client: suiClient,
19
20
  - network: Network.MAINNET,
20
21
  - });
21
- + const client = new SuiJsonRpcClient({
22
- + url: getJsonRpcFullnodeUrl('mainnet'),
22
+ + const client = new SuiGrpcClient({
23
+ + baseUrl: 'https://fullnode.mainnet.sui.io:443',
23
24
  + network: 'mainnet',
24
25
  + }).$extend(kiosk());
25
26
 
@@ -100,14 +101,14 @@ The low-level helper functions have been removed in favor of the `KioskTransacti
100
101
  ```diff
101
102
  - import { createKiosk, shareKiosk, placeAndList } from '@mysten/kiosk';
102
103
  + import { kiosk, KioskTransaction } from '@mysten/kiosk';
103
- + import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc';
104
+ + import { SuiGrpcClient } from '@mysten/sui/grpc';
104
105
 
105
106
  - const [kiosk, cap] = createKiosk(tx);
106
107
  - shareKiosk(tx, kiosk);
107
108
  - placeAndList(tx, itemType, kiosk, cap, item, price);
108
109
 
109
- + const client = new SuiJsonRpcClient({
110
- + url: getJsonRpcFullnodeUrl('mainnet'),
110
+ + const client = new SuiGrpcClient({
111
+ + baseUrl: 'https://fullnode.mainnet.sui.io:443',
111
112
  + network: 'mainnet',
112
113
  + }).$extend(kiosk());
113
114
  +
@@ -1,6 +1,6 @@
1
1
  # SDK Maintainers
2
2
 
3
- > Migration guide for SDK maintainers and library authors upgrading to 2.0.
3
+ > Migration guide for SDK maintainers and library authors upgrading to 2.0
4
4
 
5
5
  # Upgrading SDKs to @mysten/sui@2.0.0
6
6
 
@@ -10,8 +10,8 @@ For comprehensive SDK development patterns, see the [Building SDKs guide](/sui/s
10
10
 
11
11
  ## Use `ClientWithCoreApi`
12
12
 
13
- Accept `ClientWithCoreApi` instead of `SuiClient` to support all 3 Sui clients (JSON-RPC, GraphQL,
14
- gRPC):
13
+ Accept `ClientWithCoreApi` instead of `SuiClient` so applications can pass a `SuiGrpcClient`,
14
+ `SuiGraphQLClient`, or a legacy `SuiJsonRpcClient` during migration:
15
15
 
16
16
  ```diff
17
17
  - import { SuiClient } from '@mysten/sui/client';
@@ -24,7 +24,9 @@ gRPC):
24
24
 
25
25
  ## Access data through `client.core` methods
26
26
 
27
- All data access methods are namespaced under `client.core`:
27
+ SDKs should access shared client methods through `client.core`. Application code can use the same
28
+ methods at the top level of its concrete client, but `client.core` is the stable contract for
29
+ libraries that should work across transports:
28
30
 
29
31
  ```diff
30
32
  - const result = await this.client.getObject({ objectId });
@@ -34,13 +36,17 @@ All data access methods are namespaced under `client.core`:
34
36
  + const result = await this.client.core.listOwnedObjects({ owner });
35
37
  ```
36
38
 
37
- | v1.x Method | v2.0 Method |
38
- | -------------------------------- | --------------------------------- |
39
- | `client.getObject()` | `client.core.getObject()` |
40
- | `client.getOwnedObjects()` | `client.core.listOwnedObjects()` |
41
- | `client.getDynamicFieldObject()` | `client.core.getDynamicField()` |
42
- | `client.getDynamicFields()` | `client.core.listDynamicFields()` |
43
- | `client.multiGetObjects()` | `client.core.getObjects()` |
39
+ | v1.x Method | v2.0 Method |
40
+ | -------------------------------- | ------------------------------------------------------------------------ |
41
+ | `client.getObject()` | `client.core.getObject()` |
42
+ | `client.getOwnedObjects()` | `client.core.listOwnedObjects()` |
43
+ | `client.getDynamicFieldObject()` | `client.core.getDynamicField()` or `client.core.getDynamicObjectField()` |
44
+ | `client.getDynamicFields()` | `client.core.listDynamicFields()` |
45
+ | `client.multiGetObjects()` | `client.core.getObjects()` |
46
+
47
+ Use `getDynamicField()` for regular dynamic fields and when you need the field entry or BCS-encoded
48
+ value. Use `getDynamicObjectField()` only for dynamic object fields when you want the referenced
49
+ child object returned directly.
44
50
 
45
51
  See the [Core API documentation](/sui/clients/core) for all available methods.
46
52
 
@@ -1,51 +1,63 @@
1
1
  # @mysten/sui
2
2
 
3
- > Migrate @mysten/sui from 1.x to 2.0 with new client APIs and BCS changes.
3
+ > Migrate @mysten/sui from 1.x to 2.0 with gRPC clients, Core API, and BCS changes
4
4
 
5
5
  ## Removal of `SuiClient` exports
6
6
 
7
- The `@mysten/sui/client` export path has been removed. All JSON-RPC client functionality is now
8
- exported from `@mysten/sui/jsonRpc`.
7
+ The old `SuiClient` export has been removed from `@mysten/sui/client`. For application code, migrate
8
+ to [`SuiGrpcClient`](/sui/clients/grpc) and use top-level methods such as `client.getObject()`,
9
+ `client.listCoins()`, and `client.signAndExecuteTransaction()`.
10
+
11
+ Legacy JSON-RPC functionality moved to `@mysten/sui/jsonRpc`, but JSON-RPC APIs are deprecated in
12
+ the Sui TypeScript SDK. Use the JSON-RPC exports only when maintaining code that still needs the old
13
+ JSON-RPC method names or response shapes during migration.
9
14
 
10
15
  **Removed exports:**
11
16
 
12
- - `SuiClient` (use `SuiJsonRpcClient` instead)
13
- - `SuiClientOptions` (use `SuiJsonRpcClientOptions` instead)
14
- - `isSuiClient` (use `isSuiJsonRpcClient` instead)
15
- - `SuiTransport` (use `JsonRpcTransport` instead)
17
+ - `SuiClient` (use `SuiGrpcClient`; legacy JSON-RPC code can use `SuiJsonRpcClient`)
18
+ - `SuiClientOptions` (use `SuiGrpcClientOptions`; legacy JSON-RPC code can use
19
+ `SuiJsonRpcClientOptions`)
20
+ - `isSuiClient` (use `isSuiGrpcClient`, `isSuiGraphQLClient`, or legacy `isSuiJsonRpcClient`)
21
+ - `SuiTransport` (legacy JSON-RPC code can use `JsonRpcTransport`)
16
22
  - `SuiTransportRequestOptions` (use `JsonRpcTransportRequestOptions` instead)
17
- - `SuiTransportSubscribeOptions` (use `JsonRpcTransportSubscribeOptions` instead)
23
+ - `SuiTransportSubscribeOptions` (removed; use the gRPC subscription service for streaming APIs)
18
24
  - `SuiHTTPTransportOptions` (use `JsonRpcHTTPTransportOptions` instead)
19
25
  - `SuiHTTPTransport` (use `JsonRpcHTTPTransport` instead)
20
- - `getFullnodeUrl` (use `getJsonRpcFullnodeUrl` instead)
26
+ - `getFullnodeUrl` (pass the full node URL to `SuiGrpcClient.baseUrl`; legacy JSON-RPC code can use
27
+ `getJsonRpcFullnodeUrl`)
21
28
  - All JSON-RPC types (now exported from `@mysten/sui/jsonRpc`)
22
29
 
23
30
  **Migration:**
24
31
 
25
32
  ```diff
26
33
  - import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
27
- + import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc';
34
+ + import { SuiGrpcClient } from '@mysten/sui/grpc';
28
35
 
29
36
  - const client = new SuiClient({
30
37
  - url: getFullnodeUrl('devnet'),
31
- + const client = new SuiJsonRpcClient({
32
- + url: getJsonRpcFullnodeUrl('devnet'),
38
+ + const client = new SuiGrpcClient({
39
+ + baseUrl: 'https://fullnode.devnet.sui.io:443',
33
40
  network: 'devnet',
34
41
  });
35
42
  ```
36
43
 
37
44
  ## Network parameter required
38
45
 
39
- When creating a new `SuiGraphQLClient` or `SuiJsonRpcClient`, you must now provide a `network`
40
- parameter:
46
+ When creating a new `SuiGrpcClient`, `SuiGraphQLClient`, or legacy `SuiJsonRpcClient`, provide a
47
+ `network` parameter:
41
48
 
42
49
  ```ts
43
- const client = new SuiGraphQLClient({
50
+ const grpcClient = new SuiGrpcClient({
51
+ baseUrl: 'https://...',
52
+ network: 'mainnet', // Required
53
+ });
54
+
55
+ const graphqlClient = new SuiGraphQLClient({
44
56
  url: 'https://...',
45
57
  network: 'mainnet', // Required
46
58
  });
47
59
 
48
- const client = new SuiJsonRpcClient({
60
+ const jsonRpcClient = new SuiJsonRpcClient({
49
61
  url: 'https://...',
50
62
  network: 'mainnet', // Required
51
63
  });
@@ -66,11 +78,12 @@ objects.
66
78
  + effects.status.Failure.error
67
79
  ```
68
80
 
69
- **Core API** (gRPC and GraphQL responses): Uses a simplified structure with a `success` boolean:
81
+ **Core API and top-level client methods** (gRPC and GraphQL responses): Use a simplified structure
82
+ with a `success` boolean:
70
83
 
71
84
  ```typescript
72
- // Core API returns this structure
73
- const result = await client.core.getTransaction({ digest, include: { effects: true } });
85
+ // Top-level gRPC and GraphQL methods return this structure.
86
+ const result = await client.getTransaction({ digest, include: { effects: true } });
74
87
  const tx = result.Transaction ?? result.FailedTransaction;
75
88
 
76
89
  if (tx.effects.status.success) {
@@ -223,7 +236,7 @@ resolution is now built directly into the core client.
223
236
  **How it works now:**
224
237
 
225
238
  MVR name resolution happens automatically during transaction building. The SDK detects `.move` names
226
- (like `@org/package::module::Type`) and resolves them using the client's MVR resolver.
239
+ like `@org/package::module::Type` and resolves them using the client's MVR resolver.
227
240
 
228
241
  **Migration:**
229
242
 
@@ -238,11 +251,10 @@ MVR name resolution happens automatically during transaction building. The SDK d
238
251
  - })
239
252
  - );
240
253
 
241
- + import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
242
- + import type { NamedPackagesOverrides } from '@mysten/sui/client';
254
+ + import { SuiGrpcClient } from '@mysten/sui/grpc';
243
255
  +
244
- + const client = new SuiJsonRpcClient({
245
- + url: 'https://fullnode.mainnet.sui.io:443',
256
+ + const client = new SuiGrpcClient({
257
+ + baseUrl: 'https://fullnode.mainnet.sui.io:443',
246
258
  + network: 'mainnet',
247
259
  + mvr: {
248
260
  + overrides: myOverrides,
@@ -264,7 +276,8 @@ requiring `SuiJsonRpcClient` specifically.
264
276
  **Breaking changes:**
265
277
 
266
278
  - Constructor `client` parameter type changed from `SuiJsonRpcClient` to `ClientWithCoreApi`
267
- - Return type of `executeTransaction()`: `data` property renamed to `result`
279
+ - Return type of `executeTransaction()` changed from the legacy `{ digest, effects, data }` wrapper
280
+ to a Core API `TransactionResult` discriminated union returned directly
268
281
  - The second parameter changed from JSON-RPC options to core API include options
269
282
 
270
283
  **Migration:**
@@ -272,7 +285,12 @@ requiring `SuiJsonRpcClient` specifically.
272
285
  ```diff
273
286
 
274
287
  - import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
275
- + // Works with any client: SuiJsonRpcClient, SuiGrpcClient, or SuiGraphQLClient
288
+ + import { SuiGrpcClient } from '@mysten/sui/grpc';
289
+
290
+ + const client = new SuiGrpcClient({
291
+ + baseUrl: 'https://fullnode.devnet.sui.io:443',
292
+ + network: 'devnet',
293
+ + });
276
294
 
277
295
  const executor = new SerialTransactionExecutor({
278
296
  - client: jsonRpcClient,
@@ -282,10 +300,10 @@ const executor = new SerialTransactionExecutor({
282
300
 
283
301
  const result = await executor.executeTransaction(tx);
284
302
 
285
- // Accessing the transaction result (changed)
303
+ // Accessing the transaction result now returned directly
286
304
  - console.log(result.data.effects?.status.status);
287
- + const tx = result.Transaction ?? result.FailedTransaction;
288
- + console.log(tx.effects.status.success);
305
+ + const transaction = result.Transaction ?? result.FailedTransaction;
306
+ + console.log(transaction.effects.status.success);
289
307
  ```
290
308
 
291
309
  Include options have also changed:
@@ -1,13 +1,13 @@
1
1
  # @mysten/suins
2
2
 
3
- > Migrate @mysten/suins to 2.0 with client extension pattern.
3
+ > Migrate @mysten/suins 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 { SuinsClient } from '@mysten/suins';
10
- + import { SuiGrpcClient } from '@mysten/sui/grpc'; // or SuiJsonRpcClient, SuiGraphQLClient
10
+ + import { SuiGrpcClient } from '@mysten/sui/grpc';
11
11
  + import { suins } from '@mysten/suins';
12
12
 
13
13
  - const suiClient = new SuiClient({ url: getFullnodeUrl('mainnet') });
@@ -1,6 +1,6 @@
1
1
  # @mysten/walrus
2
2
 
3
- > Migrate @mysten/walrus to 2.0 with required client parameter and updated API.
3
+ > Migrate @mysten/walrus to 2.0 with required client parameter and updated API
4
4
 
5
5
  ## Breaking changes
6
6
 
@@ -17,7 +17,7 @@ If you were creating `WalrusClient` directly:
17
17
 
18
18
  ```diff
19
19
  - import { WalrusClient } from '@mysten/walrus';
20
- + import { SuiGrpcClient } from '@mysten/sui/grpc'; // or SuiJsonRpcClient, SuiGraphQLClient
20
+ + import { SuiGrpcClient } from '@mysten/sui/grpc';
21
21
  + import { walrus } from '@mysten/walrus';
22
22
 
23
23
  - const walrusClient = new WalrusClient({
@@ -30,7 +30,7 @@ If you were creating `WalrusClient` directly:
30
30
  + }).$extend(walrus());
31
31
 
32
32
  - await walrusClient.getBlob(blobId);
33
- + await client.walrus.getBlob(blobId);
33
+ + await client.walrus.getBlob({ blobId });
34
34
  ```
35
35
 
36
36
  If you were passing `network` to `walrus()`, remove it:
@@ -1,9 +1,9 @@
1
1
  # @mysten/zksend
2
2
 
3
- > Migrate @mysten/zksend to 2.0 with client extension pattern and simplified API.
3
+ > Migrate @mysten/zksend to 2.0 with client extension pattern and simplified API
4
4
 
5
- This package now exports a client extension that integrates with Sui clients, enabling compatibility
6
- with gRPC, GraphQL, and JSON RPC transports.
5
+ This package now exports a client extension that integrates with Sui clients through the Core API.
6
+ Use `SuiGrpcClient` for most applications.
7
7
 
8
8
  ## Breaking changes
9
9
 
@@ -23,7 +23,7 @@ Update your code to use the client extension:
23
23
  ```diff
24
24
  - import { ZkSendLinkBuilder, ZkSendLink } from '@mysten/zksend';
25
25
  + import { zksend } from '@mysten/zksend';
26
- + import { SuiGrpcClient } from '@mysten/sui/grpc'; // or SuiJsonRpcClient, SuiGraphQLClient
26
+ + import { SuiGrpcClient } from '@mysten/sui/grpc';
27
27
 
28
28
  + const client = new SuiGrpcClient({
29
29
  + baseUrl: 'https://fullnode.testnet.sui.io:443',
@@ -84,12 +84,13 @@ const linkBuilder = client.zksend.linkBuilder({
84
84
  });
85
85
 
86
86
  // Add assets to the link
87
- linkBuilder.addSui(1_000_000_000n); // 1 SUI
87
+ linkBuilder.addClaimableMist(1_000_000_000n); // 1 SUI
88
88
 
89
- // Create the transaction
90
- const { tx, link } = await linkBuilder.build();
89
+ // Create the transaction and get the claim URL
90
+ const tx = await linkBuilder.createSendTransaction();
91
+ const linkUrl = linkBuilder.getLink();
91
92
 
92
93
  // Later, load an existing link
93
94
  const existingLink = await client.zksend.loadLinkFromUrl(linkUrl);
94
- const assets = await existingLink.getAssets();
95
+ const assets = existingLink.assets;
95
96
  ```
@@ -1,14 +1,16 @@
1
1
  # Building SDKs
2
2
 
3
- > Build custom SDKs on top of the Sui TypeScript SDK.
3
+ > Build custom SDKs on top of the Sui TypeScript SDK
4
4
 
5
5
  This guide covers recommended patterns for building TypeScript SDKs that integrate with the Sui SDK.
6
- Following these patterns ensures your SDK integrates seamlessly with the ecosystem, works across
7
- different transports (JSON-RPC, GraphQL, gRPC), and composes well with other SDKs.
6
+ Following these patterns ensures your SDK integrates seamlessly with the ecosystem, works with
7
+ `SuiGrpcClient` and `SuiGraphQLClient` through the shared Core API, and composes well with other
8
+ SDKs. Legacy JSON-RPC clients can also be supported during migration because they implement the same
9
+ Core API contract.
8
10
 
9
11
  All SDKs should depend on [`ClientWithCoreApi`](./clients/core), which is the transport-agnostic
10
- interface implemented by all Sui clients. This ensures your SDK works with any client the user
11
- chooses.
12
+ interface implemented by Sui clients. This lets application code choose one concrete client and use
13
+ top-level methods, while SDK internals use `client.core` for portable reads, writes, and queries.
12
14
 
13
15
  ## Package setup
14
16
 
@@ -36,24 +36,10 @@ if (result.$kind === 'FailedTransaction') {
36
36
  }
37
37
  ```
38
38
 
39
- ### `include` options
40
-
41
- The `include` parameter controls what data is returned from the simulation. All fields are optional
42
- and default to `false`:
43
-
44
- | Field | Description |
45
- | ---------------- | -------------------------------------------------------------------------------------- |
46
- | `effects` | Execution effects: created, mutated, and deleted objects, gas usage |
47
- | `events` | Move events emitted during execution |
48
- | `balanceChanges` | Token balance changes for each affected address and coin type |
49
- | `objectTypes` | Map of object ID to type string for all changed objects |
50
- | `transaction` | The full transaction data (sender, commands, gas config) |
51
- | `bcs` | Raw BCS-encoded transaction bytes |
52
- | `commandResults` | BCS-encoded return values and mutated references from each command _(simulation only)_ |
53
-
54
- The `commandResults` field is unique to simulation. It is not available on `executeTransaction`.
55
- Each entry contains `returnValues` and `mutatedReferences`, both as BCS-encoded `Uint8Array` values
56
- that you can decode with the [BCS library](/bcs).
39
+ `commandResults` is unique to simulation. Each entry holds a command's `returnValues` and
40
+ `mutatedReferences` as BCS-encoded bytes, which you can decode with the [BCS library](/bcs). For the
41
+ rest of the `include` options, and the two flags that change how the node runs a simulation, see
42
+ [Executing transactions](/sui/clients/executing#simulatetransaction).
57
43
 
58
44
  ## With a keypair (backend or scripts)
59
45
 
@@ -178,16 +164,10 @@ const result = await grpcClient.executeTransaction({
178
164
  });
179
165
  ```
180
166
 
181
- The `include` parameter controls what data is returned with the result:
182
-
183
- | Field | Description |
184
- | ---------------- | -------------------------------------------------------- |
185
- | `transaction` | The full transaction data (sender, commands, gas) |
186
- | `effects` | Execution effects (created, mutated, or deleted objects) |
187
- | `events` | Move events emitted during execution |
188
- | `balanceChanges` | Token balance changes for each affected address |
189
- | `objectTypes` | Map of object ID to type for changed objects |
190
- | `bcs` | Raw BCS bytes of the transaction |
167
+ Clients also expose `signAndExecuteTransaction`, which takes a signer instead of bytes and does both
168
+ steps in one call, which is useful when the signer is not a keypair, or in library code that holds a
169
+ client. See [Executing transactions](/sui/clients/executing) for the full `include` options and the
170
+ rest of the client execution methods.
191
171
 
192
172
  ## Observing results
193
173
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Mysten Labs <build@mystenlabs.com>",
4
4
  "description": "Sui TypeScript API",
5
5
  "homepage": "https://sdk.mystenlabs.com",
6
- "version": "2.23.2",
6
+ "version": "2.25.0",
7
7
  "license": "Apache-2.0",
8
8
  "sideEffects": false,
9
9
  "files": [
@@ -134,6 +134,10 @@ export abstract class CoreClient extends BaseClient implements SuiClientTypes.Tr
134
134
  options: SuiClientTypes.DefaultNameServiceNameOptions,
135
135
  ): Promise<SuiClientTypes.DefaultNameServiceNameResponse>;
136
136
 
137
+ abstract resolveNameServiceAddress(
138
+ options: SuiClientTypes.ResolveNameServiceAddressOptions,
139
+ ): Promise<SuiClientTypes.ResolveNameServiceAddressResponse>;
140
+
137
141
  async getDynamicField(
138
142
  options: SuiClientTypes.GetDynamicFieldOptions,
139
143
  ): Promise<SuiClientTypes.GetDynamicFieldResponse> {
@@ -205,6 +209,7 @@ export abstract class CoreClient extends BaseClient implements SuiClientTypes.Tr
205
209
  const resolvedNameType = (
206
210
  await this.core.mvr.resolveType({
207
211
  type: options.name.type,
212
+ signal: options.signal,
208
213
  })
209
214
  ).type;
210
215
  const wrappedType = `0x2::dynamic_object_field::Wrapper<${resolvedNameType}>`;
package/src/client/mvr.ts CHANGED
@@ -401,6 +401,12 @@ export function raceSignal<T>(promise: Promise<T>, signal?: AbortSignal): Promis
401
401
  return promise;
402
402
  }
403
403
 
404
+ // An `abort` event is not replayed for listeners added after the fact, so a signal that was
405
+ // already aborted would otherwise resolve normally.
406
+ if (signal.aborted) {
407
+ return Promise.reject(signal.reason);
408
+ }
409
+
404
410
  return new Promise<T>((resolve, reject) => {
405
411
  const onAbort = () => reject(signal.reason);
406
412
  signal.addEventListener('abort', onAbort, { once: true });
@@ -757,6 +757,14 @@ export namespace SuiClientTypes {
757
757
  }
758
758
 
759
759
  /** Name service methods */
760
+ export interface ResolveNameServiceAddressOptions extends CoreClientMethodOptions {
761
+ name: string;
762
+ }
763
+
764
+ export interface ResolveNameServiceAddressResponse {
765
+ address: string | null;
766
+ }
767
+
760
768
  export interface DefaultNameServiceNameOptions extends CoreClientMethodOptions {
761
769
  address: string;
762
770
  }
@@ -768,6 +776,9 @@ export namespace SuiClientTypes {
768
776
  }
769
777
 
770
778
  export interface TransportMethods {
779
+ resolveNameServiceAddress: (
780
+ options: ResolveNameServiceAddressOptions,
781
+ ) => Promise<ResolveNameServiceAddressResponse>;
771
782
  defaultNameServiceName: (
772
783
  options: DefaultNameServiceNameOptions,
773
784
  ) => Promise<DefaultNameServiceNameResponse>;
@@ -249,8 +249,28 @@ export class SuiGraphQLClient<Queries extends Record<string, GraphQLDocument> =
249
249
  return this.core.simulateTransaction(input);
250
250
  }
251
251
 
252
- getReferenceGasPrice(): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
253
- return this.core.getReferenceGasPrice();
252
+ getReferenceGasPrice(
253
+ input?: SuiClientTypes.GetReferenceGasPriceOptions,
254
+ ): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
255
+ return this.core.getReferenceGasPrice(input);
256
+ }
257
+
258
+ getCurrentSystemState(
259
+ input?: SuiClientTypes.GetCurrentSystemStateOptions,
260
+ ): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
261
+ return this.core.getCurrentSystemState(input);
262
+ }
263
+
264
+ getProtocolConfig(
265
+ input?: SuiClientTypes.GetProtocolConfigOptions,
266
+ ): Promise<SuiClientTypes.GetProtocolConfigResponse> {
267
+ return this.core.getProtocolConfig(input);
268
+ }
269
+
270
+ getChainIdentifier(
271
+ input?: SuiClientTypes.GetChainIdentifierOptions,
272
+ ): Promise<SuiClientTypes.GetChainIdentifierResponse> {
273
+ return this.core.getChainIdentifier(input);
254
274
  }
255
275
 
256
276
  async listDynamicFields<Include extends DynamicFieldInclude = {}>(
@@ -260,6 +280,7 @@ export class SuiGraphQLClient<Queries extends Record<string, GraphQLDocument> =
260
280
 
261
281
  const { data, errors } = await this.query({
262
282
  query: GetDynamicFieldsDocument,
283
+ signal: input.signal,
263
284
  variables: {
264
285
  parentId: input.parentId,
265
286
  first: input.limit,
@@ -338,6 +359,12 @@ export class SuiGraphQLClient<Queries extends Record<string, GraphQLDocument> =
338
359
  return this.core.getDynamicField(input);
339
360
  }
340
361
 
362
+ getDynamicObjectField<Include extends SuiClientTypes.ObjectInclude = {}>(
363
+ input: SuiClientTypes.GetDynamicObjectFieldOptions<Include>,
364
+ ): Promise<SuiClientTypes.GetDynamicObjectFieldResponse<Include>> {
365
+ return this.core.getDynamicObjectField(input);
366
+ }
367
+
341
368
  listTransactions<Include extends SuiClientTypes.TransactionInclude = {}>(
342
369
  input: SuiClientTypes.ListTransactionsOptions<Include>,
343
370
  ): Promise<SuiClientTypes.ListTransactionsResponse<Include>> {
@@ -369,4 +396,10 @@ export class SuiGraphQLClient<Queries extends Record<string, GraphQLDocument> =
369
396
  ): Promise<SuiClientTypes.DefaultNameServiceNameResponse> {
370
397
  return this.core.defaultNameServiceName(input);
371
398
  }
399
+
400
+ resolveNameServiceAddress(
401
+ input: SuiClientTypes.ResolveNameServiceAddressOptions,
402
+ ): Promise<SuiClientTypes.ResolveNameServiceAddressResponse> {
403
+ return this.core.resolveNameServiceAddress(input);
404
+ }
372
405
  }