Skip to main content

derive_pda_const

Macro derive_pda_const 

Source
macro_rules! derive_pda_const {
    ($program_id:expr, $bump:expr, $($seed:expr),+ $(,)?) => { ... };
}
Expand description

Derive a PDA at compile time. Requires const seeds and bump.

Uses derive_address_const (pure-Rust SHA-256, no syscall cost at runtime). The result is a const Address.

const VAULT_PDA: Address = derive_pda_const!(
    PROGRAM_ID_BYTES,
    BUMP,
    b"vault",
    AUTHORITY_BYTES,
);