avm

package
v1.11.10-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: BSD-3-Clause Imports: 61 Imported by: 50

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Network:              network.DefaultConfig,
	IndexTransactions:    false,
	IndexAllowIncomplete: false,
	ChecksumsEnabled:     false,
}
View Source
var (
	ErrRejected = errors.New("rejected")
)

Functions

func AwaitTxAccepted added in v1.11.9

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

func NewPubSubFilterer added in v1.4.0

func NewPubSubFilterer(tx *txs.Tx) pubsub.Filterer

Types

type AssetDefinition

type AssetDefinition struct {
	Name         string                   `json:"name"`
	Symbol       string                   `json:"symbol"`
	Denomination avajson.Uint8            `json:"denomination"`
	InitialState map[string][]interface{} `json:"initialState"`
	Memo         string                   `json:"memo"`
}

type AssetIDChangeAddr added in v0.8.4

type AssetIDChangeAddr struct {
	FormattedAssetID
	api.JSONChangeAddr
}

AssetIDChangeAddr is an asset ID and a change address

type Balance added in v0.8.0

type Balance struct {
	AssetID string         `json:"asset"`
	Balance avajson.Uint64 `json:"balance"`
}

type BuildGenesisArgs

type BuildGenesisArgs struct {
	NetworkID   avajson.Uint32             `json:"networkID"`
	GenesisData map[string]AssetDefinition `json:"genesisData"`
	Encoding    formatting.Encoding        `json:"encoding"`
}

BuildGenesisArgs are arguments for BuildGenesis

type BuildGenesisReply

type BuildGenesisReply struct {
	Bytes    string              `json:"bytes"`
	Encoding formatting.Encoding `json:"encoding"`
}

BuildGenesisReply is the reply from BuildGenesis

type Client added in v1.0.6

type Client interface {
	WalletClient
	// GetBlock returns the block with the given id.
	GetBlock(ctx context.Context, blkID 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)
	// GetHeight returns the height of the last accepted block.
	GetHeight(ctx context.Context, options ...rpc.Option) (uint64, error)
	// GetTxStatus returns the status of [txID]
	//
	// Deprecated: GetTxStatus only returns Accepted or Unknown, GetTx should be
	// used instead to determine if the tx was accepted.
	GetTxStatus(ctx context.Context, txID ids.ID, options ...rpc.Option) (choices.Status, error)
	// GetTx returns the byte representation of [txID]
	GetTx(ctx context.Context, txID ids.ID, options ...rpc.Option) ([]byte, 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)
	// GetAssetDescription returns a description of [assetID]
	GetAssetDescription(ctx context.Context, assetID string, options ...rpc.Option) (*GetAssetDescriptionReply, error)
	// GetBalance returns the balance of [assetID] held by [addr].
	// If [includePartial], balance includes partial owned (i.e. in a multisig) funds.
	//
	// Deprecated: GetUTXOs should be used instead.
	GetBalance(ctx context.Context, addr ids.ShortID, assetID string, includePartial bool, options ...rpc.Option) (*GetBalanceReply, error)
	// GetAllBalances returns all asset balances for [addr]
	//
	// Deprecated: GetUTXOs should be used instead.
	GetAllBalances(ctx context.Context, addr ids.ShortID, includePartial bool, options ...rpc.Option) ([]Balance, error)
	// CreateAsset creates a new asset and returns its assetID
	//
	// Deprecated: Transactions should be issued using the
	// `avalanchego/wallet/chain/x.Wallet` utility.
	CreateAsset(
		ctx context.Context,
		user api.UserPass,
		from []ids.ShortID,
		changeAddr ids.ShortID,
		name string,
		symbol string,
		denomination byte,
		holders []*ClientHolder,
		minters []ClientOwners,
		options ...rpc.Option,
	) (ids.ID, error)
	// CreateFixedCapAsset creates a new fixed cap asset and returns its assetID
	//
	// Deprecated: Transactions should be issued using the
	// `avalanchego/wallet/chain/x.Wallet` utility.
	CreateFixedCapAsset(
		ctx context.Context,
		user api.UserPass,
		from []ids.ShortID,
		changeAddr ids.ShortID,
		name string,
		symbol string,
		denomination byte,
		holders []*ClientHolder,
		options ...rpc.Option,
	) (ids.ID, error)
	// CreateVariableCapAsset creates a new variable cap asset and returns its assetID
	//
	// Deprecated: Transactions should be issued using the
	// `avalanchego/wallet/chain/x.Wallet` utility.
	CreateVariableCapAsset(
		ctx context.Context,
		user api.UserPass,
		from []ids.ShortID,
		changeAddr ids.ShortID,
		name string,
		symbol string,
		denomination byte,
		minters []ClientOwners,
		options ...rpc.Option,
	) (ids.ID, error)
	// CreateNFTAsset creates a new NFT asset and returns its assetID
	//
	// Deprecated: Transactions should be issued using the
	// `avalanchego/wallet/chain/x.Wallet` utility.
	CreateNFTAsset(
		ctx context.Context,
		user api.UserPass,
		from []ids.ShortID,
		changeAddr ids.ShortID,
		name string,
		symbol string,
		minters []ClientOwners,
		options ...rpc.Option,
	) (ids.ID, error)
	// CreateAddress creates a new address controlled by [user]
	//
	// Deprecated: Keys should no longer be stored on the node.
	CreateAddress(ctx context.Context, user api.UserPass, options ...rpc.Option) (ids.ShortID, error)
	// ListAddresses returns all addresses on this chain 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)
	// ExportKey returns the private key corresponding to [addr] controlled by [user]
	//
	// Deprecated: Keys should no longer be stored on the node.
	ExportKey(ctx context.Context, user api.UserPass, addr ids.ShortID, options ...rpc.Option) (*secp256k1.PrivateKey, error)
	// ImportKey imports [privateKey] to [user]
	//
	// Deprecated: Keys should no longer be stored on the node.
	ImportKey(ctx context.Context, user api.UserPass, privateKey *secp256k1.PrivateKey, options ...rpc.Option) (ids.ShortID, error)
	// Mint [amount] of [assetID] to be owned by [to]
	//
	// Deprecated: Transactions should be issued using the
	// `avalanchego/wallet/chain/x.Wallet` utility.
	Mint(
		ctx context.Context,
		user api.UserPass,
		from []ids.ShortID,
		changeAddr ids.ShortID,
		amount uint64,
		assetID string,
		to ids.ShortID,
		options ...rpc.Option,
	) (ids.ID, error)
	// SendNFT sends an NFT and returns the ID of the newly created transaction
	//
	// Deprecated: Transactions should be issued using the
	// `avalanchego/wallet/chain/x.Wallet` utility.
	SendNFT(
		ctx context.Context,
		user api.UserPass,
		from []ids.ShortID,
		changeAddr ids.ShortID,
		assetID string,
		groupID uint32,
		to ids.ShortID,
		options ...rpc.Option,
	) (ids.ID, error)
	// MintNFT issues a MintNFT transaction and returns the ID of the newly created transaction
	//
	// Deprecated: Transactions should be issued using the
	// `avalanchego/wallet/chain/x.Wallet` utility.
	MintNFT(
		ctx context.Context,
		user api.UserPass,
		from []ids.ShortID,
		changeAddr ids.ShortID,
		assetID string,
		payload []byte,
		to ids.ShortID,
		options ...rpc.Option,
	) (ids.ID, error)
	// Import sends an import transaction to import funds from [sourceChain] and
	// returns the ID of the newly created transaction
	//
	// Deprecated: Transactions should be issued using the
	// `avalanchego/wallet/chain/x.Wallet` utility.
	Import(ctx context.Context, user api.UserPass, to ids.ShortID, sourceChain string, options ...rpc.Option) (ids.ID, error) // Export sends an asset from this chain to the P/C-Chain.
	// After this tx is accepted, the AVAX must be imported to the P/C-chain with an importTx.
	// Returns the ID of the newly created atomic transaction
	//
	// Deprecated: Transactions should be issued using the
	// `avalanchego/wallet/chain/x.Wallet` utility.
	Export(
		ctx context.Context,
		user api.UserPass,
		from []ids.ShortID,
		changeAddr ids.ShortID,
		amount uint64,
		to ids.ShortID,
		toChainIDAlias string,
		assetID string,
		options ...rpc.Option,
	) (ids.ID, error)
}

Client for interacting with an AVM (X-Chain) instance

func NewClient added in v1.0.6

func NewClient(uri, chain string) Client

NewClient returns an AVM client for interacting with avm [chain]

type ClientHolder added in v1.7.11

type ClientHolder struct {
	Amount  uint64
	Address ids.ShortID
}

ClientHolder describes how much an address owns of an asset

type ClientOwners added in v1.7.11

type ClientOwners struct {
	Threshold uint32
	Minters   []ids.ShortID
}

ClientOwners describes who can perform an action

type ClientSendOutput added in v1.7.11

type ClientSendOutput struct {
	// The amount of funds to send
	Amount uint64

	// ID of the asset being sent
	AssetID string

	// Address of the recipient
	To ids.ShortID
}

ClientSendOutput specifies that [Amount] of asset [AssetID] be sent to [To]

type Config added in v1.5.0

type Config struct {
	Network              network.Config `json:"network"`
	IndexTransactions    bool           `json:"index-transactions"`
	IndexAllowIncomplete bool           `json:"index-allow-incomplete"`
	ChecksumsEnabled     bool           `json:"checksums-enabled"`
}

func ParseConfig added in v1.10.18

func ParseConfig(configBytes []byte) (Config, error)

type CreateAssetArgs added in v1.0.6

type CreateAssetArgs struct {
	api.JSONSpendHeader           // User, password, from addrs, change addr
	Name                string    `json:"name"`
	Symbol              string    `json:"symbol"`
	Denomination        byte      `json:"denomination"`
	InitialHolders      []*Holder `json:"initialHolders"`
	MinterSets          []Owners  `json:"minterSets"`
}

CreateAssetArgs are arguments for passing into CreateAsset

type CreateNFTAssetArgs added in v0.8.0

type CreateNFTAssetArgs struct {
	api.JSONSpendHeader          // User, password, from addrs, change addr
	Name                string   `json:"name"`
	Symbol              string   `json:"symbol"`
	MinterSets          []Owners `json:"minterSets"`
}

CreateNFTAssetArgs are arguments for passing into CreateNFTAsset requests

type ExportArgs added in v1.0.0

type ExportArgs struct {
	// User, password, from addrs, change addr
	api.JSONSpendHeader
	// Amount of nAVAX to send
	Amount avajson.Uint64 `json:"amount"`

	// Chain the funds are going to. Optional. Used if To address does not include the chainID.
	TargetChain string `json:"targetChain"`

	// ID of the address that will receive the AVAX. This address may include the
	// chainID, which is used to determine what the destination chain is.
	To string `json:"to"`

	AssetID string `json:"assetID"`
}

ExportArgs are arguments for passing into ExportAVA requests

type ExportKeyArgs

type ExportKeyArgs struct {
	api.UserPass
	Address string `json:"address"`
}

ExportKeyArgs are arguments for ExportKey

type ExportKeyReply

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 Factory

type Factory struct {
	config.Config
}

func (*Factory) New

func (f *Factory) New(logging.Logger) (interface{}, error)

type FormattedAssetID added in v0.8.0

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

FormattedAssetID defines a JSON formatted struct containing an assetID as a string

type Genesis

type Genesis struct {
	Txs []*GenesisAsset `serialize:"true"`
}

type GenesisAsset

type GenesisAsset struct {
	Alias             string `serialize:"true"`
	txs.CreateAssetTx `serialize:"true"`
}

func (*GenesisAsset) Compare added in v1.10.18

func (g *GenesisAsset) Compare(other *GenesisAsset) int

type GetAddressTxsArgs added in v1.5.0

type GetAddressTxsArgs struct {
	api.JSONAddress
	// Cursor used as a page index / offset
	Cursor avajson.Uint64 `json:"cursor"`
	// PageSize num of items per page
	PageSize avajson.Uint64 `json:"pageSize"`
	// AssetID defaulted to AVAX if omitted or left blank
	AssetID string `json:"assetID"`
}

type GetAddressTxsReply added in v1.5.0

type GetAddressTxsReply struct {
	TxIDs []ids.ID `json:"txIDs"`
	// Cursor used as a page index / offset
	Cursor avajson.Uint64 `json:"cursor"`
}

type GetAllBalancesArgs added in v1.1.4

type GetAllBalancesArgs struct {
	api.JSONAddress
	IncludePartial bool `json:"includePartial"`
}

type GetAllBalancesReply added in v0.8.0

type GetAllBalancesReply struct {
	Balances []Balance `json:"balances"`
}

GetAllBalancesReply is the response from a call to GetAllBalances

type GetAssetDescriptionArgs

type GetAssetDescriptionArgs struct {
	AssetID string `json:"assetID"`
}

GetAssetDescriptionArgs are arguments for passing into GetAssetDescription requests

type GetAssetDescriptionReply

type GetAssetDescriptionReply struct {
	FormattedAssetID
	Name         string        `json:"name"`
	Symbol       string        `json:"symbol"`
	Denomination avajson.Uint8 `json:"denomination"`
}

GetAssetDescriptionReply defines the GetAssetDescription replies returned from the API

type GetBalanceArgs

type GetBalanceArgs struct {
	Address        string `json:"address"`
	AssetID        string `json:"assetID"`
	IncludePartial bool   `json:"includePartial"`
}

GetBalanceArgs are arguments for passing into GetBalance requests

type GetBalanceReply

type GetBalanceReply struct {
	Balance avajson.Uint64 `json:"balance"`
	UTXOIDs []avax.UTXOID  `json:"utxoIDs"`
}

GetBalanceReply defines the GetBalance replies returned from the API

type GetTxStatusReply

type GetTxStatusReply struct {
	Status choices.Status `json:"status"`
}

GetTxStatusReply defines the GetTxStatus replies returned from the API

type Holder

type Holder struct {
	Amount  avajson.Uint64 `json:"amount"`
	Address string         `json:"address"`
}

Holder describes how much an address owns of an asset

type ImportArgs added in v1.0.0

type ImportArgs struct {
	// User that controls To
	api.UserPass

	// Chain the funds are coming from
	SourceChain string `json:"sourceChain"`

	// Address receiving the imported AVAX
	To string `json:"to"`
}

ImportArgs are arguments for passing into Import requests

type ImportKeyArgs

type ImportKeyArgs struct {
	api.UserPass
	PrivateKey *secp256k1.PrivateKey `json:"privateKey"`
}

ImportKeyArgs are arguments for ImportKey

type ImportKeyReply

type ImportKeyReply struct {
	// The address controlled by the PrivateKey provided in the arguments
	Address string `json:"address"`
}

ImportKeyReply is the response for ImportKey

type MintArgs added in v0.8.0

type MintArgs struct {
	api.JSONSpendHeader                // User, password, from addrs, change addr
	Amount              avajson.Uint64 `json:"amount"`
	AssetID             string         `json:"assetID"`
	To                  string         `json:"to"`
}

MintArgs are arguments for passing into Mint requests

type MintNFTArgs added in v0.8.0

type MintNFTArgs struct {
	api.JSONSpendHeader                     // User, password, from addrs, change addr
	AssetID             string              `json:"assetID"`
	Payload             string              `json:"payload"`
	To                  string              `json:"to"`
	Encoding            formatting.Encoding `json:"encoding"`
}

MintNFTArgs are arguments for passing into MintNFT requests

type Owners

type Owners struct {
	Threshold avajson.Uint32 `json:"threshold"`
	Minters   []string       `json:"minters"`
}

Owners describes who can perform an action

type SendArgs

type SendArgs struct {
	// User, password, from addrs, change addr
	api.JSONSpendHeader

	// The amount, assetID, and destination to send funds to
	SendOutput

	// Memo field
	Memo string `json:"memo"`
}

SendArgs are arguments for passing into Send requests

type SendMultipleArgs added in v1.0.1

type SendMultipleArgs struct {
	// User, password, from addrs, change addr
	api.JSONSpendHeader

	// The outputs of the transaction
	Outputs []SendOutput `json:"outputs"`

	// Memo field
	Memo string `json:"memo"`
}

SendMultipleArgs are arguments for passing into SendMultiple requests

type SendNFTArgs added in v0.8.0

type SendNFTArgs struct {
	api.JSONSpendHeader                // User, password, from addrs, change addr
	AssetID             string         `json:"assetID"`
	GroupID             avajson.Uint32 `json:"groupID"`
	To                  string         `json:"to"`
}

SendNFTArgs are arguments for passing into SendNFT requests

type SendOutput added in v1.0.1

type SendOutput struct {
	// The amount of funds to send
	Amount avajson.Uint64 `json:"amount"`

	// ID of the asset being sent
	AssetID string `json:"assetID"`

	// Address of the recipient
	To string `json:"to"`
}

SendOutput specifies that [Amount] of asset [AssetID] be sent to [To]

type Service

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

Service defines the base service for the asset vm

func (*Service) CreateAddress

func (s *Service) CreateAddress(_ *http.Request, args *api.UserPass, reply *api.JSONAddress) error

CreateAddress creates an address for the user [args.Username]

func (*Service) CreateAsset added in v1.0.6

func (s *Service) CreateAsset(_ *http.Request, args *CreateAssetArgs, reply *AssetIDChangeAddr) error

CreateAsset returns ID of the newly created asset

func (*Service) CreateFixedCapAsset

func (s *Service) CreateFixedCapAsset(r *http.Request, args *CreateAssetArgs, reply *AssetIDChangeAddr) error

CreateFixedCapAsset returns ID of the newly created asset

func (*Service) CreateNFTAsset added in v0.8.0

func (s *Service) CreateNFTAsset(_ *http.Request, args *CreateNFTAssetArgs, reply *AssetIDChangeAddr) error

CreateNFTAsset returns ID of the newly created asset

func (*Service) CreateVariableCapAsset

func (s *Service) CreateVariableCapAsset(r *http.Request, args *CreateAssetArgs, reply *AssetIDChangeAddr) error

CreateVariableCapAsset returns ID of the newly created asset

func (*Service) Export added in v1.0.0

func (s *Service) Export(_ *http.Request, args *ExportArgs, reply *api.JSONTxIDChangeAddr) error

Export sends an asset from this chain to the P/C-Chain. After this tx is accepted, the AVAX must be imported to the P/C-chain with an importTx. Returns the ID of the newly created atomic transaction

func (*Service) ExportKey

func (s *Service) ExportKey(_ *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error

ExportKey returns a private key from the provided user

func (*Service) GetAddressTxs added in v1.5.0

func (s *Service) GetAddressTxs(_ *http.Request, args *GetAddressTxsArgs, reply *GetAddressTxsReply) error

GetAddressTxs returns list of transactions for a given address

func (*Service) GetAllBalances added in v0.8.0

func (s *Service) GetAllBalances(_ *http.Request, args *GetAllBalancesArgs, reply *GetAllBalancesReply) error

GetAllBalances returns a map where:

Key: ID of an asset such that [args.Address] has a non-zero balance of the asset Value: The balance of the asset held by the address

If ![args.IncludePartial], returns only unlocked balance/UTXOs with a 1-out-of-1 multisig. Otherwise, returned balance/UTXOs includes assets held only partially by the address, and includes balances with locktime in the future.

func (*Service) GetAssetDescription

func (s *Service) GetAssetDescription(_ *http.Request, args *GetAssetDescriptionArgs, reply *GetAssetDescriptionReply) error

GetAssetDescription creates an empty account with the name passed in

func (*Service) GetBalance

func (s *Service) GetBalance(_ *http.Request, args *GetBalanceArgs, reply *GetBalanceReply) error

GetBalance returns the balance of an asset held by an address. If ![args.IncludePartial], returns only the balance held solely (1 out of 1 multisig) by the address and with a locktime in the past. Otherwise, returned balance includes assets held only partially by the address, and includes balances with locktime in the future.

func (*Service) GetBlock added in v1.9.12

func (s *Service) GetBlock(_ *http.Request, args *api.GetBlockArgs, reply *api.GetBlockResponse) error

GetBlock returns the requested block.

func (*Service) GetBlockByHeight added in v1.9.12

func (s *Service) GetBlockByHeight(_ *http.Request, args *api.GetBlockByHeightArgs, reply *api.GetBlockResponse) error

GetBlockByHeight returns the block at the given height.

func (*Service) GetHeight added in v1.9.12

func (s *Service) GetHeight(_ *http.Request, _ *struct{}, reply *api.GetHeightResponse) error

GetHeight returns the height of the last accepted block.

func (*Service) GetTx added in v0.8.0

func (s *Service) GetTx(_ *http.Request, args *api.GetTxArgs, reply *api.GetTxReply) error

GetTx returns the specified transaction

func (*Service) GetTxStatus deprecated

func (s *Service) GetTxStatus(_ *http.Request, args *api.JSONTxID, reply *GetTxStatusReply) error

GetTxStatus returns the status of the specified transaction

Deprecated: GetTxStatus only returns Accepted or Unknown, GetTx should be used instead to determine if the tx was accepted.

func (*Service) GetUTXOs

func (s *Service) GetUTXOs(_ *http.Request, args *api.GetUTXOsArgs, reply *api.GetUTXOsReply) error

GetUTXOs gets all utxos for passed in addresses

func (*Service) Import added in v1.0.0

func (s *Service) Import(_ *http.Request, args *ImportArgs, reply *api.JSONTxID) error

Import imports an asset to this chain from the P/C-Chain. The AVAX must have already been exported from the P/C-Chain. Returns the ID of the newly created atomic transaction

func (*Service) ImportKey

func (s *Service) ImportKey(_ *http.Request, args *ImportKeyArgs, reply *api.JSONAddress) error

ImportKey adds a private key to the provided user

func (*Service) IssueTx

func (s *Service) IssueTx(_ *http.Request, args *api.FormattedTx, reply *api.JSONTxID) error

IssueTx attempts to issue a transaction into consensus

func (*Service) ListAddresses added in v0.8.0

func (s *Service) ListAddresses(_ *http.Request, args *api.UserPass, response *api.JSONAddresses) error

ListAddresses returns all of the addresses controlled by user [args.Username]

func (*Service) Mint added in v0.8.0

func (s *Service) Mint(_ *http.Request, args *MintArgs, reply *api.JSONTxIDChangeAddr) error

Mint issues a transaction that mints more of the asset

func (*Service) MintNFT added in v0.8.0

func (s *Service) MintNFT(_ *http.Request, args *MintNFTArgs, reply *api.JSONTxIDChangeAddr) error

MintNFT issues a MintNFT transaction and returns the ID of the newly created transaction

func (*Service) Send

func (s *Service) Send(r *http.Request, args *SendArgs, reply *api.JSONTxIDChangeAddr) error

Send returns the ID of the newly created transaction

func (*Service) SendMultiple added in v1.0.1

func (s *Service) SendMultiple(_ *http.Request, args *SendMultipleArgs, reply *api.JSONTxIDChangeAddr) error

SendMultiple sends a transaction with multiple outputs.

func (*Service) SendNFT added in v0.8.0

func (s *Service) SendNFT(_ *http.Request, args *SendNFTArgs, reply *api.JSONTxIDChangeAddr) error

SendNFT sends an NFT

type StaticService

type StaticService struct{}

StaticService defines the base service for the asset vm

func CreateStaticService added in v1.0.3

func CreateStaticService() *StaticService

func (*StaticService) BuildGenesis

func (*StaticService) BuildGenesis(_ *http.Request, args *BuildGenesisArgs, reply *BuildGenesisReply) error

BuildGenesis returns the UTXOs such that at least one address in [args.Addresses] is referenced in the UTXO.

type Tx

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

func (*Tx) Accept added in v1.10.4

func (tx *Tx) Accept(context.Context) error

func (*Tx) Bytes added in v1.10.4

func (tx *Tx) Bytes() []byte

func (*Tx) ID added in v1.10.4

func (tx *Tx) ID() ids.ID

func (*Tx) MissingDependencies added in v1.10.4

func (tx *Tx) MissingDependencies() (set.Set[ids.ID], error)

func (*Tx) Reject added in v1.10.4

func (*Tx) Reject(context.Context) error

func (*Tx) Status added in v1.10.4

func (tx *Tx) Status() choices.Status

func (*Tx) Verify added in v1.10.4

func (tx *Tx) Verify(context.Context) error

type VM

type VM struct {
	network.Atomic

	config.Config

	avax.AddressManager
	ids.Aliaser
	utxo.Spender

	// These values are only initialized after the chain has been linearized.
	blockbuilder.Builder
	// contains filtered or unexported fields
}

func (*VM) Connected added in v1.4.8

func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, version *version.Application) error

func (*VM) CreateHandlers

func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error)

func (*VM) Disconnected added in v1.4.8

func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error

func (*VM) GetBlock added in v1.9.6

func (vm *VM) GetBlock(_ context.Context, blkID ids.ID) (snowman.Block, error)

func (*VM) GetBlockIDAtHeight added in v1.10.5

func (vm *VM) GetBlockIDAtHeight(_ context.Context, height uint64) (ids.ID, error)

func (*VM) HealthCheck added in v1.2.1

func (*VM) HealthCheck(context.Context) (interface{}, error)

TODO: add health checks

func (*VM) Initialize

func (vm *VM) Initialize(
	_ context.Context,
	ctx *snow.Context,
	db database.Database,
	genesisBytes []byte,
	_ []byte,
	configBytes []byte,
	_ chan<- common.Message,
	fxs []*common.Fx,
	appSender common.AppSender,
) error

func (*VM) LastAccepted added in v1.9.6

func (vm *VM) LastAccepted(context.Context) (ids.ID, error)

func (*VM) Linearize added in v1.9.6

func (vm *VM) Linearize(ctx context.Context, stopVertexID ids.ID, toEngine chan<- common.Message) error

func (*VM) LoadUser added in v0.8.0

func (vm *VM) LoadUser(
	username string,
	password string,
	addrsToUse set.Set[ids.ShortID],
) (
	[]*avax.UTXO,
	*secp256k1fx.Keychain,
	error,
)

LoadUser returns: 1) The UTXOs that reference one or more addresses controlled by the given user 2) A keychain that contains this user's keys If [addrsToUse] has positive length, returns UTXOs that reference one or more addresses controlled by the given user that are also in [addrsToUse].

func (*VM) ParseBlock added in v1.9.6

func (vm *VM) ParseBlock(_ context.Context, blkBytes []byte) (snowman.Block, error)

func (*VM) ParseTx

func (vm *VM) ParseTx(_ context.Context, bytes []byte) (snowstorm.Tx, error)

func (*VM) SetPreference added in v1.9.6

func (vm *VM) SetPreference(_ context.Context, blkID ids.ID) error

func (*VM) SetState added in v1.7.5

func (vm *VM) SetState(_ context.Context, state snow.State) error

func (*VM) Shutdown

func (vm *VM) Shutdown(context.Context) error

func (*VM) Version added in v1.4.10

func (*VM) Version(context.Context) (string, error)

type WalletClient added in v1.1.2

type WalletClient interface {
	// IssueTx issues a transaction to a node and returns the TxID
	IssueTx(ctx context.Context, tx []byte, options ...rpc.Option) (ids.ID, error)
	// Send [amount] of [assetID] to address [to]
	//
	// Deprecated: Transactions should be issued using the
	// `avalanchego/wallet/chain/x.Wallet` utility.
	Send(
		ctx context.Context,
		user api.UserPass,
		from []ids.ShortID,
		changeAddr ids.ShortID,
		amount uint64,
		assetID string,
		to ids.ShortID,
		memo string,
		options ...rpc.Option,
	) (ids.ID, error)
	// SendMultiple sends a transaction from [user] funding all [outputs]
	//
	// Deprecated: Transactions should be issued using the
	// `avalanchego/wallet/chain/x.Wallet` utility.
	SendMultiple(
		ctx context.Context,
		user api.UserPass,
		from []ids.ShortID,
		changeAddr ids.ShortID,
		outputs []ClientSendOutput,
		memo string,
		options ...rpc.Option,
	) (ids.ID, error)
}

interface of an AVM wallet client for interacting with avm managed wallet on [chain]

func NewWalletClient deprecated added in v1.1.2

func NewWalletClient(uri, chain string) WalletClient

NewWalletClient returns an AVM wallet client for interacting with avm managed wallet on [chain]

Deprecated: Transactions should be issued using the `avalanchego/wallet/chain/x.Wallet` utility.

type WalletService added in v1.0.3

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

func (*WalletService) IssueTx added in v1.0.3

func (w *WalletService) IssueTx(_ *http.Request, args *api.FormattedTx, reply *api.JSONTxID) error

IssueTx attempts to issue a transaction into consensus

func (*WalletService) Send added in v1.0.3

func (w *WalletService) Send(r *http.Request, args *SendArgs, reply *api.JSONTxIDChangeAddr) error

Send returns the ID of the newly created transaction

func (*WalletService) SendMultiple added in v1.0.3

func (w *WalletService) SendMultiple(_ *http.Request, args *SendMultipleArgs, reply *api.JSONTxIDChangeAddr) error

SendMultiple sends a transaction with multiple outputs.

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.
Package metrics is a generated GoMock package.
Package metrics is a generated GoMock package.
Package state is a generated GoMock package.
Package state is a generated GoMock package.
txs
Package txs is a generated GoMock package.
Package txs is a generated GoMock package.
mempool
Package mempool is a generated GoMock package.
Package mempool is a generated GoMock package.

Jump to

Keyboard shortcuts

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