| Crates.io | arcium-macros |
| lib.rs | arcium-macros |
| version | 0.6.4 |
| created_at | 2025-04-30 19:57:46.748561+00 |
| updated_at | 2026-01-20 22:49:00.144623+00 |
| description | Helper macros for developing Solana programs that integrate with the Arcium network. |
| homepage | https://www.arcium.com |
| repository | |
| max_upload_size | |
| id | 1655391 |
| size | 153,132 |
Helper macros for developing Solana programs that integrate with the Arcium network. Reduces boilerplate and enforces correct account structures for encrypted computations.
#[arcium_program]This attribute is the primary macro for an Arcium-integrated program. It should be used on the module containing your instruction handlers. It wraps Anchor's #[program] attribute and injects additional definitions required by Arcium.
#[arcium_program]
pub mod my_arcium_program {
// Instruction handlers go here
}
#[queue_computation_accounts]Use this attribute on an Accounts struct for instructions that queue an MPC computation. It validates the struct and implements the QueueCompAccs trait from arcium_anchor.
#[queue_computation_accounts("my_circuit", payer)]
#[derive(Accounts)]
pub struct QueueMyCircuit<'info> {
#[account(mut)]
pub payer: Signer<'info>,
// ... other required Arcium accounts
}
#[arcium_callback]This attribute marks a function as the callback handler for a MPC computation. It validates the function name and signature. The function must be named <encrypted_ix>_callback and take a SignedComputationOutputs<T> argument (in addition to the Context arg).
#[arcium_callback(encrypted_ix = "my_circuit")]
pub fn my_circuit_callback(
ctx: Context<Callback>,
output: SignedComputationOutputs<MyCircuitOutput>,
) -> Result<()> {
let result = output.verify_output(
&ctx.accounts.cluster_account,
&ctx.accounts.computation_account
)?;
msg!("Computation finished with result: {:?}", result);
Ok(())
}
#[callback_accounts]Apply this attribute to an Accounts struct used by a callback instruction. It validates that the struct has the necessary accounts for processing a computation's results.
#[callback_accounts("my_circuit", payer)]
#[derive(Accounts)]
pub struct Callback<'info> {
#[account(mut)]
pub payer: Signer<'info>,
// ... other required Arcium accounts
}
#[init_computation_definition_accounts]This attribute validates an Accounts struct used to initialize a new ComputationDefinitionAccount on-chain. It also implements the InitCompDefAccs trait from arcium_anchor.
#[init_computation_definition_accounts("my_circuit", payer)]
#[derive(Accounts)]
pub struct InitMyCircuitCompDef<'info> {
#[account(mut)]
pub payer: Signer<'info>,
// ... other required Arcium accounts
}