Spend wallet-held asset using spender authorization and stored allowance.
Auth:
Effects:
Notes:
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:
Effects:
Notes:
fn approve(
env: soroban_sdk::Env,
asset: soroban_sdk::Address,
spender: soroban_sdk::Address,
amount: i128,
passkey_sig: Option,
valid_until_ledger: u32,
) -> Result<(), WalletError>
Deposit asset into the wallet.
Auth:
Effects:
Notes:
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 to the latest factory-approved wasm.
Auth:
Effects:
Notes:
fn upgrade(
env: soroban_sdk::Env,
passkey_sig: Option,
valid_until_ledger: u32,
) -> Result<(), WalletError>
Withdraw asset from the wallet to a recipient.
Auth:
Effects:
Notes:
fn withdraw(
env: soroban_sdk::Env,
to: soroban_sdk::Address,
asset: soroban_sdk::Address,
amount: i128,
passkey_sig: Option,
valid_until_ledger: u32,
) -> Result<(), WalletError>
Returns the configured spend limit for an asset.
Audit note:
Returning Option<i128> avoids overloading sentinel values (e.g. 0)
and makes the semantics explicit:
Some(limit) → enforce the configured limitNone → no asset-specific limit configuredfn get_limit(env: soroban_sdk::Env, asset: soroban_sdk::Address) -> Option
Return the linked external owner wallet, if set.
Effects:
Notes:
fn get_owner(env: soroban_sdk::Env) -> Option
Return wallet balance for the specified asset.
Effects:
Notes:
fn get_balance(env: soroban_sdk::Env, asset: soroban_sdk::Address) -> i128
Return the configured factory contract address, if set.
Effects:
Notes:
fn get_factory(env: soroban_sdk::Env) -> Option
Return the stored passkey, if configured.
Effects:
Notes:
fn get_passkey(env: soroban_sdk::Env) -> Option>
Invoke an external contract/dapp through the wallet.
Auth:
Effects:
Notes:
fn dapp_invoker(
env: soroban_sdk::Env,
contract_id: soroban_sdk::Address,
func: soroban_sdk::Symbol,
args: Option>,
auth_vec: Option<
soroban_sdk::Vec>,
>,
passkey_sig: Option,
valid_until_ledger: u32,
) -> Result<(), WalletError>
Return the configured registry contract address, if set.
Effects:
Notes:
fn get_registry(env: soroban_sdk::Env) -> Option
Initialize wallet state and linked contract addresses.
Auth:
Effects:
Notes:
fn __constructor(
env: soroban_sdk::Env,
challenge: soroban_sdk::BytesN<32>,
passkey: soroban_sdk::BytesN<65>,
passkey_sig: PasskeySignature,
rpid_hash: soroban_sdk::BytesN<32>,
bls_keys_pop: soroban_sdk::Vec,
registry: soroban_sdk::Address,
social_router: soroban_sdk::Address,
fee_manager: soroban_sdk::Address,
factory: soroban_sdk::Address,
external_wallet: Option,
) -> Result<(), WalletError>
Return current allowance for a spender on a asset.
Effects:
Notes:
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:
Notes:
fn get_tx_payload(
env: soroban_sdk::Env,
func: soroban_sdk::String,
args: soroban_sdk::Vec,
valid_until_ledger: u32,
) -> Result, WalletError>
Return the configured fee manager contract address, if set.
Effects:
Notes:
fn get_fee_manager(env: soroban_sdk::Env) -> Option
Set a asset-specific spend limit. Auth:
Effects:
Notes:
fn set_asset_limit(
env: soroban_sdk::Env,
asset: soroban_sdk::Address,
limit: i128,
passkey_sig: Option,
valid_until_ledger: u32,
) -> Result<(), WalletError>
Links a (platform, user_id) identity to this wallet in the registry.
Requires wallet authorization before forwarding the request to the registry. The mapping is used to associate an external identity (e.g. X, Discord, Telegram) with the current wallet address.
Validation of platform support, signature threshold, and identity ownership is enforced by the registry contract.
fn add_id_wallet_map(
env: soroban_sdk::Env,
user_id: soroban_sdk::String,
platform_str: soroban_sdk::String,
signatures: soroban_sdk::Vec,
passkey_sig: Option,
valid_until_ledger: u32,
) -> Result<(), WalletError>
Return the configured social router contract address, if set.
Effects:
Notes:
fn get_social_router(env: soroban_sdk::Env) -> Option
Set or replace the linked external owner wallet.
Auth:
Effects:
Notes:
fn set_external_wallet(
env: soroban_sdk::Env,
external_wallet: soroban_sdk::Address,
passkey_sig: Option,
valid_until_ledger: u32,
) -> Result<(), WalletError>
Removes an existing (platform, user_id) identity mapping from the registry.
Requires wallet authorization before forwarding the request to the registry. This operation detaches the external identity from the current wallet address.
Registry-level validation ensures only valid and authorized removals occur.
fn remove_id_wallet_map(
env: soroban_sdk::Env,
user_id: soroban_sdk::String,
platform_str: soroban_sdk::String,
passkey_sig: Option,
valid_until_ledger: u32,
) -> Result<(), WalletError>
Synchronizes wallet protocol dependencies from the currently configured factory.
SECURITY:
fn sync_protocol_dependencies(
env: soroban_sdk::Env,
passkey_sig: Option,
valid_until_ledger: u32,
) -> Result<(), WalletError>