From ccafdeaa562b8641130a28c017d4e56cd6a1a001 Mon Sep 17 00:00:00 2001 From: Ilias Trichopoulos Date: Fri, 1 Sep 2023 17:04:26 +0300 Subject: [PATCH] Clean up --- src/api/transactions.ts | 8 +- src/components/DashboardHeaderActions.tsx | 27 ++--- src/contexts/SendContext.tsx | 27 ++--- .../walletConnect/WalletConnectContext.tsx | 69 ++++++------ ...x => WalletConnectSessionRequestModal.tsx} | 104 +++++++++--------- src/screens/SendReceive/Send/VerifyScreen.tsx | 33 +++--- src/screens/WalletConnectPairingsModal.tsx | 13 +-- src/types/walletConnect.ts | 2 +- 8 files changed, 130 insertions(+), 153 deletions(-) rename src/contexts/walletConnect/{WalletConnectTxModal.tsx => WalletConnectSessionRequestModal.tsx} (69%) diff --git a/src/api/transactions.ts b/src/api/transactions.ts index dbddc868..5321d73b 100644 --- a/src/api/transactions.ts +++ b/src/api/transactions.ts @@ -40,9 +40,7 @@ export const buildSweepTransactions = async (fromAddress: Address, toAddressHash export const buildUnsignedTransactions = async ( fromAddress: Address, toAddressHash: string, - assetAmounts: AssetAmount[], - gasAmount?: number, - gasPrice?: string + assetAmounts: AssetAmount[] ) => { const assetsWithAvailableBalance = getAddressAssetsAvailableBalance(fromAddress).filter( (asset) => asset.availableBalance > 0 @@ -60,9 +58,7 @@ export const buildUnsignedTransactions = async ( const data = await buildTransferTransaction({ fromAddress, toAddress: toAddressHash, - assetAmounts, - gasAmount, - gasPrice + assetAmounts }) return { diff --git a/src/components/DashboardHeaderActions.tsx b/src/components/DashboardHeaderActions.tsx index 964d2b4f..9518542b 100644 --- a/src/components/DashboardHeaderActions.tsx +++ b/src/components/DashboardHeaderActions.tsx @@ -47,11 +47,11 @@ const DashboardHeaderActions = ({ style }: DashboardHeaderActionsProps) => { const isCameraOpen = useAppSelector((s) => s.app.isCameraOpen) const dispatch = useAppDispatch() const posthog = usePostHog() - const { pair, walletConnectClient, activeSessions } = useWalletConnectContext() + const { pairWithDapp, walletConnectClient, activeSessions } = useWalletConnectContext() const { - ref: currentConnectionsModalRef, - open: openCurrentConnectionsModal, - close: closeCurrentConnectionsModal + ref: currentWalletConnectConnectionsModalRef, + open: openCurrentWalletConnectConnectionsModal, + close: closeCurrentWalletConnectConnectionsModal } = useModalize() const openQRCodeScannerModal = () => dispatch(cameraToggled(true)) @@ -62,14 +62,10 @@ const DashboardHeaderActions = ({ style }: DashboardHeaderActionsProps) => { const handleQRCodeScan = async (text: string) => { if (isAddressValid(text)) { - navigation.navigate('SendNavigation', { - screen: 'OriginScreen', - params: { toAddressHash: text } - }) - + navigation.navigate('SendNavigation', { screen: 'OriginScreen', params: { toAddressHash: text } }) posthog?.capture('Send: Captured destination address by scanning QR code from Dashboard') } else if (text.startsWith('wc:')) { - pair(text) + pairWithDapp(text) } } @@ -86,7 +82,12 @@ const DashboardHeaderActions = ({ style }: DashboardHeaderActionsProps) => { variant={isMnemonicBackedUp ? 'default' : 'alert'} /> {walletConnectClient && activeSessions.length > 0 && ( -