mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
1777 lines
45 KiB
YAML
1777 lines
45 KiB
YAML
openapi: 3.0.3
|
|
info:
|
|
title: Ledger API
|
|
contact: {}
|
|
version: "LEDGER_VERSION"
|
|
|
|
paths:
|
|
/v2/_info:
|
|
get:
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
summary: Show server information
|
|
operationId: v2GetInfo
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ConfigInfoResponse'
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2:
|
|
get:
|
|
summary: List ledgers
|
|
operationId: v2ListLedgers
|
|
parameters:
|
|
- name: pageSize
|
|
in: query
|
|
description: |
|
|
The maximum number of results to return per page.
|
|
example: 100
|
|
schema:
|
|
type: integer
|
|
format: int64
|
|
minimum: 1
|
|
maximum: 1000
|
|
- name: cursor
|
|
in: query
|
|
description: |
|
|
Parameter used in pagination requests. Maximum page size is set to 15.
|
|
Set to the value of next for the next page of results.
|
|
Set to the value of previous for the previous page of results.
|
|
No other parameters can be set when this parameter is set.
|
|
schema:
|
|
type: string
|
|
example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2LedgerListResponse'
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}:
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
|
|
get:
|
|
summary: Get a ledger
|
|
operationId: v2GetLedger
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2Ledger'
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
post:
|
|
summary: Create a ledger
|
|
operationId: v2CreateLedger
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2CreateLedgerRequest'
|
|
responses:
|
|
"204":
|
|
description: OK
|
|
|
|
"400":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/_info:
|
|
get:
|
|
summary: Get information about a ledger
|
|
operationId: v2GetLedgerInfo
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2LedgerInfoResponse'
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/_bulk:
|
|
post:
|
|
x-speakeasy-errors:
|
|
override: true
|
|
statusCodes: # Defines status codes to handle as errors for all operations
|
|
- 5XX
|
|
summary: Bulk request
|
|
operationId: v2CreateBulk
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2Bulk'
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2BulkResponse'
|
|
"400":
|
|
description: Failure
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2BulkResponse'
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/accounts:
|
|
head:
|
|
summary: Count the accounts from a ledger
|
|
operationId: v2CountAccounts
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: pit
|
|
in: query
|
|
required: false
|
|
schema:
|
|
type: string
|
|
format: date-time
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
additionalProperties: true
|
|
responses:
|
|
"204":
|
|
description: OK
|
|
headers:
|
|
Count:
|
|
schema:
|
|
type: integer
|
|
format: bigint
|
|
minimum: 0
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
get:
|
|
summary: List accounts from a ledger
|
|
description: List accounts from a ledger, sorted by address in descending order.
|
|
operationId: v2ListAccounts
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: pageSize
|
|
in: query
|
|
description: |
|
|
The maximum number of results to return per page.
|
|
example: 100
|
|
schema:
|
|
type: integer
|
|
format: int64
|
|
minimum: 1
|
|
maximum: 1000
|
|
- name: cursor
|
|
in: query
|
|
description: |
|
|
Parameter used in pagination requests. Maximum page size is set to 15.
|
|
Set to the value of next for the next page of results.
|
|
Set to the value of previous for the previous page of results.
|
|
No other parameters can be set when this parameter is set.
|
|
schema:
|
|
type: string
|
|
example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==
|
|
- name: expand
|
|
in: query
|
|
schema:
|
|
type: string
|
|
items:
|
|
type: string
|
|
- name: pit
|
|
in: query
|
|
required: false
|
|
schema:
|
|
type: string
|
|
format: date-time
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
additionalProperties: true
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2AccountsCursorResponse'
|
|
|
|
"400":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/accounts/{address}:
|
|
get:
|
|
summary: Get account by its address
|
|
operationId: v2GetAccount
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: address
|
|
in: path
|
|
description: |
|
|
Exact address of the account. It must match the following regular expressions pattern:
|
|
```
|
|
^\w+(:\w+)*$
|
|
```
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: users:001
|
|
- name: expand
|
|
in: query
|
|
schema:
|
|
type: string
|
|
items:
|
|
type: string
|
|
- name: pit
|
|
in: query
|
|
required: false
|
|
schema:
|
|
type: string
|
|
format: date-time
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2AccountResponse'
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/accounts/{address}/metadata:
|
|
post:
|
|
summary: Add metadata to an account
|
|
operationId: v2AddMetadataToAccount
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: address
|
|
in: path
|
|
description: |
|
|
Exact address of the account. It must match the following regular expressions pattern:
|
|
```
|
|
^\w+(:\w+)*$
|
|
```
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: users:001
|
|
- name: dryRun
|
|
in: query
|
|
description: Set the dry run mode. Dry run mode doesn't add the logs to the database or publish a message to the message broker.
|
|
schema:
|
|
type: boolean
|
|
example: true
|
|
- name: Idempotency-Key
|
|
in: header
|
|
description: Use an idempotency key
|
|
schema:
|
|
type: string
|
|
requestBody:
|
|
description: metadata
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2Metadata'
|
|
required: true
|
|
responses:
|
|
"204":
|
|
description: No Content
|
|
content: {}
|
|
|
|
"400":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
"404":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/accounts/{address}/metadata/{key}:
|
|
delete:
|
|
description: Delete metadata by key
|
|
operationId: v2DeleteAccountMetadata
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
summary: Delete metadata by key
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: address
|
|
in: path
|
|
description: Account address
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: key
|
|
in: path
|
|
description: The key to remove.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: foo
|
|
responses:
|
|
2XX:
|
|
description: Key deleted
|
|
content: {}
|
|
|
|
/v2/{ledger}/stats:
|
|
get:
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
operationId: v2ReadStats
|
|
summary: Get statistics from a ledger
|
|
description: |
|
|
Get statistics from a ledger. (aggregate metrics on accounts and transactions)
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: name of the ledger
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2StatsResponse'
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/transactions:
|
|
head:
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
summary: Count the transactions from a ledger
|
|
operationId: v2CountTransactions
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: pit
|
|
in: query
|
|
required: false
|
|
schema:
|
|
type: string
|
|
format: date-time
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
additionalProperties: true
|
|
responses:
|
|
"204":
|
|
description: OK
|
|
headers:
|
|
Count:
|
|
schema:
|
|
type: integer
|
|
format: int64
|
|
minimum: 0
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
get:
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
summary: List transactions from a ledger
|
|
description: List transactions from a ledger, sorted by id in descending order.
|
|
operationId: v2ListTransactions
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: pageSize
|
|
in: query
|
|
description: |
|
|
The maximum number of results to return per page.
|
|
example: 100
|
|
schema:
|
|
type: integer
|
|
format: int64
|
|
minimum: 1
|
|
maximum: 1000
|
|
- name: cursor
|
|
in: query
|
|
description: |
|
|
Parameter used in pagination requests. Maximum page size is set to 15.
|
|
Set to the value of next for the next page of results.
|
|
Set to the value of previous for the previous page of results.
|
|
No other parameters can be set when this parameter is set.
|
|
schema:
|
|
type: string
|
|
example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==
|
|
- name: expand
|
|
in: query
|
|
schema:
|
|
type: string
|
|
items:
|
|
type: string
|
|
- name: pit
|
|
in: query
|
|
required: false
|
|
schema:
|
|
type: string
|
|
format: date-time
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
additionalProperties: true
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2TransactionsCursorResponse'
|
|
|
|
"404":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
"400":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
post:
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
summary: Create a new transaction to a ledger
|
|
operationId: v2CreateTransaction
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: dryRun
|
|
in: query
|
|
description: Set the dryRun mode. dry run mode doesn't add the logs to the database or publish a message to the message broker.
|
|
schema:
|
|
type: boolean
|
|
example: true
|
|
- name: Idempotency-Key
|
|
in: header
|
|
description: Use an idempotency key
|
|
schema:
|
|
type: string
|
|
requestBody:
|
|
required: true
|
|
description: >
|
|
The request body must contain at least one of the following objects:
|
|
- `postings`: suitable for simple transactions
|
|
- `script`: enabling more complex transactions with Numscript
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2PostTransaction'
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2CreateTransactionResponse'
|
|
"400":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/transactions/{id}:
|
|
get:
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
summary: Get transaction from a ledger by its ID
|
|
operationId: v2GetTransaction
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: id
|
|
in: path
|
|
description: Transaction ID.
|
|
required: true
|
|
schema:
|
|
type: integer
|
|
format: bigint
|
|
minimum: 0
|
|
example: 1234
|
|
- name: expand
|
|
in: query
|
|
schema:
|
|
type: string
|
|
items:
|
|
type: string
|
|
- name: pit
|
|
in: query
|
|
required: false
|
|
schema:
|
|
type: string
|
|
format: date-time
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2GetTransactionResponse'
|
|
|
|
"404":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/transactions/{id}/metadata:
|
|
post:
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
summary: Set the metadata of a transaction by its ID
|
|
operationId: v2AddMetadataOnTransaction
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: id
|
|
in: path
|
|
description: Transaction ID.
|
|
required: true
|
|
schema:
|
|
type: integer
|
|
format: bigint
|
|
minimum: 0
|
|
example: 1234
|
|
- name: dryRun
|
|
in: query
|
|
description: Set the dryRun mode. Dry run mode doesn't add the logs to the database or publish a message to the message broker.
|
|
schema:
|
|
type: boolean
|
|
example: true
|
|
- name: Idempotency-Key
|
|
in: header
|
|
description: Use an idempotency key
|
|
schema:
|
|
type: string
|
|
requestBody:
|
|
description: metadata
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2Metadata'
|
|
responses:
|
|
"204":
|
|
description: No Content
|
|
content: {}
|
|
|
|
"400":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
"404":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/transactions/{id}/metadata/{key}:
|
|
delete:
|
|
description: Delete metadata by key
|
|
operationId: v2DeleteTransactionMetadata
|
|
summary: Delete metadata by key
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: id
|
|
in: path
|
|
description: Transaction ID.
|
|
required: true
|
|
schema:
|
|
type: integer
|
|
format: bigint
|
|
minimum: 0
|
|
example: 1234
|
|
- name: key
|
|
in: path
|
|
required: true
|
|
description: The key to remove.
|
|
schema:
|
|
type: string
|
|
example: foo
|
|
responses:
|
|
2XX:
|
|
description: Key deleted
|
|
content: { }
|
|
|
|
"400":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/transactions/{id}/revert:
|
|
post:
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
operationId: v2RevertTransaction
|
|
summary: Revert a ledger transaction by its ID
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: id
|
|
in: path
|
|
description: Transaction ID.
|
|
required: true
|
|
schema:
|
|
type: integer
|
|
format: bigint
|
|
minimum: 0
|
|
example: 1234
|
|
- name: force
|
|
in: query
|
|
description: Force revert
|
|
required: false
|
|
schema:
|
|
type: boolean
|
|
responses:
|
|
"201":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2RevertTransactionResponse'
|
|
|
|
"400":
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
/v2/{ledger}/aggregate/balances:
|
|
get:
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
summary: Get the aggregated balances from selected accounts
|
|
operationId: v2GetBalancesAggregated
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: pit
|
|
in: query
|
|
required: false
|
|
schema:
|
|
type: string
|
|
format: date-time
|
|
- name: use_insertion_date
|
|
in: query
|
|
description: Use insertion date instead of effective date
|
|
required: false
|
|
schema:
|
|
type: boolean
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
additionalProperties: true
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2AggregateBalancesResponse'
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
/v2/{ledger}/logs:
|
|
get:
|
|
tags:
|
|
- Ledger
|
|
x-speakeasy-group: ledger
|
|
summary: List the logs from a ledger
|
|
description: List the logs from a ledger, sorted by ID in descending order.
|
|
operationId: v2ListLogs
|
|
parameters:
|
|
- name: ledger
|
|
in: path
|
|
description: Name of the ledger.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
example: ledger001
|
|
- name: pageSize
|
|
in: query
|
|
description: |
|
|
The maximum number of results to return per page.
|
|
example: 100
|
|
schema:
|
|
type: integer
|
|
format: int64
|
|
minimum: 1
|
|
maximum: 1000
|
|
- name: cursor
|
|
in: query
|
|
description: |
|
|
Parameter used in pagination requests. Maximum page size is set to 15.
|
|
Set to the value of next for the next page of results.
|
|
Set to the value of previous for the previous page of results.
|
|
No other parameters can be set when this parameter is set.
|
|
schema:
|
|
type: string
|
|
example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==
|
|
- name: pit
|
|
in: query
|
|
required: false
|
|
schema:
|
|
type: string
|
|
format: date-time
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
additionalProperties: true
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2LogsCursorResponse'
|
|
default:
|
|
description: Error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/V2ErrorResponse'
|
|
|
|
components:
|
|
schemas:
|
|
V2AccountsCursorResponse:
|
|
type: object
|
|
required:
|
|
- cursor
|
|
properties:
|
|
cursor:
|
|
type: object
|
|
required:
|
|
- pageSize
|
|
- hasMore
|
|
- data
|
|
properties:
|
|
pageSize:
|
|
type: integer
|
|
format: int64
|
|
minimum: 1
|
|
maximum: 1000
|
|
example: 15
|
|
hasMore:
|
|
type: boolean
|
|
example: false
|
|
previous:
|
|
type: string
|
|
example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol="
|
|
next:
|
|
type: string
|
|
example: ""
|
|
data:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/V2Account'
|
|
|
|
V2BalancesCursorResponse:
|
|
type: object
|
|
required:
|
|
- cursor
|
|
properties:
|
|
cursor:
|
|
type: object
|
|
required:
|
|
- pageSize
|
|
- hasMore
|
|
- data
|
|
properties:
|
|
pageSize:
|
|
type: integer
|
|
format: int64
|
|
minimum: 1
|
|
maximum: 1000
|
|
example: 15
|
|
hasMore:
|
|
type: boolean
|
|
example: false
|
|
previous:
|
|
type: string
|
|
example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol="
|
|
next:
|
|
type: string
|
|
example: ""
|
|
data:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/V2AccountsBalances'
|
|
|
|
V2TransactionsCursorResponse:
|
|
type: object
|
|
required:
|
|
- cursor
|
|
properties:
|
|
cursor:
|
|
type: object
|
|
required:
|
|
- pageSize
|
|
- hasMore
|
|
- data
|
|
properties:
|
|
pageSize:
|
|
type: integer
|
|
format: int64
|
|
minimum: 1
|
|
maximum: 1000
|
|
example: 15
|
|
hasMore:
|
|
type: boolean
|
|
example: false
|
|
previous:
|
|
type: string
|
|
example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol="
|
|
next:
|
|
type: string
|
|
example: ""
|
|
data:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/V2ExpandedTransaction'
|
|
|
|
V2LogsCursorResponse:
|
|
type: object
|
|
required:
|
|
- cursor
|
|
properties:
|
|
cursor:
|
|
type: object
|
|
required:
|
|
- pageSize
|
|
- hasMore
|
|
- data
|
|
properties:
|
|
pageSize:
|
|
type: integer
|
|
format: int64
|
|
minimum: 1
|
|
maximum: 1000
|
|
example: 15
|
|
hasMore:
|
|
type: boolean
|
|
example: false
|
|
previous:
|
|
type: string
|
|
example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol="
|
|
next:
|
|
type: string
|
|
example: ""
|
|
data:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/V2Log'
|
|
|
|
V2AccountResponse:
|
|
type: object
|
|
required:
|
|
- data
|
|
properties:
|
|
data:
|
|
$ref: '#/components/schemas/V2Account'
|
|
|
|
V2AggregateBalancesResponse:
|
|
type: object
|
|
required:
|
|
- data
|
|
properties:
|
|
data:
|
|
$ref: '#/components/schemas/V2AssetsBalances'
|
|
|
|
V2Metadata:
|
|
type: object
|
|
additionalProperties:
|
|
type: string
|
|
example: { admin: "true" }
|
|
|
|
V2ConfigInfo:
|
|
type: object
|
|
properties:
|
|
server:
|
|
type: string
|
|
version:
|
|
type: string
|
|
required:
|
|
- config
|
|
- server
|
|
- version
|
|
|
|
V2Account:
|
|
type: object
|
|
required:
|
|
- address
|
|
- metadata
|
|
properties:
|
|
address:
|
|
type: string
|
|
example: users:001
|
|
metadata:
|
|
type: object
|
|
properties: {}
|
|
additionalProperties:
|
|
type: string
|
|
example: { admin: "true" }
|
|
volumes:
|
|
$ref: '#/components/schemas/V2Volumes'
|
|
effectiveVolumes:
|
|
$ref: '#/components/schemas/V2Volumes'
|
|
|
|
V2AccountsBalances:
|
|
type: object
|
|
additionalProperties:
|
|
$ref: '#/components/schemas/V2AssetsBalances'
|
|
example:
|
|
account1:
|
|
USD: 100
|
|
EUR: 23
|
|
account2:
|
|
CAD: 20
|
|
JPY: 21
|
|
|
|
V2AssetsBalances:
|
|
type: object
|
|
additionalProperties:
|
|
type: integer
|
|
format: bigint
|
|
example:
|
|
USD: 100
|
|
EUR: 12
|
|
|
|
V2Posting:
|
|
type: object
|
|
properties:
|
|
amount:
|
|
type: integer
|
|
format: bigint
|
|
minimum: 0
|
|
example: 100
|
|
asset:
|
|
type: string
|
|
example: COIN
|
|
destination:
|
|
type: string
|
|
example: users:002
|
|
source:
|
|
type: string
|
|
example: users:001
|
|
required:
|
|
- amount
|
|
- asset
|
|
- destination
|
|
- source
|
|
|
|
V2Script:
|
|
type: object
|
|
properties:
|
|
plain:
|
|
type: string
|
|
example: "vars {\naccount $user\n}\nsend [COIN 10] (\n\tsource = @world\n\tdestination = $user\n)\n"
|
|
vars:
|
|
type: object
|
|
properties: {}
|
|
additionalProperties: true
|
|
example: {
|
|
"user": "users:042"
|
|
}
|
|
reference:
|
|
type: string
|
|
example: order_1234
|
|
description: Reference to attach to the generated transaction
|
|
metadata:
|
|
$ref: '#/components/schemas/V2Metadata'
|
|
required:
|
|
- plain
|
|
|
|
V2Transaction:
|
|
type: object
|
|
properties:
|
|
timestamp:
|
|
type: string
|
|
format: date-time
|
|
postings:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/V2Posting'
|
|
reference:
|
|
type: string
|
|
example: ref:001
|
|
metadata:
|
|
$ref: '#/components/schemas/V2Metadata'
|
|
id:
|
|
type: integer
|
|
format: bigint
|
|
minimum: 0
|
|
reverted:
|
|
type: boolean
|
|
required:
|
|
- postings
|
|
- timestamp
|
|
- id
|
|
- metadata
|
|
- reverted
|
|
|
|
V2ExpandedTransaction:
|
|
allOf:
|
|
- $ref: '#/components/schemas/V2Transaction'
|
|
- type: object
|
|
properties:
|
|
preCommitVolumes:
|
|
$ref: '#/components/schemas/V2AggregatedVolumes'
|
|
postCommitVolumes:
|
|
$ref: '#/components/schemas/V2AggregatedVolumes'
|
|
|
|
V2PostTransaction:
|
|
type: object
|
|
required:
|
|
- metadata
|
|
properties:
|
|
timestamp:
|
|
type: string
|
|
format: date-time
|
|
postings:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/V2Posting'
|
|
script:
|
|
type: object
|
|
properties:
|
|
plain:
|
|
type: string
|
|
example: "vars {\naccount $user\n}\nsend [COIN 10] (\n\tsource = @world\n\tdestination = $user\n)\n"
|
|
vars:
|
|
type: object
|
|
properties: {}
|
|
additionalProperties: true
|
|
example: {
|
|
"user": "users:042"
|
|
}
|
|
required:
|
|
- plain
|
|
reference:
|
|
type: string
|
|
example: ref:001
|
|
metadata:
|
|
$ref: '#/components/schemas/V2Metadata'
|
|
|
|
V2Stats:
|
|
type: object
|
|
properties:
|
|
accounts:
|
|
type: integer
|
|
format: int64
|
|
minimum: 0
|
|
transactions:
|
|
type: integer
|
|
format: bigint
|
|
minimum: 0
|
|
required:
|
|
- accounts
|
|
- transactions
|
|
|
|
V2Log:
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: integer
|
|
format: bigint
|
|
minimum: 0
|
|
example: 1234
|
|
type:
|
|
type: string
|
|
enum:
|
|
- NEW_TRANSACTION
|
|
- SET_METADATA
|
|
- REVERTED_TRANSACTION
|
|
data:
|
|
type: object
|
|
properties: {}
|
|
additionalProperties: true
|
|
hash:
|
|
type: string
|
|
example: "9ee060170400f556b7e1575cb13f9db004f150a08355c7431c62bc639166431e"
|
|
date:
|
|
type: string
|
|
format: date-time
|
|
required:
|
|
- id
|
|
- type
|
|
- data
|
|
- hash
|
|
- date
|
|
|
|
V2CreateTransactionResponse:
|
|
properties:
|
|
data:
|
|
$ref: '#/components/schemas/V2Transaction'
|
|
type: object
|
|
required:
|
|
- data
|
|
|
|
V2RevertTransactionResponse:
|
|
$ref: '#/components/schemas/V2CreateTransactionResponse'
|
|
|
|
V2GetTransactionResponse:
|
|
properties:
|
|
data:
|
|
$ref: '#/components/schemas/V2ExpandedTransaction'
|
|
type: object
|
|
required:
|
|
- data
|
|
|
|
V2StatsResponse:
|
|
properties:
|
|
data:
|
|
$ref: '#/components/schemas/V2Stats'
|
|
type: object
|
|
required:
|
|
- data
|
|
|
|
V2ConfigInfoResponse:
|
|
$ref: '#/components/schemas/V2ConfigInfo'
|
|
|
|
V2Volume:
|
|
type: object
|
|
properties:
|
|
input:
|
|
type: integer
|
|
format: bigint
|
|
output:
|
|
type: integer
|
|
format: bigint
|
|
balance:
|
|
type: integer
|
|
format: bigint
|
|
required:
|
|
- input
|
|
- output
|
|
example:
|
|
input: 100
|
|
output: 20
|
|
balance: 80
|
|
|
|
V2Volumes:
|
|
type: object
|
|
additionalProperties:
|
|
$ref: '#/components/schemas/V2Volume'
|
|
example:
|
|
USD:
|
|
input: 100
|
|
output: 10
|
|
balance: 90
|
|
EUR:
|
|
input: 100
|
|
output: 10
|
|
balance: 90
|
|
|
|
V2AggregatedVolumes:
|
|
type: object
|
|
additionalProperties:
|
|
$ref: '#/components/schemas/V2Volumes'
|
|
example:
|
|
"orders:1":
|
|
"USD":
|
|
input: 100
|
|
output: 10
|
|
balance: 90
|
|
"orders:2":
|
|
"USD":
|
|
input: 100
|
|
output: 10
|
|
balance: 90
|
|
|
|
V2ErrorResponse:
|
|
type: object
|
|
required:
|
|
- errorCode
|
|
- errorMessage
|
|
properties:
|
|
errorCode:
|
|
$ref: '#/components/schemas/V2ErrorsEnum'
|
|
errorMessage:
|
|
type: string
|
|
example: "[VALIDATION] invalid 'cursor' query param"
|
|
details:
|
|
type: string
|
|
example: "https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9"
|
|
|
|
V2ErrorsEnum:
|
|
type: string
|
|
enum:
|
|
- INTERNAL
|
|
- INSUFFICIENT_FUND
|
|
- VALIDATION
|
|
- CONFLICT
|
|
- COMPILATION_FAILED
|
|
- METADATA_OVERRIDE
|
|
- NOT_FOUND
|
|
- REVERT_OCCURRING
|
|
- ALREADY_REVERT
|
|
- NO_POSTINGS
|
|
example: VALIDATION
|
|
|
|
V2LedgerInfoResponse:
|
|
properties:
|
|
data:
|
|
$ref: '#/components/schemas/V2LedgerInfo'
|
|
|
|
V2LedgerInfo:
|
|
type: object
|
|
properties:
|
|
name:
|
|
type: string
|
|
example: ledger001
|
|
storage:
|
|
type: object
|
|
properties:
|
|
migrations:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/V2MigrationInfo'
|
|
|
|
V2MigrationInfo:
|
|
type: object
|
|
properties:
|
|
version:
|
|
type: integer
|
|
format: int64
|
|
minimum: 0
|
|
example: 11
|
|
name:
|
|
type: string
|
|
example: migrations:001
|
|
date:
|
|
type: string
|
|
format: date-time
|
|
state:
|
|
type: string
|
|
enum:
|
|
- "TO DO"
|
|
- "DONE"
|
|
|
|
V2Bulk:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/V2BulkElement'
|
|
|
|
V2BaseBulkElement:
|
|
type: object
|
|
required:
|
|
- action
|
|
properties:
|
|
action:
|
|
type: string
|
|
ik:
|
|
type: string
|
|
|
|
V2BulkElement:
|
|
type: object
|
|
oneOf:
|
|
- $ref: '#/components/schemas/V2BulkElementCreateTransaction'
|
|
- $ref: '#/components/schemas/V2BulkElementAddMetadata'
|
|
- $ref: '#/components/schemas/V2BulkElementRevertTransaction'
|
|
- $ref: '#/components/schemas/V2BulkElementDeleteMetadata'
|
|
discriminator:
|
|
propertyName: action
|
|
mapping:
|
|
CREATE_TRANSACTION: '#/components/schemas/V2BulkElementCreateTransaction'
|
|
ADD_METADATA: '#/components/schemas/V2BulkElementAddMetadata'
|
|
REVERT_TRANSACTION: '#/components/schemas/V2BulkElementRevertTransaction'
|
|
DELETE_METADATA: '#/components/schemas/V2BulkElementDeleteMetadata'
|
|
|
|
V2BulkElementCreateTransaction:
|
|
type: object
|
|
allOf:
|
|
- $ref: '#/components/schemas/V2BaseBulkElement'
|
|
- type: object
|
|
properties:
|
|
data:
|
|
$ref: '#/components/schemas/V2PostTransaction'
|
|
|
|
V2TargetId:
|
|
oneOf:
|
|
- type: string
|
|
- type: integer
|
|
format: bigint
|
|
|
|
V2TargetType:
|
|
type: string
|
|
enum:
|
|
- TRANSACTION
|
|
- ACCOUNT
|
|
|
|
V2BulkElementAddMetadata:
|
|
type: object
|
|
allOf:
|
|
- $ref: '#/components/schemas/V2BaseBulkElement'
|
|
- type: object
|
|
properties:
|
|
data:
|
|
type: object
|
|
properties:
|
|
targetId:
|
|
$ref: '#/components/schemas/V2TargetId'
|
|
targetType:
|
|
$ref: '#/components/schemas/V2TargetType'
|
|
metadata:
|
|
type: object
|
|
additionalProperties:
|
|
type: string
|
|
required:
|
|
- targetId
|
|
- targetType
|
|
- metadata
|
|
|
|
V2BulkElementRevertTransaction:
|
|
type: object
|
|
allOf:
|
|
- $ref: '#/components/schemas/V2BaseBulkElement'
|
|
- type: object
|
|
properties:
|
|
data:
|
|
properties:
|
|
id:
|
|
type: integer
|
|
format: bigint
|
|
force:
|
|
type: boolean
|
|
required:
|
|
- id
|
|
|
|
V2BulkElementDeleteMetadata:
|
|
type: object
|
|
allOf:
|
|
- $ref: '#/components/schemas/V2BaseBulkElement'
|
|
- type: object
|
|
properties:
|
|
data:
|
|
properties:
|
|
targetId:
|
|
$ref: '#/components/schemas/V2TargetId'
|
|
targetType:
|
|
$ref: '#/components/schemas/V2TargetType'
|
|
key:
|
|
type: string
|
|
required:
|
|
- targetId
|
|
- targetType
|
|
- key
|
|
|
|
V2BulkResponse:
|
|
properties:
|
|
data:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/V2BulkElementResult'
|
|
type: object
|
|
required:
|
|
- data
|
|
|
|
V2BulkElementResult:
|
|
type: object
|
|
oneOf:
|
|
- $ref: '#/components/schemas/V2BulkElementResultCreateTransaction'
|
|
- $ref: '#/components/schemas/V2BulkElementResultAddMetadata'
|
|
- $ref: '#/components/schemas/V2BulkElementResultRevertTransaction'
|
|
- $ref: '#/components/schemas/V2BulkElementResultDeleteMetadata'
|
|
- $ref: '#/components/schemas/V2BulkElementResultError'
|
|
discriminator:
|
|
propertyName: responseType
|
|
mapping:
|
|
CREATE_TRANSACTION: '#/components/schemas/V2BulkElementResultCreateTransaction'
|
|
ADD_METADATA: '#/components/schemas/V2BulkElementResultAddMetadata'
|
|
REVERT_TRANSACTION: '#/components/schemas/V2BulkElementResultRevertTransaction'
|
|
DELETE_METADATA: '#/components/schemas/V2BulkElementResultDeleteMetadata'
|
|
ERROR: '#/components/schemas/V2BulkElementResultError'
|
|
|
|
V2BaseBulkElementResult:
|
|
type: object
|
|
properties:
|
|
responseType:
|
|
type: string
|
|
required:
|
|
- responseType
|
|
|
|
V2BulkElementResultCreateTransaction:
|
|
allOf:
|
|
- $ref: '#/components/schemas/V2BaseBulkElementResult'
|
|
- type: object
|
|
properties:
|
|
data:
|
|
$ref: '#/components/schemas/V2Transaction'
|
|
required:
|
|
- data
|
|
|
|
V2BulkElementResultAddMetadata:
|
|
allOf:
|
|
- $ref: '#/components/schemas/V2BaseBulkElementResult'
|
|
|
|
V2BulkElementResultRevertTransaction:
|
|
allOf:
|
|
- $ref: '#/components/schemas/V2BaseBulkElementResult'
|
|
- type: object
|
|
properties:
|
|
data:
|
|
$ref: '#/components/schemas/V2Transaction'
|
|
required:
|
|
- data
|
|
|
|
V2BulkElementResultDeleteMetadata:
|
|
allOf:
|
|
- $ref: '#/components/schemas/V2BaseBulkElementResult'
|
|
|
|
V2BulkElementResultError:
|
|
allOf:
|
|
- $ref: '#/components/schemas/V2BaseBulkElementResult'
|
|
- type: object
|
|
properties:
|
|
errorCode:
|
|
type: string
|
|
errorDescription:
|
|
type: string
|
|
errorDetails:
|
|
type: string
|
|
required:
|
|
- errorCode
|
|
- errorDescription
|
|
|
|
V2CreateLedgerRequest:
|
|
type: object
|
|
properties:
|
|
bucket:
|
|
type: string
|
|
|
|
V2Ledger:
|
|
type: object
|
|
properties:
|
|
name:
|
|
type: string
|
|
addedAt:
|
|
type: string
|
|
format: date-time
|
|
bucket:
|
|
type: string
|
|
required:
|
|
- name
|
|
- addedAt
|
|
- bucket
|
|
|
|
V2LedgerListResponse:
|
|
type: object
|
|
required:
|
|
- cursor
|
|
properties:
|
|
cursor:
|
|
type: object
|
|
required:
|
|
- pageSize
|
|
- hasMore
|
|
- data
|
|
properties:
|
|
pageSize:
|
|
type: integer
|
|
format: int64
|
|
minimum: 1
|
|
maximum: 1000
|
|
example: 15
|
|
hasMore:
|
|
type: boolean
|
|
example: false
|
|
previous:
|
|
type: string
|
|
example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol="
|
|
next:
|
|
type: string
|
|
example: ""
|
|
data:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/V2Ledger' |