-
Notifications
You must be signed in to change notification settings - Fork 105
Boxes: Add support for Boxes #341
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
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
87bbe39
Boxes: Support for Box array transaction field (#337)
michaeldiamant 3956391
Boxes: Query algod Box by application ID and Box name (#338)
michaeldiamant 475a670
Boxes: Add convenience methods for encoding Box names (#342)
michaeldiamant 69644b7
Boxes: Support GetApplicationBoxes (#344)
michaeldiamant 42ba3e3
Merge develop into feature/box-storage (#353)
algochoi b21b064
Enhancement: Merge `develop` to `feature/box-storage` (#384)
ahangsu 1e09eac
Merge branch 'develop' into feature/box-storage
ahangsu 7d154c4
Box support for Indexer endpoints (#355)
algochoi 6b2f7ba
boxes integration algod test
ahangsu 78ca163
Enhancement: Boxes Indexer Integration test (#391)
ahangsu 266621b
remove unnecessary @applications tag
ahangsu 64001fb
remove unnecessary func
ahangsu c5e5af8
refactoring in algodclientv2 test
ahangsu fab3e31
Re-run generator for boxes branch (#411)
jasonpaulos a042df9
Box storage improvements from review (#410)
jasonpaulos 15c411b
Merge branch 'develop' into feature/box-storage
jasonpaulos fef13bc
Remove newline
jasonpaulos 5e94270
Box storage merge develop (#425)
jasonpaulos e2ec98f
Merge branch 'box-storage-merge-develop' into feature/box-storage
jasonpaulos 5d2e5cf
Merge branch 'develop' into feature/box-storage
jasonpaulos 600e1df
Box storage: Improvements from generator (#417)
jasonpaulos 9ae6afa
Re-generate sources from upstream AVM branches
michaeldiamant 1236c6a
Merge branch 'develop' into update_master
michaeldiamant 906ec89
update circle go orb
87f2a33
don't test unsupported version 1.16 on circle
47ac940
Update .gitignore
tzaffi 4ca3bd3
Update .circleci/config.yml
tzaffi 86d287b
revert
9d69302
Merge pull request #429 from algorand/update_update_master
tzaffi 80e7f91
Revert SDK_TESTING_BRANCH to master
michaeldiamant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.