Skip to content

Latest commit

 

History

History
 
 

oracle

@switchboard-xyz/oracle

A Typescript wrapper for the Switchboard V2 oracle.

Test Status NPM Badge

Discord Twitter

Install

npm i --save-dev @switchboard-xyz/oracle

Usage

NodeJS

import { NodeOracle } from "@switchboard-xyz/oracle";

const oracle = await NodeOracle.fromReleaseChannel({
  releaseChannel: "testnet",
  chain: "solana",
  network: "localnet",
  rpcUrl: "http://0.0.0.0:8899",
  oracleKey: "FKFPBD5WUUL5bSNwBH3AKY58KuY8nz2zkMCYR271CcVA",
  secretPath: "~/.config/solana/id.json",
});

try {
  await oracle.startAndAwait();
  console.log("oracle ready");
  await sleep(10000);
} catch (error) {
  console.error(error);
}

oracle.stop();

Docker

import { DockerOracle } from "@switchboard-xyz/oracle";

const oracle = await DockerOracle.fromReleaseChannel({
  releaseChannel: "testnet",
  chain: "solana",
  network: "localnet",
  rpcUrl: "http://0.0.0.0:8899",
  oracleKey: "FKFPBD5WUUL5bSNwBH3AKY58KuY8nz2zkMCYR271CcVA",
  secretPath: "~/.config/solana/id.json",
});

try {
  await oracle.startAndAwait();
  console.log("oracle ready");
  await sleep(10000);
} catch (error) {
  console.error(error);
}

oracle.stop();