@mysten/sui 2.17.0 → 2.18.0

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 (46) hide show
  1. package/CHANGELOG.md +18 -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/name_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/transactions/Transaction.d.mts +16 -2
  8. package/dist/transactions/Transaction.d.mts.map +1 -1
  9. package/dist/transactions/Transaction.mjs +8 -3
  10. package/dist/transactions/Transaction.mjs.map +1 -1
  11. package/dist/transactions/index.d.mts +2 -2
  12. package/dist/version.mjs +1 -1
  13. package/dist/version.mjs.map +1 -1
  14. package/dist/zklogin/jwt-utils.d.mts.map +1 -1
  15. package/dist/zklogin/jwt-utils.mjs.map +1 -1
  16. package/dist/zklogin/utils.d.mts.map +1 -1
  17. package/dist/zklogin/utils.mjs +9 -0
  18. package/dist/zklogin/utils.mjs.map +1 -1
  19. package/docs/bcs.md +11 -6
  20. package/docs/clients/core.md +10 -9
  21. package/docs/clients/grpc.md +1 -1
  22. package/docs/index.md +176 -22
  23. package/docs/llms-index.md +6 -9
  24. package/docs/migrations/0.38.md +2 -2
  25. package/docs/migrations/sui-1.0.md +2 -2
  26. package/docs/migrations/sui-2.0/json-rpc-migration.md +76 -33
  27. package/docs/plugins.md +29 -5
  28. package/docs/transactions/basics.md +279 -0
  29. package/docs/transactions/coins-and-balances.md +293 -0
  30. package/docs/transactions/offline.md +192 -0
  31. package/docs/transactions/reference.md +380 -0
  32. package/docs/transactions/signing-and-execution.md +401 -0
  33. package/package.json +26 -26
  34. package/src/transactions/Transaction.ts +36 -5
  35. package/src/transactions/index.ts +1 -0
  36. package/src/version.ts +1 -1
  37. package/src/zklogin/jwt-utils.ts +3 -0
  38. package/src/zklogin/utils.ts +17 -0
  39. package/docs/faucet.md +0 -26
  40. package/docs/hello-sui.md +0 -115
  41. package/docs/install.md +0 -61
  42. package/docs/transaction-building/basics.md +0 -299
  43. package/docs/transaction-building/gas.md +0 -61
  44. package/docs/transaction-building/intents.md +0 -62
  45. package/docs/transaction-building/offline.md +0 -73
  46. package/docs/transaction-building/sponsored-transactions.md +0 -22
@@ -0,0 +1,192 @@
1
+ # Building Offline
2
+
3
+ > Build transactions without a network connection
4
+
5
+ Normally the SDK resolves object versions, estimates gas, and fills in other details by querying the
6
+ network. For offline building of backend services, air-gapped signing, or pre-built transactions,
7
+ you must provide this information yourself. See also the Sui documentation on
8
+ [offline signing](https://docs.sui.io/guides/developer/transactions/transaction-auth/offline-signing)
9
+ for the protocol-level details.
10
+
11
+ ## Transactions without owned object inputs
12
+
13
+ When your transaction only uses shared objects, party objects, and/or address balance withdrawals,
14
+ there are no owned object versions to look up. Use `tx.withdrawal()` directly instead of `tx.coin()`
15
+ or `coinWithBalance` because they require a client to resolve coin objects at build time.
16
+
17
+ ```typescript
18
+
19
+ const tx = new Transaction();
20
+
21
+ // Use tx.withdrawal() + coin::redeem_funds to withdraw from address balance.
22
+ // No coin object lookups needed — fully offline.
23
+ const [coin] = tx.moveCall({
24
+ target: '0x2::coin::redeem_funds',
25
+ typeArguments: ['0x2::sui::SUI'],
26
+ arguments: [tx.withdrawal({ amount: 1_000_000_000 })],
27
+ });
28
+ tx.transferObjects([coin], '0xRecipientAddress');
29
+
30
+ // Shared/party objects only need objectId + initialSharedVersion (both stable)
31
+ tx.moveCall({
32
+ target: '0xPackage::module::function',
33
+ arguments: [
34
+ tx.sharedObjectRef({
35
+ objectId: '0xSharedObjectId',
36
+ initialSharedVersion: '1',
37
+ mutable: true,
38
+ }),
39
+ ],
40
+ });
41
+
42
+ // Required configuration for all offline builds
43
+ tx.setSender('0xSenderAddress');
44
+ tx.setGasPrice(1000); // query getReferenceGasPrice() beforehand, or use a known value
45
+ tx.setGasBudget(50_000_000);
46
+ tx.setGasPayment([]); // empty array = pay gas from address balance
47
+
48
+ // Expiration is required when there are no owned objects for gas or inputs
49
+ tx.setExpiration({
50
+ ValidDuring: {
51
+ minEpoch: 100, // current epoch
52
+ maxEpoch: 101, // current epoch + 1
53
+ minTimestamp: null,
54
+ maxTimestamp: null,
55
+ chain: 'mainnet', // or 'testnet', 'devnet'
56
+ nonce: 0,
57
+ },
58
+ });
59
+
60
+ // Build without a client
61
+ const bytes = await tx.build();
62
+ ```
63
+
64
+ This enables fully stateless construction. You only need the sender address, reference gas price,
65
+ epoch, and chain identifier.
66
+
67
+ ## Party objects
68
+
69
+ Party objects are address-owned but consensus-versioned, with per-address permissions. They are
70
+ referenced the same way as shared objects:
71
+
72
+ ```typescript
73
+ tx.sharedObjectRef({
74
+ objectId: '0xPartyObjectId',
75
+ initialSharedVersion: '1',
76
+ mutable: true,
77
+ });
78
+ ```
79
+
80
+ Key properties for offline building:
81
+
82
+ - **No version lookup needed**: `initialSharedVersion` is stable and set once when the object
83
+ becomes a party object
84
+ - **Enable pipelining**: Submit multiple transactions on the same party object without waiting for
85
+ each one to finalize
86
+ - **Cannot be used for gas**: Use address balance for gas payment (`setGasPayment([])`)
87
+
88
+ ## Transactions with owned object inputs
89
+
90
+ When your transaction uses owned or immutable objects, you must provide the exact version and digest
91
+ for each one:
92
+
93
+ ```typescript
94
+
95
+ const tx = new Transaction();
96
+
97
+ // Owned objects need exact version and digest
98
+ tx.transferObjects(
99
+ [
100
+ tx.objectRef({
101
+ objectId: '0xOwnedObjectId',
102
+ version: '42',
103
+ digest: 'abc123...',
104
+ }),
105
+ ],
106
+ '0xRecipientAddress',
107
+ );
108
+
109
+ // Receiving objects also need exact version and digest
110
+ tx.moveCall({
111
+ target: '0xPackage::module::receive',
112
+ arguments: [
113
+ tx.objectRef({
114
+ objectId: '0xParentId',
115
+ version: '10',
116
+ digest: 'def456...',
117
+ }),
118
+ tx.receivingRef({
119
+ objectId: '0xReceivingId',
120
+ version: '5',
121
+ digest: 'ghi789...',
122
+ }),
123
+ ],
124
+ });
125
+
126
+ // Gas payment with specific coin objects
127
+ tx.setGasPayment([{ objectId: '0xGasCoinId', version: '3', digest: 'jkl012...' }]);
128
+
129
+ tx.setSender('0xSenderAddress');
130
+ tx.setGasPrice(1000);
131
+ tx.setGasBudget(50_000_000);
132
+
133
+ const bytes = await tx.build();
134
+ ```
135
+
136
+ ## Required configuration for all offline builds
137
+
138
+ Every offline-built transaction must have the following:
139
+
140
+ | Method | Description |
141
+ | ----------------- | --------------------------------------------------------------- |
142
+ | `setSender()` | The address executing the transaction |
143
+ | `setGasPrice()` | Reference gas price (query `getReferenceGasPrice()` beforehand) |
144
+ | `setGasBudget()` | Maximum gas to spend (in MIST) |
145
+ | `setGasPayment()` | Coin object references, or `[]` for address balance |
146
+
147
+ ### Expiration
148
+
149
+ Set an expiration when your transaction uses no owned objects for gas or inputs. This applies when
150
+ you use address balances for gas (`setGasPayment([])`) with only shared and party object inputs:
151
+
152
+ ```typescript
153
+ tx.setExpiration({
154
+ ValidDuring: {
155
+ minEpoch: 100, // current epoch
156
+ maxEpoch: 101, // typically current epoch + 1
157
+ minTimestamp: null,
158
+ maxTimestamp: null,
159
+ chain: 'mainnet',
160
+ nonce: 0, // increment for multiple transactions in the same epoch
161
+ },
162
+ });
163
+ ```
164
+
165
+ You can also use epoch-based expiration:
166
+
167
+ ```typescript
168
+ tx.setExpiration({ Epoch: 100 });
169
+ ```
170
+
171
+ > **Note:** When building with a client, the SDK sets expiration automatically. You only need the manual
172
+ > configuration above for fully offline builds.
173
+
174
+ ## Serialization
175
+
176
+ ### Building to bytes
177
+
178
+ ```typescript
179
+ // Build to BCS bytes (Uint8Array) — fully offline, all data must be provided
180
+ const bytes = await tx.build();
181
+
182
+ // Build with a client — only makes network requests when there is unresolved data to look up
183
+ const bytes = await tx.build({ client: grpcClient });
184
+ ```
185
+
186
+ ### Converting bytes back to a Transaction
187
+
188
+ ```typescript
189
+ const tx = Transaction.from(bytes);
190
+ ```
191
+
192
+ This works with BCS byte arrays, base64-encoded strings, and JSON strings (from `toJSON()`).
@@ -0,0 +1,380 @@
1
+ # Commands and Inputs Reference
2
+
3
+ > Complete reference for transaction commands and input types
4
+
5
+ A
6
+ [programmable transaction block](https://docs.sui.io/guides/developer/transactions/prog-txn-blocks)
7
+ has two parts: **inputs** (objects and pure values) and **commands** (operations that execute on
8
+ those inputs). This page is a complete reference for all input types and commands available in the
9
+ SDK. For task-oriented guides, see [Building Transactions](./basics).
10
+
11
+ See also the [Sui documentation on PTB commands](https://docs.sui.io/references/ptb-commands) and
12
+ [inputs and results](https://docs.sui.io/concepts/transactions/inputs-and-results).
13
+
14
+ ## Passing inputs
15
+
16
+ ### Object references
17
+
18
+ Commands that accept objects (like `splitCoins`, `mergeCoins`, `transferObjects`, and `moveCall`)
19
+ accept any of the following as an object reference:
20
+
21
+ - **String object ID**:`'0xObjectId'`, SDK looks up version and digest at build time
22
+ - **`tx.object('0xObjectId')`**: Equivalent to a string ID, but explicit
23
+ - **`tx.objectRef({...})`**: Fully-resolved owned or immutable object (no lookup needed)
24
+ - **`tx.sharedObjectRef({...})`**: Fully-resolved shared object (no lookup needed)
25
+ - **`tx.receivingRef({...})`**: Fully-resolved receiving object (no lookup needed)
26
+ - **Transaction result**: The return value of a previous command (for example, from `splitCoins`)
27
+ - **`tx.coin({...})`** or **`coinWithBalance({...})`**: A coin intent resolved at build time
28
+ - **`tx.gas`**: The gas coin (when gas is paid from coin objects)
29
+
30
+ ### JavaScript value shortcuts
31
+
32
+ For arguments where the expected type is known, you can pass plain JavaScript values. The SDK
33
+ coerces them to the correct Move type automatically.
34
+
35
+ ```typescript
36
+ // amounts in splitCoins are coerced to u64
37
+ tx.splitCoins(tx.gas, [100, 200]);
38
+
39
+ // addresses in transferObjects are coerced to address
40
+ tx.transferObjects([coin], '0xRecipientAddress');
41
+ ```
42
+
43
+ ### Pure values
44
+
45
+ For Move primitive types, use `tx.pure` to serialize values as BCS:
46
+
47
+ ```typescript
48
+ tx.pure.u8(255);
49
+ tx.pure.u16(65535);
50
+ tx.pure.u32(4294967295);
51
+ tx.pure.u64(100);
52
+ tx.pure.u128(100n);
53
+ tx.pure.u256(100n);
54
+ tx.pure.bool(true);
55
+ tx.pure.string('hello');
56
+ tx.pure.address('0xSomeAddress');
57
+ tx.pure.id('0xSomeObjectId');
58
+ ```
59
+
60
+ ### Vectors and options
61
+
62
+ ```typescript
63
+ // Using type-specific methods
64
+ tx.pure.vector('u8', [1, 2, 3]);
65
+ tx.pure.option('u8', 1);
66
+ tx.pure.option('u8', null); // None
67
+
68
+ // Using type string syntax
69
+ tx.pure('vector<u8>', [1, 2, 3]);
70
+ tx.pure('option<u8>', 1);
71
+ tx.pure('option<u8>', null);
72
+ tx.pure('vector<option<u8>>', [1, null, 2]);
73
+ ```
74
+
75
+ ### BCS serialization
76
+
77
+ For complex types, use the BCS library directly:
78
+
79
+ ```typescript
80
+
81
+ tx.pure(bcs.vector(bcs.U8).serialize([1, 2, 3]));
82
+ tx.pure(bcs.option(bcs.U8).serialize(1));
83
+ tx.pure(bcs.option(bcs.U8).serialize(null));
84
+ ```
85
+
86
+ ### Address balance withdrawals
87
+
88
+ > **Warning:** Address balances are currently only available on Devnet and Testnet. They are not yet supported on
89
+ > Mainnet.
90
+
91
+ Use `tx.withdrawal()` to create an input that withdraws from your address balance:
92
+
93
+ ```typescript
94
+ // Withdraw SUI
95
+ const withdrawal = tx.withdrawal({ amount: 1_000_000_000 });
96
+
97
+ // Withdraw another coin type
98
+ const withdrawal = tx.withdrawal({ amount: 1_000_000, type: '0xPackageId::module::CoinType' });
99
+ ```
100
+
101
+ See [Coins and Balances](./coins-and-balances#withdrawing-from-address-balance) for usage examples.
102
+
103
+ ### The gas coin
104
+
105
+ `tx.gas` references the coin used for gas payment. It can be used as an input to commands:
106
+
107
+ ```typescript
108
+ const [coin] = tx.splitCoins(tx.gas, [1_000_000_000]);
109
+ ```
110
+
111
+ > **Warning:** `tx.gas` is not available when gas is paid from address balances. Use `tx.coin()` instead for
112
+ > portable code.
113
+
114
+ ## Object inputs
115
+
116
+ Objects on Sui have different
117
+ [ownership types](https://docs.sui.io/guides/developer/objects/object-ownership), including
118
+ address-owned, shared, immutable, and object-owned (receiving). Each type requires different
119
+ metadata when used as a transaction input, but the SDK handles most of this automatically.
120
+
121
+ ### tx.object(id)
122
+
123
+ The simplest way to reference an onchain object. The SDK automatically looks up the object's
124
+ version, digest, and type when the transaction is built:
125
+
126
+ ```typescript
127
+ tx.moveCall({
128
+ target: '0xPackage::module::function',
129
+ arguments: [tx.object('0xSomeObjectId')],
130
+ });
131
+ ```
132
+
133
+ Object IDs can also be passed directly to commands that only accept objects:
134
+
135
+ ```typescript
136
+ tx.transferObjects(['0xObjectId1', '0xObjectId2'], '0xRecipient');
137
+ ```
138
+
139
+ When a Move function expects a `Receiving<T>` argument, `tx.object()` automatically converts the
140
+ reference to a receiving input:
141
+
142
+ ```typescript
143
+ tx.moveCall({
144
+ target: '0xPackage::module::receive',
145
+ // The SDK detects the function signature expects Receiving<T> and adjusts accordingly
146
+ arguments: [tx.object('0xParentId'), tx.object('0xReceivingObjectId')],
147
+ });
148
+ ```
149
+
150
+ ### Fully-resolved object references
151
+
152
+ To avoid the SDK's automatic lookup (for [offline building](./offline) or performance), provide the
153
+ full object metadata directly:
154
+
155
+ ```typescript
156
+ // Owned or immutable objects — need exact version and digest
157
+ tx.objectRef({
158
+ objectId: '0xObjectId',
159
+ version: '42',
160
+ digest: 'abc123...',
161
+ });
162
+
163
+ // Shared objects — need initial shared version (stable, doesn't change)
164
+ tx.sharedObjectRef({
165
+ objectId: '0xObjectId',
166
+ initialSharedVersion: '1',
167
+ mutable: true,
168
+ });
169
+
170
+ // Receiving objects — need exact version and digest
171
+ tx.receivingRef({
172
+ objectId: '0xObjectId',
173
+ version: '42',
174
+ digest: 'abc123...',
175
+ });
176
+ ```
177
+
178
+ ### Shared objects
179
+
180
+ Shared objects are accessible by any transaction and are sequenced through consensus. When using
181
+ `tx.object()` with a shared object ID, the SDK looks up the required metadata automatically. For
182
+ offline building or performance, use `tx.sharedObjectRef()` with the `initialSharedVersion` (which
183
+ is stable and never changes after the object is shared):
184
+
185
+ ```typescript
186
+ tx.sharedObjectRef({
187
+ objectId: '0xSharedObjectId',
188
+ initialSharedVersion: '1',
189
+ mutable: true, // false for read-only access
190
+ });
191
+ ```
192
+
193
+ ### Party objects
194
+
195
+ Party objects are address-owned but consensus-versioned, with per-address permissions (read, write,
196
+ delete, or transfer). They are referenced the same way as shared objects:
197
+
198
+ ```typescript
199
+ tx.sharedObjectRef({
200
+ objectId: '0xPartyObjectId',
201
+ initialSharedVersion: '1',
202
+ mutable: true,
203
+ });
204
+ ```
205
+
206
+ Key differences from regular owned objects:
207
+
208
+ - **Enable pipelining**: Multiple in-flight transactions on the same object
209
+ - **No version lookup needed**: `initialSharedVersion` is stable
210
+ - **Cannot be used for gas payment**: Use address balance for gas instead
211
+
212
+ ### Object helpers
213
+
214
+ Common system objects have shorthand methods. Passing `mutable` skips the SDK's automatic mutability
215
+ lookup:
216
+
217
+ ```typescript
218
+ tx.object.system(); // Sui system state (SDK looks up mutability)
219
+ tx.object.system({ mutable: true }); // Mutable system state (no lookup needed)
220
+ tx.object.system({ mutable: false }); // Immutable system state (no lookup needed)
221
+ tx.object.clock(); // On-chain clock (always immutable)
222
+ tx.object.random(); // Random number generator
223
+ tx.object.denyList(); // Coin deny list (SDK looks up mutability)
224
+ tx.object.denyList({ mutable: true }); // Mutable deny list (no lookup needed)
225
+ ```
226
+
227
+ `tx.object.option` wraps an object as a Move `Option<T>`. This adds a `moveCall` command to the
228
+ transaction that constructs the option value:
229
+
230
+ ```typescript
231
+ // Some — wraps the object in Option::some()
232
+ tx.object.option({
233
+ type: '0xPackage::module::Thing',
234
+ value: '0xObjectId',
235
+ });
236
+
237
+ // None — creates Option::none()
238
+ tx.object.option({
239
+ type: '0xPackage::module::Thing',
240
+ value: null,
241
+ });
242
+ ```
243
+
244
+ ## Commands
245
+
246
+ ### `splitCoins`
247
+
248
+ Creates new coins by splitting amounts from an existing coin. Returns one result per amount.
249
+
250
+ ```typescript
251
+ const [coin1, coin2] = tx.splitCoins(coin, [amount1, amount2]);
252
+ ```
253
+
254
+ | Parameter | Type | Description |
255
+ | --------- | -------------------------------------------------- | ------------------------- |
256
+ | `coin` | [object reference](#object-references) or `tx.gas` | The coin to split from |
257
+ | `amounts` | `(number \| bigint \| string)[]` | Amounts for each new coin |
258
+
259
+ ### `mergeCoins`
260
+
261
+ Merges one or more source coins into a destination coin. The source coins are destroyed.
262
+
263
+ ```typescript
264
+ tx.mergeCoins(destinationCoin, [sourceCoin1, sourceCoin2]);
265
+ ```
266
+
267
+ | Parameter | Type | Description |
268
+ | ------------- | ---------------------------------------- | -------------------------------- |
269
+ | `destination` | [object reference](#object-references) | The coin to merge into |
270
+ | `sources` | [object reference](#object-references)[] | Coins to merge (destroyed after) |
271
+
272
+ ### `transferObjects`
273
+
274
+ Transfers one or more objects to a recipient address.
275
+
276
+ ```typescript
277
+ tx.transferObjects([obj1, obj2], recipientAddress);
278
+ ```
279
+
280
+ | Parameter | Type | Description |
281
+ | --------- | ---------------------------------------- | ------------------- |
282
+ | `objects` | [object reference](#object-references)[] | Objects to transfer |
283
+ | `address` | `string` | Recipient address |
284
+
285
+ ### `moveCall`
286
+
287
+ Calls a function in a published Move package. Returns whatever the Move function returns.
288
+
289
+ ```typescript
290
+ const [result] = tx.moveCall({
291
+ target: '0xPackage::module::function',
292
+ arguments: [arg1, arg2],
293
+ typeArguments: ['0x2::sui::SUI'],
294
+ });
295
+ ```
296
+
297
+ | Parameter | Type | Description |
298
+ | --------------- | ---------- | -------------------------------------------------- |
299
+ | `target` | `string` | `packageId::moduleName::functionName` |
300
+ | `arguments` | `any[]` | Function arguments (objects, pure values, results) |
301
+ | `typeArguments` | `string[]` | Move type parameters |
302
+
303
+ You can also pass `package`, `module`, and `function` separately instead of `target`:
304
+
305
+ ```typescript
306
+ tx.moveCall({
307
+ package: '0xPackageId',
308
+ module: 'my_module',
309
+ function: 'my_function',
310
+ arguments: [],
311
+ typeArguments: [],
312
+ });
313
+ ```
314
+
315
+ ### `makeMoveVec`
316
+
317
+ Constructs a vector of objects for use in `moveCall`. Required because there's no other way to pass
318
+ a vector of objects as a transaction input.
319
+
320
+ ```typescript
321
+ const vec = tx.makeMoveVec({ elements: [obj1, obj2] });
322
+
323
+ // Pass the vector to a Move function
324
+ tx.moveCall({
325
+ target: '0xPackage::module::process_items',
326
+ arguments: [vec],
327
+ });
328
+ ```
329
+
330
+ | Parameter | Type | Description |
331
+ | ---------- | ---------------------------------------- | -------------------------------- |
332
+ | `elements` | [object reference](#object-references)[] | Objects to include in the vector |
333
+ | `type` | `string` (optional) | Move type of the elements |
334
+
335
+ ### `publish`
336
+
337
+ Publishes a new Move package. Returns the upgrade capability object.
338
+
339
+ ```typescript
340
+ const [upgradeCap] = tx.publish({ modules, dependencies });
341
+ ```
342
+
343
+ | Parameter | Type | Description |
344
+ | -------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
345
+ | `modules` | `number[][] \| string[]` | Compiled module bytecodes. Each module as a `number[]` (byte array) or base64-encoded `string`. To convert from `Uint8Array`, use `Array.from(bytes)`. |
346
+ | `dependencies` | `string[]` | Package IDs of dependencies |
347
+
348
+ ### `upgrade`
349
+
350
+ Upgrades an existing Move package.
351
+
352
+ ```typescript
353
+ const [upgradeReceipt] = tx.upgrade({ modules, dependencies, package: packageId, ticket });
354
+ ```
355
+
356
+ | Parameter | Type | Description |
357
+ | -------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
358
+ | `modules` | `number[][] \| string[]` | Compiled module bytecodes. Each module as a `number[]` (byte array) or base64-encoded `string`. To convert from `Uint8Array`, use `Array.from(bytes)`. |
359
+ | `dependencies` | `string[]` | Package IDs of dependencies |
360
+ | `package` | `string` | ID of the package being upgraded |
361
+ | `ticket` | [object reference](#object-references) | The upgrade ticket |
362
+
363
+ ## Transaction results
364
+
365
+ Every command returns a `TransactionResult` that can be used as input to subsequent commands:
366
+
367
+ ```typescript
368
+ const [coin] = tx.splitCoins(tx.gas, [100]);
369
+ tx.transferObjects([coin], address);
370
+ ```
371
+
372
+ When a command returns multiple values, use destructuring or indexing:
373
+
374
+ ```typescript
375
+ const [a, b] = tx.moveCall({ target: '0xPkg::mod::returns_two' });
376
+
377
+ // or
378
+ const result = tx.moveCall({ target: '0xPkg::mod::returns_two' });
379
+ tx.transferObjects([result[0], result[1]], address);
380
+ ```