BillingVibesWallet billing.vibes-wallet@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
billing
Visibility
public
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/billing/vibes-wallet.v1.json

billing.vibes-wallet@1: a person's own Vibes, answered by GET /api/v1/vibes/me (capability billing.vibes.read) to an app the person approved. credit is Vibes to spend; payable is Vibes the person received as a creator and may cash out under the payout rules (never into Balance); bits_per_usd is today's rate. Vibes are whole integers; this is not a Balance and carries no nano-USD.

Fields

FieldTypeRequiredDescriptionConstraints
subjectobjectyesThe person the app reads for (the approved delegation). Only a user, never an app or a service.
  • no other fields
subject.typeconstyes
  • = "user"
subject.idstringyes
  • pattern ^usr_[0-9A-HJKMNP-TV-Z]{26}$
currencyconstyes
  • = "vibes-bits"
creditintegeryesVibes to spend.
  • minimum 0
payableintegeryesVibes received as a creator, to cash out; never Balance.
  • minimum 0
bits_per_usdnumberyesToday's Vibes per USD rate, the same one a pack is priced with.

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: person
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "currency": "vibes-bits",
  "credit": 1250,
  "payable": 340,
  "bits_per_usd": 100
}
Rejected: app-subject
{
  "subject": {
    "type": "app",
    "id": "app_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "currency": "vibes-bits",
  "credit": 0,
  "payable": 0,
  "bits_per_usd": 100
}
Rejected: hidden-balance
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "currency": "vibes-bits",
  "credit": 1250,
  "payable": 0,
  "bits_per_usd": 100,
  "balance_nano_usd": "1"
}
Rejected: negative-credit
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "currency": "vibes-bits",
  "credit": -1,
  "payable": 0,
  "bits_per_usd": 100
}
Rejected: usd
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "currency": "usd-cents",
  "credit": 1250,
  "payable": 0,
  "bits_per_usd": 100
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('billing.vibes-wallet@1', value);   // { valid, errors: [{ path, message }] }