exchangevm

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRejected = errors.New("rejected")

Functions

func AwaitTxAccepted

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

AwaitTxAccepted waits for a transaction to be accepted

Types

type AssetDefinition

type AssetDefinition struct {
	Name         string                   `json:"name"`
	Symbol       string                   `json:"symbol"`
	Denomination byte                     `json:"denomination"`
	InitialState map[string][]interface{} `json:"initialState"`
}

AssetDefinition defines an asset in genesis

type Balance

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

Balance represents an asset balance

type BuildGenesisArgs

type BuildGenesisArgs struct {
	Encoding    formatting.Encoding `json:"encoding"`
	GenesisData map[string]AssetDefinition
}

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

type Client struct {
	Requester rpc.EndpointRequester
}

Client for interacting with the Exchange VM (X-Chain)

func NewClient

func NewClient(uri, chain string) *Client

NewClient returns an Exchange VM client for interacting with the X-Chain

func (*Client) GetAllBalances deprecated

func (c *Client) GetAllBalances(
	ctx context.Context,
	addr ids.ShortID,
	includePartial bool,
	options ...rpc.Option,
) ([]Balance, error)

GetAllBalances returns all asset balances for addr.

Deprecated: GetUTXOs should be used instead.

func (*Client) GetAssetDescription

func (c *Client) GetAssetDescription(ctx context.Context, assetID string, options ...rpc.Option) (*GetAssetDescriptionReply, error)

GetAssetDescription returns a description of assetID.

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,
	addr ids.ShortID,
	assetID string,
	includePartial bool,
	options ...rpc.Option,
) (*GetBalanceReply, error)

GetBalance returns the balance of assetID held by addr.

If includePartial is set, balance includes partial owned (i.e. in a multisig) funds.

Deprecated: GetUTXOs should be used instead.

func (*Client) GetBlock

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

GetBlock returns the block with the given id.

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) GetHeight

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

GetHeight returns the height of the last accepted block.

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) GetTxFee

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

GetTxFee returns the cost to issue certain transactions.

func (*Client) GetTxStatus deprecated

func (c *Client) GetTxStatus(ctx context.Context, txID ids.ID, options ...rpc.Option) (choices.Status, 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.

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) IssueTx

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

IssueTx issues a transaction to a node and returns the TxID

type GetAllBalancesArgs

type GetAllBalancesArgs struct {
	JSONAddress    interface{} `json:"address"`
	IncludePartial bool        `json:"includePartial"`
}

GetAllBalancesArgs are arguments for GetAllBalances

type GetAllBalancesReply

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

GetAllBalancesReply is the reply from GetAllBalances

type GetAssetDescriptionArgs

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

GetAssetDescriptionArgs are arguments for GetAssetDescription

type GetAssetDescriptionReply

type GetAssetDescriptionReply struct {
	AssetID      string `json:"assetID"`
	Name         string `json:"name"`
	Symbol       string `json:"symbol"`
	Denomination byte   `json:"denomination"`
}

GetAssetDescriptionReply is the reply from GetAssetDescription

type GetBalanceArgs

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

GetBalanceArgs are arguments for GetBalance

type GetBalanceReply

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

GetBalanceReply is the reply from GetBalance

type GetTxFeeReply

type GetTxFeeReply struct {
	TxFee            json.Uint64 `json:"txFee"`
	CreateAssetTxFee json.Uint64 `json:"createAssetTxFee"`
}

GetTxFeeReply is the response from a GetTxFee call

type GetTxStatusReply

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

GetTxStatusReply is the response from a GetTxStatus call

type StaticClient

type StaticClient interface {
	BuildGenesis(ctx context.Context, args *BuildGenesisArgs, options ...rpc.Option) (*BuildGenesisReply, error)
}

StaticClient for interacting with the XVM static api

func NewStaticClient

func NewStaticClient(uri string) StaticClient

NewClient returns an XVM client for interacting with the xvm static api

type WalletClient deprecated

type WalletClient struct {
	Requester rpc.EndpointRequester
}

WalletClient for interacting with exchangevm managed wallet.

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

func NewWalletClient deprecated

func NewWalletClient(uri, chain string) *WalletClient

NewWalletClient returns an Exchange VM wallet client for interacting with exchangevm managed wallet

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

func (*WalletClient) IssueTx

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

IssueTx issues a transaction to a node and returns the TxID

Jump to

Keyboard shortcuts

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