submitFlowTransaction
Prepares, signs, and broadcasts a flow transaction in one call. This is the recommended way to submit — it handles the full sequence:
- Calls
prepareFlowSigning to lock the quote and get the signing payload
- Switches the wallet to the correct network
- Signs the transaction (including ERC-20 approval if needed)
- Calls
broadcastFlow with the resulting txHash
When to call
Call submitFlowTransaction when executionState is quoted. The function starts by calling prepareFlowSigning, which requires that state.
Before retrying after an interruption or network error, call getFlow:
- If the flow is still
quoted, you can call submitFlowTransaction again.
- If it is
signing, first determine whether the wallet submitted a transaction. If you have its transaction hash, call broadcastFlow to record it. If no transaction was submitted, call getFlowQuote to return to quoted with a new quote, then submit again.
- If it is
broadcasted or source_confirmed, the transaction has already been submitted. Poll the flow instead.
- If it is
cancelled, expired, or failed, create a new flow for another attempt.
Do not retry submitFlowTransaction without checking state. Calling it after
the flow has advanced from quoted returns 409 and can prompt the user to
repeat signing unnecessarily.
Usage
Parameters
Returns
Promise<Flow> — the flow after broadcast, with executionState: 'broadcasted' and txHash populated.
Examples
Basic submission
With balance assertions and step tracking
Handle wallet rejection
React