protobook_api/state/
mod.rs1mod order;
2mod receipt;
3pub use order::*;
4pub use receipt::*;
5
6use steel::*;
7
8use crate::consts::*;
9
10#[repr(u8)]
11#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
12pub enum ProtobookAccount {
13 Order = 0,
14 Receipt = 1,
15}
16
17pub fn order_pda(authority: Pubkey, id: u64) -> (Pubkey, u8) {
19 Pubkey::find_program_address(
20 &[ORDER, authority.as_ref(), &id.to_le_bytes()],
21 &crate::id(),
22 )
23}
24
25pub fn receipt_pda(authority: Pubkey, order: Pubkey) -> (Pubkey, u8) {
27 Pubkey::find_program_address(&[RECEIPT, authority.as_ref(), order.as_ref()], &crate::id())
28}