Documentation
¶
Index ¶
- Variables
- func AwaitTxAccepted(c Client, ctx context.Context, txID ids.ID, freq time.Duration, ...) error
- type APIBlockchain
- type APINet
- type Client
- type ClientDelegator
- type ClientNet
- type ClientOwner
- type ClientPermissionlessValidator
- type ClientStaker
- type ExportKeyArgs
- type ExportKeyReply
- type Factory
- type GetBalanceRequest
- type GetBalanceResponse
- type GetBlockchainStatusArgs
- type GetBlockchainStatusReply
- type GetBlockchainsResponse
- type GetCurrentSupplyArgs
- type GetCurrentSupplyReply
- type GetCurrentValidatorsArgs
- type GetCurrentValidatorsReply
- type GetMinStakeArgs
- type GetMinStakeReply
- type GetRewardUTXOsReply
- type GetStakeArgs
- type GetStakeReply
- type GetStakingAssetIDArgs
- type GetStakingAssetIDResponse
- type GetSubnetArgs
- type GetSubnetClientResponse
- type GetSubnetResponse
- type GetSubnetsArgs
- type GetSubnetsResponse
- type GetTimestampReply
- type GetTotalStakeArgs
- type GetTotalStakeReply
- type GetTxStatusArgs
- type GetTxStatusResponse
- type GetValidatorsAtArgs
- type GetValidatorsAtReply
- type Index
- type SampleValidatorsArgs
- type SampleValidatorsReply
- type Service
- func (s *Service) ExportKey(_ *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error
- func (s *Service) GetBalance(_ *http.Request, args *GetBalanceRequest, response *GetBalanceResponse) error
- func (s *Service) GetBlock(_ *http.Request, args *api.GetBlockArgs, response *api.GetBlockResponse) error
- func (s *Service) GetBlockByHeight(_ *http.Request, args *api.GetBlockByHeightArgs, ...) error
- func (s *Service) GetBlockchainStatus(r *http.Request, args *GetBlockchainStatusArgs, ...) error
- func (s *Service) GetBlockchains(_ *http.Request, _ *struct{}, response *GetBlockchainsResponse) error
- func (s *Service) GetCurrentSupply(r *http.Request, args *GetCurrentSupplyArgs, reply *GetCurrentSupplyReply) error
- func (s *Service) GetCurrentValidators(_ *http.Request, args *GetCurrentValidatorsArgs, ...) error
- func (s *Service) GetHeight(r *http.Request, _ *struct{}, response *api.GetHeightResponse) error
- func (s *Service) GetMinStake(_ *http.Request, args *GetMinStakeArgs, reply *GetMinStakeReply) error
- func (s *Service) GetRewardUTXOs(_ *http.Request, args *api.GetTxArgs, reply *GetRewardUTXOsReply) error
- func (s *Service) GetStake(_ *http.Request, args *GetStakeArgs, response *GetStakeReply) error
- func (s *Service) GetStakingAssetID(_ *http.Request, args *GetStakingAssetIDArgs, ...) error
- func (s *Service) GetSubnet(_ *http.Request, args *GetSubnetArgs, response *GetSubnetResponse) error
- func (s *Service) GetSubnets(_ *http.Request, args *GetSubnetsArgs, response *GetSubnetsResponse) error
- func (s *Service) GetTimestamp(_ *http.Request, _ *struct{}, reply *GetTimestampReply) error
- func (s *Service) GetTotalStake(_ *http.Request, args *GetTotalStakeArgs, reply *GetTotalStakeReply) error
- func (s *Service) GetTx(_ *http.Request, args *api.GetTxArgs, response *api.GetTxReply) error
- func (s *Service) GetTxStatus(_ *http.Request, args *GetTxStatusArgs, response *GetTxStatusResponse) error
- func (s *Service) GetUTXOs(_ *http.Request, args *api.GetUTXOsArgs, response *api.GetUTXOsReply) error
- func (s *Service) GetValidatorsAt(r *http.Request, args *GetValidatorsAtArgs, reply *GetValidatorsAtReply) error
- func (s *Service) IssueTx(_ *http.Request, args *api.FormattedTx, response *api.JSONTxID) error
- func (s *Service) ListAddresses(_ *http.Request, args *api.UserPass, response *api.JSONAddresses) error
- func (s *Service) SampleValidators(_ *http.Request, args *SampleValidatorsArgs, reply *SampleValidatorsReply) error
- func (s *Service) ValidatedBy(r *http.Request, args *ValidatedByArgs, response *ValidatedByResponse) error
- func (s *Service) Validates(_ *http.Request, args *ValidatesArgs, response *ValidatesResponse) error
- type TestAppSender
- func (t *TestAppSender) SendAppGossip(ctx context.Context, appGossipBytes []byte) error
- func (t *TestAppSender) SendAppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (t *TestAppSender) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (t *TestAppSender) SendCrossChainAppError(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, ...) error
- func (t *TestAppSender) SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, appRequestBytes []byte) error
- func (t *TestAppSender) SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, appResponseBytes []byte) error
- type VM
- func (vm *VM) BuildBlock(ctx context.Context) (linearblock.Block, error)
- func (vm *VM) Clock() *mockable.Clock
- func (vm *VM) CodecRegistry() codec.Registry
- func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error
- func (vm *VM) ConnectedSubnet(_ context.Context, nodeID ids.NodeID, netID ids.ID) error
- func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error)
- func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error
- func (vm *VM) GetBlock(_ context.Context, blkID ids.ID) (linearblock.Block, error)
- func (vm *VM) GetBlockIDAtHeight(_ context.Context, height uint64) (ids.ID, error)
- func (vm *VM) GetChainID(context.Context) (ids.ID, error)
- func (vm *VM) HealthCheck(context.Context) (interface{}, error)
- func (vm *VM) Initialize(ctx context.Context, chainCtxIntf interface{}, dbManagerIntf interface{}, ...) error
- func (vm *VM) LastAccepted(context.Context) (ids.ID, error)
- func (vm *VM) Logger() log.Logger
- func (vm *VM) NewHTTPHandler(context.Context) (http.Handler, error)
- func (vm *VM) ParseBlock(_ context.Context, b []byte) (linearblock.Block, error)
- func (vm *VM) SetPreference(_ context.Context, blkID ids.ID) error
- func (vm *VM) SetState(_ context.Context, state interfaces.State) error
- func (vm *VM) Shutdown(context.Context) error
- func (*VM) Version(context.Context) (string, error)
- func (vm *VM) WaitForEvent(ctx context.Context) (interface{}, error)
- type ValidatedByArgs
- type ValidatedByResponse
- type ValidatesArgs
- type ValidatesResponse
Constants ¶
This section is empty.
Variables ¶
var MinValidatorCount = 1
MinValidatorCount sets the minimum number of validators required
var RequireValidatorApproval = false
RequireValidatorApproval determines if multiple validators must approve
var SingleValidatorMode = true
SingleValidatorMode enables single validator operation without build tags
Functions ¶
Types ¶
type APIBlockchain ¶
type APIBlockchain struct {
// Blockchain's ID
ID ids.ID `json:"id"`
// Blockchain's (non-unique) human-readable name
Name string `json:"name"`
// Net that validates the blockchain
NetID ids.ID `json:"netID"`
// Virtual Machine the blockchain runs
VMID ids.ID `json:"vmID"`
}
APIBlockchain is the representation of a blockchain used in API calls
type APINet ¶ added in v1.16.56
type APINet struct {
// ID of the subnet
ID ids.ID `json:"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 []string `json:"controlKeys"`
Threshold avajson.Uint32 `json:"threshold"`
}
APINet is a representation of a net used in API calls
type Client ¶ added in v0.1.1
type Client interface {
// GetHeight returns the current block height of the P Chain
GetHeight(ctx context.Context, options ...rpc.Option) (uint64, error)
// ExportKey returns the private key corresponding to [address] from [user]'s account
//
// Deprecated: Keys should no longer be stored on the node.
ExportKey(ctx context.Context, user api.UserPass, address ids.ShortID, options ...rpc.Option) (*secp256k1.PrivateKey, error)
// GetBalance returns the balance of [addrs] on the P Chain
//
// Deprecated: GetUTXOs should be used instead.
GetBalance(ctx context.Context, addrs []ids.ShortID, options ...rpc.Option) (*GetBalanceResponse, error)
// ListAddresses returns an array of platform addresses controlled by [user]
//
// Deprecated: Keys should no longer be stored on the node.
ListAddresses(ctx context.Context, user api.UserPass, options ...rpc.Option) ([]ids.ShortID, error)
// GetUTXOs returns the byte representation of the UTXOs controlled by [addrs]
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 returns the byte representation of the atomic UTXOs controlled by [addrs]
// from [sourceChain]
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)
// GetNet returns information about the specified subnet
GetSubnet(ctx context.Context, netID ids.ID, options ...rpc.Option) (GetSubnetClientResponse, error)
// GetSubnets returns information about the specified subnets
//
// Deprecated: Subnets should be fetched from a dedicated indexer.
GetSubnets(ctx context.Context, netIDs []ids.ID, options ...rpc.Option) ([]ClientNet, error)
// GetStakingAssetID returns the assetID of the asset used for staking on
// net corresponding to [netID]
GetStakingAssetID(ctx context.Context, netID ids.ID, options ...rpc.Option) (ids.ID, error)
// GetCurrentValidators returns the list of current validators for net with ID [netID]
GetCurrentValidators(ctx context.Context, netID ids.ID, nodeIDs []ids.NodeID, options ...rpc.Option) ([]ClientPermissionlessValidator, error)
// GetCurrentSupply returns an upper bound on the supply of LUX in the system along with the P-chain height
GetCurrentSupply(ctx context.Context, netID ids.ID, options ...rpc.Option) (uint64, uint64, error)
// SampleValidators returns the nodeIDs of a sample of [sampleSize] validators from the current validator set for net with ID [netID]
SampleValidators(ctx context.Context, netID ids.ID, sampleSize uint16, options ...rpc.Option) ([]ids.NodeID, error)
// GetBlockchainStatus returns the current status of blockchain with ID: [blockchainID]
GetBlockchainStatus(ctx context.Context, blockchainID string, options ...rpc.Option) (status.BlockchainStatus, error)
// ValidatedBy returns the ID of the Net that validates [blockchainID]
ValidatedBy(ctx context.Context, blockchainID ids.ID, options ...rpc.Option) (ids.ID, error)
// Validates returns the list of blockchains that are validated by the net with ID [netID]
Validates(ctx context.Context, netID ids.ID, options ...rpc.Option) ([]ids.ID, error)
// GetBlockchains returns the list of blockchains on the platform
//
// Deprecated: Blockchains should be fetched from a dedicated indexer.
GetBlockchains(ctx context.Context, options ...rpc.Option) ([]APIBlockchain, error)
// IssueTx issues the transaction and returns its txID
IssueTx(ctx context.Context, tx []byte, options ...rpc.Option) (ids.ID, error)
// GetTx returns the byte representation of the transaction corresponding to [txID]
GetTx(ctx context.Context, txID ids.ID, options ...rpc.Option) ([]byte, error)
// GetTxStatus returns the status of the transaction corresponding to [txID]
GetTxStatus(ctx context.Context, txID ids.ID, options ...rpc.Option) (*GetTxStatusResponse, 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.
GetStake(
ctx context.Context,
addrs []ids.ShortID,
validatorsOnly bool,
options ...rpc.Option,
) (map[ids.ID]uint64, [][]byte, error)
// GetMinStake returns the minimum staking amount in nLUX for validators
// and delegators respectively
GetMinStake(ctx context.Context, netID ids.ID, options ...rpc.Option) (uint64, uint64, error)
// GetTotalStake returns the total amount (in nLUX) staked on the network
GetTotalStake(ctx context.Context, netID ids.ID, options ...rpc.Option) (uint64, error)
// GetRewardUTXOs returns the reward UTXOs for a transaction
//
// Deprecated: GetRewardUTXOs should be fetched from a dedicated indexer.
GetRewardUTXOs(context.Context, *api.GetTxArgs, ...rpc.Option) ([][]byte, error)
// GetTimestamp returns the current chain timestamp
GetTimestamp(ctx context.Context, options ...rpc.Option) (time.Time, error)
// GetValidatorsAt returns the weights of the validator set of a provided
// net at the specified height.
GetValidatorsAt(
ctx context.Context,
netID ids.ID,
height uint64,
options ...rpc.Option,
) (map[ids.NodeID]*validators.GetValidatorOutput, error)
// GetBlock returns the block with the given id.
GetBlock(ctx context.Context, blockID ids.ID, options ...rpc.Option) ([]byte, error)
// GetBlockByHeight returns the block at the given [height].
GetBlockByHeight(ctx context.Context, height uint64, options ...rpc.Option) ([]byte, error)
}
Client interface for interacting with the P Chain endpoint
type ClientDelegator ¶ added in v0.1.1
type ClientDelegator struct {
ClientStaker
RewardOwner *ClientOwner
PotentialReward *uint64
}
ClientDelegator is the repr. of a delegator sent over client
type ClientNet ¶ added in v1.16.56
type ClientNet struct {
// ID of the subnet
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 ¶ added in v0.1.1
ClientOwner is the repr. of a reward owner sent over client
type ClientPermissionlessValidator ¶ added in v0.1.1
type ClientPermissionlessValidator struct {
ClientStaker
ValidationRewardOwner *ClientOwner
DelegationRewardOwner *ClientOwner
PotentialReward *uint64
AccruedDelegateeReward *uint64
DelegationFee float32
Uptime *float32
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 ¶ added in v0.1.1
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 amount of tokens being staked.
StakeAmount *uint64
// the node ID of the staker
NodeID ids.NodeID
}
ClientStaker is the representation of a staker sent via client.
type ExportKeyArgs ¶ added in v1.1.11
ExportKeyArgs are arguments for ExportKey
type ExportKeyReply ¶ added in v1.1.11
type ExportKeyReply struct {
// The decrypted PrivateKey for the Address provided in the arguments
PrivateKey *secp256k1.PrivateKey `json:"privateKey"`
}
ExportKeyReply is the response for ExportKey
type GetBalanceRequest ¶ added in v0.1.1
type GetBalanceRequest struct {
Addresses []string `json:"addresses"`
}
type GetBalanceResponse ¶ added in v0.1.1
type GetBalanceResponse struct {
// Balance, in nLUX, of the address
Balance avajson.Uint64 `json:"balance"`
Unlocked avajson.Uint64 `json:"unlocked"`
LockedStakeable avajson.Uint64 `json:"lockedStakeable"`
LockedNotStakeable avajson.Uint64 `json:"lockedNotStakeable"`
Balances map[ids.ID]avajson.Uint64 `json:"balances"`
Unlockeds map[ids.ID]avajson.Uint64 `json:"unlockeds"`
LockedStakeables map[ids.ID]avajson.Uint64 `json:"lockedStakeables"`
LockedNotStakeables map[ids.ID]avajson.Uint64 `json:"lockedNotStakeables"`
UTXOIDs []*lux.UTXOID `json:"utxoIDs"`
}
Note: We explicitly duplicate LUX out of the maps to ensure backwards compatibility.
type GetBlockchainStatusArgs ¶
type GetBlockchainStatusArgs struct {
BlockchainID string `json:"blockchainID"`
}
GetBlockchainStatusArgs is the arguments for calling GetBlockchainStatus [BlockchainID] is the ID of or an alias of the blockchain to get the status of.
type GetBlockchainStatusReply ¶
type GetBlockchainStatusReply struct {
Status status.BlockchainStatus `json:"status"`
}
GetBlockchainStatusReply is the reply from calling GetBlockchainStatus [Status] is the blockchain's status.
type GetBlockchainsResponse ¶
type GetBlockchainsResponse struct {
// blockchains that exist
Blockchains []APIBlockchain `json:"blockchains"`
}
GetBlockchainsResponse is the response from a call to GetBlockchains
type GetCurrentSupplyArgs ¶ added in v0.1.1
GetCurrentSupplyArgs are the arguments for calling GetCurrentSupply
type GetCurrentSupplyReply ¶ added in v0.1.1
type GetCurrentSupplyReply struct {
Supply avajson.Uint64 `json:"supply"`
Height avajson.Uint64 `json:"height"`
}
GetCurrentSupplyReply are the results from calling GetCurrentSupply
type GetCurrentValidatorsArgs ¶
type GetCurrentValidatorsArgs struct {
// Net we're listing the validators of
// If omitted, defaults to primary network
NetID ids.ID `json:"netID"`
// NodeIDs of validators to request. If [NodeIDs]
// is empty, it fetches all current validators. If
// some nodeIDs are not currently validators, they
// will be omitted from the response.
NodeIDs []ids.NodeID `json:"nodeIDs"`
}
GetCurrentValidatorsArgs are the arguments for calling GetCurrentValidators
type GetCurrentValidatorsReply ¶
type GetCurrentValidatorsReply struct {
Validators []interface{} `json:"validators"`
}
GetCurrentValidatorsReply are the results from calling GetCurrentValidators. Each validator contains a list of delegators to itself.
type GetMinStakeArgs ¶ added in v0.1.1
GetMinStakeArgs are the arguments for calling GetMinStake.
type GetMinStakeReply ¶ added in v0.1.1
type GetMinStakeReply struct {
// The minimum amount of tokens one must bond to be a validator
MinValidatorStake avajson.Uint64 `json:"minValidatorStake"`
// Minimum stake, in nLUX, that can be delegated on the primary network
MinDelegatorStake avajson.Uint64 `json:"minDelegatorStake"`
}
GetMinStakeReply is the response from calling GetMinStake.
type GetRewardUTXOsReply ¶ added in v0.1.1
type GetRewardUTXOsReply struct {
// Number of UTXOs returned
NumFetched avajson.Uint64 `json:"numFetched"`
// The UTXOs
UTXOs []string `json:"utxos"`
// Encoding specifies the encoding format the UTXOs are returned in
Encoding formatting.Encoding `json:"encoding"`
}
GetRewardUTXOsReply defines the GetRewardUTXOs replies returned from the API
type GetStakeArgs ¶ added in v0.1.1
type GetStakeArgs struct {
api.JSONAddresses
ValidatorsOnly bool `json:"validatorsOnly"`
Encoding formatting.Encoding `json:"encoding"`
}
type GetStakeReply ¶ added in v0.1.1
type GetStakeReply struct {
Staked avajson.Uint64 `json:"staked"`
Stakeds map[ids.ID]avajson.Uint64 `json:"stakeds"`
// String representation of staked outputs
// Each is of type lux.TransferableOutput
Outputs []string `json:"stakedOutputs"`
// Encoding of [Outputs]
Encoding formatting.Encoding `json:"encoding"`
}
GetStakeReply is the response from calling GetStake.
type GetStakingAssetIDArgs ¶ added in v0.1.1
GetStakingAssetIDArgs are the arguments to GetStakingAssetID
type GetStakingAssetIDResponse ¶ added in v0.1.1
GetStakingAssetIDResponse is the response from calling GetStakingAssetID
type GetSubnetArgs ¶ added in v0.1.1
type GetSubnetArgs struct {
// ID of the net to retrieve information about
NetID ids.ID `json:"netID"`
}
GetSubnetArgs are the arguments to GetSubnet
type GetSubnetClientResponse ¶ added in v0.1.1
type GetSubnetClientResponse struct {
// whether it is permissioned or not
IsPermissioned bool
// net auth information for a permissioned subnet
ControlKeys []ids.ShortID
Threshold uint32
Locktime uint64
// net transformation tx ID for a permissionless subnet
SubnetTransformationTxID ids.ID
}
GetSubnetClientResponse is the response from calling GetNet on the client
type GetSubnetResponse ¶ added in v0.1.1
type GetSubnetResponse struct {
// whether it is permissioned or not
IsPermissioned bool `json:"isPermissioned"`
// net auth information for a permissioned subnet
ControlKeys []string `json:"controlKeys"`
Threshold avajson.Uint32 `json:"threshold"`
Locktime avajson.Uint64 `json:"locktime"`
// net transformation tx ID for a permissionless subnet
SubnetTransformationTxID ids.ID `json:"subnetTransformationTxID"`
}
GetSubnetResponse is the response from calling GetSubnet
type GetSubnetsArgs ¶
type GetSubnetsArgs struct {
// IDs of the subnets to retrieve information about
// If omitted, gets all subnets
IDs []ids.ID `json:"ids"`
}
GetSubnetsArgs are the arguments to GetSubnets
type GetSubnetsResponse ¶
type GetSubnetsResponse struct {
// Each element is a net that exists
// Null if there are no subnets other than the primary network
Subnets []APINet `json:"subnets"`
}
GetSubnetsResponse is the response from calling GetSubnets
type GetTimestampReply ¶ added in v0.1.1
GetTimestampReply is the response from GetTimestamp
type GetTotalStakeArgs ¶ added in v0.1.1
type GetTotalStakeArgs struct {
// Net we're getting the total stake
// If omitted returns Primary network weight
NetID ids.ID `json:"netID"`
}
GetTotalStakeArgs are the arguments for calling GetTotalStake
type GetTotalStakeReply ¶ added in v0.1.1
type GetTotalStakeReply struct {
// Deprecated: Use Weight instead.
Stake avajson.Uint64 `json:"stake"`
Weight avajson.Uint64 `json:"weight"`
}
GetTotalStakeReply is the response from calling GetTotalStake.
type GetTxStatusArgs ¶ added in v0.1.1
type GetTxStatusResponse ¶ added in v0.1.1
type GetValidatorsAtArgs ¶ added in v0.1.1
type GetValidatorsAtArgs struct {
Height avajson.Uint64 `json:"height"`
NetID ids.ID `json:"netID"`
}
GetValidatorsAtArgs is the response from GetValidatorsAt
type GetValidatorsAtReply ¶ added in v0.1.1
type GetValidatorsAtReply struct {
Validators map[ids.NodeID]*validators.GetValidatorOutput
}
GetValidatorsAtReply is the response from GetValidatorsAt
func (*GetValidatorsAtReply) MarshalJSON ¶ added in v0.1.1
func (v *GetValidatorsAtReply) MarshalJSON() ([]byte, error)
func (*GetValidatorsAtReply) UnmarshalJSON ¶ added in v0.1.1
func (v *GetValidatorsAtReply) UnmarshalJSON(b []byte) error
type Index ¶ added in v0.1.1
type Index struct {
Address string `json:"address"` // The address as a string
UTXO string `json:"utxo"` // The UTXO ID as a string
}
Index is an address and an associated UTXO. Marks a starting or stopping point when fetching UTXOs. Used for pagination.
type SampleValidatorsArgs ¶
type SampleValidatorsArgs struct {
// Number of validators in the sample
Size avajson.Uint16 `json:"size"`
// ID of net to sample validators from
// If omitted, defaults to the primary network
NetID ids.ID `json:"netID"`
}
SampleValidatorsArgs are the arguments for calling SampleValidators
type SampleValidatorsReply ¶
SampleValidatorsReply are the results from calling Sample
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service defines the API calls that can be made to the platform chain
func (*Service) ExportKey ¶ added in v1.1.11
func (s *Service) ExportKey(_ *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error
ExportKey returns a private key from the provided user
func (*Service) GetBalance ¶ added in v0.1.1
func (s *Service) GetBalance(_ *http.Request, args *GetBalanceRequest, response *GetBalanceResponse) error
GetBalance gets the balance of an address
func (*Service) GetBlock ¶ added in v0.1.1
func (s *Service) GetBlock(_ *http.Request, args *api.GetBlockArgs, response *api.GetBlockResponse) error
func (*Service) GetBlockByHeight ¶ added in v0.1.1
func (s *Service) GetBlockByHeight(_ *http.Request, args *api.GetBlockByHeightArgs, response *api.GetBlockResponse) error
GetBlockByHeight returns the block at the given height.
func (*Service) GetBlockchainStatus ¶
func (s *Service) GetBlockchainStatus(r *http.Request, args *GetBlockchainStatusArgs, reply *GetBlockchainStatusReply) error
GetBlockchainStatus gets the status of a blockchain with the ID [args.BlockchainID].
func (*Service) GetBlockchains ¶
func (s *Service) GetBlockchains(_ *http.Request, _ *struct{}, response *GetBlockchainsResponse) error
GetBlockchains returns all of the blockchains that exist
func (*Service) GetCurrentSupply ¶ added in v0.1.1
func (s *Service) GetCurrentSupply(r *http.Request, args *GetCurrentSupplyArgs, reply *GetCurrentSupplyReply) error
GetCurrentSupply returns an upper bound on the supply of LUX in the system
func (*Service) GetCurrentValidators ¶
func (s *Service) GetCurrentValidators(_ *http.Request, args *GetCurrentValidatorsArgs, reply *GetCurrentValidatorsReply) error
GetCurrentValidators returns the current validators. If a single nodeID is provided, full delegators information is also returned. Otherwise only delegators' number and total weight is returned.
func (*Service) GetMinStake ¶ added in v0.1.1
func (s *Service) GetMinStake(_ *http.Request, args *GetMinStakeArgs, reply *GetMinStakeReply) error
GetMinStake returns the minimum staking amount in nLUX.
func (*Service) GetRewardUTXOs ¶ added in v0.1.1
func (s *Service) GetRewardUTXOs(_ *http.Request, args *api.GetTxArgs, reply *GetRewardUTXOsReply) error
GetRewardUTXOs returns the UTXOs that were rewarded after the provided transaction's staking period ended.
func (*Service) GetStake ¶ added in v0.1.1
func (s *Service) GetStake(_ *http.Request, args *GetStakeArgs, response *GetStakeReply) error
GetStake returns the amount of nLUX that [args.Addresses] have cumulatively staked on the Primary Network.
This method assumes that each stake output has only owner This method assumes only LUX can be staked This method only concerns itself with the Primary Network, not subnets in a data structure rather than re-calculating it by iterating over stakers
func (*Service) GetStakingAssetID ¶ added in v0.1.1
func (s *Service) GetStakingAssetID(_ *http.Request, args *GetStakingAssetIDArgs, response *GetStakingAssetIDResponse) error
GetStakingAssetID returns the assetID of the token used to stake on the provided subnet
func (*Service) GetSubnet ¶ added in v0.1.1
func (s *Service) GetSubnet(_ *http.Request, args *GetSubnetArgs, response *GetSubnetResponse) error
func (*Service) GetSubnets ¶
func (s *Service) GetSubnets(_ *http.Request, args *GetSubnetsArgs, response *GetSubnetsResponse) error
GetSubnets returns the subnets whose ID are in [args.IDs] The response will include the primary network
func (*Service) GetTimestamp ¶ added in v0.1.1
func (s *Service) GetTimestamp(_ *http.Request, _ *struct{}, reply *GetTimestampReply) error
GetTimestamp returns the current timestamp on chain.
func (*Service) GetTotalStake ¶ added in v0.1.1
func (s *Service) GetTotalStake(_ *http.Request, args *GetTotalStakeArgs, reply *GetTotalStakeReply) error
GetTotalStake returns the total amount staked on the Primary Network
func (*Service) GetTxStatus ¶ added in v0.1.1
func (s *Service) GetTxStatus(_ *http.Request, args *GetTxStatusArgs, response *GetTxStatusResponse) error
GetTxStatus gets a tx's status
func (*Service) GetUTXOs ¶ added in v0.1.1
func (s *Service) GetUTXOs(_ *http.Request, args *api.GetUTXOsArgs, response *api.GetUTXOsReply) error
GetUTXOs returns the UTXOs controlled by the given addresses
func (*Service) GetValidatorsAt ¶ added in v0.1.1
func (s *Service) GetValidatorsAt(r *http.Request, args *GetValidatorsAtArgs, reply *GetValidatorsAtReply) error
GetValidatorsAt returns the weights of the validator set of a provided subnet at the specified height.
func (*Service) ListAddresses ¶ added in v1.1.11
func (s *Service) ListAddresses(_ *http.Request, args *api.UserPass, response *api.JSONAddresses) error
ListAddresses returns the addresses controlled by [args.Username]
func (*Service) SampleValidators ¶
func (s *Service) SampleValidators(_ *http.Request, args *SampleValidatorsArgs, reply *SampleValidatorsReply) error
SampleValidators returns a sampling of the list of current validators
func (*Service) ValidatedBy ¶
func (s *Service) ValidatedBy(r *http.Request, args *ValidatedByArgs, response *ValidatedByResponse) error
ValidatedBy returns the ID of the Net that validates [args.BlockchainID]
func (*Service) Validates ¶
func (s *Service) Validates(_ *http.Request, args *ValidatesArgs, response *ValidatesResponse) error
Validates returns the IDs of the blockchains validated by [args.NetID]
type TestAppSender ¶ added in v1.16.56
type TestAppSender struct{}
TestAppSender is a test implementation of AppSender for platformvm tests
func (*TestAppSender) SendAppGossip ¶ added in v1.17.2
func (t *TestAppSender) SendAppGossip(ctx context.Context, appGossipBytes []byte) error
SendAppGossip is a no-op for tests
func (*TestAppSender) SendAppRequest ¶ added in v1.17.2
func (t *TestAppSender) SendAppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, appRequestBytes []byte) error
SendAppRequest is a no-op for tests
func (*TestAppSender) SendAppResponse ¶ added in v1.17.2
func (t *TestAppSender) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, appResponseBytes []byte) error
SendAppResponse is a no-op for tests
func (*TestAppSender) SendCrossChainAppError ¶ added in v1.17.2
func (t *TestAppSender) SendCrossChainAppError(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, errorMessage string) error
SendCrossChainAppError is a no-op for tests
func (*TestAppSender) SendCrossChainAppRequest ¶ added in v1.17.2
func (t *TestAppSender) SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, appRequestBytes []byte) error
SendCrossChainAppRequest is a no-op for tests
func (*TestAppSender) SendCrossChainAppResponse ¶ added in v1.17.2
func (t *TestAppSender) SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, appResponseBytes []byte) error
SendCrossChainAppResponse is a no-op for tests
type VM ¶
type VM struct {
config.Config
blockbuilder.Builder
*network.Network
validators.State
// contains filtered or unexported fields
}
func (*VM) BuildBlock ¶
func (*VM) CodecRegistry ¶ added in v0.1.1
func (*VM) ConnectedSubnet ¶ added in v1.1.11
func (*VM) CreateHandlers ¶
CreateHandlers returns a map where: * keys are API endpoint extensions * values are API handlers
func (*VM) Disconnected ¶ added in v0.1.1
func (*VM) GetBlockIDAtHeight ¶ added in v0.1.1
func (*VM) GetChainID ¶ added in v1.16.56
GetChainID returns the chain ID of this VM
func (*VM) HealthCheck ¶ added in v0.1.1
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx context.Context, chainCtxIntf interface{}, dbManagerIntf interface{}, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, toEngineIntf interface{}, fxsIntf []interface{}, appSenderIntf interface{}, ) error
Initialize this blockchain. [vm.ChainManager] and [vm.vdrMgr] must be set before this function is called.
func (*VM) LastAccepted ¶ added in v0.1.1
LastAccepted returns the block most recently accepted
func (*VM) NewHTTPHandler ¶ added in v0.1.1
NewHTTPHandler returns a new HTTP handler that can handle API calls This is required by the linearblock.ChainVM interface
func (*VM) ParseBlock ¶
func (*VM) SetPreference ¶
SetPreference sets the preferred block to be the one with ID [blkID]
type ValidatedByArgs ¶
type ValidatedByArgs struct {
// ValidatedBy returns the ID of the Net validating the blockchain with this ID
BlockchainID ids.ID `json:"blockchainID"`
}
ValidatedByArgs is the arguments for calling ValidatedBy
type ValidatedByResponse ¶
type ValidatedByResponse struct {
// ID of the Net validating the specified blockchain
NetID ids.ID `json:"netID"`
}
ValidatedByResponse is the reply from calling ValidatedBy
type ValidatesArgs ¶
ValidatesArgs are the arguments to Validates
type ValidatesResponse ¶
ValidatesResponse is the response from calling Validates
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package block is a generated GoMock package.
|
Package block is a generated GoMock package. |
|
executor
Package executor is a generated GoMock package.
|
Package executor is a generated GoMock package. |
|
executor/executormock
Package executormock is a generated GoMock package.
|
Package executormock is a generated GoMock package. |
|
Package fx is a generated GoMock package.
|
Package fx is a generated GoMock package. |
|
fxmock
Package fxmock is a generated GoMock package.
|
Package fxmock is a generated GoMock package. |
|
signermock
Package signermock is a generated GoMock package.
|
Package signermock is a generated GoMock package. |
|
Package state is a generated GoMock package.
|
Package state is a generated GoMock package. |
|
Package testcontext provides a test context for platformvm tests
|
Package testcontext provides a test context for platformvm tests |
|
Package txs is a generated GoMock package.
|
Package txs is a generated GoMock package. |
|
builder
Package builder is a generated GoMock package.
|
Package builder is a generated GoMock package. |
|
fee
compliance.
|
compliance. |
|
mempool
Package mempool is a generated GoMock package.
|
Package mempool is a generated GoMock package. |
|
Package utxo is a generated GoMock package.
|
Package utxo is a generated GoMock package. |
|
utxomock
Package utxomock is a generated GoMock package.
|
Package utxomock is a generated GoMock package. |