Skip to content

Commit

Permalink
Update prog-trans-ts-sdk.md (MystenLabs#9623)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test Plan 

How did you test the new or updated feature?

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes

---------

Co-authored-by: Todd Nowacki <[email protected]>
  • Loading branch information
randall-Mysten and tnowacki authored Mar 21, 2023
1 parent 9dc84e6 commit cd2a3e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/src/build/prog-trans-ts-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ signer.signAndExecuteTransaction({ transaction: tx });

Programmable Transactions have two key concepts: inputs and commands.

Inputs are values that are used as arguments to the commands in the transaction. Inputs can either be an object reference (either to an owned object, or a shared object), or a pure BCS value (for example, an encoded string used as an argument to a move call).
Inputs are values that are used as arguments to the commands in the transaction. Inputs can either be an object reference (either to an owned object, an immutable object, or a shared object), or a pure BCS value (for example, an encoded string used as an argument to a move call).

Commands are steps of execution in the transaction. You can also use the result of previous commands as arguments to a future command. By combining multiple commands together, programmable transactions provide a flexible way to create complex transactions.

Expand All @@ -77,7 +77,7 @@ The following commands are available:
- Example: `tx.mergeCoins(tx.object(coin1), [tx.object(coin2), tx.object(coin3)])`
- `tx.transferObjects(objects, address)` - Transfers a list of objects to the specified address.
- Example: `tx.transferObjects([tx.object(thing1), tx.object(thing2)], tx.pure(myAddress))`
- `tx.moveCall({ target, arguments, typeArguments })` - Executes a move call. Returns whatever the move call returns.
- `tx.moveCall({ target, arguments, typeArguments })` - Executes a move call. Returns whatever the Sui Move call returns.
- Example: `tx.moveCall({ target: '0x2::devnet_nft::mint', arguments: [tx.pure(name), tx.pure(description), tx.pure(image)] })`
- `tx.makeMoveVec({ type, objects })` - Constructs a vector of objects that can be passed into a `moveCall`. This is required as there’s no way to define a vector as an input.
- Example: `tx.makeMoveVec({ objects: [tx.object(id1), tx.object(id2)] })`
Expand Down Expand Up @@ -108,7 +108,7 @@ tx.transferObjects([mintMany[0], mintMany[1]], tx.pure(address));
## Use the gas coin
With Programmable Transactions, you’re able to use the gas payment coin to construct coins with a set balance using `splitCoin`. This is useful for Sui payments, and avoids the need for up-front coin selection. You can use `tx.gas` to access the gas coin in a transaction, and is valid as input for any arguments.
With Programmable Transactions, you’re able to use the gas payment coin to construct coins with a set balance using `splitCoin`. This is useful for Sui payments, and avoids the need for up-front coin selection. You can use `tx.gas` to access the gas coin in a transaction, and it is valid as input for any arguments, as long as it is used [by-reference](../build/programming-with-objects/ch2-using-objects.md#pass-objects-by-reference). Practically speaking, this means you can also add to the gas coin with `mergeCoins` and borrow it for Move functions with `moveCall`.
You can also transfer the gas coin using `transferObjects`, in the event that you want to transfer all of your coin balance to another address.
Expand Down Expand Up @@ -231,4 +231,4 @@ const sponsoredTx = Transaction.fromKind(kindBytes);
sponsoredTx.setSender(sender);
sponsoredTx.setGasOwner(sponsor);
sponsoredTx.setGasPayment(sponsorCoins);
```
```

0 comments on commit cd2a3e9

Please sign in to comment.