algod

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: MIT Imports: 13 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client manages the REST interface for a calling user.

func MakeClient

func MakeClient(address string, apiToken string) (c Client, err error)

MakeClient is the factory for constructing a Client for a given endpoint.

func MakeClientWithHeaders

func MakeClientWithHeaders(address string, apiToken string, headers []*Header) (c Client, err error)

MakeClientWithHeaders is the factory for constructing a Client for a given endpoint with additional user defined headers.

func (Client) AccountInformation

func (client Client) AccountInformation(address string, headers ...*Header) (response models.Account, err error)

AccountInformation also gets the AccountInformationResponse associated with the passed address

func (Client) AssetInformation

func (client Client) AssetInformation(index uint64, headers ...*Header) (response models.AssetParams, err error)

AssetInformation also gets the AssetInformationResponse associated with the passed asset creator and index

func (Client) Block

func (client Client) Block(round uint64, headers ...*Header) (response models.Block, err error)

Block gets the block info for the given round

func (Client) BlockRaw added in v1.3.0

func (client Client) BlockRaw(round uint64, headers ...*Header) (blockbytes []byte, err error)

BlockRaw gets the raw block msgpack bytes for the given round

func (Client) BuildSuggestedParams added in v1.3.0

func (client Client) BuildSuggestedParams(headers ...*Header) (response types.SuggestedParams, err error)

BuildSuggestedParams gets the suggested transaction parameters and builds a types.SuggestedParams to pass to transaction builders (see package future)

func (Client) GetPendingTransactions

func (client Client) GetPendingTransactions(maxTxns uint64, headers ...*Header) (response models.PendingTransactions, err error)

GetPendingTransactions asks algod for a snapshot of current pending txns on the node, bounded by maxTxns. If maxTxns = 0, fetches as many transactions as possible.

func (Client) HealthCheck

func (client Client) HealthCheck(headers ...*Header) error

HealthCheck does a health check on the the potentially running node, returning an error if the API is down

func (Client) LedgerSupply

func (client Client) LedgerSupply(headers ...*Header) (response models.Supply, err error)

LedgerSupply gets the supply details for the specified node's Ledger

func (Client) PendingTransactionInformation

func (client Client) PendingTransactionInformation(transactionID string, headers ...*Header) (response models.Transaction, err error)

PendingTransactionInformation gets information about a recently issued transaction. There are several cases when this might succeed:

- transaction committed (CommittedRound > 0) - transaction still in the pool (CommittedRound = 0, PoolError = "") - transaction removed from pool due to error (CommittedRound = 0, PoolError != "")

Or the transaction may have happened sufficiently long ago that the node no longer remembers it, and this will return an error.

func (Client) SendRawTransaction

func (client Client) SendRawTransaction(stx []byte, headers ...*Header) (response models.TransactionID, err error)

SendRawTransaction gets the bytes of a SignedTxn and broadcasts it to the network

func (Client) Status

func (client Client) Status(headers ...*Header) (response models.NodeStatus, err error)

Status retrieves the StatusResponse from the running node the StatusResponse includes data like the consensus version and current round

func (Client) StatusAfterBlock

func (client Client) StatusAfterBlock(blockNum uint64, headers ...*Header) (response models.NodeStatus, err error)

StatusAfterBlock waits for a block to occur then returns the StatusResponse after that block blocks on the node end

func (Client) SuggestedFee

func (client Client) SuggestedFee(headers ...*Header) (response models.TransactionFee, err error)

SuggestedFee gets the recommended transaction fee from the node

func (Client) SuggestedParams

func (client Client) SuggestedParams(headers ...*Header) (response models.TransactionParams, err error)

SuggestedParams gets the suggested transaction parameters

func (Client) TransactionByID

func (client Client) TransactionByID(transactionID string, headers ...*Header) (response models.Transaction, err error)

TransactionByID gets a transaction by its ID. Works only if the indexer is enabled on the node being queried.

func (Client) TransactionInformation

func (client Client) TransactionInformation(accountAddress, transactionID string, headers ...*Header) (response models.Transaction, err error)

TransactionInformation gets information about a specific transaction involving a specific account it will only return information about transactions submitted to the node queried

func (Client) TransactionsByAddr

func (client Client) TransactionsByAddr(addr string, first, last uint64, headers ...*Header) (response models.TransactionList, err error)

TransactionsByAddr returns all transactions for a PK [addr] in the [first, last] rounds range.

func (Client) TransactionsByAddrForDate

func (client Client) TransactionsByAddrForDate(addr string, first, last string, headers ...*Header) (response models.TransactionList, err error)

TransactionsByAddrForDate returns all transactions for a PK [addr] in the [first, last] date range. Dates are of the form "2006-01-02".

func (Client) TransactionsByAddrLimit

func (client Client) TransactionsByAddrLimit(addr string, limit uint64, headers ...*Header) (response models.TransactionList, err error)

TransactionsByAddrLimit returns the last [limit] number of transaction for a PK [addr].

func (Client) Versions

func (client Client) Versions(headers ...*Header) (response models.Version, err error)

Versions retrieves the VersionResponse from the running node the VersionResponse includes data like version number and genesis ID

type Header struct {
	Key   string
	Value string
}

Header is a struct for custom headers.

Directories

Path Synopsis
Package models defines models used by an algod rest client// IF YOU MODIFY THIS FILE: IMPORTANT In practice, this is straight up copied from /v1/models/model.go.
Package models defines models used by an algod rest client// IF YOU MODIFY THIS FILE: IMPORTANT In practice, this is straight up copied from /v1/models/model.go.

Jump to

Keyboard shortcuts

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