| Crates.io | switchboard-solana-macros |
| lib.rs | switchboard-solana-macros |
| version | 0.2.3 |
| created_at | 2023-11-10 22:36:12.390015+00 |
| updated_at | 2024-02-01 13:28:01.228807+00 |
| description | Proc macros for creating Switchboard Functions on Solana |
| homepage | https://switchboard.xyz |
| repository | https://github.com/switchboard-xyz/solana-sdk/tree/main/rust/switchboard-solana-macros |
| max_upload_size | |
| id | 1031552 |
| size | 47,702 |
![]()
Proc macros for creating Switchboard Functions on Solana
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"
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)
}