Documentation ¶
Index ¶
- Variables
- func ConvertToBytes(input string, encoding string) ([]byte, error)
- func ConvertToVector(input interface{}, encoding string) ([]byte, error)
- type AccountAddress
- type AccountInfo
- type Address
- type AddressTag
- type Bool
- type BoolTag
- type Bytes
- type FunctionCall
- type FunctionId
- type Identifier
- type L1Block
- type L1Transaction
- type LedgerTransaction
- type LedgerTxData
- type LedgerTxDataImpl
- type LedgerTxDataVariant
- type ModuleBundle
- type ModuleId
- type MoveAction
- type MoveActionImpl
- type MoveActionUnknown
- type MoveActionVariant
- type MultiChainIDVariant
- type ObjectID
- type RoochAddress
- type RoochTransaction
- type ScriptCall
- type SignerTag
- type StructTag
- type Transaction
- type TransactionData
- type TransactionExecutionInfo
- type TransactionSequenceInfo
- type TransactionWithInfo
- type TypeTag
- type TypeTagImpl
- type TypeTagVariant
- type U128
- type U128Tag
- type U16
- type U16Tag
- type U256
- type U256Tag
- type U32
- type U32Tag
- type U64
- type U64Tag
- type U8
- type U8Tag
- type VectorTag
Constants ¶
This section is empty.
Variables ¶
var AddressFour = address.AddressFour
AddressFour represents the 0x4 address
var AddressOne = address.AddressOne
AddressOne represents the 0x1 address
var AddressThree = address.AddressThree
AddressThree represents the 0x3 address
var AddressTwo = address.AddressTwo
AddressTwo represents the 0x2 address
var AddressZero = address.AddressZero
AccountZero represents the 0x0 address
var EmptyBytes = make([]byte, 0)
EmptyBytes represents an empty byte slice
var RGasTypeTag = TypeTag{&StructTag{ Address: AddressThree, Module: "gas_coin", Name: "RGas", }}
RGasTypeTag is the TypeTag for 0x1::gas_coin::RGas
Functions ¶
func ConvertToVector ¶
Types ¶
type AccountAddress ¶
type AccountAddress = address.AccountAddress
AccountAddress is a 32 byte address on the Rooch blockchain It can represent an Object, an Account, and much more.
type AccountInfo ¶
type AccountInfo struct { SequenceNumberStr string `json:"sequence_number"` AuthenticationKeyHex string `json:"authentication_key"` }
AccountInfo is returned from calls to #Account()
func (AccountInfo) AuthenticationKey ¶
func (ai AccountInfo) AuthenticationKey() ([]byte, error)
AuthenticationKey Hex decode of AuthenticationKeyHex
func (AccountInfo) SequenceNumber ¶
func (ai AccountInfo) SequenceNumber() (uint64, error)
SequenceNumber ParseUint of SequenceNumberStr
type Address ¶
type Address interface{} // Can be string, *address.Address, or []byte
ObjectID string
type AddressTag ¶
type AddressTag struct{}
AddressTag represents the address type in Move
func (*AddressTag) GetType ¶
func (xt *AddressTag) GetType() TypeTagVariant
func (*AddressTag) MarshalBCS ¶
func (xt *AddressTag) MarshalBCS(_ *bcs.Serializer)
func (*AddressTag) String ¶
func (xt *AddressTag) String() string
func (*AddressTag) UnmarshalBCS ¶
func (xt *AddressTag) UnmarshalBCS(_ *bcs.Deserializer)
type BoolTag ¶
type BoolTag struct{}
BoolTag represents the bool type in Move
func (*BoolTag) GetType ¶
func (xt *BoolTag) GetType() TypeTagVariant
func (*BoolTag) MarshalBCS ¶
func (xt *BoolTag) MarshalBCS(_ *bcs.Serializer)
func (*BoolTag) UnmarshalBCS ¶
func (xt *BoolTag) UnmarshalBCS(_ *bcs.Deserializer)
type FunctionCall ¶
type FunctionCall struct { FunctionId FunctionId `json:"function_id"` TypeArgs []TypeTag `json:"ty_args"` Args [][]byte `json:"args"` }
func (*FunctionCall) MarshalBCS ¶
func (fc *FunctionCall) MarshalBCS(ser *bcs.Serializer)
func (*FunctionCall) MoveActionType ¶
func (fc *FunctionCall) MoveActionType() MoveActionVariant
func (*FunctionCall) UnmarshalBCS ¶
func (fc *FunctionCall) UnmarshalBCS(des *bcs.Deserializer)
type FunctionId ¶
type FunctionId struct { ModuleId ModuleId `json:"module_id"` FunctionName Identifier `json:"function_name"` }
func (*FunctionId) MarshalBCS ¶
func (fi *FunctionId) MarshalBCS(ser *bcs.Serializer)
func (*FunctionId) UnmarshalBCS ¶
func (fi *FunctionId) UnmarshalBCS(des *bcs.Deserializer)
type Identifier ¶
type Identifier string
type L1Block ¶
type L1Block struct { ChainId MultiChainIDVariant `json:"chain_id"` BlockHeight uint64 `json:"block_height"` BlockHash []byte `json:"block_hash"` }
func (*L1Block) LedgerTxDataType ¶
func (lb *L1Block) LedgerTxDataType() LedgerTxDataVariant
func (*L1Block) MarshalBCS ¶
func (lb *L1Block) MarshalBCS(ser *bcs.Serializer)
func (*L1Block) UnmarshalBCS ¶
func (lb *L1Block) UnmarshalBCS(des *bcs.Deserializer)
type L1Transaction ¶
type L1Transaction struct { ChainId MultiChainIDVariant `json:"chain_id"` BlockHash []byte `json:"block_hash"` TxID []byte `json:"txid"` }
func (*L1Transaction) LedgerTxDataType ¶
func (lt *L1Transaction) LedgerTxDataType() LedgerTxDataVariant
func (*L1Transaction) MarshalBCS ¶
func (lt *L1Transaction) MarshalBCS(ser *bcs.Serializer)
func (*L1Transaction) UnmarshalBCS ¶
func (lt *L1Transaction) UnmarshalBCS(des *bcs.Deserializer)
type LedgerTransaction ¶
type LedgerTransaction struct {
// contains filtered or unexported fields
}
type LedgerTxData ¶
type LedgerTxData struct { //Payload TransactionPayloadImpl //Variant LedgerTxDataVariant `json:"variant"` TxData LedgerTxDataImpl `json:"tx_data"` }
TransactionPayload the actual instructions of which functions to call on chain
func (*LedgerTxData) MarshalBCS ¶
func (ltd *LedgerTxData) MarshalBCS(ser *bcs.Serializer)
func (*LedgerTxData) UnmarshalBCS ¶
func (ltd *LedgerTxData) UnmarshalBCS(des *bcs.Deserializer)
type LedgerTxDataImpl ¶
type LedgerTxDataImpl interface { bcs.Struct LedgerTxDataType() LedgerTxDataVariant // This is specifically to ensure that wrong types don't end up here }
type LedgerTxDataVariant ¶
type LedgerTxDataVariant uint32
const ( LedgerTxDataVariantL1Block LedgerTxDataVariant = 0 LedgerTxDataVariantL1Tx LedgerTxDataVariant = 1 // Deprecated LedgerTxDataVariantL2Tx LedgerTxDataVariant = 2 )
type ModuleBundle ¶
type ModuleBundle struct {
Value [][]byte `json:"value"`
}
ModuleBundle is long deprecated and no longer used, but exist as an enum position in TransactionPayload
func (*ModuleBundle) MarshalBCS ¶
func (mb *ModuleBundle) MarshalBCS(ser *bcs.Serializer)
func (*ModuleBundle) MoveActionType ¶
func (mb *ModuleBundle) MoveActionType() MoveActionVariant
func (*ModuleBundle) UnmarshalBCS ¶
func (mb *ModuleBundle) UnmarshalBCS(des *bcs.Deserializer)
type ModuleId ¶
type ModuleId struct { Address RoochAddress Name string }
ModuleId the identifier for a module e.g. 0x1::coin
func (*ModuleId) MarshalBCS ¶
func (mod *ModuleId) MarshalBCS(ser *bcs.Serializer)
func (*ModuleId) UnmarshalBCS ¶
func (mod *ModuleId) UnmarshalBCS(des *bcs.Deserializer)
type MoveAction ¶
type MoveAction struct { //Payload TransactionPayloadImpl //Variant MoveActionVariant `json:"variant"` //Action MoveActionImpl `json:"action"` Action MoveActionImpl }
TransactionPayload the actual instructions of which functions to call on chain
func (*MoveAction) MarshalBCS ¶
func (ma *MoveAction) MarshalBCS(ser *bcs.Serializer)
func (*MoveAction) UnmarshalBCS ¶
func (ma *MoveAction) UnmarshalBCS(des *bcs.Deserializer)
type MoveActionImpl ¶
type MoveActionImpl interface { bcs.Struct MoveActionType() MoveActionVariant // This is specifically to ensure that wrong types don't end up here }
type MoveActionUnknown ¶
type MoveActionUnknown struct { Variant uint32 `json:"variant"` // Variant is the actual type field from the JSON. Action map[string]any `json:"action"` // Action is the raw JSON payload. }
This is a fallback type for unknown move action.
type MoveActionVariant ¶
type MoveActionVariant uint32
const ( MoveActionVariantScript MoveActionVariant = iota MoveActionVariantFunction // Deprecated MoveActionVariantModuleBundle )
type MultiChainIDVariant ¶
type MultiChainIDVariant uint64
const ( MultiChainIDVariantBitcoin MultiChainIDVariant = 0 MultiChainIDVariantEther MultiChainIDVariant = 60 // Deprecated MultiChainIDVariantSui MultiChainIDVariant = 784 MultiChainIDVariantNostr MultiChainIDVariant = 1237 MultiChainIDVariantRooch MultiChainIDVariant = 20230101 )
type ObjectID ¶
type ObjectID struct {
Address []RoochAddress
}
func ConvertObjectID ¶
ConvertObjectID handles the input
func NewObjectID ¶
func NewObjectID(address []RoochAddress) ObjectID
func StructTagToObjectID ¶
structTagToObjectID converts a StructTag to an object ID
func (*ObjectID) MarshalBCS ¶
func (o *ObjectID) MarshalBCS(ser *bcs.Serializer)
func (*ObjectID) String ¶
Join handles the output transformation (equivalent to transform.output in JS)
func (*ObjectID) UnmarshalBCS ¶
func (o *ObjectID) UnmarshalBCS(des *bcs.Deserializer)
type RoochAddress ¶
type RoochAddress = address.RoochAddress
type RoochTransaction ¶
type RoochTransaction struct { Data TransactionData `json:"data"` Authenticator crypto.Authenticator `json:"authenticator"` DataHash string `json:"data_hash,omitempty"` }
func (*RoochTransaction) LedgerTxDataType ¶
func (rt *RoochTransaction) LedgerTxDataType() LedgerTxDataVariant
func (*RoochTransaction) MarshalBCS ¶
func (rt *RoochTransaction) MarshalBCS(ser *bcs.Serializer)
func (*RoochTransaction) UnmarshalBCS ¶
func (rt *RoochTransaction) UnmarshalBCS(des *bcs.Deserializer)
type ScriptCall ¶
type ScriptCall struct { Code []byte `json:"code"` TyArgs []TypeTag `json:"ty_args"` Args [][]byte `json:"args"` }
func (*ScriptCall) MarshalBCS ¶
func (sc *ScriptCall) MarshalBCS(ser *bcs.Serializer)
func (*ScriptCall) MoveActionType ¶
func (sc *ScriptCall) MoveActionType() MoveActionVariant
func (*ScriptCall) UnmarshalBCS ¶
func (sc *ScriptCall) UnmarshalBCS(des *bcs.Deserializer)
type SignerTag ¶
type SignerTag struct{}
SignerTag represents the signer type in Move
func (*SignerTag) GetType ¶
func (xt *SignerTag) GetType() TypeTagVariant
func (*SignerTag) MarshalBCS ¶
func (xt *SignerTag) MarshalBCS(_ *bcs.Serializer)
func (*SignerTag) UnmarshalBCS ¶
func (xt *SignerTag) UnmarshalBCS(_ *bcs.Deserializer)
type StructTag ¶
type StructTag struct { Address RoochAddress // Address is the address of the module //Address string // Address is the address of the module Module string // Module is the name of the module Name string // Name is the name of the struct TypeParams []TypeTag // TypeParams are the TypeTags of the type parameters }
StructTag represents an on-chain struct of the form address::module::name<T1,T2,...> and each T is a TypeTag
func NewObjectTag ¶
func NewObjectTag(inner TypeTagImpl) *StructTag
NewObjectTag creates a 0x1::object::Object TypeTag based on an inner type
func NewOptionTag ¶
func NewOptionTag(inner TypeTagImpl) *StructTag
NewOptionTag creates a 0x1::option::Option TypeTag based on an inner type
func NewStringTag ¶
func NewStringTag() *StructTag
NewStringTag creates a TypeTag for 0x1::string::String
func TypeTagAsStructTag ¶
TypeTagAsStructTag converts a TypeTag to StructTag
func (*StructTag) GetType ¶
func (xt *StructTag) GetType() TypeTagVariant
func (*StructTag) MarshalBCS ¶
func (xt *StructTag) MarshalBCS(ser *bcs.Serializer)
func (*StructTag) String ¶
String outputs to the form address::module::name<type1, type2> e.g. 0x1::string::String or 0x42::my_mod::MultiType<u8,0x1::string::String>
func (*StructTag) ToCanonicalString ¶
String outputs to the form address::module::name<type1, type2> e.g. 0x1::string::String or 0x42::my_mod::MultiType<u8,0x1::string::String>
func (*StructTag) UnmarshalBCS ¶
func (xt *StructTag) UnmarshalBCS(des *bcs.Deserializer)
type Transaction ¶
type Transaction struct { Data TransactionData `json:"data"` //Data crypto.TransactionData `json:"data"` Authenticator crypto.Authenticator `json:"authenticator"` Info string `json:"info"` }
func (*Transaction) GetData ¶
func (t *Transaction) GetData() crypto.TransactionData
getData returns the transaction data after validation
func (*Transaction) GetInfo ¶
func (t *Transaction) GetInfo() *string
GetInfo returns the transaction info
func (*Transaction) HashData ¶
func (t *Transaction) HashData() ([]byte, error)
HashData returns the hash of the transaction data
func (*Transaction) MarshalBCS ¶
func (t *Transaction) MarshalBCS(ser *bcs.Serializer)
func (*Transaction) UnmarshalBCS ¶
func (t *Transaction) UnmarshalBCS(des *bcs.Deserializer)
type TransactionData ¶
type TransactionData struct { Sender RoochAddress `json:"sender"` SequenceNumber uint64 `json:"sequence_number"` ChainId uint64 `json:"chain_id"` MaxGasAmount uint64 `json:"max_gas_amount"` Action MoveAction `json:"action"` }
func (*TransactionData) Hash ¶
func (rd *TransactionData) Hash() ([]byte, error)
func (*TransactionData) MarshalBCS ¶
func (rd *TransactionData) MarshalBCS(ser *bcs.Serializer)
func (*TransactionData) UnmarshalBCS ¶
func (rd *TransactionData) UnmarshalBCS(des *bcs.Deserializer)
type TransactionExecutionInfo ¶
type TransactionExecutionInfo struct { TxHash string `json:"tx_hash"` StateRoot string `json:"state_root"` Size uint64 `json:"size"` EventRoot string `json:"event_root"` GasUsed uint64 `json:"gas_used"` /// The vm status. If it is not `Executed`, this will provide the general error class. Execution /// failures and Move abort's receive more detailed information. But other errors are generally /// categorized with no status code or other information //pub status: KeptVMStatus, //Status string `json:"status"` Status json.RawMessage `json:"status"` }
type TransactionSequenceInfo ¶
type TransactionSequenceInfo struct { TxOrder uint64 `json:"tx_order"` TxOrderSignature []byte `json:"tx_order_signature"` TxAccumulatorRoot string `json:"tx_accumulator_root"` TxTimestamp uint64 `json:"tx_timestamp"` TxAccumulatorFrozenSubtreeRoots []string `json:"tx_accumulator_frozen_subtree_roots"` TxAccumulatorNumLeaves uint64 `json:"tx_accumulator_num_leaves"` TxAccumulatorNumNodes uint64 `json:"tx_accumulator_num_nodes"` }
type TransactionWithInfo ¶
type TransactionWithInfo struct { Transaction LedgerTransaction `json:"transaction"` // contains filtered or unexported fields }
type TypeTag ¶
type TypeTag struct {
Value TypeTagImpl
}
TypeTag is a wrapper around a TypeTagImpl e.g. BoolTag or U8Tag for the purpose of serialization and deserialization Implements:
func NewTypeTag ¶
func NewTypeTag(inner TypeTagImpl) TypeTag
NewTypeTag wraps a TypeTagImpl in a TypeTag
func TypeTagFromStructTag ¶
Convert StructTag to TypeTag
func (*TypeTag) GetType ¶
func (tt *TypeTag) GetType() TypeTagVariant
String gives the canonical TypeTag string value used in Move
func (*TypeTag) MarshalBCS ¶
func (tt *TypeTag) MarshalBCS(ser *bcs.Serializer)
MarshalBCS serializes the TypeTag to bytes
Implements:
func (*TypeTag) UnmarshalBCS ¶
func (tt *TypeTag) UnmarshalBCS(des *bcs.Deserializer)
UnmarshalBCS deserializes the TypeTag from bytes
Implements:
type TypeTagImpl ¶
type TypeTagImpl interface { bcs.Struct // GetType returns the TypeTagVariant for this [TypeTag] GetType() TypeTagVariant // String returns the canonical Move string representation of this [TypeTag] String() string }
TypeTagImpl is an interface describing all the different types of TypeTag. Unfortunately because of how serialization works, a wrapper TypeTag struct is needed to handle the differentiation between types
type TypeTagVariant ¶
type TypeTagVariant uint32
TypeTagVariant is an enum representing the different types of TypeTag
const ( TypeTagBool TypeTagVariant = 0 // Represents the bool type in Move BoolTag TypeTagU8 TypeTagVariant = 1 // Represents the u8 type in Move U8Tag TypeTagU64 TypeTagVariant = 2 // Represents the u64 type in Move U64Tag TypeTagU128 TypeTagVariant = 3 // Represents the u128 type in Move U128Tag TypeTagAddress TypeTagVariant = 4 // Represents the address type in Move AddressTag TypeTagSigner TypeTagVariant = 5 // Represents the signer type in Move SignerTag TypeTagVector TypeTagVariant = 6 // Represents the vector type in Move VectorTag TypeTagStruct TypeTagVariant = 7 // Represents the struct type in Move StructTag TypeTagU16 TypeTagVariant = 8 // Represents the u16 type in Move U16Tag TypeTagU32 TypeTagVariant = 9 // Represents the u32 type in Move U32Tag TypeTagU256 TypeTagVariant = 10 // Represents the u256 type in Move U256Tag )
type U128Tag ¶
type U128Tag struct{}
U128Tag represents the u128 type in Move
func (*U128Tag) GetType ¶
func (xt *U128Tag) GetType() TypeTagVariant
func (*U128Tag) MarshalBCS ¶
func (xt *U128Tag) MarshalBCS(_ *bcs.Serializer)
func (*U128Tag) UnmarshalBCS ¶
func (xt *U128Tag) UnmarshalBCS(_ *bcs.Deserializer)
type U16Tag ¶
type U16Tag struct{}
U16Tag represents the u16 type in Move
func (*U16Tag) GetType ¶
func (xt *U16Tag) GetType() TypeTagVariant
func (*U16Tag) MarshalBCS ¶
func (xt *U16Tag) MarshalBCS(_ *bcs.Serializer)
func (*U16Tag) UnmarshalBCS ¶
func (xt *U16Tag) UnmarshalBCS(_ *bcs.Deserializer)
type U256Tag ¶
type U256Tag struct{}
U256Tag represents the u256 type in Move
func (*U256Tag) GetType ¶
func (xt *U256Tag) GetType() TypeTagVariant
func (*U256Tag) MarshalBCS ¶
func (xt *U256Tag) MarshalBCS(_ *bcs.Serializer)
func (*U256Tag) UnmarshalBCS ¶
func (xt *U256Tag) UnmarshalBCS(_ *bcs.Deserializer)
type U32Tag ¶
type U32Tag struct{}
U32Tag represents the u32 type in Move
func (*U32Tag) GetType ¶
func (xt *U32Tag) GetType() TypeTagVariant
func (*U32Tag) MarshalBCS ¶
func (xt *U32Tag) MarshalBCS(_ *bcs.Serializer)
func (*U32Tag) UnmarshalBCS ¶
func (xt *U32Tag) UnmarshalBCS(_ *bcs.Deserializer)
type U64Tag ¶
type U64Tag struct{}
U64Tag represents the u64 type in Move
func (*U64Tag) GetType ¶
func (xt *U64Tag) GetType() TypeTagVariant
func (*U64Tag) MarshalBCS ¶
func (xt *U64Tag) MarshalBCS(_ *bcs.Serializer)
func (*U64Tag) UnmarshalBCS ¶
func (xt *U64Tag) UnmarshalBCS(_ *bcs.Deserializer)
type U8Tag ¶
type U8Tag struct{}
U8Tag represents the u8 type in Move
func (*U8Tag) GetType ¶
func (xt *U8Tag) GetType() TypeTagVariant
func (*U8Tag) MarshalBCS ¶
func (xt *U8Tag) MarshalBCS(_ *bcs.Serializer)
func (*U8Tag) UnmarshalBCS ¶
func (xt *U8Tag) UnmarshalBCS(_ *bcs.Deserializer)
type VectorTag ¶
type VectorTag struct {
TypeParam TypeTag // TypeParam is the type of the elements in the vector
}
VectorTag represents the vector<T> type in Move, where T is another TypeTag
func NewVectorTag ¶
func NewVectorTag(inner TypeTagImpl) *VectorTag
NewVectorTag creates a TypeTag for vector<inner>
func (*VectorTag) GetType ¶
func (xt *VectorTag) GetType() TypeTagVariant
func (*VectorTag) MarshalBCS ¶
func (xt *VectorTag) MarshalBCS(ser *bcs.Serializer)
func (*VectorTag) UnmarshalBCS ¶
func (xt *VectorTag) UnmarshalBCS(des *bcs.Deserializer)