Contract 21970f086287da193e88c412b1ffa7aa470afbea9990eac9b1c8d1fcd7c3940e

← Back to Index 📥 Download WASM

Meta

rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.91.0

Interface

Spend wallet-held asset using spender authorization and stored allowance.

Auth:

  • Requires direct authorization from the spender address.

Effects:

  • Consumes allowance and transfers asset to the recipient.

Notes:

  • Rejects non-positive amounts. -spend_asset validates allowance, reduces it correctly, and transfers from wallet-controlled balance.
fn spend(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    to: soroban_sdk::Address,
) -> Result<(), WalletError>

Approve a spender to use wallet-held asset up to a given amount.

Auth:

  • Requires owner authorization through the wallet auth flow.

Effects:

  • Writes or updates spender allowance for the specified asset.

Notes:

  • Rejects negative amounts.
  • Enforces the configured asset spend limit.
fn approve(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    tx_signature: Option>,
) -> Result<(), WalletError>

Deposit asset into the wallet.

Auth:

  • Requires authorization from the source address.

Effects:

  • Pulls asset from the source address into wallet-controlled balance.

Notes:

  • Rejects non-positive amounts. -take_asset transfers funds into the current contract context.
fn deposit(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    asset: soroban_sdk::Address,
    amount: i128,
) -> Result<(), WalletError>

Upgrade the current contract wasm.

Auth:

  • Requires owner authorization through the wallet auth flow.

Effects:

  • Replaces the currently deployed contract code.

Notes:

  • Payload includes wasm hash and nonce to prevent replay.
fn upgrade(
    env: soroban_sdk::Env,
    wasm: soroban_sdk::BytesN<32>,
    tx_signature: Option>,
) -> Result<(), WalletError>

Withdraw asset from the wallet to a recipient.

Auth:

  • Requires owner authorization through the wallet auth flow.

Effects:

  • Transfers asset from wallet balance to the recipient.
  • Quote and apply transaction fees before the transfer.

Notes:

  • Rejects non-positive amounts.
  • Enforces the configured asset spend limit.
fn withdraw(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
    asset: soroban_sdk::Address,
    amount: i128,
    tx_signature: Option>,
) -> Result<(), WalletError>

Return the current authorization nonce.

Effects:

  • Reads nonce state from storage.

Notes:

  • Used by off-chain signers to build replay-safe payloads.
fn get_nonce(env: soroban_sdk::Env) -> u64

Return the linked external owner wallet, if set.

Effects:

  • Reads owner state from storage.

Notes:

  • Read-only helper.
fn get_owner(env: soroban_sdk::Env) -> Option

Set a asset-specific spend limit. Auth:

  • Requires owner authorization through the wallet auth flow.

Effects:

  • Stores a per-asset limit override.

Notes:

  • Rejects negative values.
  • This value overrides the default limit for the specified asset.
  • Payload includes asset, limit, and nonce to prevent replay.
fn set_limit(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    limit: i128,
    tx_signature: Option>,
) -> Result<(), WalletError>

Return wallet balance for the specified asset.

Effects:

  • Reads asset balance associated with the wallet.

Notes:

  • Read-only helper.
fn get_balance(env: soroban_sdk::Env, asset: soroban_sdk::Address) -> i128

Return the configured factory contract address, if set.

Effects:

  • Reads factory reference from storage.

Notes:

  • Read-only helper.
fn get_factory(env: soroban_sdk::Env) -> Option

Return the stored passkey, if configured.

Effects:

  • Reads passkey state from storage.

Notes:

  • Read-only helper.
fn get_passkey(env: soroban_sdk::Env) -> Option>

Invoke an external contract/dapp through the wallet.

Auth:

  • Requires owner authorization through the wallet auth flow.

Effects:

  • Optionally enforces additional invocation auth rules when applicable.
  • Performs an external contract call with the provided function and args.

Notes:

  • Payload includes contract, function, args, auth payload, and nonce.
fn dapp_invoker(
    env: soroban_sdk::Env,
    contract_id: soroban_sdk::Address,
    func: soroban_sdk::Symbol,
    args: Option>,
    auth_vec: Option<
        soroban_sdk::Vec>,
    >,
    tx_signature: Option>,
) -> Result<(), WalletError>

Return the configured registry contract address, if set.

Effects:

  • Reads registry reference from storage.

Notes:

  • Read-only helper.
fn get_registry(env: soroban_sdk::Env) -> Option

Initialize wallet state and linked contract addresses.

Auth:

  • Intended to run once during wallet deployment/creation.

Effects:

  • Stores access keys and linked contract references.
  • Marks the wallet as initialized.

Notes:

  • Reverts if initialization was already completed.
fn __constructor(
    env: soroban_sdk::Env,
    passkey: soroban_sdk::BytesN<77>,
    bls_keys: soroban_sdk::Vec>,
    registry: soroban_sdk::Address,
    fee_manager: soroban_sdk::Address,
    social_router: soroban_sdk::Address,
    factory: soroban_sdk::Address,
) -> Result<(), WalletError>

Return current allowance for a spender on a asset.

Effects:

  • Reads allowance state from storage.

Notes:

  • Read-only helper.
fn get_allowance(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128

Compute the authorization payload hash for a function call.

Effects:

  • Returns the payload derived from function name, args, and nonce.

Notes:

  • Read-only helper for off-chain signing flows.
  • Reviewers should confirm payload construction matches verification logic.
fn get_tx_payload(
    env: soroban_sdk::Env,
    func: soroban_sdk::String,
    args: soroban_sdk::Vec,
) -> soroban_sdk::BytesN<32>

Return the configured fee manager contract address, if set.

Effects:

  • Reads fee manager reference from storage.

Notes:

  • Read-only helper.
fn get_fee_manager(env: soroban_sdk::Env) -> Option

Return the configured social router contract address, if set.

Effects:

  • Reads social router reference from storage.

Notes:

  • Read-only helper.
fn get_social_router(env: soroban_sdk::Env) -> Option

Set or replace the linked external owner wallet.

Auth:

  • Requires owner authorization through the wallet bls auth flow.

Effects:

  • Updates the stored external owner address.

Notes:

  • Payload includes the new address and nonce to prevent replay.
fn set_external_wallet(
    env: soroban_sdk::Env,
    external_wallet: soroban_sdk::Address,
    tx_signature: Option>,
) -> Result<(), WalletError>

Update the default spend limit used by asset operations.

Auth:

  • Requires owner authorization through the wallet auth flow.

Effects:

  • Replaces the default spend limit in storage.

Notes:

  • Rejects negative values.
  • This default is used when no asset-specific limit is configured.
fn update_default_limit(
    env: soroban_sdk::Env,
    limit: i128,
    tx_signature: Option>,
) -> Result<(), WalletError>

Return wallet access settings.

Effects:

  • Reads the default spend limit and linked external owner from storage.

Notes:

  • Read-only helper for clients and integrations.
fn get_account_parameters(env: soroban_sdk::Env) -> AccessSettings

Imports

WebAssembly Text (WAT) ▶