platformvm

package
v1.16.45 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AwaitTxAccepted

func AwaitTxAccepted(
	c *Client,
	ctx context.Context,
	txID ids.ID,
	freq time.Duration,
	options ...rpc.Option,
) error

func GetDeactivationOwners

func GetDeactivationOwners(
	c *Client,
	ctx context.Context,
	validationIDs ...ids.ID,
) (map[ids.ID]fx.Owner, error)

GetDeactivationOwners returns a map of validation ID to deactivation owners

func GetNetOwners

func GetNetOwners(
	c *Client,
	ctx context.Context,
	chainIDs ...ids.ID,
) (map[ids.ID]fx.Owner, error)

GetNetOwners returns a map of chain ID to current chain's owner

func GetOwners

func GetOwners(
	c *Client,
	ctx context.Context,
	chainIDs []ids.ID,
	validationIDs []ids.ID,
) (map[ids.ID]fx.Owner, error)

GetOwners returns the union of GetNetOwners and GetDeactivationOwners.

Types

type APIBlockchain

type APIBlockchain struct {
	ID       ids.ID   `json:"id"`
	Name     string   `json:"name"`
	ChainID  ids.ID   `json:"chainID"`
	VMID     ids.ID   `json:"vmID"`
	FxIDs    []ids.ID `json:"fxIDs,omitempty"`
	Metadata string   `json:"metadata,omitempty"`
}

APIBlockchain represents a blockchain in the API response

type APINet

type APINet struct {
	ID          ids.ID      `json:"id"`
	ControlKeys []string    `json:"controlKeys"`
	Threshold   json.Uint32 `json:"threshold"`
}

APINet represents a net in the API

type Client

type Client struct {
	Requester rpc.EndpointRequester
	// contains filtered or unexported fields
}

func NewClient

func NewClient(uri string) *Client

func NewClientWithNetworkID

func NewClientWithNetworkID(uri string, networkID uint32) *Client

NewClientWithNetworkID returns a new platformvm.Client with the network ID set for proper bech32 address formatting

func (*Client) GetAtomicUTXOs

func (c *Client) 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)

GetAtomicUTXOs returns the byte representation of the atomic UTXOs controlled by addrs from sourceChain.

func (*Client) GetBalance deprecated

func (c *Client) GetBalance(ctx context.Context, addrs []ids.ShortID, options ...rpc.Option) (*GetBalanceResponse, error)

GetBalance returns the balance of addrs.

Deprecated: GetUTXOs should be used instead.

func (*Client) GetBlock

func (c *Client) GetBlock(ctx context.Context, blockID ids.ID, options ...rpc.Option) ([]byte, error)

GetBlock returns blockID.

func (*Client) GetBlockByHeight

func (c *Client) GetBlockByHeight(ctx context.Context, height uint64, options ...rpc.Option) ([]byte, error)

GetBlockByHeight returns the block at the given height.

func (*Client) GetBlockchainStatus

func (c *Client) GetBlockchainStatus(ctx context.Context, blockchainID string, options ...rpc.Option) (status.BlockchainStatus, error)

GetBlockchainStatus returns the current status of blockchainID.

func (*Client) GetBlockchains deprecated

func (c *Client) GetBlockchains(ctx context.Context, options ...rpc.Option) ([]APIBlockchain, error)

GetBlockchains returns the list of all blockchains on the platform.

Deprecated: Blockchains should be fetched from a dedicated indexer.

func (*Client) GetCurrentSupply

func (c *Client) GetCurrentSupply(ctx context.Context, chainID ids.ID, options ...rpc.Option) (uint64, uint64, error)

GetCurrentSupply returns an upper bound on the supply of LUX in the system along with the chain height.

func (*Client) GetCurrentValidators

func (c *Client) GetCurrentValidators(
	ctx context.Context,
	chainID ids.ID,
	nodeIDs []ids.NodeID,
	options ...rpc.Option,
) ([]ClientPermissionlessValidator, error)

GetCurrentValidators returns the list of current validators for chainID.

func (*Client) GetFeeConfig

func (c *Client) GetFeeConfig(ctx context.Context, options ...rpc.Option) (*gas.Config, error)

GetFeeConfig returns the dynamic fee config.

func (*Client) GetFeeState

func (c *Client) GetFeeState(ctx context.Context, options ...rpc.Option) (
	gas.State,
	gas.Price,
	time.Time,
	error,
)

GetFeeState returns the current fee state.

func (*Client) GetHeight

func (c *Client) GetHeight(ctx context.Context, options ...rpc.Option) (uint64, error)

GetHeight returns the current block height.

func (*Client) GetL1Validator

func (c *Client) GetL1Validator(
	ctx context.Context,
	validationID ids.ID,
	options ...rpc.Option,
) (L1Validator, uint64, error)

GetL1Validator returns the requested L1 validator with validationID and the height at which it was calculated.

func (*Client) GetMinStake

func (c *Client) GetMinStake(ctx context.Context, chainID ids.ID, options ...rpc.Option) (uint64, uint64, error)

GetMinStake returns the minimum staking amount in nLUX for validators and delegators respectively.

func (*Client) GetNet

func (c *Client) GetNet(ctx context.Context, chainID ids.ID, options ...rpc.Option) (GetNetClientResponse, error)

GetNet returns information about the specified chain.

func (*Client) GetNets deprecated

func (c *Client) GetNets(ctx context.Context, ids []ids.ID, options ...rpc.Option) ([]ClientNet, error)

GetNets returns information about the specified chains

Deprecated: Nets should be fetched from a dedicated indexer.

func (*Client) GetProposedHeight

func (c *Client) GetProposedHeight(ctx context.Context, options ...rpc.Option) (uint64, error)

GetProposedHeight returns the current height of this node's proposer VM.

func (*Client) GetRewardUTXOs deprecated

func (c *Client) GetRewardUTXOs(ctx context.Context, args *api.GetTxArgs, options ...rpc.Option) ([][]byte, error)

GetRewardUTXOs returns the reward UTXOs for a transaction.

Deprecated: GetRewardUTXOs should be fetched from a dedicated indexer.

func (*Client) GetStake deprecated

func (c *Client) GetStake(
	ctx context.Context,
	addrs []ids.ShortID,
	validatorsOnly bool,
	options ...rpc.Option,
) (map[ids.ID]uint64, [][]byte, error)

GetStake returns the amount of nLUX that addrs have cumulatively staked on the Primary Network.

Deprecated: Stake should be calculated using GetTx and GetCurrentValidators.

func (*Client) GetStakingAssetID

func (c *Client) GetStakingAssetID(ctx context.Context, chainID ids.ID, options ...rpc.Option) (ids.ID, error)

GetStakingAssetID returns the assetID of the asset used for staking on the chain corresponding to chainID.

func (*Client) GetTimestamp

func (c *Client) GetTimestamp(ctx context.Context, options ...rpc.Option) (time.Time, error)

GetTimestamp returns the current chain timestamp.

func (*Client) GetTotalStake

func (c *Client) GetTotalStake(ctx context.Context, chainID ids.ID, options ...rpc.Option) (uint64, error)

GetTotalStake returns the total amount (in nLUX) staked on the network.

func (*Client) GetTx

func (c *Client) GetTx(ctx context.Context, txID ids.ID, options ...rpc.Option) ([]byte, error)

GetTx returns the byte representation of txID.

func (*Client) GetTxStatus

func (c *Client) GetTxStatus(ctx context.Context, txID ids.ID, options ...rpc.Option) (*GetTxStatusResponse, error)

GetTxStatus returns the status of txID.

func (*Client) GetUTXOs

func (c *Client) GetUTXOs(
	ctx context.Context,
	addrs []ids.ShortID,
	limit uint32,
	startAddress ids.ShortID,
	startUTXOID ids.ID,
	options ...rpc.Option,
) ([][]byte, ids.ShortID, ids.ID, error)

GetUTXOs returns the byte representation of the UTXOs controlled by addrs.

func (*Client) GetValidatorFeeConfig

func (c *Client) GetValidatorFeeConfig(ctx context.Context, options ...rpc.Option) (*fee.Config, error)

GetValidatorFeeConfig returns the validator fee config.

func (*Client) GetValidatorFeeState

func (c *Client) GetValidatorFeeState(ctx context.Context, options ...rpc.Option) (
	gas.Gas,
	gas.Price,
	time.Time,
	error,
)

GetValidatorFeeState returns the current validator fee state.

func (*Client) GetValidatorsAt

func (c *Client) GetValidatorsAt(
	ctx context.Context,
	chainID ids.ID,
	height platformapi.Height,
	options ...rpc.Option,
) (map[ids.NodeID]*validators.GetValidatorOutput, error)

GetValidatorsAt returns the weights of the validator set of a provided chain at the specified height or at proposerVM height if set to platformapi.ProposedHeight.

func (*Client) IssueTx

func (c *Client) IssueTx(ctx context.Context, txBytes []byte, options ...rpc.Option) (ids.ID, error)

IssueTx issues the transaction and returns its txID.

func (*Client) SampleValidators

func (c *Client) SampleValidators(ctx context.Context, chainID ids.ID, sampleSize uint16, options ...rpc.Option) ([]ids.NodeID, error)

SampleValidators returns the nodeIDs of a sample of sampleSize validators from the current validator set for chainID.

func (*Client) SetNetworkID

func (c *Client) SetNetworkID(networkID uint32)

SetNetworkID sets the network ID for address formatting

func (*Client) ValidatedBy

func (c *Client) ValidatedBy(ctx context.Context, blockchainID ids.ID, options ...rpc.Option) (ids.ID, error)

ValidatedBy returns the chainID that validates blockchainID.

func (*Client) Validates

func (c *Client) Validates(ctx context.Context, chainID ids.ID, options ...rpc.Option) ([]ids.ID, error)

Validates returns the list of blockchains that are validated by chainID.

type ClientDelegator

type ClientDelegator struct {
	ClientStaker
	RewardOwner     *ClientOwner
	PotentialReward *uint64
}

ClientDelegator is the repr. of a delegator sent over client

type ClientL1Validator

type ClientL1Validator struct {
	ValidationID          *ids.ID
	RemainingBalanceOwner *ClientOwner
	DeactivationOwner     *ClientOwner
	MinNonce              *uint64
	Balance               *uint64
}

type ClientNet

type ClientNet struct {
	// ID of the chain
	ID ids.ID
	// Each element of [ControlKeys] the address of a public key.
	// A transaction to add a validator to this net requires
	// signatures from [Threshold] of these keys to be valid.
	ControlKeys []ids.ShortID
	Threshold   uint32
}

ClientNet is a representation of a net used in client methods

type ClientOwner

type ClientOwner struct {
	Locktime  uint64
	Threshold uint32
	Addresses []ids.ShortID
}

ClientOwner is the repr. of a reward owner sent over client

type ClientPermissionlessValidator

type ClientPermissionlessValidator struct {
	ClientStaker
	ClientL1Validator
	ValidationRewardOwner  *ClientOwner
	DelegationRewardOwner  *ClientOwner
	PotentialReward        *uint64
	AccruedDelegateeReward *uint64
	DelegationFee          float32
	// Uptime is deprecated for Net Validators.
	// It will be available only for Primary Network Validators.
	Uptime *float32
	// Connected is deprecated for Net Validators.
	// It will be available only for Primary Network Validators.
	Connected *bool
	Signer    *signer.ProofOfPossession
	// The delegators delegating to this validator
	DelegatorCount  *uint64
	DelegatorWeight *uint64
	Delegators      []ClientDelegator
}

ClientPermissionlessValidator is the repr. of a permissionless validator sent over client

type ClientStaker

type ClientStaker struct {
	// the txID of the transaction that added this staker.
	TxID ids.ID
	// the Unix time when they start staking
	StartTime uint64
	// the Unix time when they are done staking
	EndTime uint64
	// the validator weight when sampling validators
	Weight uint64
	// the node ID of the staker
	NodeID ids.NodeID
}

ClientStaker is the representation of a staker sent via client.

type GetBalanceRequest

type GetBalanceRequest struct {
	Addresses []string `json:"addresses"`
}

GetBalanceRequest is the request for GetBalance

type GetBalanceResponse

type GetBalanceResponse struct {
	Balance            json.Uint64 `json:"balance"`
	Unlocked           json.Uint64 `json:"unlocked"`
	LockedStakeable    json.Uint64 `json:"lockedStakeable"`
	LockedNotStakeable json.Uint64 `json:"lockedNotStakeable"`
	UTXOIDs            []ids.ID    `json:"utxoIDs"`
}

GetBalanceResponse is the response from GetBalance

type GetBlockchainStatusArgs

type GetBlockchainStatusArgs struct {
	BlockchainID string `json:"blockchainID"`
}

GetBlockchainStatusArgs is the request for GetBlockchainStatus

type GetBlockchainStatusReply

type GetBlockchainStatusReply struct {
	Status status.BlockchainStatus `json:"status"`
}

GetBlockchainStatusReply is the response from GetBlockchainStatus

type GetBlockchainsReply

type GetBlockchainsReply struct {
	Blockchains []APIBlockchain `json:"blockchains"`
}

GetBlockchainsReply is the response from GetBlockchains

type GetBlockchainsResponse

type GetBlockchainsResponse struct {
	Blockchains []APIBlockchain `json:"blockchains"`
}

GetBlockchainsResponse is the response from GetBlockchains

type GetCurrentSupplyArgs

type GetCurrentSupplyArgs struct {
	ChainID ids.ID `json:"chainID"`
}

GetCurrentSupplyArgs is the request for GetCurrentSupply

type GetCurrentSupplyReply

type GetCurrentSupplyReply struct {
	Supply json.Uint64 `json:"supply"`
	Height json.Uint64 `json:"height"`
}

GetCurrentSupplyReply is the response from GetCurrentSupply

type GetCurrentValidatorsArgs

type GetCurrentValidatorsArgs struct {
	ChainID ids.ID       `json:"chainID"`
	NodeIDs []ids.NodeID `json:"nodeIDs"`
}

GetCurrentValidatorsArgs is the request for GetCurrentValidators

type GetCurrentValidatorsReply

type GetCurrentValidatorsReply struct {
	Validators []interface{} `json:"validators"`
}

GetCurrentValidatorsReply is the response from GetCurrentValidators

type GetFeeConfigReply

type GetFeeConfigReply struct {
	GasConfig interface{} `json:"gasConfig"`
	GasPrice  interface{} `json:"gasPrice"`
	Timestamp time.Time   `json:"timestamp"`
}

GetFeeConfigReply is the response from GetFeeConfig

type GetFeeStateReply

type GetFeeStateReply struct {
	gas.State
	Price gas.Price `json:"price"`
	Time  time.Time `json:"timestamp"`
}

GetFeeStateReply is the response from GetFeeState

type GetL1ValidatorArgs

type GetL1ValidatorArgs struct {
	ValidationID ids.ID `json:"validationID"`
}

GetL1ValidatorArgs is the request for GetL1Validator

type GetL1ValidatorReply

type GetL1ValidatorReply struct {
	ChainID               ids.ID           `json:"chainID"`
	NodeID                ids.NodeID       `json:"nodeID"`
	PublicKey             *[]byte          `json:"publicKey,omitempty"`
	RemainingBalanceOwner L1ValidatorOwner `json:"remainingBalanceOwner"`
	DeactivationOwner     L1ValidatorOwner `json:"deactivationOwner"`
	StartTime             json.Uint64      `json:"startTime"`
	Weight                json.Uint64      `json:"weight"`
	MinNonce              *json.Uint64     `json:"minNonce,omitempty"`
	Balance               *json.Uint64     `json:"balance,omitempty"`
	Height                json.Uint64      `json:"height"`
}

GetL1ValidatorReply is the response from GetL1Validator

type GetMinStakeArgs

type GetMinStakeArgs struct {
	ChainID ids.ID `json:"chainID"`
}

GetMinStakeArgs is the request for GetMinStake

type GetMinStakeReply

type GetMinStakeReply struct {
	MinValidatorStake json.Uint64 `json:"minValidatorStake"`
	MinDelegatorStake json.Uint64 `json:"minDelegatorStake"`
}

GetMinStakeReply is the response from GetMinStake

type GetNetArgs

type GetNetArgs struct {
	ChainID ids.ID `json:"chainID"`
}

GetNetArgs is the request for GetNet

type GetNetClientResponse

type GetNetClientResponse struct {
	// whether it is permissioned or not
	IsPermissioned bool
	// net auth information for a permissioned chain
	ControlKeys []ids.ShortID
	Threshold   uint32
	Locktime    uint64
	// net transformation tx ID for a permissionless chain
	NetTransformationTxID ids.ID
	// chain conversion information for an L1
	ConversionID   ids.ID
	ManagerChainID ids.ID
	ManagerAddress []byte
}

GetNetClientResponse is the response from calling GetNet on the client

type GetNetResponse

type GetNetResponse struct {
	IsPermissioned        bool        `json:"isPermissioned"`
	ControlKeys           []string    `json:"controlKeys"`
	Threshold             json.Uint32 `json:"threshold"`
	Locktime              json.Uint64 `json:"locktime"`
	NetTransformationTxID ids.ID      `json:"netTransformationTxID"`
	ConversionID          ids.ID      `json:"conversionID"`
	ManagerChainID        ids.ID      `json:"managerChainID"`
	ManagerAddress        []byte      `json:"managerAddress"`
}

GetNetResponse is the response from GetNet

type GetNetsArgs

type GetNetsArgs struct {
	IDs []ids.ID `json:"ids"`
}

GetNetsArgs is the request for GetNets

type GetNetsResponse

type GetNetsResponse struct {
	Nets []APINet `json:"nets"`
}

GetNetsResponse is the response from GetNets

type GetRewardUTXOsReply

type GetRewardUTXOsReply struct {
	UTXOs    []string            `json:"utxos"`
	Encoding formatting.Encoding `json:"encoding"`
}

GetRewardUTXOsReply is the response from GetRewardUTXOs

type GetStakeArgs

type GetStakeArgs struct {
	JSONAddresses  interface{}         `json:"addresses"`
	ValidatorsOnly bool                `json:"validatorsOnly"`
	Encoding       formatting.Encoding `json:"encoding"`
}

GetStakeArgs is the request for GetStake

type GetStakeReply

type GetStakeReply struct {
	Stakeds  map[ids.ID]json.Uint64 `json:"stakeds"`
	Outputs  []string               `json:"stakedOutputs"`
	Encoding formatting.Encoding    `json:"encoding"`
}

GetStakeReply is the response from GetStake

type GetStakingAssetIDArgs

type GetStakingAssetIDArgs struct {
	ChainID ids.ID `json:"chainID"`
}

GetStakingAssetIDArgs is the request for GetStakingAssetID

type GetStakingAssetIDResponse

type GetStakingAssetIDResponse struct {
	AssetID ids.ID `json:"assetID"`
}

GetStakingAssetIDResponse is the response from GetStakingAssetID

type GetTimestampReply

type GetTimestampReply struct {
	Timestamp time.Time `json:"timestamp"`
}

GetTimestampReply is the response from GetTimestamp

type GetTotalStakeArgs

type GetTotalStakeArgs struct {
	ChainID ids.ID `json:"chainID"`
}

GetTotalStakeArgs is the request for GetTotalStake

type GetTotalStakeReply

type GetTotalStakeReply struct {
	Stake  json.Uint64 `json:"stake,omitempty"`
	Weight json.Uint64 `json:"weight,omitempty"`
}

GetTotalStakeReply is the response from GetTotalStake

type GetTxStatusArgs

type GetTxStatusArgs struct {
	TxID ids.ID `json:"txID"`
}

GetTxStatusArgs is the request for GetTxStatus

type GetTxStatusResponse

type GetTxStatusResponse struct {
	Status status.Status `json:"status"`
	Reason string        `json:"reason,omitempty"`
}

GetTxStatusResponse is the response from GetTxStatus

type GetValidatorFeeStateReply

type GetValidatorFeeStateReply struct {
	Excess gas.Gas   `json:"excess"`
	Price  gas.Price `json:"price"`
	Time   time.Time `json:"timestamp"`
}

GetValidatorFeeStateReply is the response from GetValidatorFeeState

type GetValidatorsAtArgs

type GetValidatorsAtArgs struct {
	Height  interface{} `json:"height"`
	ChainID ids.ID      `json:"chainID"`
}

GetValidatorsAtArgs is the request for GetValidatorsAt

type GetValidatorsAtReply

type GetValidatorsAtReply struct {
	Validators map[ids.NodeID]*validators.GetValidatorOutput `json:"validators"`
}

GetValidatorsAtReply is the response from GetValidatorsAt

type L1Validator

type L1Validator struct {
	ChainID               ids.ID
	NodeID                ids.NodeID
	PublicKey             *bls.PublicKey
	RemainingBalanceOwner *secp256k1fx.OutputOwners
	DeactivationOwner     *secp256k1fx.OutputOwners
	StartTime             uint64
	Weight                uint64
	MinNonce              uint64
	// Balance is the remaining amount of LUX this L1 validator has for paying
	// the continuous fee.
	Balance uint64
}

L1Validator is the response from calling GetL1Validator on the API client.

type L1ValidatorOwner

type L1ValidatorOwner struct {
	Locktime  json.Uint64 `json:"locktime"`
	Threshold json.Uint32 `json:"threshold"`
	Addresses []string    `json:"addresses"`
}

L1ValidatorOwner represents an owner in an L1 validator response

type SampleValidatorsArgs

type SampleValidatorsArgs struct {
	ChainID ids.ID      `json:"chainID"`
	Size    json.Uint16 `json:"size"`
}

SampleValidatorsArgs is the request for SampleValidators

type SampleValidatorsReply

type SampleValidatorsReply struct {
	Validators []ids.NodeID `json:"validators"`
}

SampleValidatorsReply is the response from SampleValidators

type ValidatedByArgs

type ValidatedByArgs struct {
	BlockchainID ids.ID `json:"blockchainID"`
}

ValidatedByArgs is the request for ValidatedBy

type ValidatedByResponse

type ValidatedByResponse struct {
	ChainID ids.ID `json:"chainID"`
}

ValidatedByResponse is the response from ValidatedBy

type ValidatesArgs

type ValidatesArgs struct {
	ChainID ids.ID `json:"chainID"`
}

ValidatesArgs is the request for Validates

type ValidatesResponse

type ValidatesResponse struct {
	BlockchainIDs []ids.ID `json:"blockchainIDs"`
}

ValidatesResponse is the response from Validates

Jump to

Keyboard shortcuts

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