Skip to content

Commit

Permalink
Merge branch 'release/v1.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
onetechnical committed Jun 17, 2021
2 parents 056bf3a + 4ffaa6b commit 3c87e12
Show file tree
Hide file tree
Showing 70 changed files with 3,298 additions and 2,182 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 1.9.0
# Added
- Support for TEAL 4 programs
- Support for creating application with extra program pages
- Support for setting a transaction fee below the network minimum, for use with fee pooling
# Bugfix
- Algod and Indexer responses will now produce JSON that matches the other SDKs
# 1.8.0
# Added
- V2: Add MakeClientWithHeaders wrapper functions
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build: generate

unit:
go test $(TEST_SOURCES_NO_CUCUMBER)
cd test && go test --godog.strict=true --godog.format=pretty --godog.tags="@unit.offline,@unit.algod,@unit.indexer,@unit.rekey,@unit.tealsign,@unit.dryrun,@unit.responses,@unit.applications,@unit.transactions,@unit.indexer.rekey,@unit.responses.messagepack,@unit.responses.231,@unit.responses.messagepack.231,@unit.responses.genesis" --test.v .
cd test && go test --godog.strict=true --godog.format=pretty --godog.tags="@unit.offline,@unit.algod,@unit.indexer,@unit.rekey,@unit.tealsign,@unit.dryrun,@unit.responses,@unit.applications,@unit.transactions,@unit.indexer.rekey,@unit.responses.messagepack,@unit.responses.231,@unit.responses.messagepack.231,@unit.responses.genesis,@unit.feetest" --test.v .

integration:
go test $(TEST_SOURCES_NO_CUCUMBER)
Expand Down
8 changes: 4 additions & 4 deletions client/algod/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,8 @@ type AssetList struct {
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.
// 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.
//
// required: true
Fee uint64 `json:"fee"`
Expand All @@ -571,8 +571,8 @@ type TransactionFee struct {
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.
// 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.
//
// required: true
Fee uint64 `json:"fee"`
Expand Down
2 changes: 2 additions & 0 deletions client/v2/algod/algod.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func MakeClient(address string, apiToken string) (c *Client, err error) {
return
}

// MakeClientWithHeaders is the factory for constructing a ClientV2 for a
// given endpoint with custom headers.
func MakeClientWithHeaders(address string, apiToken string, headers []*common.Header) (c *Client, err error) {
commonClientWithHeaders, err := common.MakeClientWithHeaders(address, authHeader, apiToken, headers)
c = (*Client)(commonClientWithHeaders)
Expand Down
18 changes: 11 additions & 7 deletions client/v2/common/models/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ package models
// data/basics/userBalance.go : AccountData
type Account struct {
// Address the account public key
Address string `json:"address,omitempty"`
Address string `json:"address"`

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

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

// AppsLocalState (appl) applications 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 uint64 `json:"apps-total-extra-pages,omitempty"`

// AppsTotalSchema (tsch) stores the sum of all of the local schemas and global
// schemas in this account.
// Note: the raw account uses `StateSchema` for this type.
Expand Down Expand Up @@ -55,18 +59,18 @@ type Account struct {
Participation AccountParticipation `json:"participation,omitempty"`

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

// RewardBase (ebase) 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 uint64 `json:"rewards,omitempty"`
Rewards uint64 `json:"rewards"`

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

// SigType indicates what type of signature is used by this account, must be one
// of:
Expand All @@ -81,5 +85,5 @@ type Account struct {
// pool.
// * NotParticipating - indicates that the associated account is neither a
// delegator nor a delegate.
Status string `json:"status,omitempty"`
Status string `json:"status"`
}
10 changes: 5 additions & 5 deletions client/v2/common/models/account_participation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ package models
type AccountParticipation struct {
// SelectionParticipationKey (sel) Selection public key (if any) currently
// registered for this round.
SelectionParticipationKey []byte `json:"selection-participation-key,omitempty"`
SelectionParticipationKey []byte `json:"selection-participation-key"`

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

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

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

// VoteParticipationKey (vote) root participation public key (if any) currently
// registered for this round.
VoteParticipationKey []byte `json:"vote-participation-key,omitempty"`
VoteParticipationKey []byte `json:"vote-participation-key"`
}
4 changes: 2 additions & 2 deletions client/v2/common/models/account_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type AccountResponse struct {
// Account account information at a given round.
// Definition:
// data/basics/userBalance.go : AccountData
Account Account `json:"account,omitempty"`
Account Account `json:"account"`

// CurrentRound round at which the results were computed.
CurrentRound uint64 `json:"current-round,omitempty"`
CurrentRound uint64 `json:"current-round"`
}
4 changes: 2 additions & 2 deletions client/v2/common/models/account_state_delta.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package models
// AccountStateDelta application state delta.
type AccountStateDelta struct {
// Address
Address string `json:"address,omitempty"`
Address string `json:"address"`

// Delta application state delta.
Delta []EvalDeltaKeyValue `json:"delta,omitempty"`
Delta []EvalDeltaKeyValue `json:"delta"`
}
4 changes: 2 additions & 2 deletions client/v2/common/models/accounts_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package models
// AccountsResponse
type AccountsResponse struct {
// Accounts
Accounts []Account `json:"accounts,omitempty"`
Accounts []Account `json:"accounts"`

// CurrentRound round at which the results were computed.
CurrentRound uint64 `json:"current-round,omitempty"`
CurrentRound uint64 `json:"current-round"`

// NextToken used for pagination, when making another request provide this token
// with the next parameter.
Expand Down
4 changes: 2 additions & 2 deletions client/v2/common/models/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ type Application struct {
DeletedAtRound uint64 `json:"deleted-at-round,omitempty"`

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

// Params (appparams) application parameters.
Params ApplicationParams `json:"params,omitempty"`
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 @@ -10,7 +10,7 @@ type ApplicationLocalState struct {
Deleted bool `json:"deleted,omitempty"`

// Id the application which this local state is for.
Id uint64 `json:"id,omitempty"`
Id uint64 `json:"id"`

// KeyValue (tkv) storage.
KeyValue []TealKeyValue `json:"key-value,omitempty"`
Expand All @@ -19,5 +19,5 @@ type ApplicationLocalState struct {
OptedInAtRound uint64 `json:"opted-in-at-round,omitempty"`

// Schema (hsch) schema.
Schema ApplicationStateSchema `json:"schema,omitempty"`
Schema ApplicationStateSchema `json:"schema"`
}
7 changes: 5 additions & 2 deletions client/v2/common/models/application_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ package models
// ApplicationParams stores the global information associated with an application.
type ApplicationParams struct {
// ApprovalProgram (approv) approval program.
ApprovalProgram []byte `json:"approval-program,omitempty"`
ApprovalProgram []byte `json:"approval-program"`

// ClearStateProgram (clearp) approval program.
ClearStateProgram []byte `json:"clear-state-program,omitempty"`
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 uint64 `json:"extra-program-pages,omitempty"`

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

Expand Down
2 changes: 1 addition & 1 deletion client/v2/common/models/application_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ type ApplicationResponse struct {
Application Application `json:"application,omitempty"`

// CurrentRound round at which the results were computed.
CurrentRound uint64 `json:"current-round,omitempty"`
CurrentRound uint64 `json:"current-round"`
}
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 @@ -4,8 +4,8 @@ package models
// stored.
type ApplicationStateSchema struct {
// NumByteSlice (nbs) num of byte slices.
NumByteSlice uint64 `json:"num-byte-slice,omitempty"`
NumByteSlice uint64 `json:"num-byte-slice"`

// NumUint (nui) num of uints.
NumUint uint64 `json:"num-uint,omitempty"`
NumUint uint64 `json:"num-uint"`
}
4 changes: 2 additions & 2 deletions client/v2/common/models/applications_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package models
// ApplicationsResponse
type ApplicationsResponse struct {
// Applications
Applications []Application `json:"applications,omitempty"`
Applications []Application `json:"applications"`

// CurrentRound round at which the results were computed.
CurrentRound uint64 `json:"current-round,omitempty"`
CurrentRound uint64 `json:"current-round"`

// NextToken used for pagination, when making another request provide this token
// with the next parameter.
Expand Down
4 changes: 2 additions & 2 deletions client/v2/common/models/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ type Asset struct {
DestroyedAtRound uint64 `json:"destroyed-at-round,omitempty"`

// Index unique asset identifier
Index uint64 `json:"index,omitempty"`
Index uint64 `json:"index"`

// Params assetParams specifies the parameters for an asset.
// (apar) when part of an AssetConfig transaction.
// Definition:
// data/transactions/asset.go : AssetParams
Params AssetParams `json:"params,omitempty"`
Params AssetParams `json:"params"`
}
4 changes: 2 additions & 2 deletions client/v2/common/models/asset_balances_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package models
// AssetBalancesResponse
type AssetBalancesResponse struct {
// Balances
Balances []MiniAssetHolding `json:"balances,omitempty"`
Balances []MiniAssetHolding `json:"balances"`

// CurrentRound round at which the results were computed.
CurrentRound uint64 `json:"current-round,omitempty"`
CurrentRound uint64 `json:"current-round"`

// NextToken used for pagination, when making another request provide this token
// with the next parameter.
Expand Down
8 changes: 4 additions & 4 deletions client/v2/common/models/asset_holding.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ package models
// data/basics/userBalance.go : AssetHolding
type AssetHolding struct {
// Amount (a) number of units held.
Amount uint64 `json:"amount,omitempty"`
Amount uint64 `json:"amount"`

// AssetId asset ID of the holding.
AssetId uint64 `json:"asset-id,omitempty"`
AssetId uint64 `json:"asset-id"`

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

// 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 bool `json:"is-frozen,omitempty"`
IsFrozen bool `json:"is-frozen"`

// OptedInAtRound round during which the account opted into this asset holding.
OptedInAtRound uint64 `json:"opted-in-at-round,omitempty"`
Expand Down
6 changes: 3 additions & 3 deletions client/v2/common/models/asset_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ type AssetParams struct {
// 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,omitempty"`
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 uint64 `json:"decimals,omitempty"`
Decimals uint64 `json:"decimals"`

// DefaultFrozen (df) Whether holdings of this asset are frozen by default.
DefaultFrozen bool `json:"default-frozen,omitempty"`
Expand All @@ -42,7 +42,7 @@ type AssetParams struct {
Reserve string `json:"reserve,omitempty"`

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

// UnitName (un) Name of a unit of this asset, as supplied by the creator.
UnitName string `json:"unit-name,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions client/v2/common/models/asset_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package models
// AssetResponse
type AssetResponse struct {
// Asset specifies both the unique identifier and the parameters for an asset
Asset Asset `json:"asset,omitempty"`
Asset Asset `json:"asset"`

// CurrentRound round at which the results were computed.
CurrentRound uint64 `json:"current-round,omitempty"`
CurrentRound uint64 `json:"current-round"`
}
4 changes: 2 additions & 2 deletions client/v2/common/models/assets_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package models
// AssetsResponse
type AssetsResponse struct {
// Assets
Assets []Asset `json:"assets,omitempty"`
Assets []Asset `json:"assets"`

// CurrentRound round at which the results were computed.
CurrentRound uint64 `json:"current-round,omitempty"`
CurrentRound uint64 `json:"current-round"`

// NextToken used for pagination, when making another request provide this token
// with the next parameter.
Expand Down
14 changes: 7 additions & 7 deletions client/v2/common/models/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ package models
// data/bookkeeping/block.go : Block
type Block struct {
// GenesisHash (gh) hash to which this block belongs.
GenesisHash []byte `json:"genesis-hash,omitempty"`
GenesisHash []byte `json:"genesis-hash"`

// GenesisId (gen) ID to which this block belongs.
GenesisId string `json:"genesis-id,omitempty"`
GenesisId string `json:"genesis-id"`

// PreviousBlockHash (prev) Previous block hash.
PreviousBlockHash []byte `json:"previous-block-hash,omitempty"`
PreviousBlockHash []byte `json:"previous-block-hash"`

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

// Round (rnd) Current round on which this block was appended to the chain.
Round uint64 `json:"round,omitempty"`
Round uint64 `json:"round"`

// Seed (seed) Sortition seed.
Seed []byte `json:"seed,omitempty"`
Seed []byte `json:"seed"`

// Timestamp (ts) Block creation timestamp in seconds since eposh
Timestamp uint64 `json:"timestamp,omitempty"`
Timestamp uint64 `json:"timestamp"`

// Transactions (txns) list of transactions corresponding to a given round.
Transactions []Transaction `json:"transactions,omitempty"`
Expand All @@ -35,7 +35,7 @@ type Block struct {
// 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.
TransactionsRoot []byte `json:"transactions-root,omitempty"`
TransactionsRoot []byte `json:"transactions-root"`

// TxnCounter (tc) TxnCounter counts the number of transactions committed in the
// ledger, from the time at which support for this feature was introduced.
Expand Down
2 changes: 1 addition & 1 deletion client/v2/common/models/block_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "github.com/algorand/go-algorand-sdk/types"
// BlockResponse encoded block object.
type BlockResponse struct {
// Block block header data.
Block types.Block `json:"block,omitempty"`
Block types.Block `json:"block"`

// Cert optional certificate object. This is only included when the format is set
// to message pack.
Expand Down
Loading

0 comments on commit 3c87e12

Please sign in to comment.