Skip to main content
Transaction writes require an active wallet session with a wallet of the method’s network family. sendTransaction and callContract are alternate inputs to one lifecycle: prepare, resolve any fee requirement, execute, and wait for status by default. The Solana and Tron methods use the same lifecycle.

Send native value

Amounts are raw base-unit integer strings. Use parseUnits to convert display values without floating-point arithmetic.
The default transaction mode is .relayer, and waitForStatus defaults to true.

Send encoded calldata

Use SendTransactionRequest when you already have calldata. value remains a raw base-unit string.
parseUnits requires the token’s decimals and rounds excess fractional precision to the nearest base unit. Invalid values and negative decimal counts throw UnitConversionError.

Call an ABI method

Use callContract when you have a method name and typed arguments instead of encoded calldata. Pass the bare function name, such as "transfer". The wallet service builds the signature from the argument types, and the SDK rejects a full signature such as "transfer(address,uint256)" with .validationError before sending a request.
args defaults to nil, so omit it for a method without arguments. Both forms prepare and execute through the same fee and status code path.

Send a Solana transfer

Use sendSolanaTransfer with a selected Solana wallet. Set asset to SOL for a native transfer or to an SPL token mint address. amount is an integer string in the asset’s smallest unit: lamports for SOL or base units for an SPL token.
For an SPL transfer, to is the recipient wallet address, not an associated token account. Solana transfers accept the same execution mode, fee selector, wait setting, and polling options.

Send a Tron transaction

Use sendTronTransaction and callTronContract with a selected Tron wallet on TronNetwork.mainnet or .nile. Tron addresses are Base58Check strings that start with T. Tron wallets always execute in native mode, so these methods take no mode parameter. TRC-10 tokens are not supported. value is a raw integer string in sun (1 TRX is 1,000,000 sun) and defaults to "0".
Omitting data sends a plain TRX transfer. Passing data, even "0x", makes the transaction a contract call. Use callTronContract for a TRC-20 or other contract call. Pass the bare method name; the wallet service ABI-encodes the call, and address arguments accept Base58Check addresses.
Tron transactions report .pending with a txnHash until the block is solidified, which takes about a minute, so the default status wait returns as soon as the hash is available.

Resolve fees during preparation

Preparation tells the SDK whether the transaction is sponsored. When you provide a selector, a sponsored preparation calls it with an empty array. Return nil to continue with the sponsored transaction, or throw to stop execution. .firstAvailable handles the empty array. An unsponsored preparation must include fee options. For EVM and Solana, whether a transaction is sponsored is decided by your project’s settings, not by your application. See Gas Sponsorship. Each Tron account gets free bandwidth every day, so many Tron transactions need no fee. When it is used up, the fee is a single TRX option that your selector receives like any other. 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. It works for EVM, Solana, and Tron fee options.
Use a custom selector when your UI or policy chooses the fee token.
FeeOptionWithBalance.availableRaw is the base-unit balance used for comparison. available is formatted for display when token decimals are known, and decimals is the decimal count used for formatting. For EVM fees, balance contains the matching TokenBalance when available.
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

Set waitForStatus: 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 preserves CancellationError 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 tell you what to do next:
Do not automatically resend after .transactionExecutionUnconfirmed; the original transaction may have been submitted. .requestFailed without a txnId means nothing was submitted. For example, simulation shows the transaction would revert (upstreamError?.code == "7314"), or a Tron wallet cannot cover the transfer and its fee. upstreamError?.cause gives the wallet API’s reason when it has one. Fix the cause, then prepare the transaction again. A wallet API call that takes longer than 30 seconds also fails with one of these errors.