xdchain-oracle
v0.1.0
Published
JS/TS client for the XDChain Oracle — 47 live price & real-world-asset feeds on the XDC Network. Chainlink AggregatorV3-compatible + REST API.
Downloads
161
Maintainers
Readme
xdchain-oracle
JS/TS client for the XDChain Oracle — 47 live, cryptographically-signed price & real-world-asset feeds on the XDC Network. Chainlink AggregatorV3-compatible on-chain, plus a public REST API.
- 🔗 On-chain, live on XDC Mainnet — contract
0x17e46C96… - 📊 Crypto · FX · Commodities (gold, natgas, crude) · Rates (Fed Funds, SOFR, UST curve) · RWA (CGO) · Indices (VIX)
- 🧩 Chainlink
AggregatorV3drop-in — integrate in existing DeFi code with zero changes - ✍️ ed25519-signed payloads · multi-source median · on-chain proof-of-reserve
Install
npm i xdchain-oraclePull live feeds in 5 lines (REST)
const { getFeeds, getFeed } = require('xdchain-oracle');
const feeds = await getFeeds(); // all 47 live feeds
console.log(feeds.length, 'feeds live');
const btc = await getFeed('crypto_btc_usd'); // one feed
console.log('BTC/USD:', btc.value); // REST feeds use .value; on-chain reads use .answerRead on-chain via Chainlink AggregatorV3
Works as a drop-in Chainlink price feed — point any AggregatorV3 consumer at the proxy address. With this SDK (pass your own ethers so the package stays dependency-free):
const { readOnChain, AGGREGATOR_V3_PROXIES } = require('xdchain-oracle');
const ethers = require('ethers');
const provider = new ethers.JsonRpcProvider('https://rpc.xinfin.network');
const gold = await readOnChain(ethers, provider, 'commodity_xau_usd');
console.log('XAU/USD on-chain:', gold.answer, '· updated', new Date(gold.updatedAt * 1000));In Solidity
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
AggregatorV3Interface btc = AggregatorV3Interface(0x72B637073DD6E081022D8C4AF8aC1436A80385AF);
(, int256 price, , , ) = btc.latestRoundData();Available on-chain feeds
| Key | Pair | Proxy |
|---|---|---|
| crypto_xdc_usd | XDC/USD | 0xAb6b09F2… |
| crypto_btc_usd | BTC/USD | 0x72B63707… |
| crypto_eth_usd | ETH/USD | 0x7EB6A009… |
| trade_fx_usd_eur | USD/EUR | 0xFEF443b9… |
| commodity_xau_usd | Gold (XAU/USD) | 0xeFcb1fb2… |
| commodity_natgas_usd | Natural Gas | 0xa5587521… |
| rwa_cgo_usd | CGO (RWA) | 0xD9e77162… |
| index_vix | VIX | 0x3698E1F9… |
| rate_fed_funds | Fed Funds Rate | 0x58cae66A… |
Full list of 47 feeds (incl. SOFR, UST curve, more FX & metals) via getFeeds() or the REST API.
Links
- Website & live feeds: https://xdcoracle.ripitlabs.com
- REST:
GET /api/oracle/public·GET /api/oracle/consume - Built by Rip It Labs on the XDC Network
License
MIT
