Enum concordium_std::schema::Type
source · pub enum Type {
Show 32 variants
Unit,
Bool,
U8,
U16,
U32,
U64,
U128,
I8,
I16,
I32,
I64,
I128,
Amount,
AccountAddress,
ContractAddress,
Timestamp,
Duration,
Pair(Box<Type, Global>, Box<Type, Global>),
List(SizeLength, Box<Type, Global>),
Set(SizeLength, Box<Type, Global>),
Map(SizeLength, Box<Type, Global>, Box<Type, Global>),
Array(u32, Box<Type, Global>),
Struct(Fields),
Enum(Vec<(String, Fields), Global>),
String(SizeLength),
ContractName(SizeLength),
ReceiveName(SizeLength),
ULeb128(u32),
ILeb128(u32),
ByteList(SizeLength),
ByteArray(u32),
TaggedEnum(BTreeMap<u8, (String, Fields), Global>),
}
Expand description
Schema type used to describe the different types in a smart contract, their serialization and how to represent the types in JSON.
Variants§
Unit
A type with no serialization.
Bool
Boolean. Serialized as a byte, where the value 0 is false and 1 is true.
U8
Unsigned 8-bit integer.
U16
Unsigned 16-bit integer. Serialized as little endian.
U32
Unsigned 32-bit integer. Serialized as little endian.
U64
Unsigned 64-bit integer. Serialized as little endian.
U128
Unsigned 128-bit integer. Serialized as little endian.
I8
Signed 8-bit integer. Serialized as little endian.
I16
Signed 16-bit integer. Serialized as little endian.
I32
Signed 32-bit integer. Serialized as little endian.
I64
Signed 64-bit integer. Serialized as little endian.
I128
Signed 128-bit integer. Serialized as little endian.
Amount
An amount of CCD. Serialized as 64-bit unsigned integer little endian.
AccountAddress
An account address.
ContractAddress
A contract address.
Timestamp
A timestamp. Represented as milliseconds since Unix epoch. Serialized as a 64-bit unsigned integer little endian.
Duration
A duration of milliseconds, cannot be negative. Serialized as a 64-bit unsigned integer little endian.
Pair(Box<Type, Global>, Box<Type, Global>)
A pair.
List(SizeLength, Box<Type, Global>)
A list. It is serialized with the length first followed by the list items.
Set(SizeLength, Box<Type, Global>)
A Set. It is serialized with the length first followed by the list items.
Map(SizeLength, Box<Type, Global>, Box<Type, Global>)
A Map. It is serialized with the length first followed by key-value pairs of the entries.
Array(u32, Box<Type, Global>)
A fixed sized list.
Struct(Fields)
A structure type with fields.
Enum(Vec<(String, Fields), Global>)
A sum type.
String(SizeLength)
A UTF8 String. It is serialized with the length first followed by the encoding of the string.
ContractName(SizeLength)
A smart contract name. It is serialized with the length first followed by the ASCII encoding of the name.
ReceiveName(SizeLength)
A smart contract receive function name. It is serialized with the length first followed by the ASCII encoding of the name.
ULeb128(u32)
An unsigned integer encoded using LEB128 with the addition of a constraint on the maximum number of bytes to use for an encoding.
ILeb128(u32)
A signed integer encoded using LEB128 with the addition of a constraint on the maximum number of bytes to use for an encoding.
ByteList(SizeLength)
A list of bytes. It is serialized with the length first followed by the bytes.
ByteArray(u32)
A fixed sized list of bytes.
TaggedEnum(BTreeMap<u8, (String, Fields), Global>)
An enum with a tag.