libreplex_metadata 0.10.0

Created with Anchor
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

use std::collections::BTreeMap;

use crate::{errors::ErrorCode};

use anchor_lang::prelude::*;


pub fn assert_pda_derivation(program_id: &Pubkey, account_key: &Pubkey, path: &[&[u8]]) -> Result<u8> {
    let (key, bump) = Pubkey::find_program_address(path, program_id);
    if key != *account_key {
        return err!(ErrorCode::DerivedKeyInvalid);
    }
    Ok(bump)
}