@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
package/dist/sui/clients/core.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Core API
|
|
2
2
|
|
|
3
|
-
> Transport-agnostic Core API shared by all Sui clients
|
|
3
|
+
> Transport-agnostic Core API shared by all Sui clients.
|
|
4
4
|
|
|
5
5
|
The Core API is the transport-agnostic interface that all Sui clients implement. It provides a
|
|
6
6
|
consistent set of methods for interacting with the Sui blockchain, regardless of whether you're
|
|
7
7
|
using gRPC, GraphQL, or JSON-RPC.
|
|
8
8
|
|
|
9
|
-
## ClientWithCoreApi
|
|
9
|
+
## `ClientWithCoreApi`
|
|
10
10
|
|
|
11
11
|
The `ClientWithCoreApi` type represents any client that implements the Core API. Use this type when
|
|
12
12
|
building SDKs or libraries that should work with any transport:
|
|
@@ -24,7 +24,7 @@ class MySDK {
|
|
|
24
24
|
}
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
## Object
|
|
27
|
+
## Object methods
|
|
28
28
|
|
|
29
29
|
Object methods accept an optional `include` parameter to control what data is returned. By default,
|
|
30
30
|
every object comes with `objectId`, `version`, `digest`, `owner`, and `type`. The following fields
|
|
@@ -32,13 +32,13 @@ are only populated when requested:
|
|
|
32
32
|
|
|
33
33
|
| Option | Type | Description |
|
|
34
34
|
| --------------------- | --------- | ------------------------------------------------------------------------- |
|
|
35
|
-
| `content` | `boolean` | BCS-encoded Move struct content
|
|
35
|
+
| `content` | `boolean` | BCS-encoded Move struct content (pass this to generated BCS type parsers) |
|
|
36
36
|
| `previousTransaction` | `boolean` | Digest of the transaction that last mutated this object |
|
|
37
37
|
| `json` | `boolean` | JSON representation of the object's Move struct content |
|
|
38
|
-
| `objectBcs` | `boolean` | Full BCS-encoded object envelope (rarely needed
|
|
38
|
+
| `objectBcs` | `boolean` | Full BCS-encoded object envelope (rarely needed; see [below](#objectbcs)) |
|
|
39
39
|
| `display` | `boolean` | [Sui Display Standard](https://docs.sui.io/standards/display) metadata |
|
|
40
40
|
|
|
41
|
-
### getObject
|
|
41
|
+
### `getObject`
|
|
42
42
|
|
|
43
43
|
Fetch a single object by ID.
|
|
44
44
|
|
|
@@ -57,7 +57,7 @@ console.log(object.digest);
|
|
|
57
57
|
console.log(object.type); // e.g., "0x2::coin::Coin<0x2::sui::SUI>"
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
### getObjects
|
|
60
|
+
### `getObjects`
|
|
61
61
|
|
|
62
62
|
Fetch multiple objects in a single request.
|
|
63
63
|
|
|
@@ -76,7 +76,7 @@ for (const obj of objects) {
|
|
|
76
76
|
}
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
### listOwnedObjects
|
|
79
|
+
### `listOwnedObjects`
|
|
80
80
|
|
|
81
81
|
List objects owned by an address.
|
|
82
82
|
|
|
@@ -121,31 +121,32 @@ const parsed = MyStruct.parse(object.content);
|
|
|
121
121
|
|
|
122
122
|
You can also fetch a JSON representation of the object's content with `include: { json: true }`.
|
|
123
123
|
|
|
124
|
-
> **Warning:** The `json` field structure
|
|
124
|
+
> **Warning:** The `json` field structure might vary between API implementations. For example, JSON-RPC returns
|
|
125
125
|
> UID fields as nested objects (`{ "id": { "id": "0x..." } }`), while gRPC and GraphQL flatten
|
|
126
126
|
> them (`{ "id": "0x..." }`). For consistent data across all clients, use `content` and parse BCS
|
|
127
127
|
> directly.
|
|
128
128
|
|
|
129
129
|
### `objectBcs`
|
|
130
130
|
|
|
131
|
-
The `objectBcs` option returns the full BCS-encoded object envelope
|
|
132
|
-
metadata (type, `hasPublicTransfer`, version, owner, previous transaction, storage
|
|
133
|
-
this metadata is already available as fields on the object response, so you
|
|
134
|
-
`content`. If you do need `objectBcs`, parse it with `bcs.Object` from
|
|
131
|
+
The `objectBcs` option returns the full BCS-encoded object envelope, which is the struct content
|
|
132
|
+
wrapped in metadata (type, `hasPublicTransfer`, version, owner, previous transaction, and storage
|
|
133
|
+
rebate). Most of this metadata is already available as fields on the object response, so you
|
|
134
|
+
typically only need `content`. If you do need `objectBcs`, parse it with `bcs.Object` from
|
|
135
|
+
`@mysten/sui/bcs`:
|
|
135
136
|
|
|
136
137
|
```typescript
|
|
137
138
|
|
|
138
139
|
const envelope = bcs.Object.parse(object.objectBcs);
|
|
139
140
|
```
|
|
140
141
|
|
|
141
|
-
> **Error:** Do not pass `objectBcs` to a Move struct parser
|
|
142
|
+
> **Error:** Do not pass `objectBcs` to a Move struct parser. It contains wrapping metadata that will cause
|
|
142
143
|
> parsing to fail or produce incorrect results. Use `content` for parsing Move struct fields.
|
|
143
144
|
|
|
144
145
|
### `display` include option
|
|
145
146
|
|
|
146
147
|
The `display` option fetches [Sui Display Standard](https://docs.sui.io/standards/display) metadata
|
|
147
|
-
for an object. Display templates define how an object should be presented in wallets and explorers
|
|
148
|
-
fields like `name`, `description`, and `image_url`.
|
|
148
|
+
for an object. Display templates define how an object should be presented in wallets and explorers,
|
|
149
|
+
including fields like `name`, `description`, and `image_url`.
|
|
149
150
|
|
|
150
151
|
```typescript
|
|
151
152
|
const { object } = await client.core.getObject({
|
|
@@ -170,9 +171,9 @@ The `display` field is `null` when the object's type has no registered Display t
|
|
|
170
171
|
|
|
171
172
|
`display` works with `getObject`, `getObjects`, and `listOwnedObjects`.
|
|
172
173
|
|
|
173
|
-
## Coin and
|
|
174
|
+
## Coin and balance methods
|
|
174
175
|
|
|
175
|
-
### getBalance
|
|
176
|
+
### `getBalance`
|
|
176
177
|
|
|
177
178
|
Get the balance of a specific coin type for an owner.
|
|
178
179
|
|
|
@@ -186,7 +187,7 @@ console.log(balance.totalBalance); // Total balance as bigint
|
|
|
186
187
|
console.log(balance.coinObjectCount); // Number of coin objects
|
|
187
188
|
```
|
|
188
189
|
|
|
189
|
-
### listBalances
|
|
190
|
+
### `listBalances`
|
|
190
191
|
|
|
191
192
|
List all coin balances for an owner.
|
|
192
193
|
|
|
@@ -200,7 +201,7 @@ for (const balance of balances) {
|
|
|
200
201
|
}
|
|
201
202
|
```
|
|
202
203
|
|
|
203
|
-
### listCoins
|
|
204
|
+
### `listCoins`
|
|
204
205
|
|
|
205
206
|
List coin objects of a specific type owned by an address.
|
|
206
207
|
|
|
@@ -216,7 +217,7 @@ for (const coin of result.coins) {
|
|
|
216
217
|
}
|
|
217
218
|
```
|
|
218
219
|
|
|
219
|
-
### getCoinMetadata
|
|
220
|
+
### `getCoinMetadata`
|
|
220
221
|
|
|
221
222
|
Get metadata for a coin type, including its name, symbol, decimals, and description.
|
|
222
223
|
|
|
@@ -231,9 +232,9 @@ if (coinMetadata) {
|
|
|
231
232
|
}
|
|
232
233
|
```
|
|
233
234
|
|
|
234
|
-
## Dynamic
|
|
235
|
+
## Dynamic field methods
|
|
235
236
|
|
|
236
|
-
### listDynamicFields
|
|
237
|
+
### `listDynamicFields`
|
|
237
238
|
|
|
238
239
|
List dynamic fields on an object.
|
|
239
240
|
|
|
@@ -248,7 +249,7 @@ for (const field of result.dynamicFields) {
|
|
|
248
249
|
}
|
|
249
250
|
```
|
|
250
251
|
|
|
251
|
-
### getDynamicField
|
|
252
|
+
### `getDynamicField`
|
|
252
253
|
|
|
253
254
|
Get a specific dynamic field by name.
|
|
254
255
|
|
|
@@ -267,7 +268,7 @@ console.log(dynamicField.value.type);
|
|
|
267
268
|
console.log(dynamicField.value.bcs); // BCS-encoded value
|
|
268
269
|
```
|
|
269
270
|
|
|
270
|
-
### getDynamicObjectField
|
|
271
|
+
### `getDynamicObjectField`
|
|
271
272
|
|
|
272
273
|
Get a dynamic object field, returning the referenced object. Supports the same
|
|
273
274
|
[object include options](#object-methods) as `getObject`.
|
|
@@ -283,20 +284,20 @@ const { object } = await client.core.getDynamicObjectField({
|
|
|
283
284
|
});
|
|
284
285
|
```
|
|
285
286
|
|
|
286
|
-
## Transaction
|
|
287
|
+
## Transaction methods
|
|
287
288
|
|
|
288
289
|
Transaction methods accept an optional `include` parameter to control what data is returned. By
|
|
289
290
|
default, every transaction result includes `digest`, `signatures`, `epoch`, and `status`. The
|
|
290
291
|
following fields are only populated when requested:
|
|
291
292
|
|
|
292
|
-
| Option | Type | Description
|
|
293
|
-
| ---------------- | --------- |
|
|
294
|
-
| `effects` | `boolean` | Parsed transaction effects (gas used, changed objects, status
|
|
295
|
-
| `events` | `boolean` | Events emitted during execution
|
|
296
|
-
| `transaction` | `boolean` | Parsed transaction data (sender, gas config, inputs, commands)
|
|
297
|
-
| `balanceChanges` | `boolean` | Balance changes caused by the transaction
|
|
298
|
-
| `objectTypes` | `boolean` | Map of object IDs to their types for all changed objects
|
|
299
|
-
| `bcs` | `boolean` | Raw BCS-encoded transaction bytes
|
|
293
|
+
| Option | Type | Description |
|
|
294
|
+
| ---------------- | --------- | ------------------------------------------------------------------ |
|
|
295
|
+
| `effects` | `boolean` | Parsed transaction effects (gas used, changed objects, and status) |
|
|
296
|
+
| `events` | `boolean` | Events emitted during execution |
|
|
297
|
+
| `transaction` | `boolean` | Parsed transaction data (sender, gas config, inputs, commands) |
|
|
298
|
+
| `balanceChanges` | `boolean` | Balance changes caused by the transaction |
|
|
299
|
+
| `objectTypes` | `boolean` | Map of object IDs to their types for all changed objects |
|
|
300
|
+
| `bcs` | `boolean` | Raw BCS-encoded transaction bytes |
|
|
300
301
|
|
|
301
302
|
`simulateTransaction` also supports:
|
|
302
303
|
|
|
@@ -304,7 +305,7 @@ following fields are only populated when requested:
|
|
|
304
305
|
| ---------------- | --------- | ------------------------------------------------------ |
|
|
305
306
|
| `commandResults` | `boolean` | Return values and mutated references from each command |
|
|
306
307
|
|
|
307
|
-
### executeTransaction
|
|
308
|
+
### `executeTransaction`
|
|
308
309
|
|
|
309
310
|
Execute a signed transaction.
|
|
310
311
|
|
|
@@ -326,7 +327,7 @@ if (result.Transaction) {
|
|
|
326
327
|
}
|
|
327
328
|
```
|
|
328
329
|
|
|
329
|
-
### simulateTransaction
|
|
330
|
+
### `simulateTransaction`
|
|
330
331
|
|
|
331
332
|
Simulate a transaction without executing it.
|
|
332
333
|
|
|
@@ -345,7 +346,7 @@ console.log(result.effects);
|
|
|
345
346
|
console.log(result.balanceChanges);
|
|
346
347
|
```
|
|
347
348
|
|
|
348
|
-
#### Disabling
|
|
349
|
+
#### Disabling checks
|
|
349
350
|
|
|
350
351
|
By default, `simulateTransaction` runs with full transaction validation. For example when inspecting
|
|
351
352
|
non-public or non-entry Move functions set `checksEnabled: false`:
|
|
@@ -360,7 +361,7 @@ const result = await client.core.simulateTransaction({
|
|
|
360
361
|
});
|
|
361
362
|
```
|
|
362
363
|
|
|
363
|
-
### signAndExecuteTransaction
|
|
364
|
+
### `signAndExecuteTransaction`
|
|
364
365
|
|
|
365
366
|
Sign and execute a transaction in one step.
|
|
366
367
|
|
|
@@ -383,7 +384,7 @@ if (result.FailedTransaction) {
|
|
|
383
384
|
console.log('Digest:', result.Transaction.digest);
|
|
384
385
|
```
|
|
385
386
|
|
|
386
|
-
### getTransaction
|
|
387
|
+
### `getTransaction`
|
|
387
388
|
|
|
388
389
|
Fetch a transaction by digest.
|
|
389
390
|
|
|
@@ -414,7 +415,7 @@ const result = await client.core.getTransaction({
|
|
|
414
415
|
console.log(result.Transaction?.bcs); // Uint8Array
|
|
415
416
|
```
|
|
416
417
|
|
|
417
|
-
### waitForTransaction
|
|
418
|
+
### `waitForTransaction`
|
|
418
419
|
|
|
419
420
|
Wait for a transaction to be available.
|
|
420
421
|
|
|
@@ -437,9 +438,9 @@ const finalResult = await client.core.waitForTransaction({
|
|
|
437
438
|
});
|
|
438
439
|
```
|
|
439
440
|
|
|
440
|
-
## System
|
|
441
|
+
## System methods
|
|
441
442
|
|
|
442
|
-
### getReferenceGasPrice
|
|
443
|
+
### `getReferenceGasPrice`
|
|
443
444
|
|
|
444
445
|
Get the current reference gas price.
|
|
445
446
|
|
|
@@ -448,7 +449,7 @@ const { referenceGasPrice } = await client.core.getReferenceGasPrice();
|
|
|
448
449
|
console.log(referenceGasPrice); // bigint
|
|
449
450
|
```
|
|
450
451
|
|
|
451
|
-
### getCurrentSystemState
|
|
452
|
+
### `getCurrentSystemState`
|
|
452
453
|
|
|
453
454
|
Get the current system state including epoch information.
|
|
454
455
|
|
|
@@ -458,7 +459,7 @@ console.log(systemState.epoch);
|
|
|
458
459
|
console.log(systemState.systemStateVersion);
|
|
459
460
|
```
|
|
460
461
|
|
|
461
|
-
### getChainIdentifier
|
|
462
|
+
### `getChainIdentifier`
|
|
462
463
|
|
|
463
464
|
Get the chain identifier for the network.
|
|
464
465
|
|
|
@@ -467,9 +468,9 @@ const { chainIdentifier } = await client.core.getChainIdentifier();
|
|
|
467
468
|
console.log(chainIdentifier); // e.g., "4c78adac"
|
|
468
469
|
```
|
|
469
470
|
|
|
470
|
-
## Move
|
|
471
|
+
## Move methods
|
|
471
472
|
|
|
472
|
-
### getMoveFunction
|
|
473
|
+
### `getMoveFunction`
|
|
473
474
|
|
|
474
475
|
Get information about a Move function.
|
|
475
476
|
|
|
@@ -485,9 +486,9 @@ console.log(fn.parameters);
|
|
|
485
486
|
console.log(fn.typeParameters);
|
|
486
487
|
```
|
|
487
488
|
|
|
488
|
-
## Name
|
|
489
|
+
## Name service methods
|
|
489
490
|
|
|
490
|
-
### defaultNameServiceName
|
|
491
|
+
### `defaultNameServiceName`
|
|
491
492
|
|
|
492
493
|
Resolve an address to its default SuiNS name.
|
|
493
494
|
|
|
@@ -499,11 +500,11 @@ const { name } = await client.core.defaultNameServiceName({
|
|
|
499
500
|
console.log(name); // e.g., "example.sui"
|
|
500
501
|
```
|
|
501
502
|
|
|
502
|
-
## MVR
|
|
503
|
+
## MVR methods
|
|
503
504
|
|
|
504
505
|
The client also exposes MVR (Move Registry) methods through `client.core.mvr`:
|
|
505
506
|
|
|
506
|
-
### resolveType
|
|
507
|
+
### `resolveType`
|
|
507
508
|
|
|
508
509
|
Resolve a type name (including `.move` names) to a fully qualified type.
|
|
509
510
|
|
|
@@ -515,9 +516,9 @@ const { type } = await client.core.mvr.resolveType({
|
|
|
515
516
|
console.log(type); // "0x2::coin::Coin<0x2::sui::SUI>"
|
|
516
517
|
```
|
|
517
518
|
|
|
518
|
-
## Error
|
|
519
|
+
## Error handling
|
|
519
520
|
|
|
520
|
-
Methods that fetch objects
|
|
521
|
+
Methods that fetch objects might return errors in the result:
|
|
521
522
|
|
|
522
523
|
```typescript
|
|
523
524
|
const { objects } = await client.core.getObjects({
|
|
@@ -549,7 +550,7 @@ if (result.Transaction) {
|
|
|
549
550
|
}
|
|
550
551
|
```
|
|
551
552
|
|
|
552
|
-
## SuiClientTypes Namespace
|
|
553
|
+
## `SuiClientTypes` Namespace
|
|
553
554
|
|
|
554
555
|
The `SuiClientTypes` namespace contains all type definitions for the Core API. Import it when you
|
|
555
556
|
need to type function parameters, return values, or variables:
|
|
@@ -577,7 +578,7 @@ const options: SuiClientTypes.GetObjectOptions<{ content: true }> = {
|
|
|
577
578
|
};
|
|
578
579
|
```
|
|
579
580
|
|
|
580
|
-
### Common
|
|
581
|
+
### Common types
|
|
581
582
|
|
|
582
583
|
| Type | Description |
|
|
583
584
|
| ---------------------- | ------------------------------------------- |
|
|
@@ -595,7 +596,7 @@ const options: SuiClientTypes.GetObjectOptions<{ content: true }> = {
|
|
|
595
596
|
| `FunctionResponse` | Move function metadata |
|
|
596
597
|
| `Network` | Network identifier type |
|
|
597
598
|
|
|
598
|
-
### Include
|
|
599
|
+
### Include options types
|
|
599
600
|
|
|
600
601
|
| Type | Description |
|
|
601
602
|
| ---------------------------- | --------------------------------------- |
|
|
@@ -603,7 +604,7 @@ const options: SuiClientTypes.GetObjectOptions<{ content: true }> = {
|
|
|
603
604
|
| `TransactionInclude` | Options for transaction data inclusion |
|
|
604
605
|
| `SimulateTransactionInclude` | Extended options for simulation results |
|
|
605
606
|
|
|
606
|
-
### Method
|
|
607
|
+
### Method options types
|
|
607
608
|
|
|
608
609
|
| Type | Description |
|
|
609
610
|
| ---------------------------------- | --------------------------------------- |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SuiGraphQLClient
|
|
2
2
|
|
|
3
|
-
> Connect to Sui
|
|
3
|
+
> Connect to Sui through GraphQL with SuiGraphQLClient.
|
|
4
4
|
|
|
5
5
|
The `SuiGraphQLClient` enables type-safe GraphQL queries against the Sui GraphQL API.
|
|
6
6
|
|
|
@@ -50,7 +50,7 @@ async function getChainIdentifier() {
|
|
|
50
50
|
|
|
51
51
|
## Type-safety for GraphQL queries
|
|
52
52
|
|
|
53
|
-
You
|
|
53
|
+
You might have noticed the example above does not include any type definitions for the query. The
|
|
54
54
|
`graphql` function used in the example is powered by [`gql.tada`](https://gql-tada.0no.co/) and will
|
|
55
55
|
automatically provide the required type information to ensure that your queries are properly typed
|
|
56
56
|
when executed through `SuiGraphQLClient`.
|
|
@@ -82,7 +82,7 @@ async function getDefaultSuinsName(address: string) {
|
|
|
82
82
|
## Using typed GraphQL queries with other GraphQL clients
|
|
83
83
|
|
|
84
84
|
The `graphql` function returns document nodes that implement the
|
|
85
|
-
[TypedDocumentNode](https://github.com/dotansimha/graphql-typed-document-node) standard, and will
|
|
85
|
+
[`TypedDocumentNode`](https://github.com/dotansimha/graphql-typed-document-node) standard, and will
|
|
86
86
|
work with the majority of popular GraphQL clients to provide queries that are automatically typed.
|
|
87
87
|
|
|
88
88
|
```typescript
|
package/dist/sui/clients/grpc.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SuiGrpcClient
|
|
2
2
|
|
|
3
|
-
> Connect to Sui
|
|
3
|
+
> Connect to Sui through gRPC with SuiGrpcClient.
|
|
4
4
|
|
|
5
5
|
The `SuiGrpcClient` provides access to the Full Node gRPC API.
|
|
6
6
|
|
|
@@ -31,8 +31,8 @@ const grpcClient = new SuiGrpcClient({
|
|
|
31
31
|
## Transport options
|
|
32
32
|
|
|
33
33
|
By default, `SuiGrpcClient` uses `GrpcWebFetchTransport` from
|
|
34
|
-
[protobuf-ts](https://github.com/timostamm/protobuf-ts), which works in browsers and Node.js
|
|
35
|
-
Fetch API. You can also provide a custom transport for advanced use cases.
|
|
34
|
+
[protobuf-ts](https://github.com/timostamm/protobuf-ts), which works in browsers and Node.js through
|
|
35
|
+
the Fetch API. You can also provide a custom transport for advanced use cases.
|
|
36
36
|
|
|
37
37
|
The `GrpcWebFetchTransport` class, `GrpcWebOptions` type, and `RpcTransport` type are all
|
|
38
38
|
re-exported from `@mysten/sui/grpc` for convenience.
|
|
@@ -58,7 +58,7 @@ const grpcClient = new SuiGrpcClient({
|
|
|
58
58
|
|
|
59
59
|
### Native gRPC transport
|
|
60
60
|
|
|
61
|
-
For server-side applications (Node.js, Bun,
|
|
61
|
+
For server-side applications (Node.js, Bun, and others), you can use the native gRPC transport with
|
|
62
62
|
`@protobuf-ts/grpc-transport` and `@grpc/grpc-js`. This uses HTTP/2 with the native gRPC protocol
|
|
63
63
|
rather than the gRPC-web translation layer.
|
|
64
64
|
|
|
@@ -123,7 +123,7 @@ await grpcClient.getCoins({
|
|
|
123
123
|
|
|
124
124
|
To query additional data not available in the core API, you can use the service clients directly:
|
|
125
125
|
|
|
126
|
-
### Transaction
|
|
126
|
+
### Transaction execution service
|
|
127
127
|
|
|
128
128
|
```typescript
|
|
129
129
|
const { response } = await grpcClient.transactionExecutionService.executeTransaction({
|
|
@@ -145,7 +145,7 @@ if (!response.finality?.effects?.status?.success) {
|
|
|
145
145
|
}
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
### Ledger
|
|
148
|
+
### Ledger service
|
|
149
149
|
|
|
150
150
|
```typescript
|
|
151
151
|
// Get transaction by digest
|
|
@@ -157,7 +157,7 @@ const { response } = await grpcClient.ledgerService.getTransaction({
|
|
|
157
157
|
const { response: epochInfo } = await grpcClient.ledgerService.getEpoch({});
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
### State
|
|
160
|
+
### State service
|
|
161
161
|
|
|
162
162
|
```typescript
|
|
163
163
|
// List owned objects
|
|
@@ -172,7 +172,7 @@ const { response: fields } = await grpcClient.stateService.listDynamicFields({
|
|
|
172
172
|
});
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
### Move
|
|
175
|
+
### Move package service
|
|
176
176
|
|
|
177
177
|
```typescript
|
|
178
178
|
// Get function information
|
|
@@ -183,7 +183,7 @@ const { response } = await grpcClient.movePackageService.getFunction({
|
|
|
183
183
|
});
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
### Name
|
|
186
|
+
### Name service
|
|
187
187
|
|
|
188
188
|
```typescript
|
|
189
189
|
// Reverse lookup address to get name
|
|
@@ -192,7 +192,7 @@ const { response } = await grpcClient.nameService.reverseLookupName({
|
|
|
192
192
|
});
|
|
193
193
|
```
|
|
194
194
|
|
|
195
|
-
### Signature
|
|
195
|
+
### Signature verification service
|
|
196
196
|
|
|
197
197
|
```typescript
|
|
198
198
|
// Verify a signature
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
# Sui Clients
|
|
2
2
|
|
|
3
|
-
> Choose and configure gRPC, GraphQL, or JSON-RPC clients
|
|
3
|
+
> Choose and configure gRPC, GraphQL, or JSON-RPC clients for the Sui network.
|
|
4
4
|
|
|
5
5
|
The Sui TypeScript SDK provides multiple client implementations for interacting with the Sui
|
|
6
6
|
network. Each client connects to a different API but provides two levels of access:
|
|
7
7
|
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
operations
|
|
8
|
+
- Native API: Full access to everything the underlying API offers
|
|
9
|
+
- [Core API](/sui/clients/core): A consistent interface across all clients for common operations
|
|
11
10
|
|
|
12
|
-
## Available
|
|
11
|
+
## Available clients
|
|
13
12
|
|
|
14
|
-
| Client
|
|
15
|
-
|
|
|
16
|
-
| [SuiGrpcClient](/sui/clients/grpc) (recommended) | [Full Node gRPC](https://docs.sui.io/references/fullnode-protocol) |
|
|
17
|
-
| [SuiGraphQLClient](/sui/clients/graphql) | [GraphQL](https://docs.sui.io/references/sui-graphql) |
|
|
18
|
-
| [SuiJsonRpcClient](/sui/clients/json-rpc) (deprecated) | [JSON-RPC (deprecated)](https://docs.sui.io/sui-api-ref) |
|
|
13
|
+
| Client | API |
|
|
14
|
+
| -------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
15
|
+
| [`SuiGrpcClient`](/sui/clients/grpc) (recommended) | [Full Node gRPC](https://docs.sui.io/references/fullnode-protocol) |
|
|
16
|
+
| [`SuiGraphQLClient`](/sui/clients/graphql) | [GraphQL](https://docs.sui.io/references/sui-graphql) |
|
|
17
|
+
| [`SuiJsonRpcClient`](/sui/clients/json-rpc) (deprecated) | [JSON-RPC (deprecated)](https://docs.sui.io/sui-api-ref) |
|
|
19
18
|
|
|
20
19
|
All clients are compatible with Mysten SDKs like `@mysten/walrus`, `@mysten/seal` and
|
|
21
20
|
`@mysten/suins`.
|
|
22
21
|
|
|
23
22
|
For most application gRPC is a good default. The JSON RPC API has been deprecated and will be
|
|
24
23
|
decommissioned soon. The GraphQL can be used for more advanced query patterns that can not be
|
|
25
|
-
supported directly on full nodes (
|
|
24
|
+
supported directly on full nodes (for example, querying for transactions or events with various
|
|
25
|
+
filters).
|
|
26
26
|
|
|
27
|
-
## Quick
|
|
27
|
+
## Quick start
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
30
|
|
|
@@ -40,7 +40,7 @@ const { response } = await client.ledgerService.getTransaction({ digest: '0x...'
|
|
|
40
40
|
const { object } = await client.core.getObject({ objectId: '0x...' });
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
## Native vs
|
|
43
|
+
## Native vs core API
|
|
44
44
|
|
|
45
45
|
### Native API
|
|
46
46
|
|
|
@@ -80,7 +80,7 @@ await client.core.executeTransaction({ transaction, signatures });
|
|
|
80
80
|
The Core API is essential for [building SDKs](/sui/sdk-building) that work with any client the user
|
|
81
81
|
chooses.
|
|
82
82
|
|
|
83
|
-
## Client
|
|
83
|
+
## Client extensions
|
|
84
84
|
|
|
85
85
|
All clients support extensions through the `$extend` method, enabling SDKs like
|
|
86
86
|
[@mysten/walrus](https://www.npmjs.com/package/@mysten/walrus) to add functionality:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# SuiJsonRpcClient
|
|
2
2
|
|
|
3
|
-
> Connect to Sui
|
|
3
|
+
> Connect to Sui through JSON-RPC with SuiJsonRpcClient.
|
|
4
4
|
|
|
5
5
|
> **Warning:** The Sui JSON-RPC API has been deprecated. We recommend migration to
|
|
6
|
-
> [SuiGrpcClient](/sui/clients/grpc) or [SuiGraphQLClient](/sui/clients/graphql) as soon as
|
|
6
|
+
> [`SuiGrpcClient`](/sui/clients/grpc) or [`SuiGraphQLClient`](/sui/clients/graphql) as soon as
|
|
7
7
|
> possible.
|
|
8
8
|
|
|
9
9
|
The `SuiJsonRpcClient` connects to a Sui network's JSON-RPC server. It implements the
|
|
@@ -100,9 +100,9 @@ const client = new SuiJsonRpcClient({
|
|
|
100
100
|
`SuiJsonRpcClient` exposes a number of RPC methods that return paginated results. These methods
|
|
101
101
|
return a result object with 3 fields:
|
|
102
102
|
|
|
103
|
-
- data
|
|
104
|
-
- nextCursor
|
|
105
|
-
- hasNextPage
|
|
103
|
+
- `data`: The list of results for the current page
|
|
104
|
+
- `nextCursor`: A cursor pointing to the next page of results
|
|
105
|
+
- `hasNextPage`: A boolean indicating whether there are more pages of results
|
|
106
106
|
|
|
107
107
|
Some APIs also accept an `order` option that can be set to either `ascending` or `descending` to
|
|
108
108
|
change the order in which the results are returned.
|
|
@@ -150,10 +150,10 @@ const result = await client.executeTransactionBlock({
|
|
|
150
150
|
|
|
151
151
|
#### Arguments
|
|
152
152
|
|
|
153
|
-
- `transactionBlock
|
|
153
|
+
- `transactionBlock`: either a Transaction or BCS serialized transaction data bytes as a Uint8Array
|
|
154
154
|
or as a base-64 encoded string.
|
|
155
|
-
- `signature
|
|
156
|
-
|
|
155
|
+
- `signature`: A signature, or list of signatures committed to the intent message of the transaction
|
|
156
|
+
data, as a base-64 encoded string.
|
|
157
157
|
- `options`:
|
|
158
158
|
- `showBalanceChanges`: Whether to show balance_changes. Default to be False
|
|
159
159
|
- `showEffects`: Whether to show transaction effects. Default to be False
|
|
@@ -185,9 +185,9 @@ if (result.$kind === 'FailedTransaction') {
|
|
|
185
185
|
|
|
186
186
|
#### Arguments
|
|
187
187
|
|
|
188
|
-
- `transaction
|
|
188
|
+
- `transaction`: BCS serialized transaction data bytes as a Uint8Array or as a base-64 encoded
|
|
189
189
|
string.
|
|
190
|
-
- `signer
|
|
190
|
+
- `signer`: A `Keypair` instance to sign the transaction
|
|
191
191
|
- `options`:
|
|
192
192
|
- `showBalanceChanges`: Whether to show balance_changes. Default to be False
|
|
193
193
|
- `showEffects`: Whether to show transaction effects. Default to be False
|
|
@@ -199,8 +199,8 @@ if (result.$kind === 'FailedTransaction') {
|
|
|
199
199
|
### `waitForTransaction`
|
|
200
200
|
|
|
201
201
|
Wait for a transaction result to be available over the API. This can be used in conjunction with
|
|
202
|
-
`signAndExecuteTransaction` to wait for the transaction to be available
|
|
203
|
-
polls the `getTransactionBlock` API to check for the transaction.
|
|
202
|
+
`signAndExecuteTransaction` to wait for the transaction to be available through the API. This
|
|
203
|
+
currently polls the `getTransactionBlock` API to check for the transaction.
|
|
204
204
|
|
|
205
205
|
```tsx
|
|
206
206
|
const tx = new Transaction();
|
|
@@ -225,10 +225,10 @@ const transaction = await client.waitForTransaction({
|
|
|
225
225
|
|
|
226
226
|
#### Arguments
|
|
227
227
|
|
|
228
|
-
- `digest
|
|
229
|
-
- `signal
|
|
230
|
-
- `timeout
|
|
231
|
-
- `pollInterval
|
|
228
|
+
- `digest`: the digest of the queried transaction
|
|
229
|
+
- `signal`: An optional abort signal that can be used to cancel the request
|
|
230
|
+
- `timeout`: The amount of time to wait for a transaction. Defaults to one minute.
|
|
231
|
+
- `pollInterval`: The amount of time to wait between checks for the transaction. Defaults to 2
|
|
232
232
|
seconds.
|
|
233
233
|
- `options`:
|
|
234
234
|
- `showBalanceChanges`: Whether to show balance_changes. Default to be False
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Key pairs
|
|
2
2
|
|
|
3
|
-
> Create and manage Ed25519, Secp256k1, and Secp256r1 keypairs
|
|
3
|
+
> Create and manage Ed25519, Secp256k1, and Secp256r1 keypairs for Sui transaction signing.
|
|
4
4
|
|
|
5
5
|
The Sui TypeScript SDK provides `Keypair` classes that handle logic for signing and verification
|
|
6
6
|
using the cryptographic key pairs associated with a Sui address.
|
|
@@ -134,10 +134,10 @@ await verifyTransactionSignature(bytes, signature, {
|
|
|
134
134
|
## Verifying zkLogin signatures
|
|
135
135
|
|
|
136
136
|
ZkLogin signatures can't be verified purely on the client. When verifying a zkLogin signature, the
|
|
137
|
-
SDK uses the GraphQL API to verify the signature. This
|
|
137
|
+
SDK uses the GraphQL API to verify the signature. This works for Mainnet signatures without any
|
|
138
138
|
additional configuration.
|
|
139
139
|
|
|
140
|
-
For
|
|
140
|
+
For Testnet signatures, you need to provide a Testnet GraphQL Client:
|
|
141
141
|
|
|
142
142
|
```typescript
|
|
143
143
|
|
|
@@ -148,9 +148,9 @@ const publicKey = await verifyPersonalMessageSignature(message, zkSignature, {
|
|
|
148
148
|
});
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
For some zklogin accounts, there are
|
|
152
|
-
run into issues if you try to compare the address returned by `publicKey.toSuiAddress()`
|
|
153
|
-
with an expected address.
|
|
151
|
+
For some zklogin accounts, there are two valid addresses for a given set of inputs. This means you
|
|
152
|
+
might run into issues if you try to compare the address returned by `publicKey.toSuiAddress()`
|
|
153
|
+
directly with an expected address.
|
|
154
154
|
|
|
155
155
|
Instead, you can either pass in the expected address during verification, or use the
|
|
156
156
|
`publicKey.verifyAddress(address)` method:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Multi-Signature Transactions
|
|
2
2
|
|
|
3
|
-
> Create multi-signature transactions with multiple signers
|
|
3
|
+
> Create multi-signature transactions with multiple signers on Sui.
|
|
4
4
|
|
|
5
5
|
The Sui TypeScript SDK provides a `MultiSigPublicKey` class to support
|
|
6
6
|
[Multi-Signature](https://docs.sui.io/concepts/cryptography/transaction-auth/multisig) (MultiSig)
|
|
@@ -69,7 +69,7 @@ const isValid = await multiSigPublicKey.verifyPersonalMessage(message, combinedS
|
|
|
69
69
|
|
|
70
70
|
The `MultiSigSigner` class allows you to create a Signer that can be used to sign personal messages
|
|
71
71
|
and Transactions like any other keypair or signer class. This is often easier than manually
|
|
72
|
-
combining signatures,
|
|
72
|
+
combining signatures, because many methods accept Signers and handle signing directly.
|
|
73
73
|
|
|
74
74
|
A `MultiSigSigner` is created by providing the underlying Signers to the `getSigner` method on the
|
|
75
75
|
`MultiSigPublicKey`. You can provide a subset of the Signers that make up the public key, so long as
|
|
@@ -147,7 +147,7 @@ const zkLoginSig = getZkLoginSignature({
|
|
|
147
147
|
const multisig = multiSigPublicKey.combinePartialSignatures([zkLoginSig]);
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
### Benefits and
|
|
150
|
+
### Benefits and design for zkLogin in multisig
|
|
151
151
|
|
|
152
152
|
Because zkLogin assumes the application client ID and its issuer (such as Google) liveliness, using
|
|
153
153
|
zkLogin with multisig provides improved recoverability to a zkLogin account. In the previous example
|
|
@@ -168,7 +168,7 @@ In this case, Charlie can always use their Google account for transactions out o
|
|
|
168
168
|
address for the threshold. At the same time, Charlie still has access to his account by combining
|
|
169
169
|
partial signatures from Alice and Bob.
|
|
170
170
|
|
|
171
|
-
## Multisig with
|
|
171
|
+
## Multisig with passkey
|
|
172
172
|
|
|
173
173
|
You can use a `PasskeyKeypair` (a `Keypair`) and `PasskeyPublicKey` (a `PublicKey`) as components in
|
|
174
174
|
a Multisig setup. Once initialized, they support both Multisig address derivation and transaction
|