Crate sui_sdk_types

Source
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§

framework
Rust definitions of move/sui framework types.
hashhash

Structs§

ActiveJwk
A new Jwk
Address
Unique identifier for an Account on the Sui blockchain.
AddressParseError
AuthenticatorStateExpire
Expire old JWKs
AuthenticatorStateUpdate
Update the set of valid JWKs
BalanceChange
Bls12381PublicKey
A bls12381 min-sig public key.
Bls12381Signature
A bls12381 min-sig signature.
Bn254FieldElement
A point on the BN254 elliptic curve.
CanceledTransaction
A transaction that was canceled
ChangeEpoch
System transaction used to change the epoch
ChangedObject
Input/output state of an object that was changed during execution
CheckpointContents
The committed to contents of a checkpoint.
CheckpointContentsDigest
CheckpointData
CheckpointDigest
CheckpointSummary
A header for a Checkpoint on the Sui blockchain.
CheckpointTransaction
CheckpointTransactionInfo
Transaction information committed to in a checkpoint
CircomG1
A G1 point
CircomG2
A G2 point
ConsensusCommitDigest
ConsensusCommitPrologue
V1 of the consensus commit prologue system transaction
ConsensusCommitPrologueV2
V2 of the consensus commit prologue system transaction
ConsensusCommitPrologueV3
V3 of the consensus commit prologue system transaction
ConsensusCommitPrologueV4
V4 of the consensus commit prologue system transaction
Digest
A 32-byte Blake2b256 hash output.
DigestParseError
Ed25519PublicKey
An ed25519 public key.
Ed25519Signature
An ed25519 signature.
EffectsAuxiliaryDataDigest
EndOfEpochData
Data, which when included in a CheckpointSummary, signals the end of an Epoch.
Event
An event
GasCostSummary
Summary of gas charges.
GasPayment
Payment information for executing a transaction
GenesisObject
An object part of the initial chain state
GenesisTransaction
The genesis transaction
Identifier
A move identifier
Intent
A Signing Intent
Jwk
A JSON Web Key
JwkId
Key to uniquely identify a JWK
MakeMoveVector
Command to build a move vector out of a set of individual elements
MergeCoins
Command to merge multiple coins of the same type into a single coin
ModifiedAtVersion
Indicates that an Object was modified at a specific version
MoveCall
Command to call a move function
MoveLocation
Location in move bytecode where an error occurred
MovePackage
A move package
MoveStruct
A move struct
MultisigAggregatedSignature
Aggregated signature from members of a multisig committee.
MultisigCommittee
A multisig committee
MultisigMember
A member in a multisig committee
Object
An object on the sui blockchain
ObjectDigest
ObjectId
An ObjectId is a 32-byte identifier used to uniquely identify an object on the Sui blockchain.
ObjectReference
Reference to an object
ObjectReferenceWithOwner
An object reference with owner information
PasskeyAuthenticator
A passkey authenticator.
PasskeyPublicKey
Public key of a PasskeyAuthenticator.
PersonalMessage
ProgrammableTransaction
A user transaction
Publish
Command to publish a new move package
RandomnessStateUpdate
Randomness update
Secp256k1PublicKey
A secp256k1 public key.
Secp256k1Signature
A secp256k1 signature.
Secp256r1PublicKey
A secp256r1 public key.
Secp256r1Signature
A secp256r1 signature.
SignedCheckpointSummary
SignedTransaction
SplitCoins
Command to split a single coin object into multiple coins
StructTag
Type information for a move struct
SystemPackage
System package
Transaction
A transaction
TransactionDigest
TransactionEffectsDigest
TransactionEffectsV1
Version 1 of TransactionEffects
TransactionEffectsV2
Version 2 of TransactionEffects
TransactionEvents
Events emitted during the successful execution of a transaction
TransactionEventsDigest
TransferObjects
Command to transfer ownership of a set of objects to an address
TypeOrigin
Identifies a struct and the module it was defined in
TypeParseError
UnchangedSharedObject
A shared object that wasn’t changed during execution
Upgrade
Command to upgrade an already published package
UpgradeInfo
Upgraded package info for the linkage table
ValidatorAggregatedSignature
An aggregated signature from multiple Validators.
ValidatorCommittee
The Validator Set for a particular epoch.
ValidatorCommitteeMember
A member of a Validator Committee
ValidatorSignature
A signature from a Validator
VersionAssignment
Object version assignment from consensus
ZkLoginAuthenticator
A zklogin authenticator
ZkLoginClaim
A claim of the iss in a zklogin proof
ZkLoginInputs
A zklogin groth16 proof and the required inputs to perform proof verification.
ZkLoginProof
A zklogin groth16 proof
ZkLoginPublicIdentifier
Public Key equivalent for Zklogin authenticators

Enums§

Argument
An argument to a programmable transaction command
CheckpointCommitment
A commitment made by a checkpoint.
Command
A single command in a programmable transaction.
CommandArgumentError
An error with an argument to a command
ConsensusDeterminedVersionAssignments
Version assignments performed by consensus
EndOfEpochTransactionKind
Operation run at the end of an epoch
ExecutionError
An error that can occur during the execution of a transaction
ExecutionStatus
The status of an executed Transaction
IdOperation
Defines what happened to an ObjectId during execution
Input
An input to a user transaction
IntentAppId
Byte signifying the application id of an Intent
IntentScope
Byte signifying the scope of an Intent
IntentVersion
Byte signifying the version of an Intent
MultisigMemberPublicKey
Enum of valid public keys for multisig committee members
MultisigMemberSignature
A signature from a member of a multisig committee.
ObjectData
Object data, either a package or struct
ObjectIn
State of an object prior to execution
ObjectOut
State of an object after execution
ObjectType
Type of a Sui object
Owner
Enum of different types of ownership for an object.
PackageUpgradeError
An error with a upgrading a package
SignatureScheme
Flag use to disambiguate the signature schemes supported by Sui.
SimpleSignature
A basic signature
TransactionEffects
The output or effects of executing a transaction
TransactionExpiration
A TTL for a transaction
TransactionKind
Transaction type
TypeArgumentError
An error with a type argument
TypeTag
Type of a move value
UnchangedSharedKind
Type of unchanged shared object
UserSignature
A signature from a user

Type Aliases§

CheckpointSequenceNumber
CheckpointTimestamp
EpochId
ProtocolVersion
SigningDigest
StakeUnit
Version