Expand description
Core type definitions for the Sui blockchain.
Sui is a next-generation smart contract platform with high throughput, low latency, and an asset-oriented programming model powered by the Move programming language. This crate provides type definitions for working with the data that makes up the Sui blockchain.
§Feature flags
This library uses a set of feature flags to reduce the number of dependencies and amount of compiled code. By default, no features are enabled which allows one to enable a subset specifically for their use case. Below is a list of the available feature flags.
serde
: Enables support for serializing and deserializing types to/from BCS utilizing serde library.rand
: Enables support for generating random instances of a number of types via the rand library.hash
: Enables support for hashing, which is required for deriving addresses and calculating digests for various types.proptest
: Enables support for the proptest library by providing implementations of proptest::arbitrary::Arbitrary for many types.
§BCS
BCS is the serialization format used to represent the state of the blockchain and is used extensively throughout the Sui ecosystem. In particular the BCS format is leveraged because it “guarantees canonical serialization, meaning that for any given data type, there is a one-to-one correspondence between in-memory values and valid byte representations.” One benefit of this property of having a canonical serialized representation is to allow different entities in the ecosystem to all agree on how a particular type should be interpreted and more importantly define a deterministic representation for hashing and signing.
This library strives to guarantee that the types defined are fully BCS-compatible with the data
that the network produces. The one caveat to this would be that as the Sui protocol evolves,
new type variants are added and older versions of this library may not support those newly
added variants. The expectation is that the most recent release of this library will support
new variants and types as they are released to Sui’s testnet
network.
See the documentation for the various types defined by this crate for a specification of their BCS serialized representation which will be defined using ABNF notation as described by RFC-5234. In addition to the format itself, some types have an extra layer of verification and may impose additional restrictions on valid byte representations above and beyond those already provided by BCS. In these instances the documentation for those types will clearly specify these additional restrictions.
Here are some common rules:
; --- BCS Value ---
bcs-value = bcs-struct / bcs-enum / bcs-length-prefixed / bcs-fixed-length
bcs-length-prefixed = bytes / string / vector / option
bcs-fixed-length = u8 / u16 / u32 / u64 / u128 /
i8 / i16 / i32 / i64 / i128 /
boolean
bcs-struct = *bcs-value ; Sequence of serialized fields
bcs-enum = uleb128-index bcs-value ; Enum index and associated value
; --- Length-prefixed types ---
bytes = uleb128 *OCTET ; Raw bytes of the specified length
string = uleb128 *OCTET ; valid utf8 string of the specified length
vector = uleb128 *bcs-value ; Length-prefixed list of values
option = %x00 / (%x01 bcs-value) ; optional value
; --- Fixed-length types ---
u8 = OCTET ; 1-byte unsigned integer
u16 = 2OCTET ; 2-byte unsigned integer, little-endian
u32 = 4OCTET ; 4-byte unsigned integer, little-endian
u64 = 8OCTET ; 8-byte unsigned integer, little-endian
u128 = 16OCTET ; 16-byte unsigned integer, little-endian
i8 = OCTET ; 1-byte signed integer
i16 = 2OCTET ; 2-byte signed integer, little-endian
i32 = 4OCTET ; 4-byte signed integer, little-endian
i64 = 8OCTET ; 8-byte signed integer, little-endian
i128 = 16OCTET ; 16-byte signed integer, little-endian
boolean = %x00 / %x01 ; Boolean: 0 = false, 1 = true
array = *(bcs-value) ; Fixed-length array
; --- ULEB128 definition ---
uleb128 = 1*5uleb128-byte ; Variable-length ULEB128 encoding
uleb128-byte = %x00-7F / %x80-FF ; ULEB128 continuation rules
uleb128-index = uleb128 ; ULEB128-encoded variant index
Modules§
Structs§
- Active
Jwk - A new Jwk
- Address
- Unique identifier for an Account on the Sui blockchain.
- Address
Parse Error - Authenticator
State Expire - Expire old JWKs
- Authenticator
State Update - Update the set of valid JWKs
- Balance
Change - Bls12381
Public Key - A bls12381 min-sig public key.
- Bls12381
Signature - A bls12381 min-sig signature.
- Bn254
Field Element - A point on the BN254 elliptic curve.
- Canceled
Transaction - A transaction that was canceled
- Change
Epoch - System transaction used to change the epoch
- Changed
Object - Input/output state of an object that was changed during execution
- Checkpoint
Contents - The committed to contents of a checkpoint.
- Checkpoint
Contents Digest - Checkpoint
Data - Checkpoint
Digest - Checkpoint
Summary - A header for a Checkpoint on the Sui blockchain.
- Checkpoint
Transaction - Checkpoint
Transaction Info - Transaction information committed to in a checkpoint
- Circom
G1 - A G1 point
- Circom
G2 - A G2 point
- Consensus
Commit Digest - Consensus
Commit Prologue - V1 of the consensus commit prologue system transaction
- Consensus
Commit Prologue V2 - V2 of the consensus commit prologue system transaction
- Consensus
Commit Prologue V3 - V3 of the consensus commit prologue system transaction
- Consensus
Commit Prologue V4 - V4 of the consensus commit prologue system transaction
- Digest
- A 32-byte Blake2b256 hash output.
- Digest
Parse Error - Ed25519
Public Key - An ed25519 public key.
- Ed25519
Signature - An ed25519 signature.
- Effects
Auxiliary Data Digest - EndOf
Epoch Data - Data, which when included in a
CheckpointSummary
, signals the end of anEpoch
. - Event
- An event
- GasCost
Summary - Summary of gas charges.
- GasPayment
- Payment information for executing a transaction
- Genesis
Object - An object part of the initial chain state
- Genesis
Transaction - The genesis transaction
- Identifier
- A move identifier
- Intent
- A Signing Intent
- Jwk
- A JSON Web Key
- JwkId
- Key to uniquely identify a JWK
- Make
Move Vector - Command to build a move vector out of a set of individual elements
- Merge
Coins - Command to merge multiple coins of the same type into a single coin
- Modified
AtVersion - Indicates that an Object was modified at a specific version
- Move
Call - Command to call a move function
- Move
Location - Location in move bytecode where an error occurred
- Move
Package - A move package
- Move
Struct - A move struct
- Multisig
Aggregated Signature - Aggregated signature from members of a multisig committee.
- Multisig
Committee - A multisig committee
- Multisig
Member - A member in a multisig committee
- Object
- An object on the sui blockchain
- Object
Digest - Object
Id - An
ObjectId
is a 32-byte identifier used to uniquely identify an object on the Sui blockchain. - Object
Reference - Reference to an object
- Object
Reference With Owner - An object reference with owner information
- Passkey
Authenticator - A passkey authenticator.
- Passkey
Public Key - Public key of a
PasskeyAuthenticator
. - Personal
Message - Programmable
Transaction - A user transaction
- Publish
- Command to publish a new move package
- Randomness
State Update - Randomness update
- Secp256k1
Public Key - A secp256k1 public key.
- Secp256k1
Signature - A secp256k1 signature.
- Secp256r1
Public Key - A secp256r1 public key.
- Secp256r1
Signature - A secp256r1 signature.
- Signed
Checkpoint Summary - Signed
Transaction - Split
Coins - Command to split a single coin object into multiple coins
- Struct
Tag - Type information for a move struct
- System
Package - System package
- Transaction
- A transaction
- Transaction
Digest - Transaction
Effects Digest - Transaction
Effects V1 - Version 1 of TransactionEffects
- Transaction
Effects V2 - Version 2 of TransactionEffects
- Transaction
Events - Events emitted during the successful execution of a transaction
- Transaction
Events Digest - Transfer
Objects - Command to transfer ownership of a set of objects to an address
- Type
Origin - Identifies a struct and the module it was defined in
- Type
Parse Error - Unchanged
Shared Object - A shared object that wasn’t changed during execution
- Upgrade
- Command to upgrade an already published package
- Upgrade
Info - Upgraded package info for the linkage table
- Validator
Aggregated Signature - An aggregated signature from multiple Validators.
- Validator
Committee - The Validator Set for a particular epoch.
- Validator
Committee Member - A member of a Validator Committee
- Validator
Signature - A signature from a Validator
- Version
Assignment - Object version assignment from consensus
- ZkLogin
Authenticator - A zklogin authenticator
- ZkLogin
Claim - A claim of the iss in a zklogin proof
- ZkLogin
Inputs - A zklogin groth16 proof and the required inputs to perform proof verification.
- ZkLogin
Proof - A zklogin groth16 proof
- ZkLogin
Public Identifier - Public Key equivalent for Zklogin authenticators
Enums§
- Argument
- An argument to a programmable transaction command
- Checkpoint
Commitment - A commitment made by a checkpoint.
- Command
- A single command in a programmable transaction.
- Command
Argument Error - An error with an argument to a command
- Consensus
Determined Version Assignments - Version assignments performed by consensus
- EndOf
Epoch Transaction Kind - Operation run at the end of an epoch
- Execution
Error - An error that can occur during the execution of a transaction
- Execution
Status - The status of an executed Transaction
- IdOperation
- Defines what happened to an ObjectId during execution
- Input
- An input to a user transaction
- Intent
AppId - Byte signifying the application id of an
Intent
- Intent
Scope - Byte signifying the scope of an
Intent
- Intent
Version - Byte signifying the version of an
Intent
- Multisig
Member Public Key - Enum of valid public keys for multisig committee members
- Multisig
Member Signature - A signature from a member of a multisig committee.
- Object
Data - Object data, either a package or struct
- Object
In - State of an object prior to execution
- Object
Out - State of an object after execution
- Object
Type - Type of a Sui object
- Owner
- Enum of different types of ownership for an object.
- Package
Upgrade Error - An error with a upgrading a package
- Signature
Scheme - Flag use to disambiguate the signature schemes supported by Sui.
- Simple
Signature - A basic signature
- Transaction
Effects - The output or effects of executing a transaction
- Transaction
Expiration - A TTL for a transaction
- Transaction
Kind - Transaction type
- Type
Argument Error - An error with a type argument
- TypeTag
- Type of a move value
- Unchanged
Shared Kind - Type of unchanged shared object
- User
Signature - A signature from a user