From ddbebd0757bf1d703688b5c345f302919bd67659 Mon Sep 17 00:00:00 2001 From: Thiendekaco Date: Tue, 9 Jul 2024 17:57:14 +0700 Subject: [PATCH] [Issue 3275] Extension - Disable request connect from walletConnect when don't support substrate network #1 --- .../extension-koni-ui/src/Popup/Account/AccountExport.tsx | 2 +- .../src/Popup/Confirmations/parts/Sign/Evm.tsx | 6 +----- .../src/Popup/Confirmations/parts/Sign/Substrate.tsx | 4 ---- packages/extension-koni-ui/src/hooks/ledger/useLedger.ts | 4 ++++ 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/extension-koni-ui/src/Popup/Account/AccountExport.tsx b/packages/extension-koni-ui/src/Popup/Account/AccountExport.tsx index 716df1716a..e3470c6be6 100644 --- a/packages/extension-koni-ui/src/Popup/Account/AccountExport.tsx +++ b/packages/extension-koni-ui/src/Popup/Account/AccountExport.tsx @@ -666,8 +666,8 @@ const AccountExport = styled(Component)(({ theme: { token } }: Props) => '.json-done-description': { padding: `0 ${token.controlHeightLG - token.padding}px`, color: token.colorTextLabel, - textAlign: 'center', fontSize: token.fontSizeHeading5, + textAlign: 'center', lineHeight: token.lineHeightHeading5 } }; diff --git a/packages/extension-koni-ui/src/Popup/Confirmations/parts/Sign/Evm.tsx b/packages/extension-koni-ui/src/Popup/Confirmations/parts/Sign/Evm.tsx index 6de29b1da8..0f86873ccb 100644 --- a/packages/extension-koni-ui/src/Popup/Confirmations/parts/Sign/Evm.tsx +++ b/packages/extension-koni-ui/src/Popup/Confirmations/parts/Sign/Evm.tsx @@ -162,14 +162,10 @@ const Component: React.FC = (props: Props) => { }) .catch((e: Error) => { console.log(e); - notify({ - message: e.message, - type: 'error' - }); setLoading(false); }); }); - }, [account.accountIndex, account.address, account.addressOffset, hashPayload, isLedgerConnected, isMessage, ledger, ledgerSignMessage, ledgerSignTransaction, notify, onApproveSignature, refreshLedger]); + }, [account.accountIndex, account.address, account.addressOffset, hashPayload, isLedgerConnected, isMessage, ledger, ledgerSignMessage, ledgerSignTransaction, onApproveSignature, refreshLedger]); const onConfirmInject = useCallback(() => { if (evmWallet) { diff --git a/packages/extension-koni-ui/src/Popup/Confirmations/parts/Sign/Substrate.tsx b/packages/extension-koni-ui/src/Popup/Confirmations/parts/Sign/Substrate.tsx index fd9bb56834..379b917008 100644 --- a/packages/extension-koni-ui/src/Popup/Confirmations/parts/Sign/Substrate.tsx +++ b/packages/extension-koni-ui/src/Popup/Confirmations/parts/Sign/Substrate.tsx @@ -307,10 +307,6 @@ const Component: React.FC = (props: Props) => { onApproveSignature({ signature }); } catch (e) { console.error(e); - notify({ - message: (e as Error).message, - type: 'error' - }); } setLoading(false); diff --git a/packages/extension-koni-ui/src/hooks/ledger/useLedger.ts b/packages/extension-koni-ui/src/hooks/ledger/useLedger.ts index 0c698534c0..43f24a50d0 100644 --- a/packages/extension-koni-ui/src/hooks/ledger/useLedger.ts +++ b/packages/extension-koni-ui/src/hooks/ledger/useLedger.ts @@ -223,6 +223,8 @@ export function useLedger (slug?: string, active = true, isSigning = false, forc }, [getLedger, ledger, t]); const signTransaction = useCallback(async (message: Uint8Array, metadata: Uint8Array, accountOffset?: number, addressOffset?: number, address?: string, accountOption?: Partial): Promise => { + setError(null); + if (ledger) { const addressOnCurrentLedger = await ledger.getAddress(false, accountOffset, addressOffset, accountOption); @@ -255,6 +257,8 @@ export function useLedger (slug?: string, active = true, isSigning = false, forc }, [handleError, ledger, t]); const signMessage = useCallback(async (message: Uint8Array, accountOffset?: number, addressOffset?: number, address?: string, accountOption?: Partial): Promise => { + setError(null); + if (ledger) { const addressOnCurrentLedger = await ledger.getAddress(false, accountOffset, addressOffset, accountOption);