-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13da850
commit e9c1b3d
Showing
24 changed files
with
1,142 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
go: circleci/[email protected].0 | ||
go: circleci/[email protected].1 | ||
|
||
workflows: | ||
circleci_build_and_test: | ||
|
@@ -10,7 +10,7 @@ workflows: | |
name: 'test_go_<< matrix.go_version >>' | ||
matrix: | ||
parameters: | ||
go_version: ['1.16', '1.17'] | ||
go_version: ['1.17'] | ||
|
||
jobs: | ||
test: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,6 @@ coverage.html | |
# Testing files | ||
*.feature | ||
temp | ||
|
||
# asdf | ||
.tool-versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package algod | ||
|
||
import ( | ||
"context" | ||
"encoding/base64" | ||
"fmt" | ||
|
||
"github.com/algorand/go-algorand-sdk/client/v2/common" | ||
"github.com/algorand/go-algorand-sdk/client/v2/common/models" | ||
) | ||
|
||
// GetApplicationBoxByNameParams contains all of the query parameters for url serialization. | ||
type GetApplicationBoxByNameParams struct { | ||
|
||
// Name a box name, in the goal app call arg form 'encoding:value'. For ints, use | ||
// the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable | ||
// strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. | ||
Name string `url:"name,omitempty"` | ||
} | ||
|
||
// GetApplicationBoxByName given an application ID and box name, it returns the box | ||
// name and value (each base64 encoded). Box names must be in the goal app call arg | ||
// encoding form 'encoding:value'. For ints, use the form 'int:1234'. For raw | ||
// bytes, use the form 'b64:A=='. For printable strings, use the form 'str:hello'. | ||
// For addresses, use the form 'addr:XYZ...'. | ||
type GetApplicationBoxByName struct { | ||
c *Client | ||
|
||
applicationId uint64 | ||
|
||
p GetApplicationBoxByNameParams | ||
} | ||
|
||
// name a box name, in the goal app call arg form 'encoding:value'. For ints, use | ||
// the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable | ||
// strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. | ||
func (s *GetApplicationBoxByName) name(name []byte) *GetApplicationBoxByName { | ||
s.p.Name = "b64:" + base64.StdEncoding.EncodeToString(name) | ||
|
||
return s | ||
} | ||
|
||
// Do performs the HTTP request | ||
func (s *GetApplicationBoxByName) Do(ctx context.Context, headers ...*common.Header) (response models.Box, err error) { | ||
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/applications/%s/box", common.EscapeParams(s.applicationId)...), s.p, headers) | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package algod | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/algorand/go-algorand-sdk/client/v2/common" | ||
"github.com/algorand/go-algorand-sdk/client/v2/common/models" | ||
) | ||
|
||
// GetApplicationBoxesParams contains all of the query parameters for url serialization. | ||
type GetApplicationBoxesParams struct { | ||
|
||
// Max max number of box names to return. If max is not set, or max == 0, returns | ||
// all box-names. | ||
Max uint64 `url:"max,omitempty"` | ||
} | ||
|
||
// GetApplicationBoxes given an application ID, return all Box names. No particular | ||
// ordering is guaranteed. Request fails when client or server-side configured | ||
// limits prevent returning all Box names. | ||
type GetApplicationBoxes struct { | ||
c *Client | ||
|
||
applicationId uint64 | ||
|
||
p GetApplicationBoxesParams | ||
} | ||
|
||
// Max max number of box names to return. If max is not set, or max == 0, returns | ||
// all box-names. | ||
func (s *GetApplicationBoxes) Max(Max uint64) *GetApplicationBoxes { | ||
s.p.Max = Max | ||
|
||
return s | ||
} | ||
|
||
// Do performs the HTTP request | ||
func (s *GetApplicationBoxes) Do(ctx context.Context, headers ...*common.Header) (response models.BoxesResponse, err error) { | ||
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/applications/%s/boxes", common.EscapeParams(s.applicationId)...), s.p, headers) | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package models | ||
|
||
// Box box name and its content. | ||
type Box struct { | ||
// Name (name) box name, base64 encoded | ||
Name []byte `json:"name"` | ||
|
||
// Value (value) box value, base64 encoded. | ||
Value []byte `json:"value"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package models | ||
|
||
// BoxDescriptor box descriptor describes an app box without a value. | ||
type BoxDescriptor struct { | ||
// Name base64 encoded box name | ||
Name []byte `json:"name"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package models | ||
|
||
// BoxesResponse box names of an application | ||
type BoxesResponse struct { | ||
// ApplicationId (appidx) application index. | ||
ApplicationId uint64 `json:"application-id"` | ||
|
||
// Boxes | ||
Boxes []BoxDescriptor `json:"boxes"` | ||
|
||
// NextToken used for pagination, when making another request provide this token | ||
// with the next parameter. | ||
NextToken string `json:"next-token,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package indexer | ||
|
||
import ( | ||
"context" | ||
"encoding/base64" | ||
"fmt" | ||
|
||
"github.com/algorand/go-algorand-sdk/client/v2/common" | ||
"github.com/algorand/go-algorand-sdk/client/v2/common/models" | ||
) | ||
|
||
// LookupApplicationBoxByIDAndNameParams contains all of the query parameters for url serialization. | ||
type LookupApplicationBoxByIDAndNameParams struct { | ||
|
||
// Name a box name in goal-arg form 'encoding:value'. For ints, use the form | ||
// 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use | ||
// the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. | ||
Name string `url:"name,omitempty"` | ||
} | ||
|
||
// LookupApplicationBoxByIDAndName given an application ID and box name, returns | ||
// base64 encoded box name and value. Box names must be in the goal app call arg | ||
// form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, encode | ||
// base 64 and use 'b64' prefix as in 'b64:A=='. For printable strings, use the | ||
// form 'str:hello'. For addresses, use the form 'addr:XYZ...'. | ||
type LookupApplicationBoxByIDAndName struct { | ||
c *Client | ||
|
||
applicationId uint64 | ||
|
||
p LookupApplicationBoxByIDAndNameParams | ||
} | ||
|
||
// name a box name in goal-arg form 'encoding:value'. For ints, use the form | ||
// 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use | ||
// the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. | ||
func (s *LookupApplicationBoxByIDAndName) name(name []byte) *LookupApplicationBoxByIDAndName { | ||
s.p.Name = "b64:" + base64.StdEncoding.EncodeToString(name) | ||
|
||
return s | ||
} | ||
|
||
// Do performs the HTTP request | ||
func (s *LookupApplicationBoxByIDAndName) Do(ctx context.Context, headers ...*common.Header) (response models.Box, err error) { | ||
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/applications/%s/box", common.EscapeParams(s.applicationId)...), s.p, headers) | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package indexer | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/algorand/go-algorand-sdk/client/v2/common" | ||
"github.com/algorand/go-algorand-sdk/client/v2/common/models" | ||
) | ||
|
||
// SearchForApplicationBoxesParams contains all of the query parameters for url serialization. | ||
type SearchForApplicationBoxesParams struct { | ||
|
||
// 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"` | ||
} | ||
|
||
// SearchForApplicationBoxes given an application ID, returns the box names of that | ||
// application sorted lexicographically. | ||
type SearchForApplicationBoxes struct { | ||
c *Client | ||
|
||
applicationId uint64 | ||
|
||
p SearchForApplicationBoxesParams | ||
} | ||
|
||
// Limit maximum number of results to return. There could be additional pages even | ||
// if the limit is not reached. | ||
func (s *SearchForApplicationBoxes) Limit(Limit uint64) *SearchForApplicationBoxes { | ||
s.p.Limit = Limit | ||
|
||
return s | ||
} | ||
|
||
// Next the next page of results. Use the next token provided by the previous | ||
// results. | ||
func (s *SearchForApplicationBoxes) Next(Next string) *SearchForApplicationBoxes { | ||
s.p.Next = Next | ||
|
||
return s | ||
} | ||
|
||
// Do performs the HTTP request | ||
func (s *SearchForApplicationBoxes) Do(ctx context.Context, headers ...*common.Header) (response models.BoxesResponse, err error) { | ||
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/applications/%s/boxes", common.EscapeParams(s.applicationId)...), s.p, headers) | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.