@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,22 +1,22 @@
1
1
  # Building SDKs
2
2
 
3
- > Build custom SDKs on top of the Sui TypeScript SDK
3
+ > Build custom SDKs on top of the Sui TypeScript SDK.
4
4
 
5
5
  This guide covers recommended patterns for building TypeScript SDKs that integrate with the Sui SDK.
6
6
  Following these patterns ensures your SDK integrates seamlessly with the ecosystem, works across
7
7
  different transports (JSON-RPC, GraphQL, gRPC), and composes well with other SDKs.
8
8
 
9
- **Key requirement:** All SDKs should depend on [`ClientWithCoreApi`](./clients/core), which is the
10
- transport-agnostic interface implemented by all Sui clients. This ensures your SDK works with any
11
- client the user chooses.
9
+ All SDKs should depend on [`ClientWithCoreApi`](./clients/core), which is the transport-agnostic
10
+ interface implemented by all Sui clients. This ensures your SDK works with any client the user
11
+ chooses.
12
12
 
13
- ## Package Setup
13
+ ## Package setup
14
14
 
15
- ### Use Mysten Packages as Peer Dependencies
15
+ ### Use Mysten packages as peer dependencies
16
16
 
17
- SDKs should declare all `@mysten/*` packages as **peer dependencies** rather than direct
18
- dependencies. This ensures users get a single shared instance of each package, avoiding version
19
- conflicts and duplicate code.
17
+ SDKs should declare all `@mysten/*` packages as peer dependencies rather than direct dependencies.
18
+ This ensures users get a single shared instance of each package, avoiding version conflicts and
19
+ duplicate code.
20
20
 
21
21
  ```json title="package.json"
22
22
  {
@@ -40,14 +40,14 @@ This approach:
40
40
  - Avoids subtle bugs from mismatched package instances
41
41
  - Allows the SDK to work with any compatible client
42
42
 
43
- ## Client Extensions
43
+ ## Client extensions
44
44
 
45
45
  The recommended way to build SDKs is using the **client extension pattern**. This allows your SDK to
46
46
  extend the Sui client with custom functionality. This makes it easier to use custom SDKs across the
47
47
  ecosystem without having to build custom bindings (like react context providers) for each individual
48
48
  SDK and client.
49
49
 
50
- ### Extension Pattern
50
+ ### Extension pattern
51
51
 
52
52
  Client extensions use the `$extend` method to add functionality to any Sui client. Create a factory
53
53
  function that returns a `name` and `register` function:
@@ -89,6 +89,7 @@ function that returns a `name` and `register` function:
89
89
  Users can then extend their client:
90
90
 
91
91
  ```typescript
92
+
92
93
  const client = new SuiGrpcClient({
93
94
  network: 'testnet',
94
95
  baseUrl: 'https://fullnode.testnet.sui.io:443',
@@ -98,25 +99,25 @@ const client = new SuiGrpcClient({
98
99
  await client.mySDK.getResource('0x...');
99
100
  ```
100
101
 
101
- ### Real-World Examples
102
+ ### Real-world examples
102
103
 
103
104
  Several official SDKs use this pattern:
104
105
 
105
- - **[@mysten/walrus](https://www.npmjs.com/package/@mysten/walrus)** - Decentralized storage
106
- - **[@mysten/seal](https://www.npmjs.com/package/@mysten/seal)** - Encryption and key management
106
+ - **[@mysten/walrus](https://www.npmjs.com/package/@mysten/walrus):** Decentralized storage
107
+ - **[@mysten/seal](https://www.npmjs.com/package/@mysten/seal):** Encryption and key management
107
108
 
108
- ## SDK Organization
109
+ ## SDK organization
109
110
 
110
111
  Most Mysten SDKs do not strictly follow these patterns yet, but we recommend scoping methods on your
111
112
  client extension into the following categories for clarity and consistency:
112
113
 
113
- | Property | Purpose | Example |
114
- | -------- | --------------------------------------------------------- | ----------------------------------- |
115
- | Methods | Top-level operations (execute actions or read/parse data) | `sdk.readBlob()`, `sdk.getConfig()` |
116
- | `tx` | Methods that create transactions without executing | `sdk.tx.registerBlob()` |
117
- | `bcs` | BCS type definitions for encoding/decoding | `sdk.bcs.MyStruct` |
118
- | `call` | Methods returning Move calls that can be used with tx.add | `sdk.call.myFunction()` |
119
- | `view` | Methods that use simulate API to read onchain state | `sdk.view.getState()` |
114
+ | Property | Purpose | Example |
115
+ | -------- | ------------------------------------------------------------- | ----------------------------------- |
116
+ | Methods | Top-level operations (execute actions or read and parse data) | `sdk.readBlob()`, `sdk.getConfig()` |
117
+ | `tx` | Methods that create transactions without executing | `sdk.tx.registerBlob()` |
118
+ | `bcs` | BCS type definitions for encoding and decoding | `sdk.bcs.MyStruct` |
119
+ | `call` | Methods returning Move calls that can be used with tx.add | `sdk.call.myFunction()` |
120
+ | `view` | Methods that use simulate API to read onchain state | `sdk.view.getState()` |
120
121
 
121
122
  ```typescript
122
123
 
@@ -178,14 +179,15 @@ client extension into the following categories for clarity and consistency:
178
179
  }
179
180
  ```
180
181
 
181
- ## Transaction Building Patterns
182
+ ## Transaction building patterns
182
183
 
183
- ### Transaction Thunks
184
+ ### Transaction thunks
184
185
 
185
186
  Transaction thunks are functions that accept a `Transaction` and mutate it. This pattern enables
186
187
  composition across multiple SDKs in a single transaction.
187
188
 
188
189
  ```typescript
190
+
189
191
  // Synchronous thunk for operations that don't need async work
190
192
  function createResource(options: { name: string }) {
191
193
  return (tx: Transaction): TransactionObjectArgument => {
@@ -203,7 +205,7 @@ const resource = tx.add(createResource({ name: 'my-resource' }));
203
205
  tx.transferObjects([resource], recipient);
204
206
  ```
205
207
 
206
- ### Async Thunks
208
+ ### Async thunks
207
209
 
208
210
  For operations requiring async work (like fetching package IDs or configuration), return async
209
211
  thunks. These are used with `tx.add()` exactly like synchronous thunks - the async resolution
@@ -235,14 +237,14 @@ await signer.signAndExecuteTransaction({ transaction: tx, client });
235
237
  This pattern is critical for web wallet compatibility - async work that happens during transaction
236
238
  construction won't block the popup triggered by user interaction.
237
239
 
238
- ## Transaction Execution
240
+ ## Transaction execution
239
241
 
240
- ### Accept a Signer Parameter
242
+ ### Accept a signer parameter
241
243
 
242
244
  For methods that execute transactions, accept a `Signer` parameter and always use the signer to
243
245
  execute the transaction. This enables:
244
246
 
245
- - Wallet integration through dApp Kit
247
+ - Wallet integration through dApp kit
246
248
  - Transaction sponsorship
247
249
  - Custom signing flows
248
250
 
@@ -266,7 +268,7 @@ execute the transaction. This enables:
266
268
 
267
269
  Using `signAndExecuteTransaction` allows wallets and sponsors to customize execution behavior.
268
270
 
269
- ## Code Generation
271
+ ## Code generation
270
272
 
271
273
  For SDKs that interact with Move contracts, use **[@mysten/codegen](/codegen)** to generate
272
274
  type-safe TypeScript bindings from your Move packages.
@@ -274,11 +276,12 @@ type-safe TypeScript bindings from your Move packages.
274
276
  Benefits include type safety, BCS parsing, IDE support, and MoveRegistry support for human-readable
275
277
  package names. See the [codegen documentation](/codegen) for setup instructions.
276
278
 
277
- ### Using Generated Code
279
+ ### Using generated code
278
280
 
279
281
  The generated code provides both Move call functions and BCS struct definitions:
280
282
 
281
283
  ```typescript
284
+
282
285
  // Generated Move call functions return thunks with typed options
283
286
  const tx = new Transaction();
284
287
  tx.add(
@@ -290,7 +293,7 @@ tx.add(
290
293
  }),
291
294
  );
292
295
 
293
- // Generated BCS types parse on-chain data
296
+ // Generated BCS types parse onchain data
294
297
  const { object } = await client.core.getObject({
295
298
  objectId: '0x123...',
296
299
  include: { content: true },
@@ -300,12 +303,13 @@ const parsed = myContract.MyStruct.parse(object.content);
300
303
 
301
304
  See the [codegen documentation](/codegen) for complete setup and configuration options.
302
305
 
303
- ## Reading Object Contents
306
+ ## Reading object contents
304
307
 
305
308
  SDKs often need to fetch objects and parse their BCS-encoded content. Use `getObject` with
306
309
  `include: { content: true }` and generated BCS types:
307
310
 
308
311
  ```typescript
312
+
309
313
  async function getResource(objectId: string) {
310
314
  const { object } = await this.#client.core.getObject({
311
315
  objectId,
@@ -337,4 +341,4 @@ async function getResources(objectIds: string[]) {
337
341
  return MyStruct.parse(obj.content);
338
342
  });
339
343
  }
340
- ```
344
+ ```
@@ -1,11 +1,12 @@
1
1
  # Sui Programmable Transaction Basics
2
2
 
3
- > Construct programmable transaction blocks with the Transaction API
3
+ > Construct programmable transaction blocks with the Transaction API.
4
4
 
5
5
  This example starts by constructing a transaction to send SUI. To construct transactions, import the
6
6
  `Transaction` class and construct it:
7
7
 
8
8
  ```tsx
9
+
9
10
  const tx = new Transaction();
10
11
  ```
11
12
 
@@ -63,7 +64,7 @@ if (result.$kind === 'FailedTransaction') {
63
64
 
64
65
  When you use `client.signAndExecuteTransaction` or `client.executeTransactionBlock`, the transaction
65
66
  will be finalized on the blockchain before the function resolves, but the effects of the transaction
66
- may not be immediately observable.
67
+ might not be immediately observable.
67
68
 
68
69
  There are 2 ways to observe the results of a transaction. Methods like
69
70
  `client.signAndExecuteTransaction` accept an `options` object with options like `showObjectChanges`
@@ -74,7 +75,7 @@ immediately displayed to the user, or used for further processing in your applic
74
75
 
75
76
  The other way effects of transactions can be observed is by querying other RPC methods like
76
77
  `client.getBalances` that return objects or balances owned by a specific address. These RPC calls
77
- depend on the RPC node having indexed the effects of the transaction, which may not have happened
78
+ depend on the RPC node having indexed the effects of the transaction, which might not have happened
78
79
  immediately after a transaction has been executed. To ensure that effects of a transaction are
79
80
  represented in future RPC calls, you can use the `waitForTransaction` method on the client:
80
81
 
@@ -100,21 +101,21 @@ Commands are steps of execution in the transaction. Each command in a Transactio
100
101
  inputs, and produces results. The inputs for a transaction depend on the kind of command. Sui
101
102
  supports following commands:
102
103
 
103
- - `tx.splitCoins(coin, amounts)` - Creates new coins with the defined amounts, split from the
104
+ - `tx.splitCoins(coin, amounts)`: Creates new coins with the defined amounts, split from the
104
105
  provided coin. Returns the coins so that it can be used in subsequent transactions.
105
106
  - Example: `tx.splitCoins(tx.gas, [100, 200])`
106
- - `tx.mergeCoins(destinationCoin, sourceCoins)` - Merges the sourceCoins into the destinationCoin.
107
+ - `tx.mergeCoins(destinationCoin, sourceCoins)`: Merges the sourceCoins into the destinationCoin.
107
108
  - Example: `tx.mergeCoins(tx.object(coin1), [tx.object(coin2), tx.object(coin3)])`
108
- - `tx.transferObjects(objects, address)` - Transfers a list of objects to the specified address.
109
+ - `tx.transferObjects(objects, address)`: Transfers a list of objects to the specified address.
109
110
  - Example: `tx.transferObjects([tx.object(thing1), tx.object(thing2)], myAddress)`
110
- - `tx.moveCall({ target, arguments, typeArguments })` - Executes a Move call. Returns whatever the
111
+ - `tx.moveCall({ target, arguments, typeArguments })`: Executes a Move call. Returns whatever the
111
112
  Sui Move call returns.
112
113
  - Example:
113
114
  `tx.moveCall({ target: '0x2::devnet_nft::mint', arguments: [tx.pure.string(name), tx.pure.string(description), tx.pure.string(image)] })`
114
- - `tx.makeMoveVec({ type, elements })` - Constructs a vector of objects that can be passed into a
115
+ - `tx.makeMoveVec({ type, elements })`: Constructs a vector of objects that can be passed into a
115
116
  `moveCall`. This is required as there’s no way to define a vector as an input.
116
117
  - Example: `tx.makeMoveVec({ elements: [tx.object(id1), tx.object(id2)] })`
117
- - `tx.publish(modules, dependencies)` - Publishes a Move package. Returns the upgrade capability
118
+ - `tx.publish(modules, dependencies)`: Publishes a Move package. Returns the upgrade capability
118
119
  object.
119
120
 
120
121
  ## Passing inputs to a command
@@ -139,7 +140,7 @@ tx.transferObjects([coin], '0xSomeSuiAddress');
139
140
 
140
141
  When providing inputs that are not on chain objects, the values must be serialized as
141
142
 
142
- [BCS](https://sdk.mystenlabs.com/bcs), which can be done using `tx.pure` eg,
143
+ [BCS](https://sdk.mystenlabs.com/bcs), which can be done using `tx.pure`, for example
143
144
  `tx.pure.address(address)` or `tx.pure(bcs.vector(bcs.U8).serialize(bytes))`.
144
145
 
145
146
  `tx.pure` can be called as a function that accepts a SerializedBcs object, or as a namespace that
@@ -157,6 +158,7 @@ tx.pure as a function with a type argument, or serialize the value before passin
157
158
  using the bcs sdk:
158
159
 
159
160
  ```ts
161
+
160
162
  tx.moveCall({
161
163
  target: '0x2::foo::bar',
162
164
  arguments: [
@@ -275,9 +277,9 @@ tx.transferObjects([mintMany[0], mintMany[1]], address);
275
277
  If you need the transaction bytes, instead of signing or executing the transaction, you can use the
276
278
  `build` method on the transaction builder itself.
277
279
 
278
- **Important:** You might need to explicitly call `setSender()` on the transaction to ensure that the
279
- `sender` field is populated. This is normally done by the signer before signing the transaction, but
280
- will not be done automatically if you’re building the transaction bytes yourself.
280
+ You might need to explicitly call `setSender()` on the transaction to ensure that the `sender` field
281
+ is populated. This is normally done by the signer before signing the transaction, but will not be
282
+ done automatically if you’re building the transaction bytes yourself.
281
283
 
282
284
  ```tsx
283
285
  const tx = new Transaction();
@@ -294,4 +296,4 @@ If you have transaction bytes, you can also convert them back into a `Transactio
294
296
  ```tsx
295
297
  const bytes = getTransactionBytesFromSomewhere();
296
298
  const tx = Transaction.from(bytes);
297
- ```
299
+ ```
@@ -1,6 +1,6 @@
1
1
  # Paying for Sui Transactions with Gas Coins
2
2
 
3
- > Configure gas budget, price, and coin selection for transactions
3
+ > Configure gas budget, price, and coin selection for Sui transactions.
4
4
 
5
5
  With Programmable Transactions, you can use the gas payment coin to construct coins with a set
6
6
  balance using `splitCoin`. This is useful for Sui payments, and avoids the need for up-front coin
@@ -35,8 +35,7 @@ beforehand. The dry run gas consumption is then used to determine a balance for
35
35
  can override this behavior by explicitly setting a gas budget for the transaction, by calling
36
36
  `setGasBudget` on the transaction builder.
37
37
 
38
- **Note:** The gas budget is represented in Sui, and should take the gas price of the transaction
39
- into account.
38
+ The gas budget is represented in Sui and should take the gas price of the transaction into account.
40
39
 
41
40
  ```tsx
42
41
  tx.setGasBudget(gasBudgetAmount);
@@ -59,4 +58,4 @@ tx.setGasPayment([coin1, coin2]);
59
58
 
60
59
  Gas coins should be objects containing the coins objectId, version, and digest.
61
60
 
62
- <auto-type-table type="{ objectId: string, version: string | number, digest: string }" />
61
+ <auto-type-table type="{ objectId: string, version: string | number, digest: string }" />
@@ -1,9 +1,9 @@
1
1
  # Transaction Intents
2
2
 
3
- > Use high-level intents to simplify transaction building
3
+ > Use high-level intents to simplify transaction building.
4
4
 
5
- Transaction Intents enable 3rd party SDKs and [Transaction Plugins](../plugins) to more easily add
6
- complex operations to a Transaction. The Typescript SDK currently only includes a single Intent
5
+ Transaction Intents enable third-party SDKs and [Transaction Plugins](../plugins) to more easily add
6
+ operations to a Transaction. The TypeScript SDK currently only includes a single Intent
7
7
  (CoinWithBalance), but more will be added in the future.
8
8
 
9
9
  ## The CoinWithBalance intent
@@ -24,6 +24,7 @@ solves this by providing a helper function that automatically adds the correct S
24
24
  MergeCoins commands to the transaction:
25
25
 
26
26
  ```typescript
27
+
27
28
  const tx = new Transaction();
28
29
 
29
30
  // Setting the sender is required for the CoinWithBalance intent to resolve coins when not using the gas coin
@@ -51,11 +52,11 @@ tx.transferObjects([coinWithBalance({ balance: 100, useGasCoin: false })], recip
51
52
  ```
52
53
 
53
54
  It's important to only set `useGasCoin` option to false for sponsored transactions, otherwise the
54
- coinWithBalance intent may use all the SUI coins, leaving no coins to use for gas.
55
+ coinWithBalance intent might use all the SUI coins, leaving no coins to use for gas.
55
56
 
56
57
  ## How it works
57
58
 
58
59
  When the `CoinWithBalance` intent is resolved, it will look up the senders owned coins for each type
59
60
  that needs to be created. It will then find a set of coins with sufficient balance to cover the
60
61
  desired balance, to combine them into a single coin. This coin is then used in a `SplitCoins`
61
- command to create the desired coin.
62
+ command to create the desired coin.
@@ -1,22 +1,23 @@
1
1
  # Building Offline
2
2
 
3
- > Build transactions without a network connection
3
+ > Build transactions without a network connection.
4
4
 
5
5
  To build a transaction offline (with no `client` required), you need to fully define all of your
6
6
  inputs, gas configuration, and expiration.
7
7
 
8
- ## Required Configuration
8
+ ## Required configuration
9
9
 
10
10
  When building offline, you must set the following:
11
11
 
12
- - **Sender address** - The address that will execute the transaction
13
- - **Gas price** - The price per gas unit (can be obtained from the network beforehand)
14
- - **Gas budget** - The maximum gas to spend on this transaction
15
- - **Gas payment** - One or more coin object references to use for gas, or an empty array for Address
12
+ - Sender address: The address that will execute the transaction
13
+ - Gas price: The price per gas unit (can be obtained from the network beforehand)
14
+ - Gas budget: The maximum gas to spend on this transaction
15
+ - Gas payment: One or more coin object references to use for gas, or an empty array for Address
16
16
  Balances
17
- - **Expiration** - Only needed when using address balances for gas
17
+ - Expiration: Only needed when using address balances for gas
18
18
 
19
19
  ```tsx
20
+
20
21
  const { referenceGasPrice } = await client.getReferenceGasPrice();
21
22
 
22
23
  const tx = new Transaction();
@@ -36,12 +37,13 @@ tx.setGasPayment([
36
37
  const bytes = await tx.build();
37
38
  ```
38
39
 
39
- ## Object References
40
+ ## Object references
40
41
 
41
42
  For objects used in your transaction, you must provide full object references using the `Inputs`
42
43
  helper:
43
44
 
44
45
  ```tsx
46
+
45
47
  // For owned or immutable objects
46
48
  tx.object(
47
49
  Inputs.ObjectRef({
@@ -68,4 +70,4 @@ tx.object(
68
70
  digest: '<object-digest>',
69
71
  }),
70
72
  );
71
- ```
73
+ ```
@@ -1,6 +1,6 @@
1
1
  # Sponsored Transactions
2
2
 
3
- > Pay gas fees on behalf of other users with sponsored transactions
3
+ > Pay gas fees on behalf of other users with sponsored transactions.
4
4
 
5
5
  The transaction builder can support sponsored transactions by using the `onlyTransactionKind` flag
6
6
  when building the transaction.
@@ -19,4 +19,4 @@ const sponsoredtx = Transaction.fromKind(kindBytes);
19
19
  sponsoredtx.setSender(sender);
20
20
  sponsoredtx.setGasOwner(sponsor);
21
21
  sponsoredtx.setGasPayment(sponsorCoins);
22
- ```
22
+ ```
@@ -1,6 +1,6 @@
1
1
  # Derived Objects
2
2
 
3
- > Compute derived object IDs from parent objects
3
+ > Compute derived object IDs from parent objects for deterministic offline derivation.
4
4
 
5
5
  Derived objects enable deterministic IDs for objects, enabling offline derivation of object IDs.
6
6
  [Click here to read more.](https://docs.sui.io/concepts/sui-move-concepts/derived-objects)
@@ -14,9 +14,9 @@ To derive an object ID, you can import `deriveObjectID` function exposed from ut
14
14
  To derive any object, you need to have its parent's ID (the object from which it was derived), and
15
15
  the key used to generate it.
16
16
 
17
- > **Warning:** It is recommended to verify the on-chain `derived_object::derive_address` match your
18
- > off-chain calculation (at least once when implementing offline calculations), especially for
19
- > critical cases like transferring assets.
17
+ > **Warning:** It is recommended to verify the onchain `derived_object::derive_address` match your offchain
18
+ > calculation (at least once when implementing offline calculations), especially for critical cases
19
+ > like transferring assets.
20
20
 
21
21
  ## Deriving using primitive keys
22
22
 
@@ -24,21 +24,21 @@ To derive the IDs using primitive types, you can use the built-in types like thi
24
24
  a parent object with ID `0xc0ffee`.
25
25
 
26
26
  ```typescript
27
- // Example 1: On-chain derivation for `0xc0ffee + vector<u8>([0,1,2])
27
+ // Example 1: Onchain derivation for `0xc0ffee + vector<u8>([0,1,2])
28
28
  deriveObjectID('0xc0ffee', 'vector<u8>', bcs.vector(bcs.u8()).serialize([0, 1, 2]).toBytes());
29
29
 
30
- // Example 2: On-chain derivation for `0xc0ffee + address('0x111')`
30
+ // Example 2: Onchain derivation for `0xc0ffee + address('0x111')`
31
31
  deriveObjectID('0xc0ffee', 'address', bcs.Address.serialize('0x111').toBytes());
32
32
 
33
- // Example 3: On-chain derivation for `0xc0ffee + non-ascii string ("foo")`
33
+ // Example 3: Onchain derivation for `0xc0ffee + non-ascii string ("foo")`
34
34
  deriveObjectID('0xc0ffee', '0x1::string::String', bcs.String.serialize('foo').toBytes());
35
35
  ```
36
36
 
37
37
  ## Deriving using custom types
38
38
 
39
- To derive IDs using your custom objects, you can use BCS & the known type IDs.
39
+ To derive IDs using your custom objects, you can use BCS and the known type IDs.
40
40
 
41
- Assuming a custom struct on-chain (for the key) being:
41
+ Assuming a custom struct onchain (for the key) being:
42
42
 
43
43
  ```move
44
44
  public struct DemoStruct has copy, store, drop { value: u64 }
@@ -61,14 +61,14 @@ deriveObjectID('0xc0ffee', `0xc0ffee::demo::DemoStruct`, key);
61
61
  ### Deriving with fieldless structs
62
62
 
63
63
  In Move, structs with no user-defined fields automatically get a `dummy_field: bool` injected by the
64
- compiler. This means their BCS encoding is not empty it's a single `0x00` byte (the encoding of
64
+ compiler. This means their BCS encoding is not empty. It is a single `0x00` byte (the encoding of
65
65
  `false`). You can treat this as a constant.
66
66
 
67
67
  A real-world example is `0x2::coin_registry::CurrencyKey<T>`, which is a fieldless generic struct
68
68
  used to derive `Currency` objects from the coin registry (`0xc`) based on their type:
69
69
 
70
70
  ```typescript
71
- // On-chain: `public struct CurrencyKey<phantom T>() has copy, store, drop`
71
+ // Onchain: `public struct CurrencyKey<phantom T>() has copy, store, drop`
72
72
  // The compiler injects `dummy_field: bool`, always `false`.
73
73
  const key = new Uint8Array([0]);
74
74
 
@@ -76,5 +76,5 @@ const coinType = '0x2::sui::SUI';
76
76
  const currencyId = deriveObjectID('0xc', `0x2::coin_registry::CurrencyKey<${coinType}>`, key);
77
77
  ```
78
78
 
79
- This applies to any struct with no fields phantom type parameters don't add any BCS-encoded data,
80
- so the key is always `new Uint8Array([0])`.
79
+ This applies to any struct with no fields. Phantom type parameters do not add any BCS-encoded data,
80
+ so the key is always `new Uint8Array([0])`.
@@ -1,6 +1,6 @@
1
1
  # The `@mysten/sui/utils` package
2
2
 
3
- > Utility functions for addresses, coins, and common operations
3
+ > Utility functions for addresses, coins, and common operations in the Sui TypeScript SDK.
4
4
 
5
5
  This package contains some utilities that simplify common operations when working with the Sui
6
6
  TypeScript SDK.
@@ -56,4 +56,4 @@ The following methods are re-exported to help with converting between commonly u
56
56
  - `fromHex`: Deserializes a hex string to a Uint8Array
57
57
  - `toHex`: Serializes a Uint8Array to a hex string
58
58
  - `fromBase64`: Deserializes a base64 string to a Uint8Array
59
- - `toBase64`: Serializes a Uint8Array to a base64 string
59
+ - `toBase64`: Serializes a Uint8Array to a base64 string
package/docs/zklogin.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ZkLogin
2
2
 
3
- > Zero-knowledge authentication with OAuth providers on Sui
3
+ > Zero-knowledge authentication with OAuth providers on Sui.
4
4
 
5
5
  Utilities for working with zkLogin. Currently contains functionality to create and parse zkLogin
6
6
  signatures and compute zkLogin addresses.
@@ -8,30 +8,35 @@ signatures and compute zkLogin addresses.
8
8
  To parse a serialized zkLogin signature
9
9
 
10
10
  ```typescript
11
+
11
12
  const parsedSignature = await parseZkLoginSignature('BQNNMTY4NjAxMzAyO....');
12
13
  ```
13
14
 
14
15
  Use `getZkLoginSignature` to serialize a zkLogin signature.
15
16
 
16
17
  ```typescript
18
+
17
19
  const serializedSignature = await getZkLoginSignature({ inputs, maxEpoch, userSignature });
18
20
  ```
19
21
 
20
22
  To compute the address for a given address seed and iss you can use `computeZkLoginAddressFromSeed`
21
23
 
22
24
  ```typescript
25
+
23
26
  const address = computeZkLoginAddressFromSeed(0n, 'https://accounts.google.com');
24
27
  ```
25
28
 
26
29
  To compute an address from jwt:
27
30
 
28
31
  ```typescript
32
+
29
33
  const address = jwtToAddress(jwtAsString, salt);
30
34
  ```
31
35
 
32
36
  To compute an address from a parsed jwt:
33
37
 
34
38
  ```typescript
39
+
35
40
  const address = computeZkLoginAddress({
36
41
  claimName,
37
42
  claimValue,
@@ -75,4 +80,4 @@ const address = toZkLoginPublicIdentifier(
75
80
  iss,
76
81
  { legacyAddress: true },
77
82
  ).toSuiAddress();
78
- ```
83
+ ```
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Mysten Labs <build@mystenlabs.com>",
4
4
  "description": "Sui TypeScript API",
5
5
  "homepage": "https://sdk.mystenlabs.com",
6
- "version": "2.16.0",
6
+ "version": "2.16.2",
7
7
  "license": "Apache-2.0",
8
8
  "sideEffects": false,
9
9
  "files": [
@@ -139,7 +139,6 @@
139
139
  "@graphql-codegen/typescript-document-nodes": "5.0.7",
140
140
  "@graphql-codegen/typescript-operations": "^5.0.7",
141
141
  "@grpc/grpc-js": "^1.13.3",
142
- "@iarna/toml": "^2.2.5",
143
142
  "@parcel/watcher": "^2.5.4",
144
143
  "@protobuf-ts/grpc-transport": "^2.11.1",
145
144
  "@types/node": "^25.0.8",
@@ -169,8 +168,8 @@
169
168
  "graphql": "^16.12.0",
170
169
  "poseidon-lite": "0.2.1",
171
170
  "valibot": "^1.2.0",
172
- "@mysten/bcs": "^2.0.3",
173
- "@mysten/utils": "^0.3.1"
171
+ "@mysten/bcs": "^2.0.5",
172
+ "@mysten/utils": "^0.3.3"
174
173
  },
175
174
  "scripts": {
176
175
  "clean": "rm -rf tsconfig.tsbuildinfo ./dist",
@@ -183,7 +182,7 @@
183
182
  "codegen:grpc-header": "find src/grpc/proto -type f -exec sh -c 'echo \"// Copyright (c) Mysten Labs, Inc.\\n// SPDX-License-Identifier: Apache-2.0\\n\" | cat - {} > temp && mv temp {}' \\;",
184
183
  "codegen:grpc-extensions": "find src/grpc/proto -name '*.ts' | xargs sed -i '' -E 's/from \"(\\.[^\"]+)\"/from \"\\1.js\"/g'",
185
184
  "build": "rm -rf dist && node genversion.mjs && tsc --noEmit && tsdown",
186
- "build:docs": "tsx ../docs/scripts/build-docs.ts",
185
+ "build:docs": "node ../docs/scripts/build-docs.ts",
187
186
  "vitest": "vitest",
188
187
  "test": "pnpm test:typecheck && pnpm test:unit",
189
188
  "test:typecheck": "tsc -p ./test",
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { PACKAGE_VERSION, TARGETED_RPC_VERSION } from '../version.js';
4
+ import { PACKAGE_VERSION } from '../version.js';
5
5
  import { JsonRpcError, SuiHTTPStatusError } from './errors.js';
6
6
 
7
7
  /**
@@ -58,7 +58,6 @@ export class JsonRpcHTTPTransport implements JsonRpcTransport {
58
58
  'Content-Type': 'application/json',
59
59
  'Client-Sdk-Type': 'typescript',
60
60
  'Client-Sdk-Version': PACKAGE_VERSION,
61
- 'Client-Target-Api-Version': TARGETED_RPC_VERSION,
62
61
  'Client-Request-Method': input.method,
63
62
  ...this.#options.rpc?.headers,
64
63
  },
package/src/version.ts CHANGED
@@ -3,5 +3,4 @@
3
3
 
4
4
  // This file is generated by genversion.mjs. Do not edit it directly.
5
5
 
6
- export const PACKAGE_VERSION = '2.16.0';
7
- export const TARGETED_RPC_VERSION = '1.71.0';
6
+ export const PACKAGE_VERSION = '2.16.2';