Skip to content
Closed
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
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,6 @@ generate: deps

msgp: $(patsubst %,%/msgp_gen.go,$(MSGP_GENERATE))

api:
make -C daemon/algod/api

logic:
make -C data/transactions/logic


%/msgp_gen.go: deps ALWAYS
@set +e; \
printf "msgp: $(@D)..."; \
Expand Down
3 changes: 2 additions & 1 deletion cmd/goal/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@
}

printAccountAssetsInformation(accountAddress, response)

},
}
var infoCmd = &cobra.Command{
Expand Down Expand Up @@ -776,7 +777,7 @@
fmt.Printf("Account: %s\n", address)
fmt.Printf("Round: %d\n", response.Round)
if response.NextToken != nil {
fmt.Printf("NextToken (use with --next to retrieve more account assets): %s\n", *response.NextToken)
fmt.Printf("NextToken (to retrieve more account assets): %s\n", *response.NextToken)

Check warning on line 780 in cmd/goal/account.go

View check run for this annotation

Codecov / codecov/patch

cmd/goal/account.go#L780

Added line #L780 was not covered by tests
}
fmt.Printf("Assets:\n")
for _, asset := range *response.AssetHoldings {
Expand Down
53 changes: 19 additions & 34 deletions cmd/goal/box.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,11 @@
"bytes"
"strings"

"github.com/algorand/go-algorand/cmd/util/datadir"
"github.com/spf13/cobra"
)

var (
boxName string
// next uint64 // declared in account.go
// limit uint64 // declared in account.go
boxPrefix string
boxValues bool
)
var boxName string
var maxBoxes uint64

func init() {
appCmd.AddCommand(appBoxCmd)
Expand All @@ -43,10 +37,7 @@
appBoxInfoCmd.Flags().StringVarP(&boxName, "name", "n", "", "Application box name. Use the same form as app-arg to name the box.")
appBoxInfoCmd.MarkFlagRequired("name")

appBoxListCmd.Flags().StringVarP(&boxPrefix, "prefix", "p", "", "Return only boxes that begin with the supplied prefix.")
appBoxListCmd.Flags().StringVarP(&next, "next", "n", "", "The next-token returned from a previous call, used for pagination.")
appBoxListCmd.Flags().Uint64VarP(&limit, "limit", "l", 0, "The maximum number of boxes to list. 0 means no limit.")
appBoxListCmd.Flags().BoolVarP(&boxValues, "values", "v", false, "Request and display box values.")
appBoxListCmd.Flags().Uint64VarP(&maxBoxes, "max", "m", 0, "Maximum number of boxes to list. 0 means no limit.")
}

var appBoxCmd = &cobra.Command{
Expand Down Expand Up @@ -98,36 +89,30 @@

var appBoxListCmd = &cobra.Command{
Use: "list",
Short: "List application boxes belonging to an application",
Long: "List application boxes belonging to an application.\n" +
"Printable names and values are formatted as 'str:hello' otherwise 'b64:A=='.",
Short: "List all application boxes belonging to an application",
Long: "List all application boxes belonging to an application.\n" +
"For printable strings, the box name is formatted as 'str:hello'\n" +
"For everything else, the box name is formatted as 'b64:A=='. ",
Args: validateNoPosArgsFn,
Run: func(cmd *cobra.Command, args []string) {
dataDir := datadir.EnsureSingleDataDir()
client := ensureAlgodClient(dataDir)
_, client := getDataDirAndClient()

Check warning on line 98 in cmd/goal/box.go

View check run for this annotation

Codecov / codecov/patch

cmd/goal/box.go#L98

Added line #L98 was not covered by tests

response, err := client.ApplicationBoxes(appIdx, boxPrefix, &next, limit, boxValues)
// Get app boxes
boxesRes, err := client.ApplicationBoxes(appIdx, maxBoxes)

Check warning on line 101 in cmd/goal/box.go

View check run for this annotation

Codecov / codecov/patch

cmd/goal/box.go#L101

Added line #L101 was not covered by tests
if err != nil {
reportErrorf(errorRequestFail, err)
}
boxes := boxesRes.Boxes

Check warning on line 105 in cmd/goal/box.go

View check run for this annotation

Codecov / codecov/patch

cmd/goal/box.go#L105

Added line #L105 was not covered by tests

// Endpoint did not originally report the Round, so don't show it if it's 0
if response.Round != 0 {
reportInfof("Round: %d", response.Round)
}
// There will only be a next-token if there are more boxes to list
if response.NextToken != nil {
encoded := encodeBytesAsAppCallBytes([]byte(*response.NextToken))
reportInfof("NextToken (use with --next to retrieve more boxes): %s", encoded)
// Error if no boxes found
if len(boxes) == 0 {
reportErrorf("No boxes found for appid %d", appIdx)

Check warning on line 109 in cmd/goal/box.go

View check run for this annotation

Codecov / codecov/patch

cmd/goal/box.go#L108-L109

Added lines #L108 - L109 were not covered by tests
}
reportInfoln("Boxes:")
for _, descriptor := range response.Boxes {
name := encodeBytesAsAppCallBytes(descriptor.Name)
if boxValues {
reportInfof("%s : %s", name, encodeBytesAsAppCallBytes(descriptor.Value))
} else {
reportInfoln(name)
}

// Print app boxes
for _, descriptor := range boxes {
encodedName := encodeBytesAsAppCallBytes(descriptor.Name)
reportInfof("%s", encodedName)

Check warning on line 115 in cmd/goal/box.go

View check run for this annotation

Codecov / codecov/patch

cmd/goal/box.go#L113-L115

Added lines #L113 - L115 were not covered by tests
}
},
}
72 changes: 38 additions & 34 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2280,7 +2280,7 @@
},
"/v2/applications/{application-id}/boxes": {
"get": {
"description": "Given an application ID, return boxes in lexographical order by name. If the results must be truncated, a next-token is supplied to continue the request.",
"description": "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.",
"tags": [
"public",
"nonparticipating"
Expand All @@ -2291,7 +2291,7 @@
"schemes": [
"http"
],
"summary": "Get boxes for a given application.",
"summary": "Get all box names for a given application.",
"operationId": "GetApplicationBoxes",
"parameters": [
{
Expand All @@ -2303,27 +2303,9 @@
},
{
"type": "integer",
"description": "Maximum number of boxes to return. Server may impose a lower limit.",
"description": "Max number of box names to return. If max is not set, or max == 0, returns all box-names.",
"name": "max",
"in": "query"
},
{
"type": "string",
"description": "A box name prefix, 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": "prefix",
"in": "query"
},
{
"type": "string",
"description": "A box name, in the goal app call arg form 'encoding:value'. When provided, the returned boxes begin (lexographically) with the supplied name. Callers may implement pagination by reinvoking the endpoint with the token from a previous call's next-token.",
"name": "next",
"in": "query"
},
{
"type": "boolean",
"description": "If true, box values will be returned.",
"name": "values",
"in": "query"
}
],
"responses": {
Expand Down Expand Up @@ -4154,6 +4136,7 @@
"description": "Box name and its content.",
"type": "object",
"required": [
"round",
"name",
"value"
],
Expand All @@ -4163,12 +4146,26 @@
"type": "integer"
},
"name": {
"description": "The box name, base64 encoded",
"description": "\\[name\\] box name, base64 encoded",
"type": "string",
"format": "byte"
},
"value": {
"description": "The box value, base64 encoded.",
"description": "\\[value\\] box value, base64 encoded.",
"type": "string",
"format": "byte"
}
}
},
"BoxDescriptor": {
"description": "Box descriptor describes a Box.",
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"description": "Base64 encoded box name",
"type": "string",
"format": "byte"
}
Expand All @@ -4193,6 +4190,22 @@
}
}
},
"KvDelta": {
"description": "A single Delta containing the key, the previous value and the current value for a single round.",
"type": "object",
"properties": {
"key": {
"description": "The key, base64 encoded.",
"type": "string",
"format": "byte"
},
"value": {
"description": "The new value of the KV store entry, base64 encoded.",
"type": "string",
"format": "byte"
}
}
},
"Version": {
"description": "algod version information.",
"type": "object",
Expand Down Expand Up @@ -5600,26 +5613,17 @@
}
},
"BoxesResponse": {
"description": "Boxes of an application",
"description": "Box names of an application",
"schema": {
"type": "object",
"required": [
"round",
"boxes"
],
"properties": {
"round": {
"description": "The round for which this information is relevant.",
"type": "integer"
},
"next-token": {
"description": "Used for pagination, when making another request provide this token with the next parameter.",
"type": "string"
},
"boxes": {
"type": "array",
"items": {
"$ref": "#/definitions/Box"
"$ref": "#/definitions/BoxDescriptor"
}
}
}
Expand Down
Loading