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

2.6.2 • Public • Published

Task Runner

Install

yarn install
yarn build

ctx

cache

stores items in a temporary cache to share with future job executions

  • Anchor IDL's for fetching on-chain accountInfo
  • Websockets
  • Websocket responses
  • Websocket subscriptionss

clients

clients with helper functions for various protocols

  • switchboard
  • serum
  • saber
  • raydium
  • pyth
  • port
  • orca
  • mercurial
  • mango
  • jupiter
  • chainlink

logger

logger to be used

task

task runner for the OracleJob interface

const ctx = new JobContext(
  taskRunner,
  "",
  OracleJob.fromObject({}),
  undefined,
  input ?? ""
);
const result: ITaskResult = await ctx.task.run(ctx, {
  valueTask: {
    scalar,
  },
});

worker

workerpool to off-load CPU related tasks

  • can be disabled with DISABLE_WORKERPOOL
  • can disable websocket workers with DISABLE_WORKERPOOL_WEBSOCKET
  • can disable jsonpath worker with DISABLE_WORKERPOOL_JSONPATH
  • can disable twap worker with DISABLE_WORKERPOOL_TWAP

TaskRunnerReceipt

Returns a receipt of the TaskRunner execution containing the job ID, OracleJob, and an array of TaskResult's for each top level task.

const receipt = await taskRunner.perform(PublicKey.default.toString(), job);
if ("error" in receipt) {
  throw new Error(`Job failed with error ${receipt.error}`);
}
console.log(receipt.result);

Readme

Keywords

none

Package Sidebar

Install

npm i @switchboard-xyz/task-runner

Weekly Downloads

8

Version

2.6.2

License

MIT

Unpacked Size

11.7 MB

Total Files

342

Last publish

Collaborators

  • eldios
  • herm
  • mgild
  • jessupjn