Documentation
¶
Index ¶
- Variables
- func AnySliceToBytes(src []any) ([]byte, error)
- func BytesToAnySlice(b []byte) []any
- func ConvertBase64StringsToHex(data any) any
- func DecodeBCSPrimitive(deserializer *aptosBCS.Deserializer, primitiveType string) (any, error)
- func DecodeBCSVector(deserializer *aptosBCS.Deserializer, elementType string) (any, error)
- func DecodeJSONReturn(data any, target any) error
- func DecodeSuiJsonValue(data any, target any) error
- func DecodeSuiPrimative(bcsDecoder *aptosBCS.Deserializer, primativeType string) (any, error)
- func DecodeSuiStructToJSON(normalizedStructs map[string]any, identifier string, ...) (map[string]any, error)
- func DecodeVectorOfStructs(bcsDecoder *aptosBCS.Deserializer, vectorType string, ...) (any, error)
- func EncodeToSuiValue(typeName string, value any) (any, error)
- func IsSuiAddress(addr string) bool
- func NormalizeSuiAddress(address string) string
- func ToSuiAddress(address string) (string, error)
- func UnifiedTypeConverterHook(from, to reflect.Type, data any) (any, error)
- func UnwrapBCSPureBytes(pure []byte) ([]byte, error)
- type Any2SuiRampMessage
- type Any2SuiTokenTransfer
- type BCSPrimitiveHandler
- type BCSTypeConverter
- func (c *BCSTypeConverter) DecodePrimitive(deserializer *aptosBCS.Deserializer, primitiveType string) (any, error)
- func (c *BCSTypeConverter) DecodeVector(deserializer *aptosBCS.Deserializer, elementType string) (any, error)
- func (c *BCSTypeConverter) HasPrimitiveHandler(typeName string) bool
- func (c *BCSTypeConverter) HasVectorHandler(elementType string) bool
- func (c *BCSTypeConverter) RegisterPrimitive(typeName string, handler BCSPrimitiveHandler)
- func (c *BCSTypeConverter) RegisterVector(elementType string, handler BCSVectorHandler)
- type BCSVectorHandler
- type ConfigSet
- type ExecutionReport
- type ExecutionStateChanged
- type Object
- type PTBCommandDependency
- type PointerTag
- type RampMessageHeader
- type SourceChainConfig
- type SourceChainConfigSet
- type SuiFunctionParam
- type SuiPTBCommandType
- type TypeConversionFunc
- type TypeConverter
Constants ¶
This section is empty.
Variables ¶
var AccountZero = make([]byte, 32)
Functions ¶
func AnySliceToBytes ¶
AnySliceToBytes converts slice of interface{} to byte slice
func BytesToAnySlice ¶
func ConvertBase64StringsToHex ¶
ConvertBase64StringsToHex walks arbitrary JSON-like structures and converts any base64-encoded strings into 0x-prefixed hex strings, preserving []byte slices.
func DecodeBCSPrimitive ¶
func DecodeBCSPrimitive(deserializer *aptosBCS.Deserializer, primitiveType string) (any, error)
DecodeBCSPrimitive decodes a BCS primitive type using the default converter
func DecodeBCSVector ¶
func DecodeBCSVector(deserializer *aptosBCS.Deserializer, elementType string) (any, error)
DecodeBCSVector decodes a BCS vector type using the default converter
func DecodeJSONReturn ¶
DecodeJSONReturn decodes gRPC/JSON Move return values into the provided target.
func DecodeSuiJsonValue ¶
DecodeSuiJsonValue decodes Sui JSON response data into the provided target.
func DecodeSuiPrimative ¶
func DecodeSuiPrimative(bcsDecoder *aptosBCS.Deserializer, primativeType string) (any, error)
func DecodeSuiStructToJSON ¶
func DecodeSuiStructToJSON(normalizedStructs map[string]any, identifier string, bcsDecoder *aptosBCS.Deserializer) (map[string]any, error)
DecodeSuiStructToJSON decodes a Sui struct into a JSON object using the normalized struct and the result
func DecodeVectorOfStructs ¶
func DecodeVectorOfStructs(bcsDecoder *aptosBCS.Deserializer, vectorType string, normalizedStructs map[string]any) (any, error)
DecodeVectorOfStructs decodes a vector of structs from BCS bytes vectorType should be in format "vector<0xpackage::module::StructName>"
func IsSuiAddress ¶
IsSuiAddress returns true if addr is a valid Sui address/ObjectID. It is an improvement over the sui-go-sdk's IsValidSuiAddress function.
func NormalizeSuiAddress ¶
NormalizeSuiAddress normalizes a Sui address to 64 hex characters.
func ToSuiAddress ¶
ToSuiAddress normalizes and validates a Sui address. It pads the address to 64 hex characters (32 bytes) with leading zeros.
func UnifiedTypeConverterHook ¶
UnifiedTypeConverterHook is a mapstructure hook that uses the type converter registry
func UnwrapBCSPureBytes ¶
UnwrapBCSPureBytes decodes a BCS-encoded pure input value stored on-chain. Pure vector<u8> arguments are stored with a ULEB128 length prefix.
Types ¶
type Any2SuiRampMessage ¶
type Any2SuiRampMessage struct {
Header RampMessageHeader
Sender []byte
Data []byte
Receiver models.SuiAddress
GasLimit *big.Int
TokenReceiver models.SuiAddressBytes
TokenAmounts []Any2SuiTokenTransfer
}
Any2SuiRampMessage event data
type Any2SuiTokenTransfer ¶
type Any2SuiTokenTransfer struct {
SourcePoolAddress []byte
DestTokenAddress models.SuiAddress
DestGasAmount uint32
ExtraData []byte
Amount *big.Int
}
Any2SuiTokenTransfer event data
type BCSPrimitiveHandler ¶
type BCSPrimitiveHandler func(*aptosBCS.Deserializer) (any, error)
BCSPrimitiveHandler defines a function that reads a primitive type from a BCS deserializer
type BCSTypeConverter ¶
type BCSTypeConverter struct {
// contains filtered or unexported fields
}
BCSTypeConverter provides a registry-based approach to converting BCS types to JSON-compatible values
func NewBCSTypeConverter ¶
func NewBCSTypeConverter() *BCSTypeConverter
NewBCSTypeConverter creates a new BCS type converter with all standard Sui types registered
func (*BCSTypeConverter) DecodePrimitive ¶
func (c *BCSTypeConverter) DecodePrimitive(deserializer *aptosBCS.Deserializer, primitiveType string) (any, error)
DecodePrimitive decodes a primitive type using the registered handler
func (*BCSTypeConverter) DecodeVector ¶
func (c *BCSTypeConverter) DecodeVector(deserializer *aptosBCS.Deserializer, elementType string) (any, error)
DecodeVector decodes a vector type using the registered handler
func (*BCSTypeConverter) HasPrimitiveHandler ¶
func (c *BCSTypeConverter) HasPrimitiveHandler(typeName string) bool
HasPrimitiveHandler checks if a primitive type handler is registered
func (*BCSTypeConverter) HasVectorHandler ¶
func (c *BCSTypeConverter) HasVectorHandler(elementType string) bool
HasVectorHandler checks if a vector type handler is registered
func (*BCSTypeConverter) RegisterPrimitive ¶
func (c *BCSTypeConverter) RegisterPrimitive(typeName string, handler BCSPrimitiveHandler)
RegisterPrimitive registers a handler for a primitive type
func (*BCSTypeConverter) RegisterVector ¶
func (c *BCSTypeConverter) RegisterVector(elementType string, handler BCSVectorHandler)
RegisterVector registers a handler for a vector type
type BCSVectorHandler ¶
type BCSVectorHandler func(*aptosBCS.Deserializer, uint64) (any, error)
BCSVectorHandler defines a function that reads a vector type from a BCS deserializer
type ConfigSet ¶
type ConfigSet struct {
OcrPluginType byte
ConfigDigest []byte
Signers [][]byte
// this is a list of addresses, we can treat them as strings
Transmitters []string
BigF byte
}
OCRConfigSet event data
type ExecutionReport ¶
type ExecutionReport struct {
SourceChainSelector uint64
Message Any2SuiRampMessage
OffchainTokenData [][]byte
Proofs [][]byte
}
ExecutionReport event data
func DeserializeExecutionReport ¶
func DeserializeExecutionReport(data []byte) (*ExecutionReport, error)
func DeserializeExecutionReportFromPure ¶
func DeserializeExecutionReportFromPure(pure []byte) (*ExecutionReport, error)
DeserializeExecutionReportFromPure deserializes an execution report from a BCS-encoded pure input containing vector<u8>.
type ExecutionStateChanged ¶
type ExecutionStateChanged struct {
SourceChainSelector uint64 `json:"source_chain_selector"`
SequenceNumber uint64 `json:"sequence_number"`
MessageId []byte `json:"message_id"`
MessageHash []byte `json:"message_hash"`
State byte `json:"state"`
}
ExecutionStateChanged event data
type Object ¶
type Object struct {
Id string
}
Object represents a Sui object with its ID and optional initial shared version.
type PTBCommandDependency ¶
type PointerTag ¶
type PointerTag struct {
// Module name containing the pointer object (e.g. "state_object", "offramp", "counter")
Module string `json:"module"`
// PointerName is the object type to search for (e.g. "CCIPObjectRefPointer", "OffRampStatePointer")
PointerName string `json:"pointerName"`
// FieldName is OPTIONAL and NOT USED by the implementation. The parent field name is automatically
// looked up from the global common.PointerConfigs registry based on the PointerName.
// This field exists for backward compatibility or future implementations to override static code but is currently ignored.
FieldName string `json:"fieldName,omitempty"`
// DerivationKey is the key used to derive the child object ID from the parent object ID (e.g. "CCIPObjectRef", "CCIP_OWNABLE")
DerivationKey string `json:"derivationKey"`
// PackageID is the package ID for the Pointer object if it differs from the calling contract's package ID
// This is used for cross-package pointer dependencies (e.g. offramp package depending on CCIP package CCIPObjectRef)
// If empty, the calling contract's package ID is used
PackageID string `json:"packageId,omitempty"`
}
PointerTag defines the structured format for pointer tags used in chain reader. Pointer tags specify how to derive object IDs from pointer objects stored on-chain.
func (PointerTag) Validate ¶
func (p PointerTag) Validate() error
type RampMessageHeader ¶
type RampMessageHeader struct {
MessageID []byte
SourceChainSelector uint64
DestChainSelector uint64
SequenceNumber uint64
Nonce uint64
}
RampMessageHeader event data
type SourceChainConfig ¶
type SourceChainConfig struct {
Router string
IsEnabled bool
MinSeqNr uint64
IsRMNVerificationDisabled bool
OnRamp []byte
}
SourceChainConfig event data
type SourceChainConfigSet ¶
type SourceChainConfigSet struct {
SourceChainSelector uint64
SourceChainConfig SourceChainConfig
}
SourceChainConfigSet event data
type SuiFunctionParam ¶
type SuiFunctionParam struct {
// Name of the parameter
Name string
// PointerTag (optional) specify how to derive object IDs from pointer objects stored on-chain.
PointerTag *PointerTag
// Type of the parameter (e.g., "u64", "String", "vector<u8>", "ptb_dependency")
Type string
// IsMutable specifies if the object is mutable or not (optional - defaults to true)
IsMutable *bool
// IsGeneric specifies if the parameter is a generic argument
GenericType *string
// Whether the parameter is required
Required bool
// Default value to use if not provided
DefaultValue any
// Result from a previous PTB Command (optional). It is used for expressive construction of PTB commands
PTBDependency *PTBCommandDependency
// GenericDependency maps to internal helpers for fetching an unknown generic type required by the parameter
GenericDependency *string
}
SuiFunctionParam defines a parameter for a Sui function call
type SuiPTBCommandType ¶
type SuiPTBCommandType string
const ( SuiPTBCommandMoveCall SuiPTBCommandType = "move_call" SuiPTBCommandPublish SuiPTBCommandType = "publish" SuiPTBCommandTransfer SuiPTBCommandType = "transfer" )
type TypeConversionFunc ¶
TypeConversionFunc defines a function that converts data from one type to another
type TypeConverter ¶
type TypeConverter struct {
// contains filtered or unexported fields
}
TypeConverter provides a registry approach to type conversions for mapstructure
func NewTypeConverter ¶
func NewTypeConverter() *TypeConverter
NewTypeConverter creates a new type converter with all standard conversions registered
func (*TypeConverter) RegisterConverter ¶
func (tc *TypeConverter) RegisterConverter(key string, fn TypeConversionFunc)
RegisterConverter registers a conversion function with a unique key