Contract d83f73f1f57329793d8419910605abc292023b4f9ec3ae71038247015b5f8eb7

← Back to Index 📥 Download WASM

Meta

cliver 23.2.0#8c559e832fd969aa469784b66e70891fadf94f0a
rssdkver 23.5.1#59fcef437260ed4da42d1efb357137a5c166c02e
rsver 1.94.0-nightly

Interface

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>

Get current recovery request, if any.

fn get_recovery(env: soroban_sdk::Env) -> Option

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>)

Get current guardian configuration. Returns (guardian_addresses, threshold, timelock_seconds).

fn get_guardians(
    env: soroban_sdk::Env,
) -> (soroban_sdk::Vec, u32, u64)

Set guardians who can collectively recover this account. Requires passkey signature. Challenge: SHA256("set_guardians" | threshold | timelock | nonce)

fn set_guardians(
    env: soroban_sdk::Env,
    guardians: soroban_sdk::Vec,
    threshold: u32,
    timelock: u64,
    signature: soroban_sdk::BytesN<64>,
    auth_data: soroban_sdk::Bytes,
    client_data_json: soroban_sdk::Bytes,
)

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 an active recovery request. Requires current passkey signature. Challenge: SHA256("cancel_recovery" | nonce)

fn cancel_recovery(
    env: soroban_sdk::Env,
    signature: soroban_sdk::BytesN<64>,
    auth_data: soroban_sdk::Bytes,
    client_data_json: soroban_sdk::Bytes,
)

A guardian approves the existing recovery request.

fn approve_recovery(env: soroban_sdk::Env, guardian: soroban_sdk::Address)

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

Execute recovery after threshold met + timelock expired. Anyone can call — no auth needed.

fn execute_recovery(env: soroban_sdk::Env)

Get USDC balance of this smart account.

fn get_usdc_balance(env: soroban_sdk::Env) -> i128

Remove all guardians and any active recovery request. Requires passkey signature. Challenge: SHA256("remove_guardians" | nonce)

fn remove_guardians(
    env: soroban_sdk::Env,
    signature: soroban_sdk::BytesN<64>,
    auth_data: soroban_sdk::Bytes,
    client_data_json: soroban_sdk::Bytes,
)

A guardian initiates recovery with a new passkey. If a recovery for a different passkey exists, it is replaced. If same passkey, adds this guardian's approval.

fn initiate_recovery(
    env: soroban_sdk::Env,
    new_passkey: soroban_sdk::BytesN<65>,
    guardian: soroban_sdk::Address,
)

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:

  • Scheduled payments (execute at specific time)
  • Recurring payments (pre-sign multiple with different tx_ids)
  • Out-of-order execution

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,
)

Imports

WebAssembly Text (WAT) ▶