client

package
v1.0.1-rc20 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AvmBalance added in v0.2.0

type AvmBalance struct {
	Asset   string `json:"asset"`
	Balance string `json:"balance"`
}

type AvmClient

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

AvmClient talks to the X chain

func NewAvmClient

func NewAvmClient(endpoint string) AvmClient

func (AvmClient) Endpoint added in v0.6.0

func (c AvmClient) Endpoint() string

func (AvmClient) GetAllBalances added in v0.2.0

func (c AvmClient) GetAllBalances(address string) (result GetAllBalancesResponse, err error)

GetAllBalances returns all assets balances for a given address

type Balance

type Balance struct {
	Balance            string `json:"balance"`
	Unlocked           string `json:"unlocked"`
	LockedStakeable    string `json:"lockedStakeable"`
	LockedNotStakeable string `json:"lockedNotStakeable"`
	Staked             string `json:"staked"`
}

type Blockchain

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

type BlockchainsResponse

type BlockchainsResponse struct {
	Blockchains []Blockchain `json:"blockchains"`
}

type Call added in v0.3.0

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

func (*Call) Flatten added in v0.3.0

func (t *Call) Flatten() *FlatCall

func (*Call) UnmarshalJSON added in v0.3.0

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

type Client

type Client struct {
	Avm      AvmClient
	Evm      EvmClient
	Platform PlatformClient
	Info     InfoClient
	Ipc      IpcClient
	Index    IndexClient
}

func New

func New(endpoint string) *Client

type ClientPool added in v0.6.0

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

func NewClientPool added in v0.6.0

func NewClientPool(endpoints ...string) ClientPool

func (*ClientPool) Get added in v0.6.0

func (pool *ClientPool) Get() *Client

type Container added in v0.3.0

type Container struct {
	ID        string    `json:"id"`
	Index     string    `json:"index"`
	Bytes     string    `json:"bytes"`
	Encoding  string    `json:"encoding"`
	Timestamp time.Time `json:"timestamp"`
}

type ContainersResponse added in v0.3.0

type ContainersResponse struct {
	Containers []Container `json:"containers"`
}

type Delegator

type Delegator struct {
	TxID            string      `json:"txID"`
	StartTime       string      `json:"startTime"`
	EndTime         string      `json:"endTime"`
	StakeAmount     string      `json:"stakeAmount"`
	NodeID          string      `json:"nodeID"`
	RewardOwner     RewardOwner `json:"rewardOwner"`
	PotentialReward string      `json:"potentialReward"`
	DelegationFee   string      `json:"delegationFee"`
	Uptime          string      `json:"uptime"`
	Connected       bool        `json:"connected"`
}

type EvmClient added in v0.3.0

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

func NewEVmClient added in v0.3.0

func NewEVmClient(endpoint string) EvmClient

func (*EvmClient) TraceTransaction added in v0.3.0

func (c *EvmClient) TraceTransaction(ctx context.Context, hash string) (*Call, error)

type FlatCall added in v0.3.0

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

type GetAllBalancesResponse added in v0.2.0

type GetAllBalancesResponse struct {
	Balances []AvmBalance `json:"balances"`
}

type GetStakeResponse added in v0.5.0

type GetStakeResponse struct {
	Staked string `json:"staked"`
}

type IndexClient added in v0.3.0

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

func NewIndexClient added in v0.3.0

func NewIndexClient(endpoint string) IndexClient

func (IndexClient) Endpoint added in v0.6.0

func (c IndexClient) Endpoint() string

func (IndexClient) GetContainerRange added in v0.3.0

func (c IndexClient) GetContainerRange(chain string, startIndex uint64, numToFetch int) (*ContainersResponse, error)

func (IndexClient) GetLastAccepted added in v0.3.0

func (c IndexClient) GetLastAccepted(chain string) (*Container, error)

type InfoClient

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

func NewInfoClient

func NewInfoClient(endpoint string) InfoClient

func (InfoClient) BlockchainID

func (c InfoClient) BlockchainID(alias string) (string, error)

func (InfoClient) Endpoint added in v0.6.0

func (c InfoClient) Endpoint() string

func (InfoClient) NetworkID

func (c InfoClient) NetworkID() (int, error)

func (InfoClient) NetworkName

func (c InfoClient) NetworkName() (string, error)

func (InfoClient) NodeID

func (c InfoClient) NodeID() (string, error)

func (InfoClient) NodeVersion

func (c InfoClient) NodeVersion() (string, error)

func (InfoClient) Peers

func (c InfoClient) Peers() ([]Peer, error)

func (InfoClient) TxFee

func (c InfoClient) TxFee() (*TxFeeResponse, error)

type IpcClient

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

func NewIpcClient

func NewIpcClient(endpoint string) IpcClient

func (IpcClient) Endpoint added in v0.6.0

func (c IpcClient) Endpoint() string

type MinStakeResponse

type MinStakeResponse struct {
	MinValidatorStake string `json:"minValidatorStake"`
	MinDelegatorStake string `json:"minDelegatorStake"`
}

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 PlatformClient

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

PlatformClient talks to the P chain

func NewPlatformClient

func NewPlatformClient(endpoint string) PlatformClient

func (PlatformClient) Endpoint added in v0.6.0

func (c PlatformClient) Endpoint() string

func (PlatformClient) GetBalance

func (c PlatformClient) GetBalance(address string) (resp *Balance, err error)

func (PlatformClient) GetBlockchains

func (c PlatformClient) GetBlockchains() (resp *BlockchainsResponse, err error)

func (PlatformClient) GetCurrentHeight

func (c PlatformClient) GetCurrentHeight() (uint64, error)

func (PlatformClient) GetCurrentValidators

func (c PlatformClient) GetCurrentValidators() (resp *ValidatorsResponse, err error)

func (PlatformClient) GetMinStake

func (c PlatformClient) GetMinStake() (resp *MinStakeResponse, err error)

func (PlatformClient) GetPendingValidators

func (c PlatformClient) GetPendingValidators() (resp *ValidatorsResponse, err error)

func (PlatformClient) GetRewardUTXOs added in v0.3.0

func (c PlatformClient) GetRewardUTXOs(id string) (resp *RewardUTXOsResponse, err error)

func (PlatformClient) GetStake added in v0.5.0

func (c PlatformClient) GetStake(addresses []string) (resp *GetStakeResponse, err error)

type RewardOwner

type RewardOwner struct {
	Locktime  string   `json:"locktime"`
	Threshold string   `json:"threshold"`
	Addresses []string `json:"addresses"`
}

type RewardUTXOsResponse added in v0.3.0

type RewardUTXOsResponse struct {
	NumFetched string   `json:"numFetched"`
	Encoding   string   `json:"encoding"`
	UTXOs      []string `json:"utxos"`
}

type TxFeeResponse

type TxFeeResponse struct {
	CreationTxFee string `json:"creationTxFee"`
	TxFee         string `json:"txFee"`
}

type Validator

type Validator struct {
	TxID            string      `json:"txID"`
	StartTime       string      `json:"startTime"`
	EndTime         string      `json:"endTime"`
	StakeAmount     string      `json:"stakeAmount"`
	NodeID          string      `json:"nodeID"`
	RewardOwner     RewardOwner `json:"rewardOwner"`
	PotentialReward string      `json:"potentialReward"`
	DelegationFee   string      `json:"delegationFee"`
	Uptime          string      `json:"uptime"`
	Connected       bool        `json:"connected"`
	Delegators      []Delegator `json:"delegators"`
}

type ValidatorsResponse

type ValidatorsResponse struct {
	Validators []Validator `json:"validators"`
	Delegators []Delegator `json:"delegators"`
}

Jump to

Keyboard shortcuts

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