BillingCreditSandboxGrantResult billing.credit-sandbox-grant-result@1
Generated at from
openvibe-contracts v0.419.0 and
openvibe-sdk v0.161.0.
- Version
- 1.0.0
- Owner
- billing
- Visibility
- internal
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/billing/credit-sandbox-grant-result.v1.json
billing.credit-sandbox-grant-result@1: the grant and the balance after it.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
grant_id | string | yes |
| |
amount_nano_usd | string | yes | Integer nano-USD (1e-9 USD), stored as a string. |
|
balance_nano_usd | string | yes | Integer nano-USD (1e-9 USD), stored as a string. |
|
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: after-spend
{
"grant_id": "igr_01J8Z3Q4R5S6T7V8W9X0Y1Z2A1",
"amount_nano_usd": "5000000000",
"balance_nano_usd": "4999000000"
}Valid: full
{
"grant_id": "igr_01J8Z3Q4R5S6T7V8W9X0Y1Z2A1",
"amount_nano_usd": "5000000000",
"balance_nano_usd": "5000000000"
}Rejected: bad-id
{
"grant_id": "grant-1",
"amount_nano_usd": "5000000000",
"balance_nano_usd": "5000000000"
}Rejected: missing-balance
{
"grant_id": "igr_01J8Z3Q4R5S6T7V8W9X0Y1Z2A1",
"amount_nano_usd": "5000000000"
}Rejected: money-float
{
"grant_id": "igr_01J8Z3Q4R5S6T7V8W9X0Y1Z2A1",
"amount_nano_usd": "5000000000",
"balance_nano_usd": "1.5"
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('billing.credit-sandbox-grant-result@1', value); // { valid, errors: [{ path, message }] }