On-chain transactions must never freeze navigation or block the UI. Signing and broadcast typically take a few seconds, but receipt confirmation can take minutes on a congested network. Pacto handles this by broadcasting the transaction, releasing the UI immediately, and then continuing receipt polling entirely in the background — surfacing results via toasts and in-place card updates when they arrive.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/covenant-gov/pacto-app/llms.txt
Use this file to discover all available pages before exploring further.
Core rules
Four rules govern every on-chain action in Pacto:- Broadcast, then release the UI. Once the signed transaction is submitted to the mempool, close modals and re-enable panels so the user can keep working.
- Show honest pending state. Use toasts (“submitted — confirmation continues in the background”), pending badges on DM wallet cards, and dashboard placeholders. Never claim final success before a confirmed receipt.
- Poll receipts off the critical path. Use
wallet_wait_for_transaction(or domain-specific finalize logic) from a background task. Receipt polling times out after 180 seconds (RECEIPT_WAIT_TIMEOUTinwallet_ops.rs). On timeout, returnRECEIPT_TIMEOUTwith thetxHashwhen known. - Permanent DM announcements follow the optimistic two-phase pattern: append a local pending card immediately after broadcast, then patch it to confirmed (or failed) once the receipt arrives.
Backend commands
| Command | Default | Notes |
|---|---|---|
wallet_build_and_send_transaction | waitForConfirmation: false | Returns txHash after broadcast; optionally returns blockNumber when waitForConfirmation: true. |
wallet_wait_for_transaction | — | Polls receipt. Returns the same result shape as a confirmed send. |
evm_send_advanced_contract_call | waitForConfirmation: false | Used by the Settings → Advanced panel. |
evm_send_squad_allowlisted_contract_call | waitForConfirmation: false | Dashboard allowlist sends via squad-purpose signer. |
| Deploy / governance commands | Receipt-wait internal | UI closes immediately; the invoke runs in a background job via runOnChainInBackground. |
Frontend helpers
src/lib/evm/on-chain-background.ts provides the shared primitives for non-blocking on-chain work:
runOnChainInBackground— queues long-running Tauri invokes such as deploy wizards and squad admin writes so they don’t block the UI thread.waitForOnChainConfirmationInBackground— polls for a receipt after a broadcast-only send; drives the optimistic card lifecycle.toastOnChainSubmitted— shows a “submitted” toast with an explorer link after broadcast.toastOnChainConfirmed— shows a success toast once the receipt arrives.toastOnChainFailed— shows a failure toast on revert or timeout.
finalizeWalletDmTransferAfterBroadcast in src/lib/wallet/wallet-dm-transfer.ts to drive the optimistic card state machine.
DM wallet transfers — optimistic flow
Sending tokens from the WalletBar in a DM thread follows a seven-step optimistic lifecycle:- Broadcast the transaction via
wallet_build_and_send_transaction(waitForConfirmation: false). - Immediately append a local outbound DM row with
pending: trueand awallet_tx_announcementpayload — the card shows a “Transfer pending” badge. - Close the send modal; show a toast with the explorer link.
- Background: call
wallet_wait_for_transactionto poll for the receipt. - On success: patch the local row to its confirmed content; relay the same
wallet_tx_announcementJSON to the peer via Nostr; refresh balances; show a confirmation toast. - On revert: patch the local row to
failed: true; show a failure toast. - On timeout: leave the card pending; show a toast telling the user to check the explorer. Do not claim success.
Inbound announcements relayed from peers are post-receipt only — they are never upgraded from a pending state. The optimistic two-phase pattern applies only to locally-originated sends.
UX stage reference
| Stage | User sees |
|---|---|
| Confirm clicked | Brief signing / submit state (typically a few seconds). |
| Tx broadcast | Modal closes (or panel unlocks); toast with hash and explorer link; DM card shows pending badge. |
| Receipt success | Toast confirmation; pending UI updates to confirmed; DM announcement relayed to peer. |
| Receipt failure (revert) | Toast with failure message; DM card shows failed badge. |
| Timeout (180 s) | Toast prompting user to check explorer; DM card remains in pending state. |