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

Refresh generated sources #320

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions client/v2/algod/algod.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ func (c *Client) TealCompile(source []byte) *TealCompile {
return &TealCompile{c: c, source: source}
}

func (c *Client) TealDisassemble(source []byte) *TealDisassemble {
return &TealDisassemble{c: c, source: source}
}

func (c *Client) TealDryrun(request models.DryrunRequest) *TealDryrun {
return &TealDryrun{c: c, request: request}
}
Expand Down
13 changes: 13 additions & 0 deletions client/v2/algod/getProof.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ type GetProofParams struct {

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

// Hashtype the type of hash function used to create the proof, must be one of:
// * sha512_256
// * sha256
Hashtype string `url:"hashtype,omitempty"`
}

// GetProof get a Merkle proof for a transaction in a block.
Expand All @@ -25,6 +30,14 @@ type GetProof struct {
p GetProofParams
}

// Hashtype the type of hash function used to create the proof, must be one of:
// * sha512_256
// * sha256
func (s *GetProof) Hashtype(Hashtype string) *GetProof {
s.p.Hashtype = Hashtype
return s
}

// Do performs the HTTP request
func (s *GetProof) Do(ctx context.Context, headers ...*common.Header) (response models.ProofResponse, err error) {
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/blocks/%v/transactions/%v/proof", s.round, s.txid), s.p, headers)
Expand Down
19 changes: 18 additions & 1 deletion client/v2/algod/tealCompile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,31 @@ import (
"github.com/algorand/go-algorand-sdk/client/v2/common/models"
)

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

// Sourcemap when set to `true`, returns the source map of the program as a JSON.
// Defaults to `false`.
Sourcemap bool `url:"sourcemap,omitempty"`
}

// TealCompile given TEAL source code in plain text, return base64 encoded program
// bytes and base32 SHA512_256 hash of program bytes (Address style). This endpoint
// is only enabled when a node's configureation file sets EnableDeveloperAPI to
// is only enabled when a node's configuration file sets EnableDeveloperAPI to
// true.
type TealCompile struct {
c *Client

source []byte

p TealCompileParams
}

// Sourcemap when set to `true`, returns the source map of the program as a JSON.
// Defaults to `false`.
func (s *TealCompile) Sourcemap(Sourcemap bool) *TealCompile {
s.p.Sourcemap = Sourcemap
return s
}

// Do performs the HTTP request
Expand Down
23 changes: 23 additions & 0 deletions client/v2/algod/tealDisassemble.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package algod

import (
"context"

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

// TealDisassemble given the program bytes, return the TEAL source code in plain
// text. This endpoint is only enabled when a node's configuration file sets
// EnableDeveloperAPI to true.
type TealDisassemble struct {
c *Client

source []byte
}

// Do performs the HTTP request
func (s *TealDisassemble) Do(ctx context.Context, headers ...*common.Header) (response models.DisassembleResponse, err error) {
err = s.c.get(ctx, &response, "/v2/teal/disassemble", nil, headers)
return
}
2 changes: 1 addition & 1 deletion client/v2/algod/tealDryrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

// TealDryrun executes TEAL program(s) in context and returns debugging information
// about the execution. This endpoint is only enabled when a node's configureation
// about the execution. This endpoint is only enabled when a node's configuration
// file sets EnableDeveloperAPI to true.
type TealDryrun struct {
c *Client
Expand Down
5 changes: 5 additions & 0 deletions client/v2/common/models/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ type Account struct {
// Deleted whether or not this account is currently closed.
Deleted bool `json:"deleted,omitempty"`

// Hashtype the type of hash function used to create the proof, must be one of:
// * sha512_256
// * sha256
Hashtype string `json:"hashtype,omitempty"`

// Participation accountParticipation describes the parameters used by this account
// in consensus protocol.
Participation AccountParticipation `json:"participation,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions client/v2/common/models/compile_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ type CompileResponse struct {

// Result base64 encoded program bytes
Result string `json:"result"`

// Sourcemap jSON of the source map
Sourcemap *map[string]interface{} `json:"sourcemap,omitempty"`
}
7 changes: 7 additions & 0 deletions client/v2/common/models/disassemble_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package models

// DisassembleResponse teal disassembly Result
type DisassembleResponse struct {
// Result disassembled Teal code
Result string `json:"result"`
}
2 changes: 1 addition & 1 deletion client/v2/common/models/proof_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package models
// ProofResponse proof of transaction in a block.
type ProofResponse struct {
// Hashtype the type of hash function used to create the proof, must be one of:
// * sumhash
// * sha512_256
// * sha256
Hashtype string `json:"hashtype,omitempty"`

// Idx index of the transaction in the block's payset.
Expand Down
3 changes: 2 additions & 1 deletion client/v2/indexer/lookupAccountTransactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ type LookupAccountTransactionsParams struct {
TXID string `url:"txid,omitempty"`
}

// LookupAccountTransactions lookup account transactions.
// LookupAccountTransactions lookup account transactions. Transactions are returned
// newest to oldest.
type LookupAccountTransactions struct {
c *Client

Expand Down
3 changes: 2 additions & 1 deletion client/v2/indexer/lookupAssetTransactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ type LookupAssetTransactionsParams struct {
TXID string `url:"txid,omitempty"`
}

// LookupAssetTransactions lookup transactions for an asset.
// LookupAssetTransactions lookup transactions for an asset. Transactions are
// returned oldest to newest.
type LookupAssetTransactions struct {
c *Client

Expand Down
4 changes: 3 additions & 1 deletion client/v2/indexer/searchForTransactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ type SearchForTransactionsParams struct {
TXID string `url:"txid,omitempty"`
}

// SearchForTransactions search for transactions.
// SearchForTransactions search for transactions. Transactions are returned oldest
// to newest unless the address parameter is used, in which case results are
// returned newest to oldest.
type SearchForTransactions struct {
c *Client

Expand Down