OECD leading indicator, China
by Fomo · 1 source · a report every 1 d
Signed by Oraqle from the provider’s APIQuantum-safeSLH-DSA + ed25519
Per call
$0.005
sold in packs
Smallest payment
$0.05
what Oraqle settles on chain
A report every
1 d
from 1 source
Recent reports
Measuring · 1 of 7 days
sent, measured by Oraqle
Calls, 30 d
0
Endpoint
GET /v1/feeds/fomo/oecd-cli-china/latest
Bought a pack on this feed? Your code spends it with one header. Make an API key, then use the first example below.
- One call
- $0.005, sold in packs
- Pack of 50
- $0.25, valid 30 days
- Pack of 500
- $2.50, valid 30 days
- History page
- 5 calls
- Pays
- 8Egyhy31Qw…MfCB44PW
API key
# For a pack you already bought. Make a key in the dashboard, under API keys. curl https://oraqle.tech/gw/v1/feeds/fomo/oecd-cli-china/latest \ -H "Authorization: Bearer <your API key>" # The calls left in your packs. curl https://oraqle.tech/gw/v1/packs \ -H "Authorization: Bearer <your API key>"
HTTP
# 1. Ask. The answer is 402 with the price, in the PAYMENT-REQUIRED header. curl -i https://oraqle.tech/gw/v1/feeds/fomo/oecd-cli-china/latest # 2. Partially sign the USDC transfer it describes (x402 exact on Solana), # then ask again. Oraqle's facilitator pays the network fee: no SOL needed. curl https://oraqle.tech/gw/v1/feeds/fomo/oecd-cli-china/latest \ -H "PAYMENT-SIGNATURE: <base64 payment payload>"
TypeScript
import {readFileSync} from 'node:fs'
import {Oraqle} from '@oraqle/sdk'
// A keypair file made for this buyer. It holds USDC and needs no SOL to pay.
const secretKey = Uint8Array.from(JSON.parse(readFileSync('buyer.json', 'utf8')))
const oraqle = new Oraqle({gatewayUrl: 'https://oraqle.tech/gw', secretKey, maxSpendUsdc: 5_000_000n})
const report = await oraqle.read('fomo/oecd-cli-china') // pays in USDC, or spends a pack, by itself
report.value // 4 decimals, a bigint
report.checks // eleven, all passed: both signatures, the signer and its keys, this feed, decimals, payload, ageTypeScript, with an API key
import {Oraqle} from '@oraqle/sdk'
// No wallet on the server: the key spends calls you bought ahead.
const oraqle = new Oraqle({gatewayUrl: 'https://oraqle.tech/gw', apiKey: process.env.ORAQLE_API_KEY})
const report = await oraqle.read('fomo/oecd-cli-china') // one call from your pack, nothing signed
report.value // 4 decimals, a bigint
report.callsLeft // what the pack still holdsSolana program (Anchor)
// Cargo.toml: oraqle = { git = "<the Oraqle repository>", features = ["cpi"] }
use anchor_lang::prelude::*;
use oraqle::cpi::accounts::VerifyReport;
use oraqle::program::Oraqle;
use oraqle::state::Report;
declare_id!("<your program id>");
/// OECD leading indicator, China: the Oraqle feed account this program trusts, and no other.
pub const FEED: Pubkey = pubkey!("Byeuqh9xVe3TqRGv5JJ3NA6UmGscY5whiWx3dMQ3GtxV");
#[program]
pub mod example {
use super::*;
/// The transaction carries Oraqle's ed25519 instruction (the report's
/// signature) immediately before this one.
pub fn settle(ctx: Context<Settle>, report: Report) -> Result<()> {
let verified = oraqle::cpi::verify_report(
CpiContext::new(
ctx.accounts.oraqle_program.key(),
VerifyReport {
feed: ctx.accounts.feed.to_account_info(),
instructions: ctx.accounts.instructions.to_account_info(),
},
),
report,
172_800_000, // max age in ms: refuse anything older
)?
.get();
// verified.value is an i128 scaled by 4 decimals;
// verified.signer and verified.signer_kind say who signed it.
msg!("value {}", verified.value);
Ok(())
}
}
#[derive(Accounts)]
pub struct Settle<'info> {
/// CHECK: pinned by address here; Oraqle checks its owner and seeds.
#[account(address = FEED)]
pub feed: UncheckedAccount<'info>,
/// CHECK: the instructions sysvar, pinned by address.
#[account(address = anchor_lang::solana_program::sysvar::instructions::ID)]
pub instructions: UncheckedAccount<'info>,
pub oraqle_program: Program<'info, Oraqle>,
}TypeScript, on chain
import {readFileSync} from 'node:fs'
import {Transaction} from '@solana/web3.js'
import {Oraqle} from '@oraqle/sdk'
import {ed25519Instruction, toProgramReport} from '@oraqle/program'
import {ORAQLE_PROGRAM_ID, reportMessage} from '@oraqle/shared'
// A keypair file made for this buyer. It holds USDC and needs no SOL to pay.
const secretKey = Uint8Array.from(JSON.parse(readFileSync('buyer.json', 'utf8')))
const oraqle = new Oraqle({gatewayUrl: 'https://oraqle.tech/gw', secretKey})
const report = await oraqle.read('fomo/oecd-cli-china')
const {signer, signature} = report.envelope
// Your program's instruction, right after the signature it relies on.
const tx = new Transaction().add(
ed25519Instruction(signer, reportMessage(ORAQLE_PROGRAM_ID, report.report), signature),
await yourProgram.methods.settle(toProgramReport(report.report)).accounts({/* feed, instructions, oraqleProgram */}).instruction(),
)
// Or Oraqle's own check, with nothing of yours: the signature, then verify_report.
const check = new Transaction().add(...(await report.verifyReportIxs({maxAgeMs: 172800000})))Response schema
{
"type": "object",
"title": "OECD leading indicator, China",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"value",
"observedAtMs"
],
"properties": {
"value": {
"type": "string"
},
"observedAtMs": {
"type": "string"
}
}
}