From 64cce0abb8904157c2973d73eb5a5533c8d8c9ed Mon Sep 17 00:00:00 2001 From: Bayological <6872903+bayological@users.noreply.github.com> Date: Fri, 22 Nov 2024 18:52:52 +0700 Subject: [PATCH 1/5] Release 2.3.1 (#160) --- .github/issue_template/bug_report_task.md | 35 +++++++++++++++++++++++ .github/issue_template/common_task.md | 19 ++++++++++++ .gitignore | 2 ++ package.json | 2 +- src/components/nav/ConnectButton.tsx | 8 +++++- src/components/nav/NetworkModal.tsx | 30 ++++++++++--------- src/config/wallets.ts | 28 ++++++++++++++++++ src/features/swap/SwapConfirm.tsx | 4 +-- src/features/swap/SwapForm.tsx | 7 +++-- src/features/swap/swapSlice.ts | 8 +++++- src/pages/index.tsx | 8 ++++-- 11 files changed, 128 insertions(+), 23 deletions(-) create mode 100644 .github/issue_template/bug_report_task.md create mode 100644 .github/issue_template/common_task.md diff --git a/.github/issue_template/bug_report_task.md b/.github/issue_template/bug_report_task.md new file mode 100644 index 0000000..5fd500d --- /dev/null +++ b/.github/issue_template/bug_report_task.md @@ -0,0 +1,35 @@ +--- +name: Bug report task +about: Create a bug report task to help us fix an existing bug +--- + +#### **Description** + + + +#### **Steps To Reproduce** + + + +#### **Actual result** + + + +#### **Expected result** + + + +#### **Attachments** + + + +#### **Additional context** + + diff --git a/.github/issue_template/common_task.md b/.github/issue_template/common_task.md new file mode 100644 index 0000000..6f52337 --- /dev/null +++ b/.github/issue_template/common_task.md @@ -0,0 +1,19 @@ +--- +name: Common task +about: Create a common task to implement a feature, do refactor, or update docs +--- + +## Description + + + +## Acceptance Criteria +- [ ] _Your acceptance criteria_ + +#### **Attachments** + + + +## Additional context + + diff --git a/.gitignore b/.gitignore index 3ce6f93..0528449 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,5 @@ yarn-error.log* # vercel .vercel + +.idea diff --git a/package.json b/package.json index 3f3cbf3..b163f4b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mento-protocol/mento-web", - "version": "2.3.0", + "version": "2.3.1", "description": "A simple DApp for Celo Mento exchanges", "keywords": [ "Celo", diff --git a/src/components/nav/ConnectButton.tsx b/src/components/nav/ConnectButton.tsx index 1f813eb..934dd4b 100644 --- a/src/components/nav/ConnectButton.tsx +++ b/src/components/nav/ConnectButton.tsx @@ -6,6 +6,7 @@ import { Identicon } from 'src/components/Identicon' import { SolidButton } from 'src/components/buttons/SolidButton' import { BalancesSummary } from 'src/components/nav/BalancesSummary' import { NetworkModal } from 'src/components/nav/NetworkModal' +import { cleanupStaleWalletSessions } from 'src/config/wallets' import ClipboardDark from 'src/images/icons/clipboard-plus-dark.svg' import Clipboard from 'src/images/icons/clipboard-plus.svg' import CubeDark from 'src/images/icons/cube-dark.svg' @@ -24,6 +25,11 @@ export function ConnectButton() { const { openConnectModal } = useConnectModal() const { disconnect } = useDisconnect() + const onClickConnect = () => { + cleanupStaleWalletSessions() + openConnectModal?.() + } + const onClickCopy = async () => { if (!address) return await tryClipboardSet(address) @@ -91,7 +97,7 @@ export function ConnectButton() { styles="sm:mr-3" /> } - onClick={openConnectModal} + onClick={onClickConnect} >
Connect
diff --git a/src/components/nav/NetworkModal.tsx b/src/components/nav/NetworkModal.tsx index b4f9ae3..daf45c3 100644 --- a/src/components/nav/NetworkModal.tsx +++ b/src/components/nav/NetworkModal.tsx @@ -1,5 +1,6 @@ import { toast } from 'react-toastify' import { ChainMetadata, allChains, chainIdToChain } from 'src/config/chains' +import { cleanupStaleWalletSessions } from 'src/config/wallets' import { reset as accountReset } from 'src/features/accounts/accountSlice' import { reset as blockReset } from 'src/features/blocks/blockSlice' import { resetTokenPrices } from 'src/features/chart/tokenPriceSlice' @@ -25,6 +26,7 @@ export function NetworkModal({ isOpen, close }: Props) { try { if (!switchNetworkAsync) throw new Error('switchNetworkAsync undefined') logger.debug('Resetting and switching to network', c.name) + cleanupStaleWalletSessions() await switchNetworkAsync(c.chainId) dispatch(blockReset()) dispatch(accountReset()) @@ -38,9 +40,9 @@ export function NetworkModal({ isOpen, close }: Props) { return ( -
-
-
+
+
+
Connected to:
@@ -49,7 +51,7 @@ export function NetworkModal({ isOpen, close }: Props) {
-
+
Block Number:
@@ -58,7 +60,7 @@ export function NetworkModal({ isOpen, close }: Props) {
-
+
Node Rpc Url:
@@ -69,7 +71,7 @@ export function NetworkModal({ isOpen, close }: Props) {
-
+
{allChains.map((c) => (