v2

package
v0.0.0-...-76c1feb Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountDataToAccount

func AccountDataToAccount(
	address string, record *basics.AccountData, assetsCreators map[basics.AssetIndex]string,
	lastRound basics.Round, amountWithoutPendingRewards basics.MicroAlgos,
) (generated.Account, error)

AccountDataToAccount converts basics.AccountData to v2.generated.Account

func AccountToAccountData

func AccountToAccountData(a *generated.Account) (basics.AccountData, error)

AccountToAccountData converts v2.generated.Account to basics.AccountData

func AppParamsToApplication

func AppParamsToApplication(creator string, appIdx basics.AppIndex, appParams *basics.AppParams) generated.Application

AppParamsToApplication converts basics.AppParams to generated.Application

func ApplicationParamsToAppParams

func ApplicationParamsToAppParams(gap *generated.ApplicationParams) (basics.AppParams, error)

ApplicationParamsToAppParams converts generated.ApplicationParams to basics.AppParams

func AssetParamsToAsset

func AssetParamsToAsset(creator string, idx basics.AssetIndex, params *basics.AssetParams) generated.Asset

AssetParamsToAsset converts basics.AssetParams to generated.Asset

func MergeAppParams

func MergeAppParams(base *basics.AppParams, update *basics.AppParams)

MergeAppParams merges values, existing in "base" take priority over new in "update"

func StateDeltaToStateDelta

func StateDeltaToStateDelta(sd basics.StateDelta) *generated.StateDelta

StateDeltaToStateDelta converts basics.StateDelta to generated.StateDelta

Types

type DryrunRequest

type DryrunRequest struct {
	// Txns is transactions to simulate
	Txns []transactions.SignedTxn `codec:"txns"` // not supposed to be serialized

	// Optional, useful for testing Application Call txns.
	Accounts []generated.Account `codec:"accounts"`

	Apps []generated.Application `codec:"apps"`

	// ProtocolVersion specifies a specific version string to operate under, otherwise whatever the current protocol of the network this algod is running in.
	ProtocolVersion string `codec:"protocol-version"`

	// Round is available to some TEAL scripts. Defaults to the current round on the network this algod is attached to.
	Round uint64 `codec:"round"`

	// LatestTimestamp is available to some TEAL scripts. Defaults to the latest confirmed timestamp this algod is attached to.
	LatestTimestamp int64 `codec:"latest-timestamp"`

	Sources []generated.DryrunSource `codec:"sources"`
}

DryrunRequest object uploaded to /v2/teal/dryrun It is the same as generated.DryrunRequest but Txns deserialized properly. Given the Transactions and simulated ledger state upload, run TEAL scripts and return debugging information. This is also used for msgp-decoding

func DryrunRequestFromGenerated

func DryrunRequestFromGenerated(gdr *generated.DryrunRequest) (dr DryrunRequest, err error)

DryrunRequestFromGenerated converts generated.DryrunRequest to DryrunRequest field by fields and re-types Txns []transactions.SignedTxn

func (*DryrunRequest) ExpandSources

func (dr *DryrunRequest) ExpandSources() error

ExpandSources takes DryrunRequest.Source, compiles and puts into appropriate DryrunRequest.Apps entry

type Handlers

type Handlers struct {
	Node     NodeInterface
	Log      logging.Logger
	Shutdown <-chan struct{}
}

Handlers is an implementation to the V2 route handler interface defined by the generated code.

func (*Handlers) AbortCatchup

func (v2 *Handlers) AbortCatchup(ctx echo.Context, catchpoint string) error

AbortCatchup Given a catchpoint, it aborts catching up to this catchpoint (DELETE /v2/catchup/{catchpoint})

func (*Handlers) AccountInformation

func (v2 *Handlers) AccountInformation(ctx echo.Context, address string, params generated.AccountInformationParams) error

AccountInformation gets account information for a given account. (GET /v2/accounts/{address})

func (*Handlers) GetApplicationByID

func (v2 *Handlers) GetApplicationByID(ctx echo.Context, applicationID uint64) error

GetApplicationByID returns application information by app idx. (GET /v2/applications/{application-id})

func (*Handlers) GetAssetByID

func (v2 *Handlers) GetAssetByID(ctx echo.Context, assetID uint64) error

GetAssetByID returns application information by app idx. (GET /v2/assets/{asset-id})

func (*Handlers) GetBlock

func (v2 *Handlers) GetBlock(ctx echo.Context, round uint64, params generated.GetBlockParams) error

GetBlock gets the block for the given round. (GET /v2/blocks/{round})

func (*Handlers) GetPendingTransactions

func (v2 *Handlers) GetPendingTransactions(ctx echo.Context, params generated.GetPendingTransactionsParams) error

GetPendingTransactions returns the list of unconfirmed transactions currently in the transaction pool. (GET /v2/transactions/pending)

func (*Handlers) GetPendingTransactionsByAddress

func (v2 *Handlers) GetPendingTransactionsByAddress(ctx echo.Context, addr string, params generated.GetPendingTransactionsByAddressParams) error

GetPendingTransactionsByAddress takes an Algorand address and returns its associated list of unconfirmed transactions currently in the transaction pool. (GET /v2/accounts/{address}/transactions/pending)

func (*Handlers) GetProof

func (v2 *Handlers) GetProof(ctx echo.Context, round uint64, txid string, params generated.GetProofParams) error

GetProof generates a Merkle proof for a transaction in a block. (GET /v2/blocks/{round}/transactions/{txid}/proof)

func (*Handlers) GetStatus

func (v2 *Handlers) GetStatus(ctx echo.Context) error

GetStatus gets the current node status. (GET /v2/status)

func (*Handlers) GetSupply

func (v2 *Handlers) GetSupply(ctx echo.Context) error

GetSupply gets the current supply reported by the ledger. (GET /v2/ledger/supply)

func (*Handlers) PendingTransactionInformation

func (v2 *Handlers) PendingTransactionInformation(ctx echo.Context, txid string, params generated.PendingTransactionInformationParams) error

PendingTransactionInformation returns a transaction with the specified txID from the transaction pool. If not found looks for the transaction in the last proto.MaxTxnLife rounds (GET /v2/transactions/pending/{txid})

func (*Handlers) RawTransaction

func (v2 *Handlers) RawTransaction(ctx echo.Context) error

RawTransaction broadcasts a raw transaction to the network. (POST /v2/transactions)

func (*Handlers) RegisterParticipationKeys

func (v2 *Handlers) RegisterParticipationKeys(ctx echo.Context, address string, params private.RegisterParticipationKeysParams) error

RegisterParticipationKeys registers participation keys. (POST /v2/register-participation-keys/{address})

func (*Handlers) ShutdownNode

func (v2 *Handlers) ShutdownNode(ctx echo.Context, params private.ShutdownNodeParams) error

ShutdownNode shuts down the node. (POST /v2/shutdown)

func (*Handlers) StartCatchup

func (v2 *Handlers) StartCatchup(ctx echo.Context, catchpoint string) error

StartCatchup Given a catchpoint, it starts catching up to this catchpoint (POST /v2/catchup/{catchpoint})

func (*Handlers) TealCompile

func (v2 *Handlers) TealCompile(ctx echo.Context) error

TealCompile compiles TEAL code to binary, return both binary and hash (POST /v2/teal/compile)

func (*Handlers) TealDryrun

func (v2 *Handlers) TealDryrun(ctx echo.Context) error

TealDryrun takes transactions and additional simulated ledger state and returns debugging information. (POST /v2/teal/dryrun)

func (*Handlers) TransactionParams

func (v2 *Handlers) TransactionParams(ctx echo.Context) error

TransactionParams returns the suggested parameters for constructing a new transaction. (GET /v2/transactions/params)

func (*Handlers) WaitForBlock

func (v2 *Handlers) WaitForBlock(ctx echo.Context, round uint64) error

WaitForBlock returns the node status after waiting for the given round. (GET /v2/status/wait-for-block-after/{round}/)

type NodeInterface

type NodeInterface interface {
	Ledger() *data.Ledger
	Status() (s node.StatusReport, err error)
	GenesisID() string
	GenesisHash() crypto.Digest
	BroadcastSignedTxGroup(txgroup []transactions.SignedTxn) error
	GetPendingTransaction(txID transactions.Txid) (res node.TxnWithStatus, found bool)
	GetPendingTxnsFromPool() ([]transactions.SignedTxn, error)
	SuggestedFee() basics.MicroAlgos
	StartCatchup(catchpoint string) error
	AbortCatchup(catchpoint string) error
	Config() config.Local
}

NodeInterface represents node fns used by the handlers.

Directories

Path Synopsis
Package generated provides primitives to interact the openapi HTTP API.
Package generated provides primitives to interact the openapi HTTP API.
private
Package private provides primitives to interact the openapi HTTP API.
Package private provides primitives to interact the openapi HTTP API.

Jump to

Keyboard shortcuts

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