diff --git a/api/groups/urlParams.go b/api/groups/urlParams.go index 8ff9c5fa..1aa3c140 100644 --- a/api/groups/urlParams.go +++ b/api/groups/urlParams.go @@ -95,6 +95,11 @@ func parseAccountQueryOptions(c *gin.Context, address string) (common.AccountQue return common.AccountQueryOptions{}, err } + withKeys, err := parseBoolUrlParam(c, common.UrlParameterWithKeys) + if err != nil { + return common.AccountQueryOptions{}, err + } + if shardID.HasValue && address != SystemAccountAddressBech { return common.AccountQueryOptions{}, ErrForcedShardIDCannotBeProvided } @@ -107,6 +112,7 @@ func parseAccountQueryOptions(c *gin.Context, address string) (common.AccountQue BlockRootHash: blockRootHash, HintEpoch: hintEpoch, ForcedShardID: shardID, + WithKeys: withKeys, } return options, nil diff --git a/common/options.go b/common/options.go index 03d55272..b39df0f6 100644 --- a/common/options.go +++ b/common/options.go @@ -47,6 +47,8 @@ const ( UrlParameterTokensFilter = "tokens" // UrlParameterWithAlteredAccounts represents the name of an URL parameter UrlParameterWithAlteredAccounts = "withAlteredAccounts" + // UrlParameterWithKeys represents the name of an URL parameter + UrlParameterWithKeys = "withKeys" ) // BlockQueryOptions holds options for block queries @@ -112,6 +114,7 @@ type AccountQueryOptions struct { BlockHash []byte BlockRootHash []byte HintEpoch core.OptionalUint32 + WithKeys bool } // AreHistoricalCoordinatesSet returns true if historical block coordinates are set @@ -146,6 +149,9 @@ func BuildUrlWithAccountQueryOptions(path string, options AccountQueryOptions) s if options.HintEpoch.HasValue { query.Set(UrlParameterHintEpoch, strconv.Itoa(int(options.HintEpoch.Value))) } + if options.WithKeys { + query.Set(UrlParameterWithKeys, "true") + } u.RawQuery = query.Encode() return u.String() diff --git a/data/account.go b/data/account.go index 9bf4b8ce..93499b9b 100644 --- a/data/account.go +++ b/data/account.go @@ -15,16 +15,17 @@ type AccountsModel struct { // Account defines the data structure for an account type Account struct { - Address string `json:"address"` - Nonce uint64 `json:"nonce"` - Balance string `json:"balance"` - Username string `json:"username"` - Code string `json:"code"` - CodeHash []byte `json:"codeHash"` - RootHash []byte `json:"rootHash"` - CodeMetadata []byte `json:"codeMetadata"` - DeveloperReward string `json:"developerReward"` - OwnerAddress string `json:"ownerAddress"` + Address string `json:"address"` + Nonce uint64 `json:"nonce"` + Balance string `json:"balance"` + Username string `json:"username"` + Code string `json:"code"` + CodeHash []byte `json:"codeHash"` + RootHash []byte `json:"rootHash"` + CodeMetadata []byte `json:"codeMetadata"` + DeveloperReward string `json:"developerReward"` + OwnerAddress string `json:"ownerAddress"` + Pairs map[string]string `json:"pairs,omitempty"` } // ValidatorApiResponse represents the data which is fetched from each validator for returning it in API call