@mysten/docs 0.1.1
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/README.md +24 -0
- package/dist/bcs/index.md +358 -0
- package/dist/bcs/llms-index.md +4 -0
- package/dist/codegen/index.md +441 -0
- package/dist/codegen/llms-index.md +4 -0
- package/dist/dapp-kit/actions/connect-wallet.md +69 -0
- package/dist/dapp-kit/actions/disconnect-wallet.md +38 -0
- package/dist/dapp-kit/actions/sign-and-execute-transaction.md +96 -0
- package/dist/dapp-kit/actions/sign-personal-message.md +58 -0
- package/dist/dapp-kit/actions/sign-transaction.md +65 -0
- package/dist/dapp-kit/actions/switch-account.md +37 -0
- package/dist/dapp-kit/actions/switch-network.md +37 -0
- package/dist/dapp-kit/dapp-kit-instance.md +162 -0
- package/dist/dapp-kit/getting-started/create-dapp.md +151 -0
- package/dist/dapp-kit/getting-started/next-js.md +162 -0
- package/dist/dapp-kit/getting-started/react.md +172 -0
- package/dist/dapp-kit/getting-started/vue.md +193 -0
- package/dist/dapp-kit/index.md +70 -0
- package/dist/dapp-kit/llms-index.md +26 -0
- package/dist/dapp-kit/react/components/connect-button.md +42 -0
- package/dist/dapp-kit/react/components/connect-modal.md +51 -0
- package/dist/dapp-kit/react/components/index.md +13 -0
- package/dist/dapp-kit/react/dapp-kit-provider.md +86 -0
- package/dist/dapp-kit/react/hooks/index.md +25 -0
- package/dist/dapp-kit/react/hooks/use-current-account.md +33 -0
- package/dist/dapp-kit/react/hooks/use-current-client.md +36 -0
- package/dist/dapp-kit/react/hooks/use-current-network.md +28 -0
- package/dist/dapp-kit/react/hooks/use-current-wallet.md +36 -0
- package/dist/dapp-kit/react/hooks/use-dapp-kit.md +100 -0
- package/dist/dapp-kit/react/hooks/use-wallet-connection.md +48 -0
- package/dist/dapp-kit/react/hooks/use-wallets.md +33 -0
- package/dist/dapp-kit/state.md +169 -0
- package/dist/dapp-kit/theming.md +196 -0
- package/dist/dapp-kit/web-components/connect-button.md +89 -0
- package/dist/dapp-kit/web-components/connect-modal.md +177 -0
- package/dist/kiosk/advanced-examples.md +101 -0
- package/dist/kiosk/from-v1.md +320 -0
- package/dist/kiosk/index.md +22 -0
- package/dist/kiosk/kiosk-client/introduction.md +52 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/examples.md +119 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/kiosk-transaction.md +103 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/managing.md +235 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/purchasing.md +110 -0
- package/dist/kiosk/kiosk-client/querying.md +237 -0
- package/dist/kiosk/kiosk-client/transfer-policy-transaction/introduction.md +79 -0
- package/dist/kiosk/kiosk-client/transfer-policy-transaction/using-the-manager.md +115 -0
- package/dist/kiosk/llms-index.md +8 -0
- package/dist/llms-index.md +125 -0
- package/dist/payment-kit/getting-started.md +256 -0
- package/dist/payment-kit/index.md +132 -0
- package/dist/payment-kit/llms-index.md +8 -0
- package/dist/payment-kit/payment-kit-sdk.md +747 -0
- package/dist/payment-kit/payment-processing.md +372 -0
- package/dist/payment-kit/registry-management.md +529 -0
- package/dist/seal/index.md +85 -0
- package/dist/seal/llms-index.md +4 -0
- package/dist/slush-wallet/dapp.md +95 -0
- package/dist/slush-wallet/deep-linking.md +465 -0
- package/dist/slush-wallet/index.md +7 -0
- package/dist/slush-wallet/llms-index.md +6 -0
- package/dist/sui/bcs.md +134 -0
- package/dist/sui/clients/core.md +606 -0
- package/dist/sui/clients/graphql.md +101 -0
- package/dist/sui/clients/grpc.md +155 -0
- package/dist/sui/clients/index.md +95 -0
- package/dist/sui/clients/json-rpc.md +239 -0
- package/dist/sui/cryptography/keypairs.md +267 -0
- package/dist/sui/cryptography/multisig.md +194 -0
- package/dist/sui/cryptography/passkey.md +111 -0
- package/dist/sui/cryptography/webcrypto-signer.md +81 -0
- package/dist/sui/executors.md +148 -0
- package/dist/sui/faucet.md +26 -0
- package/dist/sui/hello-sui.md +115 -0
- package/dist/sui/index.md +53 -0
- package/dist/sui/install.md +61 -0
- package/dist/sui/llm-docs.md +32 -0
- package/dist/sui/llms-index.md +44 -0
- package/dist/sui/migrations/0.38.md +58 -0
- package/dist/sui/migrations/sui-1.0.md +455 -0
- package/dist/sui/migrations/sui-2.0/agent-prompt.md +42 -0
- package/dist/sui/migrations/sui-2.0/dapp-kit.md +350 -0
- package/dist/sui/migrations/sui-2.0/deepbook-v3.md +33 -0
- package/dist/sui/migrations/sui-2.0/index.md +158 -0
- package/dist/sui/migrations/sui-2.0/json-rpc-migration.md +386 -0
- package/dist/sui/migrations/sui-2.0/kiosk.md +120 -0
- package/dist/sui/migrations/sui-2.0/sdk-maintainers.md +90 -0
- package/dist/sui/migrations/sui-2.0/seal.md +14 -0
- package/dist/sui/migrations/sui-2.0/sui.md +341 -0
- package/dist/sui/migrations/sui-2.0/suins.md +43 -0
- package/dist/sui/migrations/sui-2.0/wallet-builders.md +66 -0
- package/dist/sui/migrations/sui-2.0/walrus.md +41 -0
- package/dist/sui/migrations/sui-2.0/zksend.md +95 -0
- package/dist/sui/plugins.md +258 -0
- package/dist/sui/sdk-building.md +344 -0
- package/dist/sui/transaction-building/basics.md +299 -0
- package/dist/sui/transaction-building/gas.md +62 -0
- package/dist/sui/transaction-building/intents.md +62 -0
- package/dist/sui/transaction-building/offline.md +73 -0
- package/dist/sui/transaction-building/sponsored-transactions.md +22 -0
- package/dist/sui/utils/derived_objects.md +59 -0
- package/dist/sui/utils/index.md +52 -0
- package/dist/sui/zklogin.md +83 -0
- package/dist/walrus/index.md +527 -0
- package/dist/walrus/llms-index.md +4 -0
- package/dist/zksend/index.md +27 -0
- package/dist/zksend/link-builder.md +192 -0
- package/dist/zksend/llms-index.md +5 -0
- package/package.json +66 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# @mysten/sui
|
|
2
|
+
|
|
3
|
+
> Migrate @mysten/sui from 1.x to 2.0
|
|
4
|
+
|
|
5
|
+
## Removal of SuiClient Exports
|
|
6
|
+
|
|
7
|
+
The `@mysten/sui/client` export path has been removed. All JSON-RPC client functionality is now
|
|
8
|
+
exported from `@mysten/sui/jsonRpc`.
|
|
9
|
+
|
|
10
|
+
**Removed exports:**
|
|
11
|
+
|
|
12
|
+
- `SuiClient` (use `SuiJsonRpcClient` instead)
|
|
13
|
+
- `SuiClientOptions` (use `SuiJsonRpcClientOptions` instead)
|
|
14
|
+
- `isSuiClient` (use `isSuiJsonRpcClient` instead)
|
|
15
|
+
- `SuiTransport` (use `JsonRpcTransport` instead)
|
|
16
|
+
- `SuiTransportRequestOptions` (use `JsonRpcTransportRequestOptions` instead)
|
|
17
|
+
- `SuiTransportSubscribeOptions` (use `JsonRpcTransportSubscribeOptions` instead)
|
|
18
|
+
- `SuiHTTPTransportOptions` (use `JsonRpcHTTPTransportOptions` instead)
|
|
19
|
+
- `SuiHTTPTransport` (use `JsonRpcHTTPTransport` instead)
|
|
20
|
+
- `getFullnodeUrl` (use `getJsonRpcFullnodeUrl` instead)
|
|
21
|
+
- All JSON-RPC types (now exported from `@mysten/sui/jsonRpc`)
|
|
22
|
+
|
|
23
|
+
**Migration:**
|
|
24
|
+
|
|
25
|
+
```diff
|
|
26
|
+
- import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
|
|
27
|
+
+ import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc';
|
|
28
|
+
|
|
29
|
+
- const client = new SuiClient({
|
|
30
|
+
- url: getFullnodeUrl('devnet'),
|
|
31
|
+
+ const client = new SuiJsonRpcClient({
|
|
32
|
+
+ url: getJsonRpcFullnodeUrl('devnet'),
|
|
33
|
+
network: 'devnet',
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Network Parameter Required
|
|
38
|
+
|
|
39
|
+
When creating a new `SuiGraphQLClient` or `SuiJsonRpcClient`, you must now provide a `network`
|
|
40
|
+
parameter:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
const client = new SuiGraphQLClient({
|
|
44
|
+
url: 'https://...',
|
|
45
|
+
network: 'mainnet', // Required
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const client = new SuiJsonRpcClient({
|
|
49
|
+
url: 'https://...',
|
|
50
|
+
network: 'mainnet', // Required
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## BCS Schema Changes
|
|
55
|
+
|
|
56
|
+
Several BCS schemas in `@mysten/sui/bcs` have been updated to align exactly with the Rust
|
|
57
|
+
implementation. These changes affect serialization and deserialization of transaction effects and
|
|
58
|
+
objects.
|
|
59
|
+
|
|
60
|
+
### ExecutionStatus Changes
|
|
61
|
+
|
|
62
|
+
**BCS Schema** (when parsing raw effects): The variant was renamed from `Failed` to `Failure`:
|
|
63
|
+
|
|
64
|
+
```diff
|
|
65
|
+
- effects.status.Failed.error
|
|
66
|
+
+ effects.status.Failure.error
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Core API** (gRPC/GraphQL responses): Uses a simplified structure with a `success` boolean:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// Core API returns this structure
|
|
73
|
+
const result = await client.core.getTransaction({ digest, include: { effects: true } });
|
|
74
|
+
const tx = result.Transaction ?? result.FailedTransaction;
|
|
75
|
+
|
|
76
|
+
if (tx.effects.status.success) {
|
|
77
|
+
// Transaction succeeded
|
|
78
|
+
} else {
|
|
79
|
+
const error = tx.effects.status.error;
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Object BCS Schema Changes
|
|
84
|
+
|
|
85
|
+
Several changes to object BCS schemas:
|
|
86
|
+
|
|
87
|
+
```diff
|
|
88
|
+
// Renamed Owner enum variant
|
|
89
|
+
const owner = {
|
|
90
|
+
- ConsensusV2: { owner: addr, startVersion: 1 }
|
|
91
|
+
+ ConsensusAddressOwner: { startVersion: 1, owner: addr }
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Renamed Data enum variant
|
|
95
|
+
const data = {
|
|
96
|
+
- MoveObject: { ... }
|
|
97
|
+
+ Move: { ... }
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// Renamed exported schema
|
|
101
|
+
- import { ObjectBcs } from '@mysten/sui/bcs';
|
|
102
|
+
+ import { bcs } from '@mysten/sui/bcs';
|
|
103
|
+
- const bytes = ObjectBcs.serialize(obj);
|
|
104
|
+
+ const bytes = bcs.Object.serialize(obj);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**This affects serialization.** Any existing serialized data with `ConsensusV2` will need to be
|
|
108
|
+
re-serialized with the new `ConsensusAddressOwner` variant.
|
|
109
|
+
|
|
110
|
+
### UnchangedSharedKind to UnchangedConsensusKind
|
|
111
|
+
|
|
112
|
+
Transaction effects field renamed:
|
|
113
|
+
|
|
114
|
+
```diff
|
|
115
|
+
// Field name change
|
|
116
|
+
- effects.unchangedSharedObjects
|
|
117
|
+
+ effects.unchangedConsensusObjects
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Removed variants:** `MutateDeleted`, `ReadDeleted`
|
|
121
|
+
|
|
122
|
+
**New variants:** `MutateConsensusStreamEnded`, `ReadConsensusStreamEnded`, `Cancelled`,
|
|
123
|
+
`PerEpochConfig`
|
|
124
|
+
|
|
125
|
+
## Experimental Client API Stabilization
|
|
126
|
+
|
|
127
|
+
The experimental client API has been stabilized and moved from `@mysten/sui/experimental` to
|
|
128
|
+
`@mysten/sui/client`. All `Experimental_` prefixes have been removed.
|
|
129
|
+
|
|
130
|
+
**Breaking changes:**
|
|
131
|
+
|
|
132
|
+
- The `@mysten/sui/experimental` module has been removed
|
|
133
|
+
- All `Experimental_` prefixed types and classes have been renamed
|
|
134
|
+
- Client types namespace changed from `Experimental_SuiClientTypes` to `SuiClientTypes`
|
|
135
|
+
|
|
136
|
+
**Migration:**
|
|
137
|
+
|
|
138
|
+
```diff
|
|
139
|
+
- import {
|
|
140
|
+
- Experimental_BaseClient,
|
|
141
|
+
- Experimental_CoreClient,
|
|
142
|
+
- type Experimental_SuiClientTypes,
|
|
143
|
+
- type Experimental_CoreClientOptions,
|
|
144
|
+
- } from '@mysten/sui/experimental';
|
|
145
|
+
+ import {
|
|
146
|
+
+ BaseClient,
|
|
147
|
+
+ CoreClient,
|
|
148
|
+
+ type SuiClientTypes,
|
|
149
|
+
+ type CoreClientOptions,
|
|
150
|
+
+ } from '@mysten/sui/client';
|
|
151
|
+
|
|
152
|
+
// Update class extensions
|
|
153
|
+
- class MyClient extends Experimental_CoreClient {
|
|
154
|
+
+ class MyClient extends CoreClient {
|
|
155
|
+
async getObjects(
|
|
156
|
+
- options: Experimental_SuiClientTypes.GetObjectsOptions,
|
|
157
|
+
- ): Promise<Experimental_SuiClientTypes.GetObjectsResponse> {
|
|
158
|
+
+ options: SuiClientTypes.GetObjectsOptions,
|
|
159
|
+
+ ): Promise<SuiClientTypes.GetObjectsResponse> {
|
|
160
|
+
// ...
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Common renames:**
|
|
166
|
+
|
|
167
|
+
| Old Name | New Name |
|
|
168
|
+
| -------------------------------- | ------------------- |
|
|
169
|
+
| `Experimental_BaseClient` | `BaseClient` |
|
|
170
|
+
| `Experimental_CoreClient` | `CoreClient` |
|
|
171
|
+
| `Experimental_SuiClientTypes` | `SuiClientTypes` |
|
|
172
|
+
| `Experimental_CoreClientOptions` | `CoreClientOptions` |
|
|
173
|
+
|
|
174
|
+
## Commands Renamed to TransactionCommands
|
|
175
|
+
|
|
176
|
+
The `Commands` type exported from `@mysten/sui/transactions` has been renamed to
|
|
177
|
+
`TransactionCommands` because `Commands` is a reserved keyword in React Native.
|
|
178
|
+
|
|
179
|
+
```diff
|
|
180
|
+
- import { Commands } from '@mysten/sui/transactions';
|
|
181
|
+
+ import { TransactionCommands } from '@mysten/sui/transactions';
|
|
182
|
+
|
|
183
|
+
- const coin = tx.add(Commands.SplitCoins(tx.gas, [tx.pure.u64(100)]));
|
|
184
|
+
+ const coin = tx.add(TransactionCommands.SplitCoins(tx.gas, [tx.pure.u64(100)]));
|
|
185
|
+
|
|
186
|
+
- tx.add(Commands.TransferObjects([coin], recipient));
|
|
187
|
+
+ tx.add(TransactionCommands.TransferObjects([coin], recipient));
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## GraphQL Schema Consolidation
|
|
191
|
+
|
|
192
|
+
The SDK now exports a single unified GraphQL schema instead of multiple versioned schemas.
|
|
193
|
+
|
|
194
|
+
**Removed exports:**
|
|
195
|
+
|
|
196
|
+
- `@mysten/sui/graphql/schemas/2024.1`
|
|
197
|
+
- `@mysten/sui/graphql/schemas/2024.4`
|
|
198
|
+
- `@mysten/sui/graphql/schemas/latest`
|
|
199
|
+
|
|
200
|
+
**Migration:**
|
|
201
|
+
|
|
202
|
+
```diff
|
|
203
|
+
- import { graphql } from '@mysten/sui/graphql/schemas/latest';
|
|
204
|
+
- import { graphql } from '@mysten/sui/graphql/schemas/2024.4';
|
|
205
|
+
- import { graphql } from '@mysten/sui/graphql/schemas/2024.1';
|
|
206
|
+
+ import { graphql } from '@mysten/sui/graphql/schema';
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Named Packages Plugin Removed
|
|
210
|
+
|
|
211
|
+
The `namedPackagesPlugin` and global plugin registry APIs have been removed. MVR (Move Registry)
|
|
212
|
+
resolution is now built directly into the core client.
|
|
213
|
+
|
|
214
|
+
**Removed:**
|
|
215
|
+
|
|
216
|
+
- `namedPackagesPlugin` function
|
|
217
|
+
- `NamedPackagesPluginOptions` type (from `@mysten/sui/transactions`)
|
|
218
|
+
- `Transaction.registerGlobalSerializationPlugin()` static method
|
|
219
|
+
- `Transaction.unregisterGlobalSerializationPlugin()` static method
|
|
220
|
+
- `Transaction.registerGlobalBuildPlugin()` static method
|
|
221
|
+
- `Transaction.unregisterGlobalBuildPlugin()` static method
|
|
222
|
+
|
|
223
|
+
**How it works now:**
|
|
224
|
+
|
|
225
|
+
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.
|
|
227
|
+
|
|
228
|
+
**Migration:**
|
|
229
|
+
|
|
230
|
+
```diff
|
|
231
|
+
- import { Transaction, namedPackagesPlugin } from '@mysten/sui/transactions';
|
|
232
|
+
-
|
|
233
|
+
- Transaction.registerGlobalSerializationPlugin(
|
|
234
|
+
- 'namedPackages',
|
|
235
|
+
- namedPackagesPlugin({
|
|
236
|
+
- url: 'https://mainnet.mvr.mystenlabs.com',
|
|
237
|
+
- overrides: myOverrides,
|
|
238
|
+
- })
|
|
239
|
+
- );
|
|
240
|
+
|
|
241
|
+
+ import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
242
|
+
+ import type { NamedPackagesOverrides } from '@mysten/sui/client';
|
|
243
|
+
+
|
|
244
|
+
+ const client = new SuiJsonRpcClient({
|
|
245
|
+
+ url: 'https://fullnode.mainnet.sui.io:443',
|
|
246
|
+
+ network: 'mainnet',
|
|
247
|
+
+ mvr: {
|
|
248
|
+
+ overrides: myOverrides,
|
|
249
|
+
+ },
|
|
250
|
+
+ });
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Transaction Executors Now Accept Any Client
|
|
254
|
+
|
|
255
|
+
The transaction executor classes now accept any client implementing `ClientWithCoreApi` instead of
|
|
256
|
+
requiring `SuiJsonRpcClient` specifically.
|
|
257
|
+
|
|
258
|
+
**Affected classes:**
|
|
259
|
+
|
|
260
|
+
- `CachingTransactionExecutor`
|
|
261
|
+
- `SerialTransactionExecutor`
|
|
262
|
+
- `ParallelTransactionExecutor`
|
|
263
|
+
|
|
264
|
+
**Breaking changes:**
|
|
265
|
+
|
|
266
|
+
- Constructor `client` parameter type changed from `SuiJsonRpcClient` to `ClientWithCoreApi`
|
|
267
|
+
- Return type of `executeTransaction()`: `data` property renamed to `result`
|
|
268
|
+
- The second parameter changed from JSON-RPC options to core API include options
|
|
269
|
+
|
|
270
|
+
**Migration:**
|
|
271
|
+
|
|
272
|
+
```diff
|
|
273
|
+
|
|
274
|
+
- import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
275
|
+
+ // Works with any client: SuiJsonRpcClient, SuiGrpcClient, or SuiGraphQLClient
|
|
276
|
+
|
|
277
|
+
const executor = new SerialTransactionExecutor({
|
|
278
|
+
- client: jsonRpcClient,
|
|
279
|
+
+ client, // Any ClientWithCoreApi-compatible client
|
|
280
|
+
signer,
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
const result = await executor.executeTransaction(tx);
|
|
284
|
+
|
|
285
|
+
// Accessing the transaction result (changed)
|
|
286
|
+
- console.log(result.data.effects?.status.status);
|
|
287
|
+
+ const tx = result.Transaction ?? result.FailedTransaction;
|
|
288
|
+
+ console.log(tx.effects.status.success);
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Include options have also changed:
|
|
292
|
+
|
|
293
|
+
```diff
|
|
294
|
+
- const result = await executor.executeTransaction(tx, {
|
|
295
|
+
- showEffects: true,
|
|
296
|
+
- showEvents: true,
|
|
297
|
+
- });
|
|
298
|
+
+ const result = await executor.executeTransaction(tx, {
|
|
299
|
+
+ effects: true,
|
|
300
|
+
+ events: true,
|
|
301
|
+
+ });
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## ZkLogin Changes
|
|
305
|
+
|
|
306
|
+
### legacyAddress Parameter Required
|
|
307
|
+
|
|
308
|
+
The `legacyAddress` parameter is now **required** for all zkLogin address computation functions.
|
|
309
|
+
|
|
310
|
+
**Migration (to preserve existing behavior):**
|
|
311
|
+
|
|
312
|
+
```diff
|
|
313
|
+
// computeZkLoginAddressFromSeed (previous default: true)
|
|
314
|
+
- computeZkLoginAddressFromSeed(seed, iss)
|
|
315
|
+
+ computeZkLoginAddressFromSeed(seed, iss, true)
|
|
316
|
+
|
|
317
|
+
// jwtToAddress (previous default: false)
|
|
318
|
+
- jwtToAddress(jwt, userSalt)
|
|
319
|
+
+ jwtToAddress(jwt, userSalt, false)
|
|
320
|
+
|
|
321
|
+
// computeZkLoginAddress (previous default: false)
|
|
322
|
+
- computeZkLoginAddress({ claimName, claimValue, iss, aud, userSalt })
|
|
323
|
+
+ computeZkLoginAddress({ claimName, claimValue, iss, aud, userSalt, legacyAddress: false })
|
|
324
|
+
|
|
325
|
+
// toZkLoginPublicIdentifier (no previous default)
|
|
326
|
+
- toZkLoginPublicIdentifier(addressSeed, iss)
|
|
327
|
+
+ toZkLoginPublicIdentifier(addressSeed, iss, { legacyAddress: false })
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Default Transaction Expiration
|
|
331
|
+
|
|
332
|
+
Transactions now default the expiration to the current epoch + 1 using `ValidDuring` when built with
|
|
333
|
+
a client. This provides replay protection for all transactions without requiring explicit
|
|
334
|
+
configuration.
|
|
335
|
+
|
|
336
|
+
**To preserve the old behavior** (no expiration), explicitly set the expiration to `None`:
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
const tx = new Transaction();
|
|
340
|
+
tx.setExpiration({ None: true });
|
|
341
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @mysten/suins
|
|
2
|
+
|
|
3
|
+
> Migrate @mysten/suins to 2.0
|
|
4
|
+
|
|
5
|
+
This package now exports a client extension that integrates with Sui clients.
|
|
6
|
+
|
|
7
|
+
```diff
|
|
8
|
+
- import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
|
|
9
|
+
- import { SuinsClient } from '@mysten/suins';
|
|
10
|
+
+ import { SuiGrpcClient } from '@mysten/sui/grpc'; // or SuiJsonRpcClient, SuiGraphQLClient
|
|
11
|
+
+ import { suins } from '@mysten/suins';
|
|
12
|
+
|
|
13
|
+
- const suiClient = new SuiClient({ url: getFullnodeUrl('mainnet') });
|
|
14
|
+
- const suinsClient = new SuinsClient({
|
|
15
|
+
- client: suiClient,
|
|
16
|
+
- network: 'mainnet',
|
|
17
|
+
- });
|
|
18
|
+
+ const client = new SuiGrpcClient({
|
|
19
|
+
+ baseUrl: 'https://fullnode.mainnet.sui.io:443',
|
|
20
|
+
+ network: 'mainnet',
|
|
21
|
+
+ }).$extend(suins());
|
|
22
|
+
|
|
23
|
+
- const nameRecord = await suinsClient.getNameRecord('example.sui');
|
|
24
|
+
+ const nameRecord = await client.suins.getNameRecord('example.sui');
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Custom Package IDs
|
|
28
|
+
|
|
29
|
+
For custom deployments or networks other than mainnet/testnet, you can provide custom package info:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
|
|
33
|
+
const customPackageInfo: PackageInfo = {
|
|
34
|
+
packageId: '0x...',
|
|
35
|
+
packageIdV1: '0x...',
|
|
36
|
+
// ... other required fields
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const client = new SuiGrpcClient({
|
|
40
|
+
baseUrl: 'http://localhost:9000',
|
|
41
|
+
network: 'localnet',
|
|
42
|
+
}).$extend(suins({ packageInfo: customPackageInfo }));
|
|
43
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Wallet Builders
|
|
2
|
+
|
|
3
|
+
> Migration guide for wallet extension developers
|
|
4
|
+
|
|
5
|
+
This guide covers the breaking changes for wallet builders implementing the
|
|
6
|
+
`@mysten/wallet-standard` interface.
|
|
7
|
+
|
|
8
|
+
## Key Changes
|
|
9
|
+
|
|
10
|
+
### Removal of `sui:reportTransactionEffects`
|
|
11
|
+
|
|
12
|
+
The `sui:reportTransactionEffects` feature has been removed entirely. If your wallet implements this
|
|
13
|
+
feature, remove it.
|
|
14
|
+
|
|
15
|
+
### New Core API Response Format
|
|
16
|
+
|
|
17
|
+
The most significant change is how you obtain BCS-encoded effects for the
|
|
18
|
+
`signAndExecuteTransaction` response. The new core API returns effects in a different structure.
|
|
19
|
+
|
|
20
|
+
## Migrating `signAndExecuteTransaction`
|
|
21
|
+
|
|
22
|
+
The wallet standard output format hasn't changed - what's different is how you obtain the BCS
|
|
23
|
+
effects when using the new Sui client APIs.
|
|
24
|
+
|
|
25
|
+
```diff
|
|
26
|
+
#signAndExecuteTransaction: SuiSignAndExecuteTransactionMethod = async ({
|
|
27
|
+
transaction,
|
|
28
|
+
signal,
|
|
29
|
+
}) => {
|
|
30
|
+
- const { bytes, signature } = await Transaction.from(
|
|
31
|
+
- await transaction.toJSON(),
|
|
32
|
+
- ).sign({ client: suiClient, signer: keypair });
|
|
33
|
+
-
|
|
34
|
+
- const { rawEffects, digest } = await suiClient.executeTransactionBlock({
|
|
35
|
+
- signature,
|
|
36
|
+
- transactionBlock: bytes,
|
|
37
|
+
- options: { showRawEffects: true },
|
|
38
|
+
- });
|
|
39
|
+
+ const parsedTransaction = Transaction.from(await transaction.toJSON());
|
|
40
|
+
+ const bytes = await parsedTransaction.build({ client });
|
|
41
|
+
+
|
|
42
|
+
+ const result = await this.#keypair.signAndExecuteTransaction({
|
|
43
|
+
+ transaction: parsedTransaction,
|
|
44
|
+
+ client,
|
|
45
|
+
+ });
|
|
46
|
+
+
|
|
47
|
+
+ const tx = result.Transaction ?? result.FailedTransaction;
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
- bytes,
|
|
51
|
+
- signature,
|
|
52
|
+
- digest,
|
|
53
|
+
- effects: toBase64(new Uint8Array(rawEffects!)),
|
|
54
|
+
+ bytes: toBase64(bytes),
|
|
55
|
+
+ signature: tx.signatures[0],
|
|
56
|
+
+ digest: tx.digest,
|
|
57
|
+
+ effects: toBase64(tx.effects.bcs!),
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Key changes:
|
|
63
|
+
|
|
64
|
+
- Use `signer.signAndExecuteTransaction()` instead of `suiClient.executeTransactionBlock()`
|
|
65
|
+
- Response is a union type - unwrap with `result.Transaction ?? result.FailedTransaction`
|
|
66
|
+
- BCS effects are in `tx.effects.bcs` (Uint8Array) instead of `rawEffects` (number array)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @mysten/walrus
|
|
2
|
+
|
|
3
|
+
> Migrate @mysten/walrus to 2.0
|
|
4
|
+
|
|
5
|
+
## Breaking Changes
|
|
6
|
+
|
|
7
|
+
- **Client required**: `WalrusClient` can no longer be created with just an RPC URL. You must pass a
|
|
8
|
+
Sui client.
|
|
9
|
+
- **Network from client**: The `network` parameter has been removed from `walrus()`. The network is
|
|
10
|
+
now inferred from the client.
|
|
11
|
+
- **Removed deprecated method**: `WalrusClient.experimental_asClientExtension()` has been removed.
|
|
12
|
+
Use the `walrus()` function instead.
|
|
13
|
+
|
|
14
|
+
## Updated Usage
|
|
15
|
+
|
|
16
|
+
If you were creating `WalrusClient` directly:
|
|
17
|
+
|
|
18
|
+
```diff
|
|
19
|
+
- import { WalrusClient } from '@mysten/walrus';
|
|
20
|
+
+ import { SuiGrpcClient } from '@mysten/sui/grpc'; // or SuiJsonRpcClient, SuiGraphQLClient
|
|
21
|
+
+ import { walrus } from '@mysten/walrus';
|
|
22
|
+
|
|
23
|
+
- const walrusClient = new WalrusClient({
|
|
24
|
+
- suiRpcUrl: 'https://fullnode.testnet.sui.io:443',
|
|
25
|
+
- network: 'testnet',
|
|
26
|
+
- });
|
|
27
|
+
+ const client = new SuiGrpcClient({
|
|
28
|
+
+ baseUrl: 'https://fullnode.testnet.sui.io:443',
|
|
29
|
+
+ network: 'testnet',
|
|
30
|
+
+ }).$extend(walrus());
|
|
31
|
+
|
|
32
|
+
- await walrusClient.getBlob(blobId);
|
|
33
|
+
+ await client.walrus.getBlob(blobId);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
If you were passing `network` to `walrus()`, remove it:
|
|
37
|
+
|
|
38
|
+
```diff
|
|
39
|
+
- client.$extend(walrus({ network: 'testnet' }));
|
|
40
|
+
+ client.$extend(walrus());
|
|
41
|
+
```
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @mysten/zksend
|
|
2
|
+
|
|
3
|
+
> Migrate @mysten/zksend to 2.0
|
|
4
|
+
|
|
5
|
+
This package now exports a client extension that integrates with Sui clients, enabling compatibility
|
|
6
|
+
with gRPC, GraphQL, and JSON RPC transports.
|
|
7
|
+
|
|
8
|
+
## Breaking Changes
|
|
9
|
+
|
|
10
|
+
- **Client extension**: The zkSend SDK is now a client extension (`client.$extend(zksend())`)
|
|
11
|
+
- **Non-contract links removed**: Only contract-based links are now supported. The `contract` option
|
|
12
|
+
no longer accepts `null`
|
|
13
|
+
- **`isContractLink` removed**: The `isContractLink` option has been removed from `ZkSendLink`
|
|
14
|
+
- **`calculateGas` removed**: The `calculateGas` option has been removed from
|
|
15
|
+
`CreateZkSendLinkOptions`
|
|
16
|
+
- **Data fetching helpers removed**: `getAssetsFromTransaction`, `isOwner`, and `ownedAfterChange`
|
|
17
|
+
are no longer exported
|
|
18
|
+
|
|
19
|
+
## Migration
|
|
20
|
+
|
|
21
|
+
Update your code to use the client extension:
|
|
22
|
+
|
|
23
|
+
```diff
|
|
24
|
+
- import { ZkSendLinkBuilder, ZkSendLink } from '@mysten/zksend';
|
|
25
|
+
+ import { zksend } from '@mysten/zksend';
|
|
26
|
+
+ import { SuiGrpcClient } from '@mysten/sui/grpc'; // or SuiJsonRpcClient, SuiGraphQLClient
|
|
27
|
+
|
|
28
|
+
+ const client = new SuiGrpcClient({
|
|
29
|
+
+ baseUrl: 'https://fullnode.testnet.sui.io:443',
|
|
30
|
+
+ network: 'testnet',
|
|
31
|
+
+ }).$extend(zksend());
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Creating a Link Builder
|
|
35
|
+
|
|
36
|
+
```diff
|
|
37
|
+
- const builder = new ZkSendLinkBuilder({
|
|
38
|
+
- client,
|
|
39
|
+
- sender: address,
|
|
40
|
+
- network: 'testnet',
|
|
41
|
+
- });
|
|
42
|
+
+ const link = client.zksend.linkBuilder({
|
|
43
|
+
+ sender: address,
|
|
44
|
+
+ });
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Loading a Link
|
|
48
|
+
|
|
49
|
+
```diff
|
|
50
|
+
- const link = new ZkSendLink({
|
|
51
|
+
- client,
|
|
52
|
+
- keypair,
|
|
53
|
+
- network: 'testnet',
|
|
54
|
+
- });
|
|
55
|
+
+ const link = await client.zksend.loadLink({
|
|
56
|
+
+ address: linkAddress,
|
|
57
|
+
+ // or: keypair: linkKeypair,
|
|
58
|
+
+ });
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Loading from URL
|
|
62
|
+
|
|
63
|
+
```diff
|
|
64
|
+
- const link = await ZkSendLink.fromUrl(url, {
|
|
65
|
+
- client,
|
|
66
|
+
- network: 'testnet',
|
|
67
|
+
- });
|
|
68
|
+
+ const link = await client.zksend.loadLinkFromUrl(url);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Complete Example
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
|
|
75
|
+
// Create client with zkSend extension
|
|
76
|
+
const client = new SuiGrpcClient({
|
|
77
|
+
baseUrl: 'https://fullnode.testnet.sui.io:443',
|
|
78
|
+
network: 'testnet',
|
|
79
|
+
}).$extend(zksend());
|
|
80
|
+
|
|
81
|
+
// Create a new link
|
|
82
|
+
const linkBuilder = client.zksend.linkBuilder({
|
|
83
|
+
sender: myAddress,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Add assets to the link
|
|
87
|
+
linkBuilder.addSui(1_000_000_000n); // 1 SUI
|
|
88
|
+
|
|
89
|
+
// Create the transaction
|
|
90
|
+
const { tx, link } = await linkBuilder.build();
|
|
91
|
+
|
|
92
|
+
// Later, load an existing link
|
|
93
|
+
const existingLink = await client.zksend.loadLinkFromUrl(linkUrl);
|
|
94
|
+
const assets = await existingLink.getAssets();
|
|
95
|
+
```
|