types

package
v1.1.14 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: 11 Imported by: 10

Documentation

Index

Constants

View Source
const HTTPHeaderRoute = "Lux-Api-Route"

HTTPHeaderRoute is the canonical header used to route API requests.

View Source
const Null = "null"

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr added in v1.1.14

type Addr string

Addr is a network address — an IP and a port — as the JSON wire has always carried it: the text netip.AddrPort writes for itself.

It is text here rather than a netip.AddrPort because that type keeps its address, its zone and its port in unexported fields. Reflection cannot read them, so the derived layout is empty and a reply holding one arrives blank with no error to say so. GetNodeIPReply has exactly one field, so its entire answer was empty.

func AddrOf added in v1.1.14

func AddrOf(ap netip.AddrPort) Addr

AddrOf is ap as it crosses. It renders through netip's own marshaler, so the bytes are the ones that were already on the JSON wire — including the empty string an invalid address has always been written as.

func (Addr) AddrPort added in v1.1.14

func (a Addr) AddrPort() netip.AddrPort

AddrPort is the address as a netip.AddrPort, or the zero value when the text does not parse — which is what an absent address already reads as.

type EmptyReply

type EmptyReply struct{}

EmptyReply indicates that an api doesn't have a response to return.

func (*EmptyReply) MarshalZAP added in v1.1.13

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

MarshalZAP writes EmptyReply from constant offsets.

func (*EmptyReply) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads EmptyReply out of the buffer that arrived.

type Float64

type Float64 float64

func (Float64) JSONSchema added in v1.1.12

func (Float64) JSONSchema() map[string]any

func (Float64) MarshalJSON

func (f Float64) MarshalJSON() ([]byte, error)

func (*Float64) UnmarshalJSON

func (f *Float64) UnmarshalJSON(b []byte) error

type FormattedBlock

type FormattedBlock struct {
	Block    string              `json:"block"`
	Encoding formatting.Encoding `json:"encoding"`
}

FormattedBlock defines a JSON formatted struct containing a block in Hex format.

type FormattedTx

type FormattedTx struct {
	Tx       string              `json:"tx"`
	Encoding formatting.Encoding `json:"encoding"`
}

FormattedTx defines a JSON formatted struct containing a Tx as a string.

func (*FormattedTx) MarshalZAP added in v1.1.13

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

MarshalZAP writes FormattedTx from constant offsets.

func (*FormattedTx) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads FormattedTx out of the buffer that arrived.

type GetBlockArgs

type GetBlockArgs struct {
	BlockID  ids.ID              `json:"blockID"`
	Encoding formatting.Encoding `json:"encoding"`
}

GetBlockArgs is the parameters supplied to the GetBlock API.

func (*GetBlockArgs) MarshalZAP added in v1.1.13

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

MarshalZAP writes GetBlockArgs from constant offsets.

func (*GetBlockArgs) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads GetBlockArgs out of the buffer that arrived.

type GetBlockByHeightArgs

type GetBlockByHeightArgs struct {
	Height   Uint64              `json:"height"`
	Encoding formatting.Encoding `json:"encoding"`
}

GetBlockByHeightArgs is the parameters supplied to the GetBlockByHeight API.

func (*GetBlockByHeightArgs) MarshalZAP added in v1.1.13

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

MarshalZAP writes GetBlockByHeightArgs from constant offsets.

func (*GetBlockByHeightArgs) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads GetBlockByHeightArgs out of the buffer that arrived.

type GetBlockResponse

type GetBlockResponse struct {
	Block json.RawMessage `json:"block"`
	// If GetBlockResponse.Encoding is formatting.Hex, GetBlockResponse.Block is
	// the string representation of the block under hex encoding.
	// If GetBlockResponse.Encoding is formatting.JSON, GetBlockResponse.Block
	// is the actual block returned as a JSON.
	Encoding formatting.Encoding `json:"encoding"`
}

GetBlockResponse is the response object for the GetBlock API.

func (*GetBlockResponse) MarshalZAP added in v1.1.13

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

MarshalZAP writes GetBlockResponse from constant offsets.

func (*GetBlockResponse) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads GetBlockResponse out of the buffer that arrived.

type GetHeightResponse

type GetHeightResponse struct {
	Height Uint64 `json:"height"`
}

func (*GetHeightResponse) MarshalZAP added in v1.1.13

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

MarshalZAP writes GetHeightResponse from constant offsets.

func (*GetHeightResponse) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads GetHeightResponse out of the buffer that arrived.

type GetTxArgs

type GetTxArgs struct {
	TxID     ids.ID              `json:"txID"`
	Encoding formatting.Encoding `json:"encoding"`
}

func (*GetTxArgs) MarshalZAP added in v1.1.13

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

MarshalZAP writes GetTxArgs from constant offsets.

func (*GetTxArgs) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads GetTxArgs out of the buffer that arrived.

type GetTxReply

type GetTxReply struct {
	// If [GetTxArgs.Encoding] is [Hex], [Tx] is the string representation of
	// the tx under hex encoding.
	// If [GetTxArgs.Encoding] is [JSON], [Tx] is the actual tx, which will be
	// returned as JSON to the caller.
	Tx       json.RawMessage     `json:"tx"`
	Encoding formatting.Encoding `json:"encoding"`
}

GetTxReply defines an object containing a single [Tx] object along with Encoding.

func (*GetTxReply) MarshalZAP added in v1.1.13

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

MarshalZAP writes GetTxReply from constant offsets.

func (*GetTxReply) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads GetTxReply out of the buffer that arrived.

type GetUTXOsArgs

type GetUTXOsArgs struct {
	Addresses   []string            `json:"addresses"`
	SourceChain string              `json:"sourceChain"`
	Limit       Uint32              `json:"limit"`
	StartIndex  Index               `json:"startIndex"`
	Encoding    formatting.Encoding `json:"encoding"`
}

GetUTXOsArgs are arguments for passing into GetUTXOs. Gets the UTXOs that reference at least one address in [Addresses]. Returns at most [limit] addresses. If specified, [SourceChain] is the chain where the atomic UTXOs were exported from. If empty, or the Chain ID of this VM is specified, then GetUTXOs fetches the native UTXOs. If [limit] == 0 or > [maxUTXOsToFetch], fetches up to [maxUTXOsToFetch]. [StartIndex] defines where to start fetching UTXOs (for pagination.) UTXOs fetched are from addresses equal to or greater than [StartIndex.Address] For address [StartIndex.Address], only UTXOs with IDs greater than [StartIndex.UTXO] will be returned. If [StartIndex] is omitted, gets all UTXOs. If GetUTXOs is called multiple times, with our without [StartIndex], it is not guaranteed that returned UTXOs are unique. That is, the same UTXO may appear in the response of multiple calls.

func (*GetUTXOsArgs) MarshalZAP added in v1.1.13

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

MarshalZAP writes GetUTXOsArgs from constant offsets.

func (*GetUTXOsArgs) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads GetUTXOsArgs out of the buffer that arrived.

type GetUTXOsReply

type GetUTXOsReply struct {
	// Number of UTXOs returned.
	NumFetched Uint64 `json:"numFetched"`
	// The UTXOs.
	UTXOs []string `json:"utxos"`
	// The last UTXO that was returned, and the address it corresponds to.
	// Used for pagination. To get the rest of the UTXOs, call GetUTXOs
	// again and set [StartIndex] to this value.
	EndIndex Index `json:"endIndex"`
	// Encoding specifies the encoding format the UTXOs are returned in.
	Encoding formatting.Encoding `json:"encoding"`
}

GetUTXOsReply defines the GetUTXOs replies returned from the API.

func (*GetUTXOsReply) MarshalZAP added in v1.1.13

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

MarshalZAP writes GetUTXOsReply from constant offsets.

func (*GetUTXOsReply) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads GetUTXOsReply out of the buffer that arrived.

type Index

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.

func (*Index) MarshalZAP added in v1.1.13

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

MarshalZAP writes Index from constant offsets.

func (*Index) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads Index out of the buffer that arrived.

type JSONAddress

type JSONAddress struct {
	Address string `json:"address"`
}

JSONAddress contains an address.

func (*JSONAddress) MarshalZAP added in v1.1.13

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

MarshalZAP writes JSONAddress from constant offsets.

func (*JSONAddress) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads JSONAddress out of the buffer that arrived.

type JSONAddresses

type JSONAddresses struct {
	Addresses []string `json:"addresses"`
}

JSONAddresses contains a list of address.

func (*JSONAddresses) MarshalZAP added in v1.1.13

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

MarshalZAP writes JSONAddresses from constant offsets.

func (*JSONAddresses) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads JSONAddresses out of the buffer that arrived.

type JSONTxID

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

JSONTxID contains the ID of a transaction.

func (*JSONTxID) MarshalZAP added in v1.1.13

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

MarshalZAP writes JSONTxID from constant offsets.

func (*JSONTxID) UnmarshalZAP added in v1.1.13

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

UnmarshalZAP reads JSONTxID out of the buffer that arrived.

type Raw added in v1.1.14

type Raw []byte

Raw is a value whose shape only the sender knows: it crosses as the bytes of its own JSON, and is written back out as those bytes.

It is what an `any` field becomes. An interface has no layout until it holds something, and what it holds is decided per call — a health check answers with an object, a string or an array depending on which check it is — so there is no struct to name. The bytes are the honest shape, and they reach a caller exactly as they were produced.

func RawOf added in v1.1.14

func RawOf(v any) (Raw, error)

RawOf is v encoded once, at the point where its concrete type is still known.

func (Raw) MarshalJSON added in v1.1.14

func (r Raw) MarshalJSON() ([]byte, error)

func (*Raw) UnmarshalJSON added in v1.1.14

func (r *Raw) UnmarshalJSON(b []byte) error

type Time added in v1.1.14

type Time struct {
	// Seconds is seconds since the epoch.
	Seconds int64 `json:"seconds"`
	// Nanos is the nanosecond within that second.
	Nanos int32 `json:"nanos"`
	// Offset is seconds east of UTC.
	Offset int32 `json:"offset"`
}

Time is an instant, as three numbers that have a layout.

time.Time cannot cross for the same reason netip.AddrPort cannot: every field is unexported. The JSON is byte for byte what time.Time's own marshaler writes, because the rendering depends only on the instant and the offset — RFC 3339 spells a zero offset "Z" and any other one "+HH:MM" — so carrying the offset is enough to put the instant back in the zone it was read in.

func TimeOf added in v1.1.14

func TimeOf(t time.Time) Time

TimeOf is t as a value that can cross.

func (Time) IsZero added in v1.1.14

func (t Time) IsZero() bool

IsZero reports whether this is the zero instant, which is what an absent time has always marshalled as.

func (Time) MarshalJSON added in v1.1.14

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) MarshalZAP added in v1.1.14

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

MarshalZAP writes Time from constant offsets.

func (Time) Time added in v1.1.14

func (t Time) Time() time.Time

Time is the instant, in the zone it was read in.

func (*Time) UnmarshalJSON added in v1.1.14

func (t *Time) UnmarshalJSON(b []byte) error

func (*Time) UnmarshalZAP added in v1.1.14

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

UnmarshalZAP reads Time out of the buffer that arrived.

type Uint16 added in v1.1.11

type Uint16 uint16

func (Uint16) JSONSchema added in v1.1.12

func (Uint16) JSONSchema() map[string]any

func (Uint16) MarshalJSON added in v1.1.11

func (u Uint16) MarshalJSON() ([]byte, error)

func (*Uint16) UnmarshalJSON added in v1.1.11

func (u *Uint16) UnmarshalJSON(b []byte) error

type Uint32

type Uint32 uint32

func (Uint32) JSONSchema added in v1.1.12

func (Uint32) JSONSchema() map[string]any

func (Uint32) MarshalJSON

func (u Uint32) MarshalJSON() ([]byte, error)

func (*Uint32) UnmarshalJSON

func (u *Uint32) UnmarshalJSON(b []byte) error

type Uint64

type Uint64 uint64

func (Uint64) JSONSchema added in v1.1.12

func (Uint64) JSONSchema() map[string]any

func (Uint64) MarshalJSON

func (u Uint64) MarshalJSON() ([]byte, error)

func (*Uint64) UnmarshalJSON

func (u *Uint64) UnmarshalJSON(b []byte) error

type Uint256 added in v1.1.11

type Uint256 uint256.Int

Uint256 is the width the EVM actually carries — a balance, a wei value or a token amount does not fit in 64 bits, and every such field reaching this boundary had to be a string or a big.Int by hand. It is fixed-size rather than big.Int so it cannot be nil and cannot allocate on the hot path.

func (Uint256) JSONSchema added in v1.1.12

func (Uint256) JSONSchema() map[string]any

Uint256 is the width the EVM carries; it does not fit any JSON numeric.

func (Uint256) MarshalJSON added in v1.1.11

func (u Uint256) MarshalJSON() ([]byte, error)

func (*Uint256) UnmarshalJSON added in v1.1.11

func (u *Uint256) UnmarshalJSON(b []byte) error

type UserPass

type UserPass struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

UserPass contains a username and password.

Jump to

Keyboard shortcuts

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