Dialed in with Switchboard: 5–23–22

Switchboard V2 SDK is Here!

The Switchboard V2 SDK is here and includes the necessary tools to help you integrate Switchboard into your on-or-off chain applications. The SDK includes libraries for Typescript/Javascript, Python, and Rust, as well as example programs demonstrating how to read and interact with Switchboard V2. Below is the current overview of the Github repo structure:

Current Switchboard V2 SDK Layout

Setup

git clone https://github.com/switchboard-xyz/switchboard-v2.git && cd switchboard-v2

Then, install and link the dependencies

yarn installyarn workspaces run buildyarn workspace @switchboard-xyz/switchboardv2-cli linkanchor build && node ./scripts/setup-example-programs.js

Finally, test the example programs

anchor test

Quick Links

Localnet Integration

First, change the cluster to localnet in Anchor.toml.

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 tests 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.

Uniswap & SushiSwap Task Types

xStepPriceTask

SplTokenParseTask & SplStakePoolTask

Publisher

… more details soon™!

publish.switchboard.xyz

Conclusion

--

--

Multi-chain, permissionless oracle protocol for general purpose data feeds & verifiable randomness! Find out more here: switchboard.xyz

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Switchboard

Multi-chain, permissionless oracle protocol for general purpose data feeds & verifiable randomness! Find out more here: switchboard.xyz