sla-escrow-api
Rust types, instruction codecs, PDA helpers, and EscrowSdk builders for the SLA-Escrow Solana program.
Crates.io · Apache-2.0
Role
declare_id!— Must match the deployed program (rebuild clients after ID changes).instruction— Binary layouts for every opcode (FundPayment,ConfirmOracle,UpdateConfig, …).state—Bank,Config,Escrow,Payment(Paymentincludesoracle_authority_set_at,resolution_hash, timing snapshots, etc.).sdk::EscrowSdk— Instruction builders aligned with the on-chain account order.event— Log-friendly event structs (e.g.PaymentOracleConfirmedEventincludesresolution_hash).consts— Fee caps, timing validation bounds, seeds, optional precomputed PDAs for integrators.
Participants
- Buyer — Funds the payment.
- Seller — Fulfills and submits
delivery_hash. - Oracle —
payment.oracle_authority; signsConfirmOraclewithdelivery_hash, optionalresolution_hash, and resolution/reason. - Bank authority — Admin path: init, open escrow, withdraw fees, pause, update config, authority rotation, etc.
SDK examples
Gross quote (fees + oracle tip)
use EscrowSdk;
let desired_net = 1_000_000u64; // e.g. 1 USDC (6 decimals)
let gross = calculate_gross_quote;
Fund payment (SPL)
use EscrowSdk;
let ix = fund_payment;
Use buyer_tokens: None and mint: Pubkey::default() for native SOL (see fund_payment rustdoc).
Confirm oracle (with attestation hash)
use EscrowSdk;
let ix = confirm_oracle;
Update global config (admin)
use EscrowSdk;
let ix = update_config;
Newly funded payments snapshot these values; existing payments keep their stored copies.
License
Apache License, Version 2.0.