OZTransaction Operations
Transaction operations for OpenZeppelin Smart Accounts.
Provides high-level transaction building, signing, and submission capabilities for smart account operations. Handles:
Token transfers with automatic stroops conversion
Transaction simulation and fee estimation
Authorization entry signing with WebAuthn
Relayer submission for fee sponsoring
Transaction polling and confirmation
Testnet wallet funding via Friendbot
Fee Sponsoring
When a relayer URL is configured via config.relayerUrl, transactions can be fee-sponsored by the relayer. Two modes are used depending on authorization entry types:
Mode 1 (Host Function + Auth): Used when no source_account auth exists. Sends host function and signed auth entries. Transaction is not signed by source account.
Mode 2 (Signed Transaction XDR): Used when source_account auth exists. Sends fully signed transaction XDR. Required for operations that need source account signature.
The mode is automatically selected based on the presence of source_account (Void) credentials in the authorization entries.
This class works in tandem with OZSmartAccountKit and should be accessed via the kit instance rather than instantiated directly.
Example usage:
val kit = OZSmartAccountKit.create(config)
val txOps = OZTransactionOperations(kit)
// Transfer tokens
val result = txOps.transfer(
tokenContract = nativeTokenAddress,
recipient = "GA7Q...",
amount = "100"
)
println("Transfer ${if (result.success) "succeeded" else "failed"}")
// Fund testnet wallet
val fundedAmount = txOps.fundWallet(nativeTokenContract = nativeTokenAddress)
println("Funded with $fundedAmount XLM")See also
for fee sponsoring mode selection logic
for testnet funding with relayer support
Functions
Calls an arbitrary function on an external contract directly from the smart account.
Executes an arbitrary contract function call through the smart account's execute entry point.
Funds the smart account wallet using Friendbot (testnet only).
Submits a host function with full Soroban authorization flow.
Transfers tokens from the smart account to a recipient.