From 69611a4c3b7ba500d9a80b8565f616dc541effd6 Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 13:51:47 -0500 Subject: [PATCH 01/24] Sorting wip --- .../components/_Transaction/_Transaction.tsx | 46 +++++++++++------- .../components/_Transaction/_Transactions.tsx | 13 +++-- .../helpers/useBridgeTxStatus.tsx | 47 ++++++++++++------- 3 files changed, 67 insertions(+), 39 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx index 3c3dbef934..3abb3892d1 100644 --- a/packages/synapse-interface/components/_Transaction/_Transaction.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transaction.tsx @@ -48,10 +48,9 @@ interface _TransactionProps { originTxHash: string bridgeModuleName: string estimatedTime: number // in seconds - kappa?: string timestamp: number currentTime: number - isComplete: boolean + // isComplete: boolean } /** TODO: Update naming after refactoring existing Activity / Transaction flow */ @@ -66,11 +65,10 @@ export const _Transaction = ({ originTxHash, bridgeModuleName, estimatedTime, - kappa, timestamp, currentTime, - isComplete, -}: _TransactionProps) => { +}: // isComplete, +_TransactionProps) => { const dispatch = useAppDispatch() const transactions = use_TransactionsState() @@ -108,11 +106,14 @@ export const _Transaction = ({ destinationChainId: destinationChain.id, originTxHash, bridgeModuleName, - kappa, + kappa: null, checkStatus: isEstimatedTimeReached, currentTime: currentTime, }) + console.log(`isTxComplete, `, isTxComplete) + console.log(`_kappa`, _kappa) + /** Update tx kappa when available */ useEffect(() => { if (_kappa && originTxHash) { @@ -122,15 +123,15 @@ export const _Transaction = ({ /** Update tx for completion */ /** Check that we have not already marked tx as complete */ - useEffect(() => { - const txKappa = kappa ?? _kappa + // useEffect(() => { + // const txKappa = _kappa - if (isTxComplete && originTxHash && txKappa) { - if (transactions[originTxHash].isComplete === false) { - dispatch(completeTransaction({ originTxHash, kappa: txKappa })) - } - } - }, [isTxComplete, dispatch, transactions]) + // if (isTxComplete && originTxHash && txKappa) { + // if (transactions[originTxHash].isComplete === false) { + // dispatch(completeTransaction({ originTxHash, kappa: txKappa })) + // } + // } + // }, [isTxComplete, dispatch, transactions]) const handleClearTransaction = useCallback(() => { dispatch(removeTransaction({ originTxHash })) @@ -161,16 +162,27 @@ export const _Transaction = ({ tokenAmount={null} isOrigin={false} /> +
+
+ {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 ? ( + {isTxComplete ? ( ) : ( )}
@@ -192,7 +204,7 @@ export const _Transaction = ({ text="Contact Support" link="https://discord.gg/synapseprotocol" /> - {isComplete && ( + {isTxComplete && ( { + return _.orderBy(transactionsArray, ['timestamp'], ['desc']) + }, [transactionsArray]).slice(0, 5) + if (hasTransactions) { return (
- {transactionsArray.map((tx: _TransactionDetails) => ( + {sortedTransactions.map((tx: _TransactionDetails) => ( <_Transaction synapseSDK={synapseSDK} connectedAddress={connectedAddress} @@ -49,10 +54,10 @@ export const _Transactions = ({ originTxHash={tx.originTxHash} bridgeModuleName={tx.bridgeModuleName} estimatedTime={tx.estimatedTime} - kappa={tx?.kappa} + // kappa={tx?.kappa} timestamp={tx.timestamp} currentTime={currentTime} - isComplete={tx.isComplete} + // isComplete={tx.isComplete} /> ))}
diff --git a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx index d3c5901e58..382e69b72f 100644 --- a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx +++ b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx @@ -34,6 +34,7 @@ export const useBridgeTxStatus = ({ bridgeModuleName, originTxHash ) + console.log(`getKappa:`) return kappa } catch (error) { console.error('Error in getKappa:', error) @@ -54,6 +55,9 @@ export const useBridgeTxStatus = ({ bridgeModuleName, kappa ) + + console.log(`statsuklafjdslkj`, status) + return status } catch (error) { console.error('Error in getBridgeTxStatus:', error) @@ -62,31 +66,38 @@ export const useBridgeTxStatus = ({ } useEffect(() => { - if (!checkStatus) return - if (isComplete) return + // if (!checkStatus) return + // if (isComplete) return ;(async () => { - let _kappa - - if (!kappa) { - console.log('fetching kappa') - _kappa = await getKappa() + if (fetchedKappa === null) { + let _kappa = await getKappa() setFetchedKappa(_kappa) - } else { - _kappa = kappa } - console.log('fetching tx status') - const txStatus = await getBridgeTxStatus( - destinationChainId, - bridgeModuleName, - _kappa - ) + if (fetchedKappa) { + const txStatus = await getBridgeTxStatus( + destinationChainId, + bridgeModuleName, + fetchedKappa + ) + + console.log(`destinationChainID`, destinationChainId) + console.log(`bridgeModuleName`, bridgeModuleName) + console.log(`fetchedKappa`, fetchedKappa) + + console.log('--======---') + console.log(`txStatus`, txStatus) + console.log(`fetchedKappa`, fetchedKappa) + console.log('--======---') - if (txStatus !== null) { - setIsComplete(txStatus) + if (txStatus !== null && txStatus === true && fetchedKappa !== null) { + setIsComplete(true) + } else { + setIsComplete(false) + } } })() - }, [currentTime, checkStatus]) + }, [currentTime, checkStatus, fetchedKappa]) return [isComplete, fetchedKappa] } From 46c02e1292ffbe3fddbe17113b352f071a0abc8c Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Sun, 7 Jan 2024 12:13:47 -0800 Subject: [PATCH 02/24] Show by latest --- .../components/_Transaction/_Transactions.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transactions.tsx b/packages/synapse-interface/components/_Transaction/_Transactions.tsx index 3b238c3ae3..fc58b87133 100644 --- a/packages/synapse-interface/components/_Transaction/_Transactions.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transactions.tsx @@ -35,14 +35,14 @@ export const _Transactions = ({ } }, []) - const sortedTransactions = useMemo(() => { - return _.orderBy(transactionsArray, ['timestamp'], ['desc']) - }, [transactionsArray]).slice(0, 5) + // const sortedTransactions = useMemo(() => { + // return _.orderBy(transactionsArray, ['timestamp'], ['desc']) + // }, [transactionsArray]).slice(0, 5) if (hasTransactions) { return ( -
- {sortedTransactions.map((tx: _TransactionDetails) => ( +
+ {transactionsArray.map((tx: _TransactionDetails) => ( <_Transaction synapseSDK={synapseSDK} connectedAddress={connectedAddress} From 820815b8846e01f95043d5f1b6a8b60973b211b1 Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 15:19:30 -0500 Subject: [PATCH 03/24] Merging sorting-j --- .../components/_Transaction/_Transactions.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transactions.tsx b/packages/synapse-interface/components/_Transaction/_Transactions.tsx index fc58b87133..aa8097a256 100644 --- a/packages/synapse-interface/components/_Transaction/_Transactions.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transactions.tsx @@ -1,4 +1,3 @@ -import _ from 'lodash' import { useState, useEffect, useMemo } from 'react' import { use_TransactionsState } from '@/slices/_transactions/hooks' import { _TransactionDetails } from '@/slices/_transactions/reducer' @@ -35,14 +34,10 @@ export const _Transactions = ({ } }, []) - // const sortedTransactions = useMemo(() => { - // return _.orderBy(transactionsArray, ['timestamp'], ['desc']) - // }, [transactionsArray]).slice(0, 5) - if (hasTransactions) { return (
- {transactionsArray.map((tx: _TransactionDetails) => ( + {transactionsArray.slice(0, 5).map((tx: _TransactionDetails) => ( <_Transaction synapseSDK={synapseSDK} connectedAddress={connectedAddress} From 8b79ae6849ac11265f80be17979c85304157be24 Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 15:26:51 -0500 Subject: [PATCH 04/24] Hides debugging related kappa and time --- .../components/_Transaction/_Transaction.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx index 3abb3892d1..46cd9e0c5d 100644 --- a/packages/synapse-interface/components/_Transaction/_Transaction.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transaction.tsx @@ -162,7 +162,7 @@ _TransactionProps) => { tokenAmount={null} isOrigin={false} /> -
+ {/*
{new Date(timestamp * 1000).toLocaleString('en-US', { hour: '2-digit', @@ -172,7 +172,7 @@ _TransactionProps) => { })}
{typeof _kappa === 'string' && _kappa?.substring(0, 15)}
-
+
*/} {/* TODO: Update visual format */}
{isTxComplete ? ( From 90d7201878eea367ae664f975b255c35da096e5d Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 16:25:07 -0500 Subject: [PATCH 05/24] debug why new type isnt recognized --- .../components/_Transaction/_Transactions.tsx | 6 +-- .../slices/_transactions/reducer.ts | 48 +++++-------------- .../slices/_transactions/updater.tsx | 4 +- packages/synapse-interface/store/reducer.ts | 5 +- 4 files changed, 20 insertions(+), 43 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transactions.tsx b/packages/synapse-interface/components/_Transaction/_Transactions.tsx index aa8097a256..2915b7a489 100644 --- a/packages/synapse-interface/components/_Transaction/_Transactions.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transactions.tsx @@ -14,9 +14,9 @@ export const _Transactions = ({ const { synapseSDK } = useSynapseContext() const transactions = use_TransactionsState() - const transactionsArray: _TransactionDetails[] = Object.values(transactions) + const transactionsArray: _TransactionDetails[] = transactions - const hasTransactions: boolean = transactionsArray.length > 0 + const hasTransactions: boolean = transactions && transactionsArray.length > 0 const [currentTime, setCurrentTime] = useState( getTimeMinutesFromNow(0) @@ -36,7 +36,7 @@ export const _Transactions = ({ if (hasTransactions) { return ( -
+
{transactionsArray.slice(0, 5).map((tx: _TransactionDetails) => ( <_Transaction synapseSDK={synapseSDK} diff --git a/packages/synapse-interface/slices/_transactions/reducer.ts b/packages/synapse-interface/slices/_transactions/reducer.ts index d789bbf2f2..fc68456712 100644 --- a/packages/synapse-interface/slices/_transactions/reducer.ts +++ b/packages/synapse-interface/slices/_transactions/reducer.ts @@ -1,6 +1,7 @@ -import { createSlice } from '@reduxjs/toolkit' +import { PayloadAction, createSlice } from '@reduxjs/toolkit' import { Chain, Token } from '@/utils/types' +import StateManagedBridge from '@/pages/state-managed-bridge' /** TODO: Rename entire slice once done refactoring prior Activity flow */ export interface _TransactionDetails { @@ -18,46 +19,19 @@ export interface _TransactionDetails { } export interface _TransactionsState { - [transactionHash: string]: _TransactionDetails + transactions: any[] } -export const initialState: _TransactionsState = {} +export const initialState: _TransactionsState = { + transactions: [], +} export const transactionsSlice = createSlice({ - name: 'transactions', + name: '_transactions', initialState, reducers: { - addTransaction: ( - transactions: _TransactionsState, - { - payload: { - originTxHash, - originValue, - bridgeModuleName, - originChain, - originToken, - destinationChain, - destinationToken, - estimatedTime, - timestamp, - }, - } - ) => { - if (!originTxHash) return - - transactions[originTxHash] = { - originTxHash, - originValue, - bridgeModuleName, - originChain, - originToken, - destinationChain, - destinationToken, - estimatedTime, - timestamp, - kappa: null, - isComplete: false, - } + addTransaction: (state, action: PayloadAction) => { + state.transactions = [...action.payload] }, removeTransaction: ( transactions: _TransactionsState, @@ -85,8 +59,8 @@ export const transactionsSlice = createSlice({ tx.isComplete = true }, - clearTransactions: (transactions: _TransactionsState) => { - transactions = {} // eslint-disable-line + clearTransactions: (state) => { + state.transactions = [] }, }, }) diff --git a/packages/synapse-interface/slices/_transactions/updater.tsx b/packages/synapse-interface/slices/_transactions/updater.tsx index e618bd4a90..f4afdc582c 100644 --- a/packages/synapse-interface/slices/_transactions/updater.tsx +++ b/packages/synapse-interface/slices/_transactions/updater.tsx @@ -14,8 +14,10 @@ export default function Updater() { /** Add transaction if not in _transactions store */ useEffect(() => { if (checkTransactionsExist(pendingBridgeTransactions)) { + const txnExists = + transactions && transactions.find((tx) => !!tx.transactionHash) pendingBridgeTransactions.forEach((tx: PendingBridgeTransaction) => { - if (!transactions[tx.transactionHash]) { + if (!txnExists) { dispatch( addTransaction({ originTxHash: tx.transactionHash, diff --git a/packages/synapse-interface/store/reducer.ts b/packages/synapse-interface/store/reducer.ts index 803d8541ef..eadf3142de 100644 --- a/packages/synapse-interface/store/reducer.ts +++ b/packages/synapse-interface/store/reducer.ts @@ -21,13 +21,13 @@ import { RootActions } from '@/slices/application/actions' const persistedReducers = { application, transactions, - _transactions, + // _transactions, } export const storageKey: string = 'synapse-interface' export const persistConfig: PersistConfig = { - version: 1, // upgrade to reset cache when updated data structures throw errors + version: 2, // upgrade to reset cache when updated data structures throw errors key: storageKey, storage, whitelist: Object.keys(persistedReducers), @@ -44,6 +44,7 @@ export const appReducer = combineReducers({ poolWithdraw, priceData, swapDisplay, + _transactions, [api.reducerPath]: api.reducer, ...persistedReducers, }) From 8708621069bcffbe81ede6e3e0ebc245eeea17c1 Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 17:05:59 -0500 Subject: [PATCH 06/24] Convert transactions object to list --- .../components/_Transaction/_Transaction.tsx | 32 +++++++------- .../components/_Transaction/_Transactions.tsx | 3 +- .../helpers/useBridgeTxStatus.tsx | 12 ------ .../constants/chains/master.tsx | 2 +- .../slices/_transactions/reducer.ts | 42 ++++++++++++------- .../slices/_transactions/updater.tsx | 2 +- packages/synapse-interface/store/reducer.ts | 5 +-- 7 files changed, 49 insertions(+), 49 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx index 46cd9e0c5d..9fab021c87 100644 --- a/packages/synapse-interface/components/_Transaction/_Transaction.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transaction.tsx @@ -70,7 +70,7 @@ export const _Transaction = ({ }: // isComplete, _TransactionProps) => { const dispatch = useAppDispatch() - const transactions = use_TransactionsState() + const { transactions } = use_TransactionsState() const [originTxExplorerLink, originExplorerName] = getTxBlockExplorerLink( originChain.id, @@ -111,27 +111,29 @@ _TransactionProps) => { currentTime: currentTime, }) - console.log(`isTxComplete, `, isTxComplete) - console.log(`_kappa`, _kappa) - /** 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 + useEffect(() => { + const txKappa = _kappa - // if (isTxComplete && originTxHash && txKappa) { - // if (transactions[originTxHash].isComplete === false) { - // dispatch(completeTransaction({ originTxHash, kappa: txKappa })) - // } - // } - // }, [isTxComplete, dispatch, transactions]) + if (isTxComplete && originTxHash && txKappa) { + const txn = transactions.find((tx) => tx.originTxHash === originTxHash) + if (txn.isComplete === false) { + dispatch( + completeTransaction({ originTxHash, kappa: txKappa as string }) + ) + } + } + }, [isTxComplete, dispatch, transactions]) const handleClearTransaction = useCallback(() => { dispatch(removeTransaction({ originTxHash })) @@ -162,7 +164,7 @@ _TransactionProps) => { tokenAmount={null} isOrigin={false} /> - {/*
+
{new Date(timestamp * 1000).toLocaleString('en-US', { hour: '2-digit', @@ -172,7 +174,7 @@ _TransactionProps) => { })}
{typeof _kappa === 'string' && _kappa?.substring(0, 15)}
-
*/} +
{/* TODO: Update visual format */}
{isTxComplete ? ( diff --git a/packages/synapse-interface/components/_Transaction/_Transactions.tsx b/packages/synapse-interface/components/_Transaction/_Transactions.tsx index 2915b7a489..2073ac6c12 100644 --- a/packages/synapse-interface/components/_Transaction/_Transactions.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transactions.tsx @@ -12,7 +12,7 @@ export const _Transactions = ({ connectedAddress: string }) => { const { synapseSDK } = useSynapseContext() - const transactions = use_TransactionsState() + const { transactions } = use_TransactionsState() const transactionsArray: _TransactionDetails[] = transactions @@ -39,6 +39,7 @@ export const _Transactions = ({
{transactionsArray.slice(0, 5).map((tx: _TransactionDetails) => ( <_Transaction + key={tx.timestamp} synapseSDK={synapseSDK} connectedAddress={connectedAddress} originValue={Number(tx.originValue)} diff --git a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx index 382e69b72f..3402ac1466 100644 --- a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx +++ b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx @@ -34,7 +34,6 @@ export const useBridgeTxStatus = ({ bridgeModuleName, originTxHash ) - console.log(`getKappa:`) return kappa } catch (error) { console.error('Error in getKappa:', error) @@ -56,8 +55,6 @@ export const useBridgeTxStatus = ({ kappa ) - console.log(`statsuklafjdslkj`, status) - return status } catch (error) { console.error('Error in getBridgeTxStatus:', error) @@ -81,15 +78,6 @@ export const useBridgeTxStatus = ({ fetchedKappa ) - console.log(`destinationChainID`, destinationChainId) - console.log(`bridgeModuleName`, bridgeModuleName) - console.log(`fetchedKappa`, fetchedKappa) - - console.log('--======---') - console.log(`txStatus`, txStatus) - console.log(`fetchedKappa`, fetchedKappa) - console.log('--======---') - if (txStatus !== null && txStatus === true && fetchedKappa !== null) { setIsComplete(true) } else { diff --git a/packages/synapse-interface/constants/chains/master.tsx b/packages/synapse-interface/constants/chains/master.tsx index ed2114d916..385994e3ea 100644 --- a/packages/synapse-interface/constants/chains/master.tsx +++ b/packages/synapse-interface/constants/chains/master.tsx @@ -155,7 +155,7 @@ export const OPTIMISM: Chain = { codeName: 'optimism', blockTime: 2000, rpcUrls: { - primary: 'https://mainnet.optimism.io', + primary: 'https://1rpc.io/op', fallback: 'https://1rpc.io/op', }, nativeCurrency: { name: 'Ethereum', symbol: 'ETH', decimals: 18 }, diff --git a/packages/synapse-interface/slices/_transactions/reducer.ts b/packages/synapse-interface/slices/_transactions/reducer.ts index fc68456712..00d1bd9acc 100644 --- a/packages/synapse-interface/slices/_transactions/reducer.ts +++ b/packages/synapse-interface/slices/_transactions/reducer.ts @@ -31,33 +31,43 @@ export const transactionsSlice = createSlice({ initialState, reducers: { addTransaction: (state, action: PayloadAction) => { - state.transactions = [...action.payload] + state.transactions.push(action.payload) }, removeTransaction: ( - transactions: _TransactionsState, - { payload: { originTxHash } } + state, + action: PayloadAction<{ originTxHash: string }> ) => { - if (transactions[originTxHash]) { - delete transactions[originTxHash] - } + const { originTxHash } = action.payload + state.transactions = state.transactions.filter( + (tx) => tx.originTxHash !== originTxHash + ) }, updateTransactionKappa: ( - transactions: _TransactionsState, - { payload: { originTxHash, kappa } } + state, + action: PayloadAction<{ originTxHash: string; kappa: string }> ) => { - const tx = transactions[originTxHash] - if (!tx) return + const { originTxHash, kappa } = action.payload + + const txIndex = state.transactions.findIndex( + (tx) => tx.originTxHash === originTxHash + ) - tx.kappa = kappa + if (txIndex !== -1) { + state.transactions[txIndex].kappa = kappa + } }, completeTransaction: ( - transactions: _TransactionsState, - { payload: { originTxHash } } + state, + action: PayloadAction<{ originTxHash: string; kappa: string }> ) => { - const tx = transactions[originTxHash] - if (!tx) return + const { originTxHash } = action.payload - tx.isComplete = true + const txIndex = state.transactions.findIndex( + (tx) => tx.originTxHash === originTxHash + ) + if (txIndex !== -1) { + state.transactions[txIndex].isComplete = true + } }, clearTransactions: (state) => { state.transactions = [] diff --git a/packages/synapse-interface/slices/_transactions/updater.tsx b/packages/synapse-interface/slices/_transactions/updater.tsx index f4afdc582c..06b8f9fe59 100644 --- a/packages/synapse-interface/slices/_transactions/updater.tsx +++ b/packages/synapse-interface/slices/_transactions/updater.tsx @@ -9,7 +9,7 @@ import { PendingBridgeTransaction } from '../transactions/actions' export default function Updater() { const dispatch = useAppDispatch() const { pendingBridgeTransactions } = useTransactionsState() - const transactions = use_TransactionsState() + const { transactions } = use_TransactionsState() /** Add transaction if not in _transactions store */ useEffect(() => { diff --git a/packages/synapse-interface/store/reducer.ts b/packages/synapse-interface/store/reducer.ts index eadf3142de..803d8541ef 100644 --- a/packages/synapse-interface/store/reducer.ts +++ b/packages/synapse-interface/store/reducer.ts @@ -21,13 +21,13 @@ import { RootActions } from '@/slices/application/actions' const persistedReducers = { application, transactions, - // _transactions, + _transactions, } export const storageKey: string = 'synapse-interface' export const persistConfig: PersistConfig = { - version: 2, // upgrade to reset cache when updated data structures throw errors + version: 1, // upgrade to reset cache when updated data structures throw errors key: storageKey, storage, whitelist: Object.keys(persistedReducers), @@ -44,7 +44,6 @@ export const appReducer = combineReducers({ poolWithdraw, priceData, swapDisplay, - _transactions, [api.reducerPath]: api.reducer, ...persistedReducers, }) From e03dcc5181daee7d114454720b0625f6b465aea9 Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Sun, 7 Jan 2024 14:14:44 -0800 Subject: [PATCH 07/24] Render transactions in list --- .../components/_Transaction/_Transactions.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transactions.tsx b/packages/synapse-interface/components/_Transaction/_Transactions.tsx index 2073ac6c12..95ab5fabfb 100644 --- a/packages/synapse-interface/components/_Transaction/_Transactions.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transactions.tsx @@ -4,6 +4,7 @@ import { _TransactionDetails } from '@/slices/_transactions/reducer' import { useSynapseContext } from '@/utils/providers/SynapseProvider' import { _Transaction } from './_Transaction' import { getTimeMinutesFromNow } from '@/utils/time' +import { checkTransactionsExist } from '@/utils/checkTransactionsExist' /** TODO: Update naming once refactoring of previous Activity/Tx flow is done */ export const _Transactions = ({ @@ -14,9 +15,7 @@ export const _Transactions = ({ const { synapseSDK } = useSynapseContext() const { transactions } = use_TransactionsState() - const transactionsArray: _TransactionDetails[] = transactions - - const hasTransactions: boolean = transactions && transactionsArray.length > 0 + const hasTransactions: boolean = checkTransactionsExist(transactions) const [currentTime, setCurrentTime] = useState( getTimeMinutesFromNow(0) @@ -37,7 +36,7 @@ export const _Transactions = ({ if (hasTransactions) { return (
- {transactionsArray.slice(0, 5).map((tx: _TransactionDetails) => ( + {transactions.slice(0, 5).map((tx: _TransactionDetails) => ( <_Transaction key={tx.timestamp} synapseSDK={synapseSDK} From b53744dfc89c059796130aba6fde0aaf68bc5873 Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Sun, 7 Jan 2024 14:46:23 -0800 Subject: [PATCH 08/24] Check tx is stored before adding into _transaction --- .../synapse-interface/slices/_transactions/updater.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/synapse-interface/slices/_transactions/updater.tsx b/packages/synapse-interface/slices/_transactions/updater.tsx index 06b8f9fe59..ea454e4702 100644 --- a/packages/synapse-interface/slices/_transactions/updater.tsx +++ b/packages/synapse-interface/slices/_transactions/updater.tsx @@ -14,9 +14,13 @@ export default function Updater() { /** Add transaction if not in _transactions store */ useEffect(() => { if (checkTransactionsExist(pendingBridgeTransactions)) { - const txnExists = - transactions && transactions.find((tx) => !!tx.transactionHash) pendingBridgeTransactions.forEach((tx: PendingBridgeTransaction) => { + // Check Transaction is already stored + const txnExists = + transactions && + transactions.some( + (storedTx) => tx.transactionHash == storedTx.originTxHash + ) if (!txnExists) { dispatch( addTransaction({ @@ -34,7 +38,7 @@ export default function Updater() { } }) } - }, [pendingBridgeTransactions]) + }, [pendingBridgeTransactions, transactions]) return null } From b57109519a49bee3b51d9b947bcb52f10a178a88 Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Sun, 7 Jan 2024 14:57:11 -0800 Subject: [PATCH 09/24] Check tx has been confirmed before adding to _transaction store --- .../synapse-interface/slices/_transactions/updater.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/synapse-interface/slices/_transactions/updater.tsx b/packages/synapse-interface/slices/_transactions/updater.tsx index ea454e4702..5e13c64ab2 100644 --- a/packages/synapse-interface/slices/_transactions/updater.tsx +++ b/packages/synapse-interface/slices/_transactions/updater.tsx @@ -5,6 +5,7 @@ import { addTransaction } from './reducer' import { useTransactionsState } from '../transactions/hooks' import { checkTransactionsExist } from '@/utils/checkTransactionsExist' import { PendingBridgeTransaction } from '../transactions/actions' +import _ from 'lodash' export default function Updater() { const dispatch = useAppDispatch() @@ -21,7 +22,12 @@ export default function Updater() { transactions.some( (storedTx) => tx.transactionHash == storedTx.originTxHash ) - if (!txnExists) { + + // Check Transaction has been confirmed + const txnConfirmed = + !_.isNull(tx.transactionHash) && !_.isUndefined(tx.transactionHash) + + if (txnConfirmed && !txnExists) { dispatch( addTransaction({ originTxHash: tx.transactionHash, From 918e5919e2269bc95cd02a010386bc011270441b Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 18:07:23 -0500 Subject: [PATCH 10/24] Sorting by descending timestamp --- .../components/_Transaction/_Transactions.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transactions.tsx b/packages/synapse-interface/components/_Transaction/_Transactions.tsx index 95ab5fabfb..be9f0b76c9 100644 --- a/packages/synapse-interface/components/_Transaction/_Transactions.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transactions.tsx @@ -1,3 +1,4 @@ +import _ from 'lodash' import { useState, useEffect, useMemo } from 'react' import { use_TransactionsState } from '@/slices/_transactions/hooks' import { _TransactionDetails } from '@/slices/_transactions/reducer' @@ -34,9 +35,10 @@ export const _Transactions = ({ }, []) if (hasTransactions) { + const sortedTransactions = _.orderBy(transactions, ['timestamp'], ['desc']) return (
- {transactions.slice(0, 5).map((tx: _TransactionDetails) => ( + {sortedTransactions.map((tx: _TransactionDetails) => ( <_Transaction key={tx.timestamp} synapseSDK={synapseSDK} From 1307ce3245d9174104d0af88044f4ebd841c2f05 Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Sun, 7 Jan 2024 15:20:13 -0800 Subject: [PATCH 11/24] Allow clear tx functionality to persist --- .../slices/_transactions/updater.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/synapse-interface/slices/_transactions/updater.tsx b/packages/synapse-interface/slices/_transactions/updater.tsx index 5e13c64ab2..cb9d828884 100644 --- a/packages/synapse-interface/slices/_transactions/updater.tsx +++ b/packages/synapse-interface/slices/_transactions/updater.tsx @@ -4,7 +4,10 @@ import { use_TransactionsState } from './hooks' import { addTransaction } from './reducer' import { useTransactionsState } from '../transactions/hooks' import { checkTransactionsExist } from '@/utils/checkTransactionsExist' -import { PendingBridgeTransaction } from '../transactions/actions' +import { + PendingBridgeTransaction, + removePendingBridgeTransaction, +} from '../transactions/actions' import _ from 'lodash' export default function Updater() { @@ -16,16 +19,21 @@ export default function Updater() { useEffect(() => { if (checkTransactionsExist(pendingBridgeTransactions)) { pendingBridgeTransactions.forEach((tx: PendingBridgeTransaction) => { - // Check Transaction is already stored + /** Check Transaction has been confirmed */ + const txnConfirmed = + !_.isNull(tx.transactionHash) && !_.isUndefined(tx.transactionHash) + + /** Check Transaction is already stored */ const txnExists = transactions && transactions.some( (storedTx) => tx.transactionHash == storedTx.originTxHash ) - // Check Transaction has been confirmed - const txnConfirmed = - !_.isNull(tx.transactionHash) && !_.isUndefined(tx.transactionHash) + /** Remove pendingBridgeTransaction once stored in transactions */ + if (txnExists) { + dispatch(removePendingBridgeTransaction(tx.id)) + } if (txnConfirmed && !txnExists) { dispatch( From 03663f51e7e37a5e2d0498d56d0153c2bb442d77 Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 18:36:18 -0500 Subject: [PATCH 12/24] back to optimism mainnet rpc --- packages/synapse-interface/constants/chains/master.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/synapse-interface/constants/chains/master.tsx b/packages/synapse-interface/constants/chains/master.tsx index 385994e3ea..ed2114d916 100644 --- a/packages/synapse-interface/constants/chains/master.tsx +++ b/packages/synapse-interface/constants/chains/master.tsx @@ -155,7 +155,7 @@ export const OPTIMISM: Chain = { codeName: 'optimism', blockTime: 2000, rpcUrls: { - primary: 'https://1rpc.io/op', + primary: 'https://mainnet.optimism.io', fallback: 'https://1rpc.io/op', }, nativeCurrency: { name: 'Ethereum', symbol: 'ETH', decimals: 18 }, From 7a5e40e5307bc7e4b625c73147498c5ada3d99cc Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Sun, 7 Jan 2024 15:49:53 -0800 Subject: [PATCH 13/24] Prevent refiring tx sdk queries if already complete --- .../components/_Transaction/_Transaction.tsx | 4 +++- .../components/_Transaction/_Transactions.tsx | 2 +- .../components/_Transaction/helpers/useBridgeTxStatus.tsx | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx index 9fab021c87..ab4c30d25c 100644 --- a/packages/synapse-interface/components/_Transaction/_Transaction.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transaction.tsx @@ -50,6 +50,7 @@ interface _TransactionProps { estimatedTime: number // in seconds timestamp: number currentTime: number + kappa?: string // isComplete: boolean } @@ -67,6 +68,7 @@ export const _Transaction = ({ estimatedTime, timestamp, currentTime, + kappa, }: // isComplete, _TransactionProps) => { const dispatch = useAppDispatch() @@ -106,7 +108,7 @@ _TransactionProps) => { destinationChainId: destinationChain.id, originTxHash, bridgeModuleName, - kappa: null, + kappa: kappa, checkStatus: isEstimatedTimeReached, currentTime: currentTime, }) diff --git a/packages/synapse-interface/components/_Transaction/_Transactions.tsx b/packages/synapse-interface/components/_Transaction/_Transactions.tsx index be9f0b76c9..17bc20fe8b 100644 --- a/packages/synapse-interface/components/_Transaction/_Transactions.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transactions.tsx @@ -51,7 +51,7 @@ export const _Transactions = ({ originTxHash={tx.originTxHash} bridgeModuleName={tx.bridgeModuleName} estimatedTime={tx.estimatedTime} - // kappa={tx?.kappa} + kappa={tx?.kappa} timestamp={tx.timestamp} currentTime={currentTime} // isComplete={tx.isComplete} diff --git a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx index 3402ac1466..183b36fc38 100644 --- a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx +++ b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx @@ -23,7 +23,7 @@ export const useBridgeTxStatus = ({ }: UseBridgeTxStatusProps) => { const { synapseSDK } = useSynapseContext() const [isComplete, setIsComplete] = useState(false) - const [fetchedKappa, setFetchedKappa] = useState(null) + const [fetchedKappa, setFetchedKappa] = useState(kappa ?? null) const getKappa = async (): Promise => { if (!synapseSDK) return null @@ -64,7 +64,7 @@ export const useBridgeTxStatus = ({ useEffect(() => { // if (!checkStatus) return - // if (isComplete) return + if (isComplete) return ;(async () => { if (fetchedKappa === null) { let _kappa = await getKappa() From 649b3f06d8e839b9e59324ce28944d9e9c55c936 Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Sun, 7 Jan 2024 15:56:21 -0800 Subject: [PATCH 14/24] Mark tx as complete once kappa and isTxComplete avail --- .../components/_Transaction/_Transaction.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx index ab4c30d25c..a7fe55443f 100644 --- a/packages/synapse-interface/components/_Transaction/_Transaction.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transaction.tsx @@ -129,13 +129,13 @@ _TransactionProps) => { if (isTxComplete && originTxHash && txKappa) { const txn = transactions.find((tx) => tx.originTxHash === originTxHash) - if (txn.isComplete === false) { + if (!txn.isComplete) { dispatch( completeTransaction({ originTxHash, kappa: txKappa as string }) ) } } - }, [isTxComplete, dispatch, transactions]) + }, [isTxComplete, dispatch, transactions, _kappa]) const handleClearTransaction = useCallback(() => { dispatch(removeTransaction({ originTxHash })) From 2e5ff47a4d07249fc84f079eca73b15c17cb5393 Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Sun, 7 Jan 2024 16:02:01 -0800 Subject: [PATCH 15/24] Check if store marked Tx complete before firing tx status hook, render persisted tx status --- .../components/_Transaction/_Transaction.tsx | 15 +++++++++------ .../components/_Transaction/_Transactions.tsx | 2 +- .../_Transaction/helpers/useBridgeTxStatus.tsx | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx index a7fe55443f..9e602a5183 100644 --- a/packages/synapse-interface/components/_Transaction/_Transaction.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transaction.tsx @@ -51,7 +51,7 @@ interface _TransactionProps { timestamp: number currentTime: number kappa?: string - // isComplete: boolean + isStoredComplete: boolean } /** TODO: Update naming after refactoring existing Activity / Transaction flow */ @@ -69,8 +69,8 @@ export const _Transaction = ({ timestamp, currentTime, kappa, -}: // isComplete, -_TransactionProps) => { + isStoredComplete, +}: _TransactionProps) => { const dispatch = useAppDispatch() const { transactions } = use_TransactionsState() @@ -109,10 +109,13 @@ _TransactionProps) => { originTxHash, bridgeModuleName, kappa: kappa, - checkStatus: isEstimatedTimeReached, + 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) { @@ -179,14 +182,14 @@ _TransactionProps) => {
{/* TODO: Update visual format */}
- {isTxComplete ? ( + {isTxCompleted ? ( ) : ( )}
diff --git a/packages/synapse-interface/components/_Transaction/_Transactions.tsx b/packages/synapse-interface/components/_Transaction/_Transactions.tsx index 17bc20fe8b..db7339ad0b 100644 --- a/packages/synapse-interface/components/_Transaction/_Transactions.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transactions.tsx @@ -54,7 +54,7 @@ export const _Transactions = ({ kappa={tx?.kappa} timestamp={tx.timestamp} currentTime={currentTime} - // isComplete={tx.isComplete} + isStoredComplete={tx.isComplete} /> ))}
diff --git a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx index 183b36fc38..97ec0dfd4c 100644 --- a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx +++ b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx @@ -20,7 +20,7 @@ export const useBridgeTxStatus = ({ kappa, checkStatus = false, currentTime, -}: UseBridgeTxStatusProps) => { +}: UseBridgeTxStatusProps): [boolean, string] => { const { synapseSDK } = useSynapseContext() const [isComplete, setIsComplete] = useState(false) const [fetchedKappa, setFetchedKappa] = useState(kappa ?? null) From d57a4bfb7818aabd8cffd0e112aa25bcff4684cb Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Sun, 7 Jan 2024 16:13:18 -0800 Subject: [PATCH 16/24] `useBridgeTxStatus` hook initialized to set isComplete to true if kappa exists, save call --- .../components/_Transaction/helpers/useBridgeTxStatus.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx index 97ec0dfd4c..b4e5e826d5 100644 --- a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx +++ b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx @@ -22,7 +22,7 @@ export const useBridgeTxStatus = ({ currentTime, }: UseBridgeTxStatusProps): [boolean, string] => { const { synapseSDK } = useSynapseContext() - const [isComplete, setIsComplete] = useState(false) + const [isComplete, setIsComplete] = useState(kappa ? true : false) const [fetchedKappa, setFetchedKappa] = useState(kappa ?? null) const getKappa = async (): Promise => { From e0f08192070336e0cfa25c74ca8534f1de433a1c Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Sun, 7 Jan 2024 16:16:47 -0800 Subject: [PATCH 17/24] Revert prev commit, require check on tx status beyond kappa avail --- .../components/_Transaction/helpers/useBridgeTxStatus.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx index b4e5e826d5..97ec0dfd4c 100644 --- a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx +++ b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx @@ -22,7 +22,7 @@ export const useBridgeTxStatus = ({ currentTime, }: UseBridgeTxStatusProps): [boolean, string] => { const { synapseSDK } = useSynapseContext() - const [isComplete, setIsComplete] = useState(kappa ? true : false) + const [isComplete, setIsComplete] = useState(false) const [fetchedKappa, setFetchedKappa] = useState(kappa ?? null) const getKappa = async (): Promise => { From 936d2b25de53317ce439261160e367374049e166 Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Sun, 7 Jan 2024 16:26:32 -0800 Subject: [PATCH 18/24] Utilize `checkStatus` as guardrail check in `useBridgeTxStatus` --- .../components/_Transaction/helpers/useBridgeTxStatus.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx index 97ec0dfd4c..8c34c1b0da 100644 --- a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx +++ b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx @@ -63,7 +63,7 @@ export const useBridgeTxStatus = ({ } useEffect(() => { - // if (!checkStatus) return + if (!checkStatus) return if (isComplete) return ;(async () => { if (fetchedKappa === null) { From 39805b28547240c68597b16bd20395b05d86bae7 Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 19:55:54 -0500 Subject: [PATCH 19/24] removes unused prop --- .../synapse-interface/components/_Transaction/_Transaction.tsx | 1 - .../components/_Transaction/helpers/useBridgeTxStatus.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx index 9e602a5183..d891841b8d 100644 --- a/packages/synapse-interface/components/_Transaction/_Transaction.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transaction.tsx @@ -103,7 +103,6 @@ export const _Transaction = ({ }, [estimatedTime, currentTime, timestamp]) const [isTxComplete, _kappa] = useBridgeTxStatus({ - synapseSDK, originChainId: originChain.id, destinationChainId: destinationChain.id, originTxHash, diff --git a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx index 8c34c1b0da..423e6db51b 100644 --- a/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx +++ b/packages/synapse-interface/components/_Transaction/helpers/useBridgeTxStatus.tsx @@ -2,7 +2,6 @@ import { useState, useEffect } from 'react' import { useSynapseContext } from '@/utils/providers/SynapseProvider' interface UseBridgeTxStatusProps { - synapseSDK: any originChainId: number destinationChainId: number originTxHash: string From feb492a91f36075c3c953451bfff4ac956e1e6a1 Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 19:58:23 -0500 Subject: [PATCH 20/24] removes another unused prop --- .../synapse-interface/components/_Transaction/_Transaction.tsx | 2 -- .../components/_Transaction/_Transactions.tsx | 3 --- 2 files changed, 5 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx index d891841b8d..7f9ab070b9 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 @@ -56,7 +55,6 @@ interface _TransactionProps { /** TODO: Update naming after refactoring existing Activity / Transaction flow */ export const _Transaction = ({ - synapseSDK, connectedAddress, originValue, originChain, diff --git a/packages/synapse-interface/components/_Transaction/_Transactions.tsx b/packages/synapse-interface/components/_Transaction/_Transactions.tsx index db7339ad0b..601f54938b 100644 --- a/packages/synapse-interface/components/_Transaction/_Transactions.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transactions.tsx @@ -2,7 +2,6 @@ import _ from 'lodash' import { useState, useEffect, useMemo } from 'react' import { use_TransactionsState } from '@/slices/_transactions/hooks' import { _TransactionDetails } from '@/slices/_transactions/reducer' -import { useSynapseContext } from '@/utils/providers/SynapseProvider' import { _Transaction } from './_Transaction' import { getTimeMinutesFromNow } from '@/utils/time' import { checkTransactionsExist } from '@/utils/checkTransactionsExist' @@ -13,7 +12,6 @@ export const _Transactions = ({ }: { connectedAddress: string }) => { - const { synapseSDK } = useSynapseContext() const { transactions } = use_TransactionsState() const hasTransactions: boolean = checkTransactionsExist(transactions) @@ -41,7 +39,6 @@ export const _Transactions = ({ {sortedTransactions.map((tx: _TransactionDetails) => ( <_Transaction key={tx.timestamp} - synapseSDK={synapseSDK} connectedAddress={connectedAddress} originValue={Number(tx.originValue)} originChain={tx.originChain} From a4a1ddcf6bbbc93a94f3b3afc686c03fa38605d8 Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 20:15:49 -0500 Subject: [PATCH 21/24] Hide debugging meta --- .../components/_Transaction/_Transaction.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx index 7f9ab070b9..450874bbc8 100644 --- a/packages/synapse-interface/components/_Transaction/_Transaction.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transaction.tsx @@ -166,7 +166,7 @@ export const _Transaction = ({ tokenAmount={null} isOrigin={false} /> -
+ {/*
{new Date(timestamp * 1000).toLocaleString('en-US', { hour: '2-digit', @@ -176,7 +176,7 @@ export const _Transaction = ({ })}
{typeof _kappa === 'string' && _kappa?.substring(0, 15)}
-
+
*/} {/* TODO: Update visual format */}
{isTxCompleted ? ( From 2101ac385a0e9dee4f2e7aa086ee14401b0f2147 Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 20:17:12 -0500 Subject: [PATCH 22/24] Hide debugging meta --- .../components/_Transaction/_Transaction.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx index 450874bbc8..7a65700423 100644 --- a/packages/synapse-interface/components/_Transaction/_Transaction.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transaction.tsx @@ -166,7 +166,7 @@ export const _Transaction = ({ tokenAmount={null} isOrigin={false} /> - {/*
+
{new Date(timestamp * 1000).toLocaleString('en-US', { hour: '2-digit', @@ -175,8 +175,8 @@ export const _Transaction = ({ hour12: true, })}
-
{typeof _kappa === 'string' && _kappa?.substring(0, 15)}
-
*/} + {/*
{typeof _kappa === 'string' && _kappa?.substring(0, 15)}
*/} +
{/* TODO: Update visual format */}
{isTxCompleted ? ( From c50c4afd41722d4573a5a891ff10662903ecbb7d Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 21:12:21 -0500 Subject: [PATCH 23/24] limits to 5 txns --- .../synapse-interface/components/_Transaction/_Transactions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transactions.tsx b/packages/synapse-interface/components/_Transaction/_Transactions.tsx index 601f54938b..8cb02c4fd5 100644 --- a/packages/synapse-interface/components/_Transaction/_Transactions.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transactions.tsx @@ -36,7 +36,7 @@ export const _Transactions = ({ const sortedTransactions = _.orderBy(transactions, ['timestamp'], ['desc']) return (
- {sortedTransactions.map((tx: _TransactionDetails) => ( + {sortedTransactions.slice(0, 5).map((tx: _TransactionDetails) => ( <_Transaction key={tx.timestamp} connectedAddress={connectedAddress} From 329427228c16f9f4be5d45d785a8a5e61d244e8f Mon Sep 17 00:00:00 2001 From: abtestingalpha Date: Sun, 7 Jan 2024 21:43:21 -0500 Subject: [PATCH 24/24] align time --- .../components/_Transaction/_Transaction.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/synapse-interface/components/_Transaction/_Transaction.tsx b/packages/synapse-interface/components/_Transaction/_Transaction.tsx index 7a65700423..1c0369c833 100644 --- a/packages/synapse-interface/components/_Transaction/_Transaction.tsx +++ b/packages/synapse-interface/components/_Transaction/_Transaction.tsx @@ -160,22 +160,22 @@ 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)}
*/}
- {/*
{typeof _kappa === 'string' && _kappa?.substring(0, 15)}
*/}
{/* TODO: Update visual format */}