Go to file
Conner Gallagher 11534c5296 updated latest docker image to dev-v2-07-11-22 2022-07-12 10:11:22 -06:00
.github yarn.lock 2022-07-05 09:03:32 -06:00
.vscode init 2022-05-17 10:42:04 -06:00
cli chore(release): publish 2022-07-10 22:02:40 -06:00
directory anchor client gen 2022-06-01 12:09:49 -06:00
libraries updated latest docker image to dev-v2-07-11-22 2022-07-12 10:11:22 -06:00
oracles updated latest docker image to dev-v2-07-11-22 2022-07-12 10:11:22 -06:00
packages Merge pull request #26 from switchboard-xyz/dependabot-npm_and_yarn-types-node-17.0.45 2022-07-05 08:54:53 -06:00
programs Merge pull request #31 from switchboard-xyz/dependabot-npm_and_yarn-eslint-plugin-prettier-4.2.1 2022-07-05 08:56:03 -06:00
tools Merge pull request #31 from switchboard-xyz/dependabot-npm_and_yarn-eslint-plugin-prettier-4.2.1 2022-07-05 08:56:03 -06:00
website updated latest docker image to dev-v2-07-11-22 2022-07-12 10:11:22 -06:00
.eslintrc.json refactored example programs 2022-05-18 15:00:17 -06:00
.gitignore docs 2022-05-30 22:49:55 -06:00
Anchor.toml cleanup 2022-06-29 21:51:29 -06:00
Cargo.toml fixed programs test 2022-05-19 14:49:38 -06:00
LICENSE cleaned up package.json, tsconfig.json, and misc build configs 2022-05-25 12:38:29 -06:00
Oracle_Version.md updated latest docker image to dev-v2-07-11-22 2022-07-12 10:11:22 -06:00
Publishing.md lerna.json 2022-06-07 23:45:35 -05:00
README.md README 2022-06-13 13:41:25 -06:00
lerna.json lerna.json 2022-06-07 23:45:35 -05:00
package.json Merge pull request #26 from switchboard-xyz/dependabot-npm_and_yarn-types-node-17.0.45 2022-07-05 08:54:53 -06:00
switchboard_v2.json anchor client gen 2022-06-01 12:09:49 -06:00
tsconfig.json uprev spl-token 2022-06-29 19:44:33 -06:00
tsconfig.testing.json fixed anchor test 2022-06-14 22:53:37 -06:00
yarn.lock yarn.lock 2022-07-05 09:03:32 -06:00

README.md

switchboard-v2

A monorepo containing APIs, Utils, and examples for Switchboard V2.

Table of Contents

Libraries

Package Description
Protobufs Protocol buffers used by the oracle to fetch and publish data.
Typescript Typescript client to interact with Switchboard V2.
Typescript Lite Typescript "Lite" client to deserialize aggregator accounts
Sbv2 Utils Typescript library with helpful utility functions
Python Python client to interact with Switchboard V2.
Rust Rust client to interact with Switchboard V2.
CLI Command Line Interface (CLI) to interact with Switchboard V2.

Program Examples

Package Description
anchor-feed-parser Anchor example program demonstrating how to deserialize and read an onchain aggregator.
spl-feed-parser Solana Program Library example demonstrating how to deserialize and read an onchain aggregator.
anchor-vrf-parser Anchor example program demonstrating how to deserialize and read an onchain verifiable randomness function (VRF) account.

Client Examples

Package Description
feed-parser Typescript example demonstrating how to read an aggregator account.
feed-walkthrough Typescript example demonstrating how to create and manage your own oracle queue.
lease-observer Typescript example demonstrating how to send PagerDuty alerts when your aggregator lease is low on funds.

Dependencies

Setup

yarn install
yarn workspaces run build
yarn workspace @switchboard-xyz/switchboardv2-cli link
anchor build && node ./tools/scripts/setup-example-programs.js

Website

Run live server

yarn workspace website start

Build

yarn docs:build

Publishing

See ./Publishing.md for a detailed guide.

lerna version patch --no-private --yes
lerna publish from-git --yes

Localnet Testing Setup

The SDK supports copying a Switchboard devnet environment to your localnet environment for integration testing. This is useful if you want to see how your program will react to Switchboard data feed updates.

First, set the [provider.cluster] in Anchor.toml to localnet.

Next, create a Switchboard devnet queue and oracle.

sbv2 localnet:env --keypair ../payer-keypair.json -o .switchboard

This command will output:

  • start-local-validator.sh: starts a local Solana validator with the Switchboard program, IDL, and our devnet environment pre-loaded
  • start-oracle.sh: start a Switchboard oracle and start heartbeating on the localnet queue
  • docker-compose.yml: docker file with the Switchboard oracle environment
  • switchboard.env: contains your Switchboard accounts

In three separate shells, run the following commands in this order:

  • ./.switchboard/start-local-validator.sh
  • ./.switchboard/start-oracle.sh
  • anchor test --skip-local-validator

The anchor test are configured to first fetch the account info for the Switchboard DAO controlled devnet permissionless queue. If the account info is not found, it assumes a localnet connection and looks for the switchboard.env with your Switchboard environment specific public keys. If a.switchboard directory or switchboard.env file is not found in the root project directory, it will look 2 levels higher until giving up.