api

package
v1.7.6-rc.3 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: BSD-3-Clause Imports: 3 Imported by: 59

README

Avalanche API

buf

Protobuf files are hosted at https://buf.build/ava-labs/avalanchego and can be used as dependencies in other projects.

Protobuf linting and generation for this project is managed by buf.

Please find installation instructions on https://docs.buf.build/installation/ or use the provided Dockerfile.buf.

Any changes made to proto files can be updated by running protobuf_codegen.sh located in the scripts/ directory.

Introduction to buf https://docs.buf.build/tour/introduction

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FormattedBlock added in v1.7.6

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

FormattedBlock defines a JSON formatted struct containing a block in CB58/Hex format

type FormattedTx added in v1.0.3

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

FormattedTx defines a JSON formatted struct containing a Tx in CB58 format

type GetBlockArgs added in v1.7.6

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

GetBlockArgs is the parameters supplied to the GetBlock API

type GetBlockResponse added in v1.7.6

type GetBlockResponse struct {
	Block interface{} `json:"block"`
	// If GetBlockResponse.Encoding is formatting.Hex or formatting.CB58,
	// GetBlockResponse.Block is the string representation of the block
	// under the respective 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.

type GetTxArgs added in v1.0.3

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

type GetTxReply added in v1.4.12

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

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

type GetUTXOsArgs added in v1.0.6

type GetUTXOsArgs struct {
	Addresses   []string            `json:"addresses"`
	SourceChain string              `json:"sourceChain"`
	Limit       json.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.

type GetUTXOsReply added in v1.0.6

type GetUTXOsReply struct {
	// Number of UTXOs returned
	NumFetched json.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

type Index added in v1.0.6

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.

type JSONAddress added in v1.0.3

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

JSONAddress contains an address

type JSONAddresses added in v1.0.3

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

JSONAddresses contains a list of address

type JSONChangeAddr added in v1.0.3

type JSONChangeAddr struct {
	ChangeAddr string `json:"changeAddr"`
}

JSONChangeAddr is the address change is sent to, if any

type JSONFromAddrs added in v1.0.3

type JSONFromAddrs struct {
	From []string `json:"from"`
}

JSONFromAddrs is a list of addresses to send funds from

type JSONSpendHeader added in v1.0.3

type JSONSpendHeader struct {
	UserPass
	JSONFromAddrs
	JSONChangeAddr
}

JSONSpendHeader is 3 arguments to a method that spends (including those with tx fees) 1) The username/password 2) The addresses used in the method 3) The address to send change to

type JSONTxID added in v1.0.3

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

JSONTxID contains the ID of a transaction

type JSONTxIDChangeAddr added in v1.0.3

type JSONTxIDChangeAddr struct {
	JSONTxID
	JSONChangeAddr
}

JSONTxIDChangeAddr is a tx ID and change address

type SuccessResponse added in v0.8.0

type SuccessResponse struct {
	Success bool `json:"success"`
}

SuccessResponse indicates success of an API call

type UserPass added in v0.8.0

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

UserPass contains a username and a password

Directories

Path Synopsis
proto
Package server is a generated GoMock package.
Package server is a generated GoMock package.

Jump to

Keyboard shortcuts

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