@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,386 @@
|
|
|
1
|
+
# Migrating from JSON-RPC
|
|
2
|
+
|
|
3
|
+
> Migrate from JSON-RPC to the new Core API
|
|
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` |
|
|
58
|
+
| `dryRunTransactionBlock` | `simulateTransaction` |
|
|
59
|
+
| `getNormalizedMoveFunction` | `getMoveFunction` |
|
|
60
|
+
| `getMoveFunctionArgTypes` | `getMoveFunction` |
|
|
61
|
+
|
|
62
|
+
### Example: Migrating getOwnedObjects
|
|
63
|
+
|
|
64
|
+
```diff
|
|
65
|
+
- const { data } = await jsonRpcClient.getOwnedObjects({
|
|
66
|
+
- owner: '0xabc...',
|
|
67
|
+
- options: { showContent: true },
|
|
68
|
+
- });
|
|
69
|
+
+ const { objects } = await grpcClient.listOwnedObjects({
|
|
70
|
+
+ owner: '0xabc...',
|
|
71
|
+
+ include: { content: true },
|
|
72
|
+
+ });
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Methods Replaced by gRPC Services
|
|
76
|
+
|
|
77
|
+
These JSON-RPC methods can be replaced by calling gRPC service clients directly:
|
|
78
|
+
|
|
79
|
+
| JSON-RPC Method | gRPC Service Replacement |
|
|
80
|
+
| ----------------------------------- | --------------------------------- |
|
|
81
|
+
| `getCheckpoint` | `ledgerService.getCheckpoint` |
|
|
82
|
+
| `getCheckpoints` | `ledgerService.listCheckpoints` |
|
|
83
|
+
| `getLatestCheckpointSequenceNumber` | `ledgerService.getCheckpoint` |
|
|
84
|
+
| `getEpochs` | `ledgerService.listEpochs` |
|
|
85
|
+
| `getCurrentEpoch` | `ledgerService.getEpoch` |
|
|
86
|
+
| `getLatestSuiSystemState` | `ledgerService.getSystemState` |
|
|
87
|
+
| `getCommitteeInfo` | `ledgerService.getCommittee` |
|
|
88
|
+
| `getValidatorsApy` | `ledgerService.getValidators` |
|
|
89
|
+
| `getProtocolConfig` | `ledgerService.getProtocolConfig` |
|
|
90
|
+
| `getNormalizedMoveModule` | `movePackageService.getModule` |
|
|
91
|
+
| `getNormalizedMoveModulesByPackage` | `movePackageService.getPackage` |
|
|
92
|
+
| `getNormalizedMoveStruct` | `movePackageService.getStruct` |
|
|
93
|
+
| `resolveNameServiceAddress` | `nameService.lookupName` |
|
|
94
|
+
| `resolveNameServiceNames` | `nameService.reverseLookupName` |
|
|
95
|
+
|
|
96
|
+
### Example: Using gRPC Service Clients
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
|
|
100
|
+
const client = new SuiGrpcClient({
|
|
101
|
+
baseUrl: 'https://fullnode.mainnet.sui.io:443',
|
|
102
|
+
network: 'mainnet',
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Get checkpoint information
|
|
106
|
+
const { response } = await client.ledgerService.getCheckpoint({
|
|
107
|
+
sequenceNumber: 12345n,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Get current epoch
|
|
111
|
+
const { response: epoch } = await client.ledgerService.getEpoch({});
|
|
112
|
+
|
|
113
|
+
// Get Move module information
|
|
114
|
+
const { response: module } = await client.movePackageService.getModule({
|
|
115
|
+
packageId: '0x2',
|
|
116
|
+
moduleName: 'coin',
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// Resolve SuiNS name
|
|
120
|
+
const { response: address } = await client.nameService.lookupName({
|
|
121
|
+
name: 'example.sui',
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Methods Requiring GraphQL
|
|
126
|
+
|
|
127
|
+
Some JSON-RPC methods don't have gRPC equivalents and require using `SuiGraphQLClient` instead:
|
|
128
|
+
|
|
129
|
+
| JSON-RPC Method | GraphQL Alternative |
|
|
130
|
+
| --------------------------- | ---------------------------------- |
|
|
131
|
+
| `queryTransactionBlocks` | `transactions` query |
|
|
132
|
+
| `multiGetTransactionBlocks` | `multiGetTransactionEffects` query |
|
|
133
|
+
| `queryEvents` | `events` query |
|
|
134
|
+
| `getCoinMetadata` | `coinMetadata` query |
|
|
135
|
+
| `getTotalSupply` | `coinMetadata` query |
|
|
136
|
+
| `getStakes` | `address.stakedSuis` query |
|
|
137
|
+
| `getStakesByIds` | `multiGetObjects` query |
|
|
138
|
+
| `tryGetPastObject` | Historical object queries |
|
|
139
|
+
| `getNetworkMetrics` | Use indexer |
|
|
140
|
+
| `getAddressMetrics` | Use indexer |
|
|
141
|
+
| `getMoveCallMetrics` | Use indexer |
|
|
142
|
+
|
|
143
|
+
### Setting Up GraphQL Client
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
|
|
147
|
+
const graphqlClient = new SuiGraphQLClient({
|
|
148
|
+
url: 'https://sui-mainnet.mystenlabs.com/graphql',
|
|
149
|
+
network: 'mainnet',
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Querying Transactions
|
|
154
|
+
|
|
155
|
+
Replace `queryTransactionBlocks` with a GraphQL query:
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
const result = await graphqlClient.query({
|
|
159
|
+
query: `
|
|
160
|
+
query QueryTransactions($sender: SuiAddress, $first: Int, $after: String) {
|
|
161
|
+
transactions(
|
|
162
|
+
first: $first
|
|
163
|
+
after: $after
|
|
164
|
+
filter: { sentAddress: $sender }
|
|
165
|
+
) {
|
|
166
|
+
pageInfo {
|
|
167
|
+
hasNextPage
|
|
168
|
+
endCursor
|
|
169
|
+
}
|
|
170
|
+
nodes {
|
|
171
|
+
digest
|
|
172
|
+
effects {
|
|
173
|
+
status
|
|
174
|
+
epoch { epochId }
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
`,
|
|
180
|
+
variables: {
|
|
181
|
+
sender: '0xabc...',
|
|
182
|
+
first: 10,
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Available transaction filters:**
|
|
188
|
+
|
|
189
|
+
- `sentAddress` - Filter by sender address
|
|
190
|
+
- `affectedAddress` - Filter by any address involved in the transaction
|
|
191
|
+
- `affectedObject` - Filter by object ID that was affected
|
|
192
|
+
- `function` - Filter by Move function called (e.g., `0x2::coin::transfer`)
|
|
193
|
+
- `kind` - Filter by transaction kind (`SYSTEM` or `PROGRAMMABLE`)
|
|
194
|
+
- `atCheckpoint` / `beforeCheckpoint` / `afterCheckpoint` - Filter by checkpoint
|
|
195
|
+
|
|
196
|
+
### Querying Events
|
|
197
|
+
|
|
198
|
+
Replace `queryEvents` with a GraphQL query:
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
const result = await graphqlClient.query({
|
|
202
|
+
query: `
|
|
203
|
+
query QueryEvents($type: String, $first: Int, $after: String) {
|
|
204
|
+
events(
|
|
205
|
+
first: $first
|
|
206
|
+
after: $after
|
|
207
|
+
filter: { type: $type }
|
|
208
|
+
) {
|
|
209
|
+
pageInfo {
|
|
210
|
+
hasNextPage
|
|
211
|
+
endCursor
|
|
212
|
+
}
|
|
213
|
+
nodes {
|
|
214
|
+
transactionModule {
|
|
215
|
+
package { address }
|
|
216
|
+
name
|
|
217
|
+
}
|
|
218
|
+
sender { address }
|
|
219
|
+
contents {
|
|
220
|
+
type { repr }
|
|
221
|
+
bcs
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
`,
|
|
227
|
+
variables: {
|
|
228
|
+
type: '0x2::coin::CoinCreated',
|
|
229
|
+
first: 10,
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Available event filters:**
|
|
235
|
+
|
|
236
|
+
- `type` - Filter by event type (package, package::module, or full type)
|
|
237
|
+
- `module` - Filter by emitting module
|
|
238
|
+
- `sender` - Filter by transaction sender
|
|
239
|
+
- `atCheckpoint` / `beforeCheckpoint` / `afterCheckpoint` - Filter by checkpoint
|
|
240
|
+
|
|
241
|
+
### Fetching Multiple Transactions
|
|
242
|
+
|
|
243
|
+
Replace `multiGetTransactionBlocks` with a GraphQL query:
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
const result = await graphqlClient.query({
|
|
247
|
+
query: `
|
|
248
|
+
query MultiGetTransactions($digests: [String!]!) {
|
|
249
|
+
multiGetTransactionEffects(keys: $digests) {
|
|
250
|
+
transaction {
|
|
251
|
+
digest
|
|
252
|
+
transactionBcs
|
|
253
|
+
}
|
|
254
|
+
status
|
|
255
|
+
epoch { epochId }
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
`,
|
|
259
|
+
variables: {
|
|
260
|
+
digests: ['digest1', 'digest2', 'digest3'],
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Querying Historical Objects
|
|
266
|
+
|
|
267
|
+
Replace `tryGetPastObject` with a GraphQL query specifying a version:
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
const result = await graphqlClient.query({
|
|
271
|
+
query: `
|
|
272
|
+
query GetObjectAtVersion($id: SuiAddress!, $version: UInt53!) {
|
|
273
|
+
object(address: $id, version: $version) {
|
|
274
|
+
address
|
|
275
|
+
version
|
|
276
|
+
digest
|
|
277
|
+
asMoveObject {
|
|
278
|
+
contents {
|
|
279
|
+
type { repr }
|
|
280
|
+
bcs
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
`,
|
|
286
|
+
variables: {
|
|
287
|
+
id: '0x123...',
|
|
288
|
+
version: 42,
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Querying Coin Metadata
|
|
294
|
+
|
|
295
|
+
Replace `getCoinMetadata` and `getTotalSupply` with a GraphQL query:
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
const result = await graphqlClient.query({
|
|
299
|
+
query: `
|
|
300
|
+
query GetCoinMetadata($coinType: String!) {
|
|
301
|
+
coinMetadata(coinType: $coinType) {
|
|
302
|
+
name
|
|
303
|
+
symbol
|
|
304
|
+
description
|
|
305
|
+
decimals
|
|
306
|
+
iconUrl
|
|
307
|
+
supply
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
`,
|
|
311
|
+
variables: {
|
|
312
|
+
coinType: '0x2::sui::SUI',
|
|
313
|
+
},
|
|
314
|
+
});
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Querying Staked SUI
|
|
318
|
+
|
|
319
|
+
Replace `getStakes` with a GraphQL query:
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
const result = await graphqlClient.query({
|
|
323
|
+
query: `
|
|
324
|
+
query GetStakes($owner: SuiAddress!) {
|
|
325
|
+
address(address: $owner) {
|
|
326
|
+
stakedSuis {
|
|
327
|
+
nodes {
|
|
328
|
+
principal
|
|
329
|
+
stakeActivationEpoch
|
|
330
|
+
estimatedReward
|
|
331
|
+
contents {
|
|
332
|
+
bcs
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
`,
|
|
339
|
+
variables: {
|
|
340
|
+
owner: '0xabc...',
|
|
341
|
+
},
|
|
342
|
+
});
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## Response Format Differences
|
|
346
|
+
|
|
347
|
+
The gRPC client uses the core API response format, which differs from JSON-RPC responses. See the
|
|
348
|
+
[@mysten/sui migration guide](/sui/migrations/sui-2.0/sui#transaction-executors-now-accept-any-client)
|
|
349
|
+
for details on the new response format.
|
|
350
|
+
|
|
351
|
+
Key differences:
|
|
352
|
+
|
|
353
|
+
```diff
|
|
354
|
+
// Transaction result access
|
|
355
|
+
- const status = result.effects?.status?.status;
|
|
356
|
+
+ const tx = result.Transaction ?? result.FailedTransaction;
|
|
357
|
+
+ const status = tx.effects.status.success;
|
|
358
|
+
|
|
359
|
+
// Include options
|
|
360
|
+
- { showEffects: true, showEvents: true }
|
|
361
|
+
+ { effects: true, events: true }
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Client Extensions
|
|
365
|
+
|
|
366
|
+
Client extensions work the same way with both clients:
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
|
|
370
|
+
const client = new SuiGrpcClient({
|
|
371
|
+
baseUrl: 'https://fullnode.mainnet.sui.io:443',
|
|
372
|
+
network: 'mainnet',
|
|
373
|
+
}).$extend(deepbook({ address: myAddress }), suins());
|
|
374
|
+
|
|
375
|
+
// Use extended functionality
|
|
376
|
+
await client.deepbook.checkManagerBalance(manager, asset);
|
|
377
|
+
await client.suins.getName('0xabc...');
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
## See Also
|
|
381
|
+
|
|
382
|
+
- [SuiGrpcClient Documentation](/sui/clients/grpc) - Full gRPC client documentation
|
|
383
|
+
- [SuiGraphQLClient Documentation](/sui/clients/graphql) - GraphQL client documentation
|
|
384
|
+
- [Core API](/sui/clients/core) - Transport-agnostic API methods
|
|
385
|
+
- [gRPC Overview](https://docs.sui.io/concepts/data-access/grpc-overview) - Sui gRPC API
|
|
386
|
+
documentation
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# @mysten/kiosk
|
|
2
|
+
|
|
3
|
+
> Migrate @mysten/kiosk to 2.0
|
|
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
|
|
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 via `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
|
|
87
|
+
packages. 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
|
|
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
|
+
```
|