@mysten/docs 0.1.17 → 0.1.19
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.
- package/dist/bcs/index.md +1 -1
- package/dist/bcs/llms-index.md +1 -1
- package/dist/codegen/index.md +53 -53
- package/dist/codegen/llms-index.md +1 -1
- package/dist/dapp-kit/actions/connect-wallet.md +4 -4
- package/dist/dapp-kit/actions/disconnect-wallet.md +8 -7
- package/dist/dapp-kit/actions/sign-and-execute-transaction.md +14 -14
- package/dist/dapp-kit/actions/sign-personal-message.md +8 -8
- package/dist/dapp-kit/actions/sign-transaction.md +7 -7
- package/dist/dapp-kit/actions/switch-account.md +6 -6
- package/dist/dapp-kit/actions/switch-network.md +5 -5
- package/dist/dapp-kit/dapp-kit-instance.md +19 -18
- package/dist/dapp-kit/getting-started/create-dapp.md +12 -12
- package/dist/dapp-kit/getting-started/next-js.md +12 -11
- package/dist/dapp-kit/getting-started/react.md +25 -25
- package/dist/dapp-kit/getting-started/vue.md +12 -12
- package/dist/dapp-kit/index.md +4 -4
- package/dist/dapp-kit/llms-index.md +23 -23
- package/dist/dapp-kit/react/components/connect-button.md +3 -3
- package/dist/dapp-kit/react/components/connect-modal.md +3 -3
- package/dist/dapp-kit/react/components/index.md +2 -2
- package/dist/dapp-kit/react/dapp-kit-provider.md +6 -6
- package/dist/dapp-kit/react/hooks/index.md +4 -3
- package/dist/dapp-kit/react/hooks/use-current-account.md +3 -3
- package/dist/dapp-kit/react/hooks/use-current-client.md +3 -3
- package/dist/dapp-kit/react/hooks/use-current-network.md +3 -3
- package/dist/dapp-kit/react/hooks/use-current-wallet.md +3 -3
- package/dist/dapp-kit/react/hooks/use-dapp-kit.md +5 -5
- package/dist/dapp-kit/react/hooks/use-wallet-connection.md +3 -3
- package/dist/dapp-kit/react/hooks/use-wallets.md +3 -3
- package/dist/dapp-kit/state.md +16 -16
- package/dist/dapp-kit/theming.md +27 -27
- package/dist/dapp-kit/web-components/connect-button.md +9 -9
- package/dist/dapp-kit/web-components/connect-modal.md +16 -16
- package/dist/kiosk/advanced-examples.md +1 -1
- package/dist/kiosk/from-v1.md +1 -1
- package/dist/kiosk/index.md +5 -5
- package/dist/kiosk/kiosk-client/introduction.md +6 -6
- package/dist/kiosk/kiosk-client/kiosk-transaction/examples.md +3 -3
- package/dist/kiosk/kiosk-client/kiosk-transaction/kiosk-transaction.md +1 -1
- package/dist/kiosk/kiosk-client/kiosk-transaction/managing.md +11 -11
- package/dist/kiosk/kiosk-client/kiosk-transaction/purchasing.md +1 -1
- package/dist/kiosk/kiosk-client/querying.md +1 -1
- package/dist/kiosk/kiosk-client/transfer-policy-transaction/introduction.md +1 -1
- package/dist/kiosk/kiosk-client/transfer-policy-transaction/using-the-manager.md +1 -3
- package/dist/kiosk/llms-index.md +5 -5
- package/dist/llms-index.md +84 -83
- package/dist/payment-kit/getting-started.md +13 -13
- package/dist/payment-kit/index.md +13 -13
- package/dist/payment-kit/llms-index.md +5 -5
- package/dist/payment-kit/payment-kit-sdk.md +18 -18
- package/dist/payment-kit/payment-processing.md +34 -34
- package/dist/payment-kit/registry-management.md +35 -35
- package/dist/seal/index.md +5 -5
- package/dist/seal/llms-index.md +1 -1
- package/dist/slush-wallet/dapp.md +10 -10
- package/dist/slush-wallet/deep-linking.md +54 -54
- package/dist/slush-wallet/index.md +2 -2
- package/dist/slush-wallet/llms-index.md +3 -3
- package/dist/sui/bcs.md +11 -11
- package/dist/sui/clients/core.md +57 -56
- package/dist/sui/clients/graphql.md +3 -3
- package/dist/sui/clients/grpc.md +10 -10
- package/dist/sui/clients/index.md +14 -14
- package/dist/sui/clients/json-rpc.md +16 -16
- package/dist/sui/cryptography/keypairs.md +6 -6
- package/dist/sui/cryptography/multisig.md +4 -4
- package/dist/sui/cryptography/passkey.md +15 -14
- package/dist/sui/cryptography/webcrypto-signer.md +4 -4
- package/dist/sui/executors.md +18 -16
- package/dist/sui/faucet.md +3 -3
- package/dist/sui/hello-sui.md +5 -5
- package/dist/sui/index.md +12 -12
- package/dist/sui/install.md +3 -3
- package/dist/sui/llm-docs.md +9 -9
- package/dist/sui/llms-index.md +41 -41
- package/dist/sui/migrations/0.38.md +6 -6
- package/dist/sui/migrations/sui-1.0.md +32 -32
- package/dist/sui/migrations/sui-2.0/agent-prompt.md +3 -3
- package/dist/sui/migrations/sui-2.0/dapp-kit.md +43 -43
- package/dist/sui/migrations/sui-2.0/deepbook-v3.md +1 -1
- package/dist/sui/migrations/sui-2.0/index.md +37 -37
- package/dist/sui/migrations/sui-2.0/json-rpc-migration.md +53 -47
- package/dist/sui/migrations/sui-2.0/kiosk.md +8 -8
- package/dist/sui/migrations/sui-2.0/sdk-maintainers.md +7 -7
- package/dist/sui/migrations/sui-2.0/seal.md +1 -1
- package/dist/sui/migrations/sui-2.0/sui.md +16 -16
- package/dist/sui/migrations/sui-2.0/suins.md +4 -3
- package/dist/sui/migrations/sui-2.0/wallet-builders.md +5 -5
- package/dist/sui/migrations/sui-2.0/walrus.md +3 -3
- package/dist/sui/migrations/sui-2.0/zksend.md +5 -5
- package/dist/sui/plugins.md +14 -14
- package/dist/sui/sdk-building.md +32 -32
- package/dist/sui/transaction-building/basics.md +13 -13
- package/dist/sui/transaction-building/gas.md +2 -3
- package/dist/sui/transaction-building/intents.md +4 -4
- package/dist/sui/transaction-building/offline.md +8 -8
- package/dist/sui/transaction-building/sponsored-transactions.md +1 -1
- package/dist/sui/utils/derived_objects.md +10 -10
- package/dist/sui/utils/index.md +8 -1
- package/dist/sui/zklogin.md +1 -1
- package/dist/walrus/index.md +1 -1
- package/dist/walrus/llms-index.md +1 -1
- package/dist/zksend/composable-claim.md +70 -0
- package/dist/zksend/index.md +2 -2
- package/dist/zksend/link-builder.md +5 -4
- package/dist/zksend/llms-index.md +3 -2
- package/package.json +8 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Migrate to 1.0
|
|
2
2
|
|
|
3
|
-
> Migrate to Sui TypeScript SDK 1.0
|
|
3
|
+
> Migrate to Sui TypeScript SDK 1.0 with new features and API changes.
|
|
4
4
|
|
|
5
|
-
We are excited to announce the 1.0 release of the
|
|
5
|
+
We are excited to announce the 1.0 release of the TypeScript SDK. This release includes a lot of new
|
|
6
6
|
features, as well as number of renames, and cleanup of old APIs that no longer make sense.
|
|
7
7
|
|
|
8
8
|
This migration guide will primarily focus on helping migrate existing features that have changed in
|
|
@@ -15,7 +15,7 @@ highlights:
|
|
|
15
15
|
- [A new Plugin system for Extending Transaction Building](../plugins)
|
|
16
16
|
|
|
17
17
|
The majority of changes in this release are in the `@mysten/sui` package, but the changes to API
|
|
18
|
-
require some breaking changes across all the
|
|
18
|
+
require some breaking changes across all the TypeScript SDKs. You can find migration guides for all
|
|
19
19
|
affected packages below:
|
|
20
20
|
|
|
21
21
|
## Changes to `@mysten/sui`
|
|
@@ -76,7 +76,7 @@ correspond to specific JSON RPC calls. The following methods are unchanged:
|
|
|
76
76
|
- `suiClient.dryRunTransactionBlock`
|
|
77
77
|
- `suiClient.devInspectTransactionBlock`
|
|
78
78
|
|
|
79
|
-
### Building
|
|
79
|
+
### Building transactions
|
|
80
80
|
|
|
81
81
|
With the introduction of the Transaction plugin API, and Transaction Intents, serializing
|
|
82
82
|
transactions is now an asynchronous process.
|
|
@@ -85,11 +85,11 @@ transactions is now an asynchronous process.
|
|
|
85
85
|
method will invoke any serialization plugins used by the transaction, and return JSON in a new
|
|
86
86
|
Transaction JSON Format.
|
|
87
87
|
|
|
88
|
-
We have also removed the protocol config and limits options
|
|
88
|
+
We have also removed the protocol config and limits options because enforcing these limits in the
|
|
89
89
|
Transaction builder adds little practical value, and required additional API calls every time a
|
|
90
90
|
transaction was build.
|
|
91
91
|
|
|
92
|
-
#### Cloning a
|
|
92
|
+
#### Cloning a transaction
|
|
93
93
|
|
|
94
94
|
Cloning a transaction can now be done the `transaction.from` rather than the TransactionBlock
|
|
95
95
|
constructor:
|
|
@@ -177,16 +177,16 @@ The `getPureSerializationType` utility function has been removed.
|
|
|
177
177
|
|
|
178
178
|
## `@mysten/sui/bcs`
|
|
179
179
|
|
|
180
|
-
###
|
|
180
|
+
### BCS types
|
|
181
181
|
|
|
182
|
-
Many of the BCS type definitions exported from the
|
|
182
|
+
Many of the BCS type definitions exported from the TypeScript SDK have been updated to more closely
|
|
183
183
|
align with the Rust definitions. If you were using these types to parse transactions from BCS, you
|
|
184
|
-
|
|
184
|
+
might find that some of the data structures have been updated.
|
|
185
185
|
|
|
186
186
|
We have also removed some redundant exports that mirror the exported BCS types. These types often
|
|
187
|
-
conflicted with other types in the
|
|
187
|
+
conflicted with other types in the TypeScript SDK, leading to confusion about which version to use.
|
|
188
188
|
|
|
189
|
-
The correct way to get
|
|
189
|
+
The correct way to get TypeScript types for the exported BCS types is to use the $inferType type
|
|
190
190
|
helper:
|
|
191
191
|
|
|
192
192
|
```ts
|
|
@@ -196,12 +196,12 @@ function callArg(arg: typeof bcs.CallArg.$inferType) {
|
|
|
196
196
|
}
|
|
197
197
|
```
|
|
198
198
|
|
|
199
|
-
##
|
|
199
|
+
## `/utils`
|
|
200
200
|
|
|
201
201
|
The typescript SDK no longer uses `superstruct` for type validation, so the `is` and `assert`
|
|
202
202
|
helpers have been removed.
|
|
203
203
|
|
|
204
|
-
##
|
|
204
|
+
## `/multisig`
|
|
205
205
|
|
|
206
206
|
The `publicKeyFromSuiBytes` has been moved to `@mysten/sui/verify`
|
|
207
207
|
|
|
@@ -225,9 +225,9 @@ The methods for verifying signatures have been renamed
|
|
|
225
225
|
+ } from '@mysten/sui/verify'
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
-
##
|
|
228
|
+
## `/cryptography`
|
|
229
229
|
|
|
230
|
-
The `signData` method has been removed from Signers and Keypair classes. Use `sign` instead.
|
|
230
|
+
The `signData` method has been removed from `Signers` and `Keypair` classes. Use `sign` instead.
|
|
231
231
|
|
|
232
232
|
```diff
|
|
233
233
|
- keypair.signData(data)
|
|
@@ -240,7 +240,7 @@ return the unwrapped bytes of the message that was signed
|
|
|
240
240
|
|
|
241
241
|
# @mysten/bcs
|
|
242
242
|
|
|
243
|
-
## The
|
|
243
|
+
## The registry
|
|
244
244
|
|
|
245
245
|
We have removed the previously deprecated registry from the BCS library. The registry was removed
|
|
246
246
|
from the documentation when BCS was re-written last year, and is now being removed entirely.
|
|
@@ -255,7 +255,7 @@ Previously the `size` option was used both as an initial size and a maximum size
|
|
|
255
255
|
writer instance. We replaced the `size` option with a new `initialSize` option, and have updated
|
|
256
256
|
`maxSize` to default to Infinity rather than defaulting to `size`.
|
|
257
257
|
|
|
258
|
-
##
|
|
258
|
+
## New methods on `BcsType`
|
|
259
259
|
|
|
260
260
|
We have added `fromBase64`, `fromBase58`, and `fromHex` methods to `BcsType` instances, making it
|
|
261
261
|
easier to parse BCS data from various string encodings.
|
|
@@ -292,7 +292,7 @@ if (parsed.Variant0 !== undefined) {
|
|
|
292
292
|
}
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
## `@mysten/kiosk`
|
|
296
296
|
|
|
297
297
|
The options passed to `KioskTransaction` and `TransferPolicyTransaction` have been updated to
|
|
298
298
|
replace `transactionBlock` with `transaction`.
|
|
@@ -313,7 +313,7 @@ than the `transactionBlock`.
|
|
|
313
313
|
+ resolveRuleFunction({ transaction }) => { ... }
|
|
314
314
|
```
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
## `@mysten/enoki`
|
|
317
317
|
|
|
318
318
|
The Enoki SDK has been updated to replace TransactionBlock terminology with Transaction throughout
|
|
319
319
|
the API:
|
|
@@ -335,9 +335,9 @@ the API:
|
|
|
335
335
|
+ enokiClient.executeSponsoredTransaction({ ... })
|
|
336
336
|
```
|
|
337
337
|
|
|
338
|
-
|
|
338
|
+
## `dapp-kit`
|
|
339
339
|
|
|
340
|
-
|
|
340
|
+
### `useSignTransactionBlock`
|
|
341
341
|
|
|
342
342
|
The `useSignTransactionBlock` has been named to `useSignTransaction` and now returns bytes instead
|
|
343
343
|
of transactionBlockBytes
|
|
@@ -350,7 +350,7 @@ of transactionBlockBytes
|
|
|
350
350
|
+ const { signature, bytes } = await signTransaction({ transaction })
|
|
351
351
|
```
|
|
352
352
|
|
|
353
|
-
|
|
353
|
+
### `useSignAndExecuteTransactionBlock`
|
|
354
354
|
|
|
355
355
|
The `useSignAndExecuteTransactionBlock` has been named to `useSignAndExecuteTransaction` and
|
|
356
356
|
redesigned to work the updated wallet-standard methods.
|
|
@@ -358,8 +358,8 @@ redesigned to work the updated wallet-standard methods.
|
|
|
358
358
|
`useSignAndExecuteTransaction` no-longer accepts the options passed to
|
|
359
359
|
`suiClient.executeTransactionBlock` for returning additional data.
|
|
360
360
|
|
|
361
|
-
By default useSignAndExecuteTransactionBlock will now return an object with the transaction
|
|
362
|
-
and the
|
|
361
|
+
By default `useSignAndExecuteTransactionBlock` will now return an object with the transaction
|
|
362
|
+
`digest` and the BCS encoded transaction effects:
|
|
363
363
|
|
|
364
364
|
```ts
|
|
365
365
|
const { mutate: signAndExecuteTransaction } = useSignAndExecuteTransaction()
|
|
@@ -397,16 +397,16 @@ To fetch additional data, you can provide a customized `execute` function:
|
|
|
397
397
|
+ });
|
|
398
398
|
```
|
|
399
399
|
|
|
400
|
-
When using a custom `execute` function, the you must return the rawEffects by setting
|
|
400
|
+
When using a custom `execute` function, the you must return the `rawEffects` by setting
|
|
401
401
|
`showRawEffects` to true if using `suiClient.executeTransactionBlock`, or by returning an object
|
|
402
|
-
matching `{ effects: { bcs: string` } }` with the base64 encoded
|
|
402
|
+
matching `{ effects: { bcs: string` } }` with the base64 encoded BCS effects when using a GraphQL
|
|
403
403
|
query to execute the transaction.
|
|
404
404
|
|
|
405
405
|
This change decouples the `useSignAndExecuteTransaction` hook from a specific RPC API
|
|
406
406
|
implementation, and will enable migration to GraphQL without additional breaking changes in this
|
|
407
407
|
hook.
|
|
408
408
|
|
|
409
|
-
|
|
409
|
+
## `@mysten/zksend`
|
|
410
410
|
|
|
411
411
|
The `getSentTransactionBlocksWithLinks` method has been renamed to `getSentTransactionsWithLinks`,
|
|
412
412
|
and all methods that previously accepted a `transactionBlock` option now accept a `transaction`
|
|
@@ -427,7 +427,7 @@ instead instead.
|
|
|
427
427
|
});
|
|
428
428
|
```
|
|
429
429
|
|
|
430
|
-
|
|
430
|
+
## `@mysten/wallet-standard`
|
|
431
431
|
|
|
432
432
|
### New wallet-standard features
|
|
433
433
|
|
|
@@ -436,16 +436,16 @@ Transactions in wallets without waiting for previous transactions to be indexed
|
|
|
436
436
|
API.
|
|
437
437
|
|
|
438
438
|
For more details on how wallets can take advantage of these features, see the
|
|
439
|
-
[wallet-standard documentation](https://docs.sui.io/standards/wallet-standard).
|
|
439
|
+
[`wallet-standard` documentation](https://docs.sui.io/standards/wallet-standard).
|
|
440
440
|
|
|
441
441
|
The old `sui:signTransactionBlock` and `sui:signAndExecuteTransactionBlock` methods have been
|
|
442
442
|
deprecated in favor of the new `sui:signTransaction` and `sui:signAndExecuteTransaction` methods,
|
|
443
443
|
but wallets should continue to implement these deprecated methods until the new methods have been
|
|
444
|
-
broadly adopted by
|
|
444
|
+
broadly adopted by apps.
|
|
445
445
|
|
|
446
|
-
###
|
|
446
|
+
### Helpers
|
|
447
447
|
|
|
448
|
-
2 new helpers have been added to make it easier for
|
|
448
|
+
2 new helpers have been added to make it easier for apps to handle wallets that have implemented
|
|
449
449
|
either the new or old wallet-standard methods: `signTransaction` and `signAndExecuteTransaction`.
|
|
450
450
|
|
|
451
451
|
```ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Agent Migration Prompt
|
|
2
2
|
|
|
3
|
-
> AI agent prompt for automated SDK 2.0 migration
|
|
3
|
+
> AI agent prompt for automated SDK 2.0 migration of your codebase.
|
|
4
4
|
|
|
5
|
-
Copy and paste the following prompt into your AI coding assistant (Claude Code, Cursor,
|
|
6
|
-
migrate your codebase to v2. If a planning mode is available we recommend starting there first.
|
|
5
|
+
Copy and paste the following prompt into your AI coding assistant (Claude Code, Cursor, and others)
|
|
6
|
+
to migrate your codebase to v2. If a planning mode is available we recommend starting there first.
|
|
7
7
|
|
|
8
8
|
```txt
|
|
9
9
|
## Sui TypeScript SDK v2 Migration
|
|
@@ -1,6 +1,6 @@
|
|
|
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.
|
|
@@ -11,20 +11,20 @@ This guide helps you migrate from the original `@mysten/dapp-kit` (legacy) to th
|
|
|
11
11
|
|
|
12
12
|
## Overview
|
|
13
13
|
|
|
14
|
-
The new dApp
|
|
14
|
+
The new dApp kit SDK represents a complete rewrite with these key changes:
|
|
15
15
|
|
|
16
|
-
-
|
|
16
|
+
- Framework agnostic: Split into `@mysten/dapp-kit-core` (framework-agnostic) and
|
|
17
17
|
`@mysten/dapp-kit-react` (React bindings)
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
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-
|
|
25
|
+
## Step-by-step migration
|
|
26
26
|
|
|
27
|
-
### 1
|
|
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
|
|
36
|
+
### Step 2: Create dApp Kit instance
|
|
37
37
|
|
|
38
|
-
Create a new instance of the dApp
|
|
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
|
|
62
|
+
### Step 3: Register types
|
|
63
63
|
|
|
64
|
-
The `declare module` block in the previous step registers your dApp
|
|
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 (
|
|
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
|
|
86
|
+
### Step 4: Replace provider setup
|
|
87
87
|
|
|
88
|
-
Replace the nested dApp
|
|
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
|
|
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
|
|
139
|
+
### Step 6: Update hook usage
|
|
140
140
|
|
|
141
|
-
The new dApp
|
|
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()
|
|
147
|
-
- `useCurrentClient()
|
|
148
|
-
- `useCurrentAccount()
|
|
149
|
-
- `useCurrentWallet()
|
|
150
|
-
- `useWallets()
|
|
151
|
-
- `useWalletConnection()
|
|
152
|
-
- `useCurrentNetwork()
|
|
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
|
|
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
|
|
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
|
|
187
|
-
like `signTransaction` and `signAndExecuteTransaction`. In the new
|
|
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
|
|
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,9 +295,9 @@ If you don't need React Query's caching and state management, you can fetch data
|
|
|
295
295
|
}
|
|
296
296
|
```
|
|
297
297
|
|
|
298
|
-
### 9
|
|
298
|
+
### Step 9: Update the remaining code
|
|
299
299
|
|
|
300
|
-
The following hooks from the original dApp
|
|
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`
|
|
@@ -305,7 +305,7 @@ The following hooks from the original dApp Kit are not available anymore:
|
|
|
305
305
|
- `useResolveSuiNSNames` → Use `useCurrentClient()` with the suins extension
|
|
306
306
|
|
|
307
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
|
|
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
|
|
317
|
+
## CSS and theming changes
|
|
318
318
|
|
|
319
|
-
The new dApp
|
|
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
|
|
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
|
|
328
|
+
appearance of dApp kit components.
|
|
329
329
|
|
|
330
330
|
**Quick theme setup:**
|
|
331
331
|
|
|
@@ -342,7 +342,7 @@ 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
|
|
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
|
|
@@ -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
|
|
12
|
+
## Quick reference
|
|
13
13
|
|
|
14
14
|
| Package | Key Changes |
|
|
15
15
|
| --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
16
|
-
| [
|
|
17
|
-
| [
|
|
18
|
-
| [
|
|
19
|
-
| [
|
|
20
|
-
| [
|
|
21
|
-
| [
|
|
22
|
-
| [
|
|
23
|
-
| [
|
|
24
|
-
| [
|
|
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
|
|
27
|
+
## Common migration patterns
|
|
28
28
|
|
|
29
|
-
### ESM
|
|
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 (
|
|
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
|
|
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)
|
|
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
|
|
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
|
|
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
|
|
94
|
+
### Network parameter required
|
|
95
95
|
|
|
96
96
|
All client constructors now require an explicit `network` parameter:
|
|
97
97
|
|
|
@@ -112,7 +112,7 @@ 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:
|
|
@@ -125,34 +125,34 @@ const graphqlClient = new SuiGraphQLClient({ url, network: 'mainnet' });
|
|
|
125
125
|
const grpcClient = new SuiGrpcClient({ baseUrl, network: 'mainnet' });
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
## Package-
|
|
128
|
+
## Package-specific guides
|
|
129
129
|
|
|
130
130
|
For detailed migration instructions, see the SDK-specific guides:
|
|
131
131
|
|
|
132
|
-
- **[
|
|
132
|
+
- **[`@mysten/sui`](/sui/migrations/sui-2.0/sui):** Core SDK changes including client API, BCS
|
|
133
133
|
schemas, transactions, zkLogin, and GraphQL
|
|
134
|
-
- **[
|
|
135
|
-
dApp
|
|
136
|
-
- **[
|
|
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,
|
|
137
137
|
low-level helpers removed
|
|
138
|
-
- **[
|
|
139
|
-
- **[
|
|
140
|
-
- **[
|
|
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
|
|
141
143
|
extension
|
|
142
|
-
- **[
|
|
143
|
-
extension
|
|
144
|
-
- **[@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
|
|
145
145
|
|
|
146
|
-
## Transport
|
|
146
|
+
## Transport migration
|
|
147
147
|
|
|
148
|
-
- **[Migrating from JSON-RPC](/sui/migrations/sui-2.0/json-rpc-migration)
|
|
148
|
+
- **[Migrating from JSON-RPC](/sui/migrations/sui-2.0/json-rpc-migration):** Migrate from the
|
|
149
149
|
deprecated JSON-RPC client to gRPC and GraphQL
|
|
150
150
|
|
|
151
|
-
## Ecosystem
|
|
151
|
+
## Ecosystem migration guides
|
|
152
152
|
|
|
153
153
|
For wallet builders and SDK maintainers building on the Sui ecosystem:
|
|
154
154
|
|
|
155
|
-
- **[Wallet
|
|
155
|
+
- **[Wallet builders](/sui/migrations/sui-2.0/wallet-builders):** Guide for wallet implementations
|
|
156
156
|
adapting to `reportTransactionEffects` removal and new core API response format
|
|
157
|
-
- **[SDK
|
|
158
|
-
|
|
157
|
+
- **[SDK maintainers](/sui/migrations/sui-2.0/sdk-maintainers):** Guide for SDK authors migrating to
|
|
158
|
+
`ClientWithCoreApi` and the new transport-agnostic architecture
|