/** * A simple func to call a txn and wait for confirmation * @param txn */ import { ContractReceipt } from "ethers"; export const doTransaction = async ( txn: () => Promise<{ wait: (confirmations?: number) => Promise; }> ) => { const tx = await txn(); const event = new CustomEvent("transactionProcessing", { detail: { tx, }, }); document.dispatchEvent(event); const confirmation = await tx.wait(); return confirmation; };