sbv2-solana/programs/anchor-vrf-parser
Conner Gallagher c742615051 migrated from @project-serum to @coral-xyz 2023-01-31 16:24:08 -07:00
..
.switchboard/networks fix gitignore 2023-01-06 11:11:51 -07:00
src updated program examples 2023-01-19 00:12:56 -07:00
tests updated program examples 2023-01-19 00:12:56 -07:00
.gitignore updated anchor-vrf-parser example 2023-01-06 10:47:59 -07:00
Anchor.toml updated program examples 2023-01-18 20:17:40 -07:00
Cargo.toml updated program examples 2023-01-18 20:17:40 -07:00
README.md solana.js: added vrf, crank, and bufferRelayer interfaces 2022-11-29 14:38:26 -07:00
Xargo.toml removed monorepo structure 2022-09-28 14:37:26 -06:00
cli.ts uprev switchboard deps 2022-11-26 15:15:13 -07:00
package-lock.json migrated from @project-serum to @coral-xyz 2023-01-31 16:24:08 -07:00
package.json updated program examples 2023-01-18 20:17:40 -07:00
sbv2-vrf-example.sh removed monorepo structure 2022-09-28 14:37:26 -06:00
tsconfig.json updated program examples 2023-01-18 20:17:40 -07:00

README.md

Switchboard VRF Cross Program Invocation Example

Example repo

Setup

npm i
find secrets/payer-keypair.json || solana-keygen new -s --no-bip39-passphrase --outfile secrets/payer-keypair.json
solana airdrop 1 secrets/payer-keypair.json
solana airdrop 1 secrets/payer-keypair.json
solana airdrop 1 secrets/payer-keypair.json
anchor build
solana-keygen pubkey target/deploy/anchor_vrf_parser-keypair.json

Note the program ID.

In the following files, replace the program ID from above:

  • programs/anchor-vrf-example/src/lib.rs
  • Anchor.toml

Rebuild the program anchor build.

Devnet Testing

NOTE: Need to re-write test so use switchboard permissionless devnet queue

In Anchor.toml, set the cluster to devnet.

[provider]
cluster = "devnet"
wallet = "secrets/payer-keypair.json"

Then deploy and run the tests.

anchor test

Localnet Testing

In Anchor.toml, set the cluster to localnet.

[provider]
cluster = "localnet"
wallet = "secrets/payer-keypair.json"

Create a localnet switchboard environment

npx sbv2 localnet:env --keypair secrets/payer-keypair.json

In a new shell, start the local validator using the script output from above

chmod +x ./start-local-validator.sh
./start-local-validator.sh

In a new shell, start the local Switchboard oracle

chmod +x ./start-oracle.sh
CLUSTER=localnet ./start-oracle.sh

Run the anchor test using the already running localnet validator

anchor test --skip-local-validator