sendTransaction and callContract are alternate inputs to one lifecycle: prepare, resolve any fee requirement, execute, and wait for status by default.
Send native value
Amounts are raw base-unit integer strings. UseparseUnits to convert display values without floating-point arithmetic.
.relayer, and waitForStatus defaults to true.
Send encoded calldata
UseSendTransactionRequest when you already have calldata. value remains a raw base-unit string.
parseUnits defaults to 18 decimals and rounds excess fractional precision to the nearest base unit. Invalid values and negative decimal counts throw UnitConversionError.
Call an ABI method
UsecallContract when you have a method signature and typed arguments instead of encoded calldata.
Resolve fees during preparation
Preparation tells the SDK whether the transaction is sponsored. Sponsored preparations execute without a fee selection. An unsponsored preparation must include fee options. Testnet transaction fees are sponsored. On mainnet, the preparation response may instead require fee selection. With no selector, the SDK chooses the first fee option returned by OMS. This default does not compare the option with the wallet’s balance. Use.firstAvailable to query indexer balances and choose the first option whose raw available balance covers its quoted fee.
FeeOptionWithBalance.availableRaw is the base-unit balance used for comparison. available is formatted for display when token decimals are known.
These fee-selection examples use Polygon mainnet. Fund the wallet for any returned fee option your app selects.
Interpret the result
SendTransactionResponse always contains the OMS txnId, the latest status, and statusResolution. txnHash is optional until an onchain hash is available.
A resolved result can still have
status == .failed. Check both status and resolution.
Return after execution
SetwaitForStatus: false when your app wants to persist txnId immediately after the execute call and manage status separately.
getTransactionStatus also requires the active wallet session and credential.
To change the default wait, pass TransactionStatusPollingOptions. The SDK defaults to a 60-second timeout, uses short initial intervals, and then polls every two seconds.
Handle uncertain execution and cancellation
The SDK preservesCancellationError instead of wrapping it. Cancelling a Swift task stops the local SDK operation or status wait. It does not cancel a transaction that may already have been submitted. When your UI needs a cancellable wait with a durable identifier, submit with waitForStatus: false, persist txnId, and poll in a separate task.
Transaction-specific OMSWalletError codes carry recovery context:
.transactionExecutionUnconfirmed; the original transaction may have been submitted.