From 71035fcf566c9ab57f6b213f684f5a2ac49beaf5 Mon Sep 17 00:00:00 2001 From: Trung-Tin Pham <60747384+AtelyPham@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:52:22 +0700 Subject: [PATCH] [RELEASE] Release tangle-dapp v0.0.17 (#2652) --- apps/tangle-dapp/CHANGELOG.md | 19 +++++ apps/tangle-dapp/package.json | 2 +- .../UpdateMetadataButton.tsx | 71 ++++++++++--------- 3 files changed, 58 insertions(+), 34 deletions(-) diff --git a/apps/tangle-dapp/CHANGELOG.md b/apps/tangle-dapp/CHANGELOG.md index 76bea2ba95..4db13ba645 100644 --- a/apps/tangle-dapp/CHANGELOG.md +++ b/apps/tangle-dapp/CHANGELOG.md @@ -1,3 +1,22 @@ +## 0.0.17 (2024-11-13) + + +### 🚀 Features + +- **tangle-dapp:** Implement LS pool modal: Update commission ([#2630](https://github.com/webb-tools/webb-dapp/pull/2630)) + +- **tangle-dapp:** Show validator address when avatar is hovered ([#2641](https://github.com/webb-tools/webb-dapp/pull/2641)) + +- **tangle-dapp:** Add LST selection modal ([#2644](https://github.com/webb-tools/webb-dapp/pull/2644)) + +- **tangle-cloud:** Configure Layout, Network, and Wallet ([#2651](https://github.com/webb-tools/webb-dapp/pull/2651)) + + +### ❤️ Thank You + +- Trung-Tin Pham @AtelyPham +- Yurixander @yurixander + ## 0.0.16 (2024-11-04) ### 🚀 Features diff --git a/apps/tangle-dapp/package.json b/apps/tangle-dapp/package.json index 3b4b501256..e88393af4b 100644 --- a/apps/tangle-dapp/package.json +++ b/apps/tangle-dapp/package.json @@ -1,6 +1,6 @@ { "name": "@webb-tools/tangle-dapp", - "version": "0.0.16", + "version": "0.0.17", "license": "Apache-2.0", "type": "commonjs" } diff --git a/libs/tangle-shared-ui/src/components/UpdateMetadataButton/UpdateMetadataButton.tsx b/libs/tangle-shared-ui/src/components/UpdateMetadataButton/UpdateMetadataButton.tsx index f61006333f..9f676a9a8e 100644 --- a/libs/tangle-shared-ui/src/components/UpdateMetadataButton/UpdateMetadataButton.tsx +++ b/libs/tangle-shared-ui/src/components/UpdateMetadataButton/UpdateMetadataButton.tsx @@ -23,11 +23,13 @@ import useLocalStorage, { import usePromise from '../../hooks/usePromise'; import useSubstrateInjectedExtension from '../../hooks/useSubstrateInjectedExtension'; import { getApiPromise } from '../../utils/polkadot/api'; +import { useActiveWallet } from '@webb-tools/api-provider-environment/hooks/useActiveWallet'; const UpdateMetadataButton: FC = () => { const [isHidden, setIsHidden] = useState(false); const [activeAccount] = useActiveAccount(); + const [activeWallet] = useActiveWallet(); const injector = useSubstrateInjectedExtension(); const { network } = useNetworkStore(); @@ -52,41 +54,44 @@ const UpdateMetadataButton: FC = () => { [setCache], ); - const isMetadataUpToDate = useMemo(() => { - // Only update metadata for the mainnet. This is because - // the testnet and local networks have the same genesis hash, - // so they represent the same network. Only the mainnet's metadata - // is relevant. - if (apiPromise === null || network.id !== NetworkId.TANGLE_MAINNET) { - return null; - } - - const genesisHash = apiPromise.genesisHash.toHex(); - const cachedEntry = cachedMetadata?.value?.[genesisHash]; - - if (cachedEntry === undefined) { - return false; - } - - return isEqual(cachedEntry, { - ss58Prefix: network.ss58Prefix, - tokenSymbol: network.tokenSymbol, - tokenDecimals: TANGLE_TOKEN_DECIMALS, - }); - }, [ - apiPromise, - cachedMetadata?.value, - network.id, - network.ss58Prefix, - network.tokenSymbol, - ]); - - const isSubstrateAccount = useMemo( - () => - activeAccount !== null ? isSubstrateAddress(activeAccount.address) : null, - [activeAccount], + const isMetadataUpToDate = useMemo( + () => { + // Only update metadata for the mainnet. This is because + // the testnet and local networks have the same genesis hash, + // so they represent the same network. Only the mainnet's metadata + // is relevant. + if (apiPromise === null || network.id !== NetworkId.TANGLE_MAINNET) { + return null; + } + + // If the active wallet is an EVM wallet, we don't need to update the metadata + if (activeWallet?.platform === 'EVM') { + return null; + } + + const genesisHash = apiPromise.genesisHash.toHex(); + const cachedEntry = cachedMetadata?.value?.[genesisHash]; + + if (cachedEntry === undefined) { + return false; + } + + return isEqual(cachedEntry, { + ss58Prefix: network.ss58Prefix, + tokenSymbol: network.tokenSymbol, + tokenDecimals: TANGLE_TOKEN_DECIMALS, + }); + }, + // prettier-ignore + [activeWallet?.platform, apiPromise, cachedMetadata?.value, network.id, network.ss58Prefix, network.tokenSymbol], ); + const isSubstrateAccount = useMemo(() => { + return activeAccount !== null + ? isSubstrateAddress(activeAccount.address) + : null; + }, [activeAccount]); + const handleClick = async () => { if ( injector === null ||