universalsettle-api 0.1.3

X402-inspired settlement program for any token on Solana
Documentation
mod config;
mod split_vault;

pub use config::*;
pub use split_vault::*;

use steel::*;

use crate::consts::*;

#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
pub enum SettlementAccount {
    Config = 0,
    SplitVault = 1,
}

/// Derive the PDA of the config account.
pub fn config_pda() -> (Pubkey, u8) {
    Pubkey::find_program_address(&[CONFIG], &crate::id())
}

/// Derive the PDA of the SplitVault account
pub fn split_vault_pda(seller: &Pubkey) -> (Pubkey, u8) {
    Pubkey::find_program_address(&[VAULT, seller.as_ref()], &crate::id())
}

/// Derive the PDA of the SOL storage account for a SplitVault.
pub fn vault_sol_storage_pda(vault_pda: Pubkey) -> (Pubkey, u8) {
    Pubkey::find_program_address(&[SOL_STORAGE, vault_pda.as_ref()], &crate::id())
}