Skip to content
Merged
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
48 changes: 48 additions & 0 deletions openapi/access.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,43 @@ paths:
$ref: '#/components/responses/404NotFound'
'500':
$ref: '#/components/responses/500InternalServerError'
/accounts/{address}/balance:
get:
summary: Get account balance by Address and BlockHeight.
description: Get an account's balance by the provided address and block height.
tags:
- Accounts
parameters:
- name: address
in: path
schema:
$ref: '#/components/schemas/Address'
required: true
description: The address of the account.
- name: block_height
in: query
schema:
$ref: '#/components/schemas/BlockHeight'
required: false
description: The block height at which to query for the account details. "sealed" is used by default.
- $ref: '#/components/parameters/expandParam'
- $ref: '#/components/parameters/selectParam'
- $ref: '#/components/parameters/agreeingExecutorsCount'
- $ref: '#/components/parameters/requiredExecutorIds'
- $ref: '#/components/parameters/includeExecutorMetadata'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AccountBalance'
'400':
$ref: '#/components/responses/400BadRequest'
'404':
$ref: '#/components/responses/404NotFound'
'500':
$ref: '#/components/responses/500InternalServerError'
/scripts:
post:
summary: Execute a Cadence Script
Expand Down Expand Up @@ -829,6 +866,17 @@ components:
description: Flag indicating whether the key is active or not.
metadata:
$ref: '#/components/schemas/Metadata'
AccountBalance:
type: object
required:
- balance
properties:
balance:
type: string
format: uint64
description: Flow balance of the account.
metadata:
$ref: '#/components/schemas/Metadata'
SigningAlgorithm:
type: string
enum:
Expand Down
2 changes: 2 additions & 0 deletions openapi/go-client-generated/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ All URIs are relative to *https://rest-testnet.onflow.org/v1*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AccountsApi* | [**AccountsAddressBalanceGet**](docs/AccountsApi.md#accountsaddressbalanceget) | **Get** /accounts/{address}/balance | Get account balance by Address and BlockHeight.
*AccountsApi* | [**AccountsAddressGet**](docs/AccountsApi.md#accountsaddressget) | **Get** /accounts/{address} | Get an Account By Address
*AccountsApi* | [**AccountsAddressKeysIndexGet**](docs/AccountsApi.md#accountsaddresskeysindexget) | **Get** /accounts/{address}/keys/{index} | Get an individual Account Key By Address and Index
*BlocksApi* | [**BlocksGet**](docs/BlocksApi.md#blocksget) | **Get** /blocks | Gets Blocks by Height
Expand All @@ -41,6 +42,7 @@ Class | Method | HTTP request | Description
## Documentation For Models

- [Account](docs/Account.md)
- [AccountBalance](docs/AccountBalance.md)
- [AccountExpandable](docs/AccountExpandable.md)
- [AccountPublicKey](docs/AccountPublicKey.md)
- [AggregatedSignature](docs/AggregatedSignature.md)
Expand Down
127 changes: 127 additions & 0 deletions openapi/go-client-generated/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,114 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/Error"
/accounts/{address}/balance:
get:
tags:
- Accounts
summary: Get account balance by Address and BlockHeight.
description: Get an account's balance by the provided address and block height.
parameters:
- name: address
in: path
description: The address of the account.
required: true
style: simple
explode: false
schema:
$ref: "#/components/schemas/Address"
- name: block_height
in: query
description: The block height at which to query for the account details. "sealed"
is used by default.
required: false
style: form
explode: true
schema:
$ref: "#/components/schemas/BlockHeight"
- name: expand
in: query
description: A comma-separated list indicating which properties of the content
to expand.
required: false
style: form
explode: false
schema:
minItems: 1
uniqueItems: true
type: array
items:
type: string
- name: select
in: query
description: A comma-separated list indicating which properties of the content
to return.
required: false
style: form
explode: false
schema:
minItems: 1
uniqueItems: true
type: array
items:
type: string
- name: agreeing_executors_count
in: query
description: A minimum number of execution receipts for the execution result.
required: false
allowEmptyValue: false
style: form
explode: true
schema:
type: string
format: uint64
- name: required_executor_ids
in: query
description: "A set of execution node IDs, one of which must have produced\
\ the execution result."
required: false
style: form
explode: false
schema:
minItems: 1
uniqueItems: true
type: array
items:
$ref: "#/components/schemas/Identifier"
- name: include_executor_metadata
in: query
description: Specifies whether or not to include the executor metadata in
the response.
required: false
allowEmptyValue: false
style: form
explode: true
schema:
type: boolean
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/AccountBalance"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"404":
description: Not Found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"500":
description: Internal Server Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/scripts:
post:
tags:
Expand Down Expand Up @@ -1474,6 +1582,25 @@ components:
signing_algorithm: BLSBLS12381
revoked: true
hashing_algorithm: SHA2_256
AccountBalance:
required:
- balance
type: object
properties:
balance:
type: string
description: Flow balance of the account.
format: uint64
metadata:
$ref: "#/components/schemas/Metadata"
example:
metadata:
executor_metadata:
execution_result_id: null
executor_ids:
- null
- null
balance: balance
SigningAlgorithm:
type: string
enum:
Expand Down
150 changes: 150 additions & 0 deletions openapi/go-client-generated/api_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,156 @@ var (

type AccountsApiService service
/*
AccountsApiService Get account balance by Address and BlockHeight.
Get an account's balance by the provided address and block height.
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param address The address of the account.
* @param optional nil or *AccountsApiAccountsAddressBalanceGetOpts - Optional Parameters:
* @param "BlockHeight" (optional.Interface of BlockHeight) - The block height at which to query for the account details. \"sealed\" is used by default.
* @param "Expand" (optional.Interface of []string) - A comma-separated list indicating which properties of the content to expand.
* @param "Select_" (optional.Interface of []string) - A comma-separated list indicating which properties of the content to return.
* @param "AgreeingExecutorsCount" (optional.String) - A minimum number of execution receipts for the execution result.
* @param "RequiredExecutorIds" (optional.Interface of []string) - A set of execution node IDs, one of which must have produced the execution result.
* @param "IncludeExecutorMetadata" (optional.Bool) - Specifies whether or not to include the executor metadata in the response.
@return AccountBalance
*/

type AccountsApiAccountsAddressBalanceGetOpts struct {
BlockHeight optional.Interface
Expand optional.Interface
Select_ optional.Interface
AgreeingExecutorsCount optional.String
RequiredExecutorIds optional.Interface
IncludeExecutorMetadata optional.Bool
}

func (a *AccountsApiService) AccountsAddressBalanceGet(ctx context.Context, address string, localVarOptionals *AccountsApiAccountsAddressBalanceGetOpts) (AccountBalance, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue AccountBalance
)

// create path and map variables
localVarPath := a.client.cfg.BasePath + "/accounts/{address}/balance"
localVarPath = strings.Replace(localVarPath, "{"+"address"+"}", fmt.Sprintf("%v", address), -1)

localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}

if localVarOptionals != nil && localVarOptionals.BlockHeight.IsSet() {
localVarQueryParams.Add("block_height", parameterToString(localVarOptionals.BlockHeight.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Expand.IsSet() {
localVarQueryParams.Add("expand", parameterToString(localVarOptionals.Expand.Value(), "csv"))
}
if localVarOptionals != nil && localVarOptionals.Select_.IsSet() {
localVarQueryParams.Add("select", parameterToString(localVarOptionals.Select_.Value(), "csv"))
}
if localVarOptionals != nil && localVarOptionals.AgreeingExecutorsCount.IsSet() {
localVarQueryParams.Add("agreeing_executors_count", parameterToString(localVarOptionals.AgreeingExecutorsCount.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.RequiredExecutorIds.IsSet() {
localVarQueryParams.Add("required_executor_ids", parameterToString(localVarOptionals.RequiredExecutorIds.Value(), "csv"))
}
if localVarOptionals != nil && localVarOptionals.IncludeExecutorMetadata.IsSet() {
localVarQueryParams.Add("include_executor_metadata", parameterToString(localVarOptionals.IncludeExecutorMetadata.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}

// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}

// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}

// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}

localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}

if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}

if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v AccountBalance
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
if localVarHttpResponse.StatusCode == 400 {
var v ModelError
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
if localVarHttpResponse.StatusCode == 404 {
var v ModelError
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
if localVarHttpResponse.StatusCode == 500 {
var v ModelError
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}

return localVarReturnValue, localVarHttpResponse, nil
}
/*
AccountsApiService Get an Account By Address
Get an account data by provided address in latest \&quot;sealed\&quot; block or by provided block height.
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
Expand Down
10 changes: 10 additions & 0 deletions openapi/go-client-generated/docs/AccountBalance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# AccountBalance

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Balance** | **string** | Flow balance of the account. | [default to null]
**Metadata** | [***Metadata**](Metadata.md) | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Loading
Loading