API ReferenceReact componentsFunction
UnconfirmedTransaction()
function UnconfirmedTransaction(props): Element;Beta
Explains a send whose outcome is unknown and gets the user to check their wallet or the block explorer before they retry.
Render it for a wallet-indeterminate
“@anvilresearchlabs/sdk/react”!WorkflowSettlement
in place of the form that started the run: a transaction may already be onchain, so a live submit
button beside a one-line error invites the user to repeat it. The screen never retries by itself.
onRetry fires only after the user says the first transaction did not go through, and when
retryEffect names a consequence they confirm that a second time against a button that arms after a
short delay, so a double-click cannot confirm by accident.
CreateLOCFlow and RedeemLOCFlow render this themselves. Use it directly when your own UI runs the workflow: pass it the result of “@anvilresearchlabs/sdk/react”!getUnconfirmedSend.
Parameters
| Parameter | Type | Description |
|---|---|---|
props | UnconfirmedTransactionProps | What the screen says and what its actions do. |
props.address? | string | Beta The account that sent the transaction, for the explorer link. Read it when the send starts and keep that value: the user can switch accounts while this screen is up, and the link has to keep pointing at the sender. |
props.className? | string | Beta Extra class names for the screen’s outer element. |
props.closeLabel? | string | Beta Label for the onClose button. Defaults to Close. Name where the user lands when that is somewhere specific, such as Back to the form. |
props.explorer? | { name: string; url: string; } | Beta The block explorer for the connected chain: its display name and base url. The screen links to <url>/address/<address>, and renders that link only when both this and address are given. |
props.onClose? | () => void | Beta Called when the user leaves without retrying. Omit it to hide that button where there is nowhere to leave to. |
props.onRetry | () => void | Beta Called when the user has checked and says the transaction did not go through. When retryEffect is set, it fires only after a second confirmation. |
props.retryEffect? | string | Beta What a repeat does if the first send went through, phrased to complete “trying again will …”. When set, the retry is gated behind a confirmation; when absent, a repeat is harmless and the retry is immediate. |
props.step | string | Beta The step whose send outcome is unknown, named as the transaction list showed it. “@anvilresearchlabs/sdk/react”!getUnconfirmedSend derives it from a settlement. |
Returns
Element
Remarks
Beta: it may change or be removed without notice and is not part of the compatibility contract. The provider and hooks are the supported React surface.
Example
import { getUnconfirmedSend, useAnvilSDK, useWorkflowLifecycle,} from '@anvilresearchlabs/sdk/react';import { TransactionsView, UnconfirmedTransaction,} from '@anvilresearchlabs/sdk/components';import type { Address, WalletOperationWorkflow,} from '@anvilresearchlabs/sdk/core';
export function SigningStep({ workflow, sender, onBackToForm, onLeave,}: { workflow: WalletOperationWorkflow; // Read when the run starts. The user can switch accounts while the // screen is up, and the link has to keep pointing at the sender. sender: Address; onBackToForm: () => void; onLeave: () => void;}) { const sdk = useAnvilSDK(); const { operations, settlement } = useWorkflowLifecycle(workflow);
// The send failed in transit: it may be on chain. Replace the signing // view rather than returning to a form with a live submit button. const unconfirmedSend = getUnconfirmedSend(settlement); if (unconfirmedSend) { // Undefined when viem knows no explorer for the chain: no link then. const explorer = sdk.deps.publicClient.chain?.blockExplorers?.default; return ( <UnconfirmedTransaction {...unconfirmedSend} explorer={explorer && { name: explorer.name, url: explorer.url }} address={sender} // Fires only once the user says the first send did not land. onRetry={onBackToForm} // For a user who found that it did land. Say where this goes. onClose={onLeave} closeLabel="Back to your LOCs" /> ); }
return <TransactionsView operations={operations} />;}