Skip to content

Commit

Permalink
Explain that no struct can be created as transaction input other than…
Browse files Browse the repository at this point in the history
… some exceptions.
  • Loading branch information
nikos-terzo committed Aug 13, 2024
1 parent b2860f3 commit f426943
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion book/src/concepts/what-is-a-transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ 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;

<sup>* Notice that custom structures defined in Move packages cannot be created and passed to
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>

## Commands

Sui transactions may consist of multiple commands. Each command is a single built-in command (like
Expand Down
2 changes: 2 additions & 0 deletions book/src/programmability/bcs.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ 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).

## Decoding

Because BCS does not self-describe and Move is statically typed, decoding requires prior knowledge of the data type. The `sui::bcs` module provides various functions to assist with this process.
Expand Down

0 comments on commit f426943

Please sign in to comment.