The manifest syntax for instruction arguments forms a representation of an encoded “Manifest SBOR” value. The Manifest SBOR value is converted by the transaction processor into “Scrypto SBOR” which is then used to make calls to other objects in the engine.
A specific SBOR implementation is formed of a core of “basic” value kinds, and then implementation specific additional value kinds. When the transaction processor processes the manifest, it maps basic value kinds are mapped as-is, and remaps the Manifest value kinds to Scrypto value kinds.
Basic Leaf Value Kinds
Below are all the value kinds in the basic (common) SBOR model.
Basic Value Kind | Manifest Syntax Example |
---|
Bool
| true
false
|
I8 , I16 , I32 , I64 , I128
| 5i8
-412i32
12345678i128
|
U8 , U16 , U32 , U64 , U128
| 5u8
412u32
12345678u128
|
String
| "I like a \"quoted message\"!\n"
Strings must be valid unicode. The string literal follows JSON escaping rules: Double quotes must be escaped as \” , and backslashes must be escaped as \\ . You can optionally also use the following escapes: \/ , \b , \f , \n , \r , \t and \uXXXX where X are exactly four hex digits, i.e. a UTF-16 encoding. The resultant string must be valid unicode (so not unmatched surrogate pairs).
If writing in Javascript, JSON.stringify(value) can be used to encode a valid string literal. |
Basic Composite Value Kinds
Below are all the composite value kinds in the basic (common) SBOR model.
Basic Value Kind | Manifest Syntax Example |
---|
Tuple
| Examples: Tuple(“Hello”, 43u8)
Tuple()
As an example, if you want to reference a structure or tuple from Scrypto, all the three examples below would have their values written in the form Tuple(55u64, "David") : #[derive(ScryptoSbor)]
pub struct Student {
id: u64,
name: String,
}
#[derive(ScryptoSbor)]
pub struct StudentTwo(u64, String)
(u64, String)
|
Enum
Represents the value of a sum-type (combined with a product type), such as a Rust enum. Technically this represents an Enum Variant value, but was shortened to Enum for brevity. An Enum Variant consists of: A `u8` discriminator - this is typically the 0-index of the variant under the enum in Rust. 0 or more child values, which form part of the enum variant.
| The canonical representation is: Some engine-specific enums also have a nicer alias-syntax for their variants, eg: Enum<AccessRule::Protected>(
Enum<AccessRuleNode::ProofRule>(
Enum<ProofRule::Require>(
Enum<ResourceOrNonFungible::NonFungible>(
NonFungibleGlobalId("...")
)
)
)
)
The full list of supported manifest enum variant names is given here. Option and Result also have rust-like ident aliases for their variants, and so can be represented as Some("value") / None and Ok("Success") / Err("Failure!") . If you are representing enum variants of an enum defined in scrypto, you can’t use the alias-syntax, and instead will have to rely on discriminant numbers. So you’ll need to work out the enum variant to use. EG the MouseMove variant below has index 1, and has two u32 fields, so you would write this in your transaction manifest as Enum<1u8>(320u32, 480u32) . Similarly, the MousePress variant has index 3, and a single String field, so would be represented as eg Enum<3u8>("scroll-wheel") . #[scrypto(ScryptoSbor)]
pub enum Event {
PageLoad,
MouseMove(u32, u32),
KeyPress(String),
MousePress { button_name: String }
}
|
Array
Represents a repeated value (such as an Array / Vec / Set / List, etc) All contained values must be of the same value kind. This value kind is specified in the angle brackets. This also includes bytes - which are effectively an Array<U8> , although their canonical representation is using the Bytes("<hex>") alias covered later.
| Array<String>("foo", "bar")
|
Map
Represents a map (effectively an array of two-tuples). All contained values must have the same value kind for their keys and the same value kind for their values. These value kinds are specified in the angle brackets.
| Map<U8, U16>(1u8 => 5u16, 2u8 => 7u16)
You can also nest Map: Map<String, Tuple>(
"Blueprint" => Tuple(
Map<String, U32>(
"method" => 1u32
),
0u32
)
);
|
Manifest Value Kinds
Manifest Value Kind | Example |
---|
Address
Resolves to a reference to the given address - either fixed, or from a bound reference.
If used as a NamedAddress: The first instruction using this will bind the given name to the given created address. In the compiled representation, names are removed and replaced with integer indexed references.
| |
AddressReservation
Resolves to an owned AddressReservation. The first instruction using this will bind the given name to the given created/bound AddressReservation. In the compiled representation, names are removed and replaced with integer indexed references.
| AddressReservation("address_reservation")
|
Bucket
Resolves to an owned FungibleBucket or NonFungibleBucket. The first instruction using this will bind the given name to the given created/bound bucket. In the compiled representation, names are removed and replaced with integer indexed references.
| Named bucket, Bucket("my_awesome_xrd_bucket") Unnamed bucket, Bucket(5u32)
|
Proof
Resolves to an owned FungibleProof or NonFungibleProof. The first instruction using this will bind the given name to the given created/bound proof. In the compiled representation, names are removed and replaced with integer indexed references.
| Named proof, Proof("auth") Unnamed proof, Proof(100u32)
|
Expression
Resolves to an array of owned Buckets or owned Proofs respectively. | Only the following are supported: |
Blob
Resolves to a Vec<u8> of the content of the blob with the given hash in the transaction intent. | Blob("<black2b_hash_of_the_blob_contents>")
|
Decimal
Resolves as a Decimal. | Decimal("-123.456")
|
PreciseDecimal
Resolves as a PreciseDecimal. | PreciseDecimal("1231232342342.123213123123")
|
NonFungibleLocalId
Resolves as a NonFungibleLocalId. | String: NonFungibleLocalId("<SomeId>") Integer: NonFungibleLocalId("#12123#") Bytes: NonFungibleLocalId("[031b84c5567b126440995d3ed5aaba05]") RUID: NonFungibleLocalId("{43968a7243968a72-5954595459545954-45da967845da9678-8659dd398659dd39}")
|
Manifest aliases
Manifest Alias | Example |
---|
Unit
Resolves as a Tuple of length 0. | ()
|
NonFungibleGlobalId
Resolves as a Tuple of the resource address and the non fungible local id. | Various examples: String: NonFungibleGlobalId("${non_fungible_resource_address}:<string-value>") Integer: NonFungibleGlobalId("${non_fungible_resource_address}:#123#") Bytes: NonFungibleGlobalId("${non_fungible_resource_address}:[031b84c5567b12643213]") RUID: NonFungibleGlobalId("${non_fungible_resource_address}:{..-..-..-..}")
Which resolves to: |
Bytes
Resolves as an Array<U8> via hex decoding. This is the canonical representation of a Array<U8> in the manifest. | Bytes("deadbeef")
|
Various Enum ident aliases: These resolve to the relevant enum variant. | Examples: Some("Hello World")
None
Ok("Success message.")
Err("Failure message.")
|
Expressions
At the moment, two expressions are available. Expression("ENTIRE_WORKTOP")
takes all resources present on the worktop and puts them in a vector of buckets that can then be used as an argument. Expression("ENTIRE_AUTH_ZONE")
works similarly but with proofs present on the AuthZone.