Skip to content

Commit

Permalink
Merge branch 'release/v1.14.0-beta.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
egieseke committed Mar 18, 2022
2 parents a2a3518 + fb6dd22 commit 01940a3
Show file tree
Hide file tree
Showing 26 changed files with 4,389 additions and 4,048 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 1.14.0-beta.1
- Unlimited assets changes (#294)
# 1.13.0
## Added
- Add app creator to dryrun request (#283)
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test:

unit:
go test $(TEST_SOURCES_NO_CUCUMBER)
cd test && go test -timeout 0s --godog.strict=true --godog.format=pretty --godog.tags="@unit.offline,@unit.algod,@unit.indexer,@unit.transactions.keyreg,@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,@unit.indexer.logs,@unit.abijson,@unit.transactions.payment,@unit.atomic_transaction_composer" --test.v .
cd test && go test -timeout 0s --godog.strict=true --godog.format=pretty --godog.tags="@unit.offline,@unit.algod,@unit.indexer,@unit.transactions.keyreg,@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,@unit.indexer.logs,@unit.abijson,@unit.transactions.payment,@unit.atomic_transaction_composer,@unit.responses.unlimited_assets,@unit.indexer.ledger_refactoring,@unit.algod.ledger_refactoring" --test.v .

integration:
go test $(TEST_SOURCES_NO_CUCUMBER)
Expand All @@ -28,4 +28,4 @@ integration:
docker-test:
./test/docker/run_docker.sh

.PHONY: test fmt
.PHONY: test fmt
35 changes: 35 additions & 0 deletions client/v2/algod/accountApplicationInformation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package algod

import (
"context"
"fmt"

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

// AccountApplicationInformationParams contains all of the query parameters for url serialization.
type AccountApplicationInformationParams struct {

// Format configures whether the response object is JSON or MessagePack encoded.
Format string `url:"format,omitempty"`
}

// AccountApplicationInformation given a specific account public key and
// application ID, this call returns the account's application local state and
// global state (AppLocalState and AppParams, if either exists). Global state will
// only be returned if the provided address is the application's creator.
type AccountApplicationInformation struct {
c *Client

address string
applicationId uint64

p AccountApplicationInformationParams
}

// Do performs the HTTP request
func (s *AccountApplicationInformation) Do(ctx context.Context, headers ...*common.Header) (response models.AccountApplicationResponse, err error) {
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/accounts/%v/applications/%v", s.address, s.applicationId), s.p, headers)
return
}
35 changes: 35 additions & 0 deletions client/v2/algod/accountAssetInformation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package algod

import (
"context"
"fmt"

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

// AccountAssetInformationParams contains all of the query parameters for url serialization.
type AccountAssetInformationParams struct {

// Format configures whether the response object is JSON or MessagePack encoded.
Format string `url:"format,omitempty"`
}

// AccountAssetInformation given a specific account public key and asset ID, this
// call returns the account's asset holding and asset parameters (if either exist).
// Asset parameters will only be returned if the provided address is the asset's
// creator.
type AccountAssetInformation struct {
c *Client

address string
assetId uint64

p AccountAssetInformationParams
}

// Do performs the HTTP request
func (s *AccountAssetInformation) Do(ctx context.Context, headers ...*common.Header) (response models.AccountAssetResponse, err error) {
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/accounts/%v/assets/%v", s.address, s.assetId), s.p, headers)
return
}
13 changes: 13 additions & 0 deletions client/v2/algod/accountInformation.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import (
// AccountInformationParams contains all of the query parameters for url serialization.
type AccountInformationParams struct {

// Exclude when set to `all` will exclude asset holdings, application local state,
// created asset parameters, any created application parameters. Defaults to
// `none`.
Exclude string `url:"exclude,omitempty"`

// Format configures whether the response object is JSON or MessagePack encoded.
Format string `url:"format,omitempty"`
}
Expand All @@ -25,6 +30,14 @@ type AccountInformation struct {
p AccountInformationParams
}

// Exclude when set to `all` will exclude asset holdings, application local state,
// created asset parameters, any created application parameters. Defaults to
// `none`.
func (s *AccountInformation) Exclude(Exclude string) *AccountInformation {
s.p.Exclude = Exclude
return s
}

// Do performs the HTTP request
func (s *AccountInformation) Do(ctx context.Context, headers ...*common.Header) (response models.Account, err error) {
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/accounts/%v", s.address), s.p, headers)
Expand Down
8 changes: 8 additions & 0 deletions client/v2/algod/algod.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ func (c *Client) AccountInformation(address string) *AccountInformation {
return &AccountInformation{c: c, address: address}
}

func (c *Client) AccountAssetInformation(address string, assetId uint64) *AccountAssetInformation {
return &AccountAssetInformation{c: c, address: address, assetId: assetId}
}

func (c *Client) AccountApplicationInformation(address string, applicationId uint64) *AccountApplicationInformation {
return &AccountApplicationInformation{c: c, address: address, applicationId: applicationId}
}

func (c *Client) PendingTransactionsByAddress(address string) *PendingTransactionsByAddress {
return &PendingTransactionsByAddress{c: c, address: address}
}
Expand Down
17 changes: 17 additions & 0 deletions client/v2/common/models/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,21 @@ type Account struct {
// * NotParticipating - indicates that the associated account is neither a
// delegator nor a delegate.
Status string `json:"status"`

// TotalAppsOptedIn the count of all applications that have been opted in,
// equivalent to the count of application local data (AppLocalState objects) stored
// in this account.
TotalAppsOptedIn uint64 `json:"total-apps-opted-in"`

// TotalAssetsOptedIn the count of all assets that have been opted in, equivalent
// to the count of AssetHolding objects held by this account.
TotalAssetsOptedIn uint64 `json:"total-assets-opted-in"`

// TotalCreatedApps the count of all apps (AppParams objects) created by this
// account.
TotalCreatedApps uint64 `json:"total-created-apps"`

// TotalCreatedAssets the count of all assets (AssetParams objects) created by this
// account.
TotalCreatedAssets uint64 `json:"total-created-assets"`
}
19 changes: 19 additions & 0 deletions client/v2/common/models/account_application_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package models

// AccountApplicationResponse accountApplicationResponse describes the account's
// application local state and global state (AppLocalState and AppParams, if either
// exists) for a specific application ID. Global state will only be returned if the
// provided address is the application's creator.
type AccountApplicationResponse struct {
// AppLocalState (appl) the application local data stored in this account.
// The raw account uses `AppLocalState` for this type.
AppLocalState ApplicationLocalState `json:"app-local-state,omitempty"`

// CreatedApp (appp) parameters of the application created by this account
// including app global data.
// The raw account uses `AppParams` for this type.
CreatedApp ApplicationParams `json:"created-app,omitempty"`

// Round the round for which this information is relevant.
Round uint64 `json:"round"`
}
17 changes: 17 additions & 0 deletions client/v2/common/models/account_asset_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package models

// AccountAssetResponse accountAssetResponse describes the account's asset holding
// and asset parameters (if either exist) for a specific asset ID. Asset parameters
// will only be returned if the provided address is the asset's creator.
type AccountAssetResponse struct {
// AssetHolding (asset) Details about the asset held by this account.
// The raw account uses `AssetHolding` for this type.
AssetHolding AssetHolding `json:"asset-holding,omitempty"`

// CreatedAsset (apar) parameters of the asset created by this account.
// The raw account uses `AssetParams` for this type.
CreatedAsset AssetParams `json:"created-asset,omitempty"`

// Round the round for which this information is relevant.
Round uint64 `json:"round"`
}
26 changes: 26 additions & 0 deletions client/v2/common/models/account_error_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package models

// AccountErrorResponse an error response for the AccountInformation endpoint, with
// optional information about limits that were exceeded.
type AccountErrorResponse struct {
// Data
Data string `json:"data,omitempty"`

// MaxResults
MaxResults uint64 `json:"max-results,omitempty"`

// Message
Message string `json:"message"`

// TotalAppsLocalState
TotalAppsLocalState uint64 `json:"total-apps-local-state,omitempty"`

// TotalAssets
TotalAssets uint64 `json:"total-assets,omitempty"`

// TotalCreatedApps
TotalCreatedApps uint64 `json:"total-created-apps,omitempty"`

// TotalCreatedAssets
TotalCreatedAssets uint64 `json:"total-created-assets,omitempty"`
}
14 changes: 14 additions & 0 deletions client/v2/common/models/application_local_states_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package models

// ApplicationLocalStatesResponse
type ApplicationLocalStatesResponse struct {
// AppsLocalStates
AppsLocalStates []ApplicationLocalState `json:"apps-local-states"`

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

// NextToken used for pagination, when making another request provide this token
// with the next parameter.
NextToken string `json:"next-token,omitempty"`
}
5 changes: 0 additions & 5 deletions client/v2/common/models/asset_holding.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ type AssetHolding struct {
// AssetId asset ID of the holding.
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"`

// Deleted whether or not the asset holding is currently deleted from its account.
Deleted bool `json:"deleted,omitempty"`

Expand Down
14 changes: 14 additions & 0 deletions client/v2/common/models/asset_holdings_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package models

// AssetHoldingsResponse
type AssetHoldingsResponse struct {
// Assets
Assets []AssetHolding `json:"assets"`

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

// NextToken used for pagination, when making another request provide this token
// with the next parameter.
NextToken string `json:"next-token,omitempty"`
}
16 changes: 16 additions & 0 deletions client/v2/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ func (c *Client) LookupAccountByID(accountId string) *LookupAccountByID {
return &LookupAccountByID{c: c, accountId: accountId}
}

func (c *Client) LookupAccountAssets(accountId string) *LookupAccountAssets {
return &LookupAccountAssets{c: c, accountId: accountId}
}

func (c *Client) LookupAccountCreatedAssets(accountId string) *LookupAccountCreatedAssets {
return &LookupAccountCreatedAssets{c: c, accountId: accountId}
}

func (c *Client) LookupAccountAppLocalStates(accountId string) *LookupAccountAppLocalStates {
return &LookupAccountAppLocalStates{c: c, accountId: accountId}
}

func (c *Client) LookupAccountCreatedApplications(accountId string) *LookupAccountCreatedApplications {
return &LookupAccountCreatedApplications{c: c, accountId: accountId}
}

func (c *Client) LookupAccountTransactions(accountId string) *LookupAccountTransactions {
return &LookupAccountTransactions{c: c, accountId: accountId}
}
Expand Down
73 changes: 73 additions & 0 deletions client/v2/indexer/lookupAccountAppLocalStates.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package indexer

import (
"context"
"fmt"

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

// LookupAccountAppLocalStatesParams contains all of the query parameters for url serialization.
type LookupAccountAppLocalStatesParams struct {

// ApplicationID application ID
ApplicationID uint64 `url:"application-id,omitempty"`

// IncludeAll include all items including closed accounts, deleted applications,
// destroyed assets, opted-out asset holdings, and closed-out application
// localstates.
IncludeAll bool `url:"include-all,omitempty"`

// Limit maximum number of results to return. There could be additional pages even
// if the limit is not reached.
Limit uint64 `url:"limit,omitempty"`

// Next the next page of results. Use the next token provided by the previous
// results.
Next string `url:"next,omitempty"`
}

// LookupAccountAppLocalStates lookup an account's asset holdings, optionally for a
// specific ID.
type LookupAccountAppLocalStates struct {
c *Client

accountId string

p LookupAccountAppLocalStatesParams
}

// ApplicationID application ID
func (s *LookupAccountAppLocalStates) ApplicationID(ApplicationID uint64) *LookupAccountAppLocalStates {
s.p.ApplicationID = ApplicationID
return s
}

// IncludeAll include all items including closed accounts, deleted applications,
// destroyed assets, opted-out asset holdings, and closed-out application
// localstates.
func (s *LookupAccountAppLocalStates) IncludeAll(IncludeAll bool) *LookupAccountAppLocalStates {
s.p.IncludeAll = IncludeAll
return s
}

// Limit maximum number of results to return. There could be additional pages even
// if the limit is not reached.
func (s *LookupAccountAppLocalStates) Limit(Limit uint64) *LookupAccountAppLocalStates {
s.p.Limit = Limit
return s
}

// Next the next page of results. Use the next token provided by the previous
// results.
func (s *LookupAccountAppLocalStates) Next(Next string) *LookupAccountAppLocalStates {
s.p.Next = Next
return s
}

// Do performs the HTTP request
func (s *LookupAccountAppLocalStates) Do(ctx context.Context, headers ...*common.Header) (response models.ApplicationLocalStatesResponse, err error) {
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/accounts/%v/apps-local-state", s.accountId), s.p, headers)
return
}
Loading

0 comments on commit 01940a3

Please sign in to comment.