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

bug-fix: include currency-greater-than param for 0 value #584

Merged
merged 4 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
}
4 changes: 3 additions & 1 deletion client/v2/algod/waitForBlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (
)

// StatusAfterBlock waits for a block to appear after round {round} and returns the
// node's status at the time.
// node's status at the time. There is a 1 minute timeout, when reached the current
// status is returned regardless of whether or not it is the round after the given
// round.
type StatusAfterBlock struct {
c *Client

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

// AvmValue represents an AVM value.
type AvmValue struct {
// Bytes bytes value.
Bytes []byte `json:"bytes,omitempty"`

// Type value type. Value `1` refers to **bytes**, value `2` refers to **uint64**
Type uint64 `json:"type"`

// Uint uint value.
Uint uint64 `json:"uint,omitempty"`
}
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"`
}
10 changes: 10 additions & 0 deletions client/v2/common/models/scratch_change.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package models

// ScratchChange a write operation into a scratch slot.
type ScratchChange struct {
// NewValue represents an AVM value.
NewValue AvmValue `json:"new-value"`

// Slot the scratch slot written.
Slot uint64 `json:"slot"`
}
8 changes: 8 additions & 0 deletions client/v2/common/models/simulate_trace_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ type SimulateTraceConfig struct {
// Enable a boolean option for opting in execution trace features simulation
// endpoint.
Enable bool `json:"enable,omitempty"`

// ScratchChange a boolean option enabling returning scratch slot changes together
// with execution trace during simulation.
ScratchChange bool `json:"scratch-change,omitempty"`

// StackChange a boolean option enabling returning stack changes together with
// execution trace during simulation.
StackChange bool `json:"stack-change,omitempty"`
}
9 changes: 9 additions & 0 deletions client/v2/common/models/simulation_opcode_trace_unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ type SimulationOpcodeTraceUnit struct {
// Pc the program counter of the current opcode being evaluated.
Pc uint64 `json:"pc"`

// ScratchChanges the writes into scratch slots.
ScratchChanges []ScratchChange `json:"scratch-changes,omitempty"`

// SpawnedInners the indexes of the traces for inner transactions spawned by this
// opcode, if any.
SpawnedInners []uint64 `json:"spawned-inners,omitempty"`

// StackAdditions the values added by this opcode to the stack.
StackAdditions []AvmValue `json:"stack-additions,omitempty"`

// StackPopCount the number of deleted stack values by this opcode.
StackPopCount uint64 `json:"stack-pop-count,omitempty"`
}
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
Loading