diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx
index 3c3dbef934..1c0369c833 100644
--- a/packages/synapse-interface/components/_Transaction/_Transaction.tsx
+++ b/packages/synapse-interface/components/_Transaction/_Transaction.tsx
@@ -38,7 +38,6 @@ const TimeRemaining = ({
}
interface _TransactionProps {
- synapseSDK: any
connectedAddress: string
originValue: number
originChain: Chain
@@ -48,15 +47,14 @@ interface _TransactionProps {
originTxHash: string
bridgeModuleName: string
estimatedTime: number // in seconds
- kappa?: string
timestamp: number
currentTime: number
- isComplete: boolean
+ kappa?: string
+ isStoredComplete: boolean
}
/** TODO: Update naming after refactoring existing Activity / Transaction flow */
export const _Transaction = ({
- synapseSDK,
connectedAddress,
originValue,
originChain,
@@ -66,13 +64,13 @@ export const _Transaction = ({
originTxHash,
bridgeModuleName,
estimatedTime,
- kappa,
timestamp,
currentTime,
- isComplete,
+ kappa,
+ isStoredComplete,
}: _TransactionProps) => {
const dispatch = useAppDispatch()
- const transactions = use_TransactionsState()
+ const { transactions } = use_TransactionsState()
const [originTxExplorerLink, originExplorerName] = getTxBlockExplorerLink(
originChain.id,
@@ -103,34 +101,41 @@ export const _Transaction = ({
}, [estimatedTime, currentTime, timestamp])
const [isTxComplete, _kappa] = useBridgeTxStatus({
- synapseSDK,
originChainId: originChain.id,
destinationChainId: destinationChain.id,
originTxHash,
bridgeModuleName,
- kappa,
- checkStatus: isEstimatedTimeReached,
+ kappa: kappa,
+ checkStatus: !isStoredComplete || isEstimatedTimeReached,
currentTime: currentTime,
})
+ /** Check if store already marked tx as complete, otherwise check hook status */
+ const isTxCompleted = isStoredComplete ?? isTxComplete
+
/** Update tx kappa when available */
useEffect(() => {
if (_kappa && originTxHash) {
- dispatch(updateTransactionKappa({ originTxHash, kappa: _kappa }))
+ dispatch(
+ updateTransactionKappa({ originTxHash, kappa: _kappa as string })
+ )
}
}, [_kappa, dispatch])
/** Update tx for completion */
/** Check that we have not already marked tx as complete */
useEffect(() => {
- const txKappa = kappa ?? _kappa
+ const txKappa = _kappa
if (isTxComplete && originTxHash && txKappa) {
- if (transactions[originTxHash].isComplete === false) {
- dispatch(completeTransaction({ originTxHash, kappa: txKappa }))
+ const txn = transactions.find((tx) => tx.originTxHash === originTxHash)
+ if (!txn.isComplete) {
+ dispatch(
+ completeTransaction({ originTxHash, kappa: txKappa as string })
+ )
}
}
- }, [isTxComplete, dispatch, transactions])
+ }, [isTxComplete, dispatch, transactions, _kappa])
const handleClearTransaction = useCallback(() => {
dispatch(removeTransaction({ originTxHash }))
@@ -155,22 +160,33 @@ export const _Transaction = ({
/>
-
+
+
+
+ {new Date(timestamp * 1000).toLocaleString('en-US', {
+ hour: '2-digit',
+ minute: '2-digit',
+ second: '2-digit',
+ hour12: true,
+ })}
+ {/*
{typeof _kappa === 'string' && _kappa?.substring(0, 15)}
*/}
+
+
{/* TODO: Update visual format */}
- {isComplete ? (
+ {isTxCompleted ? (
) : (
)}
@@ -192,7 +208,7 @@ export const _Transaction = ({
text="Contact Support"
link="https://discord.gg/synapseprotocol"
/>
- {isComplete && (
+ {isTxComplete && (