12 releases

0.3.0 May 13, 2024
0.2.5 Jan 6, 2024
0.2.4 Jan 18, 2023
0.2.3 Aug 9, 2022
0.1.1 Apr 17, 2022

#9 in #vrf

Download history 40/week @ 2024-02-18 92/week @ 2024-02-25 13/week @ 2024-03-10 1/week @ 2024-03-17 68/week @ 2024-03-31 133/week @ 2024-05-12 29/week @ 2024-05-19

162 downloads per month

Apache-2.0

56KB
872 lines

VRF v2 Rust SDK with Anchor

Crate to interact with orao-vrf smart contract on Solana network.

Provides interface to request for a verifiable randomness (Ed25519 Signature) on the Solana network.

API-Docs

Usage example - Rust Native

Please look at the off-chain example.

Cross-Program-Invocation (CPI) example

Browse through the cpi for more info.


lib.rs:

ORAO VRF

Crate to interact with orao-vrf smart contract on Solana network.

Provides an interface to request verifiable randomness (Ed25519 Signature) on the Solana network.

Documentation

Please look into the following functions and structures:

Cross Program Invocation

For CPI please look into the cpi example and account requirements for the Request instruction.

Note: requires cpi feature to be enabled and sdk feature to be disabled.

// assuming ctx to be a context of an instruction that performs CPI
let vrf_program = ctx.accounts.vrf.to_account_info();
let request_accounts = orao_solana_vrf::cpi::accounts::Request {
    payer: ctx.accounts.player.to_account_info(),
    network_state: ctx.accounts.config.to_account_info(),
    treasury: ctx.accounts.treasury.to_account_info(),
    request: ctx.accounts.request.to_account_info(),
    system_program: ctx.accounts.system_program.to_account_info(),
};
let cpi_ctx = CpiContext::new(vrf_program, request_accounts);
orao_solana_vrf::cpi::request(cpi_ctx, seed)?;

Dependencies

~17–37MB
~671K SLoC