Documentation ¶
Index ¶
- Variables
- func ConverRawMessageToBytes(inputs []json.RawMessage) [][]byte
- func NewAptosNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
- type AptosBlock
- type AptosBlockLit
- type AptosEd25519Signature
- type AptosFeePayerSignature
- type AptosLedgerInfoLit
- type AptosMultiAgentSignature
- type AptosMultiEd25519Signature
- type AptosMultiKeySignature
- type AptosPublicKey
- type AptosQuantity
- type AptosSignature
- type AptosSingleKeySignature
- type AptosSingleSignature
- type AptosTransactionInfo
- type BlockMetadataTransaction
- type DeleteModuleChange
- type DeleteResourceChange
- type DeleteTableItemChange
- type DeleteTableItemData
- type DirectWriteSet
- type EntryFunctionPayload
- type Event
- type EventGuid
- type GenericType
- type GenesisTransaction
- type GenesisTransactionPayload
- type ModuleBundlePayload
- type MoveFunction
- type MoveFunctionGenericTypeParam
- type MoveModule
- type MoveModuleBytecode
- type MoveScriptBytecode
- type MoveStruct
- type MoveStructField
- type MoveStructGenericTypeParam
- type MultisigPayload
- type ScriptPayload
- type ScriptWriteSet
- type StateCheckpointTransaction
- type UserTransaction
- type ValidatorTransaction
- type WriteModuleChange
- type WriteResourceChange
- type WriteResourceChangeData
- type WriteSetPayload
- type WriteTableItemChange
- type WriteTableItemChangeData
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Options( internal.NewParserBuilder("aptos", NewAptosNativeParser). Build(), )
Functions ¶
func ConverRawMessageToBytes ¶
func ConverRawMessageToBytes(inputs []json.RawMessage) [][]byte
func NewAptosNativeParser ¶
func NewAptosNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
Types ¶
type AptosBlock ¶
type AptosBlock struct { BlockHeight AptosQuantity `json:"block_height"` BlockHash string `json:"block_hash" validate:"required"` BlockTime AptosQuantity `json:"block_timestamp"` FirstVersion AptosQuantity `json:"first_version"` LastVersion AptosQuantity `json:"last_version"` Transactions []json.RawMessage `json:"transactions"` }
A block includes a small header and array of transactions.
type AptosBlockLit ¶
type AptosBlockLit struct { BlockHeight string `json:"block_height"` // A string containing a 64-bit unsigned integer BlockHash string `json:"block_hash" validate:"required"` BlockTime string `json:"block_timestamp" validate:"required"` // A string containing a 64-bit unsigned integer FirstVersion string `json:"first_version" validate:"required"` // A string containing a 64-bit unsigned integer LastVersion string `json:"last_version" validate:"required"` // A string containing a 64-bit unsigned integer }
An example: "block_height": "100", "block_hash": "0xa01474f8b0a1d9341ace5dfa74d949df19819d831964161fb73794345c340c6c", "block_timestamp": "1665609849500427", "first_version": "198", "last_version": "199",
type AptosEd25519Signature ¶
type AptosEd25519Signature struct { PublicKey AptosPublicKey `json:"public_key"` Signature AptosSignature `json:"signature"` }
A single Ed25519 signature
type AptosFeePayerSignature ¶
type AptosFeePayerSignature struct { // Need to be parsed into AptosEd25519Signature/AptosMultiEd25519Signature Sender json.RawMessage `json:"sender"` // The other involved parties' addresses SecondarySignerAddresses []string `json:"secondary_signer_addresses"` // Need to be parsed into multiple AptosEd25519Signature/AptosMultiEd25519Signature // The associated signatures, in the same order as the secondary addresses SecondarySigners []json.RawMessage `json:"secondary_signers"` // The address of the paying party FeePayerAddress string `json:"fee_payer_address"` // The signature of the fee payer FeePayerSigner json.RawMessage `json:"fee_payer_signer"` }
type AptosLedgerInfoLit ¶
type AptosLedgerInfoLit struct { ChainID int `json:"chain_id"` Epoch string `json:"epoch"` // A string containing a 64-bit unsigned integer OldestLedgerVersion string `json:"oldest_ledger_version"` // A string containing a 64-bit unsigned integer LedgerTimestamp string `json:"ledger_timestamp"` // A string containing a 64-bit unsigned integer NodeRole string `json:"node_role"` OldestBlockHeight string `json:"oldest_block_height"` // A string containing a 64-bit unsigned integer LatestBlockHeight string `json:"block_height"` // A string containing a 64-bit unsigned integer GitHash string `json:"git_hash,omitempty"` }
The successful response of getting ledger info. An example: "chain_id": 1, "epoch": "1925", "ledger_version": "105687020", "oldest_ledger_version": "0", "ledger_timestamp": "1679445180598692", "node_role": "full_node", "oldest_block_height": "0", "block_height": "40846989", "git_hash": "cc30c46ad41cd1577935466036eb1903b7cbc973"
type AptosMultiAgentSignature ¶
type AptosMultiAgentSignature struct { // Need to be parsed into AptosEd25519Signature/AptosMultiEd25519Signature Sender json.RawMessage `json:"sender"` // The other involved parties' addresses SecondarySignerAddresses []string `json:"secondary_signer_addresses"` // Need to be parsed into multiple AptosEd25519Signature/AptosMultiEd25519Signature // The associated signatures, in the same order as the secondary addresses SecondarySigners []json.RawMessage `json:"secondary_signers"` }
Multi agent signature for multi agent transactions. This allows you to have transactions across multiple accounts.
type AptosMultiEd25519Signature ¶
type AptosMultiEd25519Signature struct { PublicKeys []AptosPublicKey `json:"public_keys"` Signatures []AptosSignature `json:"signatures"` Threshold uint32 `json:"threshold"` Bitmap string `json:"bitmap"` }
A Ed25519 multi-sig signature. This allows k-of-n signing for a transaction
type AptosMultiKeySignature ¶
type AptosMultiKeySignature struct { PublicKeys []AptosPublicKey `json:"public_keys"` Signatures []AptosSignature `json:"signatures"` SignaturesRequired uint32 `json:"signatures_required"` }
Multi key signature for multi key transactions.
type AptosPublicKey ¶
func (*AptosPublicKey) UnmarshalJSON ¶
func (v *AptosPublicKey) UnmarshalJSON(input []byte) error
type AptosQuantity ¶
type AptosQuantity uint64
func (AptosQuantity) MarshalJSON ¶
func (v AptosQuantity) MarshalJSON() ([]byte, error)
func (*AptosQuantity) UnmarshalJSON ¶
func (v *AptosQuantity) UnmarshalJSON(input []byte) error
func (AptosQuantity) Value ¶
func (v AptosQuantity) Value() uint64
type AptosSignature ¶
func (*AptosSignature) UnmarshalJSON ¶
func (v *AptosSignature) UnmarshalJSON(input []byte) error
type AptosSingleKeySignature ¶
type AptosSingleKeySignature = AptosEd25519Signature
Single key signature for single key transactions.
type AptosSingleSignature ¶
type AptosSingleSignature = AptosEd25519Signature
type AptosTransactionInfo ¶
type AptosTransactionInfo struct { // The transaction type Type string `json:"type"` // The ledger version of the transaction. Version AptosQuantity `json:"version"` // The hash of this transaction. TransactionHash string `json:"hash"` // The root hash of Merkle Accumulator storing all events emitted during this transaction. EventRootHash string `json:"event_root_hash"` // The hash value summarizing all changes caused to the world state by this transaction. // i.e. hash of the output write set. StateChangeHash string `json:"state_change_hash"` // The root hash of the Sparse Merkle Tree describing the world state at the end of this // transaction. Depending on the protocol configuration, this can be generated periodical // only, like per block. StateCheckpointHash string `json:"state_checkpoint_hash,omitempty"` // The amount of gas used. GasUsed AptosQuantity `json:"gas_used"` // Whether the transaction was successful Success bool `json:"success"` // 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. VmStatus string `json:"vm_status"` // The accumulator root hash at this version. AccumulatorRootHash string `json:"accumulator_root_hash"` // Final state of resources changed by the transaction. Changes []json.RawMessage `json:"changes"` }
The shared transaction header info. Each transaction has this shared information.
type BlockMetadataTransaction ¶
type BlockMetadataTransaction struct { Id string `json:"id"` Epoch AptosQuantity `json:"epoch"` Round AptosQuantity `json:"round"` // The events emitted at the block creation. Events []Event `json:"events"` // Previous block votes. PreviousBlockVotesBitvec []uint8 `json:"previous_block_votes_bitvec"` Proposer string `json:"proposer"` // The indices of the proposers who failed to propose. FailedProposerIndices []uint32 `json:"failed_proposer_indices"` TimeStamp AptosQuantity `json:"timestamp"` }
The block metadata transaction
type DeleteModuleChange ¶
type DeleteModuleChange struct { Address string `json:"address"` StateKeyHash string `json:"state_key_hash"` Module string `json:"module"` }
Delete a module
type DeleteResourceChange ¶
type DeleteResourceChange struct { Address string `json:"address"` StateKeyHash string `json:"state_key_hash"` Resource string `json:"resource"` }
Delete a resource
type DeleteTableItemChange ¶
type DeleteTableItemChange struct { Handle string `json:"handle"` StateKeyHash string `json:"state_key_hash"` Key string `json:"key"` Data DeleteTableItemData `json:"data"` }
Delete a table item
type DeleteTableItemData ¶
type DirectWriteSet ¶
type DirectWriteSet struct { // Need to further parse Changes, depending different types. Changes []json.RawMessage `json:"changes"` Events []Event `json:"events"` }
type EntryFunctionPayload ¶
type EntryFunctionPayload struct { // Need to further decode to related proto AptosEntryFunctionId Function string `json:"function"` TypeArguments []string `json:"type_arguments"` Arguments []json.RawMessage `json:"arguments"` }
Payload which runs a single entry function
type Event ¶
type Event struct { // The globally unique identifier of this event stream. Guid EventGuid `json:"guid"` // The sequence number of the event. SequenceNumber AptosQuantity `json:"sequence_number"` // String representation of an on-chain Move type tag. Type string `json:"type"` // The JSON representation of the event. Data json.RawMessage `json:"data"` }
type EventGuid ¶
type EventGuid struct { CreationNumber AptosQuantity `json:"creation_number"` AccountAddress string `json:"account_address"` }
type GenericType ¶
type GenericType struct { // The transaction type Type string `json:"type"` }
There are multiple structures having multiple types. We need to first parse its type, then we know what other fields look like. This generic type is used to parse the specific "type" field.
type GenesisTransaction ¶
type GenesisTransaction struct { Payload GenesisTransactionPayload `json:"payload"` // Events generated by the transaction Events []Event `json:"events"` }
The genesis transaction. This only occurs at the genesis transaction (version 0).
type GenesisTransactionPayload ¶
type GenesisTransactionPayload struct { Type string `json:"type"` // Need to be parsed based on write set type: ScriptWriteSet and DirectWriteSet. WriteSet json.RawMessage `json:"write_set"` }
The write set payload of the Genesis transaction.
type ModuleBundlePayload ¶
type ModuleBundlePayload struct {
Modules []MoveModuleBytecode `json:"modules"`
}
type MoveFunction ¶
type MoveFunction struct { Name string `json:"name"` Visibility string `json:"visibility"` // Whether the function can be called as an entry function directly in a transaction IsEntry bool `json:"is_entry"` // Generic type params associated with the Move function GenericTypePramas []MoveFunctionGenericTypeParam `json:"generic_type_params"` // Parameters associated with the move function Params []string `json:"params"` // Return type of the function Return []string `json:"return"` }
type MoveFunctionGenericTypeParam ¶
type MoveFunctionGenericTypeParam struct {
Constraints []string `json:"constraints"`
}
type MoveModule ¶
type MoveModule struct { Address string `json:"address"` Name string `json:"name"` // Friends of the module. // Need to further parse to AptosMoveModuleId. Friends []string `json:"friends"` // Public functions of the module ExposedFunctions []MoveFunction `json:"exposed_functions"` // Structs of the module Structs []MoveStruct `json:"structs"` }
type MoveModuleBytecode ¶
type MoveModuleBytecode struct { ByteCode string `json:"bytecode"` Abi MoveModule `json:"abi"` }
Move module bytecode along with it's ABI
type MoveScriptBytecode ¶
type MoveScriptBytecode struct { ByteCode string `json:"bytecode"` Abi MoveFunction `json:"abi"` }
Move script bytecode
type MoveStruct ¶
type MoveStruct struct { Name string `json:"name"` // Whether the struct is a native struct of Move IsNative bool `json:"is_native"` Abilities []string `json:"abilities"` // Generic types associated with the struct GenericTypePramas []MoveStructGenericTypeParam `json:"generic_type_params"` Fields []MoveStructField `json:"fields"` }
type MoveStructField ¶
type MoveStructGenericTypeParam ¶
type MoveStructGenericTypeParam struct {
Constraints []string `json:"constraints"`
}
type MultisigPayload ¶
type MultisigPayload struct { MultisigAddress string `json:"multisig_address"` // This field is optional. TransactionPayload EntryFunctionPayload `json:"transaction_payload,omitempty"` }
A multisig transaction that allows an owner of a multisig account to execute a pre-approved transaction as the multisig account.
type ScriptPayload ¶
type ScriptPayload struct { Code MoveScriptBytecode `json:"code"` TypeArguments []string `json:"type_arguments"` Arguments []json.RawMessage `json:"arguments"` }
Payload which runs a script that can run multiple functions
type ScriptWriteSet ¶
type ScriptWriteSet struct { ExecuteAs string `json:"execute_as"` Payload ScriptPayload `json:"script"` }
There are 2 types of write set payloads: ScriptWriteSet and DirectWriteSet.
type StateCheckpointTransaction ¶
type StateCheckpointTransaction struct {
TimeStamp AptosQuantity `json:"timestamp"`
}
type UserTransaction ¶
type UserTransaction struct { Sender string `json:"sender"` SequenceNumber AptosQuantity `json:"sequence_number"` MaxGasAmount AptosQuantity `json:"max_gas_amount"` GasUnitPrice AptosQuantity `json:"gas_unit_price"` ExpirationTimestampSecs AptosQuantity `json:"expiration_timestamp_secs"` // Need to be further parsed based on the payload type. Payload json.RawMessage `json:"payload"` // Need to be further parsed based on the signature type. Signature json.RawMessage `json:"signature"` // Events generated by the transaction Events []Event `json:"events"` TimeStamp AptosQuantity `json:"timestamp"` }
A transaction submitted by a user to change the state of the blockchain.
type ValidatorTransaction ¶
type ValidatorTransaction struct { Events []Event `json:"events"` TimeStamp AptosQuantity `json:"timestamp"` }
type WriteModuleChange ¶
type WriteModuleChange struct { Address string `json:"address"` StateKeyHash string `json:"state_key_hash"` Data MoveModuleBytecode `json:"data"` }
Write a new module or update an existing one
type WriteResourceChange ¶
type WriteResourceChange struct { Address string `json:"address"` StateKeyHash string `json:"state_key_hash"` Data WriteResourceChangeData `json:"data"` }
Write a resource or update an existing one
type WriteResourceChangeData ¶
type WriteResourceChangeData struct { Type string `json:"type"` Data json.RawMessage `json:"data"` }
type WriteSetPayload ¶
type WriteSetPayload struct {
Payload json.RawMessage `json:"write_set"`
}
This is only used by Genesis block/transactions.
type WriteTableItemChange ¶
type WriteTableItemChange struct { Handle string `json:"handle"` StateKeyHash string `json:"state_key_hash"` Key string `json:"key"` Value string `json:"value"` Data WriteTableItemChangeData `json:"data"` }
Change set to write a table item