Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rebase #2

Merged
merged 17 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

orbs:
go: circleci/go@1.7.3
go: circleci/go@1.11.0

workflows:
circleci_build_and_test:
Expand All @@ -10,7 +10,7 @@ workflows:
name: 'test_go_<< matrix.go_version >>'
matrix:
parameters:
go_version: ['1.20.5']
go_version: ['1.21.10']

jobs:
test:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ jobs:
- name: Install specific golang
uses: actions/[email protected]
with:
go-version: '1.20.5'
go-version: '1.21.10'
- name: Check format
run: test -z `go fmt ./...`
- name: Vet
run: go vet ./...
- name: reviewdog-golangci-lint
uses: reviewdog/action-golangci-lint@v2.3.1
uses: reviewdog/action-golangci-lint@v2.6.1
with:
golangci_lint_version: "v1.53.2"
golangci_lint_version: "v1.58.0"
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
go_version: "1.20.5"
go_version: "1.21.10"
reporter: "github-pr-review"
tool_name: "Lint Errors"
level: "error"
Expand Down
2 changes: 1 addition & 1 deletion .test-env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configs for testing repo download:
SDK_TESTING_URL="https://github.com/algorand/algorand-sdk-testing"
SDK_TESTING_BRANCH="V2"
SDK_TESTING_BRANCH="master"
SDK_TESTING_HARNESS="test-harness"

INSTALL_ONLY=0
Expand Down
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# v2.6.0

<!-- Release notes generated using configuration in .github/release.yml at release/v2.6.0 -->

## What's Changed
### Enhancements
* Tests: Enable min-balance tests for indexer and algod APIs. by @gmalouf in https://github.com/algorand/go-algorand-sdk/pull/642
### Other
* Regenerate code with the latest specification file (6c917476) by @github-actions in https://github.com/algorand/go-algorand-sdk/pull/635
* Regenerate code with the latest specification file (981aef83) by @github-actions in https://github.com/algorand/go-algorand-sdk/pull/640
* Regenerate code with the latest specification file (2335b019) by @github-actions in https://github.com/algorand/go-algorand-sdk/pull/641


**Full Changelog**: https://github.com/algorand/go-algorand-sdk/compare/v2.5.0...v2.6.0

# v2.5.0

<!-- Release notes generated using configuration in .github/release.yml at release/v2.5.0 -->

## What's Changed
### Bugfixes
* Fix: Fix indexer sync issue in cucumber tests by @jasonpaulos in https://github.com/algorand/go-algorand-sdk/pull/628
* chore: fix function names by @tianzedavid in https://github.com/algorand/go-algorand-sdk/pull/632
* Tests: Fix funding for cucumber tests by rotating sender accounts by @jasonpaulos in https://github.com/algorand/go-algorand-sdk/pull/630
### New Features
* Build: Bump golang version to 1.21.10 by @gmalouf in https://github.com/algorand/go-algorand-sdk/pull/636
### Enhancements
* Build: Bump go version for builds/workflows to 1.20.14 by @gmalouf in https://github.com/algorand/go-algorand-sdk/pull/629
* Incentives: Add fields in block header for proposer and fees collected. by @jannotti in https://github.com/algorand/go-algorand-sdk/pull/617
### Other
* Regenerate code with the latest specification file (ff2c7476) by @github-actions in https://github.com/algorand/go-algorand-sdk/pull/631

## New Contributors
* @jannotti made their first contribution in https://github.com/algorand/go-algorand-sdk/pull/617
* @tianzedavid made their first contribution in https://github.com/algorand/go-algorand-sdk/pull/632

**Full Changelog**: https://github.com/algorand/go-algorand-sdk/compare/v2.4.0...v2.5.0

# v2.4.0

<!-- Release notes generated using configuration in .github/release.yml at release/v2.4.0 -->
Expand Down
6 changes: 5 additions & 1 deletion client/v2/algod/algod.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (c *Client) getMsgpack(ctx context.Context, response interface{}, path stri
return (*common.Client)(c).GetRawMsgpack(ctx, response, path, body, headers)
}

// getMsgpack performs a GET request to the specific path against the server, assumes msgpack response
// getRaw performs a GET request to the specific path against the server, returning the raw response bytes
func (c *Client) getRaw(ctx context.Context, path string, body interface{}, headers []*common.Header) ([]byte, error) {
return (*common.Client)(c).GetRaw(ctx, path, body, headers)
}
Expand Down 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
}
52 changes: 33 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,47 @@ 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"`

// MinBalance microAlgo balance required by the account.
// The requirement grows based on asset and application usage.
MinBalance uint64 `json:"min-balance"`

// 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
13 changes: 13 additions & 0 deletions client/v2/common/models/account_asset_holding.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package models

// AccountAssetHolding accountAssetHolding describes the account's asset holding
// and asset parameters (if either exist) for a specific asset ID.
type AccountAssetHolding struct {
// AssetHolding (asset) Details about the asset held by this account.
// The raw account uses `AssetHolding` for this type.
AssetHolding AssetHolding `json:"asset-holding"`

// AssetParams (apar) parameters of the asset held by this account.
// The raw account uses `AssetParams` for this type.
AssetParams AssetParams `json:"asset-params,omitempty"`
}
15 changes: 15 additions & 0 deletions client/v2/common/models/account_assets_information_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package models

// AccountAssetsInformationResponse accountAssetsInformationResponse contains a
// list of assets held by an account.
type AccountAssetsInformationResponse struct {
// AssetHoldings
AssetHoldings []AccountAssetHolding `json:"asset-holdings,omitempty"`

// NextToken used for pagination, when making another request provide this token
// with the next parameter.
NextToken string `json:"next-token,omitempty"`

// Round the round for which this information is relevant.
Round uint64 `json:"round"`
}
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"`
}
Loading