submit

suspend fun submit(hostFunction: HostFunctionXdr, auth: List<SorobanAuthorizationEntryXdr>, forceMethod: SubmissionMethod? = null, resolveContextRuleIds: ResolveContextRuleIds? = null): TransactionResult

Submits a host function with full Soroban authorization flow.

Performs the complete transaction lifecycle: simulation, auth entry extraction, WebAuthn signing, re-simulation with signed auth, and submission. This method handles the critical authorization step that allows state-changing operations to succeed on-chain.

Flow:

  1. Require connected wallet (credential ID + contract ID)

  2. Build and simulate the transaction to discover required auth entries

  3. For each auth entry matching the smart account contract:

    • Build the auth payload hash from the entry's nonce and invocation

    • Resolve context rule IDs (automatic or via callback)

    • Compute auth digest: SHA-256(payloadHash || contextRuleIds.toXDR())

    • Authenticate with WebAuthn using the auth digest as challenge

    • Normalize signature and attach to the auth entry

  4. Rebuild transaction with signed auth entries and re-simulate

  5. Assemble, optionally sign with deployer, and submit via relayer or RPC

  6. Poll for on-chain confirmation

Fee Sponsoring and Deployer Signing

The transaction is signed by the deployer keypair in these cases:

  • When no relayer is configured (always sign for direct RPC submission)

  • When using relayer Mode 2 (has source_account auth entries)

The transaction is NOT signed when using relayer Mode 1 (no source_account auth). This allows the relayer to wrap the host function with its own channel account for fee sponsoring.

Relayer Mode Selection

  • Mode 1: Used when auth entries contain only Address credentials. Submits host function + signed auth entries via relayerClient.send().

  • Mode 2: Used when any auth entry has source_account (Void) credentials. Submits fully signed transaction XDR via relayerClient.sendXdr().

IMPORTANT: This method requires WebAuthn interaction to sign auth entries. The user will be prompted for biometric authentication for each auth entry that matches the connected smart account contract.

Return

TransactionResult indicating success or failure

Parameters

hostFunction

The host function to execute

auth

Authorization entries for the transaction (typically empty; simulation provides them)

forceMethod

Optional override to force relayer or RPC submission (default: auto-detect)

resolveContextRuleIds

Optional callback to resolve context rule IDs per auth entry. When null (default), rule IDs are resolved automatically from the connected signer and available context rules. Provide a callback when automatic resolution is ambiguous or to bypass auto-resolution entirely.

See also

OZTransactionOperations.shouldUseRelayerMode2

for mode selection logic

Throws

if no wallet is connected

if configuration is invalid

if simulation, signing, or submission fails

if biometric authentication fails

if credential lookup fails during signing