client

package
v0.0.0-...-cddcb41 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Overview

Package client implements client. TODO: TO BE MIGRATED TO UPSTREAM AVALANCHEGO.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyID         = errors.New("empty ID")
	ErrEmptyURI        = errors.New("empty URI")
	ErrInvalidInterval = errors.New("invalid interval")
)
View Source
var (
	ErrInsufficientBalanceForGasFee      = errors.New("insufficient balance for gas")
	ErrInsufficientBalanceForStakeAmount = errors.New("insufficient balance for stake amount")
	ErrUnexpectedSubnetID                = errors.New("unexpected subnet ID")

	ErrEmptyValidator              = errors.New("empty validator set")
	ErrAlreadyValidator            = errors.New("already validator")
	ErrAlreadySubnetValidator      = errors.New("already subnet validator")
	ErrNotValidatingPrimaryNetwork = errors.New("validator not validating the primary network")
	ErrInvalidSubnetValidatePeriod = errors.New("invalid subnet validate period")
	ErrInvalidValidatorData        = errors.New("invalid validator data")
	ErrValidatorNotFound           = errors.New("validator not found")

	// ref. "vms.platformvm".
	ErrWrongTxType   = errors.New("wrong transaction type")
	ErrUnknownOwners = errors.New("unknown owners")
	ErrCantSign      = errors.New("can't sign")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	NetworkID() uint32
	Config() Config
	Info() Info
	KeyStore() KeyStore
	P() P
}

func New

func New(cfg Config) (Client, error)

type Config

type Config struct {
	URI string

	PollInterval time.Duration
	// contains filtered or unexported fields
}

type Info

type Info interface {
	Client() api_info.Client
}

type KeyStore

type KeyStore interface {
	Client() api_keystore.Client
}

type Op

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

type OpOption

type OpOption func(*Op)

func WithChangeAddress

func WithChangeAddress(v ids.ShortID) OpOption

func WithDryMode

func WithDryMode(b bool) OpOption

func WithPoll

func WithPoll(b bool) OpOption

func WithRewardAddress

func WithRewardAddress(v ids.ShortID) OpOption

func WithRewardShares

func WithRewardShares(v uint32) OpOption

func WithStakeAmount

func WithStakeAmount(v uint64) OpOption

type P

type P interface {
	Client() platformvm.Client
	Checker() internal_platformvm.Checker
	Balance(ctx context.Context, key key.Key) (uint64, error)
	CreateSubnet(
		ctx context.Context,
		key key.Key,
		opts ...OpOption,
	) (subnetID ids.ID, took time.Duration, err error)
	AddValidator(
		ctx context.Context,
		k key.Key,
		nodeID ids.ShortID,
		start time.Time,
		end time.Time,
		opts ...OpOption,
	) (took time.Duration, err error)
	AddSubnetValidator(
		ctx context.Context,
		k key.Key,
		subnetID ids.ID,
		nodeID ids.ShortID,
		start time.Time,
		end time.Time,
		weight uint64,
		opts ...OpOption,
	) (took time.Duration, err error)
	CreateBlockchain(
		ctx context.Context,
		key key.Key,
		subnetID ids.ID,
		chainName string,
		vmID ids.ID,
		vmGenesis []byte,
		opts ...OpOption,
	) (blkChainID ids.ID, took time.Duration, err error)
	GetValidator(
		ctx context.Context,
		rsubnetID ids.ID,
		nodeID ids.ShortID,
	) (start time.Time, end time.Time, err error)
}

Jump to

Keyboard shortcuts

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