-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
forge script support enabled by #15 and foundry-rs/foundry#12952 is great! However, now the current limiting factor is the webapp UX when signing multiple transactions. After signing a transaction, the app displays the receipt and requires a page reload and wallet reconnection to sign the next tx request generated by the script.
I guess the root cause is that pendingTx state persists after a successful signature/send
foundry-browser-wallet/src/App.tsx
Lines 148 to 187 in 94fd5b9
| // Sign and send the current pending transaction. | |
| const signAndSendCurrentTx = async () => { | |
| if (!selected || !pendingTx?.request) return; | |
| const walletClient = createWalletClient({ | |
| transport: custom(selected.provider), | |
| chain: chain ?? undefined, | |
| }); | |
| try { | |
| const hash = (await selected.provider.request({ | |
| method: "eth_sendTransaction", | |
| params: [pendingTx.request], | |
| })) as `0x${string}`; | |
| setLastTxHash(hash); | |
| await api("/api/transaction/response", "POST", { id: pendingTx.id, hash, error: null }); | |
| const receipt = await waitForTransactionReceipt(walletClient, { hash }); | |
| setLastTxReceipt(receipt); | |
| } catch (e: unknown) { | |
| const msg = | |
| typeof e === "object" && | |
| e && | |
| "message" in e && | |
| typeof (e as { message?: unknown }).message === "string" | |
| ? (e as { message: string }).message | |
| : String(e); | |
| console.error("send failed:", msg); | |
| try { | |
| await api("/api/transaction/response", "POST", { | |
| id: pendingTx.id, | |
| hash: null, | |
| error: msg, | |
| }); | |
| } catch {} | |
| } | |
| }; |
which prevents the polling from restarting. I think we need a way to clear completed request and resume polling for the next request.
I would be happy to contribute, lmk wdyt!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels