Executes a function call on a target contract from within the smart account context.
e - Access to the Soroban environment.target - The address of the contract to call.target_fn - The function name to invoke on the target contract.target_args - Arguments to pass to the target function.Defaults to requiring authorization from the smart account itself
(e.current_contract_address().require_auth()) and then calling
e.invoke_contract().
fn execute(
env: soroban_sdk::Env,
target: soroban_sdk::Address,
target_fn: soroban_sdk::Symbol,
target_args: soroban_sdk::Vec,
)
fn add_policy(
env: soroban_sdk::Env,
context_rule_id: u32,
policy: soroban_sdk::Address,
install_param: soroban_sdk::Val,
) -> u32
The recovery swap primitive — kept, but only on rule 0. Rule 1's signer set is immutable: the guardian must not brick recovery by adding a co-guardian (N-of-N), and an attacker who won rule 0 must not evict the guardian and make the takeover permanent.
fn add_signer(env: soroban_sdk::Env, context_rule_id: u32, signer: Signer) -> u32
fn __check_auth(
env: soroban_sdk::Env,
signature_payload: soroban_sdk::BytesN<32>,
signatures: AuthPayload,
auth_contexts: soroban_sdk::Vec,
) -> Result<(), SmartAccountError>
Deploy with the initial signer set (e.g. one External WebAuthn signer: verifier address + 65-byte P-256 public key) and an optional guardian.
signers/policies populate context rule 0 (Default, "owner") —
a rule without policies requires ALL of its signers (strict N-of-N),
so pass exactly the signers that must co-sign every action.guardian, when present, gets its own context rule
(CallContract(this wallet), "recovery") so it can authorize signer
management for recovery without participating in rule 0. OZ rule
matching is address-wide, but __check_auth below restricts what a
non-owner rule may authorize to add_signer/remove_signer
(CKL F14, narrowed by EAR-W5-2): the guardian cannot spend through
rule 1 and cannot touch the rule topology, so guardian-key
compromise is a visible, recoverable signer swap, not a silent
drain or a permanent fleet-wide seizure.execute_batch via rfn __constructor(
env: soroban_sdk::Env,
signers: soroban_sdk::Vec,
policies: soroban_sdk::Map,
guardian: Option,
)
fn execute_batch(env: soroban_sdk::Env, calls: soroban_sdk::Vec)
Retrieves the global registry ID for a policy.
e - Access to the Soroban environment.policy - The policy address to look up.SmartAccountError::PolicyNotFound] - When the policy is not
registered in the global registry.fn get_policy_id(env: soroban_sdk::Env, policy: soroban_sdk::Address) -> u32
Retrieves the global registry ID for a signer.
e - Access to the Soroban environment.signer - The signer to look up.SmartAccountError::SignerNotFound] - When the signer is not
registered in the global registry.fn get_signer_id(env: soroban_sdk::Env, signer: Signer) -> u32
fn remove_policy(env: soroban_sdk::Env, context_rule_id: u32, policy_id: u32)
See add_signer. Emptying rule 0 is prevented upstream by OZ
(NoSignersAndPolicies — a policy-less rule keeps its last signer).
fn remove_signer(env: soroban_sdk::Env, context_rule_id: u32, signer_id: u32)
fn add_context_rule(
env: soroban_sdk::Env,
context_type: ContextRuleType,
name: soroban_sdk::String,
valid_until: Option,
signers: soroban_sdk::Vec,
policies: soroban_sdk::Map,
) -> ContextRule
Retrieves a context rule by its unique ID, returning the
ContextRule containing all metadata, signers, and policies.
e - Access to the Soroban environment.context_rule_id - The unique identifier of the context rule to
retrieve.SmartAccountError::ContextRuleNotFound] - When no context rule
exists with the given ID.fn get_context_rule(env: soroban_sdk::Env, context_rule_id: u32) -> ContextRule
fn remove_context_rule(env: soroban_sdk::Env, context_rule_id: u32)
Retrieves the number of all context rules, including expired rules. Defaults to 0.
e - Access to the Soroban environment.fn get_context_rules_count(env: soroban_sdk::Env) -> u32
fn update_context_rule_name(
env: soroban_sdk::Env,
context_rule_id: u32,
name: soroban_sdk::String,
) -> ContextRule
fn update_context_rule_valid_until(
env: soroban_sdk::Env,
context_rule_id: u32,
valid_until: Option,
) -> ContextRule