client

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID           string `json:"assetId"`
	Name         string `json:"name"`
	Symbol       string `json:"symbol"`
	Denomination string `json:"denomination"`
}

type Blockchain

type Blockchain struct {
	ID       string `json:"id"`
	SubnetID string `json:"subnetID"`
	Name     string `json:"name"`
	VMID     string `json:"vmId"`
}

type Call

type Call struct {
	Type    string         `json:"type"`
	From    common.Address `json:"from"`
	To      common.Address `json:"to"`
	Value   *hexutil.Big   `json:"value"`
	GasUsed *hexutil.Big   `json:"gasUsed"`
	Revert  bool           `json:"revert"`
	Error   string         `json:"error,omitempty"`
	Calls   []*Call        `json:"calls,omitempty"`
}

type Client

type Client interface {
	IsBootstrapped(context.Context, string) (bool, error)
	ChainID(context.Context) (*big.Int, error)
	BlockByHash(context.Context, ethcommon.Hash) (*ethtypes.Block, error)
	BlockByNumber(context.Context, *big.Int) (*ethtypes.Block, error)
	HeaderByHash(context.Context, ethcommon.Hash) (*ethtypes.Header, error)
	HeaderByNumber(context.Context, *big.Int) (*ethtypes.Header, error)
	TransactionByHash(context.Context, ethcommon.Hash) (*ethtypes.Transaction, bool, error)
	TransactionReceipt(context.Context, ethcommon.Hash) (*ethtypes.Receipt, error)
	TraceTransaction(context.Context, string) (*Call, []*FlatCall, error)
	SendTransaction(context.Context, *ethtypes.Transaction) error
	BalanceAt(context.Context, ethcommon.Address, *big.Int) (*big.Int, error)
	NonceAt(context.Context, ethcommon.Address, *big.Int) (uint64, error)
	SuggestGasPrice(context.Context) (*big.Int, error)
	TxPoolStatus(context.Context) (*TxPoolStatus, error)
	TxPoolContent(context.Context) (*TxPoolContent, error)
	NetworkName(context.Context) (string, error)
	Peers(context.Context) ([]Peer, error)
	NodeVersion(context.Context) (string, error)
}

func NewClient

func NewClient(endpoint string) (Client, error)

NewClient returns a new client for Avalanche APIs

type EthClient

type EthClient struct {
	*ethclient.Client
	// contains filtered or unexported fields
}

EthClient provides access to Coreth API

func NewEthClient

func NewEthClient(endpoint string) (*EthClient, error)

NewEthClient returns a new EVM client

func (*EthClient) TraceTransaction

func (c *EthClient) TraceTransaction(ctx context.Context, hash string) (*Call, []*FlatCall, error)

TraceTransaction returns a transaction trace

func (*EthClient) TxPoolContent

func (c *EthClient) TxPoolContent(ctx context.Context) (*TxPoolContent, error)

TxPoolContent returns the tx pool content

func (*EthClient) TxPoolStatus

func (c *EthClient) TxPoolStatus(ctx context.Context) (*TxPoolStatus, error)

TxPoolStatus return the current tx pool status

type FlatCall

type FlatCall struct {
	Type    string         `json:"type"`
	From    common.Address `json:"from"`
	To      common.Address `json:"to"`
	Value   *big.Int       `json:"value"`
	GasUsed *big.Int       `json:"gasUsed"`
	Revert  bool           `json:"revert"`
	Error   string         `json:"error,omitempty"`
}

type InfoClient

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

InfoClient is a client for the Info API

func NewInfoClient

func NewInfoClient(endpoint string) (*InfoClient, error)

NewInfoClient returns a new client to Info API

func (*InfoClient) BlockchainID

func (c *InfoClient) BlockchainID(ctx context.Context, alias string) (string, error)

BlockchainID returns the current blockchain identifier

func (*InfoClient) IsBootstrapped

func (c *InfoClient) IsBootstrapped(ctx context.Context, chain string) (bool, error)

IsBootstrapped returns true if a chans is bootstrapped

func (*InfoClient) NetworkID

func (c *InfoClient) NetworkID(ctx context.Context) (string, error)

NetworkID returns the current network identifier

func (*InfoClient) NetworkName

func (c *InfoClient) NetworkName(ctx context.Context) (string, error)

NetworkName returns the current network name

func (*InfoClient) NodeID

func (c *InfoClient) NodeID(ctx context.Context) (string, error)

NodeID return the current node identifier

func (*InfoClient) NodeVersion

func (c *InfoClient) NodeVersion(ctx context.Context) (string, error)

NodeVersion returns the current node version

func (*InfoClient) Peers

func (c *InfoClient) Peers(ctx context.Context) ([]Peer, error)

Peers returns the list of active peers

type Peer

type Peer struct {
	ID           string `json:"nodeID"`
	IP           string `json:"ip"`
	PublicIP     string `json:"publicIP"`
	Version      string `json:"version"`
	LastSent     string `json:"lastSent"`
	LastReceived string `json:"lastReceived"`
}

func (Peer) Metadata

func (p Peer) Metadata() map[string]interface{}

type RPC

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

RPC is a generic client

func Dial

func Dial(endpoint string) *RPC

Dial returns a new RPC client

func (RPC) Call

func (c RPC) Call(ctx context.Context, method string, args interface{}, out interface{}) error

Call performs the call and decodes the response into the target interface

func (RPC) CallRaw

func (c RPC) CallRaw(ctx context.Context, method string, args interface{}) ([]byte, error)

CallRaw performs the call and returns the raw response data

type TxAccountMap

type TxAccountMap map[string]TxNonceMap

type TxNonceMap

type TxNonceMap map[string]string

type TxPoolContent

type TxPoolContent struct {
	Pending TxAccountMap `json:"pending"`
	Queued  TxAccountMap `json:"queued"`
}

type TxPoolStatus

type TxPoolStatus struct {
	PendingCount int `json:"pending"`
	QueuedCount  int `json:"queued"`
}

Jump to

Keyboard shortcuts

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