Skip to content

Commit

Permalink
bug-fix: include currency-greater-than param for 0 value (algorand#584)
Browse files Browse the repository at this point in the history
* include currency-greater-than param for 0 value
  • Loading branch information
shiqizng authored Aug 10, 2023
1 parent 6e2c96f commit 0865549
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 11 deletions.
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="master"
SDK_TESTING_BRANCH="V2"
SDK_TESTING_HARNESS="test-harness"

INSTALL_ONLY=0
Expand Down
4 changes: 4 additions & 0 deletions client/v2/algod/algod.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ func (c *Client) Block(round uint64) *Block {
return &Block{c: c, round: round}
}

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

func (c *Client) GetBlockHash(round uint64) *GetBlockHash {
return &GetBlockHash{c: c, round: round}
}
Expand Down
23 changes: 23 additions & 0 deletions client/v2/algod/getBlockTxids.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"
)

// GetBlockTxids get the top level transaction IDs for the block on the given
// round.
type GetBlockTxids struct {
c *Client

round uint64
}

// Do performs the HTTP request
func (s *GetBlockTxids) Do(ctx context.Context, headers ...*common.Header) (response models.BlockTxidsResponse, err error) {
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/blocks/%s/txids", common.EscapeParams(s.round)...), nil, headers)
return
}
7 changes: 7 additions & 0 deletions client/v2/common/models/block_txids_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package models

// BlockTxidsResponse top level transaction IDs in a block.
type BlockTxidsResponse struct {
// Blocktxids block transaction IDs.
Blocktxids []string `json:"blockTxids"`
}
4 changes: 2 additions & 2 deletions client/v2/indexer/lookupAccountTransactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type LookupAccountTransactionsParams struct {
// CurrencyGreaterThan results should have an amount greater than this value.
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
CurrencyGreaterThan uint64 `url:"currency-greater-than,omitempty"`
CurrencyGreaterThan *uint64 `url:"currency-greater-than,omitempty"`

// CurrencyLessThan results should have an amount less than this value. MicroAlgos
// are the default currency unless an asset-id is provided, in which case the asset
Expand Down Expand Up @@ -123,7 +123,7 @@ func (s *LookupAccountTransactions) BeforeTime(BeforeTime time.Time) *LookupAcco
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
func (s *LookupAccountTransactions) CurrencyGreaterThan(CurrencyGreaterThan uint64) *LookupAccountTransactions {
s.p.CurrencyGreaterThan = CurrencyGreaterThan
s.p.CurrencyGreaterThan = &CurrencyGreaterThan

return s
}
Expand Down
4 changes: 2 additions & 2 deletions client/v2/indexer/lookupAssetBalances.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type LookupAssetBalancesParams struct {
// CurrencyGreaterThan results should have an amount greater than this value.
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
CurrencyGreaterThan uint64 `url:"currency-greater-than,omitempty"`
CurrencyGreaterThan *uint64 `url:"currency-greater-than,omitempty"`

// CurrencyLessThan results should have an amount less than this value. MicroAlgos
// are the default currency unless an asset-id is provided, in which case the asset
Expand Down Expand Up @@ -48,7 +48,7 @@ type LookupAssetBalances struct {
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
func (s *LookupAssetBalances) CurrencyGreaterThan(CurrencyGreaterThan uint64) *LookupAssetBalances {
s.p.CurrencyGreaterThan = CurrencyGreaterThan
s.p.CurrencyGreaterThan = &CurrencyGreaterThan

return s
}
Expand Down
4 changes: 2 additions & 2 deletions client/v2/indexer/lookupAssetTransactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type LookupAssetTransactionsParams struct {
// CurrencyGreaterThan results should have an amount greater than this value.
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
CurrencyGreaterThan uint64 `url:"currency-greater-than,omitempty"`
CurrencyGreaterThan *uint64 `url:"currency-greater-than,omitempty"`

// CurrencyLessThan results should have an amount less than this value. MicroAlgos
// are the default currency unless an asset-id is provided, in which case the asset
Expand Down Expand Up @@ -142,7 +142,7 @@ func (s *LookupAssetTransactions) BeforeTime(BeforeTime time.Time) *LookupAssetT
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
func (s *LookupAssetTransactions) CurrencyGreaterThan(CurrencyGreaterThan uint64) *LookupAssetTransactions {
s.p.CurrencyGreaterThan = CurrencyGreaterThan
s.p.CurrencyGreaterThan = &CurrencyGreaterThan

return s
}
Expand Down
4 changes: 2 additions & 2 deletions client/v2/indexer/searchForAccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type SearchAccountsParams struct {
// CurrencyGreaterThan results should have an amount greater than this value.
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
CurrencyGreaterThan uint64 `url:"currency-greater-than,omitempty"`
CurrencyGreaterThan *uint64 `url:"currency-greater-than,omitempty"`

// CurrencyLessThan results should have an amount less than this value. MicroAlgos
// are the default currency unless an asset-id is provided, in which case the asset
Expand Down Expand Up @@ -88,7 +88,7 @@ func (s *SearchAccounts) AuthAddress(AuthAddress string) *SearchAccounts {
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
func (s *SearchAccounts) CurrencyGreaterThan(CurrencyGreaterThan uint64) *SearchAccounts {
s.p.CurrencyGreaterThan = CurrencyGreaterThan
s.p.CurrencyGreaterThan = &CurrencyGreaterThan

return s
}
Expand Down
4 changes: 2 additions & 2 deletions client/v2/indexer/searchForTransactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type SearchForTransactionsParams struct {
// CurrencyGreaterThan results should have an amount greater than this value.
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
CurrencyGreaterThan uint64 `url:"currency-greater-than,omitempty"`
CurrencyGreaterThan *uint64 `url:"currency-greater-than,omitempty"`

// CurrencyLessThan results should have an amount less than this value. MicroAlgos
// are the default currency unless an asset-id is provided, in which case the asset
Expand Down Expand Up @@ -160,7 +160,7 @@ func (s *SearchForTransactions) BeforeTime(BeforeTime time.Time) *SearchForTrans
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
func (s *SearchForTransactions) CurrencyGreaterThan(CurrencyGreaterThan uint64) *SearchForTransactions {
s.p.CurrencyGreaterThan = CurrencyGreaterThan
s.p.CurrencyGreaterThan = &CurrencyGreaterThan

return s
}
Expand Down

0 comments on commit 0865549

Please sign in to comment.