types

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: MIT Imports: 8 Imported by: 98

Documentation

Index

Constants

View Source
const AssetMaxNumberOfDecimals = 19

AssetMaxNumberOfDecimals is the maximum value of the Decimals field

View Source
const AssetMetadataHashLen = 32

AssetMetadataHashLen is the length of the AssetMetadataHash in bytes

View Source
const AssetNameMaxLen = 32

AssetNameMaxLen is the max length in bytes for the asset name

View Source
const AssetURLMaxLen = 96

AssetURLMaxLen is the max length in bytes for the asset url

View Source
const AssetUnitNameMaxLen = 8

AssetUnitNameMaxLen is the max length in bytes for the asset unit name

View Source
const KeyStoreRootSize = 64

KeyStoreRootSize is the size, in bytes, of keyreg verifier

View Source
const LogicSigMaxCost = 20000

LogicSigMaxCost is a max execution const of a TEAL program

View Source
const LogicSigMaxSize = 1000

LogicSigMaxSize is a max TEAL program size (with args)

View Source
const MaxTxGroupSize = 16

MaxTxGroupSize is max number of transactions in a single group

Variables

This section is empty.

Functions

func EncodeAddress added in v1.12.0

func EncodeAddress(addr []byte) (a string, err error)

EncodeAddress turns a byte slice into the human readable representation of the address. This representation includes a 4-byte checksum

func OAdd

func OAdd(a uint64, b uint64) (res uint64, overflowed bool)

OAdd adds 2 values with overflow detection

func OAdd16

func OAdd16(a uint16, b uint16) (res uint16, overflowed bool)

OAdd16 adds 2 uint16 values with overflow detection

func OMul

func OMul(a uint64, b uint64) (res uint64, overflowed bool)

OMul multiplies 2 values with overflow detection

func OSub

func OSub(a uint64, b uint64) (res uint64, overflowed bool)

OSub subtracts b from a with overflow detection

Types

type Address

type Address [hashLenBytes]byte

Address represents an Algorand address.

var ZeroAddress Address = [hashLenBytes]byte{}

ZeroAddress is Address with all zero bytes. For handy == != comparisons.

func DecodeAddress

func DecodeAddress(addr string) (a Address, err error)

DecodeAddress turns a checksum address string into an Address object. It checks that the checksum is correct, and returns an error if it's not.

func (Address) IsZero added in v1.3.0

func (a Address) IsZero() bool

IsZero returs true if the Address is all zero bytes.

func (Address) String

func (a Address) String() string

String grabs a human-readable representation of the address. This representation includes a 4-byte checksum.

type AppIndex added in v1.5.0

type AppIndex uint64

AppIndex is the unique integer index of an application that can be used to look up the creator of the application, whose balance record contains the AppParams

type ApplicationCallTxnFields added in v1.5.0

type ApplicationCallTxnFields struct {
	ApplicationID   AppIndex     `codec:"apid"`
	OnCompletion    OnCompletion `codec:"apan"`
	ApplicationArgs [][]byte     `codec:"apaa,allocbound=encodedMaxApplicationArgs"`
	Accounts        []Address    `codec:"apat,allocbound=encodedMaxAccounts"`
	ForeignApps     []AppIndex   `codec:"apfa,allocbound=encodedMaxForeignApps"`
	ForeignAssets   []AssetIndex `codec:"apas,allocbound=encodedMaxForeignAssets"`

	LocalStateSchema  StateSchema `codec:"apls"`
	GlobalStateSchema StateSchema `codec:"apgs"`
	ApprovalProgram   []byte      `codec:"apap"`
	ClearStateProgram []byte      `codec:"apsu"`
	ExtraProgramPages uint32      `codec:"apep"`
	// contains filtered or unexported fields
}

ApplicationCallTxnFields captures the transaction fields used for all interactions with applications

func (*ApplicationCallTxnFields) Empty added in v1.5.0

func (ac *ApplicationCallTxnFields) Empty() bool

Empty indicates whether or not all the fields in the ApplicationCallTxnFields are zeroed out

type ApplicationFields added in v1.5.0

type ApplicationFields struct {
	ApplicationCallTxnFields
}

type ApplyData added in v1.4.0

type ApplyData struct {

	// Closing amount for transaction.
	ClosingAmount MicroAlgos `codec:"ca"`

	// Closing amount for asset transaction.
	AssetClosingAmount uint64 `codec:"aca"`

	// Rewards applied to the Sender, Receiver, and CloseRemainderTo accounts.
	SenderRewards   MicroAlgos `codec:"rs"`
	ReceiverRewards MicroAlgos `codec:"rr"`
	CloseRewards    MicroAlgos `codec:"rc"`
	EvalDelta       EvalDelta  `codec:"dt"`

	ConfigAsset   uint64 `codec:"caid"`
	ApplicationID uint64 `codec:"apid"`
	// contains filtered or unexported fields
}

ApplyData contains information about the transaction's execution.

type AssetConfigTxnFields

type AssetConfigTxnFields struct {

	// ConfigAsset is the asset being configured or destroyed.
	// A zero value means allocation.
	ConfigAsset AssetIndex `codec:"caid"`

	// AssetParams are the parameters for the asset being
	// created or re-configured.  A zero value means destruction.
	AssetParams AssetParams `codec:"apar"`
	// contains filtered or unexported fields
}

AssetConfigTxnFields captures the fields used for asset allocation, re-configuration, and destruction.

type AssetFreezeTxnFields

type AssetFreezeTxnFields struct {

	// FreezeAccount is the address of the account whose asset
	// slot is being frozen or un-frozen.
	FreezeAccount Address `codec:"fadd"`

	// FreezeAsset is the asset ID being frozen or un-frozen.
	FreezeAsset AssetIndex `codec:"faid"`

	// AssetFrozen is the new frozen value.
	AssetFrozen bool `codec:"afrz"`
	// contains filtered or unexported fields
}

AssetFreezeTxnFields captures the fields used for freezing asset slots.

type AssetIndex

type AssetIndex uint64

AssetIndex is the unique integer index of an asset that can be used to look up the creator of the asset, whose balance record contains the AssetParams

type AssetParams

type AssetParams struct {

	// Total specifies the total number of units of this asset
	// created.
	Total uint64 `codec:"t"`

	// Decimals specifies the number of digits to display after the decimal
	// place when displaying this asset. A value of 0 represents an asset
	// that is not divisible, a value of 1 represents an asset divisible
	// into tenths, and so on. This value must be between 0 and 19
	// (inclusive).
	Decimals uint32 `codec:"dc"`

	// DefaultFrozen specifies whether slots for this asset
	// in user accounts are frozen by default or not.
	DefaultFrozen bool `codec:"df"`

	// UnitName specifies a hint for the name of a unit of
	// this asset.
	UnitName string `codec:"un"`

	// AssetName specifies a hint for the name of the asset.
	AssetName string `codec:"an"`

	// URL specifies a URL where more information about the asset can be
	// retrieved
	URL string `codec:"au"`

	// MetadataHash specifies a commitment to some unspecified asset
	// metadata. The format of this metadata is up to the application.
	MetadataHash [AssetMetadataHashLen]byte `codec:"am"`

	// Manager specifies an account that is allowed to change the
	// non-zero addresses in this AssetParams.
	Manager Address `codec:"m"`

	// Reserve specifies an account whose holdings of this asset
	// should be reported as "not minted".
	Reserve Address `codec:"r"`

	// Freeze specifies an account that is allowed to change the
	// frozen state of holdings of this asset.
	Freeze Address `codec:"f"`

	// Clawback specifies an account that is allowed to take units
	// of this asset from any account.
	Clawback Address `codec:"c"`
	// contains filtered or unexported fields
}

AssetParams describes the parameters of an asset.

func (AssetParams) IsZero added in v1.3.0

func (ap AssetParams) IsZero() bool

IsZero returns true if the AssetParams struct is completely empty. The AssetParams zero object is used in destroying an asset.

type AssetTransferTxnFields

type AssetTransferTxnFields struct {
	XferAsset AssetIndex `codec:"xaid"`

	// AssetAmount is the amount of asset to transfer.
	// A zero amount transferred to self allocates that asset
	// in the account's Assets map.
	AssetAmount uint64 `codec:"aamt"`

	// AssetSender is the sender of the transfer.  If this is not
	// a zero value, the real transaction sender must be the Clawback
	// address from the AssetParams.  If this is the zero value,
	// the asset is sent from the transaction's Sender.
	AssetSender Address `codec:"asnd"`

	// AssetReceiver is the recipient of the transfer.
	AssetReceiver Address `codec:"arcv"`

	// AssetCloseTo indicates that the asset should be removed
	// from the account's Assets map, and specifies where the remaining
	// asset holdings should be transferred.  It's always valid to transfer
	// remaining asset holdings to the creator account.
	AssetCloseTo Address `codec:"aclose"`
	// contains filtered or unexported fields
}

AssetTransferTxnFields captures the fields used for asset transfers.

type Bid

type Bid struct {

	// BidderKey identifies the bidder placing this bid.
	BidderKey Address `codec:"bidder"`

	// BidCurrency specifies how much external currency the bidder
	// is putting in with this bid.
	BidCurrency uint64 `codec:"cur"`

	// MaxPrice specifies the maximum price, in units of external
	// currency per Algo, that the bidder is willing to pay.
	// This must be at least as high as the current price of the
	// auction in the block in which this bid appears.
	MaxPrice uint64 `codec:"price"`

	// BidID identifies this bid.  The first bid by a bidder (identified
	// by BidderKey) with a particular BidID on the blockchain will be
	// considered, preventing replay of bids.  Specifying a different
	// BidID allows the bidder to place multiple bids in an auction.
	BidID uint64 `codec:"id"`

	// AuctionKey specifies the auction for this bid.
	AuctionKey Address `codec:"auc"`

	// AuctionID identifies the auction for which this bid is intended.
	AuctionID uint64 `codec:"aid"`
	// contains filtered or unexported fields
}

Bid represents a bid by a user as part of an auction.

type Block added in v1.4.0

type Block struct {
	BlockHeader
	Payset Payset `codec:"txns"`
}

A Block contains the Payset and metadata corresponding to a given Round.

func (*Block) FromBase64String added in v1.4.0

func (block *Block) FromBase64String(b64string string) error

type BlockHash added in v1.4.0

type BlockHash Digest

BlockHash represents the hash of a block

type BlockHeader added in v1.4.0

type BlockHeader struct {
	Round Round `codec:"rnd"`

	// The hash of the previous block
	Branch BlockHash `codec:"prev"`

	// Sortition seed
	Seed [32]byte `codec:"seed"`

	// TxnRoot 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.
	// Note that the TxnRoot does not authenticate the signatures on the transactions, only the transactions themselves.
	// Two blocks with the same transactions but with different signatures will have the same TxnRoot.
	TxnRoot Digest `codec:"txn"`

	// TimeStamp in seconds since epoch
	TimeStamp int64 `codec:"ts"`

	// Genesis ID to which this block belongs.
	GenesisID string `codec:"gen"`

	// Genesis hash to which this block belongs.
	GenesisHash Digest `codec:"gh"`

	// Rewards.
	//
	// When a block is applied, some amount of rewards are accrued to
	// every account with AccountData.Status=/=NotParticipating.  The
	// amount is (thisBlock.RewardsLevel-prevBlock.RewardsLevel) of
	// MicroAlgos for every whole config.Protocol.RewardUnit of MicroAlgos in
	// that account's AccountData.MicroAlgos.
	//
	// Rewards are not compounded (i.e., not added to AccountData.MicroAlgos)
	// until some other transaction is executed on that account.
	//
	// Not compounding rewards allows us to precisely know how many algos
	// of rewards will be distributed without having to examine every
	// account to determine if it should get one more algo of rewards
	// because compounding formed another whole config.Protocol.RewardUnit
	// of algos.
	RewardsState

	// Consensus protocol versioning.
	//
	// Each block is associated with a version of the consensus protocol,
	// stored under UpgradeState.CurrentProtocol.  The protocol version
	// for a block can be determined without having to first decode the
	// block and its CurrentProtocol field, and this field is present for
	// convenience and explicitness.  Block.Valid() checks that this field
	// correctly matches the expected protocol version.
	//
	// Each block is associated with at most one active upgrade proposal
	// (a new version of the protocol).  An upgrade proposal can be made
	// by a block proposer, as long as no other upgrade proposal is active.
	// The upgrade proposal lasts for many rounds (UpgradeVoteRounds), and
	// in each round, that round's block proposer votes to support (or not)
	// the proposed upgrade.
	//
	// If enough votes are collected, the proposal is approved, and will
	// definitely take effect.  The proposal lingers for some number of
	// rounds to give clients a chance to notify users about an approved
	// upgrade, if the client doesn't support it, so the user has a chance
	// to download updated client software.
	//
	// Block proposers influence this upgrade machinery through two fields
	// in UpgradeVote: UpgradePropose, which proposes an upgrade to a new
	// protocol, and UpgradeApprove, which signals approval of the current
	// proposal.
	//
	// Once a block proposer determines its UpgradeVote, then UpdateState
	// is updated deterministically based on the previous UpdateState and
	// the new block's UpgradeVote.
	UpgradeState
	UpgradeVote

	// TxnCounter counts the number of transactions committed in the
	// ledger, from the time at which support for this feature was
	// introduced.
	//
	// Specifically, TxnCounter is the number of the next transaction
	// that will be committed after this block.  It is 0 when no
	// transactions have ever been committed (since TxnCounter
	// started being supported).
	TxnCounter uint64 `codec:"tc"`

	// ParticipationUpdates contains the information needed to mark
	// certain accounts offline because their participation keys expired
	ParticipationUpdates
	// contains filtered or unexported fields
}

A BlockHeader represents the metadata and commitments to the state of a Block. The Algorand Ledger may be defined minimally as a cryptographically authenticated series of BlockHeader objects.

type DeltaAction added in v1.6.0

type DeltaAction uint64

DeltaAction is an enum of actions that may be performed when applying a delta to a TEAL key/value store

const (
	// SetBytesAction indicates that a TEAL byte slice should be stored at a key
	SetBytesAction DeltaAction = 1

	// SetUintAction indicates that a Uint should be stored at a key
	SetUintAction DeltaAction = 2

	// DeleteAction indicates that the value for a particular key should be deleted
	DeleteAction DeltaAction = 3
)

type Digest

type Digest [hashLenBytes]byte

Digest is a SHA512_256 hash

type EvalDelta added in v1.6.0

type EvalDelta struct {
	GlobalDelta StateDelta `codec:"gd"`

	// When decoding EvalDeltas, the integer key represents an offset into
	// [txn.Sender, txn.Accounts[0], txn.Accounts[1], ...]
	LocalDeltas map[uint64]StateDelta `codec:"ld,allocbound=config.MaxEvalDeltaAccounts"`

	Logs []string `codec:"lg"`

	InnerTxns []SignedTxnWithAD `codec:"itx"`
	// contains filtered or unexported fields
}
type Header struct {
	Sender      Address    `codec:"snd"`
	Fee         MicroAlgos `codec:"fee"`
	FirstValid  Round      `codec:"fv"`
	LastValid   Round      `codec:"lv"`
	Note        []byte     `codec:"note"`
	GenesisID   string     `codec:"gen"`
	GenesisHash Digest     `codec:"gh"`

	// Group specifies that this transaction is part of a
	// transaction group (and, if so, specifies the hash
	// of a TxGroup).
	Group Digest `codec:"grp"`

	// 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.
	Lease [32]byte `codec:"lx"`

	// RekeyTo, if nonzero, sets the sender's SpendingKey to the given address
	// If the RekeyTo address is the sender's actual address, the SpendingKey is set to zero
	// This allows "re-keying" a long-lived account -- rotating the signing key, changing
	// membership of a multisig account, etc.
	RekeyTo Address `codec:"rekey"`
	// contains filtered or unexported fields
}

Header captures the fields common to every transaction type.

type KeyregTxnFields

type KeyregTxnFields struct {
	VotePK           VotePK         `codec:"votekey"`
	SelectionPK      VRFPK          `codec:"selkey"`
	VoteFirst        Round          `codec:"votefst"`
	VoteLast         Round          `codec:"votelst"`
	VoteKeyDilution  uint64         `codec:"votekd"`
	Nonparticipation bool           `codec:"nonpart"`
	StateProofPK     MerkleVerifier `codec:"sprfkey"`
	// contains filtered or unexported fields
}

KeyregTxnFields captures the fields used for key registration transactions.

type LogicSig

type LogicSig struct {

	// Logic signed by Sig or Msig
	// OR hashed to be the Address of an account.
	Logic []byte `codec:"l"`

	// The signature of the account that has delegated to this LogicSig, if any
	Sig Signature `codec:"sig"`

	// The signature of the multisig account that has delegated to this LogicSig, if any
	Msig MultisigSig `codec:"msig"`

	// Args are not signed, but checked by Logic
	Args [][]byte `codec:"arg"`
	// contains filtered or unexported fields
}

LogicSig contains logic for validating a transaction. LogicSig is signed by an account, allowing delegation of operations. OR LogicSig defines a contract account.

func (LogicSig) Blank added in v1.3.0

func (lsig LogicSig) Blank() bool

Blank returns true iff the lsig is empty. We need this instead of just comparing with == LogicSig{}, because it contains slices.

type MasterDerivationKey

type MasterDerivationKey [masterDerivationKeyLenBytes]byte

MasterDerivationKey is the secret key used to derive keys in wallets

type MerkleVerifier added in v1.12.0

type MerkleVerifier [KeyStoreRootSize]byte

MerkleVerifier is a state proof

type MicroAlgos

type MicroAlgos uint64

MicroAlgos are the base unit of currency in Algorand

func ToMicroAlgos

func ToMicroAlgos(algos float64) MicroAlgos

ToMicroAlgos converts amount in Algos to microAlgos

func (MicroAlgos) ToAlgos

func (microalgos MicroAlgos) ToAlgos() float64

ToAlgos converts amount in microAlgos to Algos

type MultisigSig

type MultisigSig struct {
	Version   uint8            `codec:"v"`
	Threshold uint8            `codec:"thr"`
	Subsigs   []MultisigSubsig `codec:"subsig"`
	// contains filtered or unexported fields
}

MultisigSig holds multiple Subsigs, as well as threshold and version info

func (MultisigSig) Blank

func (msig MultisigSig) Blank() bool

Blank returns true iff the msig is empty. We need this instead of just comparing with == MultisigSig{}, because Subsigs is a slice.

type MultisigSubsig

type MultisigSubsig struct {
	Key ed25519.PublicKey `codec:"pk"`
	Sig Signature         `codec:"s"`
	// contains filtered or unexported fields
}

MultisigSubsig contains a single public key and, optionally, a signature

type NoteField

type NoteField struct {

	// Type indicates which type of a message this is
	Type NoteFieldType `codec:"t"`

	// SignedBid, for NoteBid type
	SignedBid SignedBid `codec:"b"`
	// contains filtered or unexported fields
}

NoteField is the struct that represents an auction message.

type NoteFieldType

type NoteFieldType string

NoteFieldType indicates a type of auction message encoded into a transaction's Note field.

const (
	// NoteDeposit indicates a SignedDeposit message.
	NoteDeposit NoteFieldType = "d"

	// NoteBid indicates a SignedBid message.
	NoteBid NoteFieldType = "b"

	// NoteSettlement indicates a SignedSettlement message.
	NoteSettlement NoteFieldType = "s"

	// NoteParams indicates a SignedParams message.
	NoteParams NoteFieldType = "p"
)

type OnCompletion added in v1.5.0

type OnCompletion uint64

OnCompletion is an enum representing some layer 1 side effect that an ApplicationCall transaction will have if it is included in a block.

const (
	// NoOpOC indicates that an application transaction will simply call its
	// ApprovalProgram
	NoOpOC OnCompletion = 0

	// OptInOC indicates that an application transaction will allocate some
	// LocalState for the application in the sender's account
	OptInOC OnCompletion = 1

	// CloseOutOC indicates that an application transaction will deallocate
	// some LocalState for the application from the user's account
	CloseOutOC OnCompletion = 2

	// ClearStateOC is similar to CloseOutOC, but may never fail. This
	// allows users to reclaim their minimum balance from an application
	// they no longer wish to opt in to.
	ClearStateOC OnCompletion = 3

	// UpdateApplicationOC indicates that an application transaction will
	// update the ApprovalProgram and ClearStateProgram for the application
	UpdateApplicationOC OnCompletion = 4

	// DeleteApplicationOC indicates that an application transaction will
	// delete the AppParams for the application from the creator's balance
	// record
	DeleteApplicationOC OnCompletion = 5
)

type ParticipationUpdates added in v1.14.1

type ParticipationUpdates struct {

	// ExpiredParticipationAccounts contains a list of online accounts
	// that needs to be converted to offline since their
	// participation key expired.
	ExpiredParticipationAccounts []Address `codec:"partupdrmv"`
	// contains filtered or unexported fields
}

ParticipationUpdates represents participation account data that needs to be checked/acted on by the network

type PaymentTxnFields

type PaymentTxnFields struct {
	Receiver Address    `codec:"rcv"`
	Amount   MicroAlgos `codec:"amt"`

	// When CloseRemainderTo is set, it indicates that the
	// transaction is requesting that the account should be
	// closed, and all remaining funds be transferred to this
	// address.
	CloseRemainderTo Address `codec:"close"`
	// contains filtered or unexported fields
}

PaymentTxnFields captures the fields used by payment transactions.

type Payset added in v1.4.0

type Payset []SignedTxnInBlock

A Payset represents a common, unforgeable, consistent, ordered set of SignedTxn objects.

type RewardsState added in v1.4.0

type RewardsState struct {

	// The FeeSink accepts transaction fees. It can only spend to
	// the incentive pool.
	FeeSink Address `codec:"fees"`

	// The RewardsPool accepts periodic injections from the
	// FeeSink and continually redistributes them to adresses as
	// rewards.
	RewardsPool Address `codec:"rwd"`

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

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

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

	// The round at which the RewardsRate will be recalculated.
	RewardsRecalculationRound Round `codec:"rwcalr"`
	// contains filtered or unexported fields
}

RewardsState represents the global parameters controlling the rate at which accounts accrue rewards.

type Round

type Round uint64

Round represents a round of the Algorand consensus protocol

type Signature

type Signature [ed25519.SignatureSize]byte

Signature is an ed25519 signature

type SignedBid

type SignedBid struct {

	// Bid contains information about the bid.
	Bid Bid `codec:"bid"`

	// Sig is a signature by the bidder, as identified in the bid
	// (Bid.BidderKey) over the hash of the Bid.
	Sig Signature `codec:"sig"`
	// contains filtered or unexported fields
}

SignedBid represents a signed bid by a bidder.

type SignedTxn

type SignedTxn struct {
	Sig      Signature   `codec:"sig"`
	Msig     MultisigSig `codec:"msig"`
	Lsig     LogicSig    `codec:"lsig"`
	Txn      Transaction `codec:"txn"`
	AuthAddr Address     `codec:"sgnr"`
	// contains filtered or unexported fields
}

SignedTxn wraps a transaction and a signature. The encoding of this struct is suitable to broadcast on the network

func (*SignedTxn) FromBase64String added in v1.4.0

func (signedTxn *SignedTxn) FromBase64String(b64string string) error

type SignedTxnInBlock added in v1.4.0

type SignedTxnInBlock struct {
	SignedTxnWithAD

	HasGenesisID   bool `codec:"hgi"`
	HasGenesisHash bool `codec:"hgh"`
	// contains filtered or unexported fields
}

SignedTxnInBlock is how a signed transaction is encoded in a block.

type SignedTxnWithAD added in v1.4.0

type SignedTxnWithAD struct {
	SignedTxn
	ApplyData
	// contains filtered or unexported fields
}

SignedTxnWithAD is a (decoded) SignedTxn with associated ApplyData

type StateDelta added in v1.6.0

type StateDelta map[string]ValueDelta

StateDelta is a map from key/value store keys to ValueDeltas, indicating what should happen for that key

type StateSchema added in v1.5.0

type StateSchema struct {
	NumUint      uint64 `codec:"nui"`
	NumByteSlice uint64 `codec:"nbs"`
	// contains filtered or unexported fields
}

StateSchema sets maximums on the number of each type that may be stored

type SuggestedParams added in v1.3.0

type SuggestedParams struct {
	// Fee is the suggested transaction fee
	// Fee is in units of micro-Algos per byte.
	// Fee may fall to zero but a group of N atomic transactions must
	// still have a fee of at least N*MinTxnFee for the current network protocol.
	Fee MicroAlgos `codec:"fee"`

	// Genesis ID
	GenesisID string `codec:"genesis-id"`

	// Genesis hash
	GenesisHash []byte `codec:"genesis-hash"`

	// FirstRoundValid is the first protocol round on which the txn is valid
	FirstRoundValid Round `codec:"first-round"`

	// LastRoundValid is the final protocol round on which the txn may be committed
	LastRoundValid Round `codec:"last-round"`

	// ConsensusVersion indicates the consensus protocol version
	// as of LastRound.
	ConsensusVersion string `codec:"consensus-version"`

	// FlatFee indicates whether the passed fee is per-byte or per-transaction
	// If true, txn fee may fall below the MinTxnFee for the current network protocol.
	FlatFee bool `codec:"flat-fee"`

	// The minimum transaction fee (not per byte) required for the
	// txn to validate for the current network protocol.
	MinFee uint64 `codec:"min-fee"`
}

SuggestedParams wraps the transaction parameters common to all transactions, typically received from the SuggestedParams endpoint of algod. This struct itself is not sent over the wire to or from algod: see models.TransactionParams.

type Transaction

type Transaction struct {

	// Type of transaction
	Type TxType `codec:"type"`

	// Common fields for all types of transactions
	Header

	// Fields for different types of transactions
	KeyregTxnFields
	PaymentTxnFields
	AssetConfigTxnFields
	AssetTransferTxnFields
	AssetFreezeTxnFields
	ApplicationFields
	// contains filtered or unexported fields
}

Transaction describes a transaction that can appear in a block.

func (*Transaction) AddLease

func (tx *Transaction) AddLease(lease [32]byte, feePerByte uint64)

AddLease adds the passed lease (see types/transaction.go) to the header of the passed transaction and updates fee accordingly - lease: the [32]byte lease to add to the header - feePerByte: the new feePerByte

func (*Transaction) AddLeaseWithFlatFee

func (tx *Transaction) AddLeaseWithFlatFee(lease [32]byte, flatFee uint64)

AddLeaseWithFlatFee adds the passed lease (see types/transaction.go) to the header of the passed transaction and updates fee accordingly - lease: the [32]byte lease to add to the header - flatFee: the new flatFee

func (*Transaction) Rekey added in v1.5.0

func (tx *Transaction) Rekey(rekeyToAddress string) error

Rekey sets the rekeyTo field to the passed address. Any future transacrtion will need to be signed by the rekeyTo address' corresponding private key.

type TxGroup

type TxGroup struct {

	// TxGroupHashes specifies a list of hashes of transactions that must appear
	// together, sequentially, in a block in order for the group to be
	// valid.  Each hash in the list is a hash of a transaction with
	// the `Group` field omitted.
	TxGroupHashes []Digest `codec:"txlist"`
	// contains filtered or unexported fields
}

TxGroup describes a group of transactions that must appear together in a specific order in a block.

type TxType

type TxType string

TxType identifies the type of the transaction

const (
	// PaymentTx is the TxType for payment transactions
	PaymentTx TxType = "pay"
	// KeyRegistrationTx is the TxType for key registration transactions
	KeyRegistrationTx TxType = "keyreg"
	// AssetConfigTx creates, re-configures, or destroys an asset
	AssetConfigTx TxType = "acfg"
	// AssetTransferTx transfers assets between accounts (optionally closing)
	AssetTransferTx TxType = "axfer"
	// AssetFreezeTx changes the freeze status of an asset
	AssetFreezeTx TxType = "afrz"
	// ApplicationCallTx allows creating, deleting, and interacting with an application
	ApplicationCallTx TxType = "appl"
)

type UpgradeState added in v1.4.0

type UpgradeState struct {
	CurrentProtocol        string `codec:"proto"`
	NextProtocol           string `codec:"nextproto"`
	NextProtocolApprovals  uint64 `codec:"nextyes"`
	NextProtocolVoteBefore Round  `codec:"nextbefore"`
	NextProtocolSwitchOn   Round  `codec:"nextswitch"`
}

UpgradeState tracks the protocol upgrade state machine. It is, strictly speaking, computable from the history of all UpgradeVotes but we keep it in the block for explicitness and convenience (instead of materializing it separately, like balances).

type UpgradeVote added in v1.4.0

type UpgradeVote struct {

	// UpgradePropose indicates a proposed upgrade
	UpgradePropose string `codec:"upgradeprop"`

	// UpgradeDelay indicates the time between acceptance and execution
	UpgradeDelay Round `codec:"upgradedelay"`

	// UpgradeApprove indicates a yes vote for the current proposal
	UpgradeApprove bool `codec:"upgradeyes"`
	// contains filtered or unexported fields
}

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

type VRFPK

type VRFPK [ed25519.PublicKeySize]byte

VRFPK is the VRF public key used in key registration transactions

type ValueDelta added in v1.6.0

type ValueDelta struct {
	Action DeltaAction `codec:"at"`
	Bytes  string      `codec:"bs"`
	Uint   uint64      `codec:"ui"`
	// contains filtered or unexported fields
}

ValueDelta links a DeltaAction with a value to be set

type VotePK

type VotePK [ed25519.PublicKeySize]byte

VotePK is the participation public key used in key registration transactions

Jump to

Keyboard shortcuts

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