Skip to content

Commit

Permalink
Regenerate code from specification file (#631)
Browse files Browse the repository at this point in the history
Co-authored-by: Algorand Generation Bot <[email protected]>
  • Loading branch information
github-actions[bot] and algo-dev-service authored May 1, 2024
1 parent 801e559 commit 3a7c4ec
Show file tree
Hide file tree
Showing 16 changed files with 144 additions and 65 deletions.
4 changes: 4 additions & 0 deletions client/v2/algod/algod.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func (c *Client) GetTransactionProof(round uint64, txid string) *GetTransactionP
return &GetTransactionProof{c: c, round: round, txid: txid}
}

func (c *Client) GetBlockLogs(round uint64) *GetBlockLogs {
return &GetBlockLogs{c: c, round: round}
}

func (c *Client) Supply() *Supply {
return &Supply{c: c}
}
Expand Down
23 changes: 23 additions & 0 deletions client/v2/algod/getBlockLogs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package algod

import (
"context"
"fmt"

"github.com/algorand/go-algorand-sdk/v2/client/v2/common"
"github.com/algorand/go-algorand-sdk/v2/client/v2/common/models"
)

// GetBlockLogs get all of the logs from outer and inner app calls in the given
// round
type GetBlockLogs struct {
c *Client

round uint64
}

// Do performs the HTTP request
func (s *GetBlockLogs) Do(ctx context.Context, headers ...*common.Header) (response models.BlockLogsResponse, err error) {
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/blocks/%s/logs", common.EscapeParams(s.round)...), nil, headers)
return
}
48 changes: 29 additions & 19 deletions client/v2/common/models/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,44 @@ type Account struct {
// Address the account public key
Address string `json:"address"`

// Amount (algo) total number of MicroAlgos in the account
// Amount total number of MicroAlgos in the account
Amount uint64 `json:"amount"`

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

// AppsLocalState (appl) applications local data stored in this account.
// AppsLocalState application local data stored in this account.
// Note the raw object uses `map[int] -> AppLocalState` for this type.
AppsLocalState []ApplicationLocalState `json:"apps-local-state,omitempty"`

// AppsTotalExtraPages (teap) the sum of all extra application program pages for
// this account.
// AppsTotalExtraPages the sum of all extra application program pages for this
// account.
AppsTotalExtraPages uint64 `json:"apps-total-extra-pages,omitempty"`

// AppsTotalSchema (tsch) stores the sum of all of the local schemas and global
// schemas in this account.
// AppsTotalSchema the sum of all of the local schemas and global schemas in this
// account.
// Note: the raw account uses `StateSchema` for this type.
AppsTotalSchema ApplicationStateSchema `json:"apps-total-schema,omitempty"`

// Assets (asset) assets held by this account.
// Assets assets held by this account.
// Note the raw object uses `map[int] -> AssetHolding` for this type.
Assets []AssetHolding `json:"assets,omitempty"`

// AuthAddr (spend) the address against which signing should be checked. If empty,
// the address of the current account is used. This field can be updated in any
// AuthAddr the address against which signing should be checked. If empty, the
// address of the current account is used. This field can be updated in any
// transaction by setting the RekeyTo field.
AuthAddr string `json:"auth-addr,omitempty"`

// ClosedAtRound round during which this account was most recently closed.
ClosedAtRound uint64 `json:"closed-at-round,omitempty"`

// CreatedApps (appp) parameters of applications created by this account including
// app global data.
// CreatedApps parameters of applications created by this account including app
// global data.
// Note: the raw account uses `map[int] -> AppParams` for this type.
CreatedApps []Application `json:"created-apps,omitempty"`

// CreatedAssets (apar) parameters of assets created by this account.
// CreatedAssets parameters of assets created by this account.
// Note: the raw account uses `map[int] -> Asset` for this type.
CreatedAssets []Asset `json:"created-assets,omitempty"`

Expand All @@ -54,33 +54,43 @@ type Account struct {
// Deleted whether or not this account is currently closed.
Deleted bool `json:"deleted,omitempty"`

// IncentiveEligible can the account receive block incentives if its balance is in
// range at proposal time.
IncentiveEligible bool `json:"incentive-eligible,omitempty"`

// LastHeartbeat the round in which this account last went online, or explicitly
// renewed their online status.
LastHeartbeat uint64 `json:"last-heartbeat,omitempty"`

// LastProposed the round in which this account last proposed the block.
LastProposed uint64 `json:"last-proposed,omitempty"`

// Participation accountParticipation describes the parameters used by this account
// in consensus protocol.
Participation AccountParticipation `json:"participation,omitempty"`

// PendingRewards amount of MicroAlgos of pending rewards in this account.
PendingRewards uint64 `json:"pending-rewards"`

// RewardBase (ebase) used as part of the rewards computation. Only applicable to
// accounts which are participating.
// RewardBase used as part of the rewards computation. Only applicable to accounts
// which are participating.
RewardBase uint64 `json:"reward-base,omitempty"`

// Rewards (ern) total rewards of MicroAlgos the account has received, including
// pending rewards.
// Rewards total rewards of MicroAlgos the account has received, including pending
// rewards.
Rewards uint64 `json:"rewards"`

// Round the round for which this information is relevant.
Round uint64 `json:"round"`

// SigType indicates what type of signature is used by this account, must be one
// of:
// SigType the type of signature used by this account, must be one of:
// * sig
// * msig
// * lsig
// * or null if unknown
SigType string `json:"sig-type,omitempty"`

// Status (onl) delegation status of the account's MicroAlgos
// Status voting 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.
Expand Down
16 changes: 8 additions & 8 deletions client/v2/common/models/account_participation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ package models
// AccountParticipation accountParticipation describes the parameters used by this
// account in consensus protocol.
type AccountParticipation struct {
// SelectionParticipationKey (sel) Selection public key (if any) currently
// registered for this round.
// SelectionParticipationKey selection public key (if any) currently registered for
// this round.
SelectionParticipationKey []byte `json:"selection-participation-key"`

// StateProofKey (stprf) Root of the state proof key (if any)
// StateProofKey root of the state proof key (if any)
StateProofKey []byte `json:"state-proof-key,omitempty"`

// VoteFirstValid (voteFst) First round for which this participation is valid.
// VoteFirstValid first round for which this participation is valid.
VoteFirstValid uint64 `json:"vote-first-valid"`

// VoteKeyDilution (voteKD) Number of subkeys in each batch of participation keys.
// VoteKeyDilution number of subkeys in each batch of participation keys.
VoteKeyDilution uint64 `json:"vote-key-dilution"`

// VoteLastValid (voteLst) Last round for which this participation is valid.
// VoteLastValid last round for which this participation is valid.
VoteLastValid uint64 `json:"vote-last-valid"`

// VoteParticipationKey (vote) root participation public key (if any) currently
// registered for this round.
// VoteParticipationKey root participation public key (if any) currently registered
// for this round.
VoteParticipationKey []byte `json:"vote-participation-key"`
}
14 changes: 14 additions & 0 deletions client/v2/common/models/app_call_logs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package models

// AppCallLogs the logged messages from an app call along with the app ID and outer
// transaction ID. Logs appear in the same order that they were emitted.
type AppCallLogs struct {
// ApplicationIndex the application from which the logs were generated
ApplicationIndex uint64 `json:"application-index"`

// Logs an array of logs
Logs [][]byte `json:"logs"`

// Txid the transaction ID of the outer app call that lead to these logs
Txid string `json:"txId"`
}
4 changes: 2 additions & 2 deletions client/v2/common/models/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ type Application struct {
// DeletedAtRound round when this application was deleted.
DeletedAtRound uint64 `json:"deleted-at-round,omitempty"`

// Id (appidx) application index.
// Id application index.
Id uint64 `json:"id"`

// Params (appparams) application parameters.
// Params application parameters.
Params ApplicationParams `json:"params"`
}
4 changes: 2 additions & 2 deletions client/v2/common/models/application_local_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ type ApplicationLocalState struct {
// Id the application which this local state is for.
Id uint64 `json:"id"`

// KeyValue (tkv) storage.
// KeyValue storage.
KeyValue []TealKeyValue `json:"key-value,omitempty"`

// OptedInAtRound round when the account opted into the application.
OptedInAtRound uint64 `json:"opted-in-at-round,omitempty"`

// Schema (hsch) schema.
// Schema schema.
Schema ApplicationStateSchema `json:"schema"`
}
2 changes: 1 addition & 1 deletion client/v2/common/models/application_log_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package models

// ApplicationLogData stores the global information associated with an application.
type ApplicationLogData struct {
// Logs (lg) Logs for the application being executed by the transaction.
// Logs logs for the application being executed by the transaction.
Logs [][]byte `json:"logs"`

// Txid transaction ID
Expand Down
12 changes: 6 additions & 6 deletions client/v2/common/models/application_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ package models

// ApplicationParams stores the global information associated with an application.
type ApplicationParams struct {
// ApprovalProgram (approv) approval program.
// ApprovalProgram approval program.
ApprovalProgram []byte `json:"approval-program"`

// ClearStateProgram (clearp) approval program.
// ClearStateProgram clear state program.
ClearStateProgram []byte `json:"clear-state-program"`

// Creator the address that created this application. This is the address where the
// parameters and global state for this application can be found.
Creator string `json:"creator,omitempty"`

// ExtraProgramPages (epp) the amount of extra program pages available to this app.
// ExtraProgramPages the number of extra program pages available to this app.
ExtraProgramPages uint64 `json:"extra-program-pages,omitempty"`

// GlobalState [\gs) global schema
// GlobalState global state
GlobalState []TealKeyValue `json:"global-state,omitempty"`

// GlobalStateSchema [\gsch) global schema
// GlobalStateSchema global schema
GlobalStateSchema ApplicationStateSchema `json:"global-state-schema,omitempty"`

// LocalStateSchema [\lsch) local schema
// LocalStateSchema local schema
LocalStateSchema ApplicationStateSchema `json:"local-state-schema,omitempty"`
}
4 changes: 2 additions & 2 deletions client/v2/common/models/application_state_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package models
// ApplicationStateSchema specifies maximums on the number of each type that may be
// stored.
type ApplicationStateSchema struct {
// NumByteSlice (nbs) num of byte slices.
// NumByteSlice number of byte slices.
NumByteSlice uint64 `json:"num-byte-slice"`

// NumUint (nui) num of uints.
// NumUint number of uints.
NumUint uint64 `json:"num-uint"`
}
4 changes: 2 additions & 2 deletions client/v2/common/models/asset_holding.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package models
// Definition:
// data/basics/userBalance.go : AssetHolding
type AssetHolding struct {
// Amount (a) number of units held.
// Amount number of units held.
Amount uint64 `json:"amount"`

// AssetId asset ID of the holding.
Expand All @@ -13,7 +13,7 @@ type AssetHolding struct {
// Deleted whether or not the asset holding is currently deleted from its account.
Deleted bool `json:"deleted,omitempty"`

// IsFrozen (f) whether or not the holding is frozen.
// IsFrozen whether or not the holding is frozen.
IsFrozen bool `json:"is-frozen"`

// OptedInAtRound round during which the account opted into this asset holding.
Expand Down
39 changes: 19 additions & 20 deletions client/v2/common/models/asset_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,59 @@ package models
// Definition:
// data/transactions/asset.go : AssetParams
type AssetParams struct {
// Clawback (c) Address of account used to clawback holdings of this asset. If
// empty, clawback is not permitted.
// Clawback address of account used to clawback holdings of this asset. If empty,
// clawback is not permitted.
Clawback string `json:"clawback,omitempty"`

// Creator 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.
Creator string `json:"creator"`

// Decimals (dc) 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. This value must be between 0 and 19 (inclusive).
// Decimals 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. This
// value must be between 0 and 19 (inclusive).
Decimals uint64 `json:"decimals"`

// DefaultFrozen (df) Whether holdings of this asset are frozen by default.
// DefaultFrozen whether holdings of this asset are frozen by default.
DefaultFrozen bool `json:"default-frozen,omitempty"`

// Freeze (f) Address of account used to freeze holdings of this asset. If empty,
// Freeze address of account used to freeze holdings of this asset. If empty,
// freezing is not permitted.
Freeze string `json:"freeze,omitempty"`

// Manager (m) Address of account used to manage the keys of this asset and to
// destroy it.
// Manager address of account used to manage the keys of this asset and to destroy
// it.
Manager string `json:"manager,omitempty"`

// MetadataHash (am) A commitment to some unspecified asset metadata. The format of
// this metadata is up to the application.
// MetadataHash a commitment to some unspecified asset metadata. The format of this
// metadata is up to the application.
MetadataHash []byte `json:"metadata-hash,omitempty"`

// Name (an) Name of this asset, as supplied by the creator. Included only when the
// Name name of this asset, as supplied by the creator. Included only when the
// asset name is composed of printable utf-8 characters.
Name string `json:"name,omitempty"`

// NameB64 base64 encoded name of this asset, as supplied by the creator.
NameB64 []byte `json:"name-b64,omitempty"`

// Reserve (r) Address of account holding reserve (non-minted) units of this asset.
// Reserve address of account holding reserve (non-minted) units of this asset.
Reserve string `json:"reserve,omitempty"`

// Total (t) The total number of units of this asset.
// Total the total number of units of this asset.
Total uint64 `json:"total"`

// UnitName (un) Name of a unit of this asset, as supplied by the creator. Included
// only when the name of a unit of this asset is composed of printable utf-8
// characters.
// UnitName name of a unit of this asset, as supplied by the creator. Included only
// when the name of a unit of this asset is composed of printable utf-8 characters.
UnitName string `json:"unit-name,omitempty"`

// UnitNameB64 base64 encoded name of a unit of this asset, as supplied by the
// creator.
UnitNameB64 []byte `json:"unit-name-b64,omitempty"`

// Url (au) URL where more information about the asset can be retrieved. Included
// only when the URL is composed of printable utf-8 characters.
// Url uRL where more information about the asset can be retrieved. Included only
// when the URL is composed of printable utf-8 characters.
Url string `json:"url,omitempty"`

// UrlB64 base64 encoded URL where more information about the asset can be
Expand Down
12 changes: 12 additions & 0 deletions client/v2/common/models/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ package models
// Definition:
// data/bookkeeping/block.go : Block
type Block struct {
// Bonus the potential bonus payout for this block.
Bonus uint64 `json:"bonus,omitempty"`

// FeesCollected the sum of all fees paid by transactions in this block.
FeesCollected uint64 `json:"fees-collected,omitempty"`

// GenesisHash (gh) hash to which this block belongs.
GenesisHash []byte `json:"genesis-hash"`

Expand All @@ -17,6 +23,12 @@ type Block struct {
// PreviousBlockHash (prev) Previous block hash.
PreviousBlockHash []byte `json:"previous-block-hash"`

// Proposer the proposer of this block.
Proposer string `json:"proposer,omitempty"`

// ProposerPayout the actual amount transferred to the proposer from the fee sink.
ProposerPayout uint64 `json:"proposer-payout,omitempty"`

// Rewards fields relating to rewards,
Rewards BlockRewards `json:"rewards,omitempty"`

Expand Down
Loading

0 comments on commit 3a7c4ec

Please sign in to comment.