pub struct EscrowSdk;Expand description
SDK for interacting with the Escrow program
Implementations§
Source§impl EscrowSdk
impl EscrowSdk
Sourcepub fn program_id() -> Pubkey
pub fn program_id() -> Pubkey
Get the program ID
Sourcepub fn config_pda() -> (Pubkey, u8)
pub fn config_pda() -> (Pubkey, u8)
Get the config PDA
Sourcepub fn escrow_pda(mint: Pubkey) -> (Pubkey, u8)
pub fn escrow_pda(mint: Pubkey) -> (Pubkey, u8)
Get an escrow PDA for a specific mint
Sourcepub fn payment_pda(payment_uid: &str, bank: Pubkey) -> (Pubkey, u8)
pub fn payment_pda(payment_uid: &str, bank: Pubkey) -> (Pubkey, u8)
Get a payment PDA for a specific payment UID
Sourcepub fn sol_storage_pda(
mint: Pubkey,
bank: Pubkey,
escrow: Pubkey,
) -> (Pubkey, u8)
pub fn sol_storage_pda( mint: Pubkey, bank: Pubkey, escrow: Pubkey, ) -> (Pubkey, u8)
Get a SOL storage PDA for a specific escrow
Sourcepub fn associated_token_account(wallet: Pubkey, mint: Pubkey) -> Pubkey
pub fn associated_token_account(wallet: Pubkey, mint: Pubkey) -> Pubkey
Get the associated token account for a wallet and mint
Sourcepub fn escrow_token_account(mint: Pubkey) -> Pubkey
pub fn escrow_token_account(mint: Pubkey) -> Pubkey
Get the associated token account for an escrow
Sourcepub fn initialize(signer: Pubkey, fee_bps: Option<u16>) -> Instruction
pub fn initialize(signer: Pubkey, fee_bps: Option<u16>) -> Instruction
Create an initialize instruction
Sourcepub fn open_escrow(
signer: Pubkey,
payer: Pubkey,
mint: Pubkey,
min_payment_amount: u64,
max_payment_amount: u64,
fee_bps: u16,
) -> Instruction
pub fn open_escrow( signer: Pubkey, payer: Pubkey, mint: Pubkey, min_payment_amount: u64, max_payment_amount: u64, fee_bps: u16, ) -> Instruction
Create an open escrow instruction signer: bank authority payer: funder mint: token mint min_payment_amount: minimum payment amount max_payment_amount: maximum payment amount fee_bps: fee basis points
Sourcepub fn fund_payment(
buyer: Pubkey,
buyer_tokens: Option<Pubkey>,
seller: Pubkey,
mint: Pubkey,
amount: u64,
ttl_seconds: i64,
reference: Option<Pubkey>,
payment_uid: &str,
order_num: &str,
) -> Instruction
pub fn fund_payment( buyer: Pubkey, buyer_tokens: Option<Pubkey>, seller: Pubkey, mint: Pubkey, amount: u64, ttl_seconds: i64, reference: Option<Pubkey>, payment_uid: &str, order_num: &str, ) -> Instruction
Create a fund payment instruction (supports both SOL and SPL tokens) For SOL: mint should be Pubkey::default() For SPL tokens: mint should be the actual token mint
Sourcepub fn release_payment(
caller: Pubkey,
seller_tokens: Option<Pubkey>,
seller: Option<Pubkey>,
mint: Pubkey,
payment_uid: &str,
) -> Instruction
pub fn release_payment( caller: Pubkey, seller_tokens: Option<Pubkey>, seller: Option<Pubkey>, mint: Pubkey, payment_uid: &str, ) -> Instruction
Create a release payment instruction (supports both SOL and SPL tokens) For SOL: mint should be Pubkey::default() For SPL tokens: mint should be the actual token mint
Sourcepub fn refund_payment(
caller: Pubkey,
buyer_tokens: Option<Pubkey>,
mint: Pubkey,
payment_uid: &str,
) -> Instruction
pub fn refund_payment( caller: Pubkey, buyer_tokens: Option<Pubkey>, mint: Pubkey, payment_uid: &str, ) -> Instruction
Create a refund payment instruction (supports both SOL and SPL tokens) For SOL: mint should be Pubkey::default() For SPL tokens: mint should be the actual token mint
Sourcepub fn close_payment(
buyer: Pubkey,
mint: Pubkey,
payment_uid: &str,
) -> Instruction
pub fn close_payment( buyer: Pubkey, mint: Pubkey, payment_uid: &str, ) -> Instruction
Create a close payment instruction
Sourcepub fn withdraw_fees(
authority: Pubkey,
beneficiary: Pubkey,
mint: Pubkey,
amount: u64,
) -> Instruction
pub fn withdraw_fees( authority: Pubkey, beneficiary: Pubkey, mint: Pubkey, amount: u64, ) -> Instruction
Create a withdraw fees instruction (supports both SOL and SPL tokens) For SOL: mint should be Pubkey::default() For SPL tokens: mint should be the actual token mint
pub fn confirm_fulfillment( buyer: Pubkey, mint: Pubkey, payment_uid: &str, ) -> Instruction
Sourcepub fn dispute_payment(
disputer: Pubkey,
mint: Pubkey,
payment_uid: &str,
reason: u8,
description: Option<&str>,
) -> Instruction
pub fn dispute_payment( disputer: Pubkey, mint: Pubkey, payment_uid: &str, reason: u8, description: Option<&str>, ) -> Instruction
Create a dispute payment instruction
Sourcepub fn arbitrate_payment(
arbitrator: Pubkey,
mint: Pubkey,
payment_uid: &str,
decision: u8,
buyer_amount: u64,
seller_amount: u64,
reason: u8,
description: Option<&str>,
) -> Instruction
pub fn arbitrate_payment( arbitrator: Pubkey, mint: Pubkey, payment_uid: &str, decision: u8, buyer_amount: u64, seller_amount: u64, reason: u8, description: Option<&str>, ) -> Instruction
Create an arbitrate payment instruction
Sourcepub fn resolve_dispute(
resolver: Pubkey,
buyer_ata: Option<Pubkey>,
seller_ata: Option<Pubkey>,
arbitrator: Pubkey,
mint: Pubkey,
payment_uid: &str,
decision: u8,
buyer_amount: u64,
seller_amount: u64,
) -> Instruction
pub fn resolve_dispute( resolver: Pubkey, buyer_ata: Option<Pubkey>, seller_ata: Option<Pubkey>, arbitrator: Pubkey, mint: Pubkey, payment_uid: &str, decision: u8, buyer_amount: u64, seller_amount: u64, ) -> Instruction
Create a resolve dispute instruction (supports both SOL and SPL tokens) For SOL: mint should be Pubkey::default() For SPL tokens: mint should be the actual token mint
Sourcepub fn extend_payment_ttl(
caller: Pubkey,
mint: Pubkey,
payment_uid: &str,
additional_seconds: i64,
) -> Instruction
pub fn extend_payment_ttl( caller: Pubkey, mint: Pubkey, payment_uid: &str, additional_seconds: i64, ) -> Instruction
Create an extend payment TTL instruction
Sourcepub fn close_escrow(
authority: Pubkey,
recipient: Pubkey,
mint: Pubkey,
) -> Instruction
pub fn close_escrow( authority: Pubkey, recipient: Pubkey, mint: Pubkey, ) -> Instruction
Create a close escrow instruction
Sourcepub fn update_escrow_settings(
authority: Pubkey,
escrow: Pubkey,
fee_bps: u16,
min_payment_amount: u64,
max_payment_amount: u64,
) -> Instruction
pub fn update_escrow_settings( authority: Pubkey, escrow: Pubkey, fee_bps: u16, min_payment_amount: u64, max_payment_amount: u64, ) -> Instruction
Create an update escrow settings instruction
Sourcepub fn pause_escrow(authority: Pubkey, mint: Pubkey, pause: bool) -> Instruction
pub fn pause_escrow(authority: Pubkey, mint: Pubkey, pause: bool) -> Instruction
Create a pause escrow instruction
Create an update authority instruction
Sourcepub fn appeal_arbitration(
appellant: Pubkey,
mint: Pubkey,
payment_uid: &str,
reason: u8,
description: Option<&str>,
) -> Instruction
pub fn appeal_arbitration( appellant: Pubkey, mint: Pubkey, payment_uid: &str, reason: u8, description: Option<&str>, ) -> Instruction
Create an appeal arbitration instruction
Sourcepub fn validate_payment_for_funding(
payment: &Payment,
) -> Result<(), EscrowError>
pub fn validate_payment_for_funding( payment: &Payment, ) -> Result<(), EscrowError>
Validate that a payment is in the correct state for funding
Sourcepub fn validate_payment_for_release(
payment: &Payment,
) -> Result<(), EscrowError>
pub fn validate_payment_for_release( payment: &Payment, ) -> Result<(), EscrowError>
Validate that a payment is in the correct state for release
Sourcepub fn validate_payment_for_refund(payment: &Payment) -> Result<(), EscrowError>
pub fn validate_payment_for_refund(payment: &Payment) -> Result<(), EscrowError>
Validate that a payment is in the correct state for refund
Sourcepub fn validate_payment_for_dispute(
payment: &Payment,
) -> Result<(), EscrowError>
pub fn validate_payment_for_dispute( payment: &Payment, ) -> Result<(), EscrowError>
Validate that a payment is in the correct state for dispute
Sourcepub fn validate_payment_for_arbitration(
payment: &Payment,
) -> Result<(), EscrowError>
pub fn validate_payment_for_arbitration( payment: &Payment, ) -> Result<(), EscrowError>
Validate that a payment is in the correct state for arbitration
Sourcepub fn validate_payment_for_resolution(
payment: &Payment,
) -> Result<(), EscrowError>
pub fn validate_payment_for_resolution( payment: &Payment, ) -> Result<(), EscrowError>
Validate that a payment is in the correct state for resolution
Sourcepub fn calculate_fee(amount: u64, fee_bps: u16) -> u64
pub fn calculate_fee(amount: u64, fee_bps: u16) -> u64
Calculate fee amount based on payment amount and fee basis points
Sourcepub fn calculate_payout(amount: u64, fee_bps: u16) -> u64
pub fn calculate_payout(amount: u64, fee_bps: u16) -> u64
Calculate payout amount after deducting fees
Sourcepub fn is_payment_expired(payment: &Payment) -> bool
pub fn is_payment_expired(payment: &Payment) -> bool
Check if a payment has expired
Sourcepub fn get_payment_state_string(state: u8) -> &'static str
pub fn get_payment_state_string(state: u8) -> &'static str
Get payment state as string
Sourcepub fn get_escrow_state_string(paused: u8) -> &'static str
pub fn get_escrow_state_string(paused: u8) -> &'static str
Get escrow state as string
Sourcepub fn get_payment_accounts(
buyer: Pubkey,
seller: Pubkey,
mint: Pubkey,
payment_uid: &str,
) -> PaymentAccounts
pub fn get_payment_accounts( buyer: Pubkey, seller: Pubkey, mint: Pubkey, payment_uid: &str, ) -> PaymentAccounts
Get all required accounts for a payment operation
Sourcepub fn get_escrow_accounts(mint: Pubkey) -> EscrowAccounts
pub fn get_escrow_accounts(mint: Pubkey) -> EscrowAccounts
Get all required accounts for an escrow operation
Auto Trait Implementations§
impl Freeze for EscrowSdk
impl RefUnwindSafe for EscrowSdk
impl Send for EscrowSdk
impl Sync for EscrowSdk
impl Unpin for EscrowSdk
impl UnsafeUnpin for EscrowSdk
impl UnwindSafe for EscrowSdk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more