Go to file
gallynaut 9ee13d31a3 chore(release): publish
- @switchboard-xyz/sbv2-utils@0.1.46
 - @switchboard-xyz/switchboard-v2@0.0.133
2022-09-20 18:40:07 -06:00
.github docs: trigger rebuild 2022-07-22 13:05:48 -06:00
.vscode programs: added sbv2-vrf-example CLI script 2022-07-14 14:58:56 -06:00
examples removed CLI and removed OracleJob protos from TS client 2022-09-01 13:09:53 -06:00
libraries chore(release): publish 2022-09-20 18:40:07 -06:00
oracles Updated oracle version to dev-v2-07-18-22 2022-07-20 13:29:08 -06:00
tools removed CLI and removed OracleJob protos from TS client 2022-09-01 13:09:53 -06:00
website update typedocs 2022-09-01 03:40:13 -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 anchor test cleanup 2022-08-11 11:01:28 -06:00
Cargo.toml refactor: moved programs and clients under examples 2022-07-22 12:11:29 -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 oracle version to dev-v2-07-18-22 2022-07-20 13:29:08 -06:00
Publishing.md lerna.json 2022-06-07 23:45:35 -05:00
README.md removed CLI and removed OracleJob protos from TS client 2022-09-01 13:09:53 -06:00
lerna.json lerna 2022-09-20 18:40:04 -06:00
package.json removed CLI and removed OracleJob protos from TS client 2022-09-01 13:09:53 -06:00
switchboard_v2.json anchor client gen 2022-06-01 12:09:49 -06:00
switchboardv2.json added aptos.js docs 2022-09-01 03:25:53 -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 work 2022-09-20 18:50:44 -04: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 account.
native-feed-parser Solana Program Library example demonstrating how to deserialize and read an onchain aggregator account.
anchor-vrf-parser Anchor example program demonstrating how to deserialize and read an onchain verifiable randomness function (VRF) account.
anchor-buffer-parser Anchor example program demonstrating how to deserialize and read an onchain buffer relayer 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 ./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.