Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v1.28.21 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: BSD-3-Clause Imports: 17 Imported by: 6

Documentation

Index

Constants

View Source
const DefaultPollingInterval = 50 * time.Millisecond

Variables

This section is empty.

Functions

func AwaitTxAccepted

func AwaitTxAccepted(
	ctx context.Context,
	c *Client,
	address ids.ShortID,
	nonce uint64,
	freq time.Duration,
	options ...rpc.Option,
) error

Types

type BalanceArgs

type BalanceArgs struct {
	Address ids.ShortID `json:"address"`
	AssetID ids.ID      `json:"assetID"`
}

type BalanceReply

type BalanceReply struct {
	Balance uint64 `json:"balance"`
}

type BlockArgs

type BlockArgs struct {
	BlockID ids.ID `json:"blockID"`
}

type BlockReply

type BlockReply struct {
	Block *block.Stateless `json:"block"`
}

type Client

type Client struct {
	Req rpc.EndpointRequester
}

func NewClient

func NewClient(uri, chain string) *Client

func (*Client) Balance

func (c *Client) Balance(
	ctx context.Context,
	address ids.ShortID,
	assetID ids.ID,
	options ...rpc.Option,
) (uint64, error)

func (*Client) Block

func (c *Client) Block(
	ctx context.Context,
	blkID ids.ID,
	options ...rpc.Option,
) (*block.Stateless, error)

func (*Client) Genesis

func (c *Client) Genesis(
	ctx context.Context,
	options ...rpc.Option,
) (*genesis.Genesis, error)

func (*Client) IssueTx

func (c *Client) IssueTx(
	ctx context.Context,
	newTx *tx.Tx,
	options ...rpc.Option,
) (ids.ID, error)

func (*Client) LastAccepted

func (c *Client) LastAccepted(
	ctx context.Context,
	options ...rpc.Option,
) (ids.ID, *block.Stateless, error)

func (*Client) Loan

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

func (*Client) Message

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

func (*Client) Network

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

func (*Client) Nonce

func (c *Client) Nonce(
	ctx context.Context,
	address ids.ShortID,
	options ...rpc.Option,
) (uint64, error)

type GenesisReply

type GenesisReply struct {
	Genesis *genesis.Genesis `json:"genesis"`
}

type IssueTxArgs

type IssueTxArgs struct {
	Tx []byte `json:"tx"`
}

type IssueTxReply

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

type LastAcceptedReply

type LastAcceptedReply struct {
	BlockID ids.ID           `json:"blockID"`
	Block   *block.Stateless `json:"block"`
}

type LoanArgs

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

type LoanReply

type LoanReply struct {
	Amount uint64 `json:"amount"`
}

type MessageArgs

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

type MessageReply

type MessageReply struct {
	Message   *warp.UnsignedMessage `json:"message"`
	Signature []byte                `json:"signature"`
}

type NetworkReply

type NetworkReply struct {
	NetworkID uint32 `json:"networkID"`
	ChainID   ids.ID `json:"chainID"`
}

type NonceArgs

type NonceArgs struct {
	Address ids.ShortID `json:"address"`
}

type NonceReply

type NonceReply struct {
	Nonce uint64 `json:"nonce"`
}

type Server

type Server interface {
	Network(r *http.Request, args *struct{}, reply *NetworkReply) error
	Genesis(r *http.Request, args *struct{}, reply *GenesisReply) error
	Nonce(r *http.Request, args *NonceArgs, reply *NonceReply) error
	Balance(r *http.Request, args *BalanceArgs, reply *BalanceReply) error
	Loan(r *http.Request, args *LoanArgs, reply *LoanReply) error
	IssueTx(r *http.Request, args *IssueTxArgs, reply *IssueTxReply) error
	LastAccepted(r *http.Request, args *struct{}, reply *LastAcceptedReply) error
	Block(r *http.Request, args *BlockArgs, reply *BlockReply) error
	Message(r *http.Request, args *MessageArgs, reply *MessageReply) error
}

Server defines the xsvm API server.

func NewServer

func NewServer(
	rt *runtime.Runtime,
	genesis *genesis.Genesis,
	state database.KeyValueReader,
	chain chain.Chain,
	builder builder.Builder,
) Server

Jump to

Keyboard shortcuts

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