-
Notifications
You must be signed in to change notification settings - Fork 97
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
Showing
46 changed files
with
1,257 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
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
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
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
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
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
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
Oops, something went wrong.