api

package
v1.36.181 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: BSD-3-Clause Imports: 26 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"`
}

func (*BalanceArgs) MarshalZAP added in v1.36.178

func (x *BalanceArgs) MarshalZAP() ([]byte, error)

MarshalZAP writes BalanceArgs from constant offsets.

func (*BalanceArgs) UnmarshalZAP added in v1.36.178

func (x *BalanceArgs) UnmarshalZAP(data []byte) error

UnmarshalZAP reads BalanceArgs out of the buffer that arrived.

type BalanceReply

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

func (*BalanceReply) MarshalZAP added in v1.36.178

func (x *BalanceReply) MarshalZAP() ([]byte, error)

MarshalZAP writes BalanceReply from constant offsets.

func (*BalanceReply) UnmarshalZAP added in v1.36.178

func (x *BalanceReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads BalanceReply out of the buffer that arrived.

type BlockArgs

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

func (*BlockArgs) MarshalZAP added in v1.36.178

func (x *BlockArgs) MarshalZAP() ([]byte, error)

MarshalZAP writes BlockArgs from constant offsets.

func (*BlockArgs) UnmarshalZAP added in v1.36.178

func (x *BlockArgs) UnmarshalZAP(data []byte) error

UnmarshalZAP reads BlockArgs out of the buffer that arrived.

type BlockReply

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

type Client

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

This chain answers typed ops under its own base, so a call is a URL and a reply is that op's Out. There is no method name in a body: the address IS the operation. zip.Query turns the op's own In into the query string, so how an id is written here is derived exactly as it is read there.

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"`
}

func (*GenesisReply) MarshalZAP added in v1.36.178

func (x *GenesisReply) MarshalZAP() ([]byte, error)

MarshalZAP writes GenesisReply from constant offsets.

func (*GenesisReply) UnmarshalZAP added in v1.36.178

func (x *GenesisReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads GenesisReply out of the buffer that arrived.

type IssueTxArgs

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

func (*IssueTxArgs) MarshalZAP added in v1.36.178

func (x *IssueTxArgs) MarshalZAP() ([]byte, error)

MarshalZAP writes IssueTxArgs from constant offsets.

func (*IssueTxArgs) UnmarshalZAP added in v1.36.178

func (x *IssueTxArgs) UnmarshalZAP(data []byte) error

UnmarshalZAP reads IssueTxArgs out of the buffer that arrived.

type IssueTxReply

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

func (*IssueTxReply) MarshalZAP added in v1.36.178

func (x *IssueTxReply) MarshalZAP() ([]byte, error)

MarshalZAP writes IssueTxReply from constant offsets.

func (*IssueTxReply) UnmarshalZAP added in v1.36.178

func (x *IssueTxReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads IssueTxReply out of the buffer that arrived.

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"`
}

func (*LoanArgs) MarshalZAP added in v1.36.178

func (x *LoanArgs) MarshalZAP() ([]byte, error)

MarshalZAP writes LoanArgs from constant offsets.

func (*LoanArgs) UnmarshalZAP added in v1.36.178

func (x *LoanArgs) UnmarshalZAP(data []byte) error

UnmarshalZAP reads LoanArgs out of the buffer that arrived.

type LoanReply

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

func (*LoanReply) MarshalZAP added in v1.36.178

func (x *LoanReply) MarshalZAP() ([]byte, error)

MarshalZAP writes LoanReply from constant offsets.

func (*LoanReply) UnmarshalZAP added in v1.36.178

func (x *LoanReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads LoanReply out of the buffer that arrived.

type MessageArgs

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

func (*MessageArgs) MarshalZAP added in v1.36.178

func (x *MessageArgs) MarshalZAP() ([]byte, error)

MarshalZAP writes MessageArgs from constant offsets.

func (*MessageArgs) UnmarshalZAP added in v1.36.178

func (x *MessageArgs) UnmarshalZAP(data []byte) error

UnmarshalZAP reads MessageArgs out of the buffer that arrived.

type MessageReply

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

func (*MessageReply) MarshalZAP added in v1.36.178

func (x *MessageReply) MarshalZAP() ([]byte, error)

MarshalZAP writes MessageReply from constant offsets.

func (*MessageReply) UnmarshalZAP added in v1.36.178

func (x *MessageReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads MessageReply out of the buffer that arrived.

type NetworkReply

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

func (*NetworkReply) MarshalZAP added in v1.36.178

func (x *NetworkReply) MarshalZAP() ([]byte, error)

MarshalZAP writes NetworkReply from constant offsets.

func (*NetworkReply) UnmarshalZAP added in v1.36.178

func (x *NetworkReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads NetworkReply out of the buffer that arrived.

type NonceArgs

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

func (*NonceArgs) MarshalZAP added in v1.36.178

func (x *NonceArgs) MarshalZAP() ([]byte, error)

MarshalZAP writes NonceArgs from constant offsets.

func (*NonceArgs) UnmarshalZAP added in v1.36.178

func (x *NonceArgs) UnmarshalZAP(data []byte) error

UnmarshalZAP reads NonceArgs out of the buffer that arrived.

type NonceReply

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

func (*NonceReply) MarshalZAP added in v1.36.178

func (x *NonceReply) MarshalZAP() ([]byte, error)

MarshalZAP writes NonceReply from constant offsets.

func (*NonceReply) UnmarshalZAP added in v1.36.178

func (x *NonceReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads NonceReply out of the buffer that arrived.

type Server

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

Server answers what this chain holds. Its operations are registered by Server.Ops.

func NewServer

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

func (*Server) Ops added in v1.36.180

func (s *Server) Ops(logger log.Logger) *zip.App

ops is what this chain answers, stated once. Each registration carries its own In and Out, and the route, the OpenAPI document and the generated client all come from that one entry.

A READ is a GET, because a read changes nothing. The one WRITE is at server.Relay, where the bytes arrive already signed and carry their own authority. A path names the thing, not the verb.

Jump to

Keyboard shortcuts

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