Execute a function on a target contract.
This provides a secure mechanism for the smart account to invoke functions on other contracts, such as updating policy configurations. Requires smart account authorization.
target - Address of the contract to invoketarget_fn - Function name to call on the target contracttarget_args - Arguments to pass to the target functionfn execute(
env: soroban_sdk::Env,
target: soroban_sdk::Address,
target_fn: soroban_sdk::Symbol,
target_args: soroban_sdk::Vec,
)
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
operator: soroban_sdk::Address,
)
Add a policy to an existing context rule.
Requires smart account authorization.
fn add_policy(
env: soroban_sdk::Env,
context_rule_id: u32,
policy: soroban_sdk::Address,
install_param: soroban_sdk::Val,
)
Add a signer to an existing context rule.
Requires smart account authorization.
fn add_signer(env: soroban_sdk::Env, context_rule_id: u32, signer: Signer)
Verify authorization for the smart account.
This function is called by the Soroban host when authorization is required. It validates signatures against the configured context rules and policies.
signature_payload - Hash of the data that was signedsignatures - Map of signers to their signature dataauth_contexts - Contexts being authorized (contract calls,
deployments, etc.)Ok(()) if authorization succeedsErr(SmartAccountError) if authorization failsfn __check_auth(
env: soroban_sdk::Env,
signature_payload: soroban_sdk::BytesN<32>,
signatures: Signatures,
auth_contexts: soroban_sdk::Vec,
) -> Result<(), soroban_sdk::Error>
Creates a default context rule with the provided signers and policies.
signers - Vector of signers (Delegated or External) that can
authorize transactionspolicies - Map of policy contract addresses to their installation
parametersfn __constructor(
env: soroban_sdk::Env,
signers: soroban_sdk::Vec,
policies: soroban_sdk::Map,
)
Remove a policy from an existing context rule.
Requires smart account authorization.
fn remove_policy(
env: soroban_sdk::Env,
context_rule_id: u32,
policy: soroban_sdk::Address,
)
Remove a signer from an existing context rule.
Requires smart account authorization.
fn remove_signer(env: soroban_sdk::Env, context_rule_id: u32, signer: Signer)
Add a new context rule to the smart account.
Requires smart account authorization.
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
Retrieve a specific context rule by its ID.
fn get_context_rule(env: soroban_sdk::Env, context_rule_id: u32) -> ContextRule
Retrieve all context rules of a specific type.
fn get_context_rules(
env: soroban_sdk::Env,
context_rule_type: ContextRuleType,
) -> soroban_sdk::Vec
Remove a context rule from the smart account.
Requires smart account authorization.
fn remove_context_rule(env: soroban_sdk::Env, context_rule_id: u32)
Retrieve the number of all context rules, including the expired ones.
fn get_context_rules_count(env: soroban_sdk::Env) -> u32
Update the name of an existing context rule.
Requires smart account authorization.
fn update_context_rule_name(
env: soroban_sdk::Env,
context_rule_id: u32,
name: soroban_sdk::String,
) -> ContextRule
Update the expiration time of an existing context rule.
Requires smart account authorization.
fn update_context_rule_valid_until(
env: soroban_sdk::Env,
context_rule_id: u32,
valid_until: Option,
) -> ContextRule