2023-02-13 15:23:32 -08:00
< div align = "center" >
2023-05-10 00:12:08 -07:00
![Switchboard Logo ](https://github.com/switchboard-xyz/sbv2-core/raw/main/website/static/img/icons/switchboard/avatar.png )
2023-05-10 00:56:06 -07:00
# Switchboard x Solana
2023-05-10 00:12:08 -07:00
2023-05-10 00:56:06 -07:00
> A collection of libraries and examples for interacting with Switchboard V2 on
> Solana.
2023-05-10 00:12:08 -07:00
[![Test Status ](https://github.com/switchboard-xyz/sbv2-solana/actions/workflows/solana-js-test.yml/badge.svg )](https://github.com/switchboard-xyz/sbv2-solana/actions/workflows/solana-js-test.yml)
[![Anchor Test Status ](https://github.com/switchboard-xyz/sbv2-solana/actions/workflows/anchor-test.yml/badge.svg )](https://github.com/switchboard-xyz/sbv2-solana/actions/workflows/anchor-test.yml)
[![Crates.io ](https://img.shields.io/crates/v/switchboard-v2?label=switchboard-v2&logo=rust )](https://crates.io/crates/switchboard-v2)
[![NPM Badge ](https://img.shields.io/github/package-json/v/switchboard-xyz/sbv2-solana?color=red&filename=javascript%2Fsolana.js%2Fpackage.json&label=%40switchboard-xyz%2Fsolana.js&logo=npm )](https://www.npmjs.com/package/@switchboard-xyz/solana.js)
2023-02-13 15:23:32 -08:00
< / div >
## Getting Started
To get started, clone the
[sbv2-solana ](https://github.com/switchboard-xyz/sbv2-solana ) repository.
```bash
git clone https://github.com/switchboard-xyz/sbv2-solana
```
2023-03-08 14:47:05 -08:00
Then install the dependencies
```bash
cd sbv2-solana
pnpm install
2023-03-13 15:57:54 -07:00
pnpm build
2023-03-08 14:47:05 -08:00
```
2023-05-09 22:34:56 -07:00
## Addresses
2023-02-13 16:28:08 -08:00
2023-05-08 22:40:34 -07:00
The following addresses can be used with the Switchboard deployment on Solana
2023-02-13 16:28:08 -08:00
2023-05-09 22:07:46 -07:00
### Mainnet
2023-02-13 19:59:17 -08:00
2023-05-08 22:40:34 -07:00
| Account | Address |
| -------------------- | ---------------------------------------------- |
| Program ID | `SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f` |
| Program Authority | `2NvGRFswVx3GXxURNSfjbsWY4iP1ufj8LvAKJWGXSm4D` |
| IdlAddress | `Fi8vncGpNKbq62gPo56G4toCehWNy77GgqGkTaAF5Lkk` |
| Permissioned Queue | `3HBb2DQqDfuMdzWxNk1Eo9RTMkFYmuEAd32RiLKn9pAn` |
| Permissionless Queue | `5JYwqvKkqp35w8Nq3ba4z1WYUeJQ1rB36V8XvaGp6zn1` |
2023-05-09 22:07:46 -07:00
### Devnet
2023-05-08 22:40:34 -07:00
| Account | Address |
| -------------------- | ---------------------------------------------- |
| Program ID | `SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f` |
| Program Authority | `2KgowxogBrGqRcgXQEmqFvC3PGtCu66qERNJevYW8Ajh` |
| IdlAddress | `Fi8vncGpNKbq62gPo56G4toCehWNy77GgqGkTaAF5Lkk` |
| Permissioned Queue | `PeRMnAqNqHQYHUuCBEjhm1XPeVTh4BxjY4t4TPan1pG` |
| Permissionless Queue | `uPeRMdfPmrPqgRWSrjAnAkH78RqAhe5kXoW6vBYRqFX` |
2023-02-13 19:59:17 -08:00
2023-05-09 22:07:46 -07:00
## Clients
2023-02-13 15:23:32 -08:00
2023-05-08 22:51:49 -07:00
| **Lang** | **Name** | **Description** |
| ---------- | -------------------------------------------------- | ------------------------------------------------------------------ |
| Rust | [switchboard-v2 ](rust/switchboard-v2 ) | A Rust library to interact with Switchboard V2 accounts on Solana. |
| Javascript | [@switchboard-xyz/solana.js ](javascript/solana.js ) | A Typescript client to interact with Switchboard on Solana. |
2023-05-08 22:40:34 -07:00
2023-05-12 10:10:27 -07:00
## Examples
| **Lang** | **Name** | **Description** |
| ---------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| Rust | [native-feed-parser ](programs/native-feed-parser ) | Read a Switchboard feed using Solana's native program library |
| Anchor | [anchor-feed-parser ](programs/anchor-feed-parser ) | Read a Switchboard feed using Anchor |
| Anchor | [anchor-history-parser ](programs/anchor-history-parser ) | Read a data feeds history buffer and get the closest historical sample to a given timestamp |
| Anchor | [anchor-vrf-parser ](programs/anchor-vrf-parser ) | Read a Switchboard VRF account and make a Cross Program Invocation (CPI) to request a new randomness value |
| Anchor | [anchor-buffer-parser ](programs/anchor-buffer-parser ) | Read a Switchboard buffer relayer using Anchor |
| Javascript | [javascript-feed-walkthrough ](javascript/feed-walkthrough ) | Create a private Switchboard queue and oracle and fulfill your own oracle updates |
2023-02-13 15:23:32 -08:00
## Troubleshooting
1. File a
[GitHub Issue ](https://github.com/switchboard-xyz/sbv2-solana/issues/new )
2. Ask a question in
[Discord #dev-support ](https://discord.com/channels/841525135311634443/984343400377647144 )