@mysten/sui 2.16.1 → 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 (62) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/bcs/index.d.mts +20 -20
  3. package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
  4. package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
  5. package/dist/grpc/proto/sui/rpc/v2/name_service.client.d.mts +4 -4
  6. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
  7. package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
  8. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
  9. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
  10. package/dist/transactions/Transaction.d.mts +4 -4
  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/transactions/data/v2.d.mts.map +1 -1
  17. package/dist/version.mjs +1 -1
  18. package/dist/version.mjs.map +1 -1
  19. package/docs/bcs.md +134 -0
  20. package/docs/clients/core.md +622 -0
  21. package/docs/clients/graphql.md +101 -0
  22. package/docs/clients/grpc.md +210 -0
  23. package/docs/clients/index.md +95 -0
  24. package/docs/clients/json-rpc.md +239 -0
  25. package/docs/cryptography/keypairs.md +267 -0
  26. package/docs/cryptography/multisig.md +194 -0
  27. package/docs/cryptography/passkey.md +112 -0
  28. package/docs/cryptography/webcrypto-signer.md +81 -0
  29. package/docs/executors.md +150 -0
  30. package/docs/faucet.md +26 -0
  31. package/docs/hello-sui.md +115 -0
  32. package/docs/index.md +53 -0
  33. package/docs/install.md +61 -0
  34. package/docs/llm-docs.md +32 -0
  35. package/docs/llms-index.md +44 -0
  36. package/docs/migrations/0.38.md +58 -0
  37. package/docs/migrations/sui-1.0.md +455 -0
  38. package/docs/migrations/sui-2.0/agent-prompt.md +42 -0
  39. package/docs/migrations/sui-2.0/dapp-kit.md +350 -0
  40. package/docs/migrations/sui-2.0/deepbook-v3.md +33 -0
  41. package/docs/migrations/sui-2.0/index.md +158 -0
  42. package/docs/migrations/sui-2.0/json-rpc-migration.md +408 -0
  43. package/docs/migrations/sui-2.0/kiosk.md +120 -0
  44. package/docs/migrations/sui-2.0/sdk-maintainers.md +90 -0
  45. package/docs/migrations/sui-2.0/seal.md +14 -0
  46. package/docs/migrations/sui-2.0/sui.md +341 -0
  47. package/docs/migrations/sui-2.0/suins.md +44 -0
  48. package/docs/migrations/sui-2.0/wallet-builders.md +66 -0
  49. package/docs/migrations/sui-2.0/walrus.md +41 -0
  50. package/docs/migrations/sui-2.0/zksend.md +95 -0
  51. package/docs/plugins.md +258 -0
  52. package/docs/sdk-building.md +344 -0
  53. package/docs/transaction-building/basics.md +299 -0
  54. package/docs/transaction-building/gas.md +61 -0
  55. package/docs/transaction-building/intents.md +62 -0
  56. package/docs/transaction-building/offline.md +73 -0
  57. package/docs/transaction-building/sponsored-transactions.md +22 -0
  58. package/docs/utils/derived_objects.md +80 -0
  59. package/docs/utils/index.md +59 -0
  60. package/docs/zklogin.md +83 -0
  61. package/package.json +3 -3
  62. package/src/version.ts +1 -1
@@ -0,0 +1,408 @@
1
+ # Migrating from JSON-RPC
2
+
3
+ > Migrate from JSON-RPC to the new Core API using SuiGrpcClient or SuiGraphQLClient.
4
+
5
+ This guide covers migrating from `SuiJsonRpcClient` to the new client APIs. The JSON-RPC API is
6
+ being deprecated in favor of `SuiGrpcClient` and `SuiGraphQLClient`.
7
+
8
+ > **Note:** We recommend using `SuiGrpcClient` for most operations and `SuiGraphQLClient` for complex queries
9
+ > like filtering transactions and events.
10
+
11
+ ## Choosing a client
12
+
13
+ | Client | Best For |
14
+ | ------------------ | --------------------------------------------------------------- |
15
+ | `SuiGrpcClient` | Most operations, SDK integrations, real-time data |
16
+ | `SuiGraphQLClient` | Complex queries, filtering transactions/events, historical data |
17
+
18
+ ## Quick migration to gRPC
19
+
20
+ For most use cases, migrate to `SuiGrpcClient`:
21
+
22
+ ```diff
23
+ - import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc';
24
+ + import { SuiGrpcClient } from '@mysten/sui/grpc';
25
+
26
+ - const client = new SuiJsonRpcClient({
27
+ - url: getJsonRpcFullnodeUrl('mainnet'),
28
+ - network: 'mainnet',
29
+ - });
30
+ + const client = new SuiGrpcClient({
31
+ + baseUrl: 'https://fullnode.mainnet.sui.io:443',
32
+ + network: 'mainnet',
33
+ + });
34
+ ```
35
+
36
+ Both clients use the same full node URLs, so you can use the same endpoint when migrating.
37
+
38
+ ## Core API methods
39
+
40
+ The gRPC client should work with almost all mysten SDKs as a drop in replacement for the JSON-RPC
41
+ client. When using the client directly, the methods and data returned will not be exactly the same
42
+ as what was available in JSON-RPC.
43
+
44
+ ## Methods replaced by core API
45
+
46
+ These JSON-RPC methods have direct replacements in the core API:
47
+
48
+ | JSON-RPC Method | Core API Replacement |
49
+ | ---------------------------- | ------------------------------------------------- |
50
+ | `getCoins` | `listCoins` |
51
+ | `getAllCoins` | `listOwnedObjects` with `type: '0x2::coin::Coin'` |
52
+ | `getAllBalances` | `listBalances` |
53
+ | `getOwnedObjects` | `listOwnedObjects` |
54
+ | `multiGetObjects` | `getObjects` |
55
+ | `getDynamicFields` | `listDynamicFields` |
56
+ | `getDynamicFieldObject` | `getDynamicField` |
57
+ | `devInspectTransactionBlock` | `simulateTransaction` with `checksEnabled: false` |
58
+ | `dryRunTransactionBlock` | `simulateTransaction` |
59
+ | `getNormalizedMoveFunction` | `getMoveFunction` |
60
+ | `getMoveFunctionArgTypes` | `getMoveFunction` |
61
+
62
+ ### Example: Migrating devInspectTransactionBlock
63
+
64
+ ```diff
65
+ - const result = await jsonRpcClient.devInspectTransactionBlock({
66
+ - sender: '0xabc...',
67
+ - transactionBlock: tx,
68
+ - });
69
+ - const returnValues = result.results?.[0]?.returnValues;
70
+ + const result = await client.core.simulateTransaction({
71
+ + transaction: tx,
72
+ + checksEnabled: false,
73
+ + include: { commandResults: true },
74
+ + });
75
+ + const returnValues = result.commandResults?.[0]?.returnValues;
76
+ ```
77
+
78
+ ### Example: Migrating getOwnedObjects
79
+
80
+ ```diff
81
+ - const { data } = await jsonRpcClient.getOwnedObjects({
82
+ - owner: '0xabc...',
83
+ - options: { showContent: true },
84
+ - });
85
+ + const { objects } = await grpcClient.listOwnedObjects({
86
+ + owner: '0xabc...',
87
+ + include: { content: true },
88
+ + });
89
+ ```
90
+
91
+ ## Methods replaced by gRPC services
92
+
93
+ These JSON-RPC methods can be replaced by calling gRPC service clients directly:
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.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
+
114
+ ```typescript
115
+
116
+ const client = new SuiGrpcClient({
117
+ baseUrl: 'https://fullnode.mainnet.sui.io:443',
118
+ network: 'mainnet',
119
+ });
120
+
121
+ // Get checkpoint information
122
+ const { response } = await client.ledgerService.getCheckpoint({
123
+ sequenceNumber: 12345n,
124
+ });
125
+
126
+ // Get current epoch
127
+ const { response: epoch } = await client.ledgerService.getEpoch({});
128
+
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({
136
+ packageId: '0x2',
137
+ moduleName: 'coin',
138
+ name: 'Coin',
139
+ });
140
+
141
+ // Resolve SuiNS name
142
+ const { response: address } = await client.nameService.lookupName({
143
+ name: 'example.sui',
144
+ });
145
+ ```
146
+
147
+ ## Methods requiring GraphQL
148
+
149
+ Some JSON-RPC methods don't have gRPC equivalents and require using `SuiGraphQLClient` instead:
150
+
151
+ | JSON-RPC Method | GraphQL Alternative |
152
+ | --------------------------- | ---------------------------------- |
153
+ | `queryTransactionBlocks` | `transactions` query |
154
+ | `multiGetTransactionBlocks` | `multiGetTransactionEffects` query |
155
+ | `queryEvents` | `events` query |
156
+ | `getCoinMetadata` | `coinMetadata` query |
157
+ | `getTotalSupply` | `coinMetadata` query |
158
+ | `getStakes` | `address.stakedSuis` query |
159
+ | `getStakesByIds` | `multiGetObjects` query |
160
+ | `tryGetPastObject` | Historical object queries |
161
+ | `getNetworkMetrics` | Use indexer |
162
+ | `getAddressMetrics` | Use indexer |
163
+ | `getMoveCallMetrics` | Use indexer |
164
+
165
+ ### Setting up GraphQL client
166
+
167
+ ```typescript
168
+
169
+ const graphqlClient = new SuiGraphQLClient({
170
+ url: 'https://sui-mainnet.mystenlabs.com/graphql',
171
+ network: 'mainnet',
172
+ });
173
+ ```
174
+
175
+ ### Querying transactions
176
+
177
+ Replace `queryTransactionBlocks` with a GraphQL query:
178
+
179
+ ```typescript
180
+ const result = await graphqlClient.query({
181
+ query: `
182
+ query QueryTransactions($sender: SuiAddress, $first: Int, $after: String) {
183
+ transactions(
184
+ first: $first
185
+ after: $after
186
+ filter: { sentAddress: $sender }
187
+ ) {
188
+ pageInfo {
189
+ hasNextPage
190
+ endCursor
191
+ }
192
+ nodes {
193
+ digest
194
+ effects {
195
+ status
196
+ epoch { epochId }
197
+ }
198
+ }
199
+ }
200
+ }
201
+ `,
202
+ variables: {
203
+ sender: '0xabc...',
204
+ first: 10,
205
+ },
206
+ });
207
+ ```
208
+
209
+ **Available transaction filters:**
210
+
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`)
216
+ - `atCheckpoint` / `beforeCheckpoint` / `afterCheckpoint` - Filter by checkpoint
217
+
218
+ ### Querying events
219
+
220
+ Replace `queryEvents` with a GraphQL query:
221
+
222
+ ```typescript
223
+ const result = await graphqlClient.query({
224
+ query: `
225
+ query QueryEvents($type: String, $first: Int, $after: String) {
226
+ events(
227
+ first: $first
228
+ after: $after
229
+ filter: { type: $type }
230
+ ) {
231
+ pageInfo {
232
+ hasNextPage
233
+ endCursor
234
+ }
235
+ nodes {
236
+ transactionModule {
237
+ package { address }
238
+ name
239
+ }
240
+ sender { address }
241
+ contents {
242
+ type { repr }
243
+ bcs
244
+ }
245
+ }
246
+ }
247
+ }
248
+ `,
249
+ variables: {
250
+ type: '0x2::coin::CoinCreated',
251
+ first: 10,
252
+ },
253
+ });
254
+ ```
255
+
256
+ **Available event filters:**
257
+
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
262
+
263
+ ### Fetching multiple transactions
264
+
265
+ Replace `multiGetTransactionBlocks` with a GraphQL query:
266
+
267
+ ```typescript
268
+ const result = await graphqlClient.query({
269
+ query: `
270
+ query MultiGetTransactions($digests: [String!]!) {
271
+ multiGetTransactionEffects(keys: $digests) {
272
+ transaction {
273
+ digest
274
+ transactionBcs
275
+ }
276
+ status
277
+ epoch { epochId }
278
+ }
279
+ }
280
+ `,
281
+ variables: {
282
+ digests: ['digest1', 'digest2', 'digest3'],
283
+ },
284
+ });
285
+ ```
286
+
287
+ ### Querying historical objects
288
+
289
+ Replace `tryGetPastObject` with a GraphQL query specifying a version:
290
+
291
+ ```typescript
292
+ const result = await graphqlClient.query({
293
+ query: `
294
+ query GetObjectAtVersion($id: SuiAddress!, $version: UInt53!) {
295
+ object(address: $id, version: $version) {
296
+ address
297
+ version
298
+ digest
299
+ asMoveObject {
300
+ contents {
301
+ type { repr }
302
+ bcs
303
+ }
304
+ }
305
+ }
306
+ }
307
+ `,
308
+ variables: {
309
+ id: '0x123...',
310
+ version: 42,
311
+ },
312
+ });
313
+ ```
314
+
315
+ ### Querying coin metadata
316
+
317
+ Replace `getCoinMetadata` and `getTotalSupply` with a GraphQL query:
318
+
319
+ ```typescript
320
+ const result = await graphqlClient.query({
321
+ query: `
322
+ query GetCoinMetadata($coinType: String!) {
323
+ coinMetadata(coinType: $coinType) {
324
+ name
325
+ symbol
326
+ description
327
+ decimals
328
+ iconUrl
329
+ supply
330
+ }
331
+ }
332
+ `,
333
+ variables: {
334
+ coinType: '0x2::sui::SUI',
335
+ },
336
+ });
337
+ ```
338
+
339
+ ### Querying staked SUI
340
+
341
+ Replace `getStakes` with a GraphQL query:
342
+
343
+ ```typescript
344
+ const result = await graphqlClient.query({
345
+ query: `
346
+ query GetStakes($owner: SuiAddress!) {
347
+ address(address: $owner) {
348
+ stakedSuis {
349
+ nodes {
350
+ principal
351
+ stakeActivationEpoch
352
+ estimatedReward
353
+ contents {
354
+ bcs
355
+ }
356
+ }
357
+ }
358
+ }
359
+ }
360
+ `,
361
+ variables: {
362
+ owner: '0xabc...',
363
+ },
364
+ });
365
+ ```
366
+
367
+ ## Response format differences
368
+
369
+ The gRPC client uses the core API response format, which differs from JSON-RPC responses. See the
370
+ [`@mysten/sui` migration guide](/sui/migrations/sui-2.0/sui#transaction-executors-now-accept-any-client)
371
+ for details on the new response format.
372
+
373
+ Key differences:
374
+
375
+ ```diff
376
+ // Transaction result access
377
+ - const status = result.effects?.status?.status;
378
+ + const tx = result.Transaction ?? result.FailedTransaction;
379
+ + const status = tx.effects.status.success;
380
+
381
+ // Include options
382
+ - { showEffects: true, showEvents: true }
383
+ + { effects: true, events: true }
384
+ ```
385
+
386
+ ## Client extensions
387
+
388
+ Client extensions work the same way with both clients:
389
+
390
+ ```typescript
391
+
392
+ const client = new SuiGrpcClient({
393
+ baseUrl: 'https://fullnode.mainnet.sui.io:443',
394
+ network: 'mainnet',
395
+ }).$extend(deepbook({ address: myAddress }), suins());
396
+
397
+ // Use extended functionality
398
+ await client.deepbook.checkManagerBalance(manager, asset);
399
+ await client.suins.getName('0xabc...');
400
+ ```
401
+
402
+ ## See also
403
+
404
+ - [SuiGrpcClient Documentation](/sui/clients/grpc) - Full gRPC client documentation
405
+ - [SuiGraphQLClient Documentation](/sui/clients/graphql) - GraphQL client documentation
406
+ - [Core API](/sui/clients/core) - Transport-agnostic API methods
407
+ - [gRPC Overview](https://docs.sui.io/concepts/data-access/grpc-overview) - Sui gRPC API
408
+ documentation
@@ -0,0 +1,120 @@
1
+ # @mysten/kiosk
2
+
3
+ > Migrate @mysten/kiosk to 2.0 with client extension pattern and KioskTransaction.
4
+
5
+ This package now exports a client extension that integrates with Sui clients.
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.
9
+
10
+ ```diff
11
+ - import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
12
+ - import { KioskClient, Network } from '@mysten/kiosk';
13
+ + import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc'; // or SuiGraphQLClient
14
+ + import { kiosk } from '@mysten/kiosk';
15
+
16
+ - const suiClient = new SuiClient({ url: getFullnodeUrl('mainnet') });
17
+ - const kioskClient = new KioskClient({
18
+ - client: suiClient,
19
+ - network: Network.MAINNET,
20
+ - });
21
+ + const client = new SuiJsonRpcClient({
22
+ + url: getJsonRpcFullnodeUrl('mainnet'),
23
+ + network: 'mainnet',
24
+ + }).$extend(kiosk());
25
+
26
+ - const ownedKiosks = await kioskClient.getOwnedKiosks({ address: myAddress });
27
+ + const ownedKiosks = await client.kiosk.getOwnedKiosks({ address: myAddress });
28
+ ```
29
+
30
+ ## Removed: `transactionBlock` parameter
31
+
32
+ The deprecated `transactionBlock` parameter has been removed from `KioskTransaction`,
33
+ `TransferPolicyTransaction`, and rule resolving functions. Use `transaction` instead:
34
+
35
+ ```diff
36
+ const kioskTx = new KioskTransaction({
37
+ - transactionBlock: tx,
38
+ + transaction: tx,
39
+ kioskClient,
40
+ cap,
41
+ });
42
+
43
+ const tpTx = new TransferPolicyTransaction({
44
+ - transactionBlock: tx,
45
+ + transaction: tx,
46
+ kioskClient,
47
+ cap,
48
+ });
49
+ ```
50
+
51
+ ## Removed: low-level helper functions
52
+
53
+ The low-level helper functions have been removed in favor of the `KioskTransaction` and
54
+ `TransferPolicyTransaction` builder classes.
55
+
56
+ ### Kiosk functions
57
+
58
+ | Removed Function | Use Instead |
59
+ | ------------------- | ------------------------ |
60
+ | `createKiosk` | `kioskTx.create()` |
61
+ | `shareKiosk` | `kioskTx.share()` |
62
+ | `place` | `kioskTx.place()` |
63
+ | `lock` | `kioskTx.lock()` |
64
+ | `take` | `kioskTx.take()` |
65
+ | `list` | `kioskTx.list()` |
66
+ | `delist` | `kioskTx.delist()` |
67
+ | `placeAndList` | `kioskTx.placeAndList()` |
68
+ | `purchase` | `kioskTx.purchase()` |
69
+ | `withdrawFromKiosk` | `kioskTx.withdraw()` |
70
+ | `borrowValue` | `kioskTx.borrow()` |
71
+ | `returnValue` | `kioskTx.return()` |
72
+
73
+ ### Transfer policy functions
74
+
75
+ | Removed Function | Use Instead |
76
+ | ------------------------------------ | ------------------------------------------------------- |
77
+ | `createTransferPolicyWithoutSharing` | `tpTx.create()` |
78
+ | `shareTransferPolicy` | `tpTx.shareAndTransferCap()` |
79
+ | `confirmRequest` | Handled automatically by `kioskTx.purchaseAndResolve()` |
80
+ | `removeTransferPolicyRule` | `tpTx.removeRule()` |
81
+
82
+ ### Personal Kiosk functions
83
+
84
+ | Removed Function | Use Instead |
85
+ | ----------------------- | --------------------------------------------- |
86
+ | `convertToPersonalTx` | `kioskTx.convertToPersonal()` |
87
+ | `transferPersonalCapTx` | Handled automatically by `kioskTx.finalize()` |
88
+
89
+ ### Rule attachment functions
90
+
91
+ | Removed Function | Use Instead |
92
+ | --------------------------- | ----------------------------- |
93
+ | `attachKioskLockRuleTx` | `tpTx.addLockRule()` |
94
+ | `attachRoyaltyRuleTx` | `tpTx.addRoyaltyRule()` |
95
+ | `attachPersonalKioskRuleTx` | `tpTx.addPersonalKioskRule()` |
96
+ | `attachFloorPriceRuleTx` | `tpTx.addFloorPriceRule()` |
97
+
98
+ ## Migration example
99
+
100
+ ```diff
101
+ - import { createKiosk, shareKiosk, placeAndList } from '@mysten/kiosk';
102
+ + import { kiosk, KioskTransaction } from '@mysten/kiosk';
103
+ + import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc';
104
+
105
+ - const [kiosk, cap] = createKiosk(tx);
106
+ - shareKiosk(tx, kiosk);
107
+ - placeAndList(tx, itemType, kiosk, cap, item, price);
108
+
109
+ + const client = new SuiJsonRpcClient({
110
+ + url: getJsonRpcFullnodeUrl('mainnet'),
111
+ + network: 'mainnet',
112
+ + }).$extend(kiosk());
113
+ +
114
+ + const kioskTx = new KioskTransaction({ transaction: tx, kioskClient: client.kiosk });
115
+ + kioskTx
116
+ + .create()
117
+ + .placeAndList({ itemType, item, price })
118
+ + .shareAndTransferCap(address)
119
+ + .finalize();
120
+ ```
@@ -0,0 +1,90 @@
1
+ # SDK Maintainers
2
+
3
+ > Migration guide for SDK maintainers and library authors upgrading to 2.0.
4
+
5
+ # Upgrading SDKs to @mysten/sui@2.0.0
6
+
7
+ This guide covers the key breaking changes for SDK maintainers building on top of `@mysten/sui`.
8
+
9
+ For comprehensive SDK development patterns, see the [Building SDKs guide](/sui/sdk-building).
10
+
11
+ ## Use `ClientWithCoreApi`
12
+
13
+ Accept `ClientWithCoreApi` instead of `SuiClient` to support all 3 Sui clients (JSON-RPC, GraphQL,
14
+ gRPC):
15
+
16
+ ```diff
17
+ - import { SuiClient } from '@mysten/sui/client';
18
+ + import type { ClientWithCoreApi } from '@mysten/sui/client';
19
+
20
+ - client: SuiClient;
21
+ + client: ClientWithCoreApi;
22
+ }
23
+ ```
24
+
25
+ ## Access data through `client.core` methods
26
+
27
+ All data access methods are namespaced under `client.core`:
28
+
29
+ ```diff
30
+ - const result = await this.client.getObject({ objectId });
31
+ + const result = await this.client.core.getObject({ objectId });
32
+
33
+ - const result = await this.client.getOwnedObjects({ owner });
34
+ + const result = await this.client.core.listOwnedObjects({ owner });
35
+ ```
36
+
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()` |
44
+
45
+ See the [Core API documentation](/sui/clients/core) for all available methods.
46
+
47
+ ## Use peer dependencies
48
+
49
+ Declare `@mysten/*` packages as peer dependencies:
50
+
51
+ ```json
52
+ {
53
+ "peerDependencies": {
54
+ "@mysten/sui": "^2.0.0"
55
+ },
56
+ "devDependencies": {
57
+ "@mysten/sui": "^2.0.0"
58
+ }
59
+ }
60
+ ```
61
+
62
+ ## Client extensions
63
+
64
+ v2.0 introduces client extensions that let users add your SDK to any Sui client:
65
+
66
+ ```typescript
67
+
68
+ return {
69
+ name: 'mySDK',
70
+ register: (client: ClientWithCoreApi) => {
71
+ return new MySDKClient({ client });
72
+ },
73
+ };
74
+ }
75
+
76
+ // Users can then extend any client
77
+ const client = new SuiGrpcClient({ ... }).$extend(mySDK());
78
+ await client.mySDK.doSomething();
79
+ ```
80
+
81
+ See the [Building SDKs guide](/sui/sdk-building#client-extensions) for the complete extension
82
+ pattern.
83
+
84
+ ## Code generation
85
+
86
+ Use [`@mysten/codegen`](/codegen) to generate type-safe TypeScript bindings from your Move packages.
87
+ See the [codegen documentation](/codegen) for setup instructions.
88
+
89
+ For complete SDK development patterns including client extensions, transaction thunks, and best
90
+ practices, see the [Building SDKs guide](/sui/sdk-building).
@@ -0,0 +1,14 @@
1
+ # @mysten/seal
2
+
3
+ > Migrate @mysten/seal to 2.0 with the new registration function pattern.
4
+
5
+ The deprecated `SealClient.asClientExtension()` static method has been removed. Use the `seal()`
6
+ registration function instead:
7
+
8
+ ```diff
9
+ - import { SealClient } from '@mysten/seal';
10
+ + import { seal } from '@mysten/seal';
11
+
12
+ - const client = suiClient.$extend(SealClient.asClientExtension());
13
+ + const client = suiClient.$extend(seal());
14
+ ```