Skip to content

Commit

Permalink
More detailed explanation on transaction inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikos-terzo committed Aug 13, 2024
1 parent f426943 commit a59f2cb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 22 additions & 1 deletion book/src/concepts/what-is-a-transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Transactions consist of:

- a sender - the [account](./what-is-an-account.md) that _signs_ the transaction;
- a list (or a chain) of commands - the operations to be executed;
- command inputs - the arguments for the commands: either `pure` - simple* values like numbers or
- command inputs - the arguments for the commands: either `pure` - simple values like numbers or
strings, or `object` - objects that the transaction will access;
- a gas object - the `Coin` object used to pay for the transaction;
- gas price and budget - the cost of the transaction;
Expand All @@ -33,6 +33,27 @@ Transactions consist of:
MoveVM as transaction inputs. They always need to be instantiated/created inside MoveVM. There are
only some exceptions to this such as: `ID` and `String`</sup>

## Inputs

Transaction inputs are the arguments for the transaction and are split between 2 types:
- Pure arguments: These are mostly [primitive types](../move-basics/primitive-types.html) with some
extra additions. A pure argument can be:
- boolean
- integer (u8, u16, u32, u64, u128, u256)
- address
- std::ascii::String
- std::string::String
- vector of the above types
- Option of the above types
- ID, a special type that refers to a unique identifier of an object
- Object arguments: These are objects or references of objects that the transaction will access. An
object argument needs to be either a shared object, a frozen object, or an object that the
transaction sender owns, in order for the transaction to be successfull.
For more see [Object Model](http://localhost:3000/object/index.html).

Note that a single command inside a transaction can also have a previous command's result as input.
These results/inputs can be anything from a simple value, an object, or any kind of Move struct.

## Commands

Sui transactions may consist of multiple commands. Each command is a single built-in command (like
Expand Down
4 changes: 3 additions & 1 deletion book/src/programmability/bcs.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ Structs encode similarly to simple types. Here is how to encode a struct using B
{{#include ../../../packages/samples/sources/programmability/bcs.move:encode_struct}}
```

Note that encoding a struct does not make much sense in interacting with the Move VM, as custom structs cannot be created this way to use in MoveVM. See also [Transaction](../concepts/what-is-a-transaction.html).
Note that encoding a custom struct does not make much sense in interacting with the Move VM, as
custom structs cannot be created this way to use in MoveVM. See also
[Transaction Inputs](../concepts/what-is-a-transaction.html#inputs).

## Decoding

Expand Down

0 comments on commit a59f2cb

Please sign in to comment.