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

FieldTypeRequiredDescriptionConstraints
grant_idstringyes
  • pattern ^igr_[0-9A-HJKMNP-TV-Z]{26}$
amount_nano_usdstringyesInteger nano-USD (1e-9 USD), stored as a string.
  • pattern ^[0-9]{1,19}$
balance_nano_usdstringyesInteger nano-USD (1e-9 USD), stored as a string.
  • pattern ^[0-9]{1,19}$

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 }] }