@switchboard-xyz/common
v2.5.7
Published
common type definitions and utils for interacting with switchboard
Downloads
27,876
Readme
Install
npm i --save @switchboard-xyz/common
Usage
Create an OracleJob
import { OracleJob, serializeOracleJob } from "@switchboard-xyz/common";
const oracleJob: OracleJob = serializeOracleJob({
tasks: [
{
httpTask: {
url: "https://www.binance.com/api/v3/ticker/price?symbol=BTCUSDT",
},
},
{
jsonParseTask: {
path: "$.price",
},
},
{
multiplyTask: {
/* Mainnet USDT/USD Feed */
aggregatorPubkey: "ETAaeeuQBwsh9mC2gCov9WdhJENZuffRMXY2HgjCcSL9",
},
},
],
});
Simulate an OracleJob
import { simulateOracleJobs } from "@switchboard-xyz/common";
const result = await simulateOracleJobs([oracleJob]);
console.log(result);