client

package
v0.0.0-...-b259709 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blob

type Blob []byte

Blob represents arbitrary blob of data satisfying RawResponse interface

func (*Blob) SetBytes

func (blob *Blob) SetBytes(b []byte)

SetBytes fulfills the RawResponse interface on Blob

type BytesBase64

type BytesBase64 []byte

BytesBase64 is a base64-encoded binary blob (i.e., []byte), for use with text encodings like JSON.

func (BytesBase64) MarshalText

func (b BytesBase64) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface

func (*BytesBase64) UnmarshalText

func (b *BytesBase64) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface

type HTTPError

type HTTPError struct {
	StatusCode  int
	Status      string
	ErrorString string
	Data        map[string]any
}

HTTPError is generated when we receive an unhandled error from the server. This error contains the error string.

func (HTTPError) Error

func (e HTTPError) Error() string

Error formats an error string.

type RawResponse

type RawResponse interface {
	SetBytes([]byte)
}

RawResponse is fulfilled by responses that should not be decoded as json

type RestClient

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

RestClient manages the REST interface for a calling user.

func MakeRestClient

func MakeRestClient(url url.URL, apiToken string) RestClient

MakeRestClient is the factory for constructing a RestClient for a given endpoint

func (RestClient) AbortCatchup

func (client RestClient) AbortCatchup(catchpointLabel string) (response model.CatchpointAbortResponse, err error)

AbortCatchup aborts the currently running catchup

func (RestClient) AccountApplicationInformation

func (client RestClient) AccountApplicationInformation(accountAddress string, applicationID uint64) (response model.AccountApplicationResponse, err error)

AccountApplicationInformation gets account information about a given app.

func (RestClient) AccountAssetInformation

func (client RestClient) AccountAssetInformation(accountAddress string, assetID uint64) (response model.AccountAssetResponse, err error)

AccountAssetInformation gets account information about a given app.

func (RestClient) AccountInformation

func (client RestClient) AccountInformation(address string, includeCreatables bool) (response model.Account, err error)

AccountInformation gets the AccountData associated with the passed address

func (RestClient) ApplicationBoxes

func (client RestClient) ApplicationBoxes(appID uint64, maxBoxNum uint64) (response model.BoxesResponse, err error)

ApplicationBoxes gets the BoxesResponse associated with the passed application ID

func (RestClient) ApplicationInformation

func (client RestClient) ApplicationInformation(index uint64) (response model.Application, err error)

ApplicationInformation gets the ApplicationInformationResponse associated with the passed application index

func (RestClient) AssetInformation

func (client RestClient) AssetInformation(index uint64) (response model.Asset, err error)

AssetInformation gets the AssetInformationResponse associated with the passed asset index

func (RestClient) Block

func (client RestClient) Block(round uint64) (response model.BlockResponse, err error)

Block gets the block info for the given round

func (RestClient) Catchup

func (client RestClient) Catchup(catchpointLabel string, minRounds uint64) (response model.CatchpointStartResponse, err error)

Catchup start catching up to the give catchpoint label

func (RestClient) Compile

func (client RestClient) Compile(program []byte, useSourceMap bool) (compiledProgram []byte, programHash crypto.Digest, sourceMap *logic.SourceMap, err error)

Compile compiles the given program and returned the compiled program

func (RestClient) GetApplicationBoxByName

func (client RestClient) GetApplicationBoxByName(appID uint64, name string) (response model.BoxResponse, err error)

GetApplicationBoxByName gets the BoxResponse associated with the passed application ID and box name

func (RestClient) GetBlockTimestampOffset

func (client RestClient) GetBlockTimestampOffset() (response model.GetBlockTimeStampOffsetResponse, err error)

GetBlockTimestampOffset gets the offset in seconds which is being added to devmode blocks

func (RestClient) GetGoRoutines

func (client RestClient) GetGoRoutines(ctx context.Context) (goRoutines string, err error)

GetGoRoutines gets a dump of the goroutines from pprof Not supported

func (RestClient) GetLedgerStateDelta

func (client RestClient) GetLedgerStateDelta(round uint64) (response model.LedgerStateDeltaResponse, err error)

GetLedgerStateDelta retrieves the ledger state delta for the round

func (RestClient) GetLedgerStateDeltaForTransactionGroup

func (client RestClient) GetLedgerStateDeltaForTransactionGroup(id string) (response model.LedgerStateDeltaForTransactionGroupResponse, err error)

GetLedgerStateDeltaForTransactionGroup retrieves the ledger state delta for the txn group specified by the id

func (RestClient) GetParticipationKeyByID

func (client RestClient) GetParticipationKeyByID(participationID string) (response model.ParticipationKeyResponse, err error)

GetParticipationKeyByID gets a single participation key

func (RestClient) GetParticipationKeys

func (client RestClient) GetParticipationKeys() (response model.ParticipationKeysResponse, err error)

GetParticipationKeys gets all of the participation keys

func (RestClient) GetPendingTransactions

func (client RestClient) GetPendingTransactions(maxTxns uint64) (response model.PendingTransactionsResponse, 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 (RestClient) GetRawPendingTransactions

func (client RestClient) GetRawPendingTransactions(maxTxns uint64) (response []byte, err error)

GetRawPendingTransactions gets the raw encoded msgpack transactions. If maxTxns = 0, fetches as many transactions as possible.

func (RestClient) GetSyncRound

func (client RestClient) GetSyncRound() (response model.GetSyncRoundResponse, err error)

GetSyncRound retrieves the sync round (if set)

func (RestClient) GetTransactionGroupLedgerStateDeltasForRound

func (client RestClient) GetTransactionGroupLedgerStateDeltasForRound(round uint64) (response model.TransactionGroupLedgerStateDeltasForRoundResponse, err error)

GetTransactionGroupLedgerStateDeltasForRound retrieves the ledger state deltas for the txn groups in the specified round

func (RestClient) HealthCheck

func (client RestClient) HealthCheck() error

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

func (RestClient) LedgerSupply

func (client RestClient) LedgerSupply() (response model.SupplyResponse, err error)

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

func (RestClient) LightBlockHeaderProof

func (client RestClient) LightBlockHeaderProof(round uint64) (response model.LightBlockHeaderProofResponse, err error)

LightBlockHeaderProof gets a Merkle proof for the light block header of a given round.

func (RestClient) PendingTransactionInformation

func (client RestClient) PendingTransactionInformation(transactionID string) (response model.PendingTransactionResponse, 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 (RestClient) PendingTransactionsByAddr

func (client RestClient) PendingTransactionsByAddr(addr string, max uint64) (response model.PendingTransactionsResponse, err error)

PendingTransactionsByAddr returns all the pending transactions for an addr.

func (RestClient) PostParticipationKey

func (client RestClient) PostParticipationKey(file []byte) (response model.PostParticipationResponse, err error)

PostParticipationKey sends a key file to the node.

func (RestClient) RawAccountApplicationInformation

func (client RestClient) RawAccountApplicationInformation(accountAddress string, applicationID uint64) (response []byte, err error)

RawAccountApplicationInformation gets account information about a given app.

func (RestClient) RawAccountAssetInformation

func (client RestClient) RawAccountAssetInformation(accountAddress string, assetID uint64) (response []byte, err error)

RawAccountAssetInformation gets account information about a given app.

func (RestClient) RawAccountInformation

func (client RestClient) RawAccountInformation(address string) (response []byte, err error)

RawAccountInformation gets the raw AccountData associated with the passed address

func (RestClient) RawBlock

func (client RestClient) RawBlock(round uint64) (response []byte, err error)

RawBlock gets the encoded, raw msgpack block for the given round

func (RestClient) RawDryrun

func (client RestClient) RawDryrun(data []byte) (response []byte, err error)

RawDryrun gets the raw DryrunResponse associated with the passed address

func (RestClient) RawPendingTransactionInformation

func (client RestClient) RawPendingTransactionInformation(transactionID string) (response []byte, err error)

RawPendingTransactionInformation gets information about a recently issued transaction in msgpack encoded bytes.

func (RestClient) RawPendingTransactionsByAddr

func (client RestClient) RawPendingTransactionsByAddr(addr string, max uint64) (response []byte, err error)

RawPendingTransactionsByAddr returns all the pending transactions for an addr in raw msgpack format.

func (RestClient) RawSimulateRawTransaction

func (client RestClient) RawSimulateRawTransaction(data []byte) (response []byte, err error)

RawSimulateRawTransaction simulates transactions by taking raw request bytes and returns relevant simulation results as raw bytes.

func (RestClient) ReadyCheck

func (client RestClient) ReadyCheck() error

ReadyCheck does a readiness check on the potentially running node, returning an error if the node is not ready (caught up and healthy)

func (RestClient) RemoveParticipationKeyByID

func (client RestClient) RemoveParticipationKeyByID(participationID string) (err error)

RemoveParticipationKeyByID removes a particiption key by its ID

func (RestClient) SendRawTransaction

func (client RestClient) SendRawTransaction(txn transactions.SignedTxn) (response model.PostTransactionsResponse, err error)

SendRawTransaction gets a SignedTxn and broadcasts it to the network

func (RestClient) SendRawTransactionAsync

func (client RestClient) SendRawTransactionAsync(txn transactions.SignedTxn) (response model.PostTransactionsResponse, err error)

SendRawTransactionAsync gets a SignedTxn and broadcasts it to the network

func (RestClient) SendRawTransactionGroup

func (client RestClient) SendRawTransactionGroup(txgroup []transactions.SignedTxn) error

SendRawTransactionGroup gets a SignedTxn group and broadcasts it to the network

func (RestClient) SetBlockTimestampOffset

func (client RestClient) SetBlockTimestampOffset(offset uint64) (err error)

SetBlockTimestampOffset sets the offset in seconds to add to the block timestamp when in devmode

func (RestClient) SetSyncRound

func (client RestClient) SetSyncRound(round uint64) (err error)

SetSyncRound sets the sync round for the catchup service

func (RestClient) Shutdown

func (client RestClient) Shutdown() (err error)

Shutdown requests the node to shut itself down

func (RestClient) StateProofs

func (client RestClient) StateProofs(round uint64) (response model.StateProofResponse, err error)

StateProofs gets a state proof that covers a given round

func (RestClient) Status

func (client RestClient) Status() (response model.NodeStatusResponse, err error)

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

func (RestClient) StatusAfterBlock

func (client RestClient) StatusAfterBlock(blockNum uint64) (response model.NodeStatusResponse, err error)

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

func (RestClient) SuggestedParams

func (client RestClient) SuggestedParams() (response model.TransactionParametersResponse, err error)

SuggestedParams gets the suggested transaction parameters

func (RestClient) TransactionProof

func (client RestClient) TransactionProof(txid string, round uint64, hashType crypto.HashType) (response model.TransactionProofResponse, err error)

TransactionProof gets a Merkle proof for a transaction in a block.

func (RestClient) UnsetSyncRound

func (client RestClient) UnsetSyncRound() (err error)

UnsetSyncRound deletes the sync round constraint

func (RestClient) Versions

func (client RestClient) Versions() (response common.Version, err error)

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

func (RestClient) WaitForBlock

func (client RestClient) WaitForBlock(round basics.Round) (response model.NodeStatusResponse, err error)

WaitForBlock returns the node status after waiting for the given round.

Jump to

Keyboard shortcuts

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