diff --git a/src/hooks/transactions/index.tsx b/src/hooks/transactions/index.tsx index bd1547bc8..5c8d97a9b 100644 --- a/src/hooks/transactions/index.tsx +++ b/src/hooks/transactions/index.tsx @@ -66,7 +66,7 @@ export function useIsPendingApproval(token?: Token): boolean { } export type OnTxSubmit = (hash: string, tx: Transaction) => void -export type OnTxSuccess = (hash: string, receipt: TransactionReceipt) => void +export type OnTxSuccess = (hash: string, tx: WithRequired) => void export type OnTxFail = (hash: string, receipt: TransactionReceipt) => void export interface TransactionEventHandlers { @@ -102,10 +102,13 @@ export function TransactionsUpdater({ onTxSubmit, onTxSuccess, onTxFail }: Trans if (receipt.status === 0) { onTxFail?.(hash, receipt) } else { - onTxSuccess?.(hash, receipt) + onTxSuccess?.(hash, { + ...currentPendingTxs[hash], + receipt, + }) } }, - [updateTxs, onTxFail, onTxSuccess] + [updateTxs, onTxFail, onTxSuccess, currentPendingTxs] ) const oldPendingTxs = useRef({}) diff --git a/src/widgets.d.ts b/src/widgets.d.ts index e8f69a830..7c66631fa 100644 --- a/src/widgets.d.ts +++ b/src/widgets.d.ts @@ -41,3 +41,5 @@ declare module '*.svg' { const src: string export default src } + +type WithRequired = Omit & Required>