switchboard-solana-macros-temp

Crates.ioswitchboard-solana-macros-temp
lib.rsswitchboard-solana-macros-temp
version0.2.3
sourcesrc
created_at2023-11-14 12:48:28.115248
updated_at2023-11-14 13:44:36.918711
descriptionProc macros for creating Switchboard Functions on Solana
homepagehttps://switchboard.xyz
repositoryhttps://github.com/switchboard-xyz/solana-sdk/tree/main/rust/switchboard-solana-macros
max_upload_size
id1034709
size156,700
(mgild)

documentation

README

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)
}
Commit count: 0

cargo fmt