aptos

package
v0.0.0-...-efbd42f Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTooManyRequests = fmt.Errorf("too many requests")

Functions

This section is empty.

Types

type AptosSDK

type AptosSDK struct {
	// contains filtered or unexported fields
}

AptosSDK is a client for the Aptos API.

func NewAptosSDK

func NewAptosSDK(url string, rl ratelimit.Limiter, metrics metrics.Metrics) *AptosSDK

NewAptosSDK creates a new AptosSDK.

func (*AptosSDK) GetBlock

func (s *AptosSDK) GetBlock(ctx context.Context, block uint64) (*GetBlockResult, error)

func (*AptosSDK) GetLatestBlock

func (s *AptosSDK) GetLatestBlock(ctx context.Context) (uint64, error)

func (*AptosSDK) GetTransaction

func (s *AptosSDK) GetTransaction(ctx context.Context, version string) (*GetTransactionResult, error)

type GetBlockResult

type GetBlockResult struct {
	BlockHeight    string        `json:"block_height"`
	BlockHash      string        `json:"block_hash"`
	BlockTimestamp string        `json:"block_timestamp"`
	Transactions   []Transaction `json:"transactions"`
}

func (*GetBlockResult) GetBlockTime

func (r *GetBlockResult) GetBlockTime() (*time.Time, error)

type GetLatestBlock

type GetLatestBlock struct {
	BlockHeight string `json:"block_height"`
}

type GetTransactionResult

type GetTransactionResult struct {
	Version             string `json:"version"`
	Hash                string `json:"hash"`
	StateChangeHash     string `json:"state_change_hash"`
	EventRootHash       string `json:"event_root_hash"`
	StateCheckpointHash any    `json:"state_checkpoint_hash"`
	GasUsed             string `json:"gas_used"`
	Success             bool   `json:"success"`
	VMStatus            string `json:"vm_status"`
}

type Payload

type Payload struct {
	Function      string   `json:"function"`
	TypeArguments []string `json:"type_arguments"`
	Arguments     []any    `json:"arguments"`
	Type          string   `json:"type"`
}

type Transaction

type Transaction struct {
	Version string  `json:"version"`
	Hash    string  `json:"hash"`
	Payload Payload `json:"payload,omitempty"`
}

Jump to

Keyboard shortcuts

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