sbv2-solana/README.md

97 lines
4.7 KiB
Markdown
Raw Normal View History

2023-02-13 15:23:32 -08:00
<div align="center">
2023-02-13 15:52:41 -08:00
<a href="#">
2023-04-26 11:14:41 -07:00
<img src="https://github.com/switchboard-xyz/sbv2-core/raw/main/website/static/img/icons/switchboard/avatar.png" />
2023-02-13 15:52:41 -08:00
</a>
2022-09-28 13:39:36 -07:00
2023-02-13 15:23:32 -08:00
<h1>Switchboard V2</h1>
2023-02-13 16:28:08 -08:00
<p>A collection of libraries and examples for interacting with Switchboard V2 on Solana.</p>
2023-02-13 15:23:32 -08:00
<p>
2023-03-09 17:27:51 -08:00
<a href="https://github.com/switchboard-xyz/sbv2-solana/actions/workflows/solana-js-test.yml">
<img alt="Test Status" src="https://github.com/switchboard-xyz/sbv2-solana/actions/workflows/solana-js-test.yml/badge.svg" />
</a>
<a href="https://github.com/switchboard-xyz/sbv2-solana/actions/workflows/anchor-test.yml">
<img alt="Anchor Test Status" src="https://github.com/switchboard-xyz/sbv2-solana/actions/workflows/anchor-test.yml/badge.svg" />
</a>
2023-02-13 16:28:08 -08:00
<a href="https://crates.io/crates/switchboard-v2">
2023-04-26 10:53:07 -07:00
<img alt="Crates.io" src="https://img.shields.io/crates/v/switchboard-v2?label=switchboard-v2&logo=rust" />
2023-02-13 16:28:08 -08:00
</a>
<a href="https://www.npmjs.com/package/@switchboard-xyz/solana.js">
2023-02-14 13:13:08 -08:00
<img alt="NPM Badge" src="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" />
2023-02-13 16:28:08 -08:00
</a>
2023-02-13 15:23:32 -08:00
</p>
<p>
2023-02-13 15:52:41 -08:00
<a href="https://discord.gg/switchboardxyz">
2023-04-26 10:53:07 -07:00
<img alt="Discord" src="https://img.shields.io/discord/841525135311634443?color=blueviolet&logo=discord&logoColor=white" />
2023-02-13 15:52:41 -08:00
</a>
<a href="https://twitter.com/switchboardxyz">
<img alt="Twitter" src="https://img.shields.io/twitter/follow/switchboardxyz?label=Follow+Switchboard" />
</a>
2023-02-13 15:23:32 -08:00
</p>
<h4>
2023-02-13 15:52:41 -08:00
<strong>Documentation: </strong><a href="https://docs.switchboard.xyz">docs.switchboard.xyz</a>
2023-02-13 15:23:32 -08:00
</h4>
</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
pnpm build
2023-03-08 14:47:05 -08:00
```
2023-02-13 16:28:08 -08:00
## Program IDs
| **Network** | **Program ID** |
| ------------ | --------------------------------------------- |
| Mainnet-Beta | `SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f` |
| Devnet | `SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f` |
2023-02-13 16:28:08 -08:00
2023-02-13 19:59:17 -08:00
See [switchboard.xyz/explorer](https://switchboard.xyz/explorer) for a list of
feeds deployed on Solana.
See [app.switchboard.xyz](https://app.switchboard.xyz) to create your own Solana
feeds.
2023-02-13 16:28:08 -08:00
## Libraries
2023-02-13 15:23:32 -08:00
2023-02-13 16:47:22 -08:00
| **Lang** | **Name** | **Description** |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
2023-04-11 10:11:55 -07:00
| Rust | [switchboard-v2](/rust/switchboard-v2/) <br />[[Crates.io](https://crates.io/crates/switchboard-v2), [Typedocs](https://docs.rs/switchboard-v2)] | Rust crate to deserialize and read Switchboard data feeds |
2023-02-13 16:47:22 -08:00
| JS | [@switchboard-xyz/solana.js](/javascript/solana.js/) <br />[[npmjs](https://www.npmjs.com/package/@switchboard-xyz/solana.js), [Typedocs](https://docs.switchboard.xyz/api/@switchboard-xyz/solana.js)] | Typescript package to interact with Switchboard V2 |
| Python | [switchboardpy](/python/switchboardpy/) <br />[[pypi](https://pypi.org/project/switchboardpy/), [Typedocs](https://docs.switchboard.xyz/api/switchboardpy/)] | Python package to interact with Switchboard V2. **No longer maintained** |
2023-02-13 15:23:32 -08:00
2023-02-13 16:28:08 -08:00
## Example Programs
2023-02-13 15:23:32 -08:00
- [native-feed-parser](/programs/native-feed-parser/): Read a Switchboard feed
using Solana's native program library
- [anchor-feed-parser](/programs/anchor-feed-parser/): Read a Switchboard feed
using Anchor
- [anchor-history-parser](/programs/anchor-history-parser/): Read a Switchboard
history buffer using 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-buffer-parser](/programs/anchor-buffer-parser/): Read a Switchboard
buffer relayer using Anchor
## 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)