UPGRADE: Upgrade the contract WASM to a new version. Requires passkey signature. Challenge: SHA256("upgrade" | new_wasm_hash | nonce)
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
signature: soroban_sdk::BytesN<64>,
auth_data: soroban_sdk::Bytes,
client_data_json: soroban_sdk::Bytes,
)
Read current nonce (kept for backwards compatibility with immediate transfers).
fn get_nonce(env: soroban_sdk::Env) -> u64
Check if a transaction ID has been used. Returns true if the tx_id has already been executed.
fn is_tx_used(env: soroban_sdk::Env, tx_id: soroban_sdk::BytesN<32>) -> bool
STREAM PAY: Transfer USDC with name, comment metadata and 0.03% fee. Same passkey verification as transfer_usdc. Emits an event with all details. Fee (0.03% of amount) goes to FEE_RECIPIENT, remainder goes to recipient.
fn stream_pay(
env: soroban_sdk::Env,
name: soroban_sdk::String,
comment: soroban_sdk::String,
recipient: soroban_sdk::Address,
amount: i128,
signature: soroban_sdk::BytesN<64>,
auth_data: soroban_sdk::Bytes,
client_data_json: soroban_sdk::Bytes,
)
Read the stored passkey pubkey (for debugging/verification).
fn get_passkey(env: soroban_sdk::Env) -> soroban_sdk::BytesN<65>
fn __check_auth(
env: soroban_sdk::Env,
signature_payload: soroban_sdk::BytesN<32>,
signature: ZkAuthSignature,
auth_context: soroban_sdk::Vec,
) -> Result<(), soroban_sdk::Error>
Constructor: Initialize the contract with the passkey secp256r1 public key (65-byte uncompressed). This is called automatically when the contract is deployed via factory with constructor_args.
fn __constructor(env: soroban_sdk::Env, passkey_pubkey: soroban_sdk::BytesN<65>)
IMMEDIATE TRANSFER: Transfer USDC using sequential nonce (for backwards compatibility). Only the registered passkey can authorize.
fn transfer_usdc(
env: soroban_sdk::Env,
recipient: soroban_sdk::Address,
amount: i128,
signature: soroban_sdk::BytesN<64>,
auth_data: soroban_sdk::Bytes,
client_data_json: soroban_sdk::Bytes,
)
CANCEL SCHEDULED TRANSFER: Cancel a pending scheduled payment.
The user must sign to prove ownership. Once cancelled, the tx_id is marked as used and can never be executed.
The challenge format: SHA256("cancel_scheduled" | tx_id)
tx_id: The transaction ID to cancel
fn cancel_scheduled(
env: soroban_sdk::Env,
tx_id: soroban_sdk::BytesN<32>,
signature: soroban_sdk::BytesN<64>,
auth_data: soroban_sdk::Bytes,
client_data_json: soroban_sdk::Bytes,
) -> bool
Get USDC balance of this smart account.
fn get_usdc_balance(env: soroban_sdk::Env) -> i128
SCHEDULED TRANSFER: Transfer USDC using a unique tx_id (for scheduled/auto-pay).
This version uses a unique transaction ID instead of sequential nonce, allowing transactions to be executed in ANY order.
Each tx_id can only be used once. Perfect for:
The challenge format: SHA256("scheduled_transfer" | recipient | amount | tx_id | deadline)
tx_id: A unique 32-byte identifier (e.g., random bytes or hash of tx details)
deadline: Unix timestamp after which this tx is invalid (0 = no deadline)
fn scheduled_transfer(
env: soroban_sdk::Env,
recipient: soroban_sdk::Address,
amount: i128,
tx_id: soroban_sdk::BytesN<32>,
deadline: u64,
signature: soroban_sdk::BytesN<64>,
auth_data: soroban_sdk::Bytes,
client_data_json: soroban_sdk::Bytes,
)