client

package
v0.1.36 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknownERC20Symbol  = "ERC20_UNKNOWN"
	UnknownERC721Symbol = "ERC721_UNKNOWN"
)

Variables

View Source
var ContractInfoTokenABI = ContractInfoTokenMetaData.ABI

ContractInfoTokenABI is the input ABI used to generate the binding from. Deprecated: Use ContractInfoTokenMetaData.ABI instead.

View Source
var ContractInfoTokenMetaData = &bind.MetaData{
	ABI: "[{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"uint8\",\"name\":\"\",\"internalType\":\"uint8\"}],\"name\":\"decimals\",\"inputs\":[]},{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"string\",\"name\":\"\",\"internalType\":\"string\"}],\"name\":\"symbol\",\"inputs\":[]}]",
}

ContractInfoTokenMetaData contains all meta data concerning the ContractInfoToken contract.

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 {
	// info.Client methods
	InfoClient

	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)
	TraceBlockByHash(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)
	EstimateGas(context.Context, interfaces.CallMsg) (uint64, error)
	TxPoolContent(context.Context) (*TxPoolContent, error)
	GetContractInfo(ethcommon.Address, bool) (string, uint8, error)
	CallContract(context.Context, interfaces.CallMsg, *big.Int) ([]byte, error)
	IssueTx(ctx context.Context, txBytes []byte, options ...rpc.Option) (ids.ID, error)
	GetAtomicUTXOs(ctx context.Context, addrs []ids.ShortID, sourceChain string, limit uint32, startAddress ids.ShortID, startUTXOID ids.ID, options ...rpc.Option) ([][]byte, ids.ShortID, ids.ID, error)
	EstimateBaseFee(ctx context.Context) (*big.Int, error)
}

func NewClient

func NewClient(ctx context.Context, endpoint string) (Client, error)

NewClient returns a new client for Avalanche APIs

type ContractClient added in v0.0.26

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

ContractClient is a client for the calling contract information

func NewContractClient added in v0.0.26

func NewContractClient(c ethclient.Client) *ContractClient

NewContractClient returns a new ContractInfo client

func (*ContractClient) GetContractInfo added in v0.1.5

func (c *ContractClient) GetContractInfo(addr common.Address, erc20 bool) (string, uint8, error)

GetContractInfo returns the symbol and decimals for [addr].

type ContractInfo added in v0.0.26

type ContractInfo struct {
	Symbol   string
	Decimals uint8
}

type ContractInfoToken added in v0.0.26

type ContractInfoToken struct {
	ContractInfoTokenCaller     // Read-only binding to the contract
	ContractInfoTokenTransactor // Write-only binding to the contract
	ContractInfoTokenFilterer   // Log filterer for contract events
}

ContractInfoToken is an auto generated Go binding around an Ethereum contract.

func NewContractInfoToken added in v0.0.26

func NewContractInfoToken(address common.Address, backend bind.ContractBackend) (*ContractInfoToken, error)

NewContractInfoToken creates a new instance of ContractInfoToken, bound to a specific deployed contract.

type ContractInfoTokenCaller added in v0.0.26

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

ContractInfoTokenCaller is an auto generated read-only Go binding around an Ethereum contract.

func NewContractInfoTokenCaller added in v0.0.26

func NewContractInfoTokenCaller(address common.Address, caller bind.ContractCaller) (*ContractInfoTokenCaller, error)

NewContractInfoTokenCaller creates a new read-only instance of ContractInfoToken, bound to a specific deployed contract.

func (*ContractInfoTokenCaller) Decimals added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenCaller) Decimals(opts *bind.CallOpts) (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() view returns(uint8)

func (*ContractInfoTokenCaller) Symbol added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenCaller) Symbol(opts *bind.CallOpts) (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() view returns(string)

type ContractInfoTokenCallerRaw added in v0.0.26

type ContractInfoTokenCallerRaw struct {
	Contract *ContractInfoTokenCaller // Generic read-only contract binding to access the raw methods on
}

ContractInfoTokenCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.

func (*ContractInfoTokenCallerRaw) Call added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

type ContractInfoTokenCallerSession added in v0.0.26

type ContractInfoTokenCallerSession struct {
	Contract *ContractInfoTokenCaller // Generic contract caller binding to set the session for
	CallOpts bind.CallOpts            // Call options to use throughout this session
}

ContractInfoTokenCallerSession is an auto generated read-only Go binding around an Ethereum contract, with pre-set call options.

func (*ContractInfoTokenCallerSession) Decimals added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenCallerSession) Decimals() (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() view returns(uint8)

func (*ContractInfoTokenCallerSession) Symbol added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenCallerSession) Symbol() (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() view returns(string)

type ContractInfoTokenFilterer added in v0.0.26

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

ContractInfoTokenFilterer is an auto generated log filtering Go binding around an Ethereum contract events.

func NewContractInfoTokenFilterer added in v0.0.26

func NewContractInfoTokenFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractInfoTokenFilterer, error)

NewContractInfoTokenFilterer creates a new log filterer instance of ContractInfoToken, bound to a specific deployed contract.

type ContractInfoTokenRaw added in v0.0.26

type ContractInfoTokenRaw struct {
	Contract *ContractInfoToken // Generic contract binding to access the raw methods on
}

ContractInfoTokenRaw is an auto generated low-level Go binding around an Ethereum contract.

func (*ContractInfoTokenRaw) Call added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

func (*ContractInfoTokenRaw) Transact added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*ContractInfoTokenRaw) Transfer added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type ContractInfoTokenSession added in v0.0.26

type ContractInfoTokenSession struct {
	Contract     *ContractInfoToken // Generic contract binding to set the session for
	CallOpts     bind.CallOpts      // Call options to use throughout this session
	TransactOpts bind.TransactOpts  // Transaction auth options to use throughout this session
}

ContractInfoTokenSession is an auto generated Go binding around an Ethereum contract, with pre-set call and transact options.

func (*ContractInfoTokenSession) Decimals added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenSession) Decimals() (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() view returns(uint8)

func (*ContractInfoTokenSession) Symbol added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenSession) Symbol() (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() view returns(string)

type ContractInfoTokenTransactor added in v0.0.26

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

ContractInfoTokenTransactor is an auto generated write-only Go binding around an Ethereum contract.

func NewContractInfoTokenTransactor added in v0.0.26

func NewContractInfoTokenTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractInfoTokenTransactor, error)

NewContractInfoTokenTransactor creates a new write-only instance of ContractInfoToken, bound to a specific deployed contract.

type ContractInfoTokenTransactorRaw added in v0.0.26

type ContractInfoTokenTransactorRaw struct {
	Contract *ContractInfoTokenTransactor // Generic write-only contract binding to access the raw methods on
}

ContractInfoTokenTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.

func (*ContractInfoTokenTransactorRaw) Transact added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*ContractInfoTokenTransactorRaw) Transfer added in v0.0.26

func (_ContractInfoToken *ContractInfoTokenTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type ContractInfoTokenTransactorSession added in v0.0.26

type ContractInfoTokenTransactorSession struct {
	Contract     *ContractInfoTokenTransactor // Generic contract transactor binding to set the session for
	TransactOpts bind.TransactOpts            // Transaction auth options to use throughout this session
}

ContractInfoTokenTransactorSession is an auto generated write-only Go binding around an Ethereum contract, with pre-set transact options.

type EthClient

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

EthClient provides access to Coreth API

func NewEthClient

func NewEthClient(ctx context.Context, endpoint string) (*EthClient, error)

NewEthClient returns a new EVM client

func (*EthClient) TraceBlockByHash added in v0.1.1

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

TraceBlockByHash returns the transaction traces of all transactions in the block

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

type EvmClient added in v0.1.26

type EvmClient evm.Client

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 interface {
	GetBlockchainID(context.Context, string, ...rpc.Option) (ids.ID, error)
	IsBootstrapped(context.Context, string, ...rpc.Option) (bool, error)
	Peers(context.Context, ...rpc.Option) ([]info.Peer, error)
}

InfoClient collects all Avalanchego info.Client methods common to Rosetta Clients

type PChainClient added in v0.1.26

type PChainClient interface {
	// info.Client methods
	InfoClient
	GetNodeID(context.Context, ...rpc.Option) (ids.NodeID, *signer.ProofOfPossession, error)
	GetTxFee(context.Context, ...rpc.Option) (*info.GetTxFeeResponse, error)

	// indexer.Client methods
	// Note: we use indexer only to be able to retrieve blocks by height.
	// Blocks by ID are retrieved via platformVM.GetBlock, thus ignoring the proposerVM part
	// and using Pchain Block ID rather than encompassing Snowman++ block ID
	GetContainerByIndex(ctx context.Context, index uint64, options ...rpc.Option) (indexer.Container, error)
	GetLastAccepted(context.Context, ...rpc.Option) (indexer.Container, uint64, error)

	// platformvm.Client methods
	GetUTXOs(
		ctx context.Context,
		addrs []ids.ShortID,
		limit uint32,
		startAddress ids.ShortID,
		startUTXOID ids.ID,
		options ...rpc.Option,
	) ([][]byte, ids.ShortID, ids.ID, error)
	GetAtomicUTXOs(
		ctx context.Context,
		addrs []ids.ShortID,
		sourceChain string,
		limit uint32,
		startAddress ids.ShortID,
		startUTXOID ids.ID,
		options ...rpc.Option,
	) ([][]byte, ids.ShortID, ids.ID, error)
	GetRewardUTXOs(context.Context, *api.GetTxArgs, ...rpc.Option) ([][]byte, error)
	GetHeight(ctx context.Context, options ...rpc.Option) (uint64, error)
	GetBalance(ctx context.Context, addrs []ids.ShortID, options ...rpc.Option) (*platformvm.GetBalanceResponse, error)
	GetTx(ctx context.Context, txID ids.ID, options ...rpc.Option) ([]byte, error)
	GetBlock(ctx context.Context, blockID ids.ID, options ...rpc.Option) ([]byte, error)
	IssueTx(ctx context.Context, tx []byte, options ...rpc.Option) (ids.ID, error)
	GetStake(ctx context.Context, addrs []ids.ShortID, validatorsOnly bool, options ...rpc.Option) (map[ids.ID]uint64, [][]byte, error)
	GetCurrentValidators(ctx context.Context, subnetID ids.ID, nodeIDs []ids.NodeID, options ...rpc.Option) ([]platformvm.ClientPermissionlessValidator, error)

	// avm.Client methods
	GetAssetDescription(ctx context.Context, assetID string, options ...rpc.Option) (*avm.GetAssetDescriptionReply, error)
}

PChainClient contains all client methods used to interact with avalanchego in order to support P-chain operations in Rosetta.

These methods are cloned from the underlying avalanchego client interfaces, following the example of Client interface used to support C-chain operations.

func NewPChainClient added in v0.1.26

func NewPChainClient(_ context.Context, rpcBaseURL, indexerBaseURL string) PChainClient

NewPChainClient returns a new client for Avalanche APIs related to P-chain

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