api

package
v1.14.33 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: BSD-3-Clause Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

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

APIClient gives access to most node apis (or suitable wrappers)

func (APIClient) AdminAPI

func (c APIClient) AdminAPI() *admin.Client

func (APIClient) CChainAPI

func (c APIClient) CChainAPI() interface{}

func (APIClient) CChainEthAPI

func (c APIClient) CChainEthAPI() EthClient

func (APIClient) CChainIndexAPI

func (c APIClient) CChainIndexAPI() *indexer.Client

func (APIClient) HealthAPI

func (c APIClient) HealthAPI() HealthClient

func (APIClient) InfoAPI

func (c APIClient) InfoAPI() *info.Client

func (APIClient) PChainAPI

func (c APIClient) PChainAPI() *platformvm.Client

func (APIClient) PChainIndexAPI

func (c APIClient) PChainIndexAPI() *indexer.Client

func (APIClient) XChainAPI

func (c APIClient) XChainAPI() *exchangevm.Client

func (APIClient) XChainWalletAPI

func (c APIClient) XChainWalletAPI() *exchangevm.WalletClient

type Client

type Client interface {
	PChainAPI() *platformvm.Client
	XChainAPI() *exchangevm.Client
	XChainWalletAPI() *exchangevm.WalletClient
	CChainAPI() interface{}  // evmclient.Client
	CChainEthAPI() EthClient // ethclient websocket wrapper that adds mutexed calls, and lazy conn init (on first call)
	InfoAPI() *info.Client
	HealthAPI() HealthClient
	AdminAPI() *admin.Client
	PChainIndexAPI() *indexer.Client
	CChainIndexAPI() *indexer.Client
}

Issues API calls to a node TODO: byzantine api. check if appropriate. improve implementation.

func NewAPIClient

func NewAPIClient(ipAddr string, port uint16) Client

NewAPIClient initialize most of node apis

type EthClient

type EthClient interface {
	// Balance operations
	BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)

	// Block operations
	BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	BlockNumber(ctx context.Context) (uint64, error)
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

	// Transaction operations
	SendTransaction(ctx context.Context, tx *types.Transaction) error
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

	// Contract operations
	CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
	AcceptedCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
	CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
	AcceptedCodeAt(ctx context.Context, account common.Address) ([]byte, error)

	// Nonce operations
	NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
	AcceptedNonceAt(ctx context.Context, account common.Address) (uint64, error)

	// Gas operations
	EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
	SuggestGasTipCap(ctx context.Context) (*big.Int, error)

	// Log operations
	FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
	SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

	// Connection management
	Close()
}

EthClient is the interface for ethereum client operations

func NewEthClient

func NewEthClient(ipAddr string, port uint) EthClient

NewEthClient creates a new EthClient stub for testing This is a minimal implementation that returns reasonable test values

func NewEthClientWithChainID

func NewEthClientWithChainID(ipAddr string, port uint, chainID string) EthClient

NewEthClientWithChainID creates a new EthClient stub with chain ID

type HealthClient added in v1.6.1

type HealthClient interface {
	Readiness(ctx context.Context, tags []string, options ...rpc.Option) (*health.APIReply, error)
	Health(ctx context.Context, tags []string, options ...rpc.Option) (*health.APIReply, error)
	Liveness(ctx context.Context, tags []string, options ...rpc.Option) (*health.APIReply, error)
}

HealthClient is the interface for health API client operations

type NewAPIClientF

type NewAPIClientF func(ipAddr string, port uint16) Client

Returns a new API client for a node at [ipAddr]:[port].

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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