#proc-macro #solana #switchboard #oracle

macro switchboard-solana-macros

Proc macros for creating Switchboard Functions on Solana

5 releases

0.2.3 Feb 1, 2024
0.2.2 Dec 15, 2023
0.2.1 Nov 14, 2023
0.2.0 Nov 10, 2023
0.1.0 Nov 10, 2023

#34 in #switchboard

Download history 28/week @ 2024-01-01 33/week @ 2024-01-08 14/week @ 2024-01-29 3/week @ 2024-02-05 16/week @ 2024-02-19 18/week @ 2024-02-26 4/week @ 2024-03-04 14/week @ 2024-03-11 61/week @ 2024-04-01 2/week @ 2024-04-08 15/week @ 2024-04-15

78 downloads per month
Used in 5 crates (4 directly)

MIT license

34KB
683 lines

Switchboard Logo

switchboard-solana-macros

Proc macros for creating Switchboard Functions on Solana

Crates.io Badge

Discord Badge

Twitter Badge

Switchboard Documentation: docs.switchboard.xyz

Install

Run the following Cargo command in your project directory:

cargo add switchboard-solana-macros

Or add the following line to your Cargo.toml:

[dependencies]
switchboard-solana-macros = "0.2.0"

Usage

use switchboard_solana_macros::switchboard_function;

#[switchboard_function]
pub async fn my_function_logic(
    runner: FunctionRunner,
    params: Vec<u8>
) -> Result<Vec<Instruction>, SbFunctionError> {
    // Build an array of instructions targetted toward your program
    let ixs = vec![Instruction {
        program_id: Pubkey::default(),
        accounts: vec![],
        data: vec![],
    }];

    // Emit the instructions for the oracle to validate and relay on-chain
    Ok(ixs)
}

Dependencies

~325–790KB
~19K SLoC