Skip to main content

pda

Attribute Macro pda 

Source
#[pda]
Expand description

The main #[pda(...)] attribute macro. This is where the PDA seed ABI is defined.

usage example:

#[account]
#[pda(
    seeds = [
        prefix = b"message",
        from: Pubkey,
        to: Pubkey,
        id: u64,
    ],
    // optional, defaults to the current crate ID
    program_id = crate::ID,
    // optional, defaults to all disabled
    features = [
        find, // generates "find_pda" method for struct
        assert // generates "assert_pda" method for struct
    ]
)]
pub struct Message {
    pub id: u64,
}