aptostypes

package
v0.0.0-...-c246823 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 11

Documentation

Index

Constants

View Source
const (
	TypeChangeDeleteModule    = "delete_module"
	TypeChangeDeleteResource  = "delete_resource"
	TypeChangeDeleteTableItem = "delete_table_item"
	TypeChangeWriteModule     = "write_module"
	TypeChangeWriteResource   = "write_resource"
	TypeChangeWriteTableItem  = "write_table_item"
)
View Source
const (
	TypePendingTransaction            = "pending_transaction"
	TypeGenesisTransaction            = "genesis_transaction"
	TypeUserTransaction               = "user_transaction"
	TypeBlockMetadataTransaction      = "block_metadata_transaction"
	TypeStateCheckoutpointTransaction = "state_checkpoint_transaction"
)
View Source
const (
	EntryFunctionPayload = "entry_function_payload"
	ScriptPayload        = "script_payload"
	ModuleBundlePayload  = "module_bundle_payload"
	WriteSetPayload      = "write_set_payload"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountCoreData

type AccountCoreData struct {
	SequenceNumber    uint64 `json:"sequence_number"`
	AuthenticationKey string `json:"authentication_key"`
}

func (AccountCoreData) MarshalJSON

func (a AccountCoreData) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*AccountCoreData) UnmarshalJSON

func (a *AccountCoreData) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type AccountCoreDataMarshaling

type AccountCoreDataMarshaling struct {
	SequenceNumber jsonUint64
}

type AccountResource

type AccountResource struct {
	Type string                 `json:"type"` // match ^0x[0-9a-zA-Z:_<>]+$
	Data map[string]interface{} `json:"data"`
}

type Block

type Block struct {
	BlockHeight    uint64        `json:"block_height"`
	BlockHash      string        `json:"block_hash"`
	BlockTimestamp uint64        `json:"block_timestamp"`
	FirstVersion   uint64        `json:"first_version"`
	LastVersion    uint64        `json:"last_version"`
	Transactions   []Transaction `json:"transactions"`
}

func (Block) MarshalJSON

func (b Block) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Block) UnmarshalJSON

func (b *Block) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type BlockMetadataTransaction

type BlockMetadataTransaction struct {
	Type string `json:"type"`
	Hash string `json:"hash"`

	Events              []Event
	Version             uint64   `json:"version"`
	StateRootHash       string   `json:"state_root_hash"`
	EventRootHash       string   `json:"event_root_hash"`
	GasUsed             uint64   `json:"gas_used"`
	Success             bool     `json:"success"`
	VmStatus            string   `json:"vm_status"`
	AccumulatorRootHash string   `json:"accumulator_root_hash"`
	Changes             []Change `json:"changes"`
	Timestamp           uint64   `json:"timestamp"`
	ID                  string   `json:"id"`
	Round               uint64   `json:"round"`
	PreviousBlockVotes  []bool   `json:"previous_block_votes"`
	Proposer            string   `json:"proposer"`
	// contains filtered or unexported fields
}

type Change

type Change struct {
	Type         string `json:"type"`           // delete_module|delete_resource|delete_table_item|write_module|write_resource|write_table_item
	StateKeyHash string `json:"state_key_hash"` // delete_module|delete_resource|delete_table_item|write_module
	Address      string `json:"address"`        // delete_module|delete_resource|write_module
	Resource     string `json:"resource"`       // delete_resource
	Module       string `json:"module"`         // delete_module

	Handle string `json:"handle"` //write_table_item
	Key    string `json:"key"`    // write_table_item
	Value  string `json:"value"`  //write_table_item

	Data interface{} `json:"data"` // delete_table_item(DeleteTableItem)|write_module(MoveModule)|write_resource(AccountResource)
}

func (*Change) AsDeleteModuleChange

func (c *Change) AsDeleteModuleChange() *DeleteModuleChange

func (*Change) AsDeleteResourceChange

func (c *Change) AsDeleteResourceChange() *DeleteResourceChange

func (*Change) AsDeleteTableItemChange

func (c *Change) AsDeleteTableItemChange() *DeleteTableItemChange

func (*Change) AsWriteModuleChange

func (c *Change) AsWriteModuleChange() *WriteModuleChange

func (*Change) AsWriteResourceChange

func (c *Change) AsWriteResourceChange() *WriteResourceChange

func (*Change) AsWriteTableItemChange

func (c *Change) AsWriteTableItemChange() *WriteTableItemChange

type CoinInfo

type CoinInfo struct {
	Decimals int
	Symbol   string
	Name     string
}

type DeleteModuleChange

type DeleteModuleChange struct {
	Type         string `json:"type"`
	StateKeyHash string `json:"state_key_hash"`
	Address      string `json:"address"`

	Module string `json:"module"`
	// contains filtered or unexported fields
}

type DeleteResourceChange

type DeleteResourceChange struct {
	Type         string `json:"type"`
	StateKeyHash string `json:"state_key_hash"`
	Address      string `json:"address"`
	Resource     string `json:"resource"`
	// contains filtered or unexported fields
}

type DeleteTableItem

type DeleteTableItem struct {
	Handle string `json:"handle"`
	Key    string `json:"key"`
}

type DeleteTableItemChange

type DeleteTableItemChange struct {
	Type         string `json:"type"`
	StateKeyHash string `json:"state_key_hash"`

	Data interface{} `json:"data"`
	// contains filtered or unexported fields
}

type Event

type Event struct {
	Guid           *Guid       `json:"guid,omitempty"`
	Key            string      `json:"key"`
	SequenceNumber uint64      `json:"sequence_number"`
	Type           string      `json:"type"` // eg. 0x1::aptos_coin::AptosCoin, match ^(bool|u8|u64|u128|address|signer|vector<.+>|0x[0-9a-zA-Z:_<, >]+)$
	Data           interface{} `json:"data"`
	Version        uint64      `json:"version"` // only getEvents will return version
}

func (Event) MarshalJSON

func (e Event) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type Guid

type Guid struct {
	CreationNumber string `json:"creation_number"`
	AccountAddress string `json:"account_address"`
}

type LedgerInfo

type LedgerInfo struct {
	ChainId             int    `json:"chain_id"`
	LedgerVersion       uint64 `json:"ledger_version" gencodec:"required"`
	LedgerTimestamp     uint64 `json:"ledger_timestamp" gencodec:"required"`
	BlockHeight         uint64 `json:"block_height" gencodec:"required"`
	Epoch               uint64 `json:"epoch"`
	NodeRole            string `json:"node_role"`
	OldestBlockHeight   uint64 `json:"oldest_block_height"`
	OldestLedgerVersion uint64 `json:"oldest_ledger_version"`
}

LedgerInfo represents chain current ledger info

func (LedgerInfo) MarshalJSON

func (l LedgerInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*LedgerInfo) UnmarshalJSON

func (l *LedgerInfo) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type MoveFunction

type MoveFunction struct {
	Name              string        `json:"name"`
	Visibility        string        `json:"visibility"` // public|script|friend
	IsEntry           bool          `json:"is_entry"`
	GenericTypeParams []interface{} `json:"generic_type_params"`
	Params            []string      `json:"params"`
	Return            []string      `json:"return"`
}

type MoveModule

type MoveModule struct {
	ByteCode string         `json:"bytecode"`
	Abi      *MoveModuleAbi `json:"abi"`
}

type MoveModuleAbi

type MoveModuleAbi struct {
	Address          string         `json:"address"`
	Name             string         `json:"name"`
	Friend           []string       `json:"friend"`
	ExposedFunctions []MoveFunction `json:"exposed_functions"`
	Structs          []MoveStruct   `json:"structs"`
}

type MoveScript

type MoveScript struct {
	Bytecode string        `json:"bytecode"`
	Abi      *MoveFunction `json:"abi"`
}

type MoveStruct

type MoveStruct struct {
	Name              string
	IsNative          bool
	Abilities         []string          `json:"abilities"` // copy|drop|store|key
	GenericTypeParams []interface{}     `json:"generic_type_params"`
	Fields            []MoveStructField `json:"fields"`
}

type MoveStructField

type MoveStructField struct {
	Name string
	Type string // eg.0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>, match ^(bool|u8|u64|u128|address|signer|vector<.+>|0x[0-9a-zA-Z:_<, >]+|^&(mut )?.+$|T\d+)$
}

type Payload

type Payload struct {
	Type          string        `json:"type"`           // ScriptPayload|ScriptFunctionPayload|ModuleBundlePayload|WriteSetPayload
	TypeArguments []string      `json:"type_arguments"` // ScriptPayload|ScriptFunctionPayload
	Arguments     []interface{} `json:"arguments"`      // ScriptPayload|ScriptFunctionPayload

	Modules []MoveModule `json:"modules"` // ModuleBundlePayload

	Code *MoveScript `json:"code"` // ScriptPayload

	Function string `json:"function"` // ScriptFunctionPayload

	WriteSet *WriteSet `json:"write_set"` // WriteSetPayload
}

type RestError

type RestError struct {
	Code               int    `json:"code"`
	Message            string `json:"message"`
	AptosLedgerVersion uint64 `json:"aptos_ledger_version"`
}

func (*RestError) Error

func (e *RestError) Error() string

func (RestError) MarshalJSON

func (r RestError) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*RestError) UnmarshalJSON

func (r *RestError) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type Script

type Script struct {
	Code          *MoveScript   `json:"code"`
	TypeArguments []string      `json:"type_arguments"`
	Arguments     []interface{} `json:"arguments"`
}

type Signature

type Signature struct {
	Type      string `json:"type"`       // ed25519_signature|multi_ed25519_signature|multi_agent_signature
	PublicKey string `json:"public_key"` // ed25519_signature
	Signature string `json:"signature"`  // ed25519_signature

	PublicKeys []string `json:"public_keys"` // multi_ed25519_signature
	Signatures []string `json:"signatures"`  // multi_ed25519_signature
	Threshold  int      `json:"threshold"`   // multi_ed25519_signature
	Bitmap     string   `json:"bitmap"`      // multi_ed25519_signature

	Sender                   *Signature  `json:"Sender"`                     // multi_agent_signature
	SecondarySignerAddresses []string    `json:"secondary_signer_addresses"` // multi_agent_signature
	SecondarySigners         []Signature `json:"secondary_signers"`          // multi_agent_signature
}

type Transaction

type Transaction struct {
	Type                    string     `json:"type"`
	Hash                    string     `json:"hash"`                      // PendingTransaction|GenesisTransaction|UserTransaction|BlockMetadataTransaction|StateCheckoutpointTransaction
	Sender                  string     `json:"sender"`                    // PendingTransaction|UserTransaction
	SequenceNumber          uint64     `json:"sequence_number"`           // PendingTransaction|UserTransaction
	MaxGasAmount            uint64     `json:"max_gas_amount"`            // PendingTransaction|UserTransaction
	GasUnitPrice            uint64     `json:"gas_unit_price"`            // PendingTransaction|UserTransaction
	GasCurrencyCode         string     `json:"gas_currency_code"`         // PendingTransaction|UserTransaction
	ExpirationTimestampSecs uint64     `json:"expiration_timestamp_secs"` // PendingTransaction|UserTransaction
	Payload                 *Payload   `json:"payload"`                   // PendingTransaction|GenesisTransaction|UserTransaction
	Signature               *Signature `json:"signature"`                 // PendingTransaction|UserTransaction

	Events              []Event  `json:"events"`                // GenesisTransaction|UserTransaction|BlockMetadataTransaction
	Version             uint64   `json:"version"`               // GenesisTransaction|UserTransaction|BlockMetadataTransaction|StateCheckoutpointTransaction
	StateRootHash       string   `json:"state_root_hash"`       // GenesisTransaction|UserTransaction|BlockMetadataTransaction|StateCheckoutpointTransaction
	EventRootHash       string   `json:"event_root_hash"`       // GenesisTransaction|UserTransaction|BlockMetadataTransaction|StateCheckoutpointTransaction
	GasUsed             uint64   `json:"gas_used"`              // GenesisTransaction|UserTransaction|BlockMetadataTransaction|StateCheckoutpointTransaction
	Success             bool     `json:"success"`               // GenesisTransaction|UserTransaction|BlockMetadataTransaction|StateCheckoutpointTransaction
	VmStatus            string   `json:"vm_status"`             // GenesisTransaction|UserTransaction|BlockMetadataTransaction|StateCheckoutpointTransaction
	AccumulatorRootHash string   `json:"accumulator_root_hash"` // GenesisTransaction|UserTransaction|BlockMetadataTransaction|StateCheckoutpointTransaction
	Changes             []Change `json:"changes"`               // GenesisTransaction|UserTransaction|BlockMetadataTransaction|StateCheckoutpointTransaction

	Timestamp uint64 `json:"timestamp"` // UserTransaction|BlockMetadataTransaction|StateCheckoutpointTransaction

	ID                 string `json:"id"`                   //BlockMetadataTransaction
	Round              uint64 `json:"round"`                //BlockMetadataTransaction
	PreviousBlockVotes []bool `json:"previous_block_votes"` //BlockMetadataTransaction
	Proposer           string `json:"proposer"`             //BlockMetadataTransaction
}

Transaction

func (*Transaction) AsBlockMetadataTransaction

func (t *Transaction) AsBlockMetadataTransaction() *BlockMetadataTransaction

func (*Transaction) AsUserTransaction

func (t *Transaction) AsUserTransaction() *UserTransaction

func (Transaction) MarshalJSON

func (t Transaction) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type UserTransaction

type UserTransaction struct {
	Type                    string     `json:"type"`
	Hash                    string     `json:"hash"`
	Sender                  string     `json:"sender"`
	SequenceNumber          uint64     `json:"sequence_number"`
	MaxGasAmount            uint64     `json:"max_gas_amount"`
	GasUnitPrice            uint64     `json:"gas_unit_price"`
	GasCurrencyCode         string     `json:"gas_currency_code"`
	ExpirationTimestampSecs uint64     `json:"expiration_timestamp_secs"`
	Payload                 *Payload   `json:"payload"`
	Signature               *Signature `json:"signature"`
	Events                  []Event    `json:"events"`
	Version                 uint64     `json:"version"`
	StateRootHash           string     `json:"state_root_hash"`
	EventRootHash           string     `json:"event_root_hash"`
	GasUsed                 uint64     `json:"gas_used"`
	Success                 bool       `json:"success"`
	VmStatus                string     `json:"vm_status"`
	AccumulatorRootHash     string     `json:"accumulator_root_hash"`
	Changes                 []Change   `json:"changes"`
	Timestamp               uint64     `json:"timestamp"`
	// contains filtered or unexported fields
}

type WriteModuleChange

type WriteModuleChange struct {
	Type         string `json:"type"`
	StateKeyHash string `json:"state_key_hash"`
	Address      string `json:"address"`

	Data interface{} `json:"data"`
	// contains filtered or unexported fields
}

type WriteResourceChange

type WriteResourceChange struct {
	Type         string `json:"type"`
	StateKeyHash string `json:"state_key_hash"`
	Address      string `json:"address"`

	Data interface{} `json:"data"`
	// contains filtered or unexported fields
}

func (*WriteResourceChange) GetData

func (wrc *WriteResourceChange) GetData() (ar AccountResource, success bool)

type WriteSet

type WriteSet struct {
	Type      string  `json:"type"`       // script_write_set|direct_write_set
	ExecuteAs string  `json:"execute_as"` // script_write_set
	Script    *Script `json:"script"`     // script_write_set

	Changes []Change `json:"changes"` // direct_write_set
	Events  []Event  `json:"events"`  // direct_write_set
}

type WriteTableItemChange

type WriteTableItemChange struct {
	Type         string `json:"type"`
	StateKeyHash string `json:"state_key_hash"`

	Handle string `json:"handle"`
	Key    string `json:"key"`
	Value  string `json:"value"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL