@mysten/sui 2.16.0 → 2.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
  3. package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
  4. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
  5. package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
  6. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
  7. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
  8. package/dist/jsonRpc/http-transport.mjs +1 -2
  9. package/dist/jsonRpc/http-transport.mjs.map +1 -1
  10. package/dist/transactions/Transaction.d.mts +7 -7
  11. package/dist/transactions/data/internal.d.mts +109 -109
  12. package/dist/transactions/data/internal.d.mts.map +1 -1
  13. package/dist/transactions/data/v1.d.mts +220 -220
  14. package/dist/transactions/data/v1.d.mts.map +1 -1
  15. package/dist/transactions/data/v2.d.mts +16 -16
  16. package/dist/version.mjs +2 -3
  17. package/dist/version.mjs.map +1 -1
  18. package/docs/bcs.md +17 -14
  19. package/docs/clients/core.md +68 -62
  20. package/docs/clients/graphql.md +6 -4
  21. package/docs/clients/grpc.md +18 -13
  22. package/docs/clients/index.md +17 -15
  23. package/docs/clients/json-rpc.md +21 -17
  24. package/docs/cryptography/keypairs.md +16 -7
  25. package/docs/cryptography/multisig.md +7 -5
  26. package/docs/cryptography/passkey.md +16 -15
  27. package/docs/cryptography/webcrypto-signer.md +9 -9
  28. package/docs/executors.md +25 -22
  29. package/docs/faucet.md +4 -4
  30. package/docs/hello-sui.md +8 -7
  31. package/docs/index.md +20 -21
  32. package/docs/install.md +4 -4
  33. package/docs/llm-docs.md +10 -10
  34. package/docs/llms-index.md +41 -57
  35. package/docs/migrations/0.38.md +10 -9
  36. package/docs/migrations/sui-1.0.md +35 -33
  37. package/docs/migrations/sui-2.0/agent-prompt.md +4 -4
  38. package/docs/migrations/sui-2.0/dapp-kit.md +47 -47
  39. package/docs/migrations/sui-2.0/deepbook-v3.md +2 -2
  40. package/docs/migrations/sui-2.0/index.md +38 -37
  41. package/docs/migrations/sui-2.0/json-rpc-migration.md +59 -50
  42. package/docs/migrations/sui-2.0/kiosk.md +9 -9
  43. package/docs/migrations/sui-2.0/sdk-maintainers.md +8 -8
  44. package/docs/migrations/sui-2.0/seal.md +2 -2
  45. package/docs/migrations/sui-2.0/sui.md +17 -17
  46. package/docs/migrations/sui-2.0/suins.md +6 -4
  47. package/docs/migrations/sui-2.0/wallet-builders.md +6 -6
  48. package/docs/migrations/sui-2.0/walrus.md +4 -4
  49. package/docs/migrations/sui-2.0/zksend.md +7 -6
  50. package/docs/plugins.md +19 -16
  51. package/docs/sdk-building.md +37 -33
  52. package/docs/transaction-building/basics.md +16 -14
  53. package/docs/transaction-building/gas.md +3 -4
  54. package/docs/transaction-building/intents.md +6 -5
  55. package/docs/transaction-building/offline.md +11 -9
  56. package/docs/transaction-building/sponsored-transactions.md +2 -2
  57. package/docs/utils/derived_objects.md +13 -13
  58. package/docs/utils/index.md +2 -2
  59. package/docs/zklogin.md +7 -2
  60. package/package.json +4 -5
  61. package/src/jsonRpc/http-transport.ts +1 -2
  62. package/src/version.ts +1 -2
  63. package/src/transactions/__tests__/Transaction.test.ts +0 -184
  64. package/src/transactions/__tests__/bcs.test.ts +0 -205
@@ -1,32 +1,33 @@
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
- - **Native API** - Full access to everything the underlying API offers
9
- - **[Core API](/sui/clients/core)** - A consistent interface across all clients for common
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 Clients
11
+ ## Available clients
13
12
 
14
- | Client | API |
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 (eg, querying for transactions or events with various filters).
24
+ supported directly on full nodes (for example, querying for transactions or events with various
25
+ filters).
26
26
 
27
- ## Quick Start
27
+ ## Quick start
28
28
 
29
29
  ```typescript
30
+
30
31
  const client = new SuiGrpcClient({
31
32
  network: 'mainnet',
32
33
  baseUrl: 'https://fullnode.mainnet.sui.io:443',
@@ -39,7 +40,7 @@ const { response } = await client.ledgerService.getTransaction({ digest: '0x...'
39
40
  const { object } = await client.core.getObject({ objectId: '0x...' });
40
41
  ```
41
42
 
42
- ## Native vs Core API
43
+ ## Native vs core API
43
44
 
44
45
  ### Native API
45
46
 
@@ -47,6 +48,7 @@ Each client exposes the full capabilities of its underlying transport. Use the n
47
48
  need transport-specific features or want maximum control:
48
49
 
49
50
  ```typescript
51
+
50
52
  // gRPC - access various service clients to call any gRPC method
51
53
  const { response } = await grpcClient.stateService.listOwnedObjects({ owner: '0x...' });
52
54
 
@@ -78,7 +80,7 @@ await client.core.executeTransaction({ transaction, signatures });
78
80
  The Core API is essential for [building SDKs](/sui/sdk-building) that work with any client the user
79
81
  chooses.
80
82
 
81
- ## Client Extensions
83
+ ## Client extensions
82
84
 
83
85
  All clients support extensions through the `$extend` method, enabling SDKs like
84
86
  [@mysten/walrus](https://www.npmjs.com/package/@mysten/walrus) to add functionality:
@@ -90,4 +92,4 @@ const client = new SuiGrpcClient({ network: 'mainnet', baseUrl: '...' }).$extend
90
92
  await client.walrus.writeBlob({ ... });
91
93
  ```
92
94
 
93
- See [Building SDKs](/sui/sdk-building) for more on creating client extensions.
95
+ See [Building SDKs](/sui/sdk-building) for more on creating client extensions.
@@ -1,15 +1,16 @@
1
1
  # SuiJsonRpcClient
2
2
 
3
- > Connect to Sui via JSON-RPC with SuiJsonRpcClient
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
10
10
  [Core API](/sui/clients/core), so it can be used with any SDK that accepts `ClientWithCoreApi`.
11
11
 
12
12
  ```typescript
13
+
13
14
  const client = new SuiJsonRpcClient({
14
15
  url: getJsonRpcFullnodeUrl('mainnet'),
15
16
  network: 'mainnet',
@@ -26,6 +27,7 @@ the relevant URL to the `url` parameter. The following example establishes a con
26
27
  and get all `Coin<coin_type>` objects owned by an address.
27
28
 
28
29
  ```typescript
30
+
29
31
  // use getJsonRpcFullnodeUrl to define Devnet RPC location
30
32
  const rpcUrl = getJsonRpcFullnodeUrl('devnet');
31
33
 
@@ -57,6 +59,7 @@ RPC methods are built into `SuiJsonRpcClient`, but you can use `call` to leverag
57
59
  available in the RPC.
58
60
 
59
61
  ```typescript
62
+
60
63
  const client = new SuiJsonRpcClient({
61
64
  url: 'https://fullnode.devnet.sui.io:443',
62
65
  });
@@ -75,6 +78,7 @@ websocket requests for subscriptions. You can construct a custom transport insta
75
78
  pass any custom options, such as headers or timeout values.
76
79
 
77
80
  ```typescript
81
+
78
82
  const client = new SuiJsonRpcClient({
79
83
  transport: new JsonRpcHTTPTransport({
80
84
  url: 'https://fullnode.devnet.sui.io:443',
@@ -96,9 +100,9 @@ const client = new SuiJsonRpcClient({
96
100
  `SuiJsonRpcClient` exposes a number of RPC methods that return paginated results. These methods
97
101
  return a result object with 3 fields:
98
102
 
99
- - data: The list of results for the current page
100
- - nextCursor: a cursor pointing to the next page of results
101
- - hasNextPage: a boolean indicating whether there are more pages of results
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
102
106
 
103
107
  Some APIs also accept an `order` option that can be set to either `ascending` or `descending` to
104
108
  change the order in which the results are returned.
@@ -146,10 +150,10 @@ const result = await client.executeTransactionBlock({
146
150
 
147
151
  #### Arguments
148
152
 
149
- - `transactionBlock` - either a Transaction or BCS serialized transaction data bytes as a Uint8Array
153
+ - `transactionBlock`: either a Transaction or BCS serialized transaction data bytes as a Uint8Array
150
154
  or as a base-64 encoded string.
151
- - `signature` - A signature, or list of signatures committed to the intent message of the
152
- transaction data, as a base-64 encoded string.
155
+ - `signature`: A signature, or list of signatures committed to the intent message of the transaction
156
+ data, as a base-64 encoded string.
153
157
  - `options`:
154
158
  - `showBalanceChanges`: Whether to show balance_changes. Default to be False
155
159
  - `showEffects`: Whether to show transaction effects. Default to be False
@@ -181,9 +185,9 @@ if (result.$kind === 'FailedTransaction') {
181
185
 
182
186
  #### Arguments
183
187
 
184
- - `transaction` - BCS serialized transaction data bytes as a Uint8Array or as a base-64 encoded
188
+ - `transaction`: BCS serialized transaction data bytes as a Uint8Array or as a base-64 encoded
185
189
  string.
186
- - `signer` - A `Keypair` instance to sign the transaction
190
+ - `signer`: A `Keypair` instance to sign the transaction
187
191
  - `options`:
188
192
  - `showBalanceChanges`: Whether to show balance_changes. Default to be False
189
193
  - `showEffects`: Whether to show transaction effects. Default to be False
@@ -195,8 +199,8 @@ if (result.$kind === 'FailedTransaction') {
195
199
  ### `waitForTransaction`
196
200
 
197
201
  Wait for a transaction result to be available over the API. This can be used in conjunction with
198
- `signAndExecuteTransaction` to wait for the transaction to be available via the API. This currently
199
- 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.
200
204
 
201
205
  ```tsx
202
206
  const tx = new Transaction();
@@ -221,10 +225,10 @@ const transaction = await client.waitForTransaction({
221
225
 
222
226
  #### Arguments
223
227
 
224
- - `digest` - the digest of the queried transaction
225
- - `signal` - An optional abort signal that can be used to cancel the request
226
- - `timeout` - The amount of time to wait for a transaction. Defaults to one minute.
227
- - `pollInterval` - The amount of time to wait between checks for the transaction. Defaults to 2
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
228
232
  seconds.
229
233
  - `options`:
230
234
  - `showBalanceChanges`: Whether to show balance_changes. Default to be False
@@ -232,4 +236,4 @@ const transaction = await client.waitForTransaction({
232
236
  - `showEvents`: Whether to show transaction events. Default to be False
233
237
  - `showInput`: Whether to show transaction input data. Default to be False
234
238
  - `showObjectChanges`: Whether to show object_changes. Default to be False
235
- - `showRawInput`: Whether to show bcs-encoded transaction input data
239
+ - `showRawInput`: Whether to show bcs-encoded transaction input data
@@ -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.
@@ -53,6 +53,7 @@ to retrieve its associated Sui address. You can access a `Keypair` from its `Pub
53
53
  it from the bytes (as a `Uint8Array`) of the `PublicKey`, as in the following code:
54
54
 
55
55
  ```typescript
56
+
56
57
  const keypair = new Ed25519Keypair();
57
58
 
58
59
  // method 1
@@ -76,6 +77,7 @@ then verifies the message to retrieve the public key. The code then uses `toSuiA
76
77
  if the address associated with the public key matches the address that the key pair defines.
77
78
 
78
79
  ```typescript
80
+
79
81
  const keypair = new Ed25519Keypair();
80
82
  const message = new TextEncoder().encode('hello world');
81
83
  const { signature } = await keypair.signPersonalMessage(message);
@@ -93,6 +95,7 @@ if (!publicKey.verifyAddress(keypair.toSuiAddress())) {
93
95
  will throw an error if the signature is not valid for the provided address.
94
96
 
95
97
  ```typescript
98
+
96
99
  const keypair = new Ed25519Keypair();
97
100
  const message = new TextEncoder().encode('hello world');
98
101
  const { signature } = await keypair.signPersonalMessage(message);
@@ -131,12 +134,13 @@ await verifyTransactionSignature(bytes, signature, {
131
134
  ## Verifying zkLogin signatures
132
135
 
133
136
  ZkLogin signatures can't be verified purely on the client. When verifying a zkLogin signature, the
134
- SDK uses the GraphQL API to verify the signature. This will work for mainnet signatures without any
137
+ SDK uses the GraphQL API to verify the signature. This works for Mainnet signatures without any
135
138
  additional configuration.
136
139
 
137
- For testnet signatures, you will need to provide a testnet GraphQL Client:
140
+ For Testnet signatures, you need to provide a Testnet GraphQL Client:
138
141
 
139
142
  ```typescript
143
+
140
144
  const publicKey = await verifyPersonalMessageSignature(message, zkSignature, {
141
145
  client: new SuiGraphQLClient({
142
146
  url: 'https://graphql.testnet.sui.io/graphql',
@@ -144,14 +148,15 @@ const publicKey = await verifyPersonalMessageSignature(message, zkSignature, {
144
148
  });
145
149
  ```
146
150
 
147
- For some zklogin accounts, there are 2 valid addresses for a given set of inputs. This means you may
148
- run into issues if you try to compare the address returned by `publicKey.toSuiAddress()` directly
149
- 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.
150
154
 
151
155
  Instead, you can either pass in the expected address during verification, or use the
152
156
  `publicKey.verifyAddress(address)` method:
153
157
 
154
158
  ```typescript
159
+
155
160
  const publicKey = await verifyPersonalMessageSignature(message, zkSignature, {
156
161
  client: new SuiGraphQLClient({
157
162
  url: 'https://graphql.testnet.sui.io/graphql',
@@ -186,6 +191,7 @@ If you know the Keypair scheme for your secret key, you can use the `fromSecretK
186
191
  appropriate `Keypair` class to derive the keypair from the secret key.
187
192
 
188
193
  ```typescript
194
+
189
195
  // Example bech32 encoded secret key (which always starts with 'suiprivkey')
190
196
  const secretKey = 'suiprivkey1qzse89atw7d3zum8ujep76d2cxmgduyuast0y9fu23xcl0mpafgkktllhyc';
191
197
 
@@ -197,6 +203,7 @@ keyScheme, and get the keypairs private key bytes, which can be used to instanti
197
203
  `Keypair` class.
198
204
 
199
205
  ```typescript
206
+
200
207
  const { scheme, secretKey } = decodeSuiPrivateKey(encoded);
201
208
 
202
209
  // use scheme to choose the correct key pair
@@ -237,6 +244,7 @@ If you have only the raw private key bytes for your keypair, you can encode to t
237
244
  using the `encodeSuiPrivateKey` function.
238
245
 
239
246
  ```typescript
247
+
240
248
  const encoded = encodeSuiPrivateKey(
241
249
  new Uint8Array([
242
250
  59, 148, 11, 85, 134, 130, 61, 253, 2, 174, 59, 70, 27, 180, 51, 107, 94, 203, 174, 253, 102,
@@ -253,6 +261,7 @@ converting the secret key to a `Uint8Array` and passing it to the `fromSecretKey
253
261
  `Keypair` class.
254
262
 
255
263
  ```typescript
264
+
256
265
  const secret = '0x...';
257
266
  const keypair = Ed25519Keypair.fromSecretKey(fromHex(secret));
258
- ```
267
+ ```
@@ -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)
@@ -17,6 +17,7 @@ transaction is equal to or greater than the threshold value, then the Sui networ
17
17
  transdaction valid.
18
18
 
19
19
  ```typescript
20
+
20
21
  const kp1 = new Ed25519Keypair();
21
22
  const kp2 = new Ed25519Keypair();
22
23
  const kp3 = new Ed25519Keypair();
@@ -68,13 +69,14 @@ const isValid = await multiSigPublicKey.verifyPersonalMessage(message, combinedS
68
69
 
69
70
  The `MultiSigSigner` class allows you to create a Signer that can be used to sign personal messages
70
71
  and Transactions like any other keypair or signer class. This is often easier than manually
71
- combining signatures, since many methods accept Signers and handle signing directly.
72
+ combining signatures, because many methods accept Signers and handle signing directly.
72
73
 
73
74
  A `MultiSigSigner` is created by providing the underlying Signers to the `getSigner` method on the
74
75
  `MultiSigPublicKey`. You can provide a subset of the Signers that make up the public key, so long as
75
76
  their combined weight is equal to or greater than the threshold.
76
77
 
77
78
  ```typescript
79
+
78
80
  const kp1 = new Ed25519Keypair();
79
81
  const kp2 = new Ed25519Keypair();
80
82
 
@@ -145,7 +147,7 @@ const zkLoginSig = getZkLoginSignature({
145
147
  const multisig = multiSigPublicKey.combinePartialSignatures([zkLoginSig]);
146
148
  ```
147
149
 
148
- ### Benefits and Design for zkLogin in Multisig
150
+ ### Benefits and design for zkLogin in multisig
149
151
 
150
152
  Because zkLogin assumes the application client ID and its issuer (such as Google) liveliness, using
151
153
  zkLogin with multisig provides improved recoverability to a zkLogin account. In the previous example
@@ -166,7 +168,7 @@ In this case, Charlie can always use their Google account for transactions out o
166
168
  address for the threshold. At the same time, Charlie still has access to his account by combining
167
169
  partial signatures from Alice and Bob.
168
170
 
169
- ## Multisig with Passkey
171
+ ## Multisig with passkey
170
172
 
171
173
  You can use a `PasskeyKeypair` (a `Keypair`) and `PasskeyPublicKey` (a `PublicKey`) as components in
172
174
  a Multisig setup. Once initialized, they support both Multisig address derivation and transaction
@@ -189,4 +191,4 @@ const multiSigPublicKey = MultiSigPublicKey.fromPublicKeys({
189
191
  // other keys
190
192
  ],
191
193
  });
192
- ```
194
+ ```
@@ -1,6 +1,6 @@
1
1
  # Passkey
2
2
 
3
- > Use WebAuthn passkeys for Sui transaction signing
3
+ > Use WebAuthn passkeys for Sui transaction signing.
4
4
 
5
5
  Similar to other Keypair classes, the Sui TypeScript SDK provides the `PasskeyKeypair` that handles
6
6
  communication with the passkey device and signing with it. This SDK defines the address and
@@ -19,8 +19,8 @@ To use, import the `PasskeyKeypair` class from `@mysten/sui/keypairs/passkey`.
19
19
  ## Create a new passkey
20
20
 
21
21
  To create a new passkey with the passkey device, and initialize a `PasskeyKeypair`, you can use the
22
- `PasskeyProvider` and provide the `rpName`, `rpId` and additional options. Note that
23
- `getPasskeyInstance` call will initialize a new passkey wallet for the origin.
22
+ `PasskeyProvider` and provide the `rpName`, `rpId`, and additional options. The `getPasskeyInstance`
23
+ call initializes a new passkey wallet for the origin.
24
24
 
25
25
  ```typescript
26
26
  const keypair = await PasskeyKeypair.getPasskeyInstance(
@@ -49,15 +49,15 @@ same instance and the public key is available when constructing the passkey sign
49
49
  It is recommended that the user should only be allowed to create a passkey wallet once per origin.
50
50
  If the user ended up with multiple passkeys for the same origin, the passkey UI would show a list of
51
51
  all passkeys of the same origin and the user can choose which one to use. This can be a confusing
52
- experience since they do not remember which passkey is the way that the wallet was created for.
52
+ experience because they do not remember which passkey is the way that the wallet was created for.
53
53
 
54
54
  ## Recover a passkey
55
55
 
56
56
  However, if the user is logged out or uses a different browser or device, or the `PasskeyKeypair`
57
- instance is no longer present for any reason, the user should be prompt to recover the public key
58
- (e.g. "Log in to existing passkey wallet") to be able to use the passkey wallet again. If the user
59
- is prompted to create a new key in passkey device, a fresh new wallet with new address will be
60
- created.
57
+ instance is no longer present for any reason, the user should be prompted to recover the public key
58
+ (for example, through a "Log in to existing passkey wallet" flow) to be able to use the passkey
59
+ wallet again. If the user is prompted to create a new key in passkey device, a fresh new wallet with
60
+ new address will be created.
61
61
 
62
62
  One can recover the unique public key with exactly two passkey signatures on two messages. This
63
63
  means that if the user is asked to sign two messages, the developer can recover an unique public key
@@ -80,15 +80,16 @@ const keypair = new PasskeyKeypair(commonPk.toRawBytes(), provider);
80
80
  ```
81
81
 
82
82
  Alternatively, the developer can choose to ask the user to only sign one personal message that
83
- returns two possible public keys. Then the frontend may derive the addresses for both, and check
84
- onchain for the unique address that contains assets. Or the frontend may retrieve additional
85
- signatures from past transaction history for the given address. This may a preferred user experience
86
- since the user is only prompted to sign one message, but the frontend needs to do extra work.
83
+ returns two possible public keys. Then the frontend might derive the addresses for both and check
84
+ onchain for the unique address that contains assets. Or the frontend might retrieve additional
85
+ signatures from past transaction history for the given address. This might be a preferred user
86
+ experience because the user is only prompted to sign one message, but the frontend needs to do extra
87
+ work.
87
88
 
88
89
  ## Usage
89
90
 
90
91
  The usage for a passkey keypair is the same as any other keypair. You can derive the public key,
91
- derive the address, sign personal messages, sign transactions and verify signatures. See the
92
+ derive the address, sign personal messages, sign transactions, and verify signatures. See the
92
93
  [Key pairs](./keypairs) documentation for more details.
93
94
 
94
95
  ```typescript
@@ -103,9 +104,9 @@ const txSignature = await passkey.signTransaction(txBytes);
103
104
 
104
105
  An example implemention can be found [here](https://github.com/MystenLabs/passkey-example).
105
106
 
106
- ## Supported Platforms
107
+ ## Supported platforms
107
108
 
108
109
  Sui supports passkey wallets on any device that complies with the WebAuthn standard. This includes
109
110
  most modern browsers and operating systems across desktop and mobile. To check which platforms and
110
111
  authenticators are compatible, see the
111
- [Passkeys.dev device support list](https://passkeys.dev/device-support/).
112
+ [Passkeys.dev device support list](https://passkeys.dev/device-support/).
@@ -1,9 +1,9 @@
1
1
  # Web Crypto Signer
2
2
 
3
- > Sign transactions using the Web Crypto API
3
+ > Sign transactions using the Web Crypto API for secure browser-based key management.
4
4
 
5
- For cases where you need to create keypairs directly within client dapps, we recommend using the Web
6
- Crypto Signer. This signer leverages the
5
+ For cases where you need to create keypairs directly within client apps, you can use the Web Crypto
6
+ Signer. This signer leverages the
7
7
  [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) to provide a
8
8
  secure and efficient way to generate and manage cryptographic keys in the browser. The generated
9
9
  keys are `Secp256r1` keys which can be persisted between sessions, and are not extractable by
@@ -16,10 +16,10 @@ Common use cases for the Web Crypto Signer include:
16
16
 
17
17
  ## Installation
18
18
 
19
- To use the Web Crypto Signer, you need to install the `@mysten/signers` package.
19
+ To use the Web Crypto Signer, you need to install the `@mysten/webcrypto-signer` package.
20
20
 
21
21
  ```sh npm2yarn
22
- npm i @mysten/signers
22
+ npm i @mysten/webcrypto-signer
23
23
  ```
24
24
 
25
25
  You can then import the `WebCryptoSigner` class from the package:
@@ -62,13 +62,13 @@ const exported = await readFromIndexedDB('keypair');
62
62
  const keypair = await WebCryptoSigner.import(exported);
63
63
  ```
64
64
 
65
- > **Warning:** Ensure that you do not call `JSON.stringify` on the exported keypair before
66
- > persisting it to IndexedDB, as it will throw an error and fail to persist.
65
+ > **Warning:** Ensure that you do not call `JSON.stringify` on the exported keypair before persisting it to
66
+ > IndexedDB, as it will throw an error and fail to persist.
67
67
 
68
68
  ## Usage
69
69
 
70
70
  The usage for a Web Crypto signer is the same as any other keypair. You can derive the public key,
71
- derive the address, sign personal messages, sign transactions and verify signatures. See the
71
+ derive the address, sign personal messages, sign transactions, and verify signatures. See the
72
72
  [Key pairs](./keypairs) documentation for more details.
73
73
 
74
74
  ```typescript
@@ -78,4 +78,4 @@ const address = publicKey.toSuiAddress();
78
78
  const message = new TextEncoder().encode('hello world');
79
79
  await keypair.signPersonalMessage(message);
80
80
  await keypair.signTransaction(txBytes);
81
- ```
81
+ ```
package/docs/executors.md CHANGED
@@ -1,15 +1,16 @@
1
1
  # Transaction Executors
2
2
 
3
- > Manage transaction execution with queuing and parallel strategies
3
+ > Manage transaction execution with queuing and parallel strategies.
4
4
 
5
- The Typescript SDK ships 2 Transaction executor classes that simplify the processes of efficiently
6
- executing multiple transactions signed by the same address. These executors help manage object
7
- versions and gas coins which significantly reduces the number of requests made to RPC nodes, and for
8
- many cases avoids the need to wait for the RPC nodes to index previously executed transactions.
5
+ The TypeScript SDK ships two `Transaction` executor classes that simplify the processes of
6
+ efficiently executing multiple transactions signed by the same address. These executors help manage
7
+ object versions and gas coins which significantly reduces the number of requests made to RPC nodes,
8
+ and for many cases avoids the need to wait for the RPC nodes to index previously executed
9
+ transactions.
9
10
 
10
11
  ## `SerialTransactionExecutor`
11
12
 
12
- The `SerialTransactionExecutor` is designed for use in wallet implementations, and dapps where the
13
+ The `SerialTransactionExecutor` is designed for use in wallet implementations and apps where the
13
14
  objects owned by the address executing transactions are unlikely to be changed by transactions not
14
15
  executed through the executor.
15
16
 
@@ -35,6 +36,7 @@ transactions to finish before sending the next one.
35
36
  from the sender's address balance.
36
37
 
37
38
  ```ts
39
+
38
40
  const client = new SuiGrpcClient({
39
41
  network: 'devnet',
40
42
  baseUrl: 'https://fullnode.devnet.sui.io:443',
@@ -60,8 +62,7 @@ const [{ digest: digest1 }, { digest: digest2 }] = await Promise.all([
60
62
 
61
63
  ## `ParallelTransactionExecutor`
62
64
 
63
- > **Warning:** `ParallelTransactionExecutor` is experimental and may change rapidly as it is being
64
- > developed.
65
+ > **Warning:** `ParallelTransactionExecutor` is experimental and might change rapidly as it is being developed.
65
66
 
66
67
  The `ParallelTransactionExecutor` class works similarly to the `SerialTransactionExecutor`, but
67
68
  allows for parallel execution of transactions. To make this work, the `ParallelTransactionExecutor`
@@ -69,10 +70,10 @@ will maintain a pool of gas coins, and automatically execute additional transact
69
70
  gas pool as needed.
70
71
 
71
72
  > **Warning:** Using other client methods or wallets to execute additional transactions while
72
- > `ParallelTransactionExecutor` is in use may consume/combine gas coins in the gasPool, causing
73
- > transactions to fail. This may also result in the coins becoming locked for the remainder of the
73
+ > `ParallelTransactionExecutor` is in use might consume or combine gas coins in the gasPool, causing
74
+ > transactions to fail. This might also result in the coins becoming locked for the remainder of the
74
75
  > current epoch, preventing them from being used in future transactions.
75
- >
76
+ >
76
77
  > Running multiple instances of `ParallelTransactionExecutor` using the same `sourceCoins` will
77
78
  > result in the same issues.
78
79
 
@@ -99,11 +100,13 @@ way that avoids conflicts between transactions using the same object ids.
99
100
  maximum number of concurrent transactions (default 50),
100
101
  - `sourceCoins`: An array of coins to use to create the gas pool, defaults to using all coins owned
101
102
  by the signer.
102
- - `epochBoundaryWindow` Time to wait before/after the expected epoch boundary before re-fetching the
103
- gas pool (in milliseconds). Building transactions will be paused for up to 2x this duration around
104
- each epoch boundary to ensure the gas price is up-to-date for the next epoch. (default `1000`)
103
+ - `epochBoundaryWindow`: Time to wait before or after the expected epoch boundary before re-fetching
104
+ the gas pool (in milliseconds). Building transactions will be paused for up to 2x this duration
105
+ around each epoch boundary to ensure the gas price is up-to-date for the next epoch. (default
106
+ `1000`)
105
107
 
106
108
  ```ts
109
+
107
110
  const client = new SuiJsonRpcClient({ url: getJsonRpcFullnodeUrl('devnet'), network: 'devnet' });
108
111
 
109
112
  const executor = new ParallelTransactionExecutor({
@@ -124,24 +127,24 @@ const [{ digest: digest1 }, { digest: digest2 }] = await Promise.all([
124
127
  ]);
125
128
  ```
126
129
 
127
- ## Building and Executing Transactions with Executors
130
+ ## Building and executing transactions with executors
128
131
 
129
132
  The executor classes will significantly improve efficiency when executing multiple transactions, but
130
133
  to get the best results there are some best practices to follow:
131
134
 
132
135
  When building transactions, always prefer using unresolved object IDs rather than specifying the
133
- full `id`/`version`/`digest` for an object input (eg use `tx.object(id)` rather than
136
+ full `id`, `version`, and `digest` for an object input (for example, use `tx.object(id)` rather than
134
137
  `tx.objectRef({ objectId, version, digest })`). By doing this, you allow the executor to use object
135
138
  versions and digests from the cache, and will avoid executing transactions using stale object
136
139
  versions.
137
140
 
138
- If the signer executes transactions that are not sent through the executor that may cause
141
+ If the signer executes transactions that are not sent through the executor, that might cause
139
142
  transactions to fail. The executor classes will handle this by invalidating the cache for any
140
143
  objects used in the transaction, so you will often be able to recover by re-trying a failed
141
144
  transaction once. If it was caused by a stale cache, it should succeed on the second execution.
142
145
 
143
- > **Warning:** Transaction plugins and intents may resolve their own data (such as object
144
- > references) that are not automatically managed by the executor's object cache. This can cause
145
- > transactions to include stale object versions. The `coinWithBalance` intent is partially supported
146
- > by the executors and will work correctly when all coin types are either SUI or the required
147
- > balances are available as address balances rather than coin objects.
146
+ > **Warning:** Transaction plugins and intents might resolve their own data (such as object references) that are
147
+ > not automatically managed by the executor's object cache. This can cause transactions to include
148
+ > stale object versions. The `coinWithBalance` intent is partially supported by the executors and
149
+ > will work correctly when all coin types are either SUI or the required balances are available as
150
+ > address balances rather than coin objects.
package/docs/faucet.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Faucet
2
2
 
3
- > Request test SUI tokens from the faucet
3
+ > Request test SUI tokens from the faucet on Devnet, Testnet, or local networks.
4
4
 
5
5
  Devnet, Testnet, and local networks include faucets that mint SUI. You can use the Sui TypeScript
6
6
  SDK to call a network's faucet and provide SUI to the address you provide.
@@ -21,6 +21,6 @@ await requestSuiFromFaucetV2({
21
21
  });
22
22
  ```
23
23
 
24
- > **Note:** Faucets on Devnet and Testnet are rate limited. If you run the script too many times,
25
- > you surpass the limit and must wait to successfully run it again. For testnet, the best way to get
26
- > SUI is via the Web UI: `faucet.sui.io`.
24
+ > **Note:** Faucets on Devnet and Testnet are rate limited. If you run the script too many times, you surpass
25
+ > the limit and must wait to successfully run it again. For Testnet, the best way to get SUI is
26
+ > through the Web UI: `faucet.sui.io`.
package/docs/hello-sui.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Hello Sui
2
2
 
3
- > Build your first Sui application with the TypeScript SDK
3
+ > Build your first Sui application with the TypeScript SDK.
4
4
 
5
5
  This basic example introduces you to the Sui TypeScript SDK. The Node.js example mints SUI on a Sui
6
6
  network and then queries the address to get a sum for the owned SUI. You don't need to use an IDE to
@@ -9,8 +9,8 @@ projects.
9
9
 
10
10
  ## Before you begin
11
11
 
12
- You need an address on a Sui development network (Devnet, Testnet, local). If you don't already have
13
- an address, use the [Sui Client CLI](https://docs.sui.io/references/cli/client) or the
12
+ You need an address on a Sui development network (Devnet, Testnet, or local). If you don't already
13
+ have an address, use the [Sui Client CLI](https://docs.sui.io/references/cli/client) or the
14
14
  [Sui Wallet browser extension](https://docs.mystenlabs.com) to create one.
15
15
 
16
16
  You also need [Node.js](https://nodejs.org/en/download/current) and a package manager like
@@ -55,6 +55,7 @@ address. You must be on Devnet, Testnet, or a local network to use a faucet for
55
55
  Create a new `index.js` file in the root of your project with the following code.
56
56
 
57
57
  ```js
58
+
58
59
  // replace <YOUR_SUI_ADDRESS> with your actual address, which is in the form 0x123...
59
60
  const MY_ADDRESS = '<YOUR_SUI_ADDRESS>';
60
61
 
@@ -106,9 +107,9 @@ that it uses to query the address and output the amount of SUI the address owns
106
107
  using the faucet. You can check the total SUI for your address using the Sui Wallet or Sui Client
107
108
  CLI.
108
109
 
109
- > **Note:** Faucets on Devnet and Testnet are rate limited. If you run the script too many times,
110
- > you surpass the limit and must wait to successfully run it again. For testnet, the best way to get
111
- > SUI is via the Web UI: `faucet.sui.io`.
110
+ > **Note:** Faucets on Devnet and Testnet are rate limited. If you run the script too many times, you surpass
111
+ > the limit and must wait to successfully run it again. For Testnet, the best way to get SUI is
112
+ > through the Web UI: `faucet.sui.io`.
112
113
 
113
114
  You can also use the [Sui Client CLI](https://docs.sui.io/references/cli/client) to perform client
114
- calls on a Sui network.
115
+ calls on a Sui network.