Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Align balances to intended usage (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebe-lew authored Mar 27, 2024
1 parent 0293eb0 commit 68c9c04
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 66 deletions.
50 changes: 18 additions & 32 deletions hosted/json-schemas/balance.schema.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://tbdex.dev/offering.schema.json",
"definitions": {
"Balance": {
"type": "object",
"additionalProperties": false,
"properties": {
"currencyCode": {
"type": "string",
"description": "ISO 3166 currency code string"
},
"available": {
"$ref": "definitions.json#/definitions/decimalString",
"description": "The amount available to be transacted with"
}
},
"required": ["currencyCode", "available"]
}
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://tbdex.dev/balance.schema.json",
"type": "object",
"properties": {
"additionalProperties": false,
"currencyCode": {
"type": "string",
"description": "ISO 3166 currency code string"
},
"type": "object",
"properties": {
"additionalProperties": false,
"balances": {
"type": "array",
"items": {
"$ref": "#/definitions/Balance"
}
}
},
"required": [
"balances"
]
}
"available": {
"$ref": "definitions.json#/definitions/decimalString",
"description": "The amount available to be transacted with"
}
},
"required": [
"currencyCode",
"available"
]
}
28 changes: 6 additions & 22 deletions specs/http-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,28 +450,12 @@ True
`GET /balances`

### Response
| Status | Body |
| ------------------ | ------------------------- |
| `200: OK. ` | `{ data: { Balance[] } }` |
| `400: Bad Request` | `{ errors: Error[] }` |
| `404: Not Found` | N/A |
| `403: Forbidden` | N/A |

#### Example

```json
{
"data": [
{
/** ISO 4217 currency code or widely adopted cryptocurrency code as string */
"currencyCode": "USD",
/** same format used to represent currency values across messages */
"available": "400.00",
}
]
}

```
| Status | Body |
| ------------------ | -------------------------------------- |
| `200: OK. ` | `{ data: Balance[] }` See [Balance spec](https://github.com/TBD54566975/tbdex/blob/main/specs/protocol/README.md#balance) for the full schema of a Balance resource|
| `400: Bad Request` | `{ errors: Error[] }` |
| `404: Not Found` | N/A |
| `403: Forbidden` | N/A |

# References
* JSON:API spec: https://jsonapi.org/format/
16 changes: 4 additions & 12 deletions specs/protocol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,18 +306,10 @@ A `Balance` is a protected resource used to communicate the amounts of each curr
"protocol": "1.0"
},
"data": {
"balances": [
{
/** ISO 4217 currency code or widely adopted cryptocurrency code as string */
"currencyCode": "USD",
/** same format used to represent currency values across messages */
"available": "400.00",
},
{
"currencyCode": "MXN",
"available": "100.00",
}
]
/** ISO 4217 currency code or widely adopted cryptocurrency code as string */
"currencyCode": "USD",
/** same format used to represent currency values across messages */
"available": "400.00",
},
"signature": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa2syc1QyZUtvQWdUUTdzWjY3YTdmRDMzR21jYzZ1UXdaYmlxeWF5Rk1hYkhHI3o2TWtrMnNUMmVLb0FnVFE3c1o2N2E3ZkQzM0dtY2M2dVF3WmJpcXlheUZNYWJIRyJ9..9EBTL3VcajsQzSNOm8GElhcwvYcFGaRp24FTwmC845RCF84Md-ZB-CxdCo7kEjzsAY8OaB55XFSH_8K9vedhAw"
}
Expand Down

0 comments on commit 68c9c04

Please sign in to comment.