models

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: 1 Imported by: 10

Documentation

Overview

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. It is duplicated from internal model code, to maintain the internal/external client encapsulation. It does flatten some embedded structs, however. No client should depend on any package in v1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	// Round indicates the round for which this information is relevant
	//
	// required: true
	Round uint64 `json:"round"`

	// Address indicates the account public key
	//
	// required: true
	Address string `json:"address"`

	// Amount indicates the total number of MicroAlgos in the account
	//
	// required: true
	Amount uint64 `json:"amount"`

	// PendingRewards specifies the amount of MicroAlgos of pending
	// rewards in this account.
	//
	// required: true
	PendingRewards uint64 `json:"pendingrewards"`

	// AmountWithoutPendingRewards specifies the amount of MicroAlgos in
	// the account, without the pending rewards.
	//
	// required: true
	AmountWithoutPendingRewards uint64 `json:"amountwithoutpendingrewards"`

	// Rewards indicates the total rewards of MicroAlgos the account has received, including pending rewards.
	//
	// required: true
	Rewards uint64 `json:"rewards"`

	// Status indicates the delegation status of the account's MicroAlgos
	// Offline - indicates that the associated account is delegated.
	// Online  - indicates that the associated account used as part of the delegation pool.
	// NotParticipating - indicates that the associated account is neither a delegator nor a delegate.
	//
	// required: true
	Status string `json:"status"`

	// Participation is the participation information currently associated with the account, if any.
	// This field is optional and may not be set even if participation information is registered.
	// In future REST API versions, this field may become required.
	//
	// required: false
	Participation *Participation `json:"participation,omitempty"`

	// AssetParams specifies the parameters of assets created by this account.
	//
	// required: false
	AssetParams map[uint64]AssetParams `json:"thisassettotal,omitempty"`

	// Assets specifies the holdings of assets by this account,
	// indexed by the asset ID.
	//
	// required: false
	Assets map[uint64]AssetHolding `json:"assets,omitempty"`
}

Account Description swagger:model Account

type Asset added in v1.3.0

type Asset struct {
	// AssetIndex is the unique asset identifier
	//
	// required: true
	AssetIndex uint64

	// AssetParams specifies the parameters of asset referred to by AssetIndex
	//
	// required: true
	AssetParams AssetParams
}

Asset specifies both the unique identifier and the parameters for an asset swagger:model Asset

type AssetConfigTransactionType added in v1.3.0

type AssetConfigTransactionType struct {
	// AssetID is the asset being configured (or empty if creating)
	//
	// required: false
	AssetID uint64 `json:"id"`

	// Params specifies the new asset parameters (or empty if deleting)
	//
	// required: false
	Params AssetParams `json:"params"`
}

AssetConfigTransactionType contains the additional fields for an asset config transaction swagger:model AssetConfigTransactionType

type AssetFreezeTransactionType added in v1.3.0

type AssetFreezeTransactionType struct {
	// AssetID is the asset being configured (or empty if creating)
	//
	// required: true
	AssetID uint64 `json:"id"`

	// Account specifies the account where the asset is being frozen or thawed.
	//
	// required: true
	Account string `json:"acct"`

	// NewFreezeStatus specifies the new freeze status.
	//
	// required: true
	NewFreezeStatus bool `json:"freeze"`
}

AssetFreezeTransactionType contains the additional fields for an asset freeze transaction swagger:model AssetFreezeTransactionType

type AssetHolding

type AssetHolding struct {
	// Creator specifies the address that created this asset.
	// This is the address where the parameters for this asset
	// can be found, and also the address where unwanted asset
	// units can be sent in the worst case.
	//
	// required: true
	Creator string `json:"creator"`

	// Amount specifies the number of units held.
	//
	// required: true
	Amount uint64 `json:"amount"`

	// Frozen specifies whether this holding is frozen.
	//
	// required: false
	Frozen bool `json:"frozen"`
}

AssetHolding specifies the holdings of a particular asset. swagger:model AssetHolding

type AssetList added in v1.3.0

type AssetList struct {
	// AssetList is a list of assets
	//
	// required: true
	Assets []Asset `json:"assets,omitempty"`
}

AssetList contains a list of assets swagger:model AssetList

type AssetParams

type AssetParams struct {
	// Creator specifies the address that created this asset.
	// This is the address where the parameters for this asset
	// can be found, and also the address where unwanted asset
	// units can be sent in the worst case.
	//
	// required: true
	Creator string `json:"creator"`

	// Total specifies the total number of units of this asset.
	//
	// required: true
	Total uint64 `json:"total"`

	// Decimals specifies the number of digits to use after the decimal
	// point when displaying this asset. If 0, the asset is not divisible.
	// If 1, the base unit of the asset is in tenths. If 2, the base unit
	// of the asset is in hundredths, and so on.
	//
	// required: true
	Decimals uint32 `json:"decimals"`

	// DefaultFrozen specifies whether holdings in this asset
	// are frozen by default.
	//
	// required: false
	DefaultFrozen bool `json:"defaultfrozen"`

	// UnitName specifies the name of a unit of this asset,
	// as supplied by the creator.
	//
	// required: false
	UnitName string `json:"unitname,omitempty"`

	// AssetName specifies the name of this asset,
	// as supplied by the creator.
	//
	// required: false
	AssetName string `json:"assetname,omitempty"`

	// URL specifies a URL where more information about the asset can be
	// retrieved
	//
	// required: false
	URL string `json:"url,omitempty"`

	// MetadataHash specifies a commitment to some unspecified asset
	// metadata. The format of this metadata is up to the application.
	//
	// required: false
	// swagger:strfmt byte
	MetadataHash []byte `json:"metadatahash,omitempty"`

	// ManagerAddr specifies the address used to manage the keys of this
	// asset and to destroy it.
	//
	// required: false
	ManagerAddr string `json:"managerkey"`

	// ReserveAddr specifies the address holding reserve (non-minted)
	// units of this asset.
	//
	// required: false
	ReserveAddr string `json:"reserveaddr"`

	// FreezeAddr specifies the address used to freeze holdings of
	// this asset.  If empty, freezing is not permitted.
	//
	// required: false
	FreezeAddr string `json:"freezeaddr"`

	// ClawbackAddr specifies the address used to clawback holdings of
	// this asset.  If empty, clawback is not permitted.
	//
	// required: false
	ClawbackAddr string `json:"clawbackaddr"`
}

AssetParams specifies the parameters for an asset. swagger:model AssetParams

type AssetTransferTransactionType added in v1.3.0

type AssetTransferTransactionType struct {
	// AssetID is the asset being configured (or empty if creating)
	//
	// required: true
	AssetID uint64 `json:"id"`

	// Amount is the amount being transferred.
	//
	// required: true
	Amount uint64 `json:"amt"`

	// Sender is the source account (if using clawback).
	//
	// required: false
	Sender string `json:"snd"`

	// Receiver is the recipient account.
	//
	// required: true
	Receiver string `json:"rcv"`

	// CloseTo is the destination for remaining funds (if closing).
	//
	// required: false
	CloseTo string `json:"closeto"`
}

AssetTransferTransactionType contains the additional fields for an asset transfer transaction swagger:model AssetTransferTransactionType

type Block

type Block struct {
	// Hash is the current block hash
	//
	// required: true
	Hash string `json:"hash"`

	// PreviousBlockHash is the previous block hash
	//
	// required: true
	PreviousBlockHash string `json:"previousBlockHash"`

	// Seed is the sortition seed
	//
	// required: true
	Seed string `json:"seed"`

	// Proposer is the address of this block proposer
	//
	// required: true
	Proposer string `json:"proposer"`

	// Round is the current round on which this block was appended to the chain
	//
	// required: true
	Round uint64 `json:"round"`

	// Period is the period on which the block was confirmed
	//
	// required: true
	Period uint64 `json:"period"`

	// TransactionsRoot authenticates the set of transactions appearing in the block.
	// More specifically, it's the root of a merkle tree whose leaves are the block's Txids, in lexicographic order.
	// For the empty block, it's 0.
	// Note that the TxnRoot does not authenticate the signatures on the transactions, only the transactions themselves.
	// Two blocks with the same transactions but in a different order and with different signatures will have the same TxnRoot.
	//
	// required: true
	TransactionsRoot string `json:"txnRoot"`

	// RewardsLevel specifies how many rewards, in MicroAlgos,
	// have been distributed to each config.Protocol.RewardUnit
	// of MicroAlgos since genesis.
	RewardsLevel uint64 `json:"reward"`

	// The number of new MicroAlgos added to the participation stake from rewards at the next round.
	RewardsRate uint64 `json:"rate"`

	// The number of leftover MicroAlgos after the distribution of RewardsRate/rewardUnits
	// MicroAlgos for every reward unit in the next round.
	RewardsResidue uint64 `json:"frac"`

	// Transactions is the list of transactions in this block
	Transactions TransactionList `json:"txns"`

	// TimeStamp in seconds since epoch
	//
	// required: true
	Timestamp int64 `json:"timestamp"`

	UpgradeState
	UpgradeVote
}

Block contains a block information swagger:model Block

type BuildVersion added in v1.3.0

type BuildVersion struct {
	// required: true
	// Algorand's major version number
	Major int `json:"major"`
	// required: true
	// Algorand's minor version number
	Minor int `json:"minor"`
	// required: true
	// Algorand's Build Number
	BuildNumber int `json:"build_number"`
	// required: true
	// Hash of commit the build is based on
	CommitHash string `json:"commit_hash"`
	// required: true
	// Branch the build is based on
	Branch string `json:"branch"`
	// required: true
	// Branch-derived release channel the build is based on
	Channel string `json:"channel"`
}

BuildVersion contains the current algod build version information.

type KeyregTransactionType added in v1.3.0

type KeyregTransactionType struct {
	// VotePK is the participation public key used in key registration transactions
	//
	// required: false
	// swagger:strfmt byte
	VotePK []byte `json:"votekey"`

	// SelectionPK is the VRF public key used in key registration transactions
	//
	// required: false
	// swagger:strfmt byte
	SelectionPK []byte `json:"selkey"`

	// VoteFirst is the first round this participation key is valid
	//
	// required: false
	VoteFirst uint64 `json:"votefst"`

	// VoteLast is the last round this participation key is valid
	//
	// required: false
	VoteLast uint64 `json:"votelst"`

	// VoteKeyDilution is the dilution for the 2-level participation key
	//
	// required: false
	VoteKeyDilution uint64 `json:"votekd"`
}

KeyregTransactionType contains the additional fields for a keyreg Transaction swagger:model KeyregTransactionType

type NodeStatus

type NodeStatus struct {
	// LastRound indicates the last round seen
	//
	// required: true
	LastRound uint64 `json:"lastRound"`

	// LastVersion indicates the last consensus version supported
	//
	// required: true
	LastVersion string `json:"lastConsensusVersion"`

	// NextVersion of consensus protocol to use
	//
	// required: true
	NextVersion string `json:"nextConsensusVersion"`

	// NextVersionRound is the round at which the next consensus version will apply
	//
	// required: true
	NextVersionRound uint64 `json:"nextConsensusVersionRound"`

	// NextVersionSupported indicates whether the next consensus version is supported by this node
	//
	// required: true
	NextVersionSupported bool `json:"nextConsensusVersionSupported"`

	// TimeSinceLastRound in nanoseconds
	//
	// required: true
	TimeSinceLastRound int64 `json:"timeSinceLastRound"`

	// CatchupTime in nanoseconds
	//
	// required: true
	CatchupTime int64 `json:"catchupTime"`

	// HasSyncedSinceStartup indicates whether a round has completed since startup
	// Required: true
	HasSyncedSinceStartup bool `json:"hasSyncedSinceStartup"`

	// StoppedAtUnsupportedRound indicates that the node does not support the new rounds and has stopped making progress
	//
	// Required: true
	StoppedAtUnsupportedRound bool `json:"stoppedAtUnsupportedRound"`
}

NodeStatus contains the information about a node status swagger:model NodeStatus

type Participation added in v1.3.0

type Participation struct {
	// ParticipationPK is the root participation public key (if any) currently registered for this round
	//
	// required: true
	// swagger:strfmt byte
	ParticipationPK []byte `json:"partpkb64"`

	// VRFPK is the selection public key (if any) currently registered for this round
	//
	// required: true
	// swagger:strfmt byte
	VRFPK []byte `json:"vrfpkb64"`

	// VoteFirst is the first round for which this participation is valid.
	//
	// required: true
	VoteFirst uint64 `json:"votefst"`

	// VoteLast is the last round for which this participation is valid.
	//
	// required: true
	VoteLast uint64 `json:"votelst"`

	// VoteKeyDilution is the number of subkeys in for each batch of participation keys.
	//
	// required: true
	VoteKeyDilution uint64 `json:"votekd"`
}

Participation Description swagger:model Participation

type PaymentTransactionType

type PaymentTransactionType struct {
	// To is the receiver's address
	//
	// required: true
	To string `json:"to"`

	// CloseRemainderTo is the address the sender closed to
	//
	// required: false
	CloseRemainderTo string `json:"close,omitempty"`

	// CloseAmount is the amount sent to CloseRemainderTo, for committed transaction
	//
	// required: false
	CloseAmount uint64 `json:"closeamount,omitempty"`

	// Amount is the amount of MicroAlgos intended to be transferred
	//
	// required: true
	Amount uint64 `json:"amount"`

	// ToRewards is the amount of pending rewards applied to the To account
	// as part of this transaction.
	//
	// required: false
	ToRewards uint64 `json:"torewards"`

	// CloseRewards is the amount of pending rewards applied to the CloseRemainderTo
	// account as part of this transaction.
	//
	// required: false
	CloseRewards uint64 `json:"closerewards"`
}

PaymentTransactionType contains the additional fields for a payment Transaction swagger:model PaymentTransactionType

type PendingTransactions

type PendingTransactions struct {
	// TruncatedTxns
	// required: true
	TruncatedTxns TransactionList `json:"truncatedTxns"`
	// TotalTxns
	// required: true
	TotalTxns uint64 `json:"totalTxns"`
}

PendingTransactions represents a potentially truncated list of transactions currently in the node's transaction pool. swagger:model PendingTransactions

type RawBlock added in v1.3.0

type RawBlock []byte

RawBlock represents an encoded msgpack block swagger:model RawBlock swagger:strfmt byte

func (*RawBlock) SetBytes added in v1.3.0

func (rb *RawBlock) SetBytes(b []byte)

SetBytes fulfills the RawResponse interface on RawBlock

type RawResponse added in v1.3.0

type RawResponse interface {
	SetBytes([]byte)
}

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

type Supply

type Supply struct {
	// Round
	//
	// required: true
	Round uint64 `json:"round"`

	// TotalMoney
	//
	// required: true
	TotalMoney uint64 `json:"totalMoney"`

	// OnlineMoney
	//
	// required: true
	OnlineMoney uint64 `json:"onlineMoney"`
}

Supply represents the current supply of MicroAlgos in the system swagger:model Supply

type Transaction

type Transaction struct {
	// Type is the transaction type
	//
	// required: true
	Type types.TxType `json:"type"`

	// TxID is the transaction ID
	//
	// required: true
	TxID string `json:"tx"`

	// From is the sender's address
	//
	// required: true
	From string `json:"from"`

	// Fee is the transaction fee
	//
	// required: true
	Fee uint64 `json:"fee"`

	// FirstRound indicates the first valid round for this transaction
	//
	// required: true
	FirstRound uint64 `json:"first-round"`

	// LastRound indicates the last valid round for this transaction
	//
	// required: true
	LastRound uint64 `json:"last-round"`

	// Note is a free form data
	//
	// required: false
	// swagger:strfmt byte
	Note []byte `json:"noteb64,omitempty"`

	// Lease enforces mutual exclusion of transactions.  If this field is
	// nonzero, then once the transaction is confirmed, it acquires the
	// lease identified by the (Sender, Lease) pair of the transaction until
	// the LastValid round passes.  While this transaction possesses the
	// lease, no other transaction specifying this lease can be confirmed.
	//
	// required: false
	// swagger:strfmt byte
	Lease []byte `json:"lease,omitempty"`

	// ConfirmedRound indicates the block number this transaction appeared in
	//
	// required: false
	ConfirmedRound uint64 `json:"round"`

	// TransactionResults contains information about the side effects of a transaction
	//
	// required: false
	TransactionResults *TransactionResults `json:"txresults,omitempty"`

	// PoolError indicates the transaction was evicted from this node's transaction
	// pool (if non-empty).  A non-empty PoolError does not guarantee that the
	// transaction will never be committed; other nodes may not have evicted the
	// transaction and may attempt to commit it in the future.
	//
	// required: false
	PoolError string `json:"poolerror,omitempty"`

	// Payment contains the additional fields for a payment transaction.
	//
	// required: false
	Payment *PaymentTransactionType `json:"payment,omitempty"`

	// Keyreg contains the additional fields for a keyreg transaction.
	//
	// required: false
	Keyreg *KeyregTransactionType `json:"keyreg,omitempty"`

	// AssetConfig contains the additional fields for an asset config transaction.
	//
	// required: false
	AssetConfig *AssetConfigTransactionType `json:"curcfg,omitempty"`

	// AssetTransfer contains the additional fields for an asset transfer transaction.
	//
	// required: false
	AssetTransfer *AssetTransferTransactionType `json:"curxfer,omitempty"`

	// AssetFreeze contains the additional fields for an asset freeze transaction.
	//
	// required: false
	AssetFreeze *AssetFreezeTransactionType `json:"curfrz,omitempty"`

	// FromRewards is the amount of pending rewards applied to the From
	// account as part of this transaction.
	//
	// required: false
	FromRewards uint64 `json:"fromrewards"`

	// Genesis ID
	//
	// required: true
	GenesisID string `json:"genesisID"`

	// Genesis hash
	//
	// required: true
	// swagger:strfmt byte
	GenesisHash []byte `json:"genesishashb64"`

	// Group
	//
	// required: false
	// swagger:strfmt byte
	Group []byte `json:"group,omitempty"`
}

Transaction contains all fields common to all transactions and serves as an envelope to all transactions type swagger:model Transaction

type TransactionFee

type TransactionFee struct {
	// Fee is transaction fee
	// Fee is in units of micro-Algos per byte.
	// Fee may fall to zero but transactions must still have a fee of
	// at least MinTxnFee for the current network protocol.
	//
	// required: true
	Fee uint64 `json:"fee"`
}

TransactionFee contains the suggested fee swagger:model TransactionFee

type TransactionID

type TransactionID struct {
	// TxId is the string encoding of the transaction hash
	//
	// required: true
	TxID string `json:"txId"`
}

TransactionID Description swagger:model transactionID

type TransactionList

type TransactionList struct {
	// TransactionList is a list of transactions
	//
	// required: true
	Transactions []Transaction `json:"transactions,omitempty"`
}

TransactionList contains a list of transactions swagger:model TransactionList

type TransactionParams

type TransactionParams struct {
	// Fee is the suggested transaction fee
	// Fee is in units of micro-Algos per byte.
	// Fee may fall to zero but transactions must still have a fee of
	// at least MinTxnFee for the current network protocol.
	//
	// required: true
	Fee uint64 `json:"fee"`

	// Genesis ID
	//
	// required: true
	GenesisID string `json:"genesisID"`

	// Genesis hash
	//
	// required: true
	// swagger:strfmt byte
	GenesisHash []byte `json:"genesishashb64"`

	// LastRound indicates the last round seen
	//
	// required: true
	LastRound uint64 `json:"lastRound"`

	// ConsensusVersion indicates the consensus protocol version
	// as of LastRound.
	//
	// required: true
	ConsensusVersion string `json:"consensusVersion"`

	// The minimum transaction fee (not per byte) required for the
	// txn to validate for the current network protocol.
	//
	// required: false
	MinTxnFee uint64 `json:"minFee"`
}

TransactionParams contains the parameters that help a client construct a new transaction. swagger:model TransactionParams

type TransactionResults

type TransactionResults struct {
	// CreatedAssetIndex indicates the asset index of an asset created by this txn
	//
	// required: false
	CreatedAssetIndex uint64 `json:"createdasset,omitempty"`
}

TransactionResults contains information about the side effects of a transaction swagger:model TransactionResults

type UpgradeState

type UpgradeState struct {
	// CurrentProtocol is a string that represents the current protocol
	//
	// required: true
	CurrentProtocol string `json:"currentProtocol"`

	// NextProtocol is a string that represents the next proposed protocol
	//
	// required: true
	NextProtocol string `json:"nextProtocol"`

	// NextProtocolApprovals is the number of blocks which approved the protocol upgrade
	//
	// required: true
	NextProtocolApprovals uint64 `json:"nextProtocolApprovals"`

	// NextProtocolVoteBefore is the deadline round for this protocol upgrade (No votes will be consider after this round)
	//
	// required: true
	NextProtocolVoteBefore uint64 `json:"nextProtocolVoteBefore"`

	// NextProtocolSwitchOn is the round on which the protocol upgrade will take effect
	//
	// required: true
	NextProtocolSwitchOn uint64 `json:"nextProtocolSwitchOn"`
}

UpgradeState contains the information about a current state of an upgrade swagger:model UpgradeState

type UpgradeVote

type UpgradeVote struct {
	// UpgradePropose indicates a proposed upgrade
	//
	// required: true
	UpgradePropose string `json:"upgradePropose"`

	// UpgradeApprove indicates a yes vote for the current proposal
	//
	// required: true
	UpgradeApprove bool `json:"upgradeApprove"`
}

UpgradeVote represents the vote of the block proposer with respect to protocol upgrades. swagger:model UpgradeVote

type Version

type Version struct {
	// required: true
	// returns a list of supported protocol versions ( i.e. v1, v2, etc. )
	Versions []string `json:"versions"`
	// required: true
	GenesisID string `json:"genesis_id"`
	// required: true
	// swagger:strfmt byte
	GenesisHash []byte `json:"genesis_hash_b64"`
	// required: true
	Build BuildVersion `json:"build"`
}

Version contains the current algod version.

Note that we annotate this as a model so that legacy clients can directly import a swagger generated Version model. swagger:model Version

type VersionsResponse

type VersionsResponse struct {
	// in: body
	Body Version
}

VersionsResponse is the response to 'GET /versions'

swagger:response VersionsResponse

Jump to

Keyboard shortcuts

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