@switchboard-xyz/common
TypeScript icon, indicating that this package has built-in type declarations

2.2.3 • Public • Published

@switchboard-xyz/common

Contains the OracleJob protobufs and other types and utilities shared across chains.

NPM Badge

Discord Twitter

Npm: npmjs.com/package/@switchboard-xyz/common

Typedocs: docs.switchboard.xyz/api/@switchboard-xyz/common

Sbv2 Core SDK: github.com/switchboard-xyz/sbv2-core

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);

Keywords

none

Install

npm i @switchboard-xyz/common

DownloadsWeekly Downloads

1,563

Version

2.2.3

License

MIT

Unpacked Size

3.23 MB

Total Files

121

Last publish

Collaborators

  • gallynaut
  • herm
  • vjessup
  • mgild
  • jessupjn