NetworkCoinsReadResult network.coins-read-result@1
Generated at from
openvibe-contracts v0.79.0 and
openvibe-sdk v0.25.0.
- Version
- 1.0.0
- Owner
- network
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/network/coins-read-result.v1.json
network.coins-read-result@1: the answer of GET /internal/coins/stats on OpenVibe.Network (capability network.coins.read): site-wide OpenCoins totals for public stat displays — earned, spent, circulating and holders, the transaction count, and two rolling seven-day windows (recent.<metric>.w is this week, .pw the seven days before it) so a display can say whether the economy is speeding up. Counts only, never a named person's balance. The answer is held for a minute; a failure is { error }.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
earned | integer | yes |
| |
spent | integer | yes |
| |
circulating | integer | yes |
| |
holders | integer | yes |
| |
transactions | integer | yes |
| |
recent | object | yes |
| |
recent.earned | https://openvibe.network/contracts/network/coins-read-result.v1.json#/$defs/window | yes | ||
recent.spent | https://openvibe.network/contracts/network/coins-read-result.v1.json#/$defs/window | yes | ||
recent.holders | https://openvibe.network/contracts/network/coins-read-result.v1.json#/$defs/window | yes |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: totals
{
"earned": 128400,
"spent": 91200,
"circulating": 37200,
"holders": 1842,
"transactions": 44190,
"recent": {
"earned": {
"w": 6400,
"pw": 5900
},
"spent": {
"w": 4100,
"pw": 4300
},
"holders": {
"w": 210,
"pw": 198
}
}
}Rejected: no-recent
{
"earned": 128400,
"spent": 91200,
"circulating": 37200,
"holders": 1842,
"transactions": 44190
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('network.coins-read-result@1', value); // { valid, errors: [{ path, message }] }