From 585ef6a5e6a74114ef444d885f8336b04f284629 Mon Sep 17 00:00:00 2001 From: guanbinrui Date: Fri, 8 Jul 2022 16:10:09 +0800 Subject: [PATCH 001/128] chore: bump version to 2.10.0 --- package.json | 2 +- packages/mask/src/manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c4567ffe0f0b..886f798f5ffc 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "yarn": ">=999.0.0", "npm": ">=999.0.0" }, - "version": "2.9.0", + "version": "2.10.0", "private": true, "license": "AGPL-3.0-or-later", "scripts": { diff --git a/packages/mask/src/manifest.json b/packages/mask/src/manifest.json index 965d53c21d67..31d049c54961 100644 --- a/packages/mask/src/manifest.json +++ b/packages/mask/src/manifest.json @@ -1,6 +1,6 @@ { "name": "Mask Network", - "version": "2.9.0", + "version": "2.10.0", "manifest_version": 2, "permissions": ["storage", "downloads", "webNavigation", "activeTab"], "optional_permissions": ["", "notifications", "clipboardRead"], From 965bc479ef4d7579a53d830a6d71ee6d8cb261d6 Mon Sep 17 00:00:00 2001 From: UncleBill Date: Fri, 8 Jul 2022 16:16:22 +0800 Subject: [PATCH 002/128] fix: get current visiting identity at initialization (#6718) --- packages/injected-script/main/index.ts | 2 +- .../main/sceneChange/twitter.ts | 42 ++++--------------- packages/injected-script/package.json | 4 ++ packages/injected-script/shared/index.ts | 1 + packages/injected-script/shared/tsconfig.json | 2 +- packages/injected-script/shared/twitter.ts | 30 +++++++++++++ .../twitter.com/collecting/identity.ts | 38 ++++++++++++----- packages/polyfills/types/global.d.ts | 7 +--- 8 files changed, 73 insertions(+), 53 deletions(-) create mode 100644 packages/injected-script/shared/twitter.ts diff --git a/packages/injected-script/main/index.ts b/packages/injected-script/main/index.ts index 03c3e225ecd0..ebaea3479a51 100644 --- a/packages/injected-script/main/index.ts +++ b/packages/injected-script/main/index.ts @@ -1,7 +1,7 @@ /// import './communicate' -import './locationChange' import './sceneChange' +import './locationChange' if (document.currentScript) document.currentScript.remove() diff --git a/packages/injected-script/main/sceneChange/twitter.ts b/packages/injected-script/main/sceneChange/twitter.ts index 906ef3102c60..b8497f2ab688 100644 --- a/packages/injected-script/main/sceneChange/twitter.ts +++ b/packages/injected-script/main/sceneChange/twitter.ts @@ -1,36 +1,6 @@ +import { TWITTER_RESERVED_SLUGS } from '../../shared' import { apply, dispatchEvent, no_xray_CustomEvent } from '../intrinsic' -// Collect from main js of Twitter's web client. -const RESERVED_SLUGS = [ - '404', - 'account', - 'download', - 'explore', - 'follower_requests', - 'hashtag', - 'home', - 'i', - 'intent', - 'lists', - 'login', - 'logout', - 'mentions', - 'messages', - 'notifications', - 'personalization', - 'search', - 'search-advanced', - 'search-home', - 'session', - 'settings', - 'share', - 'signup', - 'twitterblue', - 'webview', - 'welcome', - 'your_twitter_data', -] - const { split } = String.prototype const { filter, includes } = Array.prototype const { Boolean } = globalThis @@ -41,11 +11,11 @@ function getFirstSlug() { } export function setupWatcherForTwitter() { - let firstSlug = getFirstSlug() - window.addEventListener('locationchange', () => { + let firstSlug = '' + const update = () => { const newFirstSlug = getFirstSlug() // reset to void wrong value - if (!firstSlug || apply(includes, RESERVED_SLUGS, [firstSlug])) { + if (!firstSlug || apply(includes, TWITTER_RESERVED_SLUGS, [firstSlug])) { const event = new no_xray_CustomEvent('scenechange', { detail: { scene: 'unknown' }, }) as WindowEventMap['scenechange'] @@ -55,6 +25,7 @@ export function setupWatcherForTwitter() { if (firstSlug !== newFirstSlug) { firstSlug = newFirstSlug const event = new no_xray_CustomEvent('scenechange', { + cancelable: true, detail: { scene: 'profile', value: newFirstSlug, @@ -62,5 +33,6 @@ export function setupWatcherForTwitter() { }) apply(dispatchEvent, window, [event]) } - }) + } + window.addEventListener('locationchange', update) } diff --git a/packages/injected-script/package.json b/packages/injected-script/package.json index d8da8dfdaad7..50e4d70b8a3c 100644 --- a/packages/injected-script/package.json +++ b/packages/injected-script/package.json @@ -6,6 +6,10 @@ ".": { "webpack": "./sdk/index.ts", "default": "./dist/sdk/index.js" + }, + "./shared": { + "webpack": "./shared/index.ts", + "default": "./dist/shared/index.js" } }, "types": "./dist/sdk/index.d.ts", diff --git a/packages/injected-script/shared/index.ts b/packages/injected-script/shared/index.ts index 57f27c34a406..64cd167fef70 100644 --- a/packages/injected-script/shared/index.ts +++ b/packages/injected-script/shared/index.ts @@ -81,3 +81,4 @@ function isEventItemBeforeSerialization(data: unknown): data is EventItemBeforeS if (!isArray(data[1])) return false return true } +export * from './twitter' diff --git a/packages/injected-script/shared/tsconfig.json b/packages/injected-script/shared/tsconfig.json index 63aa902d948f..9cff811e50fc 100644 --- a/packages/injected-script/shared/tsconfig.json +++ b/packages/injected-script/shared/tsconfig.json @@ -5,6 +5,6 @@ "outDir": "../dist/shared", "tsBuildInfoFile": "../dist/shared.tsbuildinfo" }, - "files": ["./index.ts"], + "files": ["./index.ts", "./twitter.ts"], "references": [] } diff --git a/packages/injected-script/shared/twitter.ts b/packages/injected-script/shared/twitter.ts new file mode 100644 index 000000000000..5dcb44f510ce --- /dev/null +++ b/packages/injected-script/shared/twitter.ts @@ -0,0 +1,30 @@ +// Collect from main js of Twitter's web client. +export const TWITTER_RESERVED_SLUGS = [ + '404', + 'account', + 'download', + 'explore', + 'follower_requests', + 'hashtag', + 'home', + 'i', + 'intent', + 'lists', + 'login', + 'logout', + 'mentions', + 'messages', + 'notifications', + 'personalization', + 'search', + 'search-advanced', + 'search-home', + 'session', + 'settings', + 'share', + 'signup', + 'twitterblue', + 'webview', + 'welcome', + 'your_twitter_data', +] diff --git a/packages/mask/src/social-network-adaptor/twitter.com/collecting/identity.ts b/packages/mask/src/social-network-adaptor/twitter.com/collecting/identity.ts index fa07a7a2609f..d394351bf86b 100644 --- a/packages/mask/src/social-network-adaptor/twitter.com/collecting/identity.ts +++ b/packages/mask/src/social-network-adaptor/twitter.com/collecting/identity.ts @@ -1,17 +1,19 @@ -import { delay } from '@dimensiondev/kit' import { LiveSelector, MutationObserverWatcher } from '@dimensiondev/holoflows-kit' -import { Twitter } from '@masknet/web3-providers' +import { delay } from '@dimensiondev/kit' +import { TWITTER_RESERVED_SLUGS } from '@masknet/injected-script/shared' import { ProfileIdentifier } from '@masknet/shared-base' +import { Twitter } from '@masknet/web3-providers' +import { first } from 'lodash-unified' +import { creator, SocialNetworkUI as Next } from '../../../social-network' +import { twitterBase } from '../base' +import { isMobileTwitter } from '../utils/isMobile' import { + searchSelfAvatarSelector, searchSelfHandleSelector, searchSelfNicknameSelector, - searchSelfAvatarSelector, searchWatcherAvatarSelector, selfInfoSelectors, } from '../utils/selector' -import { creator, SocialNetworkUI as Next } from '../../../social-network' -import { twitterBase } from '../base' -import { isMobileTwitter } from '../utils/isMobile' function recognizeDesktop() { const collect = () => { @@ -111,13 +113,16 @@ function resolveLastRecognizedIdentityMobileInner( window.addEventListener('locationchange', onLocationChange, { signal: cancel }) } +function getFirstSlug() { + const slugs: string[] = location.pathname.split('/').filter(Boolean) + return first(slugs) +} + function resolveCurrentVisitingIdentityInner( ref: Next.CollectingCapabilities.IdentityResolveProvider['recognized'], cancel: AbortSignal, ) { - const update = async (event: WindowEventMap['scenechange']) => { - if (event.detail.scene !== 'profile' || !event.detail.value) return - const twitterId = event.detail.value + const update = async (twitterId: string) => { const user = await Twitter.getUserByScreenName(twitterId) const bio = user.legacy.description @@ -135,7 +140,20 @@ function resolveCurrentVisitingIdentityInner( } } - window.addEventListener('scenechange', update, { signal: cancel }) + const slug = getFirstSlug() + if (slug && !TWITTER_RESERVED_SLUGS.includes(slug)) { + update(slug) + } + + window.addEventListener( + 'scenechange', + (event) => { + if (event.detail.scene !== 'profile') return + const twitterId = event.detail.value + update(twitterId) + }, + { signal: cancel }, + ) } export const IdentityProviderTwitter: Next.CollectingCapabilities.IdentityResolveProvider = { diff --git a/packages/polyfills/types/global.d.ts b/packages/polyfills/types/global.d.ts index 27468229cb44..23fca567fef3 100644 --- a/packages/polyfills/types/global.d.ts +++ b/packages/polyfills/types/global.d.ts @@ -1,10 +1,5 @@ declare function r2d2Fetch(url: RequestInfo, init?: RequestInit): Promise -type SceneTypes = 'profile' | 'unknown' - interface WindowEventMap { - scenechange: CustomEvent<{ - scene: SceneTypes - value?: string - }> + scenechange: CustomEvent<{ scene: 'profile'; value: string }> | CustomEvent<{ scene: 'unknown' }> } From b1eb5e116168331c015794d8813786a6e7fa4a3b Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 16:39:48 +0800 Subject: [PATCH 003/128] fix: bugfix for connect wallet --- .../extension/popups/pages/Wallet/ConnectWallet/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/mask/src/extension/popups/pages/Wallet/ConnectWallet/index.tsx b/packages/mask/src/extension/popups/pages/Wallet/ConnectWallet/index.tsx index b3d93c7d20cf..530d0c256ca4 100644 --- a/packages/mask/src/extension/popups/pages/Wallet/ConnectWallet/index.tsx +++ b/packages/mask/src/extension/popups/pages/Wallet/ConnectWallet/index.tsx @@ -89,7 +89,10 @@ const ConnectWalletPage = memo(() => { return } - if (!wallets.length) navigate(PopupRoutes.Wallet, { replace: true }) + if (!wallets.length) { + navigate(PopupRoutes.Wallet, { replace: true }) + return + } navigate( urlcat(PopupRoutes.SelectWallet, { From 39bb72ddb2eacc4326b3e64e93b688d669563066 Mon Sep 17 00:00:00 2001 From: Lantt Date: Fri, 8 Jul 2022 16:57:05 +0800 Subject: [PATCH 004/128] style: fix tab component style --- .../mask/src/plugins/Approval/SNSAdaptor/ApprovalDialog.tsx | 6 +++--- packages/theme/src/Components/Tabs/BaseTab.tsx | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalDialog.tsx b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalDialog.tsx index 71bd3d54657a..343586690b46 100644 --- a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalDialog.tsx +++ b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalDialog.tsx @@ -1,4 +1,4 @@ -import { DialogContent, Button, Tab, Typography } from '@mui/material' +import { DialogContent, Button, Tab } from '@mui/material' import { MaskTabList, useTabs } from '@masknet/theme' import { TargetChainIdContext } from '@masknet/plugin-infra/web3-evm' import { useState } from 'react' @@ -45,8 +45,8 @@ export function ApprovalDialog({ open, onClose }: ApprovalDialogProps) { classes={{ paper: classes.dialogRoot, dialogTitle: classes.dialogTitle }} titleTabs={ - {t.tokens()}} value={t.tokens()} /> - {t.collectibles()}} value={t.collectibles()} /> + + }> diff --git a/packages/theme/src/Components/Tabs/BaseTab.tsx b/packages/theme/src/Components/Tabs/BaseTab.tsx index 0ab28eab4c8b..f0987e722af7 100644 --- a/packages/theme/src/Components/Tabs/BaseTab.tsx +++ b/packages/theme/src/Components/Tabs/BaseTab.tsx @@ -21,6 +21,7 @@ const BaseTabWrap = styled(Button, { '&:hover': { boxShadow: activated ? '0 0 20px rgba(0, 0, 0, 0.05)' : 'none', background: activated ? theme.palette.maskColor.bottom : 'transparent', + color: theme.palette.maskColor.main, }, })) From 3b7a5b6c69ec1eb498f80ccdb702cd89ba5702fa Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 17:04:48 +0800 Subject: [PATCH 005/128] fix: bugfix for status bar --- packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx | 5 ----- packages/mask/src/web3/UI/ChainBoundary.tsx | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx b/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx index 58a140552f9d..d14752768911 100644 --- a/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx +++ b/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx @@ -385,11 +385,6 @@ export function PetSetDialog({ configNFTs, onClose }: PetSetDialogProps) { noSwitchNetworkTip ActionButtonPromiseProps={{ fullWidth: true, - sx: { - height: 40, - padding: 0, - margin: 0, - }, }}> (props: ChainBoundaryPro const renderBox = (children?: React.ReactNode, tips?: string) => { return ( - + {children} From 497031be4e177e4ad5b4bc584730452e54ca482b Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 17:32:15 +0800 Subject: [PATCH 006/128] fix: link out icon --- .../Wallets/components/HistoryTableRow/index.tsx | 2 +- packages/icons/general/PopupLink.tsx | 15 +++++++++++++++ packages/icons/general/index.ts | 1 + .../components/shared/WalletStatusBox/index.tsx | 2 +- .../pages/Personas/ConnectedWallets/UI.tsx | 4 ++-- .../pages/Wallet/components/WalletHeader/UI.tsx | 4 ++-- .../trader/components/InputTokenPanelUI.tsx | 2 +- .../utils/components/PluginWalletStatusBar.tsx | 16 ++++++++-------- .../src/SNSAdaptor/components/WalletAssets.tsx | 2 +- .../src/SNSAdaptor/components/WalletSwitch.tsx | 2 +- 10 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 packages/icons/general/PopupLink.tsx diff --git a/packages/dashboard/src/pages/Wallets/components/HistoryTableRow/index.tsx b/packages/dashboard/src/pages/Wallets/components/HistoryTableRow/index.tsx index 56604e38f0d6..3167b610b9a9 100644 --- a/packages/dashboard/src/pages/Wallets/components/HistoryTableRow/index.tsx +++ b/packages/dashboard/src/pages/Wallets/components/HistoryTableRow/index.tsx @@ -33,7 +33,7 @@ const useStyles = makeStyles()((theme) => ({ }, linkIcon: { // TODO: replace with theme color - fill: theme.palette.mode === 'dark' ? '#F5F5F5' : '#07101B', + color: theme.palette.mode === 'dark' ? '#F5F5F5' : '#07101B', fontSize: 16, marginLeft: 10, }, diff --git a/packages/icons/general/PopupLink.tsx b/packages/icons/general/PopupLink.tsx new file mode 100644 index 000000000000..d59676c01546 --- /dev/null +++ b/packages/icons/general/PopupLink.tsx @@ -0,0 +1,15 @@ +import { createIcon } from '../utils' +import type { SvgIcon } from '@mui/material' + +export const PopupLinkIcon: typeof SvgIcon = createIcon( + 'PopupLinkIcon', + + + , + '0 0 12 12', +) diff --git a/packages/icons/general/index.ts b/packages/icons/general/index.ts index 7437955acca7..580a192f706c 100644 --- a/packages/icons/general/index.ts +++ b/packages/icons/general/index.ts @@ -139,3 +139,4 @@ export * from './CheckCircle' export * from './SuccessForSnackBar' export * from './MaskAvatarIcon' export * from './ArrowDownward' +export * from './PopupLink' diff --git a/packages/mask/src/components/shared/WalletStatusBox/index.tsx b/packages/mask/src/components/shared/WalletStatusBox/index.tsx index f43abb3ec3bd..89b03e2646f4 100644 --- a/packages/mask/src/components/shared/WalletStatusBox/index.tsx +++ b/packages/mask/src/components/shared/WalletStatusBox/index.tsx @@ -103,7 +103,7 @@ const useStyles = makeStyles<{ contentBackground?: string }>()((theme, { content fill: isDashboardPage() ? theme.palette.text.primary : theme.palette.maskColor.dark, }, linkIcon: { - fill: isDashboardPage() ? theme.palette.text.primary : theme.palette.maskColor?.dark, + color: isDashboardPage() ? theme.palette.text.primary : theme.palette.maskColor?.dark, }, statusBox: { position: 'relative', diff --git a/packages/mask/src/extension/popups/pages/Personas/ConnectedWallets/UI.tsx b/packages/mask/src/extension/popups/pages/Personas/ConnectedWallets/UI.tsx index 1a653ac1b1cb..8f927e07195f 100644 --- a/packages/mask/src/extension/popups/pages/Personas/ConnectedWallets/UI.tsx +++ b/packages/mask/src/extension/popups/pages/Personas/ConnectedWallets/UI.tsx @@ -5,7 +5,7 @@ import { useNetworkDescriptor } from '@masknet/plugin-infra/web3' import { FormattedAddress, ImageIcon } from '@masknet/shared' import { Button, Link, Typography } from '@mui/material' import { CopyIconButton } from '../../../components/CopyIconButton' -import { CircleLoadingIcon, DeleteIcon, EmptyIcon, LinkOutIcon } from '@masknet/icons' +import { CircleLoadingIcon, DeleteIcon, EmptyIcon, PopupLinkIcon } from '@masknet/icons' import type { ConnectedWalletInfo } from '../type' import { DisconnectWalletDialog } from '../components/DisconnectWalletDialog' import { useI18N } from '../../../../../utils' @@ -157,7 +157,7 @@ export const ConnectedWalletsUI = memo( href={explorerResolver.addressLink(chainId, wallet.identity ?? '')} target="_blank" rel="noopener noreferrer"> - + diff --git a/packages/mask/src/extension/popups/pages/Wallet/components/WalletHeader/UI.tsx b/packages/mask/src/extension/popups/pages/Wallet/components/WalletHeader/UI.tsx index 654ef9a2ba55..0ced616ee3fa 100644 --- a/packages/mask/src/extension/popups/pages/Wallet/components/WalletHeader/UI.tsx +++ b/packages/mask/src/extension/popups/pages/Wallet/components/WalletHeader/UI.tsx @@ -4,7 +4,7 @@ import { Box, Link, Typography } from '@mui/material' import { CopyIconButton } from '../../../../components/CopyIconButton' import { ChainIcon, FormattedAddress, WalletIcon } from '@masknet/shared' import { ChainId, formatEthereumAddress, explorerResolver, NetworkType } from '@masknet/web3-shared-evm' -import { ArrowDropIcon, LinkOutIcon, MaskBlueIcon } from '@masknet/icons' +import { ArrowDropIcon, MaskBlueIcon, PopupLinkIcon } from '@masknet/icons' import type { NetworkDescriptor, Wallet } from '@masknet/web3-shared-base' const useStyles = makeStyles()(() => ({ @@ -136,7 +136,7 @@ export const WalletHeaderUI = memo( href={explorerResolver.addressLink(chainId, wallet.address ?? '')} target="_blank" rel="noopener noreferrer"> - + diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trader/components/InputTokenPanelUI.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trader/components/InputTokenPanelUI.tsx index 3da3cd075fcd..0ff62d9e3d13 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trader/components/InputTokenPanelUI.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trader/components/InputTokenPanelUI.tsx @@ -43,7 +43,7 @@ const useStyles = makeStyles<{ isDashboard: boolean }>()((theme, { isDashboard } height: 20, backgroundColor: !isDashboard ? theme.palette.maskColor?.primary : undefined, '&:hover': { - backgroundColor: !isDashboard ? lighten(theme.palette.maskColor?.primary, 0.1) : undefined, + backgroundColor: !isDashboard ? `${lighten(theme.palette.maskColor?.primary, 0.1)}!important` : undefined, }, }, chipLabel: { diff --git a/packages/mask/src/utils/components/PluginWalletStatusBar.tsx b/packages/mask/src/utils/components/PluginWalletStatusBar.tsx index 4a420c5c9d2a..aee5db39142f 100644 --- a/packages/mask/src/utils/components/PluginWalletStatusBar.tsx +++ b/packages/mask/src/utils/components/PluginWalletStatusBar.tsx @@ -37,8 +37,8 @@ interface WalletStatusBarProps extends PropsWithChildren<{}> { const useStyles = makeStyles()((theme) => ({ root: { display: 'flex', - backgroundColor: parseColor(theme.palette.maskColor?.bottom).setAlpha(0.8).toRgbString(), - boxShadow: `0 0 20px ${parseColor(theme.palette.maskColor?.highlight).setAlpha(0.05).toRgbString()}`, + backgroundColor: parseColor(theme.palette.maskColor.bottom).setAlpha(0.8).toRgbString(), + boxShadow: `0 0 20px ${parseColor(theme.palette.maskColor.highlight).setAlpha(0.05).toRgbString()}`, backdropFilter: 'blur(16px)', padding: theme.spacing(2), borderRadius: '0 0 12px 12px', @@ -60,13 +60,13 @@ const useStyles = makeStyles()((theme) => ({ display: 'flex', alignItems: 'center', columnGap: 4, - color: theme.palette.maskColor?.main, + color: theme.palette.maskColor.main, fontWeight: 700, fontSize: 14, lineHeight: '18px', }, address: { - color: theme.palette.maskColor?.second, + color: theme.palette.maskColor.second, fontSize: 14, lineHeight: '18px', display: 'flex', @@ -79,19 +79,19 @@ const useStyles = makeStyles()((theme) => ({ gap: 2, borderRadius: 2, padding: '2px 4px', - backgroundColor: parseColor(theme.palette.maskColor?.warn).setAlpha(0.1).toRgbString(), - color: theme.palette.maskColor?.warn, + backgroundColor: parseColor(theme.palette.maskColor.warn).setAlpha(0.1).toRgbString(), + color: theme.palette.maskColor.warn, fontSize: 14, lineHeight: '18px', }, progress: { - color: theme.palette.maskColor?.warn, + color: theme.palette.maskColor.warn, }, linkIcon: { width: 14, height: 14, fontSize: 14, - fill: theme.palette.maskColor?.second, + color: theme.palette.maskColor.second, cursor: 'pointer', }, action: { diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletAssets.tsx b/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletAssets.tsx index 04a41965fa87..38f839a74630 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletAssets.tsx +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletAssets.tsx @@ -45,7 +45,7 @@ const useStyles = makeStyles()((theme) => { }, }, linkIcon: { - fill: theme.palette.maskColor.second, + color: theme.palette.maskColor.second, height: 20, width: 20, marginLeft: theme.spacing(0.5), diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletSwitch.tsx b/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletSwitch.tsx index b1cf6d81d2a1..6443bd11b57e 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletSwitch.tsx +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletSwitch.tsx @@ -45,7 +45,7 @@ const useStyles = makeStyles()((theme) => ({ alignItems: 'center', }, linkIcon: { - fill: theme.palette.maskColor.second, + color: theme.palette.maskColor.second, height: 15, width: 15, marginTop: '1px', From 73a5a898b6a53526d353e3d69afab32e1388f462 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 17:39:28 +0800 Subject: [PATCH 007/128] fix: primary color don't flow twitter --- .../social-network-adaptor/twitter.com/customization/custom.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts b/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts index 6ce8b5973fed..126aef156d7f 100644 --- a/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts +++ b/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts @@ -8,6 +8,7 @@ import type { SocialNetworkUI } from '../../../social-network' import { fromRGB, getBackgroundColor, getForegroundColor, isDark, shade, toRGB } from '../../../utils/theme' import { isMobileTwitter } from '../utils/isMobile' import { composeAnchorSelector, composeAnchorTextSelector, headingTextSelector } from '../utils/selector' +import { parseColor } from '@masknet/theme' const themeColorRef = new ValueRef('rgb(29, 161, 242)') const textColorRef = new ValueRef('rgb(255, 255, 255)') @@ -50,7 +51,7 @@ export function useThemeTwitterVariant(baseTheme: Theme) { const primaryContrastColor = useValueRef(textColorRef) const backgroundColor = useValueRef(backgroundColorRef) return useMemo(() => { - const primaryColorRGB = fromRGB(primaryColor)! + const primaryColorRGB = fromRGB(parseColor(baseTheme.palette.maskColor.primary).toRgbString())! const primaryContrastColorRGB = fromRGB(primaryContrastColor) setAutoFreeze(false) From 70bc9e5ce277d3f6cbe50fda206e362f363e013c Mon Sep 17 00:00:00 2001 From: Lantt Date: Fri, 8 Jul 2022 17:45:51 +0800 Subject: [PATCH 008/128] fix: trending maximum value format --- .../plugins/Trader/SNSAdaptor/trending/CoinMarketTable.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMarketTable.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMarketTable.tsx index 89fece8be549..8abe13fd5316 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMarketTable.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMarketTable.tsx @@ -62,7 +62,7 @@ export function FungibleCoinMarketTable(props: CoinMarketTableProps) { - + {market?.market_cap ? `$${formatSupply(market.market_cap)}` : '--'} ) : null} @@ -85,7 +85,7 @@ export function FungibleCoinMarketTable(props: CoinMarketTableProps) { - + {market?.total_volume ? `$${formatSupply(market.total_volume)}` : '--'} {dataProvider !== DataProvider.UNISWAP_INFO ? ( From 206227f86be81ec5b578bc9958007f5d66e8397c Mon Sep 17 00:00:00 2001 From: Lantt Date: Fri, 8 Jul 2022 17:54:21 +0800 Subject: [PATCH 009/128] feat: remove short name for bnb chain --- packages/web3-shared/evm/constants/descriptors.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/web3-shared/evm/constants/descriptors.ts b/packages/web3-shared/evm/constants/descriptors.ts index 0fd7557101ec..e0f468c7ac04 100644 --- a/packages/web3-shared/evm/constants/descriptors.ts +++ b/packages/web3-shared/evm/constants/descriptors.ts @@ -93,7 +93,6 @@ export const NETWORK_DESCRIPTORS: Array> chainId: ChainId.BSC, type: NetworkType.Binance, name: 'BNB Chain', - shortName: 'BNB', icon: new URL('../assets/binance.png', import.meta.url), iconColor: 'rgb(240, 185, 10)', backgroundGradient: 'linear-gradient(180deg, rgba(243, 186, 47, 0.15) 0%, rgba(243, 186, 47, 0.05) 100%)', From a50260be6b0302ff4587ae15cb325f5fd2b4a672 Mon Sep 17 00:00:00 2001 From: Randolph314 <97870249+Randolph314@users.noreply.github.com> Date: Fri, 8 Jul 2022 18:07:38 +0800 Subject: [PATCH 010/128] feat: change RSS3 icon style (#6723) Co-authored-by: Randolph <840094513@qq.com> --- .../plugins/Pets/SNSAdaptor/PetSetDialog.tsx | 6 +++++- .../mask/src/plugins/Pets/assets/rss3.tsx | 20 ++++--------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx b/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx index d14752768911..3e9a81a7f8b1 100644 --- a/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx +++ b/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx @@ -115,6 +115,10 @@ const useStyles = makeStyles()((theme) => ({ logo: { height: 21, }, + RSS3Icon: { + fontSize: 24, + fill: theme.palette.mode === 'light' ? '#000' : '#fff', + }, })) interface PetSetDialogProps { @@ -373,7 +377,7 @@ export function PetSetDialog({ configNFTs, onClose }: PetSetDialogProps) { RSS3 - + diff --git a/packages/mask/src/plugins/Pets/assets/rss3.tsx b/packages/mask/src/plugins/Pets/assets/rss3.tsx index e06bb99fef38..7778f2d9a0a7 100644 --- a/packages/mask/src/plugins/Pets/assets/rss3.tsx +++ b/packages/mask/src/plugins/Pets/assets/rss3.tsx @@ -2,22 +2,10 @@ import { createIcon } from '@masknet/icons' export const RSS3Icon = createIcon( 'RSS3Icon', - - - - + + + + , From d906ea5b9ee7e4f65f4f503f76717160f700f773 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 18:06:07 +0800 Subject: [PATCH 011/128] fix: snackbar --- .../twitter.com/customization/custom.ts | 3 +-- .../SNSAdaptor/components/ConsoleContent.tsx | 19 ++++++++++++++++++- .../theme/src/Components/Snackbar/index.tsx | 8 ++++---- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts b/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts index 126aef156d7f..6ce8b5973fed 100644 --- a/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts +++ b/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts @@ -8,7 +8,6 @@ import type { SocialNetworkUI } from '../../../social-network' import { fromRGB, getBackgroundColor, getForegroundColor, isDark, shade, toRGB } from '../../../utils/theme' import { isMobileTwitter } from '../utils/isMobile' import { composeAnchorSelector, composeAnchorTextSelector, headingTextSelector } from '../utils/selector' -import { parseColor } from '@masknet/theme' const themeColorRef = new ValueRef('rgb(29, 161, 242)') const textColorRef = new ValueRef('rgb(255, 255, 255)') @@ -51,7 +50,7 @@ export function useThemeTwitterVariant(baseTheme: Theme) { const primaryContrastColor = useValueRef(textColorRef) const backgroundColor = useValueRef(backgroundColorRef) return useMemo(() => { - const primaryColorRGB = fromRGB(parseColor(baseTheme.palette.maskColor.primary).toRgbString())! + const primaryColorRGB = fromRGB(primaryColor)! const primaryContrastColorRGB = fromRGB(primaryContrastColor) setAutoFreeze(false) diff --git a/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx b/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx index 39fc5a22876d..fe36f6c370e7 100644 --- a/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx +++ b/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx @@ -11,7 +11,7 @@ import { useWeb3State, Web3Helper, } from '@masknet/plugin-infra/web3' -import { makeStyles } from '@masknet/theme' +import { makeStyles, useCustomSnackbar } from '@masknet/theme' import { NetworkPluginID, SourceType } from '@masknet/web3-shared-base' import { ChainId, @@ -152,6 +152,8 @@ export function ConsoleContent(props: ConsoleContentProps) { const onSelectFungibleToken = useSelectFungibleToken() const onSelectGasSettings = useSelectAdvancedSettings(NetworkPluginID.PLUGIN_EVM) + const { showSnackbar, closeSnackbar } = useCustomSnackbar() + return (
@@ -487,6 +489,21 @@ export function ConsoleContent(props: ConsoleContentProps) { + + Test Snackbar + + + +
diff --git a/packages/theme/src/Components/Snackbar/index.tsx b/packages/theme/src/Components/Snackbar/index.tsx index df9fcdedf173..2ec07f0ba924 100644 --- a/packages/theme/src/Components/Snackbar/index.tsx +++ b/packages/theme/src/Components/Snackbar/index.tsx @@ -11,7 +11,7 @@ import { SnackbarAction, OptionsObject, } from 'notistack' -import { Typography, IconButton } from '@mui/material' +import { Typography, IconButton, alpha } from '@mui/material' import classnames from 'classnames' import { Close as CloseIcon } from '@mui/icons-material' import WarningIcon from '@mui/icons-material/Warning' @@ -64,15 +64,15 @@ to { }, } const success = { - backgroundColor: MaskColorVar.greenMain, + backgroundColor: theme.palette.maskColor.success, color: '#ffffff', [`& .${refs.title}`]: { color: 'inherit', }, [`& .${refs.message}`]: { - color: MaskColorVar.normalTextLight, + color: alpha(theme.palette.maskColor.white, 0.8), '& svg': { - color: MaskColorVar.white, + color: theme.palette.maskColor.white, }, }, } as const From d0ca0ddef1c3cbf03abad61d98764880e75b881e Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 19:07:52 +0800 Subject: [PATCH 012/128] fix: bugfix for application --- packages/mask/src/components/shared/ApplicationBoard.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/mask/src/components/shared/ApplicationBoard.tsx b/packages/mask/src/components/shared/ApplicationBoard.tsx index d13712e340fc..0cc6a1221167 100644 --- a/packages/mask/src/components/shared/ApplicationBoard.tsx +++ b/packages/mask/src/components/shared/ApplicationBoard.tsx @@ -235,8 +235,10 @@ function RenderEntryComponent({ application }: { application: Application }) { }, []) const clickHandler = useMemo(() => { - if (application.isWalletConnectedRequired || application.isWalletConnectedEVMRequired) - return () => setSelectProviderDialog({ open: true }) + if (application.isWalletConnectedRequired || application.isWalletConnectedEVMRequired) { + return (walletConnectedCallback?: () => void) => + setSelectProviderDialog({ open: true, walletConnectedCallback }) + } if (!application.entry.nextIdRequired) return if (ApplicationEntryStatus.isPersonaConnected === false || ApplicationEntryStatus.isPersonaCreated === false) return createOrConnectPersona From ccafbf31d17e8f818f6f504b310065245cad9873 Mon Sep 17 00:00:00 2001 From: Lantt Date: Fri, 8 Jul 2022 19:11:04 +0800 Subject: [PATCH 013/128] feat: format token security supply format --- .../src/SNSAdaptor/components/TokenPanel.tsx | 6 +++--- .../UI/components/TokenSecurity/components/TokenPanel.tsx | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/TokenPanel.tsx b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/TokenPanel.tsx index bf36eced894d..59812b63163e 100644 --- a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/TokenPanel.tsx +++ b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/TokenPanel.tsx @@ -5,7 +5,7 @@ import React from 'react' import { useTheme } from '@mui/system' import { makeStyles, usePortalShadowRoot } from '@masknet/theme' import { explorerResolver, formatEthereumAddress } from '@masknet/web3-shared-evm' -import { formatCurrency } from '@masknet/web3-shared-base' +import { formatCurrency, formatSupply } from '@masknet/web3-shared-base' import { LinkOutIcon } from '@masknet/icons' const useStyles = makeStyles()((theme) => ({ @@ -57,7 +57,7 @@ export const TokenPanel = React.forwardRef(({ tokenSecurity, tokenMarketCap }: T arrow title={ theme.palette.text.buttonText} className={classes.tooltip}> - {tokenSecurity.total_supply} + {tokenSecurity.total_supply ? formatSupply(tokenSecurity.total_supply) : DEFAULT_PLACEHOLDER} }> {formatTotalSupply(tokenSecurity.total_supply)} @@ -140,7 +140,7 @@ export const TokenPanel = React.forwardRef(({ tokenSecurity, tokenMarketCap }: T {t.token_market_cap()} - {tokenMarketCap ? formatCurrency(tokenMarketCap) : DEFAULT_PLACEHOLDER} + {tokenMarketCap ? `$${formatSupply(tokenMarketCap)}` : DEFAULT_PLACEHOLDER} diff --git a/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx b/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx index d5817705696d..86485c104399 100644 --- a/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx +++ b/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx @@ -6,7 +6,7 @@ import { useTheme } from '@mui/system' import { ExternalLink } from 'react-feather' import { makeStyles, usePortalShadowRoot } from '@masknet/theme' import { explorerResolver, formatEthereumAddress } from '@masknet/web3-shared-evm' -import { formatCurrency } from '@masknet/web3-shared-base' +import { formatCurrency, formatSupply } from '@masknet/web3-shared-base' const useStyles = makeStyles()((theme) => ({ card: { @@ -56,7 +56,7 @@ export const TokenPanel = React.forwardRef(({ tokenSecurity, tokenMarketCap }: T arrow title={ theme.palette.info.contrastText} className={classes.tooltip}> - {tokenSecurity.total_supply} + {tokenSecurity.total_supply ? formatSupply(tokenSecurity.total_supply) : DEFAULT_PLACEHOLDER} }> {formatTotalSupply(tokenSecurity.total_supply)} @@ -139,8 +139,7 @@ export const TokenPanel = React.forwardRef(({ tokenSecurity, tokenMarketCap }: T {t.token_info_market_cap()} - {' '} - {tokenMarketCap ? formatCurrency(tokenMarketCap) : DEFAULT_PLACEHOLDER}{' '} + {tokenMarketCap ? `$${formatSupply(tokenMarketCap)}` : DEFAULT_PLACEHOLDER} From 92c7791ac4355101fd3836270f8f16bafcb10896 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 19:12:58 +0800 Subject: [PATCH 014/128] fix: issue #6725 --- .../src/utils/theme/useClassicMaskFullPageTheme.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/mask/src/utils/theme/useClassicMaskFullPageTheme.ts b/packages/mask/src/utils/theme/useClassicMaskFullPageTheme.ts index 8a0da1724299..3854232ac03b 100644 --- a/packages/mask/src/utils/theme/useClassicMaskFullPageTheme.ts +++ b/packages/mask/src/utils/theme/useClassicMaskFullPageTheme.ts @@ -1,10 +1,11 @@ // ! This file is used during SSR. DO NOT import new files that does not work in SSR import type { LanguageOptions } from '@masknet/public-api' -import { Appearance } from '@masknet/theme' +import { Appearance, MaskColors } from '@masknet/theme' import { PaletteMode, unstable_createMuiStrictModeTheme } from '@mui/material' import { MaskDarkTheme, MaskLightTheme } from './MaskTheme' import { useThemeLanguage } from './useThemeLanguage' +import produce, { setAutoFreeze } from 'immer' /** * @deprecated Should migrate to \@masknet/theme @@ -15,7 +16,13 @@ export function useClassicMaskFullPageTheme(userPreference: Appearance, language const finalPalette: PaletteMode = userPreference === Appearance.default ? systemPreference : userPreference const baseTheme = finalPalette === 'dark' ? MaskDarkTheme : MaskLightTheme - return unstable_createMuiStrictModeTheme(baseTheme, useThemeLanguage(language)) + setAutoFreeze(false) + const maskTheme = produce(baseTheme, (theme) => { + const colorSchema = MaskColors[theme.palette.mode] + theme.palette.maskColor = colorSchema.maskColor + }) + setAutoFreeze(true) + return unstable_createMuiStrictModeTheme(maskTheme, useThemeLanguage(language)) } /** From 9ca3e02c5538c3124d95477764a5bf72f3c8cefd Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 20:00:54 +0800 Subject: [PATCH 015/128] fix: bugfix for mask textfield --- packages/theme/src/Components/TextField/index.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/theme/src/Components/TextField/index.tsx b/packages/theme/src/Components/TextField/index.tsx index 83bbd4cf47f5..907c22c31b80 100644 --- a/packages/theme/src/Components/TextField/index.tsx +++ b/packages/theme/src/Components/TextField/index.tsx @@ -2,6 +2,9 @@ import { ForwardedRef, forwardRef } from 'react' import { Box, formHelperTextClasses, TextField, StandardTextFieldProps, InputProps, Typography } from '@mui/material' import { makeStyles } from '../../UIHelper/makeStyles' import { getMaskColor, MaskColorVar } from '../../CSSVariables/vars' +import { isDashboardPage } from '@masknet/shared-base' + +const isDashboard = isDashboardPage() const useStyles = makeStyles()((theme) => ({ label: { @@ -27,12 +30,16 @@ const useStyles = makeStyles()((theme) => ({ lineHeight: '16px', }, '& input::-webkit-input-placeholder': { - color: theme.palette.maskColor.second, + color: !isDashboard ? theme.palette.maskColor.second : undefined, }, }, input: { padding: theme.spacing(1), - background: theme.palette.maskColor.input, + background: !isDashboard + ? theme.palette.maskColor.input + : theme.palette.mode === 'dark' + ? '#2B2E4C' + : '#F6F6F8', fontSize: 13, lineHeight: '16px', borderRadius: 6, @@ -46,7 +53,7 @@ const useStyles = makeStyles()((theme) => ({ color: 'rgba(255, 255, 255, 0.4)', }, inputFocused: { - backgroundColor: theme.palette.maskColor.input, + backgroundColor: !isDashboard ? theme.palette.maskColor.input : MaskColorVar.primaryBackground, boxShadow: `0 0 0 2px ${theme.palette.mode === 'dark' ? '#4F5378' : 'rgba(28, 104, 243, 0.2)'}`, }, })) From 6be4c13a7ad444ae67b46cd84f4577bb5de51cee Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 21:14:44 +0800 Subject: [PATCH 016/128] fix: popup --- .../src/extension/popups/pages/Wallet/SignRequest/index.tsx | 2 +- packages/plugin-infra/src/web3-state/Provider.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/mask/src/extension/popups/pages/Wallet/SignRequest/index.tsx b/packages/mask/src/extension/popups/pages/Wallet/SignRequest/index.tsx index 23ad029712bb..8cf87df86127 100644 --- a/packages/mask/src/extension/popups/pages/Wallet/SignRequest/index.tsx +++ b/packages/mask/src/extension/popups/pages/Wallet/SignRequest/index.tsx @@ -155,7 +155,7 @@ const SignRequest = memo(() => { {t('popups_wallet_signature_request')} {wallet?.name ?? ''} - {address} + {typeof address === 'string' ? address : undefined} diff --git a/packages/plugin-infra/src/web3-state/Provider.ts b/packages/plugin-infra/src/web3-state/Provider.ts index 080adc4b39ef..d42bb5c9538b 100644 --- a/packages/plugin-infra/src/web3-state/Provider.ts +++ b/packages/plugin-infra/src/web3-state/Provider.ts @@ -109,7 +109,7 @@ export class ProviderState< const siteType = getSiteType() if (!siteType) return - this.storage.providerType.setValue(this.options.getDefaultProviderType()) + this.storage.providerType.setValue(this.options.getDefaultProviderType(siteType)) }) }) } From a9f0fc5318c918f3a55ed804013d465b9cdbc0e8 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 21:28:17 +0800 Subject: [PATCH 017/128] fix: ui style --- .../src/plugins/MaskBox/SNSAdaptor/components/DetailsTab.tsx | 2 ++ packages/mask/src/utils/components/PluginWalletStatusBar.tsx | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/mask/src/plugins/MaskBox/SNSAdaptor/components/DetailsTab.tsx b/packages/mask/src/plugins/MaskBox/SNSAdaptor/components/DetailsTab.tsx index 2424d5bbd90c..7ce607cb793f 100644 --- a/packages/mask/src/plugins/MaskBox/SNSAdaptor/components/DetailsTab.tsx +++ b/packages/mask/src/plugins/MaskBox/SNSAdaptor/components/DetailsTab.tsx @@ -26,11 +26,13 @@ const useStyles = makeStyles()((theme) => ({ fontWeight: 500, lineHeight: '24px', marginBottom: theme.spacing(4), + color: theme.palette.maskColor.dark, }, content: { fontSize: 14, lineHeight: '24px', whiteSpace: 'pre-line', + color: theme.palette.maskColor.dark, }, })) diff --git a/packages/mask/src/utils/components/PluginWalletStatusBar.tsx b/packages/mask/src/utils/components/PluginWalletStatusBar.tsx index aee5db39142f..cb25fbf6494c 100644 --- a/packages/mask/src/utils/components/PluginWalletStatusBar.tsx +++ b/packages/mask/src/utils/components/PluginWalletStatusBar.tsx @@ -36,6 +36,7 @@ interface WalletStatusBarProps extends PropsWithChildren<{}> { const useStyles = makeStyles()((theme) => ({ root: { + boxSizing: 'content-box', display: 'flex', backgroundColor: parseColor(theme.palette.maskColor.bottom).setAlpha(0.8).toRgbString(), boxShadow: `0 0 20px ${parseColor(theme.palette.maskColor.highlight).setAlpha(0.05).toRgbString()}`, From 183344afb935d39f8933f691eeccda14de08a1bf Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 21:45:47 +0800 Subject: [PATCH 018/128] fix: add tooltip to game plugin --- packages/mask/src/plugins/Game/SNSAdaptor/index.tsx | 12 ++++++++++-- .../web3/UI/EthereumERC721TokenApprovedBoundary.tsx | 5 ----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/mask/src/plugins/Game/SNSAdaptor/index.tsx b/packages/mask/src/plugins/Game/SNSAdaptor/index.tsx index 2019b5b5dbd8..4347fb83b272 100644 --- a/packages/mask/src/plugins/Game/SNSAdaptor/index.tsx +++ b/packages/mask/src/plugins/Game/SNSAdaptor/index.tsx @@ -22,10 +22,18 @@ const sns: Plugin.SNSAdaptor.Definition = { const name = return { ApplicationEntryID: base.ID, - RenderEntryComponent({ disabled }) { + RenderEntryComponent({ disabled, ...props }) { const { openDialog } = useRemoteControlledDialog(PluginGameMessages.events.gameDialogUpdated) - return + return ( + + ) }, appBoardSortingDefaultPriority: 11, marketListSortingPriority: 12, diff --git a/packages/mask/src/web3/UI/EthereumERC721TokenApprovedBoundary.tsx b/packages/mask/src/web3/UI/EthereumERC721TokenApprovedBoundary.tsx index 261a0bcacc17..99168f60dcc9 100644 --- a/packages/mask/src/web3/UI/EthereumERC721TokenApprovedBoundary.tsx +++ b/packages/mask/src/web3/UI/EthereumERC721TokenApprovedBoundary.tsx @@ -65,7 +65,6 @@ export function EthereumERC721TokenApprovedBoundary(props: EthereumERC712TokenAp @@ -96,7 +94,6 @@ export function EthereumERC721TokenApprovedBoundary(props: EthereumERC712TokenAp @@ -126,7 +122,6 @@ export function EthereumERC721TokenApprovedBoundary(props: EthereumERC712TokenAp From cd11fc1db51b12df225964146f3247c68dd23947 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 22:01:00 +0800 Subject: [PATCH 019/128] fix: remove startIcon --- .../options-page/DashboardComponents/ActionButton.tsx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/mask/src/extension/options-page/DashboardComponents/ActionButton.tsx b/packages/mask/src/extension/options-page/DashboardComponents/ActionButton.tsx index 438a889dc2cf..9f58f86bd127 100644 --- a/packages/mask/src/extension/options-page/DashboardComponents/ActionButton.tsx +++ b/packages/mask/src/extension/options-page/DashboardComponents/ActionButton.tsx @@ -169,16 +169,7 @@ export function ActionButtonPromise(props: ActionButtonPromiseProps) { }, [executor, noUpdateEffect]) if (state === 'wait') - return ( - - ) + return if (state === 'complete') return ( Date: Fri, 8 Jul 2022 22:23:00 +0800 Subject: [PATCH 020/128] fix: open select wallet dialog when click game without wallet --- packages/mask/src/plugins/Game/SNSAdaptor/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mask/src/plugins/Game/SNSAdaptor/index.tsx b/packages/mask/src/plugins/Game/SNSAdaptor/index.tsx index 4347fb83b272..0cf4b93930ab 100644 --- a/packages/mask/src/plugins/Game/SNSAdaptor/index.tsx +++ b/packages/mask/src/plugins/Game/SNSAdaptor/index.tsx @@ -31,7 +31,7 @@ const sns: Plugin.SNSAdaptor.Definition = { disabled={disabled} title={name} icon={icon} - onClick={openDialog} + onClick={props.onClick ? () => props.onClick?.(openDialog) : openDialog} /> ) }, From 77fdeb409139e0af2e027e26340235277a406956 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Fri, 8 Jul 2022 23:01:53 +0800 Subject: [PATCH 021/128] fix: button style at referral --- .../mask/src/plugins/Referral/SNSAdaptor/FarmPost.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/mask/src/plugins/Referral/SNSAdaptor/FarmPost.tsx b/packages/mask/src/plugins/Referral/SNSAdaptor/FarmPost.tsx index 8b8e4a214ccf..baf5da7165de 100644 --- a/packages/mask/src/plugins/Referral/SNSAdaptor/FarmPost.tsx +++ b/packages/mask/src/plugins/Referral/SNSAdaptor/FarmPost.tsx @@ -192,15 +192,18 @@ export function FarmPost(props: FarmPostProps) { )} - - + + - - From b7c3af918116a20fccb404d28c6599701c56dbde Mon Sep 17 00:00:00 2001 From: lelenei <72531217+lelenei@users.noreply.github.com> Date: Fri, 8 Jul 2022 23:11:25 +0800 Subject: [PATCH 022/128] fix: css style (#6730) --- packages/mask/src/plugins/CryptoartAI/SNSAdaptor/ActionBar.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/ActionBar.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/ActionBar.tsx index cc898a98a4f3..6051dbc657e2 100644 --- a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/ActionBar.tsx +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/ActionBar.tsx @@ -59,6 +59,7 @@ export function ActionBar(props: ActionBarProps) { assetSource?.trade?.is_auction ? ( { onOpenOfferDialog() }}> @@ -70,7 +71,7 @@ export function ActionBar(props: ActionBarProps) { !assetSource?.is24Auction && assetSource?.priceInEth < 100000 && assetSource?.trade?.isCanBuy ? ( - + {t('plugin_collectible_buy_now')} ) : null} From 7776fcc2532b02d7dbb30b62699cca52226cc78b Mon Sep 17 00:00:00 2001 From: UncleBill Date: Fri, 8 Jul 2022 23:17:55 +0800 Subject: [PATCH 023/128] fix: link link on by coingecko is incorrect (#6731) --- .../web3-providers/src/coingecko/index.ts | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/web3-providers/src/coingecko/index.ts b/packages/web3-providers/src/coingecko/index.ts index cc99f155024c..c88a29637929 100644 --- a/packages/web3-providers/src/coingecko/index.ts +++ b/packages/web3-providers/src/coingecko/index.ts @@ -2,7 +2,7 @@ import { DataProvider } from '@masknet/public-api' import { CurrencyType, Price } from '@masknet/web3-shared-base' import type { ChainId } from '@masknet/web3-shared-evm' import urlcat from 'urlcat' -import { uniq } from 'lodash-unified' +import { uniq, uniqBy } from 'lodash-unified' import { getCommunityLink, isMirroredKeyword, resolveChainId, resolveCoinAddress } from '../CoinMarketCap/helper' import { fetchJSON } from '../helpers' import { PriceAPI, TrendingAPI, TrendingCoinType } from '../types' @@ -57,7 +57,7 @@ export class CoinGeckoAPI implements PriceAPI.Provider, TrendingAPI.Provider x.toLowerCase(), + ), ), source_code_urls: Object.values(info.links.repos_url).flatMap((x) => x), home_urls: info.links.homepage.filter(Boolean), From f14b8e4f238380f2c07aed84023417ad9a50c53f Mon Sep 17 00:00:00 2001 From: Randolph314 <97870249+Randolph314@users.noreply.github.com> Date: Fri, 8 Jul 2022 23:18:07 +0800 Subject: [PATCH 024/128] fix: web3 profile bug (#6727) * feat: delete LinkOutIcon initial fill color * feat: refresh wallet setting date when wallets change * feat: change button name and collection style Co-authored-by: Randolph <840094513@qq.com> --- packages/icons/general/LinkOut.tsx | 1 - .../Web3Profile/src/SNSAdaptor/components/ImageManagement.tsx | 2 +- .../Web3Profile/src/SNSAdaptor/components/WalletSetting.tsx | 2 +- packages/plugins/Web3Profile/src/locales/en-US.json | 3 ++- packages/shared/src/UI/components/NFTCard/index.tsx | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/icons/general/LinkOut.tsx b/packages/icons/general/LinkOut.tsx index 3dfd945cc774..7d42b718ffe5 100644 --- a/packages/icons/general/LinkOut.tsx +++ b/packages/icons/general/LinkOut.tsx @@ -7,7 +7,6 @@ export const LinkOutIcon: typeof SvgIcon = createIcon( , diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/components/ImageManagement.tsx b/packages/plugins/Web3Profile/src/SNSAdaptor/components/ImageManagement.tsx index 69da446dd5e5..380c3f181f16 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/components/ImageManagement.tsx +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/components/ImageManagement.tsx @@ -127,7 +127,7 @@ export function ImageManagement(props: ImageManagementProps) { )) ) : ( - + )} {!hasConnectedWallets && ( diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletSetting.tsx b/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletSetting.tsx index fc28d84146cc..7a30bda13bbc 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletSetting.tsx +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletSetting.tsx @@ -156,7 +156,7 @@ const WalletSetting = memo( -1, ), ) - }, [open]) + }, [open, wallets]) useEffect(() => { if (confirmButtonDisabled) setConfirmButtonDisabled(false) diff --git a/packages/plugins/Web3Profile/src/locales/en-US.json b/packages/plugins/Web3Profile/src/locales/en-US.json index b99a368308a5..8116d5297dfd 100644 --- a/packages/plugins/Web3Profile/src/locales/en-US.json +++ b/packages/plugins/Web3Profile/src/locales/en-US.json @@ -26,7 +26,8 @@ "copied": "Copied", "listed": "Listed", "unlisted": "Unlisted", - "add_wallet": "No connected wallet, pleae add wallet.", + "add_wallet": "Add Wallet", + "add_wallet_to_connected": "No connected wallet, pleae add wallet.", "open_wallet": "You’ve switched off all wallets. Please go to settings to active.", "tip_persona_sign_success": "Persona signed successfully.", "tip_wallet_sign_error": "Wallet connection failed.", diff --git a/packages/shared/src/UI/components/NFTCard/index.tsx b/packages/shared/src/UI/components/NFTCard/index.tsx index b9303adc712a..241ea284d505 100644 --- a/packages/shared/src/UI/components/NFTCard/index.tsx +++ b/packages/shared/src/UI/components/NFTCard/index.tsx @@ -67,6 +67,7 @@ const useStyles = makeStyles<{ networkPluginID: NetworkPluginID }>()((theme, pro display: 'flex', justifyContent: 'center', alignItems: 'center', + borderRadius: 12, }, image: { width: 126, From 6258961e6eeae90d7696dce9f1c7cdb6cfca1a37 Mon Sep 17 00:00:00 2001 From: lelenei <72531217+lelenei@users.noreply.github.com> Date: Fri, 8 Jul 2022 23:18:13 +0800 Subject: [PATCH 025/128] fix: add collectible dialog (#6729) --- packages/mask/src/components/shared/ApplicationBoard.tsx | 5 ++--- .../mask/src/components/shared/ApplicationRecommendArea.tsx | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/mask/src/components/shared/ApplicationBoard.tsx b/packages/mask/src/components/shared/ApplicationBoard.tsx index 0cc6a1221167..7780fc90ed7a 100644 --- a/packages/mask/src/components/shared/ApplicationBoard.tsx +++ b/packages/mask/src/components/shared/ApplicationBoard.tsx @@ -1,6 +1,5 @@ import { useState, useContext, createContext, PropsWithChildren, useMemo, useCallback, useEffect } from 'react' import { makeStyles, getMaskColor } from '@masknet/theme' -import { useTimeout } from 'react-use' import { Typography } from '@mui/material' import { useActivatedPluginsSNSAdaptor } from '@masknet/plugin-infra/content-script' import { useCurrentWeb3NetworkPluginID, useAccount, useChainId } from '@masknet/plugin-infra/web3' @@ -18,6 +17,7 @@ import { usePersonaAgainstSNSConnectStatus } from '../DataSource/usePersonaAgain import { WalletMessages } from '../../plugins/Wallet/messages' import { PersonaContext } from '../../extension/popups/pages/Personas/hooks/usePersonaContext' import { MaskMessages } from '../../../shared' +import { useTimeout } from 'react-use' const useStyles = makeStyles<{ shouldScroll: boolean; isCarouselReady: boolean }>()((theme, props) => { const smallQuery = `@media (max-width: ${theme.breakpoints.values.sm}px)` @@ -168,9 +168,8 @@ function ApplicationBoardContent(props: Props) { setIsHoveringCarousel(hover)} + setIsHoveringCarousel={setIsHoveringCarousel} /> {listedAppList.length > 0 ? ( diff --git a/packages/mask/src/components/shared/ApplicationRecommendArea.tsx b/packages/mask/src/components/shared/ApplicationRecommendArea.tsx index 2dbde990ff38..d09b82f690ed 100644 --- a/packages/mask/src/components/shared/ApplicationRecommendArea.tsx +++ b/packages/mask/src/components/shared/ApplicationRecommendArea.tsx @@ -42,7 +42,7 @@ const useStyles = makeStyles()(() => { interface Props { recommendFeatureAppList: Application[] RenderEntryComponent: (props: { application: Application }) => JSX.Element - isCarouselReady: () => boolean | null + isCarouselReady?: () => boolean | null setIsHoveringCarousel: (hover: boolean) => void isHoveringCarousel: boolean } @@ -61,7 +61,7 @@ export function ApplicationRecommendArea(props: Props) { return ( <> - {recommendFeatureAppList.length > 2 && isCarouselReady() ? ( + {recommendFeatureAppList.length > 2 && isCarouselReady?.() ? ( Date: Sat, 9 Jul 2022 09:17:19 +0800 Subject: [PATCH 026/128] fix: share button at pets dialog --- packages/mask/src/plugins/Pets/SNSAdaptor/PetDialog.tsx | 2 +- packages/mask/src/plugins/Pets/SNSAdaptor/PetShareDialog.tsx | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/mask/src/plugins/Pets/SNSAdaptor/PetDialog.tsx b/packages/mask/src/plugins/Pets/SNSAdaptor/PetDialog.tsx index 77ca0256bbc0..bad57c29ff2c 100644 --- a/packages/mask/src/plugins/Pets/SNSAdaptor/PetDialog.tsx +++ b/packages/mask/src/plugins/Pets/SNSAdaptor/PetDialog.tsx @@ -42,7 +42,7 @@ export function PetDialog() { onClose={handleClose} title={step === PetFriendNFTStep.SetFriendNFT ? t.pets_dialog_title() : t.pets_dialog_title_share()} titleBarIconStyle="back"> - + {step === PetFriendNFTStep.SetFriendNFT ? ( ) : ( diff --git a/packages/mask/src/plugins/Pets/SNSAdaptor/PetShareDialog.tsx b/packages/mask/src/plugins/Pets/SNSAdaptor/PetShareDialog.tsx index 7eeac16a1104..70b515a07ed7 100644 --- a/packages/mask/src/plugins/Pets/SNSAdaptor/PetShareDialog.tsx +++ b/packages/mask/src/plugins/Pets/SNSAdaptor/PetShareDialog.tsx @@ -8,6 +8,10 @@ import { Share_Twitter_TXT } from '../constants' const useStyles = makeStyles()((theme) => ({ root: { margin: theme.spacing(0, 2.5), + flex: 1, + display: 'flex', + flexDirection: 'column', + justifyContent: 'space-between', }, shareNotice: { color: theme.palette.maskColor.main, From 7d8c66c80230ddc846c0443fd3da74ed3c504344 Mon Sep 17 00:00:00 2001 From: UncleBill Date: Sat, 9 Jul 2022 11:00:18 +0800 Subject: [PATCH 027/128] fix: detecting scenechange (#6724) * fix: detecting scenechange * fix: follow up reviews * add useSceneChange hook --- .../main/sceneChange/twitter.ts | 2 +- .../twitter.com/collecting/identity.ts | 1 + .../mask/src/utils/hooks/useSceneChange.ts | 8 ++++ packages/web3-providers/src/twitter/index.ts | 37 +++++++++++++------ packages/web3-providers/src/types.ts | 2 +- 5 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 packages/mask/src/utils/hooks/useSceneChange.ts diff --git a/packages/injected-script/main/sceneChange/twitter.ts b/packages/injected-script/main/sceneChange/twitter.ts index b8497f2ab688..5ff16de8d4c8 100644 --- a/packages/injected-script/main/sceneChange/twitter.ts +++ b/packages/injected-script/main/sceneChange/twitter.ts @@ -15,7 +15,7 @@ export function setupWatcherForTwitter() { const update = () => { const newFirstSlug = getFirstSlug() // reset to void wrong value - if (!firstSlug || apply(includes, TWITTER_RESERVED_SLUGS, [firstSlug])) { + if (!newFirstSlug || apply(includes, TWITTER_RESERVED_SLUGS, [newFirstSlug])) { const event = new no_xray_CustomEvent('scenechange', { detail: { scene: 'unknown' }, }) as WindowEventMap['scenechange'] diff --git a/packages/mask/src/social-network-adaptor/twitter.com/collecting/identity.ts b/packages/mask/src/social-network-adaptor/twitter.com/collecting/identity.ts index d394351bf86b..b0fabd0fb176 100644 --- a/packages/mask/src/social-network-adaptor/twitter.com/collecting/identity.ts +++ b/packages/mask/src/social-network-adaptor/twitter.com/collecting/identity.ts @@ -124,6 +124,7 @@ function resolveCurrentVisitingIdentityInner( ) { const update = async (twitterId: string) => { const user = await Twitter.getUserByScreenName(twitterId) + if (!user) return const bio = user.legacy.description const nickname = user.legacy.name diff --git a/packages/mask/src/utils/hooks/useSceneChange.ts b/packages/mask/src/utils/hooks/useSceneChange.ts new file mode 100644 index 000000000000..fd912c98c6ac --- /dev/null +++ b/packages/mask/src/utils/hooks/useSceneChange.ts @@ -0,0 +1,8 @@ +import { useEffect } from 'react' + +export function useSceneChange(handler: (event: WindowEventMap['scenechange']) => void) { + useEffect(() => { + window.addEventListener('scenechange', handler) + return () => window.removeEventListener('scenechange', handler) + }, [handler]) +} diff --git a/packages/web3-providers/src/twitter/index.ts b/packages/web3-providers/src/twitter/index.ts index f589576f5a7a..c0b8e02ec7c5 100644 --- a/packages/web3-providers/src/twitter/index.ts +++ b/packages/web3-providers/src/twitter/index.ts @@ -1,5 +1,6 @@ import { escapeRegExp } from 'lodash-unified' import urlcat from 'urlcat' +import LRUCache from 'lru-cache' import type { TwitterBaseAPI } from '../types' const UPLOAD_AVATAR_URL = 'https://upload.twitter.com/i/media/upload.json' @@ -117,6 +118,11 @@ async function getSettings(bearerToken: string, csrfToken: string): Promise({ + max: 20, + ttl: 300_000, +}) + export class TwitterAPI implements TwitterBaseAPI.Provider { async getSettings() { const { bearerToken, queryToken, csrfToken } = await getTokens() @@ -197,7 +203,7 @@ export class TwitterAPI implements TwitterBaseAPI.Provider { } } - async getUserByScreenName(screenName: string): Promise { + async getUserByScreenName(screenName: string): Promise { const { bearerToken, csrfToken, queryId } = await getTokens('UserByScreenName') const url = urlcat('https://twitter.com/i/api/graphql/:queryId/UserByScreenName', { queryId, @@ -207,17 +213,26 @@ export class TwitterAPI implements TwitterBaseAPI.Provider { withSuperFollowsUserFields: true, }), }) + const cacheKey = `${bearerToken}/${csrfToken}/${url}` + const fetchingTask: Promise = + cache.get(cacheKey) ?? + fetch(url, { + headers: { + authorization: `Bearer ${bearerToken}`, + 'x-csrf-token': csrfToken, + 'content-type': 'application/json', + 'x-twitter-auth-type': 'OAuth2Session', + 'x-twitter-active-user': 'yes', + referer: `https://twitter.com/${screenName}`, + }, + }) - const response = await fetch(url, { - headers: { - authorization: `Bearer ${bearerToken}`, - 'x-csrf-token': csrfToken, - 'content-type': 'application/json', - 'x-twitter-auth-type': 'OAuth2Session', - 'x-twitter-active-user': 'yes', - referer: `https://twitter.com/${screenName}`, - }, - }) + cache.set(cacheKey, fetchingTask) + const response = (await fetchingTask).clone() + if (!response.ok) { + cache.delete(cacheKey) + return null + } const userResponse: TwitterBaseAPI.UserByScreenNameResponse = await response.json() return userResponse.data.user.result } diff --git a/packages/web3-providers/src/types.ts b/packages/web3-providers/src/types.ts index a8150e067e8b..e6cbfc9ef785 100644 --- a/packages/web3-providers/src/types.ts +++ b/packages/web3-providers/src/types.ts @@ -531,7 +531,7 @@ export namespace TwitterBaseAPI { > uploadUserAvatar: (screenName: string, image: Blob | File) => Promise updateProfileImage: (screenName: string, media_id_str: string) => Promise - getUserByScreenName: (screenName: string) => Promise + getUserByScreenName: (screenName: string) => Promise } } From 1cd2c71945e2543d5a5702c6241eff7e1a689afb Mon Sep 17 00:00:00 2001 From: UncleBill Date: Sun, 10 Jul 2022 15:51:16 +0800 Subject: [PATCH 028/128] fix(tip): remove link and click to select on NFT item (#6736) --- .../Tips/components/NFTSection/NFTList.tsx | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/packages/mask/src/plugins/Tips/components/NFTSection/NFTList.tsx b/packages/mask/src/plugins/Tips/components/NFTSection/NFTList.tsx index c3296c95f061..9a3db51223c5 100644 --- a/packages/mask/src/plugins/Tips/components/NFTSection/NFTList.tsx +++ b/packages/mask/src/plugins/Tips/components/NFTSection/NFTList.tsx @@ -2,9 +2,8 @@ import { useChainId, useCurrentWeb3NetworkPluginID, useWeb3State, Web3Helper } f import { ElementAnchor, NFTCardStyledAssetPlayer, RetryHint } from '@masknet/shared' import { LoadingBase, makeStyles } from '@masknet/theme' import { isSameAddress, NetworkPluginID, NonFungibleToken } from '@masknet/web3-shared-base' -import { Checkbox, Link, List, ListItem, Radio, Stack, Tooltip } from '@mui/material' +import { Checkbox, List, ListItem, Radio, Stack, Tooltip } from '@mui/material' import classnames from 'classnames' -import { noop } from 'lodash-unified' import { FC, useCallback } from 'react' import type { TipNFTKeyPair } from '../../types' @@ -153,13 +152,6 @@ export const NFTList: FC = ({ {tokens.map((token) => { const selected = includes(selectedPairs, [token.contract?.address!, token.tokenId]) const disabled = !isRadio && reachedLimit && !selected - const link = token.contract - ? Others?.explorerResolver?.nonFungibleTokenLink( - token.contract.chainId, - token.contract.address, - token.tokenId, - ) - : undefined const name = token.collection?.name || token.contract?.name const title = `${name} ${Others?.formatTokenId(token.tokenId, 2)}` return ( @@ -181,22 +173,19 @@ export const NFTList: FC = ({ [classes.disabled]: disabled, [classes.selected]: selected, [classes.unselected]: selectedPairs.length > 0 && !selected, - })}> - - - + })} + onClick={() => { + if (disabled) return + if (selected) { + toggleItem(null, '') + } else { + toggleItem(token.tokenId, token.contract?.address) + } + }}> + { - if (disabled) return - if (selected) { - toggleItem(null, '') - } else { - toggleItem(token.tokenId, token.contract?.address) - } - }} className={classes.checkbox} checked={selected} /> From c450676ba0ca47966d0ae6baac0c747d944b7f09 Mon Sep 17 00:00:00 2001 From: UncleBill Date: Sun, 10 Jul 2022 15:51:28 +0800 Subject: [PATCH 029/128] fix(Connection): use promise instead of function that return promise (#6740) --- packages/plugins/EVM/src/state/Connection/connection.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugins/EVM/src/state/Connection/connection.ts b/packages/plugins/EVM/src/state/Connection/connection.ts index 0da7171ec6e0..9516ddbf3c50 100644 --- a/packages/plugins/EVM/src/state/Connection/connection.ts +++ b/packages/plugins/EVM/src/state/Connection/connection.ts @@ -60,8 +60,8 @@ import { getReceiptStatus } from './utils' import { Web3StateSettings } from '../../settings' import { getSubscriptionCurrentValue, PartialRequired } from '@masknet/shared-base' -const EMPTY_STRING = () => Promise.resolve('') -const ZERO = () => Promise.resolve(0) +const EMPTY_STRING = Promise.resolve('') +const ZERO = Promise.resolve(0) export function isReadOnlyMethod(method: EthereumMethodType) { return [ From b384b093183b294505f1d60e0b57130586122bbf Mon Sep 17 00:00:00 2001 From: UncleBill Date: Sun, 10 Jul 2022 15:59:58 +0800 Subject: [PATCH 030/128] fix: some fixes for pending transaction (#6737) --- packages/mask/shared-ui/locales/en-US.json | 7 ++++--- .../src/components/InjectedComponents/ToolboxUnstyled.tsx | 2 -- .../components/shared/WalletStatusBox/TransactionList.tsx | 4 ++-- .../shared/WalletStatusBox/usePendingTransactions.tsx | 5 +---- packages/plugins/Web3Profile/src/locales/languages.ts | 4 +--- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/packages/mask/shared-ui/locales/en-US.json b/packages/mask/shared-ui/locales/en-US.json index 901f2b8d58de..818f0871562b 100644 --- a/packages/mask/shared-ui/locales/en-US.json +++ b/packages/mask/shared-ui/locales/en-US.json @@ -212,7 +212,6 @@ "export": "Export", "wallet_status_bar_pending": "Pending", "wallet_load_retry": "Failed to load {{symbol}}. Click to retry.", - "wallet_status_bar_pending": "Pending", "wallet_name": "Wallet Name", "wallet_rename": "Rename Wallet", "wallet_loading_nft_contract": "Loading NFT contract...", @@ -252,7 +251,8 @@ "wallet_balance": "Balance", "wallet_balance_eth": "Balance(ETH)", "wallet_new": "New Wallet", - "wallet_status_pending": "Pending{{plural}}", + "wallet_status_pending_one": "{{count}} Pending", + "wallet_status_pending_other": "{{count}} Pendings", "wallet_status_pending_clear_all": "Clear All", "wallet_status_pending_clear": "Clear", "wallet_status_button_change": "Change", @@ -340,7 +340,8 @@ "plugin_wallet_on_create": "Create Wallet", "plugin_wallet_on_connect": "Connect Wallet", "plugin_wallet_wrong_network": "Wrong Network", - "plugin_wallet_pending_transactions": "{{count}} Pending{{plural}}", + "plugin_wallet_pending_transactions_one": "{{count}} Pending", + "plugin_wallet_pending_transactions_other": "{{count}} Pendings", "plugin_wallet_import_wallet": "Import Wallet", "plugin_wallet_select_provider_dialog_title": "Connect Wallet", "plugin_wallet_qr_code_with_wallet_connect": "Scan QR code with a WalletConnect-compatible wallet", diff --git a/packages/mask/src/components/InjectedComponents/ToolboxUnstyled.tsx b/packages/mask/src/components/InjectedComponents/ToolboxUnstyled.tsx index d86f569fe75a..a844efcda9cb 100644 --- a/packages/mask/src/components/InjectedComponents/ToolboxUnstyled.tsx +++ b/packages/mask/src/components/InjectedComponents/ToolboxUnstyled.tsx @@ -95,7 +95,6 @@ export function ToolboxHintUnstyled(props: ToolboxHintProps) { function ToolboxHintForApplication(props: ToolboxHintProps) { const { ListItemButton = MuiListItemButton, - ListItemIcon = MuiListItemIcon, Container = 'div', Typography = MuiTypography, iconSize = 24, @@ -243,7 +242,6 @@ function useToolbox() { {t('plugin_wallet_pending_transactions', { count: pendingTransactions.length, - plural: pendingTransactions.length > 1 ? 's' : '', })} diff --git a/packages/mask/src/components/shared/WalletStatusBox/TransactionList.tsx b/packages/mask/src/components/shared/WalletStatusBox/TransactionList.tsx index fdc4582e8cc4..b47affa9ce6c 100644 --- a/packages/mask/src/components/shared/WalletStatusBox/TransactionList.tsx +++ b/packages/mask/src/components/shared/WalletStatusBox/TransactionList.tsx @@ -58,14 +58,14 @@ const useStyles = makeStyles()((theme) => ({ }, linkIcon: { // TODO: replace with theme color - fill: theme.palette.mode === 'dark' ? '#F5F5F5' : '#07101B', + color: theme.palette.mode === 'dark' ? '#F5F5F5' : '#07101B', width: 17.5, height: 17.5, marginLeft: theme.spacing(0.5), }, clear: { fontSize: 14, - color: theme.palette.mode === 'light' ? MaskColorVar.blue : theme.palette.common.white, + color: MaskColorVar.blue, cursor: 'pointer', }, })) diff --git a/packages/mask/src/components/shared/WalletStatusBox/usePendingTransactions.tsx b/packages/mask/src/components/shared/WalletStatusBox/usePendingTransactions.tsx index 3ef54106328d..6ca4a8ba109c 100644 --- a/packages/mask/src/components/shared/WalletStatusBox/usePendingTransactions.tsx +++ b/packages/mask/src/components/shared/WalletStatusBox/usePendingTransactions.tsx @@ -59,10 +59,7 @@ export function usePendingTransactions() {
{pendingTransactions.length ? ( - {pendingTransactions.length}{' '} - {t('wallet_status_pending', { - plural: pendingTransactions.length > 1 ? 's' : '', - })} + {t('wallet_status_pending', { count: pendingTransactions.length })} ) : null}
diff --git a/packages/plugins/Web3Profile/src/locales/languages.ts b/packages/plugins/Web3Profile/src/locales/languages.ts index cff1155ab4cb..48c9a26a18f7 100644 --- a/packages/plugins/Web3Profile/src/locales/languages.ts +++ b/packages/plugins/Web3Profile/src/locales/languages.ts @@ -16,8 +16,6 @@ export const languages = { 'zh-CN': zh_CN, zh: zh_TW, } -import { createI18NBundle } from '@masknet/shared-base' -export const add__template__I18N = createI18NBundle('__template__', languages) // @ts-ignore if (import.meta.webpackHot) { // @ts-ignore @@ -27,7 +25,7 @@ if (import.meta.webpackHot) { globalThis.dispatchEvent?.( new CustomEvent('MASK_I18N_HMR', { detail: [ - '__template__', + 'io.mask.web3-profile', { en: en_US, ja: ja_JP, ko: ko_KR, qy: qya_AA, 'zh-CN': zh_CN, zh: zh_TW }, ], }), From d34c7a0bb6385f1cd3530c75ad5bbc00de62af20 Mon Sep 17 00:00:00 2001 From: Randolph314 <97870249+Randolph314@users.noreply.github.com> Date: Sun, 10 Jul 2022 17:02:34 +0800 Subject: [PATCH 031/128] fix: web3 profile bug (#6741) * feat: delete LinkOutIcon initial fill color * feat: refresh wallet setting date when wallets change * feat: change button name and collection style * feat: change nextId UI under web3 tab * fix: address display of menu * fix: copywriting of FindTruman * fix: donations and footprints display * feat: chang fundtruman copywriting Co-authored-by: Randolph <840094513@qq.com> --- packages/mask/shared-ui/locales/en-US.json | 3 ++- .../FindTruman/SNSAdaptor/FindTrumanDialog.tsx | 9 ++++----- .../src/plugins/FindTruman/locales/en-US.json | 3 ++- .../src/plugins/NextID/components/NextIdPage.tsx | 15 --------------- packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx | 10 ++++++---- packages/plugins/RSS3/src/SNSAdaptor/index.tsx | 8 +------- 6 files changed, 15 insertions(+), 33 deletions(-) diff --git a/packages/mask/shared-ui/locales/en-US.json b/packages/mask/shared-ui/locales/en-US.json index 818f0871562b..7fd4b4a393a2 100644 --- a/packages/mask/shared-ui/locales/en-US.json +++ b/packages/mask/shared-ui/locales/en-US.json @@ -210,7 +210,6 @@ "sharing": "Sharing", "transfer": "Transfer", "export": "Export", - "wallet_status_bar_pending": "Pending", "wallet_load_retry": "Failed to load {{symbol}}. Click to retry.", "wallet_name": "Wallet Name", "wallet_rename": "Rename Wallet", @@ -423,6 +422,8 @@ "plugin_savings_withdraw": "Withdraw", "plugin_savings_process_deposit": "Processing Deposit", "plugin_savings_process_withdraw": "Processing Withdrawal", + "plugin_findtruman_powered_by": "Powered By", + "plugin_findtruman_find_truman": "FindTruman", "plugin_trader_swap": "Swap", "plugin_trader_wrap": "Wrap", "plugin_trader_swap_from": "You sell", diff --git a/packages/mask/src/plugins/FindTruman/SNSAdaptor/FindTrumanDialog.tsx b/packages/mask/src/plugins/FindTruman/SNSAdaptor/FindTrumanDialog.tsx index 6fe99aa90272..6f2d69701e93 100644 --- a/packages/mask/src/plugins/FindTruman/SNSAdaptor/FindTrumanDialog.tsx +++ b/packages/mask/src/plugins/FindTruman/SNSAdaptor/FindTrumanDialog.tsx @@ -10,10 +10,9 @@ import { FindTrumanContext } from '../context' import { useAccount, useChainId } from '@masknet/plugin-infra/web3' import { useConst } from './hooks/useConst' import IntroductionPanel from './IntroductionPanel' -import { PluginWalletStatusBar } from '../../../utils' +import { PluginWalletStatusBar, useI18N } from '../../../utils' import { ChainBoundary } from '../../../web3/UI/ChainBoundary' import { NetworkPluginID } from '@masknet/web3-shared-base' -import { useI18N } from '../locales' const useStyles = makeStyles()((theme, props) => ({ wrapper: { @@ -77,7 +76,7 @@ interface FindTrumanDialogProps { } export function FindTrumanDialog(props: FindTrumanDialogProps) { - const i18N = useI18N() + const { t: i18N } = useI18N() const { open, onClose } = props const { classes } = useStyles() const account = useAccount() @@ -126,10 +125,10 @@ export function FindTrumanDialog(props: FindTrumanDialogProps) { color="textSecondary" fontSize={14} fontWeight={700}> - {i18N.powered_by()} + {i18N('plugin_findtruman_powered_by')}
- FindTruman + {i18N('plugin_findtruman_find_truman')} - - {t.verify_Twitter_ID_intro()} - {t.verify_Twitter_ID()} - - - - - - - ) - } - return ( <> diff --git a/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx b/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx index 247dca396a53..888796c26d09 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx @@ -108,7 +108,10 @@ export function TabCard({ type, socialAddressList, persona }: TabCardProps) { className={classes.button}> {selectedAddress?.type === SocialAddressType.KV || selectedAddress?.type === SocialAddressType.ADDRESS ? ( - + ) : ( selectedAddress.label )} @@ -123,9 +126,8 @@ export function TabCard({ type, socialAddressList, persona }: TabCardProps) { {uniqBy(socialAddressList ?? [], (x) => x.address.toLowerCase()).map((x) => { return ( onSelect(x)}> - {selectedAddress?.type === SocialAddressType.KV || - selectedAddress?.type === SocialAddressType.ADDRESS ? ( - + {x?.type === SocialAddressType.KV || x?.type === SocialAddressType.ADDRESS ? ( + ) : ( x.label )} diff --git a/packages/plugins/RSS3/src/SNSAdaptor/index.tsx b/packages/plugins/RSS3/src/SNSAdaptor/index.tsx index 454adf7a5020..1d3e40b7a429 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/index.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/index.tsx @@ -12,13 +12,7 @@ function sorter(a: SocialAddress, z: SocialAddress>) { - return ( - addressNames?.some( - (x) => - (x.type === SocialAddressType.RSS3 || x.type === SocialAddressType.KV) && - x.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM, - ) ?? false - ) + return !!addressNames?.some((x) => x.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM) } const sns: Plugin.SNSAdaptor.Definition = { From ca30ba2603f98b9b16f7c94d4b0cab166a41f039 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Mon, 11 Jul 2022 01:19:33 +0800 Subject: [PATCH 032/128] fix: incorrect gas config --- .../plugin-infra/src/web3/EVM/useGasConfig.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/plugin-infra/src/web3/EVM/useGasConfig.ts b/packages/plugin-infra/src/web3/EVM/useGasConfig.ts index 8846b45668e8..29c2648ad867 100644 --- a/packages/plugin-infra/src/web3/EVM/useGasConfig.ts +++ b/packages/plugin-infra/src/web3/EVM/useGasConfig.ts @@ -3,10 +3,14 @@ import { useAsync } from 'react-use' import { GasOptionConfig, formatGweiToWei, ChainId } from '@masknet/web3-shared-evm' import { GasOptionType, NetworkPluginID } from '@masknet/web3-shared-base' import { useGasOptions } from '../useGasOptions' +import { useWeb3State } from '../useWeb3State' // TODO: support multiple chain export function useGasConfig(chainId: ChainId) { const [gasConfig, setGasConfig] = useState() + const { Others } = useWeb3State(NetworkPluginID.PLUGIN_EVM) + const isEIP1559 = Others?.chainResolver.isSupport(chainId, 'EIP1559') + const { value: gasOptions_ } = useGasOptions(NetworkPluginID.PLUGIN_EVM) const { value: gasPrice } = useAsync(async () => { try { @@ -17,10 +21,16 @@ export function useGasConfig(chainId: ChainId) { gasOptions_?.[GasOptionType.NORMAL]?.suggestedMaxPriorityFeePerGas ?? 0, ).toFixed(0) - setGasConfig({ - maxFeePerGas, - maxPriorityFeePerGas, - }) + setGasConfig( + isEIP1559 + ? { + maxFeePerGas, + maxPriorityFeePerGas, + } + : { + gasPrice: maxFeePerGas, + }, + ) return maxFeePerGas } catch (err) { setGasConfig(undefined) From 1dac99a4e8c48004a8217e166c63668462ebc307 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 11 Jul 2022 08:39:39 +0800 Subject: [PATCH 033/128] fix: mf 1404 --- .../plugins/Furucombo/UI/FurucomboView.tsx | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/packages/mask/src/plugins/Furucombo/UI/FurucomboView.tsx b/packages/mask/src/plugins/Furucombo/UI/FurucomboView.tsx index 9db48c74425d..2b93051ef30c 100644 --- a/packages/mask/src/plugins/Furucombo/UI/FurucomboView.tsx +++ b/packages/mask/src/plugins/Furucombo/UI/FurucomboView.tsx @@ -1,10 +1,9 @@ import { useChainId } from '@masknet/plugin-infra/web3' import { isSameAddress, NetworkPluginID } from '@masknet/web3-shared-base' import { makeStyles, MaskColorVar } from '@masknet/theme' -import { Card, CardContent, Tabs, Tab, Typography, Paper, CircularProgress, Button, Stack, Box } from '@mui/material' +import { Card, CardContent, Tabs, Tab, Typography, Paper, CircularProgress, Button, Stack } from '@mui/material' import { useState } from 'react' import { useI18N } from '../../../utils/i18n-next-ui' -import { ChainBoundary } from '../../../web3/UI/ChainBoundary' import { useFetchPools } from '../hooks/usePool' import type { Investable } from '../types' import { InvestmentsView } from './InvestmentsView' @@ -88,19 +87,9 @@ export function FurucomboView(props: PoolViewProps) { if (!investable) return ( - <> - - {t('plugin_furucombo_pool_not_found')} - - - - - - + + {t('plugin_furucombo_pool_not_found')} + ) return ( @@ -123,9 +112,6 @@ export function FurucomboView(props: PoolViewProps) { - - - ) } From 41d50649e825688d377f1e263dd1a11778051911 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 11 Jul 2022 08:43:49 +0800 Subject: [PATCH 034/128] chore: remove undefined locale key --- packages/mask/shared-ui/locales/qya-AA.json | 1 - packages/mask/src/utils/components/PluginWalletStatusBar.tsx | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/mask/shared-ui/locales/qya-AA.json b/packages/mask/shared-ui/locales/qya-AA.json index 0c61af603c7c..e6cb343c82ed 100644 --- a/packages/mask/shared-ui/locales/qya-AA.json +++ b/packages/mask/shared-ui/locales/qya-AA.json @@ -205,7 +205,6 @@ "sharing": "crwdns4469:0crwdne4469:0", "transfer": "crwdns4471:0crwdne4471:0", "export": "crwdns9305:0crwdne9305:0", - "wallet_status_bar_pending": "crwdns17546:0crwdne17546:0", "wallet_load_retry": "crwdns10135:0{{symbol}}crwdne10135:0", "wallet_name": "crwdns4487:0crwdne4487:0", "wallet_rename": "crwdns4489:0crwdne4489:0", diff --git a/packages/mask/src/utils/components/PluginWalletStatusBar.tsx b/packages/mask/src/utils/components/PluginWalletStatusBar.tsx index cb25fbf6494c..d6a43e5da0f0 100644 --- a/packages/mask/src/utils/components/PluginWalletStatusBar.tsx +++ b/packages/mask/src/utils/components/PluginWalletStatusBar.tsx @@ -212,7 +212,7 @@ export function PluginWalletStatusBar({ e.stopPropagation() openWalletStatusDialog() }}> - {t('wallet_status_bar_pending')} + {t('recent_transaction_pending')} ) : null} From fa631a17ce74dcbc8fc380d40869837bf2a1d92e Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 11 Jul 2022 08:58:44 +0800 Subject: [PATCH 035/128] fix: type error --- packages/mask/src/components/shared/ApplicationBoard.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/mask/src/components/shared/ApplicationBoard.tsx b/packages/mask/src/components/shared/ApplicationBoard.tsx index 7780fc90ed7a..df1df8a44f8d 100644 --- a/packages/mask/src/components/shared/ApplicationBoard.tsx +++ b/packages/mask/src/components/shared/ApplicationBoard.tsx @@ -235,8 +235,7 @@ function RenderEntryComponent({ application }: { application: Application }) { const clickHandler = useMemo(() => { if (application.isWalletConnectedRequired || application.isWalletConnectedEVMRequired) { - return (walletConnectedCallback?: () => void) => - setSelectProviderDialog({ open: true, walletConnectedCallback }) + return (walletConnectedCallback?: () => void) => setSelectProviderDialog({ open: true }) } if (!application.entry.nextIdRequired) return if (ApplicationEntryStatus.isPersonaConnected === false || ApplicationEntryStatus.isPersonaCreated === false) From 31e31c637dbe170978d2d8377ff69472de0416c8 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 11 Jul 2022 10:06:02 +0800 Subject: [PATCH 036/128] fix: mf 1365 --- packages/mask/src/plugins/RedPacket/SNSAdaptor/index.tsx | 1 + packages/plugin-infra/src/types.ts | 1 + .../shared/src/UI/components/ApplicationEntry/index.tsx | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/index.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/index.tsx index b052fd414538..ab225bc6139c 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/index.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/index.tsx @@ -93,6 +93,7 @@ const sns: Plugin.SNSAdaptor.Definition = { const recommendFeature = { description: , backgroundGradient: 'linear-gradient(180.54deg, #FF9A9E 0.71%, #FECFEF 98.79%, #FECFEF 99.78%)', + isFirst: true, } return { ApplicationEntryID: base.ID, diff --git a/packages/plugin-infra/src/types.ts b/packages/plugin-infra/src/types.ts index 35c32492029d..de1241da56ee 100644 --- a/packages/plugin-infra/src/types.ts +++ b/packages/plugin-infra/src/types.ts @@ -547,6 +547,7 @@ export namespace Plugin.SNSAdaptor { recommendFeature?: { description: React.ReactNode backgroundGradient: string + isFirst?: boolean } } diff --git a/packages/shared/src/UI/components/ApplicationEntry/index.tsx b/packages/shared/src/UI/components/ApplicationEntry/index.tsx index faaf122c198d..b7cffde3258c 100644 --- a/packages/shared/src/UI/components/ApplicationEntry/index.tsx +++ b/packages/shared/src/UI/components/ApplicationEntry/index.tsx @@ -55,8 +55,12 @@ const useStyles = makeStyles<{ disabled: boolean; iconFilterColor?: string }>()( color: theme.palette.mode === 'light' ? theme.palette.common.white : theme.palette.common.black, }, arrow: { + marginLeft: '-12px', color: theme.palette.mode === 'light' ? theme.palette.common.black : theme.palette.common.white, }, + firstAreaArrow: { + marginLeft: '12px !important', + }, recommendFeatureApplicationBox: { width: 220, minWidth: 220, @@ -139,7 +143,10 @@ export function ApplicationEntry(props: ApplicationEntryProps) { disablePortal: true, placement: recommendFeature ? 'bottom' : 'top', }} - classes={{ tooltip: classes.tooltip, arrow: classes.arrow }} + classes={{ + tooltip: classes.tooltip, + arrow: classNames(classes.arrow, recommendFeature?.isFirst ? classes.firstAreaArrow : ''), + }} placement={recommendFeature ? 'bottom' : 'top'} arrow disableHoverListener={!tooltipHint} From e918990e84bacd4cdb4ae47fa6be1bd562a211a6 Mon Sep 17 00:00:00 2001 From: Lantt Date: Mon, 11 Jul 2022 11:16:52 +0800 Subject: [PATCH 037/128] fix: token id maybe is string in alchemy --- packages/web3-providers/src/alchemy/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web3-providers/src/alchemy/index.ts b/packages/web3-providers/src/alchemy/index.ts index fd8a9599c3a6..f9b841b335d0 100644 --- a/packages/web3-providers/src/alchemy/index.ts +++ b/packages/web3-providers/src/alchemy/index.ts @@ -146,7 +146,7 @@ function createNftToken_EVM( asset: AlchemyNFT_EVM, ): NonFungibleAsset { const contractAddress = asset.contract?.address - const tokenId = Number.parseInt(asset.id?.tokenId, 16).toString() + const tokenId = asset.id?.tokenId ?? '' return { id: `${contractAddress}_${tokenId}`, @@ -257,7 +257,7 @@ function createNftToken_FLOW( chainId, type: TokenType.NonFungible, schema: SchemaType_FLOW.NonFungible, - tokenId: Number.parseInt(asset.id?.tokenId, 16).toString(), + tokenId: asset.id?.tokenId ?? '', address: asset.contract?.address, metadata: { chainId, @@ -300,7 +300,7 @@ function createNFTAsset_FLOW( chainId, type: TokenType.NonFungible, schema: SchemaType_FLOW.NonFungible, - tokenId: Number.parseInt(metaDataResponse.id?.tokenId, 16).toString(), + tokenId: metaDataResponse.id?.tokenId ?? '', address: metaDataResponse.contract?.address, metadata: { chainId, From f84a883a5957fa0b4510b21c4852473b07473203 Mon Sep 17 00:00:00 2001 From: UncleBill Date: Mon, 11 Jul 2022 11:22:37 +0800 Subject: [PATCH 038/128] fix: hide buy button on NFT trending (#6738) --- .../plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx | 4 ++-- packages/mask/src/plugins/Trader/trending/useTrending.ts | 2 +- packages/plugins/GoPlusSecurity/src/SNSAdaptor/index.tsx | 2 +- packages/web3-providers/src/coingecko/base-api.ts | 2 +- packages/web3-providers/src/coingecko/index.ts | 2 ++ 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx index 45179cb1a0bf..549f9909e4ae 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx @@ -157,10 +157,10 @@ export function TrendingViewDeck(props: TrendingViewDeckProps) { isTokenSecurityEnable, ) + const isBuyable = !isNFT && transakPluginEnabled && !transakIsMinimalMode && trending.coin.symbol && isAllowanceCoin const onBuyButtonClicked = useCallback(() => { setBuyDialog({ open: true, - // @ts-ignore code: coin.symbol, address: account, }) @@ -293,7 +293,7 @@ export function TrendingViewDeck(props: TrendingViewDeckProps) { - {transakPluginEnabled && !transakIsMinimalMode && trending.coin.symbol && isAllowanceCoin ? ( + {isBuyable ? ( + ) : null} @@ -292,21 +308,6 @@ export function TrendingViewDeck(props: TrendingViewDeckProps) { - - {isBuyable ? ( - - ) : null} - From 378da47f601be1c0c6818bff168869dc64a6d8ae Mon Sep 17 00:00:00 2001 From: Lantt Date: Mon, 11 Jul 2022 14:30:37 +0800 Subject: [PATCH 042/128] fix: tab text hover color --- packages/theme/src/Components/Tabs/BaseTab.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/theme/src/Components/Tabs/BaseTab.tsx b/packages/theme/src/Components/Tabs/BaseTab.tsx index f0987e722af7..0ab28eab4c8b 100644 --- a/packages/theme/src/Components/Tabs/BaseTab.tsx +++ b/packages/theme/src/Components/Tabs/BaseTab.tsx @@ -21,7 +21,6 @@ const BaseTabWrap = styled(Button, { '&:hover': { boxShadow: activated ? '0 0 20px rgba(0, 0, 0, 0.05)' : 'none', background: activated ? theme.palette.maskColor.bottom : 'transparent', - color: theme.palette.maskColor.main, }, })) From ba5820c1ed7f1dd2e8cfd987b9f47096263f3453 Mon Sep 17 00:00:00 2001 From: UncleBill Date: Mon, 11 Jul 2022 14:54:12 +0800 Subject: [PATCH 043/128] fix: mf-1409 style of scrollbar (#6746) --- .../components/SelectTokenDialog/index.tsx | 26 ------------------- .../components/shared/ApplicationBoard.tsx | 4 +-- .../twitter.com/customization/custom.ts | 18 +++++++++++++ .../components/SelectFungibleTokenDialog.tsx | 3 +++ .../SearchableList/SearchableList.tsx | 5 +++- 5 files changed, 27 insertions(+), 29 deletions(-) delete mode 100644 packages/dashboard/src/pages/Wallets/components/SelectTokenDialog/index.tsx diff --git a/packages/dashboard/src/pages/Wallets/components/SelectTokenDialog/index.tsx b/packages/dashboard/src/pages/Wallets/components/SelectTokenDialog/index.tsx deleted file mode 100644 index 10528de822ea..000000000000 --- a/packages/dashboard/src/pages/Wallets/components/SelectTokenDialog/index.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { memo } from 'react' -import { MaskDialog } from '@masknet/theme' -import { useDashboardI18N } from '../../../../locales' -import { FungibleTokenList } from '@masknet/shared' -import { DialogContent } from '@mui/material' -import type { FungibleToken } from '@masknet/web3-shared-base' -import type { ChainId, SchemaType } from '@masknet/web3-shared-evm' - -export interface SelectTokenDialogProps { - open: boolean - onClose: () => void - onSelect?(token: FungibleToken | null): void -} - -// todo use remote dialog for add token list dialog -export const SelectTokenDialog = memo(({ open, onClose, onSelect }) => { - const t = useDashboardI18N() - - return ( - - - - - - ) -}) diff --git a/packages/mask/src/components/shared/ApplicationBoard.tsx b/packages/mask/src/components/shared/ApplicationBoard.tsx index df1df8a44f8d..a00dfbb31f7c 100644 --- a/packages/mask/src/components/shared/ApplicationBoard.tsx +++ b/packages/mask/src/components/shared/ApplicationBoard.tsx @@ -23,7 +23,7 @@ const useStyles = makeStyles<{ shouldScroll: boolean; isCarouselReady: boolean } const smallQuery = `@media (max-width: ${theme.breakpoints.values.sm}px)` return { applicationWrapper: { - padding: theme.spacing(props.isCarouselReady ? 0 : 1, 0.25, 1), + paddingTop: theme.spacing(1), display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', overflowY: 'auto', @@ -38,7 +38,7 @@ const useStyles = makeStyles<{ shouldScroll: boolean; isCarouselReady: boolean } width: 20, }, '::-webkit-scrollbar-thumb': { - borderRadius: '20px', + borderRadius: 20, width: 5, border: '7px solid rgba(0, 0, 0, 0)', backgroundColor: theme.palette.maskColor.secondaryLine, diff --git a/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts b/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts index 6ce8b5973fed..e837f65e9c85 100644 --- a/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts +++ b/packages/mask/src/social-network-adaptor/twitter.com/customization/custom.ts @@ -118,6 +118,24 @@ export function useThemeTwitterVariant(baseTheme: Theme) { }, }, } + theme.components.MuiDialogContent = { + styleOverrides: { + root: { + paddingRight: 4, + '::-webkit-scrollbar': { + backgroundColor: 'transparent', + width: 20, + }, + '::-webkit-scrollbar-thumb': { + borderRadius: 20, + width: 5, + border: '7px solid rgba(0, 0, 0, 0)', + backgroundColor: theme.palette.maskColor.secondaryLine, + backgroundClip: 'padding-box', + }, + }, + }, + } theme.components.MuiSnackbar = { styleOverrides: { root: { diff --git a/packages/shared/src/contexts/components/SelectFungibleTokenDialog.tsx b/packages/shared/src/contexts/components/SelectFungibleTokenDialog.tsx index 3c12d01f9382..b580e4363ba3 100644 --- a/packages/shared/src/contexts/components/SelectFungibleTokenDialog.tsx +++ b/packages/shared/src/contexts/components/SelectFungibleTokenDialog.tsx @@ -19,6 +19,9 @@ const useStyles = makeStyles()((theme, { compact, disablePaddingTop ...(compact ? { minWidth: 552 } : {}), padding: theme.spacing(3), paddingTop: disablePaddingTop ? 0 : theme.spacing(2.8), + display: 'flex', + flexDirection: 'column', + overflow: 'auto', }, list: { scrollbarWidth: 'none', diff --git a/packages/theme/src/Components/SearchableList/SearchableList.tsx b/packages/theme/src/Components/SearchableList/SearchableList.tsx index 28f642d090dd..e5f4c91c21db 100644 --- a/packages/theme/src/Components/SearchableList/SearchableList.tsx +++ b/packages/theme/src/Components/SearchableList/SearchableList.tsx @@ -136,8 +136,11 @@ export function SearchableList({ ) } const useStyles = makeStyles()((theme) => ({ - container: {}, + container: { + overflow: 'hidden', + }, list: { + overflow: 'auto', marginTop: theme.spacing(1.5), '& > div::-webkit-scrollbar': { width: '7px', From a1c9f304584ea03e9fca77d968ba7fc7c3f94530 Mon Sep 17 00:00:00 2001 From: Lantt Date: Mon, 11 Jul 2022 14:59:35 +0800 Subject: [PATCH 044/128] style: dashboard swap background --- .../plugins/Trader/SNSAdaptor/trader/TraderDialog.tsx | 8 +++++++- .../mask/src/utils/components/PluginWalletStatusBar.tsx | 9 +++++++-- packages/theme/src/Components/Tabs/index.tsx | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trader/TraderDialog.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trader/TraderDialog.tsx index 349fc3be830f..d76c6f43180e 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trader/TraderDialog.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trader/TraderDialog.tsx @@ -11,7 +11,7 @@ import { TargetChainIdContext } from '@masknet/plugin-infra/web3-evm' import { PluginTraderMessages } from '../../messages' import { Trader, TraderRef, TraderProps } from './Trader' import { useI18N } from '../../../../utils' -import { makeStyles } from '@masknet/theme' +import { makeStyles, MaskColorVar } from '@masknet/theme' import { NetworkTab } from '../../../../components/shared/NetworkTab' import { useUpdateEffect } from 'react-use' import { NetworkPluginID } from '@masknet/web3-shared-base' @@ -28,6 +28,12 @@ const useStyles = makeStyles()((theme) => ({ position: 'sticky', top: 0, zIndex: 2, + + '& > div .MuiBox-root': isDashboard + ? { + background: MaskColorVar.mainBackground, + } + : {}, }, indicator: { display: 'none', diff --git a/packages/mask/src/utils/components/PluginWalletStatusBar.tsx b/packages/mask/src/utils/components/PluginWalletStatusBar.tsx index d6a43e5da0f0..ba08a4d784c3 100644 --- a/packages/mask/src/utils/components/PluginWalletStatusBar.tsx +++ b/packages/mask/src/utils/components/PluginWalletStatusBar.tsx @@ -14,13 +14,14 @@ import { import { WalletMessages } from '@masknet/plugin-wallet' import { ImageIcon, WalletIcon } from '@masknet/shared' import { useRemoteControlledDialog } from '@masknet/shared-base-ui' -import { makeStyles, parseColor } from '@masknet/theme' +import { makeStyles, MaskColorVar, parseColor } from '@masknet/theme' import { NetworkPluginID, TransactionStatusType, Wallet } from '@masknet/web3-shared-base' import { Box, Button, CircularProgress, Link, Typography } from '@mui/material' import { useI18N } from '../i18n-next-ui' import { LinkOutIcon, ArrowDropIcon, PluginWalletConnectIcon } from '@masknet/icons' import { useLayoutEffect, useRef, useState, PropsWithChildren } from 'react' import { ChainId, ProviderType } from '@masknet/web3-shared-evm' +import { isDashboardPage } from '@masknet/shared-base' interface WalletStatusBarProps extends PropsWithChildren<{}> { className?: string @@ -34,11 +35,15 @@ interface WalletStatusBarProps extends PropsWithChildren<{}> { expectedChainIdOrNetworkTypeOrID?: string | number } +const isDashboard = isDashboardPage() + const useStyles = makeStyles()((theme) => ({ root: { boxSizing: 'content-box', display: 'flex', - backgroundColor: parseColor(theme.palette.maskColor.bottom).setAlpha(0.8).toRgbString(), + backgroundColor: isDashboard + ? MaskColorVar.mainBackground + : parseColor(theme.palette.maskColor.bottom).setAlpha(0.8).toRgbString(), boxShadow: `0 0 20px ${parseColor(theme.palette.maskColor.highlight).setAlpha(0.05).toRgbString()}`, backdropFilter: 'blur(16px)', padding: theme.spacing(2), diff --git a/packages/theme/src/Components/Tabs/index.tsx b/packages/theme/src/Components/Tabs/index.tsx index 07bcbdf88252..85561051ca00 100644 --- a/packages/theme/src/Components/Tabs/index.tsx +++ b/packages/theme/src/Components/Tabs/index.tsx @@ -63,6 +63,7 @@ const FlexibleButtonGroupPanel = styled(Box, { : 'none', backdropFilter: 'blur(20px)', background: theme.palette.mode === 'dark' ? 'rgba(0, 0, 0, 0.8)' : 'rgba(255, 255, 255, 0.8)', + boxSizing: 'content-box', })) const ButtonGroupWrap = styled(ButtonGroup, { From d57daf5fb10fdc84437dc93d6651d3cdf380586d Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Mon, 11 Jul 2022 15:08:08 +0800 Subject: [PATCH 045/128] fix: wallet connect callback --- packages/mask/src/components/shared/ApplicationBoard.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mask/src/components/shared/ApplicationBoard.tsx b/packages/mask/src/components/shared/ApplicationBoard.tsx index a00dfbb31f7c..ebb9f4500f28 100644 --- a/packages/mask/src/components/shared/ApplicationBoard.tsx +++ b/packages/mask/src/components/shared/ApplicationBoard.tsx @@ -235,7 +235,8 @@ function RenderEntryComponent({ application }: { application: Application }) { const clickHandler = useMemo(() => { if (application.isWalletConnectedRequired || application.isWalletConnectedEVMRequired) { - return (walletConnectedCallback?: () => void) => setSelectProviderDialog({ open: true }) + return (walletConnectedCallback?: () => void) => + setSelectProviderDialog({ open: true, walletConnectedCallback }) } if (!application.entry.nextIdRequired) return if (ApplicationEntryStatus.isPersonaConnected === false || ApplicationEntryStatus.isPersonaCreated === false) From 09f728e4969e48854714f9d8eee3dbcc51563c78 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Mon, 11 Jul 2022 15:33:02 +0800 Subject: [PATCH 046/128] fix: replace web3 to connection (#6751) * fix: replace web3 to connection in trader plugin * fix: bugfix --- .../trader/components/ConfirmDialogUI.tsx | 4 +- .../Trader/trader/0x/useTradeCallback.ts | 31 +++---- .../trader/balancer/useTradeCallback.ts | 71 ++++++++-------- .../Trader/trader/bancor/useTradeCallback.ts | 32 +++---- .../Trader/trader/dodo/useTradeCallback.ts | 28 +++---- .../trader/openocean/useTradeCallback.ts | 27 +++--- .../Trader/trader/uniswap/useTradeCallback.ts | 84 ++++++++++--------- packages/web3-constants/evm/trader.json | 4 +- packages/web3-shared/base/src/specs/index.ts | 45 +++++++--- 9 files changed, 163 insertions(+), 163 deletions(-) diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trader/components/ConfirmDialogUI.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trader/components/ConfirmDialogUI.tsx index 3e4fa376cc4b..559890b48140 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trader/components/ConfirmDialogUI.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trader/components/ConfirmDialogUI.tsx @@ -323,7 +323,7 @@ export const ConfirmDialogUI = memo( - + ( - + | null, gasConfig?: GasOptionConfig) { const { targetChainId: chainId } = TargetChainIdContext.useContainer() const account = useAccount(NetworkPluginID.PLUGIN_EVM) - const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM, { chainId }) + const connection = useWeb3Connection(NetworkPluginID.PLUGIN_EVM, { chainId }) // compose transaction config const config = useMemo(() => { @@ -27,28 +27,23 @@ export function useTradeCallback(tradeComputed: TradeComputed return useAsyncFn(async () => { // validate config - if (!web3 || !account || !config || !tradeComputed) { + if (!account || !config || !tradeComputed || !connection) { return } const config_ = { ...config, - gas: await web3.eth - .estimateGas({ + gas: + (await connection.estimateTransaction?.({ from: account, ...pick(tradeComputed.trade_, ['to', 'data', 'value']), - }) - .catch(() => 0), + })) ?? ZERO.toString(), } // send transaction and wait for hash - return new Promise((resolve, reject) => { - web3.eth - .sendTransaction(config_) - .on(TransactionEventType.CONFIRMATION, (_, receipt) => { - resolve(receipt.transactionHash) - }) - .on(TransactionEventType.ERROR, reject) - }) - }, [web3, account, chainId, stringify(config), gasConfig]) + const hash = await connection.sendTransaction(config_) + const receipt = await connection.getTransactionReceipt(hash) + + return receipt?.transactionHash + }, [connection, account, chainId, stringify(config), gasConfig]) } diff --git a/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts b/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts index da77ea446aac..b777653083d6 100644 --- a/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts +++ b/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts @@ -1,12 +1,16 @@ import type { ExchangeProxy } from '@masknet/web3-contracts/types/ExchangeProxy' -import type { PayableTx } from '@masknet/web3-contracts/types/types' -import { SchemaType, GasOptionConfig, TransactionEventType, useTraderConstants } from '@masknet/web3-shared-evm' +import { + SchemaType, + GasOptionConfig, + useTraderConstants, + encodeContractTransaction +} from '@masknet/web3-shared-evm' import { useAsyncFn } from 'react-use' import { SLIPPAGE_DEFAULT } from '../../constants' import { SwapResponse, TradeComputed, TradeStrategy } from '../../types' import { TargetChainIdContext } from '@masknet/plugin-infra/web3-evm' -import { useAccount } from '@masknet/plugin-infra/web3' -import { NetworkPluginID } from '@masknet/web3-shared-base' +import { useAccount, useWeb3Connection } from '@masknet/plugin-infra/web3' +import { NetworkPluginID, ZERO } from '@masknet/web3-shared-base' import { useTradeAmount } from './useTradeAmount' export function useTradeCallback( @@ -18,7 +22,7 @@ export function useTradeCallback( const account = useAccount(NetworkPluginID.PLUGIN_EVM) const { targetChainId: chainId } = TargetChainIdContext.useContainer() const { BALANCER_ETH_ADDRESS } = useTraderConstants(chainId) - + const connection = useWeb3Connection() const tradeAmount = useTradeAmount(trade, allowedSlippage) return useAsyncFn(async () => { @@ -51,21 +55,6 @@ export function useTradeCallback( const outputTokenAddress = trade.outputToken.schema === SchemaType.Native ? BALANCER_ETH_ADDRESS : trade.outputToken.address - const tx = - trade.strategy === TradeStrategy.ExactIn - ? exchangeProxyContract.methods.multihopBatchSwapExactIn( - swap_, - inputTokenAddress, - outputTokenAddress, - trade.inputAmount.toFixed(), - tradeAmount.toFixed(), - ) - : exchangeProxyContract.methods.multihopBatchSwapExactOut( - swap_, - inputTokenAddress, - outputTokenAddress, - tradeAmount.toFixed(), - ) // trade with the native token let transactionValue = '0' @@ -77,27 +66,37 @@ export function useTradeCallback( // send transaction and wait for hash const config = { from: account, - gas: await tx - .estimateGas({ + gas: await connection + .estimateTransaction?.({ from: account, value: transactionValue, - }) - .catch((error: Error) => { - throw error - }), + }) ?? ZERO.toString(), value: transactionValue, ...gasConfig, } + + const tx = await encodeContractTransaction(exchangeProxyContract, trade.strategy === TradeStrategy.ExactIn + ? exchangeProxyContract.methods.multihopBatchSwapExactIn( + swap_, + inputTokenAddress, + outputTokenAddress, + trade.inputAmount.toFixed(), + tradeAmount.toFixed(), + ) + : exchangeProxyContract.methods.multihopBatchSwapExactOut( + swap_, + inputTokenAddress, + outputTokenAddress, + tradeAmount.toFixed(), + ), config) + + + // send transaction and wait for hash - return new Promise((resolve, reject) => { - tx.send(config as PayableTx) - .on(TransactionEventType.CONFIRMATION, (_, receipt) => { - resolve(receipt.transactionHash) - }) - .on(TransactionEventType.ERROR, (error) => { - reject(error) - }) - }) - }, [chainId, trade, tradeAmount, exchangeProxyContract, BALANCER_ETH_ADDRESS]) + const hash = await connection.sendTransaction(tx) + const receipt = await connection.getTransactionReceipt(hash) + + return receipt?.transactionHash + }, [chainId, trade, tradeAmount, exchangeProxyContract, BALANCER_ETH_ADDRESS, connection]) } diff --git a/packages/mask/src/plugins/Trader/trader/bancor/useTradeCallback.ts b/packages/mask/src/plugins/Trader/trader/bancor/useTradeCallback.ts index 3df5e15598d4..f7d91416aa61 100644 --- a/packages/mask/src/plugins/Trader/trader/bancor/useTradeCallback.ts +++ b/packages/mask/src/plugins/Trader/trader/bancor/useTradeCallback.ts @@ -2,16 +2,16 @@ import { pick } from 'lodash-unified' import { useMemo } from 'react' import { useAsyncFn } from 'react-use' import stringify from 'json-stable-stringify' -import { NetworkPluginID } from '@masknet/web3-shared-base' -import { useAccount, useWeb3 } from '@masknet/plugin-infra/web3' -import { GasOptionConfig, TransactionEventType } from '@masknet/web3-shared-evm' +import { NetworkPluginID, ZERO } from '@masknet/web3-shared-base' +import { useAccount, useWeb3Connection } from '@masknet/plugin-infra/web3' +import type { GasOptionConfig } from '@masknet/web3-shared-evm' import { PluginTraderRPC } from '../../messages' import type { SwapBancorRequest, TradeComputed } from '../../types' import { TargetChainIdContext } from '@masknet/plugin-infra/web3-evm' export function useTradeCallback(tradeComputed: TradeComputed | null, gasConfig?: GasOptionConfig) { const { targetChainId: chainId } = TargetChainIdContext.useContainer() - const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM, { chainId }) + const connection = useWeb3Connection(NetworkPluginID.PLUGIN_EVM, { chainId }) const account = useAccount(NetworkPluginID.PLUGIN_EVM) const trade: SwapBancorRequest | null = useMemo(() => { @@ -20,14 +20,13 @@ export function useTradeCallback(tradeComputed: TradeComputed }, [account, tradeComputed]) return useAsyncFn(async () => { - if (!account || !trade || !web3) { + if (!account || !trade || !connection) { return } const [data, err] = await PluginTraderRPC.swapTransactionBancor(trade) if (err) { - const error = new Error(err.error.messages?.[0] || 'Unknown Error') - throw error + throw new Error(err.error.messages?.[0] || 'Unknown Error') } // Note that if approval is required, the API will also return the necessary approval transaction. @@ -36,20 +35,15 @@ export function useTradeCallback(tradeComputed: TradeComputed const config = pick(tradeTransaction.transaction, ['to', 'data', 'value', 'from']) const config_ = { ...config, - gas: await web3.eth.estimateGas(config).catch((error) => { - throw error - }), + gas: (await connection.estimateTransaction?.(config)) ?? ZERO.toString(), ...gasConfig, } // send transaction and wait for hash - return new Promise((resolve, reject) => { - web3.eth - .sendTransaction(config_) - .on(TransactionEventType.ERROR, reject) - .on(TransactionEventType.CONFIRMATION, (_, receipt) => { - resolve(receipt.transactionHash) - }) - }) - }, [web3, account, chainId, stringify(trade), gasConfig]) + + const hash = await connection.sendTransaction(config_) + const receipt = await connection.getTransactionReceipt(hash) + + return receipt?.transactionHash + }, [connection, account, chainId, stringify(trade), gasConfig]) } diff --git a/packages/mask/src/plugins/Trader/trader/dodo/useTradeCallback.ts b/packages/mask/src/plugins/Trader/trader/dodo/useTradeCallback.ts index da5fbc34b972..f446521c02af 100644 --- a/packages/mask/src/plugins/Trader/trader/dodo/useTradeCallback.ts +++ b/packages/mask/src/plugins/Trader/trader/dodo/useTradeCallback.ts @@ -1,4 +1,4 @@ -import { useAccount, useWeb3 } from '@masknet/plugin-infra/web3' +import { useAccount, useWeb3Connection } from '@masknet/plugin-infra/web3' import stringify from 'json-stable-stringify' import { pick } from 'lodash-unified' import { useMemo } from 'react' @@ -6,7 +6,7 @@ import { useAsyncFn } from 'react-use' import type { TransactionConfig } from 'web3-core' import type { SwapRouteSuccessResponse, TradeComputed } from '../../types' import { TargetChainIdContext } from '@masknet/plugin-infra/web3-evm' -import { NetworkPluginID } from '@masknet/web3-shared-base' +import { NetworkPluginID, ZERO } from '@masknet/web3-shared-base' import type { GasOptionConfig } from '@masknet/web3-shared-evm' export function useTradeCallback( @@ -15,7 +15,7 @@ export function useTradeCallback( ) { const { targetChainId: chainId } = TargetChainIdContext.useContainer() const account = useAccount(NetworkPluginID.PLUGIN_EVM) - const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM, { chainId }) + const connection = useWeb3Connection(NetworkPluginID.PLUGIN_EVM, { chainId }) // compose transaction config const config = useMemo(() => { @@ -28,28 +28,22 @@ export function useTradeCallback( return useAsyncFn(async () => { // validate config - if (!account || !config || !web3) { + if (!account || !config || !connection) { return } // compose transaction config const config_ = { ...config, - gas: await web3.eth.estimateGas(config).catch((error) => { - throw error - }), + gas: (await connection.estimateTransaction?.(config)) ?? ZERO.toString(), ...gasConfig, } // send transaction and wait for hash - return new Promise((resolve, reject) => { - web3.eth.sendTransaction(config_, (error, hash) => { - if (error) { - reject(error) - } else { - resolve(hash) - } - }) - }) - }, [web3, account, chainId, stringify(config), gasConfig]) + + const hash = await connection.sendTransaction(config_) + const receipt = await connection.getTransactionReceipt(hash) + + return receipt?.transactionHash + }, [connection, account, chainId, stringify(config), gasConfig]) } diff --git a/packages/mask/src/plugins/Trader/trader/openocean/useTradeCallback.ts b/packages/mask/src/plugins/Trader/trader/openocean/useTradeCallback.ts index af16b1aa1588..3b081653bdec 100644 --- a/packages/mask/src/plugins/Trader/trader/openocean/useTradeCallback.ts +++ b/packages/mask/src/plugins/Trader/trader/openocean/useTradeCallback.ts @@ -5,14 +5,14 @@ import { useAsyncFn } from 'react-use' import type { TransactionConfig } from 'web3-core' import type { GasOptionConfig } from '@masknet/web3-shared-evm' import type { SwapOOSuccessResponse, TradeComputed } from '../../types' -import { NetworkPluginID } from '@masknet/web3-shared-base' -import { useAccount, useChainId, useWeb3 } from '@masknet/plugin-infra/web3' +import { NetworkPluginID, ZERO } from '@masknet/web3-shared-base' +import { useAccount, useChainId, useWeb3Connection } from '@masknet/plugin-infra/web3' export function useTradeCallback( tradeComputed: TradeComputed | null, gasConfig?: GasOptionConfig, ) { - const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM) + const connection = useWeb3Connection(NetworkPluginID.PLUGIN_EVM) const account = useAccount(NetworkPluginID.PLUGIN_EVM) const chainId = useChainId(NetworkPluginID.PLUGIN_EVM) @@ -27,28 +27,21 @@ export function useTradeCallback( return useAsyncFn(async () => { // validate config - if (!account || !config || !web3) { + if (!account || !config || !connection) { return } // compose transaction config const config_ = { ...config, - gas: await web3.eth.estimateGas(config).catch((error) => { - throw error - }), + gas: (await connection.estimateTransaction?.(config)) ?? ZERO.toString(), ...gasConfig, } // send transaction and wait for hash - return new Promise((resolve, reject) => { - web3.eth.sendTransaction(config_, (error, hash) => { - if (error) { - reject(error) - } else { - resolve(hash) - } - }) - }) - }, [web3, account, chainId, stringify(config)]) + + const hash = await connection.sendTransaction(config_) + const receipt = await connection.getTransactionReceipt(hash) + return receipt?.transactionHash + }, [connection, account, chainId, stringify(config)]) } diff --git a/packages/mask/src/plugins/Trader/trader/uniswap/useTradeCallback.ts b/packages/mask/src/plugins/Trader/trader/uniswap/useTradeCallback.ts index 52edd6456174..749987845bf3 100644 --- a/packages/mask/src/plugins/Trader/trader/uniswap/useTradeCallback.ts +++ b/packages/mask/src/plugins/Trader/trader/uniswap/useTradeCallback.ts @@ -2,13 +2,13 @@ import { useAsyncFn } from 'react-use' import BigNumber from 'bignumber.js' import type { TradeProvider } from '@masknet/public-api' import type { SwapParameters } from '@uniswap/v2-sdk' -import { GasOptionConfig, TransactionEventType } from '@masknet/web3-shared-evm' +import type { GasOptionConfig } from '@masknet/web3-shared-evm' import { useSwapParameters as useTradeParameters } from './useTradeParameters' import { swapErrorToUserReadableMessage } from '../../helpers' import type { SwapCall, Trade, TradeComputed } from '../../types' import { TargetChainIdContext } from '@masknet/plugin-infra/web3-evm' -import { useAccount, useWeb3 } from '@masknet/plugin-infra/web3' -import { NetworkPluginID } from '@masknet/web3-shared-base' +import { useAccount, useWeb3Connection } from '@masknet/plugin-infra/web3' +import { NetworkPluginID, ZERO } from '@masknet/web3-shared-base' interface FailedCall { parameters: SwapParameters @@ -36,15 +36,16 @@ export function useTradeCallback( allowedSlippage?: number, ) { const { targetChainId } = TargetChainIdContext.useContainer() - const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM, { chainId: targetChainId }) + // const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM, { chainId: targetChainId }) + const connection = useWeb3Connection(NetworkPluginID.PLUGIN_EVM, { chainId: targetChainId }) const account = useAccount(NetworkPluginID.PLUGIN_EVM) const tradeParameters = useTradeParameters(trade, tradeProvider, allowedSlippage) return useAsyncFn(async () => { - if (!tradeParameters.length || !web3) { + if (!tradeParameters.length || !connection) { return } - + const web3 = await connection.getWeb3() // step 1: estimate each trade parameter const estimatedCalls: SwapCallEstimate[] = await Promise.all( tradeParameters.map(async (x) => { @@ -58,8 +59,14 @@ export function useTradeCallback( : { value: `0x${Number.parseInt(value, 16).toString(16)}` }), } - return web3.eth - .estimateGas(config) + if (!connection.estimateTransaction) { + return { + call: x, + gasEstimate: ZERO, + } + } + return connection + .estimateTransaction(config) .then((gasEstimate) => { return { call: x, @@ -104,39 +111,34 @@ export function useTradeCallback( bestCallOption = firstNoErrorCall } - return new Promise(async (resolve, reject) => { - if (!bestCallOption) { - return - } + if (!bestCallOption) { + return + } - const { - call: { address, calldata, value }, - } = bestCallOption + const { + call: { address, calldata, value }, + } = bestCallOption - web3.eth - .sendTransaction({ - from: account, - to: address, - data: calldata, - ...('gasEstimate' in bestCallOption ? { gas: bestCallOption.gasEstimate.toFixed() } : {}), - ...(!value || /^0x0*$/.test(value) ? {} : { value }), - ...gasConfig, - }) - .on(TransactionEventType.CONFIRMATION, (_, receipt) => { - resolve(receipt.transactionHash) - }) - .on(TransactionEventType.ERROR, (error) => { - if (!(error as any)?.code) { - reject(error) - return - } - const error_ = new Error( - error?.message === 'Unable to add more requests.' - ? 'Unable to add more requests.' - : 'Transaction rejected.', - ) - reject(error_) - }) - }) - }, [web3, account, tradeParameters, gasConfig]) + try { + const hash = await connection.sendTransaction({ + from: account, + to: address, + data: calldata, + ...('gasEstimate' in bestCallOption ? { gas: bestCallOption.gasEstimate.toFixed() } : {}), + ...(!value || /^0x0*$/.test(value) ? {} : { value }), + ...gasConfig, + }) + const receipt = await connection.getTransactionReceipt(hash) + return receipt?.transactionHash + } catch (error: any) { + if (!(error as any)?.code) { + throw error + } + throw new Error( + error?.message === 'Unable to add more requests.' + ? 'Unable to add more requests.' + : 'Transaction rejected.', + ) + } + }, [connection, account, tradeParameters, gasConfig]) } diff --git a/packages/web3-constants/evm/trader.json b/packages/web3-constants/evm/trader.json index 3b20c45fa677..277cb75b4d7e 100644 --- a/packages/web3-constants/evm/trader.json +++ b/packages/web3-constants/evm/trader.json @@ -653,8 +653,8 @@ "BSCT": "", "Matic": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "Mumbai": "", - "Arbitrum": "", - "Arbitrum_Rinkeby": "", + "Arbitrum": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", + "Arbitrum_Rinkeby": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "xDai": "", "Avalanche": "", "Avalanche_Fuji": "", diff --git a/packages/web3-shared/base/src/specs/index.ts b/packages/web3-shared/base/src/specs/index.ts index 2181e27b3da8..7d188f04d76d 100644 --- a/packages/web3-shared/base/src/specs/index.ts +++ b/packages/web3-shared/base/src/specs/index.ts @@ -66,7 +66,7 @@ export enum SourceType { LooksRare = 'looksrare', NFTScan = 'NFTScan', Alchemy_EVM = 'Alchemy_EVM', - Alchemy_FLOW = 'Alchemy_FLOW' + Alchemy_FLOW = 'Alchemy_FLOW', } export enum TransactionStatusType { @@ -387,7 +387,7 @@ export interface FungibleTokenAuthorization { /** * Authorization about a non-fungible token. */ - export interface NonFungibleTokenAuthorization { +export interface NonFungibleTokenAuthorization { all: boolean recipient: string tokens: NonFungibleToken @@ -552,7 +552,6 @@ export interface Account { chainId: ChainId } - export interface BalanceEvent { /** Emit if the balance of the account updated. */ update: [Account] @@ -682,7 +681,12 @@ export interface Connection< /** Get fungible token balance */ getFungibleTokenBalance(address: string, initial?: Web3ConnectionOptions): Promise /** Get non-fungible token balance */ - getNonFungibleTokenBalance(address: string, tokenId?: string, schema?: SchemaType, initial?: Web3ConnectionOptions): Promise + getNonFungibleTokenBalance( + address: string, + tokenId?: string, + schema?: SchemaType, + initial?: Web3ConnectionOptions, + ): Promise /** Get fungible token balance */ getFungibleTokensBalance(listOfAddress: string[], initial?: Web3ConnectionOptions): Promise> /** Get non-fungible token balance */ @@ -728,7 +732,7 @@ export interface Connection< address: string, recipient: string, amount: string, - initial?: Web3ConnectionOptions + initial?: Web3ConnectionOptions, ): Promise /** Approve a recipient for using a non-fungible token. */ approveNonFungibleToken( @@ -736,7 +740,7 @@ export interface Connection< recipient: string, tokenId: string, schema?: SchemaType, - initial?: Web3ConnectionOptions + initial?: Web3ConnectionOptions, ): Promise /** Approve a recipient for using all non-fungible tokens. */ approveAllNonFungibleTokens( @@ -744,7 +748,7 @@ export interface Connection< recipient: string, approved: boolean, schema?: SchemaType, - initial?: Web3ConnectionOptions + initial?: Web3ConnectionOptions, ): Promise /** Transfer fungible token to */ transferFungibleToken( @@ -771,6 +775,12 @@ export interface Connection< callTransaction(transaction: Transaction, initial?: Web3ConnectionOptions): Promise /** Send a transaction and wait for mining */ sendTransaction(transaction: Transaction, initial?: Web3ConnectionOptions): Promise + /** Estimate a transaction */ + estimateTransaction?: ( + transaction: Transaction, + fallback?: number, + initial?: Web3ConnectionOptions, + ) => Promise /** Send a signed transaction */ sendSignedTransaction(signature: TransactionSignature, initial?: Web3ConnectionOptions): Promise /** Build connection */ @@ -817,9 +827,17 @@ export interface Hub Promise>> /** Get security diagnosis about a fungible token */ - getFungibleTokenSecurity?: (chainId: ChainId, address: string, initial?: Web3HubOptions) => Promise + getFungibleTokenSecurity?: ( + chainId: ChainId, + address: string, + initial?: Web3HubOptions, + ) => Promise /** Get security diagnosis about a non-fungible token */ - getNonFungibleTokenSecurity?: (chainId: ChainId, address: string, initial?: Web3HubOptions) => Promise + getNonFungibleTokenSecurity?: ( + chainId: ChainId, + address: string, + initial?: Web3HubOptions, + ) => Promise /** Get the fungible from built-in token list */ getFungibleTokensFromTokenList?: ( chainId: ChainId, @@ -897,7 +915,7 @@ export interface Hub Promise>> } @@ -1025,7 +1043,12 @@ export interface TransactionWatcherState { /** Notify error */ notifyError: (error: Error) => Promise /** Notify transaction status */ - notifyTransaction: (chainId: ChainId, id: string, transaction: Transaction, status: TransactionStatusType) => Promise + notifyTransaction: ( + chainId: ChainId, + id: string, + transaction: Transaction, + status: TransactionStatusType, + ) => Promise } export interface ProviderState { /** The account of the currently visiting site. */ From 175c67abb30052ecdb4b9b4a71be0c566b172dfc Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 11 Jul 2022 15:45:09 +0800 Subject: [PATCH 047/128] fix: mf 1408 app board verify --- packages/mask/src/components/shared/ApplicationBoard.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/mask/src/components/shared/ApplicationBoard.tsx b/packages/mask/src/components/shared/ApplicationBoard.tsx index ebb9f4500f28..ae551276fdad 100644 --- a/packages/mask/src/components/shared/ApplicationBoard.tsx +++ b/packages/mask/src/components/shared/ApplicationBoard.tsx @@ -316,7 +316,6 @@ function ApplicationEntryStatusProvider(props: PropsWithChildren<{}>) { useEffect(() => { retry() - nextIDConnectStatus.reset() return MaskMessages.events.currentPersonaIdentifier.on(() => { retry() nextIDConnectStatus.reset() From 15ba9288b1630e7ef35d74ba25446d7a727ad2c8 Mon Sep 17 00:00:00 2001 From: Randolph314 <97870249+Randolph314@users.noreply.github.com> Date: Mon, 11 Jul 2022 16:21:13 +0800 Subject: [PATCH 048/128] fix: token security UI (#6755) * fix: profile content component computed dependency * fix: token security ui * fix: copy ui Co-authored-by: Randolph <840094513@qq.com> --- .../InjectedComponents/ProfileTabContent.tsx | 7 ++- .../trader/balancer/useTradeCallback.ts | 49 +++++++++---------- .../src/SNSAdaptor/components/Common.tsx | 6 +-- .../src/SNSAdaptor/components/RiskCard.tsx | 7 ++- .../SNSAdaptor/components/SecurityPanel.tsx | 45 +++++++---------- .../GoPlusSecurity/src/SNSAdaptor/index.tsx | 1 - packages/plugins/GoPlusSecurity/src/base.ts | 1 - .../SNSAdaptor/components/PersonaAction.tsx | 47 ++++++++++-------- .../TokenSecurity/components/RiskCard.tsx | 7 ++- .../components/SecurityPanel.tsx | 32 +++++++----- .../TokenSecurity/components/TokenPanel.tsx | 14 ++++-- 11 files changed, 114 insertions(+), 102 deletions(-) diff --git a/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx b/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx index 204d5dcfb855..15f556b7f6ce 100644 --- a/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx +++ b/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx @@ -102,7 +102,7 @@ export function ProfileTabContent(props: ProfileTabContentProps) { } }) return [...socialAddressList, ...addresses] - }, [socialAddressList, wallets, isOwn]) + }, [socialAddressList, wallets?.map((x) => x.identity).join(), isOwn]) const activatedPlugins = useActivatedPluginsSNSAdaptor('any') const availablePlugins = useAvailablePlugins(activatedPlugins) @@ -163,9 +163,10 @@ export function ProfileTabContent(props: ProfileTabContentProps) { ) }, [ componentTabId, + personaPublicKey, displayPlugins.map((x) => x.ID).join(), personaList.join(), - socialAddressList.map((x) => x.address).join(), + addressList.map((x) => x.address).join(), ]) useLocationChange(() => { @@ -188,6 +189,8 @@ export function ProfileTabContent(props: ProfileTabContentProps) { }) }, [identity.identifier?.userId]) + // console.log({ identity, socialAddressList, addressList, wallets }) + if (hidden) return null if (!identity.identifier?.userId || loadingSocialAddressList || loadingPersonaList) diff --git a/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts b/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts index b777653083d6..51dee6e2d4f0 100644 --- a/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts +++ b/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts @@ -1,10 +1,5 @@ import type { ExchangeProxy } from '@masknet/web3-contracts/types/ExchangeProxy' -import { - SchemaType, - GasOptionConfig, - useTraderConstants, - encodeContractTransaction -} from '@masknet/web3-shared-evm' +import { SchemaType, GasOptionConfig, useTraderConstants, encodeContractTransaction } from '@masknet/web3-shared-evm' import { useAsyncFn } from 'react-use' import { SLIPPAGE_DEFAULT } from '../../constants' import { SwapResponse, TradeComputed, TradeStrategy } from '../../types' @@ -55,7 +50,6 @@ export function useTradeCallback( const outputTokenAddress = trade.outputToken.schema === SchemaType.Native ? BALANCER_ETH_ADDRESS : trade.outputToken.address - // trade with the native token let transactionValue = '0' if (trade.strategy === TradeStrategy.ExactIn && trade.inputToken.schema === SchemaType.Native) @@ -66,32 +60,33 @@ export function useTradeCallback( // send transaction and wait for hash const config = { from: account, - gas: await connection - .estimateTransaction?.({ + gas: + (await connection.estimateTransaction?.({ from: account, value: transactionValue, - }) ?? ZERO.toString(), + })) ?? ZERO.toString(), value: transactionValue, ...gasConfig, } - - const tx = await encodeContractTransaction(exchangeProxyContract, trade.strategy === TradeStrategy.ExactIn - ? exchangeProxyContract.methods.multihopBatchSwapExactIn( - swap_, - inputTokenAddress, - outputTokenAddress, - trade.inputAmount.toFixed(), - tradeAmount.toFixed(), - ) - : exchangeProxyContract.methods.multihopBatchSwapExactOut( - swap_, - inputTokenAddress, - outputTokenAddress, - tradeAmount.toFixed(), - ), config) - - + const tx = await encodeContractTransaction( + exchangeProxyContract, + trade.strategy === TradeStrategy.ExactIn + ? exchangeProxyContract.methods.multihopBatchSwapExactIn( + swap_, + inputTokenAddress, + outputTokenAddress, + trade.inputAmount.toFixed(), + tradeAmount.toFixed(), + ) + : exchangeProxyContract.methods.multihopBatchSwapExactOut( + swap_, + inputTokenAddress, + outputTokenAddress, + tradeAmount.toFixed(), + ), + config, + ) // send transaction and wait for hash const hash = await connection.sendTransaction(tx) diff --git a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/Common.tsx b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/Common.tsx index f20033875d53..403cd516e158 100644 --- a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/Common.tsx +++ b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/Common.tsx @@ -34,13 +34,13 @@ export const DefineMapping: DefineMapping = { [SecurityMessageLevel.High]: { i18nKey: 'high_risk', titleColor: '#FF5F5F', - bgColor: 'rgba(255, 95, 95, 0.1)', + bgColor: 'rgba(255, 53, 69, 0.1)', icon: (size: number) => , }, [SecurityMessageLevel.Medium]: { i18nKey: 'medium_risk', - titleColor: '#FFB915', - bgColor: 'rgba(255, 177, 0, 0.2)', + titleColor: '#FFB100', + bgColor: 'rgba(255, 177, 0, 0.1)', // TODO: Merge duplicate icon in a another PR. icon: (size: number) => , }, diff --git a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/RiskCard.tsx b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/RiskCard.tsx index 971b3342e68b..a9efe262cbb2 100644 --- a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/RiskCard.tsx +++ b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/RiskCard.tsx @@ -22,11 +22,14 @@ const useStyles = makeStyles()((theme) => ({ alignItems: 'center', }, header: { - fontSize: 14, + fontSize: 16, + fontWeight: 700, lineHeight: '22px', }, description: { - fontSize: 12, + fontSize: 16, + fontWeight: 400, + color: theme.palette.maskColor.second, }, })) diff --git a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx index 060233f8aa36..9b8f59753155 100644 --- a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx +++ b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx @@ -23,7 +23,7 @@ interface TokenCardProps { const useStyles = makeStyles()((theme) => ({ header: { - fontWeight: 500, + fontWeight: 700, fontSize: 18, }, root: { @@ -43,13 +43,14 @@ const useStyles = makeStyles()((theme) => ({ height: '48px', }, tokenName: { - fontSize: '16px', + fontSize: '18px', fontWeight: 700, + color: theme.palette.maskColor.main, }, tokenPrice: { - fontSize: '16px', + fontSize: '18px', fontWeight: 700, - color: theme.palette.text.secondary, + color: theme.palette.maskColor.main, }, itemTitle: { color: theme.palette.maskColor.second, @@ -160,7 +161,7 @@ export const SecurityPanel = memo(({ tokenSecurity, tokenInfo, t /> - + {t.more_details()} (({ tokenSecurity, tokenInfo, t )} - - - {makeMessageList.map((x, i) => ( - - ))} - {(!makeMessageList.length || securityMessageLevel === SecurityMessageLevel.Safe) && ( - - )} - - + + {makeMessageList.map((x, i) => ( + + ))} + {(!makeMessageList.length || securityMessageLevel === SecurityMessageLevel.Safe) && ( + + )} + ) diff --git a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/index.tsx b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/index.tsx index f68bdcc78cf6..eb29fee2a06a 100644 --- a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/index.tsx +++ b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/index.tsx @@ -33,7 +33,6 @@ const sns: Plugin.SNSAdaptor.Definition = { }, name, icon, - iconFilterColor: '', appBoardSortingDefaultPriority: 14, category: 'dapp', marketListSortingPriority: 16, diff --git a/packages/plugins/GoPlusSecurity/src/base.ts b/packages/plugins/GoPlusSecurity/src/base.ts index c19fe3023fe1..2c83e4ed8e50 100644 --- a/packages/plugins/GoPlusSecurity/src/base.ts +++ b/packages/plugins/GoPlusSecurity/src/base.ts @@ -4,7 +4,6 @@ import { languages } from './locales/languages' export const base: Plugin.Shared.Definition = { ID: PLUGIN_ID, - icon: '', name: { fallback: PLUGIN_NAME }, description: { fallback: PLUGIN_DESCRIPTION }, publisher: { name: { fallback: 'Mask Network' }, link: 'https://mask.io/' }, diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/components/PersonaAction.tsx b/packages/plugins/Web3Profile/src/SNSAdaptor/components/PersonaAction.tsx index 556bb8f52be3..972e3ef5751b 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/components/PersonaAction.tsx +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/components/PersonaAction.tsx @@ -1,14 +1,14 @@ -import { useStylesExtends, makeStyles } from '@masknet/theme' -import { Box, Link, Typography } from '@mui/material' -import { Copy } from 'react-feather' +import { useStylesExtends, makeStyles, ShadowRootTooltip } from '@masknet/theme' +import { Box, Typography } from '@mui/material' import { useAsyncRetry, useCopyToClipboard } from 'react-use' import { useI18N } from '../../locales' import { PlatformAvatar } from './PlatformAvatar' -import { useSnackbarCallback } from '@masknet/shared' import { formatPublicKey } from '../utils' import type { PersonaInformation } from '@masknet/shared-base' import type { IdentityResolved } from '@masknet/plugin-infra' import { context } from '../context' +import { CopyIcon } from '@masknet/icons' +import { useCallback, useState } from 'react' const useStyles = makeStyles()((theme) => ({ bottomFixed: { @@ -27,6 +27,7 @@ const useStyles = makeStyles()((theme) => ({ linkIcon: { marginRight: theme.spacing(1), color: theme.palette.maskColor.second, + cursor: 'pointer', }, personaKey: { fontSize: '12px', @@ -45,22 +46,27 @@ export function PersonaAction(props: PersonaActionProps) { const { currentPersona, currentVisitingProfile } = props const t = useI18N() + const [open, setOpen] = useState(false) + const { value: avatar } = useAsyncRetry(async () => { const avatar = await context.getPersonaAvatar(currentPersona?.identifier) if (!avatar) return undefined return avatar }) const [, copyToClipboard] = useCopyToClipboard() - const onCopy = useSnackbarCallback( - async (ev: React.MouseEvent) => { - ev.stopPropagation() + + const onCopy = useCallback( + (e: React.MouseEvent) => { + e.preventDefault() + e.stopPropagation() copyToClipboard(currentPersona?.identifier?.rawPublicKey ?? '') + setOpen(true) + // Close tooltip after five seconds of copying + setTimeout(() => { + setOpen(false) + }, 5000) }, - [], - undefined, - undefined, - undefined, - t.copied(), + [currentPersona?.identifier?.rawPublicKey, copyToClipboard], ) return ( @@ -74,14 +80,15 @@ export function PersonaAction(props: PersonaActionProps) { {currentPersona?.identifier ? formatPublicKey(currentPersona?.identifier?.rawPublicKey) : '--'} - - - + setOpen(false)} + disableFocusListener + disableTouchListener> + + diff --git a/packages/shared/src/UI/components/TokenSecurity/components/RiskCard.tsx b/packages/shared/src/UI/components/TokenSecurity/components/RiskCard.tsx index 7c3e61369a15..62071b3981d1 100644 --- a/packages/shared/src/UI/components/TokenSecurity/components/RiskCard.tsx +++ b/packages/shared/src/UI/components/TokenSecurity/components/RiskCard.tsx @@ -22,11 +22,14 @@ const useStyles = makeStyles()((theme) => ({ alignItems: 'center', }, header: { - fontSize: 14, + fontSize: 16, + fontWeight: 700, lineHeight: '22px', }, description: { - fontSize: 12, + fontSize: 16, + fontWeight: 400, + color: theme.palette.maskColor.second, }, })) diff --git a/packages/shared/src/UI/components/TokenSecurity/components/SecurityPanel.tsx b/packages/shared/src/UI/components/TokenSecurity/components/SecurityPanel.tsx index 250ea2402b6e..7935137dde87 100644 --- a/packages/shared/src/UI/components/TokenSecurity/components/SecurityPanel.tsx +++ b/packages/shared/src/UI/components/TokenSecurity/components/SecurityPanel.tsx @@ -1,6 +1,5 @@ import { Collapse, Link, Stack, Typography } from '@mui/material' import { useSharedI18N } from '../../../../locales' -import { ExternalLink } from 'react-feather' import { makeStyles } from '@masknet/theme' import { memo, useMemo, useState } from 'react' import { DefineMapping, SecurityMessageLevel, TokenSecurity } from './Common' @@ -14,6 +13,7 @@ import type { ChainId, SchemaType } from '@masknet/web3-shared-evm' import urlcat from 'urlcat' import type { TokenAPI } from '@masknet/web3-providers' import { formatCurrency, FungibleToken } from '@masknet/web3-shared-base' +import { LinkOutIcon } from '@masknet/icons' interface TokenCardProps { tokenSecurity: TokenSecurity @@ -24,7 +24,7 @@ interface TokenCardProps { const useStyles = makeStyles()((theme) => ({ header: { - fontWeight: 500, + fontWeight: 700, fontSize: 18, }, root: { @@ -44,13 +44,24 @@ const useStyles = makeStyles()((theme) => ({ height: '48px', }, tokenName: { - fontSize: '16px', + fontSize: '18px', fontWeight: 700, + color: theme.palette.maskColor.main, }, tokenPrice: { - fontSize: '16px', + fontSize: '18px', fontWeight: 700, - color: theme.palette.text.secondary, + color: theme.palette.maskColor.main, + }, + arrowIcon: { + fontSize: 15, + cursor: 'pointer', + fill: theme.palette.maskColor.second, + }, + linkIcon: { + fill: theme.palette.maskColor.main, + width: 18, + height: 18, }, })) @@ -150,13 +161,8 @@ export const SecurityPanel = memo(({ tokenSecurity, tokenInfo, t - - {t.token_info()} - - setCollapse(!isCollapse)} - sx={{ fontSize: 15, cursor: 'pointer' }} - /> + {t.token_info()} + setCollapse(!isCollapse)} className={classes.arrowIcon} /> @@ -167,7 +173,7 @@ export const SecurityPanel = memo(({ tokenSecurity, tokenInfo, t href={resolveGoLabLink(tokenSecurity.chainId, tokenSecurity.contract)} target="_blank" rel="noopener noreferrer"> - + diff --git a/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx b/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx index a8ead2961df9..4e2cd24f5598 100644 --- a/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx +++ b/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx @@ -7,6 +7,7 @@ import { ExternalLink } from 'react-feather' import { makeStyles, usePortalShadowRoot } from '@masknet/theme' import { explorerResolver, formatEthereumAddress } from '@masknet/web3-shared-evm' import { formatCurrency, formatSupply } from '@masknet/web3-shared-base' +import { LinkOutIcon } from '@masknet/icons' const useStyles = makeStyles()((theme) => ({ card: { @@ -18,18 +19,23 @@ const useStyles = makeStyles()((theme) => ({ : '0px 0px 20px rgba(255, 255, 255, 0.12)', }, subtitle: { - color: theme.palette.text.secondary, + color: theme.palette.maskColor.second, fontWeight: 400, fontSize: 16, }, cardValue: { - color: theme.palette.text.primary, + color: theme.palette.maskColor.main, fontSize: 16, fontWeight: 700, }, tooltip: { fontSize: 12, }, + linkIcon: { + fill: theme.palette.maskColor.main, + width: 16, + height: 16, + }, })) const DEFAULT_PLACEHOLDER = '--' @@ -88,7 +94,7 @@ export const TokenPanel = React.forwardRef(({ tokenSecurity, tokenMarketCap }: T href={explorerResolver.fungibleTokenLink(tokenSecurity.chainId, tokenSecurity.contract)} target="_blank" rel="noopener noreferrer"> - + @@ -109,7 +115,7 @@ export const TokenPanel = React.forwardRef(({ tokenSecurity, tokenMarketCap }: T )} target="_blank" rel="noopener noreferrer"> - + )} From f43b5124df17f1a478a52db7733c30bf850cd47e Mon Sep 17 00:00:00 2001 From: UncleBill Date: Mon, 11 Jul 2022 16:54:07 +0800 Subject: [PATCH 049/128] fix: mf-1443 crash on persona searching (#6753) * fix: mf-1443 crash on persona searching * fixup! add reaction to copy --- .../shared/SelectRecipients/ProfileInList.tsx | 36 +++++++++++-------- .../SelectRecipients/SelectRecipients.tsx | 16 ++++----- .../SelectRecipientsDialog.tsx | 6 ++-- .../useTwitterIdByWalletSearch.tsx | 8 +++-- 4 files changed, 36 insertions(+), 30 deletions(-) diff --git a/packages/mask/src/components/shared/SelectRecipients/ProfileInList.tsx b/packages/mask/src/components/shared/SelectRecipients/ProfileInList.tsx index 3f2a3f62be39..e2daa87d4761 100644 --- a/packages/mask/src/components/shared/SelectRecipients/ProfileInList.tsx +++ b/packages/mask/src/components/shared/SelectRecipients/ProfileInList.tsx @@ -1,13 +1,14 @@ -import { useCallback } from 'react' -import { ListItemText, Checkbox, ListItemAvatar, ListItem } from '@mui/material' -import { makeStyles, ShadowRootTooltip } from '@masknet/theme' -import Highlighter from 'react-highlight-words' -import { formatPersonaFingerprint, ProfileInformationFromNextID } from '@masknet/shared-base' -import { Avatar } from '../../../utils/components/Avatar' import { CopyIcon } from '@masknet/icons' +import { useSnackbarCallback } from '@masknet/shared' +import { formatPersonaFingerprint, ProfileInformationFromNextID } from '@masknet/shared-base' +import { makeStyles, ShadowRootTooltip } from '@masknet/theme' +import { Checkbox, ListItem, ListItemAvatar, ListItemText } from '@mui/material' import { truncate } from 'lodash-unified' -import { useI18N } from '../../../utils' +import { useCallback } from 'react' +import Highlighter from 'react-highlight-words' import { useCopyToClipboard } from 'react-use' +import { useI18N } from '../../../utils' +import { Avatar } from '../../../utils/components/Avatar' const useStyles = makeStyles()((theme) => ({ root: { @@ -93,6 +94,18 @@ export function ProfileInList(props: ProfileInListProps) { const profile = props.item const [, copyToClipboard] = useCopyToClipboard() + const rawPublicKey = profile.linkedPersona?.rawPublicKey + const onCopyPubkey = useSnackbarCallback( + async () => { + if (!rawPublicKey) return + copyToClipboard(rawPublicKey) + }, + [rawPublicKey], + undefined, + undefined, + undefined, + t('copied'), + ) const highlightText = (() => { if (!profile.fromNextID) return `@${profile.identifier.userId || profile.nickname}` const mentions = profile.linkedTwitterNames.map((x) => '@' + x).join(' ') @@ -150,14 +163,7 @@ export function ProfileInList(props: ProfileInListProps) { autoEscape textToHighlight={textToHighlight} /> - { - const rawPublicKey = profile.linkedPersona?.rawPublicKey - if (!rawPublicKey) return - copyToClipboard(rawPublicKey.toUpperCase()) - }} - /> + {profile.fromNextID &&
Next.ID
} } diff --git a/packages/mask/src/components/shared/SelectRecipients/SelectRecipients.tsx b/packages/mask/src/components/shared/SelectRecipients/SelectRecipients.tsx index c6efd4dbbb04..615fb1a854dc 100644 --- a/packages/mask/src/components/shared/SelectRecipients/SelectRecipients.tsx +++ b/packages/mask/src/components/shared/SelectRecipients/SelectRecipients.tsx @@ -1,7 +1,6 @@ -import { useEffect, useState } from 'react' +import { useEffect, useMemo, useState } from 'react' import { ProfileInformation as Profile, - EMPTY_LIST, NextIDPlatform, ECKeyIdentifier, ProfileInformationFromNextID, @@ -51,13 +50,12 @@ export function SelectRecipientsUI(props: SelectRecipientsUIProps) { type ?? NextIDPlatform.NextID, value, ) - const NextIDItems = useTwitterIdByWalletSearch(NextIDResults, value, type) - const profileItems = items.recipients?.filter((x) => x.identifier !== currentIdentity?.identifier) - const searchedList = uniqBy( - profileItems?.concat(NextIDItems) ?? [], - ({ linkedPersona }) => linkedPersona?.rawPublicKey, - ) + const NextIDItems = useTwitterIdByWalletSearch(NextIDResults, value, type) + const searchedList = useMemo(() => { + const profileItems = items.recipients?.filter((x) => x.identifier !== currentIdentity?.identifier) + return uniqBy(profileItems?.concat(NextIDItems) ?? [], ({ linkedPersona }) => linkedPersona?.rawPublicKey) + }, [NextIDItems, items.recipients]) const onSelect = async (item: ProfileInformationFromNextID) => { onSetSelected([...selected, item]) @@ -85,7 +83,7 @@ export function SelectRecipientsUI(props: SelectRecipientsUIProps) { setValueToSearch(v) }} open={open} - items={searchedList || EMPTY_LIST} + items={searchedList} selected={selected} disabled={false} submitDisabled={false} diff --git a/packages/mask/src/components/shared/SelectRecipients/SelectRecipientsDialog.tsx b/packages/mask/src/components/shared/SelectRecipients/SelectRecipientsDialog.tsx index 814b6e9182bf..0cb974da13ed 100644 --- a/packages/mask/src/components/shared/SelectRecipients/SelectRecipientsDialog.tsx +++ b/packages/mask/src/components/shared/SelectRecipients/SelectRecipientsDialog.tsx @@ -102,7 +102,7 @@ export function SelectRecipientsDialogUI(props: SelectRecipientsDialogUIProps) { setSearch('') onSearch('') }, [props.open]) - const itemsAfterSearch = useMemo(() => { + const searchedItems = useMemo(() => { const fuse = new Fuse(items, { keys: [ 'identifier.userId', @@ -151,7 +151,7 @@ export function SelectRecipientsDialogUI(props: SelectRecipientsDialogUIProps) { ) : (
- {itemsAfterSearch.length === 0 ? ( + {searchedItems.length === 0 ? (
@@ -159,7 +159,7 @@ export function SelectRecipientsDialogUI(props: SelectRecipientsDialogUIProps) {
) : ( - itemsAfterSearch.map((item, idx) => ( + searchedItems.map((item, idx) => ( { + const nextIdAccounts = bindings.map((binding) => { const proofs = uniqBy( binding.proofs.filter((x) => x.platform === NextIDPlatform.Twitter), (proof) => proof.identity, ) + if (!proofs.length) return null const linkedTwitterNames = proofs.map((x) => x.identity) return { nickname: proofs[0].identity, @@ -29,4 +30,5 @@ export function useTwitterIdByWalletSearch( linkedPersona: ECKeyIdentifier.fromHexPublicKeyK256(binding.persona).unwrap(), } }) + return compact(nextIdAccounts) } From 3e01462e6289eb6cf9c9a055f796e8d2be4996cc Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 11 Jul 2022 17:01:55 +0800 Subject: [PATCH 050/128] fix: mf 1435 --- .../EVM/src/state/TransactionFormatter/descriptors/ERC20.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts index ab391b45b151..cd6a08c79c1d 100644 --- a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts +++ b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts @@ -18,7 +18,7 @@ export class ERC20Descriptor implements TransactionDescriptor { case 'approve': if (parameters?.spender === undefined || parameters?.value === undefined) break - if (isZero(context.value)) { + if (isZero(parameters?.value)) { return { chainId: context.chainId, title: 'Revoke', From ddea985ad5c1790cb4b9b1e054ae452ccdcc5b13 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Mon, 11 Jul 2022 17:05:36 +0800 Subject: [PATCH 051/128] fix: patch for swap (#6756) * fix: bugfix for swap callback * fix: bugfix --- .../Wallet/ContractInteraction/index.tsx | 30 ++++++++++--------- .../trader/balancer/useTradeCallback.ts | 7 +---- .../EVM/src/state/Connection/connection.ts | 1 + .../web3-shared/evm/constants/chains.json | 6 ++-- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx b/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx index 51fd41a3fd22..5271c1b4515f 100644 --- a/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx +++ b/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx @@ -173,11 +173,22 @@ const ContractInteraction = memo(() => { const type = request?.formatterTransaction?.type if (!type) return {} - const methods = request.transactionContext?.methods - if (!methods?.length) return {} - switch (type) { case TransactionDescriptorType.INTERACTION: + const methods = request.transactionContext?.methods + if (!methods?.length) + return { + isNativeTokenInteraction: true, + typeName: t('popups_wallet_contract_interaction'), + tokenAddress: request.computedPayload?.to, + to: request.computedPayload?.to, + gas: request.computedPayload?.gas, + gasPrice: request.computedPayload?.gasPrice, + maxFeePerGas: request.computedPayload?.maxFeePerGas, + maxPriorityFeePerGas: request.computedPayload?.maxPriorityFeePerGas, + amount: request.computedPayload?.value, + } + for (const method of methods) { const parameters = method.parameters @@ -214,17 +225,8 @@ const ContractInteraction = memo(() => { } } } - return { - isNativeTokenInteraction: true, - typeName: t('popups_wallet_contract_interaction'), - tokenAddress: request.computedPayload?.to, - to: request.computedPayload?.to, - gas: request.computedPayload?.gas, - gasPrice: request.computedPayload?.gasPrice, - maxFeePerGas: request.computedPayload?.maxFeePerGas, - maxPriorityFeePerGas: request.computedPayload?.maxPriorityFeePerGas, - amount: request.computedPayload?.value, - } + + return {} case TransactionDescriptorType.TRANSFER: return { isNativeTokenInteraction: true, diff --git a/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts b/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts index 51dee6e2d4f0..fc3059a63ccc 100644 --- a/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts +++ b/packages/mask/src/plugins/Trader/trader/balancer/useTradeCallback.ts @@ -5,7 +5,7 @@ import { SLIPPAGE_DEFAULT } from '../../constants' import { SwapResponse, TradeComputed, TradeStrategy } from '../../types' import { TargetChainIdContext } from '@masknet/plugin-infra/web3-evm' import { useAccount, useWeb3Connection } from '@masknet/plugin-infra/web3' -import { NetworkPluginID, ZERO } from '@masknet/web3-shared-base' +import { NetworkPluginID } from '@masknet/web3-shared-base' import { useTradeAmount } from './useTradeAmount' export function useTradeCallback( @@ -60,11 +60,6 @@ export function useTradeCallback( // send transaction and wait for hash const config = { from: account, - gas: - (await connection.estimateTransaction?.({ - from: account, - value: transactionValue, - })) ?? ZERO.toString(), value: transactionValue, ...gasConfig, } diff --git a/packages/plugins/EVM/src/state/Connection/connection.ts b/packages/plugins/EVM/src/state/Connection/connection.ts index 9516ddbf3c50..cd439da4730d 100644 --- a/packages/plugins/EVM/src/state/Connection/connection.ts +++ b/packages/plugins/EVM/src/state/Connection/connection.ts @@ -794,6 +794,7 @@ class Connection implements EVM_Connection { { from: options.account, ...transaction, + value: transaction.value ? toHex(transaction.value) : undefined, }, ], }, diff --git a/packages/web3-shared/evm/constants/chains.json b/packages/web3-shared/evm/constants/chains.json index 70abf0d8c5cb..c157fb2120df 100644 --- a/packages/web3-shared/evm/constants/chains.json +++ b/packages/web3-shared/evm/constants/chains.json @@ -2782,7 +2782,7 @@ "nativeCurrency": { "chainId": 1313161554, "name": "Ether", - "symbol": "aETH", + "symbol": "AETH", "decimals": 18 }, "infoURL": "https://aurora.dev", @@ -2805,7 +2805,7 @@ "nativeCurrency": { "chainId": 1313161555, "name": "Ether", - "symbol": "aETH", + "symbol": "AETH", "decimals": 18 }, "infoURL": "https://aurora.dev" @@ -2821,7 +2821,7 @@ "nativeCurrency": { "chainId": 1313161556, "name": "Ether", - "symbol": "aETH", + "symbol": "AETH", "decimals": 18 }, "infoURL": "https://aurora.dev" From 4748603e38b65768e4bdec089b515e0cb4ceaca6 Mon Sep 17 00:00:00 2001 From: UncleBill Date: Mon, 11 Jul 2022 17:15:21 +0800 Subject: [PATCH 052/128] fix: turn off annoying isVisitable props warning (#6748) --- packages/theme/src/Components/Tabs/index.tsx | 31 ++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/packages/theme/src/Components/Tabs/index.tsx b/packages/theme/src/Components/Tabs/index.tsx index 85561051ca00..7568459c66ae 100644 --- a/packages/theme/src/Components/Tabs/index.tsx +++ b/packages/theme/src/Components/Tabs/index.tsx @@ -2,7 +2,6 @@ import { Box, Button, ButtonGroup, ButtonGroupProps, styled, Tab } from '@mui/ma import { useTabContext, getPanelId, getTabId } from '@mui/lab/TabContext' import { forwardRef, - cloneElement, Children, isValidElement, useState, @@ -177,11 +176,6 @@ export const MaskTabList = forwardRef((props, 'aria-controls': getPanelId(context, child.props.value), id: getTabId(context, child.props.value), selected: child.props.value === context.value, - // if move tab to first in flexible tabs - isVisitable: (top: number, right: number) => { - const anchor = anchorRef.current?.getBoundingClientRect() - return right <= (anchor?.right ?? 0) - defaultTabSize && top - (anchor?.top ?? 0) < defaultTabSize - }, onChange: (event: object, value: string, visitable?: boolean) => { handleToggle(false) props.onChange(event, value) @@ -191,16 +185,23 @@ export const MaskTabList = forwardRef((props, }, } - if (child.type === Tab) { - const C = tabMapping[variant] - return ( - - {child.props.label} - - ) - } + if (child.type !== Tab) return child - return cloneElement(child, extra) + if (variant === 'flexible') { + Object.assign(extra, { + // if move tab to first in flexible tabs + isVisitable: (top: number, right: number) => { + const anchor = anchorRef.current?.getBoundingClientRect() + return right <= (anchor?.right ?? 0) - defaultTabSize && top - (anchor?.top ?? 0) < defaultTabSize + }, + }) + } + const C = tabMapping[variant] + return ( + + {child.props.label} + + ) }) // #region hide tab should up to first when chick From f2a44fed60ca778f2c6640450de2ff5ca6aaf754 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 11 Jul 2022 17:26:14 +0800 Subject: [PATCH 053/128] fix: mf 1416 --- .../src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx | 1 + .../src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx | 1 + packages/mask/src/plugins/Approval/SNSAdaptor/useStyles.tsx | 3 +++ 3 files changed, 5 insertions(+) diff --git a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx index c4c5ca648f89..8eaeacea0207 100644 --- a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx +++ b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx @@ -116,6 +116,7 @@ function ApprovalNFTItem(props: ApprovalNFTItemProps) { expectedChainId={chainId} switchChainWithoutPopup expectedPluginID={NetworkPluginID.PLUGIN_EVM} + className={classes.chainBoundary} classes={{ switchButton: classes.button }} expectedChainIdSwitchedCallback={() => approveCallback()} ActionButtonPromiseProps={{ diff --git a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx index beb9545e552e..9e03fe19feed 100644 --- a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx +++ b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx @@ -98,6 +98,7 @@ function ApprovalTokenItem(props: ApprovalTokenItemProps) { expectedChainId={chainId} switchChainWithoutPopup expectedPluginID={NetworkPluginID.PLUGIN_EVM} + className={classes.chainBoundary} classes={{ switchButton: classes.button }} expectedChainIdSwitchedCallback={() => approveCallback(true, true)} ActionButtonPromiseProps={{ diff --git a/packages/mask/src/plugins/Approval/SNSAdaptor/useStyles.tsx b/packages/mask/src/plugins/Approval/SNSAdaptor/useStyles.tsx index 310559562782..97a8f57616f3 100644 --- a/packages/mask/src/plugins/Approval/SNSAdaptor/useStyles.tsx +++ b/packages/mask/src/plugins/Approval/SNSAdaptor/useStyles.tsx @@ -219,5 +219,8 @@ export const useStyles = makeStyles<{ listItemBackground?: string; listItemBackg boxShadow: `0 8px 25px ${parseColor(theme.palette.common.black).setAlpha(0.3).toRgbString()}`, }, }, + chainBoundary: { + width: 'auto !important', + }, }), ) From 58d0c2ebf59b83d2b93390ba78076a566195e8a1 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 11 Jul 2022 17:31:13 +0800 Subject: [PATCH 054/128] fix: mf 1419 --- packages/mask/src/components/shared/ApplicationBoardDialog.tsx | 2 +- .../mask/src/components/shared/ApplicationRecommendArea.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/mask/src/components/shared/ApplicationBoardDialog.tsx b/packages/mask/src/components/shared/ApplicationBoardDialog.tsx index fddee13004aa..0a248df29a93 100644 --- a/packages/mask/src/components/shared/ApplicationBoardDialog.tsx +++ b/packages/mask/src/components/shared/ApplicationBoardDialog.tsx @@ -13,7 +13,7 @@ import { GearIcon } from '@masknet/icons' const useStyles = makeStyles()((theme) => { return { content: { - padding: theme.spacing(1.5, 2, 2), + padding: theme.spacing(1.5, 2, '6px'), height: 470, overflow: 'hidden', }, diff --git a/packages/mask/src/components/shared/ApplicationRecommendArea.tsx b/packages/mask/src/components/shared/ApplicationRecommendArea.tsx index d09b82f690ed..7fe0c3f16de3 100644 --- a/packages/mask/src/components/shared/ApplicationRecommendArea.tsx +++ b/packages/mask/src/components/shared/ApplicationRecommendArea.tsx @@ -9,7 +9,7 @@ const useStyles = makeStyles()(() => { recommendFeatureAppListWrapper: { display: 'flex', overflowX: 'scroll', - margin: '0 2px 5px 2px', + margin: '0 2px 4px 2px', padding: '8px 2px 0 2px', '&::-webkit-scrollbar': { display: 'none', From 740734520e8e1e085fd9fb27111c2714eddac2cc Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 11 Jul 2022 17:35:55 +0800 Subject: [PATCH 055/128] fix: mf 1404 --- packages/mask/src/plugins/Furucombo/UI/FurucomboView.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/mask/src/plugins/Furucombo/UI/FurucomboView.tsx b/packages/mask/src/plugins/Furucombo/UI/FurucomboView.tsx index 2b93051ef30c..ff56b8967a64 100644 --- a/packages/mask/src/plugins/Furucombo/UI/FurucomboView.tsx +++ b/packages/mask/src/plugins/Furucombo/UI/FurucomboView.tsx @@ -80,9 +80,7 @@ export function FurucomboView(props: PoolViewProps) { const investable = investables.find( (investable: Investable) => - isSameAddress(investable.address, props.address) && - investable.chainId === currentChainId && - investable.category === props.category, + isSameAddress(investable.address, props.address) && investable.category === props.category, ) if (!investable) From 92808aa08a6772789ccb33cc8322627de7ae6fbc Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Mon, 11 Jul 2022 17:36:53 +0800 Subject: [PATCH 056/128] fix: bugfix for unknow contract --- .../Wallet/ContractInteraction/index.tsx | 87 +++++++++---------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx b/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx index 5271c1b4515f..1f1b915f7a3d 100644 --- a/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx +++ b/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx @@ -176,57 +176,56 @@ const ContractInteraction = memo(() => { switch (type) { case TransactionDescriptorType.INTERACTION: const methods = request.transactionContext?.methods - if (!methods?.length) - return { - isNativeTokenInteraction: true, - typeName: t('popups_wallet_contract_interaction'), - tokenAddress: request.computedPayload?.to, - to: request.computedPayload?.to, - gas: request.computedPayload?.gas, - gasPrice: request.computedPayload?.gasPrice, - maxFeePerGas: request.computedPayload?.maxFeePerGas, - maxPriorityFeePerGas: request.computedPayload?.maxPriorityFeePerGas, - amount: request.computedPayload?.value, - } - for (const method of methods) { - const parameters = method.parameters + if (methods?.length) { + for (const method of methods) { + const parameters = method.parameters - if (method.name === 'approve' && parameters?.value) { - return { - isNativeTokenInteraction: false, - typeName: request.formatterTransaction?.title, - tokenAddress: request.computedPayload?.to, - to: request.computedPayload?.to, - gas: request.computedPayload?.gas, - gasPrice: request.computedPayload?.gasPrice, - maxFeePerGas: request.computedPayload?.maxFeePerGas, - maxPriorityFeePerGas: request.computedPayload?.maxPriorityFeePerGas, - amount: parameters?.value, + if (method.name === 'approve' && parameters?.value) { + return { + isNativeTokenInteraction: false, + typeName: request.formatterTransaction?.title, + tokenAddress: request.computedPayload?.to, + to: request.computedPayload?.to, + gas: request.computedPayload?.gas, + gasPrice: request.computedPayload?.gasPrice, + maxFeePerGas: request.computedPayload?.maxFeePerGas, + maxPriorityFeePerGas: request.computedPayload?.maxPriorityFeePerGas, + amount: parameters?.value, + } } - } - if ( - (method.name === 'transfer' || method.name === 'transferFrom') && - parameters?.to && - parameters?.value - ) { - return { - isNativeTokenInteraction: false, - typeName: t('popups_wallet_contract_interaction_transfer'), - tokenAddress: request.computedPayload?.to, - to: parameters?.to as string, - gas: request.computedPayload?.gas, - gasPrice: request.computedPayload?.gasPrice, - maxFeePerGas: request.computedPayload?.maxFeePerGas, - maxPriorityFeePerGas: request.computedPayload?.maxPriorityFeePerGas, - amount: parameters?.value, - contractAddress: request.computedPayload?.to, + if ( + (method.name === 'transfer' || method.name === 'transferFrom') && + parameters?.to && + parameters?.value + ) { + return { + isNativeTokenInteraction: false, + typeName: t('popups_wallet_contract_interaction_transfer'), + tokenAddress: request.computedPayload?.to, + to: parameters?.to as string, + gas: request.computedPayload?.gas, + gasPrice: request.computedPayload?.gasPrice, + maxFeePerGas: request.computedPayload?.maxFeePerGas, + maxPriorityFeePerGas: request.computedPayload?.maxPriorityFeePerGas, + amount: parameters?.value, + contractAddress: request.computedPayload?.to, + } } } } - - return {} + return { + isNativeTokenInteraction: true, + typeName: t('popups_wallet_contract_interaction'), + tokenAddress: request.computedPayload?.to, + to: request.computedPayload?.to, + gas: request.computedPayload?.gas, + gasPrice: request.computedPayload?.gasPrice, + maxFeePerGas: request.computedPayload?.maxFeePerGas, + maxPriorityFeePerGas: request.computedPayload?.maxPriorityFeePerGas, + amount: request.computedPayload?.value, + } case TransactionDescriptorType.TRANSFER: return { isNativeTokenInteraction: true, From ac74a6dd14e7000e5e9fe8a94b4e4fba51b0098c Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 11 Jul 2022 17:50:23 +0800 Subject: [PATCH 057/128] fix: mf 1373 --- packages/mask/src/components/shared/ApplicationBoard.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/mask/src/components/shared/ApplicationBoard.tsx b/packages/mask/src/components/shared/ApplicationBoard.tsx index ae551276fdad..7206ac544d1e 100644 --- a/packages/mask/src/components/shared/ApplicationBoard.tsx +++ b/packages/mask/src/components/shared/ApplicationBoard.tsx @@ -185,7 +185,13 @@ function ApplicationBoardContent(props: Props) { ))} ) : ( -
+
2 && isCarouselReady() && isHoveringCarousel + ? classes.applicationWrapperWithCarousel + : '', + )}> {t('application_display_tab_plug_app-unlisted-placeholder')} From 00979875e63be0160b9715dc7dc6389f06bfbbb6 Mon Sep 17 00:00:00 2001 From: BillyS Date: Mon, 11 Jul 2022 18:00:27 +0800 Subject: [PATCH 058/128] fix: rebase (#6754) --- .../shared/SelectRecipients/SelectRecipientsDialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mask/src/components/shared/SelectRecipients/SelectRecipientsDialog.tsx b/packages/mask/src/components/shared/SelectRecipients/SelectRecipientsDialog.tsx index 0cb974da13ed..d9445566b182 100644 --- a/packages/mask/src/components/shared/SelectRecipients/SelectRecipientsDialog.tsx +++ b/packages/mask/src/components/shared/SelectRecipients/SelectRecipientsDialog.tsx @@ -116,7 +116,7 @@ export function SelectRecipientsDialogUI(props: SelectRecipientsDialogUIProps) { ignoreLocation: true, threshold: 0, }) - return (search === '' ? items : fuse.search(search).map((item) => item.item)).concat(props.selected) + return search === '' ? items : fuse.search(search).map((item) => item.item) }, [search, items]) return ( Date: Mon, 11 Jul 2022 18:11:41 +0800 Subject: [PATCH 059/128] fix: mf 1397 --- .../mask/src/web3/UI/EthereumERC721TokenApprovedBoundary.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/mask/src/web3/UI/EthereumERC721TokenApprovedBoundary.tsx b/packages/mask/src/web3/UI/EthereumERC721TokenApprovedBoundary.tsx index 99168f60dcc9..163dbb33cbf8 100644 --- a/packages/mask/src/web3/UI/EthereumERC721TokenApprovedBoundary.tsx +++ b/packages/mask/src/web3/UI/EthereumERC721TokenApprovedBoundary.tsx @@ -49,6 +49,7 @@ export function EthereumERC721TokenApprovedBoundary(props: EthereumERC712TokenAp contractDetailed?.address, operator, true, + retry, ) const validationMessage = useMemo(() => { From a99327851782deb7ca6f6b6b1c4c3ca72643a60f Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Mon, 11 Jul 2022 18:22:51 +0800 Subject: [PATCH 060/128] fix: incorrect chain id with formatter context (#6758) --- .../popups/pages/Wallet/hooks/useUnConfirmedRequest.ts | 2 +- packages/plugins/EVM/src/state/TransactionFormatter.ts | 2 +- packages/web3-shared/evm/utils/contract.ts | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/mask/src/extension/popups/pages/Wallet/hooks/useUnConfirmedRequest.ts b/packages/mask/src/extension/popups/pages/Wallet/hooks/useUnConfirmedRequest.ts index c3f8a2ce4189..8642a7bee4cc 100644 --- a/packages/mask/src/extension/popups/pages/Wallet/hooks/useUnConfirmedRequest.ts +++ b/packages/mask/src/extension/popups/pages/Wallet/hooks/useUnConfirmedRequest.ts @@ -24,7 +24,7 @@ export const useUnconfirmedRequest = () => { formatterTransaction, transactionContext, } - }, []) + }, [chainId, TransactionFormatter]) useEffect(() => { return WalletMessages.events.requestsUpdated.on(result.retry) diff --git a/packages/plugins/EVM/src/state/TransactionFormatter.ts b/packages/plugins/EVM/src/state/TransactionFormatter.ts index 8101f61a3f80..1d8b33eb99d4 100644 --- a/packages/plugins/EVM/src/state/TransactionFormatter.ts +++ b/packages/plugins/EVM/src/state/TransactionFormatter.ts @@ -106,7 +106,7 @@ export class TransactionFormatter extends TransactionFormatterState Date: Mon, 11 Jul 2022 18:37:01 +0800 Subject: [PATCH 061/128] fix: mf 1423 --- packages/mask/src/components/shared/ApplicationBoard.tsx | 2 ++ .../plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/packages/mask/src/components/shared/ApplicationBoard.tsx b/packages/mask/src/components/shared/ApplicationBoard.tsx index 7206ac544d1e..0cf6f9bcd276 100644 --- a/packages/mask/src/components/shared/ApplicationBoard.tsx +++ b/packages/mask/src/components/shared/ApplicationBoard.tsx @@ -167,6 +167,7 @@ function ApplicationBoardContent(props: Props) { <> ) { } = usePersonaAgainstSNSConnectStatus() useEffect(() => { + nextIDConnectStatus.reset() retry() return MaskMessages.events.currentPersonaIdentifier.on(() => { retry() diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx index d3d9353d8e76..646a83313ea8 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx @@ -119,6 +119,10 @@ export function RedPacketConfirmDialog(props: ConfirmRedPacketFormProps) { token_address: string total: string } + + // the events log is not available + if (!events?.CreationSuccess.returnValues.id) return + payload.current.sender = { address: account, name: settings.name, From 35a60ce0b94564093ce35f4309b8d99d4168d2a2 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 11 Jul 2022 19:24:00 +0800 Subject: [PATCH 062/128] fix: workaround for pure react carousel issue --- packages/mask/src/plugins/Avatar/SNSAdaptor/AddNFT.tsx | 4 ++++ .../Web3Profile/src/SNSAdaptor/components/AddCollectibles.tsx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packages/mask/src/plugins/Avatar/SNSAdaptor/AddNFT.tsx b/packages/mask/src/plugins/Avatar/SNSAdaptor/AddNFT.tsx index 75eb06b8b45b..e638cefe3763 100644 --- a/packages/mask/src/plugins/Avatar/SNSAdaptor/AddNFT.tsx +++ b/packages/mask/src/plugins/Avatar/SNSAdaptor/AddNFT.tsx @@ -147,6 +147,9 @@ export function AddNFT(props: AddNFTProps) {
e.currentTarget.getElementsByTagName('input')[0].focus()} sx={{ width: '100%' }} placeholder={t('plugin_avatar_input_token_address')} onChange={(e) => onAddressChange(e.target.value)} @@ -154,6 +157,7 @@ export function AddNFT(props: AddNFTProps) {
e.currentTarget.getElementsByTagName('input')[0].focus()} sx={{ width: '100%' }} placeholder={t('plugin_avatar_input_token_id')} onChange={(e) => onTokenIdChange(e.target.value)} diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/components/AddCollectibles.tsx b/packages/plugins/Web3Profile/src/SNSAdaptor/components/AddCollectibles.tsx index 2ef64203701d..a4b02a112376 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/components/AddCollectibles.tsx +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/components/AddCollectibles.tsx @@ -145,6 +145,9 @@ export function AddNFT(props: AddNFTProps) {
e.currentTarget.getElementsByTagName('input')[0].focus()} sx={{ width: '100%' }} placeholder={t.plugin_avatar_input_token_address()} onChange={(e) => onAddressChange(e.target.value)} @@ -152,6 +155,7 @@ export function AddNFT(props: AddNFTProps) {
e.currentTarget.getElementsByTagName('input')[0].focus()} sx={{ width: '100%' }} placeholder={t.plugin_avatar_input_token_id()} onChange={(e) => onTokenIdChange(e.target.value)} From db85d26589e7bbdbaa08194f589c29530f7c56c1 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Mon, 11 Jul 2022 20:05:03 +0800 Subject: [PATCH 063/128] fix: add explore link at harmony --- .../Trader/trader/uniswap/useTradeCallback.ts | 1 - .../web3-shared/evm/constants/chains.json | 36 ++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/packages/mask/src/plugins/Trader/trader/uniswap/useTradeCallback.ts b/packages/mask/src/plugins/Trader/trader/uniswap/useTradeCallback.ts index 749987845bf3..5bdacb1555ef 100644 --- a/packages/mask/src/plugins/Trader/trader/uniswap/useTradeCallback.ts +++ b/packages/mask/src/plugins/Trader/trader/uniswap/useTradeCallback.ts @@ -36,7 +36,6 @@ export function useTradeCallback( allowedSlippage?: number, ) { const { targetChainId } = TargetChainIdContext.useContainer() - // const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM, { chainId: targetChainId }) const connection = useWeb3Connection(NetworkPluginID.PLUGIN_EVM, { chainId: targetChainId }) const account = useAccount(NetworkPluginID.PLUGIN_EVM) const tradeParameters = useTradeParameters(trade, tradeProvider, allowedSlippage) diff --git a/packages/web3-shared/evm/constants/chains.json b/packages/web3-shared/evm/constants/chains.json index c157fb2120df..725cccd2906c 100644 --- a/packages/web3-shared/evm/constants/chains.json +++ b/packages/web3-shared/evm/constants/chains.json @@ -2839,7 +2839,14 @@ "symbol": "ONE", "decimals": 18 }, - "infoURL": "https://www.harmony.one/" + "infoURL": "https://www.harmony.one/", + "explorers": [ + { + "name": "harmony", + "url": "https://explorer.harmony.one", + "standard": "EIP3091" + } + ] }, { "chainId": 1666600001, @@ -2854,7 +2861,14 @@ "symbol": "ONE", "decimals": 18 }, - "infoURL": "https://www.harmony.one/" + "infoURL": "https://www.harmony.one/", + "explorers": [ + { + "name": "harmony", + "url": "https://explorer.harmony.one", + "standard": "EIP3091" + } + ] }, { "chainId": 1666600002, @@ -2869,7 +2883,14 @@ "symbol": "ONE", "decimals": 18 }, - "infoURL": "https://www.harmony.one/" + "infoURL": "https://www.harmony.one/", + "explorers": [ + { + "name": "harmony", + "url": "https://explorer.harmony.one", + "standard": "EIP3091" + } + ] }, { "chainId": 1666600003, @@ -2884,7 +2905,14 @@ "symbol": "ONE", "decimals": 18 }, - "infoURL": "https://www.harmony.one/" + "infoURL": "https://www.harmony.one/", + "explorers": [ + { + "name": "harmony", + "url": "https://explorer.harmony.one", + "standard": "EIP3091" + } + ] }, { "chainId": 1666700000, From 905a6baadf89ef16909ca8a909e8a1efce6403eb Mon Sep 17 00:00:00 2001 From: UncleBill Date: Mon, 11 Jul 2022 20:51:55 +0800 Subject: [PATCH 064/128] fix: mf-1418 some places fail to get icon of token (#6759) * fix: mf-1418 some places fail to get icon of token * fixup! fix: mf-1418 some places fail to get icon of token --- .../trending/components/CoinIcon.tsx | 6 +- packages/shared/package.json | 2 + .../src/UI/components/TokenIcon/index.tsx | 30 +- packages/shared/src/hooks/useImageBase64.ts | 40 ++- pnpm-lock.yaml | 266 ++++++++---------- 5 files changed, 175 insertions(+), 169 deletions(-) diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/components/CoinIcon.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/components/CoinIcon.tsx index 79792183527d..ff3df111f8f8 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/components/CoinIcon.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/components/CoinIcon.tsx @@ -21,7 +21,7 @@ export const CoinIcon: FC = ({ type, address, logoUrl, name, size }, }, } - if (address && type === TrendingCoinType.Fungible) return - if (type === TrendingCoinType.NonFungible) return - return null + if (address && type === TrendingCoinType.Fungible) + return + return } diff --git a/packages/shared/package.json b/packages/shared/package.json index 39d4d7a053d3..47dd621944b6 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -24,6 +24,8 @@ "@types/qrcode": "^1.4.2", "@solana/web3.js": "^1.30.2", "anchorme": "^2.1.2", + "lru-cache": "^7.10.1", + "@types/lru-cache": "^7.10.10", "bignumber.js": "^9.0.2", "classnames": "^2.3.1", "date-fns": "2.28.0", diff --git a/packages/shared/src/UI/components/TokenIcon/index.tsx b/packages/shared/src/UI/components/TokenIcon/index.tsx index a200c0e49d15..de06e60dd17e 100644 --- a/packages/shared/src/UI/components/TokenIcon/index.tsx +++ b/packages/shared/src/UI/components/TokenIcon/index.tsx @@ -1,17 +1,16 @@ import { memo } from 'react' import { useAsyncRetry } from 'react-use' import { first } from 'lodash-unified' -import { Avatar, AvatarProps } from '@mui/material' +import { Avatar, AvatarProps, useTheme } from '@mui/material' import { makeStyles, useStylesExtends } from '@masknet/theme' import NO_IMAGE_COLOR from './constants' import { useChainId, useWeb3Hub, Web3Helper } from '@masknet/plugin-infra/web3' import type { NetworkPluginID } from '@masknet/web3-shared-base' import { EMPTY_LIST } from '@masknet/shared-base' -import { useImageBase64 } from '../../../hooks/useImageBase64' +import { useAccessibleUrl } from '../../../hooks/useImageBase64' const useStyles = makeStyles()((theme) => ({ icon: { - backgroundColor: theme.palette.common.white, margin: 0, }, })) @@ -31,18 +30,25 @@ export function TokenIcon(props: TokenIconProps) { const chainId = useChainId(props.pluginID, props.chainId) const hub = useWeb3Hub(props.pluginID) - const { value } = useAsyncRetry(async () => { - const logoURLs = await hub?.getFungibleTokenIconURLs?.(chainId, address) + const logoURLs = await hub?.getFungibleTokenIconURLs?.(chainId, address).catch(() => []) + const key = address ? [chainId, address].join('/') : logoURL return { - key: [chainId, address, logoURL].join('/'), + key, urls: [logoURL, ...(logoURLs ?? [])].filter(Boolean) as string[], } }, [chainId, address, logoURL, hub]) const { urls = EMPTY_LIST, key } = value ?? {} - const base64 = useImageBase64(key, first(urls)) + const accessibleUrl = useAccessibleUrl(key, first(urls)) - return + return ( + + ) } export interface TokenIconUIProps extends withClasses<'icon'> { @@ -61,13 +67,17 @@ export const TokenIconUI = memo((props) => { : undefined const classes = useStylesExtends(useStyles(), props) + const theme = useTheme() return ( + {...AvatarProps} + sx={{ + ...AvatarProps?.sx, + backgroundColor: logoURL ? theme.palette.common.white : defaultBackgroundColor, + }}> {name?.slice(0, 1).toUpperCase()} ) diff --git a/packages/shared/src/hooks/useImageBase64.ts b/packages/shared/src/hooks/useImageBase64.ts index 609dbe819606..81867e1726a9 100644 --- a/packages/shared/src/hooks/useImageBase64.ts +++ b/packages/shared/src/hooks/useImageBase64.ts @@ -1,4 +1,5 @@ import { useState } from 'react' +import LRUCache from 'lru-cache' import { useAsyncRetry } from 'react-use' function readAsDataURL(blob: Blob) { @@ -10,35 +11,54 @@ function readAsDataURL(blob: Blob) { }) } -const cache = new Map() +const cache = new LRUCache>({ + max: 500, + ttl: 300_000, +}) +const responseToBase64 = async (response: Response) => { + const blob = await response.blob() + const dataURL = await readAsDataURL(blob) + return dataURL +} -export function useImageBase64( - key?: string, +export function useAccessibleUrl( + key = '', url?: string, options?: { fetch: typeof globalThis.fetch }, ) { const fetch = options?.fetch ?? globalThis.fetch - const [base64, setBase64] = useState(cache.get(key ?? '') ?? '') + const [avaliableUrl, setAvaliableUrl] = useState(() => { + const hit = cache.get(key) + return typeof hit === 'string' ? hit : '' + }) useAsyncRetry(async () => { if (!key) return const hit = cache.get(key) - if (hit) { - setBase64(hit) + if (typeof hit === 'string') { + setAvaliableUrl(hit) + return + } else if (hit instanceof Promise) { + setAvaliableUrl(await responseToBase64((await hit).clone())) return } if (!url || !fetch) return - const response = await fetch(`https://cors.r2d2.to/?${url}`) - if (!response) return + const fetchingTask = fetch(`https://cors.r2d2.to/?${url}`) + cache.set(key, fetchingTask) + const response = await fetchingTask + if (!response.ok) { + cache.delete(key) + return + } const blob = await response.blob() const dataURL = await readAsDataURL(blob) cache.set(key, dataURL) - setBase64(dataURL) + setAvaliableUrl(dataURL) }, [key, url]) - return base64 + return avaliableUrl } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d9551915fa10..c1861175333a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1312,6 +1312,7 @@ importers: '@masknet/web3-shared-solana': workspace:* '@react-hookz/web': ^14.2.2 '@solana/web3.js': ^1.30.2 + '@types/lru-cache': ^7.10.10 '@types/qrcode': ^1.4.2 anchorme: ^2.1.2 bignumber.js: ^9.0.2 @@ -1319,6 +1320,7 @@ importers: date-fns: 2.28.0 iframe-resizer-react: ^1.1.0 lodash-es: ^4.17.21 + lru-cache: ^7.10.1 qrcode: ^1.5.0 react-feather: ^2.0.9 react-hook-form: ^7.31.1 @@ -1342,6 +1344,7 @@ importers: '@masknet/web3-shared-solana': link:../web3-shared/solana '@react-hookz/web': 14.2.2 '@solana/web3.js': 1.44.2 + '@types/lru-cache': 7.10.10 '@types/qrcode': 1.4.2 anchorme: 2.1.2 bignumber.js: 9.0.2 @@ -1349,6 +1352,7 @@ importers: date-fns: 2.28.0 iframe-resizer-react: 1.1.0 lodash-es: 4.17.21 + lru-cache: 7.10.1 qrcode: 1.5.0 react-feather: 2.0.9 react-hook-form: 7.31.1 @@ -1838,11 +1842,11 @@ packages: dev: false /@0xproject/json-schemas/0.7.24: - resolution: {integrity: sha1-IaErQ6sKtKowLQLEiRZozaNrbGQ=} + resolution: {integrity: sha512-20MeFHMptuv0e58mjSLmW84m2HbYdmuxFeeXqGZjv047zBawONe2aXKqLX266XYjgNSif/cDVzdgh7/46J9MVQ==} engines: {node: '>=6.12'} dependencies: '@0xproject/typescript-typings': 0.3.2 - '@types/node': 17.0.34 + '@types/node': 17.0.45 jsonschema: 1.4.0 lodash.values: 4.3.0 dev: false @@ -1855,15 +1859,15 @@ packages: dev: false /@0xproject/types/0.7.0: - resolution: {integrity: sha1-+tE5Je6SrU7hmAZopcsr7U3Kq48=} + resolution: {integrity: sha512-LlTnq7raPnCioCokNy5CLDxZJeg3KtcHT4PBJD6BDiXYtNJxBWvL7/jr6JiwdjReNg7ihGi1265VKfFX7qukRw==} engines: {node: '>=6.12'} dependencies: - '@types/node': 17.0.34 + '@types/node': 17.0.45 bignumber.js: 4.1.0 dev: false /@0xproject/typescript-typings/0.3.2: - resolution: {integrity: sha1-q8NgtEGv2pkxAEUMqDad+r91k2s=} + resolution: {integrity: sha512-sHwGTxerREyQhyXFHhZRHvy7PlbBUjsoVbxhf5f+9JasC+IhQ2Nv4uJFjOo16uUPPp7l+lsRUvK/ZwrdGRbFBA==} engines: {node: '>=6.12'} dependencies: '@0xproject/types': 0.7.0 @@ -9953,7 +9957,6 @@ packages: deprecated: This is a stub types definition. lru-cache provides its own type definitions, so you do not need this installed. dependencies: lru-cache: 7.10.1 - dev: true /@types/mdast/3.0.10: resolution: {integrity: sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA==} @@ -11703,7 +11706,7 @@ packages: dev: false /axios/0.17.1: - resolution: {integrity: sha1-LY4+XQvb1zJ/kbyBT1xXZg+Bgk0=} + resolution: {integrity: sha512-mZzWRyJeJ0rtK7e1/6iYBUzmeXjzei+1h1IvbedyU0sB52++tU5AU6r6TLXpwNVR0ebXIpvTVW+9CpWNyc1n8w==} deprecated: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410 dependencies: follow-redirects: 1.14.9 @@ -11737,7 +11740,7 @@ packages: dev: false /babel-code-frame/6.26.0: - resolution: {integrity: sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=} + resolution: {integrity: sha512-XqYMR2dfdGMW+hd0IUZ2PwK+fGeFkOxZJ0wY+JaQAHzt1Zx8LcvpiZD2NiGkEG8qx0CfkAOr5xt76d1e8vG90g==} dependencies: chalk: 1.1.3 esutils: 2.0.3 @@ -11784,7 +11787,7 @@ packages: dev: false /babel-helper-builder-binary-assignment-operator-visitor/6.24.1: - resolution: {integrity: sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=} + resolution: {integrity: sha512-gCtfYORSG1fUMX4kKraymq607FWgMWg+j42IFPc18kFQEsmtaibP4UrqsXt8FlEJle25HUd4tsoDR7H2wDhe9Q==} dependencies: babel-helper-explode-assignable-expression: 6.24.1 babel-runtime: 6.26.0 @@ -11794,7 +11797,7 @@ packages: dev: false /babel-helper-call-delegate/6.24.1: - resolution: {integrity: sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=} + resolution: {integrity: sha512-RL8n2NiEj+kKztlrVJM9JT1cXzzAdvWFh76xh/H1I4nKwunzE4INBXn8ieCZ+wh4zWszZk7NBS1s/8HR5jDkzQ==} dependencies: babel-helper-hoist-variables: 6.24.1 babel-runtime: 6.26.0 @@ -11805,7 +11808,7 @@ packages: dev: false /babel-helper-define-map/6.26.0: - resolution: {integrity: sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=} + resolution: {integrity: sha512-bHkmjcC9lM1kmZcVpA5t2om2nzT/xiZpo6TJq7UlZ3wqKfzia4veeXbIhKvJXAMzhhEBd3cR1IElL5AenWEUpA==} dependencies: babel-helper-function-name: 6.24.1 babel-runtime: 6.26.0 @@ -11816,7 +11819,7 @@ packages: dev: false /babel-helper-explode-assignable-expression/6.24.1: - resolution: {integrity: sha1-8luCz33BBDPFX3BZLVdGQArCLKo=} + resolution: {integrity: sha512-qe5csbhbvq6ccry9G7tkXbzNtcDiH4r51rrPUbwwoTzZ18AqxWYRZT6AOmxrpxKnQBW0pYlBI/8vh73Z//78nQ==} dependencies: babel-runtime: 6.26.0 babel-traverse: 6.26.0 @@ -11826,7 +11829,7 @@ packages: dev: false /babel-helper-function-name/6.24.1: - resolution: {integrity: sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=} + resolution: {integrity: sha512-Oo6+e2iX+o9eVvJ9Y5eKL5iryeRdsIkwRYheCuhYdVHsdEQysbc2z2QkqCLIYnNxkT5Ss3ggrHdXiDI7Dhrn4Q==} dependencies: babel-helper-get-function-arity: 6.24.1 babel-runtime: 6.26.0 @@ -11838,28 +11841,28 @@ packages: dev: false /babel-helper-get-function-arity/6.24.1: - resolution: {integrity: sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=} + resolution: {integrity: sha512-WfgKFX6swFB1jS2vo+DwivRN4NB8XUdM3ij0Y1gnC21y1tdBoe6xjVnd7NSI6alv+gZXCtJqvrTeMW3fR/c0ng==} dependencies: babel-runtime: 6.26.0 babel-types: 6.26.0 dev: false /babel-helper-hoist-variables/6.24.1: - resolution: {integrity: sha1-HssnaJydJVE+rbyZFKc/VAi+enY=} + resolution: {integrity: sha512-zAYl3tqerLItvG5cKYw7f1SpvIxS9zi7ohyGHaI9cgDUjAT6YcY9jIEH5CstetP5wHIVSceXwNS7Z5BpJg+rOw==} dependencies: babel-runtime: 6.26.0 babel-types: 6.26.0 dev: false /babel-helper-optimise-call-expression/6.24.1: - resolution: {integrity: sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=} + resolution: {integrity: sha512-Op9IhEaxhbRT8MDXx2iNuMgciu2V8lDvYCNQbDGjdBNCjaMvyLf4wl4A3b8IgndCyQF8TwfgsQ8T3VD8aX1/pA==} dependencies: babel-runtime: 6.26.0 babel-types: 6.26.0 dev: false /babel-helper-regex/6.26.0: - resolution: {integrity: sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=} + resolution: {integrity: sha512-VlPiWmqmGJp0x0oK27Out1D+71nVVCTSdlbhIVoaBAj2lUgrNjBCRR9+llO4lTSb2O4r7PJg+RobRkhBrf6ofg==} dependencies: babel-runtime: 6.26.0 babel-types: 6.26.0 @@ -11867,7 +11870,7 @@ packages: dev: false /babel-helper-remap-async-to-generator/6.24.1: - resolution: {integrity: sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=} + resolution: {integrity: sha512-RYqaPD0mQyQIFRu7Ho5wE2yvA/5jxqCIj/Lv4BXNq23mHYu/vxikOy2JueLiBxQknwapwrJeNCesvY0ZcfnlHg==} dependencies: babel-helper-function-name: 6.24.1 babel-runtime: 6.26.0 @@ -11879,7 +11882,7 @@ packages: dev: false /babel-helper-replace-supers/6.24.1: - resolution: {integrity: sha1-v22/5Dk40XNpohPKiov3S2qQqxo=} + resolution: {integrity: sha512-sLI+u7sXJh6+ToqDr57Bv973kCepItDhMou0xCP2YPVmR1jkHSCY+p1no8xErbV1Siz5QE8qKT1WIwybSWlqjw==} dependencies: babel-helper-optimise-call-expression: 6.24.1 babel-messages: 6.23.0 @@ -11892,7 +11895,7 @@ packages: dev: false /babel-helpers/6.24.1: - resolution: {integrity: sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=} + resolution: {integrity: sha512-n7pFrqQm44TCYvrCDb0MqabAF+JUBq+ijBvNMUxpkLjJaAu32faIexewMumrH5KLLJ1HDyT0PTEqRyAe/GwwuQ==} dependencies: babel-runtime: 6.26.0 babel-template: 6.26.0 @@ -11975,7 +11978,7 @@ packages: dev: true /babel-messages/6.23.0: - resolution: {integrity: sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=} + resolution: {integrity: sha512-Bl3ZiA+LjqaMtNYopA9TYE9HP1tQ+E5dLxE0XrAzcIJeK2UqF0/EaqXwBn9esd4UmTfEab+P+UYQ1GnioFIb/w==} dependencies: babel-runtime: 6.26.0 dev: false @@ -11998,7 +12001,7 @@ packages: dev: true /babel-plugin-check-es2015-constants/6.22.0: - resolution: {integrity: sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=} + resolution: {integrity: sha512-B1M5KBP29248dViEo1owyY32lk1ZSH2DaNNrXLGt8lyjjHm7pBqAdQ7VKUPR6EEDO323+OvT3MQXbCin8ooWdA==} dependencies: babel-runtime: 6.26.0 dev: false @@ -12169,19 +12172,19 @@ packages: dev: true /babel-plugin-syntax-async-functions/6.13.0: - resolution: {integrity: sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=} + resolution: {integrity: sha512-4Zp4unmHgw30A1eWI5EpACji2qMocisdXhAftfhXoSV9j0Tvj6nRFE3tOmRY912E0FMRm/L5xWE7MGVT2FoLnw==} dev: false /babel-plugin-syntax-exponentiation-operator/6.13.0: - resolution: {integrity: sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=} + resolution: {integrity: sha512-Z/flU+T9ta0aIEKl1tGEmN/pZiI1uXmCiGFRegKacQfEJzp7iNsKloZmyJlQr+75FCJtiFfGIK03SiCvCt9cPQ==} dev: false /babel-plugin-syntax-trailing-function-commas/6.22.0: - resolution: {integrity: sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=} + resolution: {integrity: sha512-Gx9CH3Q/3GKbhs07Bszw5fPTlU+ygrOGfAhEt7W2JICwufpC4SuO0mG0+4NykPBSYPMJhqvVlDBU17qB1D+hMQ==} dev: false /babel-plugin-transform-async-to-generator/6.24.1: - resolution: {integrity: sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=} + resolution: {integrity: sha512-7BgYJujNCg0Ti3x0c/DL3tStvnKS6ktIYOmo9wginv/dfZOrbSZ+qG4IRRHMBOzZ5Awb1skTiAsQXg/+IWkZYw==} dependencies: babel-helper-remap-async-to-generator: 6.24.1 babel-plugin-syntax-async-functions: 6.13.0 @@ -12191,19 +12194,19 @@ packages: dev: false /babel-plugin-transform-es2015-arrow-functions/6.22.0: - resolution: {integrity: sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=} + resolution: {integrity: sha512-PCqwwzODXW7JMrzu+yZIaYbPQSKjDTAsNNlK2l5Gg9g4rz2VzLnZsStvp/3c46GfXpwkyufb3NCyG9+50FF1Vg==} dependencies: babel-runtime: 6.26.0 dev: false /babel-plugin-transform-es2015-block-scoped-functions/6.22.0: - resolution: {integrity: sha1-u8UbSflk1wy42OC5ToICRs46YUE=} + resolution: {integrity: sha512-2+ujAT2UMBzYFm7tidUsYh+ZoIutxJ3pN9IYrF1/H6dCKtECfhmB8UkHVpyxDwkj0CYbQG35ykoz925TUnBc3A==} dependencies: babel-runtime: 6.26.0 dev: false /babel-plugin-transform-es2015-block-scoping/6.26.0: - resolution: {integrity: sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=} + resolution: {integrity: sha512-YiN6sFAQ5lML8JjCmr7uerS5Yc/EMbgg9G8ZNmk2E3nYX4ckHR01wrkeeMijEf5WHNK5TW0Sl0Uu3pv3EdOJWw==} dependencies: babel-runtime: 6.26.0 babel-template: 6.26.0 @@ -12215,7 +12218,7 @@ packages: dev: false /babel-plugin-transform-es2015-classes/6.24.1: - resolution: {integrity: sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=} + resolution: {integrity: sha512-5Dy7ZbRinGrNtmWpquZKZ3EGY8sDgIVB4CU8Om8q8tnMLrD/m94cKglVcHps0BCTdZ0TJeeAWOq2TK9MIY6cag==} dependencies: babel-helper-define-map: 6.26.0 babel-helper-function-name: 6.24.1 @@ -12231,7 +12234,7 @@ packages: dev: false /babel-plugin-transform-es2015-computed-properties/6.24.1: - resolution: {integrity: sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=} + resolution: {integrity: sha512-C/uAv4ktFP/Hmh01gMTvYvICrKze0XVX9f2PdIXuriCSvUmV9j+u+BB9f5fJK3+878yMK6dkdcq+Ymr9mrcLzw==} dependencies: babel-runtime: 6.26.0 babel-template: 6.26.0 @@ -12240,26 +12243,26 @@ packages: dev: false /babel-plugin-transform-es2015-destructuring/6.23.0: - resolution: {integrity: sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=} + resolution: {integrity: sha512-aNv/GDAW0j/f4Uy1OEPZn1mqD+Nfy9viFGBfQ5bZyT35YqOiqx7/tXdyfZkJ1sC21NyEsBdfDY6PYmLHF4r5iA==} dependencies: babel-runtime: 6.26.0 dev: false /babel-plugin-transform-es2015-duplicate-keys/6.24.1: - resolution: {integrity: sha1-c+s9MQypaePvnskcU3QabxV2Qj4=} + resolution: {integrity: sha512-ossocTuPOssfxO2h+Z3/Ea1Vo1wWx31Uqy9vIiJusOP4TbF7tPs9U0sJ9pX9OJPf4lXRGj5+6Gkl/HHKiAP5ug==} dependencies: babel-runtime: 6.26.0 babel-types: 6.26.0 dev: false /babel-plugin-transform-es2015-for-of/6.23.0: - resolution: {integrity: sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=} + resolution: {integrity: sha512-DLuRwoygCoXx+YfxHLkVx5/NpeSbVwfoTeBykpJK7JhYWlL/O8hgAK/reforUnZDlxasOrVPPJVI/guE3dCwkw==} dependencies: babel-runtime: 6.26.0 dev: false /babel-plugin-transform-es2015-function-name/6.24.1: - resolution: {integrity: sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=} + resolution: {integrity: sha512-iFp5KIcorf11iBqu/y/a7DK3MN5di3pNCzto61FqCNnUX4qeBwcV1SLqe10oXNnCaxBUImX3SckX2/o1nsrTcg==} dependencies: babel-helper-function-name: 6.24.1 babel-runtime: 6.26.0 @@ -12269,13 +12272,13 @@ packages: dev: false /babel-plugin-transform-es2015-literals/6.22.0: - resolution: {integrity: sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=} + resolution: {integrity: sha512-tjFl0cwMPpDYyoqYA9li1/7mGFit39XiNX5DKC/uCNjBctMxyL1/PT/l4rSlbvBG1pOKI88STRdUsWXB3/Q9hQ==} dependencies: babel-runtime: 6.26.0 dev: false /babel-plugin-transform-es2015-modules-amd/6.24.1: - resolution: {integrity: sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=} + resolution: {integrity: sha512-LnIIdGWIKdw7zwckqx+eGjcS8/cl8D74A3BpJbGjKTFFNJSMrjN4bIh22HY1AlkUbeLG6X6OZj56BDvWD+OeFA==} dependencies: babel-plugin-transform-es2015-modules-commonjs: 6.26.2 babel-runtime: 6.26.0 @@ -12296,7 +12299,7 @@ packages: dev: false /babel-plugin-transform-es2015-modules-systemjs/6.24.1: - resolution: {integrity: sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=} + resolution: {integrity: sha512-ONFIPsq8y4bls5PPsAWYXH/21Hqv64TBxdje0FvU3MhIV6QM2j5YS7KvAzg/nTIVLot2D2fmFQrFWCbgHlFEjg==} dependencies: babel-helper-hoist-variables: 6.24.1 babel-runtime: 6.26.0 @@ -12306,7 +12309,7 @@ packages: dev: false /babel-plugin-transform-es2015-modules-umd/6.24.1: - resolution: {integrity: sha1-rJl+YoXNGO1hdq22B9YCNErThGg=} + resolution: {integrity: sha512-LpVbiT9CLsuAIp3IG0tfbVo81QIhn6pE8xBJ7XSeCtFlMltuar5VuBV6y6Q45tpui9QWcy5i0vLQfCfrnF7Kiw==} dependencies: babel-plugin-transform-es2015-modules-amd: 6.24.1 babel-runtime: 6.26.0 @@ -12316,7 +12319,7 @@ packages: dev: false /babel-plugin-transform-es2015-object-super/6.24.1: - resolution: {integrity: sha1-JM72muIcuDp/hgPa0CH1cusnj40=} + resolution: {integrity: sha512-8G5hpZMecb53vpD3mjs64NhI1au24TAmokQ4B+TBFBjN9cVoGoOvotdrMMRmHvVZUEvqGUPWL514woru1ChZMA==} dependencies: babel-helper-replace-supers: 6.24.1 babel-runtime: 6.26.0 @@ -12325,7 +12328,7 @@ packages: dev: false /babel-plugin-transform-es2015-parameters/6.24.1: - resolution: {integrity: sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=} + resolution: {integrity: sha512-8HxlW+BB5HqniD+nLkQ4xSAVq3bR/pcYW9IigY+2y0dI+Y7INFeTbfAQr+63T3E4UDsZGjyb+l9txUnABWxlOQ==} dependencies: babel-helper-call-delegate: 6.24.1 babel-helper-get-function-arity: 6.24.1 @@ -12338,20 +12341,20 @@ packages: dev: false /babel-plugin-transform-es2015-shorthand-properties/6.24.1: - resolution: {integrity: sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=} + resolution: {integrity: sha512-mDdocSfUVm1/7Jw/FIRNw9vPrBQNePy6wZJlR8HAUBLybNp1w/6lr6zZ2pjMShee65t/ybR5pT8ulkLzD1xwiw==} dependencies: babel-runtime: 6.26.0 babel-types: 6.26.0 dev: false /babel-plugin-transform-es2015-spread/6.22.0: - resolution: {integrity: sha1-1taKmfia7cRTbIGlQujdnxdG+NE=} + resolution: {integrity: sha512-3Ghhi26r4l3d0Js933E5+IhHwk0A1yiutj9gwvzmFbVV0sPMYk2lekhOufHBswX7NCoSeF4Xrl3sCIuSIa+zOg==} dependencies: babel-runtime: 6.26.0 dev: false /babel-plugin-transform-es2015-sticky-regex/6.24.1: - resolution: {integrity: sha1-AMHNsaynERLN8M9hJsLta0V8zbw=} + resolution: {integrity: sha512-CYP359ADryTo3pCsH0oxRo/0yn6UsEZLqYohHmvLQdfS9xkf+MbCzE3/Kolw9OYIY4ZMilH25z/5CbQbwDD+lQ==} dependencies: babel-helper-regex: 6.26.0 babel-runtime: 6.26.0 @@ -12359,19 +12362,19 @@ packages: dev: false /babel-plugin-transform-es2015-template-literals/6.22.0: - resolution: {integrity: sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=} + resolution: {integrity: sha512-x8b9W0ngnKzDMHimVtTfn5ryimars1ByTqsfBDwAqLibmuuQY6pgBQi5z1ErIsUOWBdw1bW9FSz5RZUojM4apg==} dependencies: babel-runtime: 6.26.0 dev: false /babel-plugin-transform-es2015-typeof-symbol/6.23.0: - resolution: {integrity: sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=} + resolution: {integrity: sha512-fz6J2Sf4gYN6gWgRZaoFXmq93X+Li/8vf+fb0sGDVtdeWvxC9y5/bTD7bvfWMEq6zetGEHpWjtzRGSugt5kNqw==} dependencies: babel-runtime: 6.26.0 dev: false /babel-plugin-transform-es2015-unicode-regex/6.24.1: - resolution: {integrity: sha1-04sS9C6nMj9yk4fxinxa4frrNek=} + resolution: {integrity: sha512-v61Dbbihf5XxnYjtBN04B/JBvsScY37R1cZT5r9permN1cp+b70DY3Ib3fIkgn1DI9U3tGgBJZVD8p/mE/4JbQ==} dependencies: babel-helper-regex: 6.26.0 babel-runtime: 6.26.0 @@ -12379,7 +12382,7 @@ packages: dev: false /babel-plugin-transform-exponentiation-operator/6.24.1: - resolution: {integrity: sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=} + resolution: {integrity: sha512-LzXDmbMkklvNhprr20//RStKVcT8Cu+SQtX18eMHLhjHf2yFzwtQ0S2f0jQ+89rokoNdmwoSqYzAhq86FxlLSQ==} dependencies: babel-helper-builder-binary-assignment-operator-visitor: 6.24.1 babel-plugin-syntax-exponentiation-operator: 6.13.0 @@ -12389,13 +12392,13 @@ packages: dev: false /babel-plugin-transform-regenerator/6.26.0: - resolution: {integrity: sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=} + resolution: {integrity: sha512-LS+dBkUGlNR15/5WHKe/8Neawx663qttS6AGqoOUhICc9d1KciBvtrQSuc0PI+CxQ2Q/S1aKuJ+u64GtLdcEZg==} dependencies: regenerator-transform: 0.10.1 dev: false /babel-plugin-transform-strict-mode/6.24.1: - resolution: {integrity: sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=} + resolution: {integrity: sha512-j3KtSpjyLSJxNoCDrhwiJad8kw0gJ9REGj8/CqL0HeRyLnvUNYV9zcqluL6QJSXh3nfsLEmSLvwRfGzrgR96Pw==} dependencies: babel-runtime: 6.26.0 babel-types: 6.26.0 @@ -12476,7 +12479,7 @@ packages: dev: true /babel-register/6.26.0: - resolution: {integrity: sha1-btAhFz4vy0htestFxgCahW9kcHE=} + resolution: {integrity: sha512-veliHlHX06wjaeY8xNITbveXSiI+ASFnOqvne/LaIJIqOWi2Ogmj91KOugEz/hoh/fwMhXNBJPCv8Xaz5CyM4A==} dependencies: babel-core: 6.26.3 babel-runtime: 6.26.0 @@ -12490,14 +12493,14 @@ packages: dev: false /babel-runtime/6.26.0: - resolution: {integrity: sha1-llxwWGaOgrVde/4E/yM3vItWR/4=} + resolution: {integrity: sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==} dependencies: core-js: 2.6.12 regenerator-runtime: 0.11.1 dev: false /babel-template/6.26.0: - resolution: {integrity: sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=} + resolution: {integrity: sha512-PCOcLFW7/eazGUKIoqH97sO9A2UYMahsn/yRQ7uOk37iutwjq7ODtcTNF+iFDSHNfkctqsLRjLP7URnOx0T1fg==} dependencies: babel-runtime: 6.26.0 babel-traverse: 6.26.0 @@ -12509,7 +12512,7 @@ packages: dev: false /babel-traverse/6.26.0: - resolution: {integrity: sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=} + resolution: {integrity: sha512-iSxeXx7apsjCHe9c7n8VtRXGzI2Bk1rBSOJgCCjfyXb6v1aCqE1KSEpq/8SXuVN8Ka/Rh1WDTF0MDzkvTA4MIA==} dependencies: babel-code-frame: 6.26.0 babel-messages: 6.23.0 @@ -12525,7 +12528,7 @@ packages: dev: false /babel-types/6.26.0: - resolution: {integrity: sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=} + resolution: {integrity: sha512-zhe3V/26rCWsEZK8kZN+HaQj5yQ1CilTObixFzKW1UWjqG7618Twz6YEsCnjfg5gBcJh02DrpCkS9h98ZqDY+g==} dependencies: babel-runtime: 6.26.0 esutils: 2.0.3 @@ -12534,7 +12537,7 @@ packages: dev: false /babelify/7.3.0: - resolution: {integrity: sha1-qlau3nBn/XvVSWZu4W3ChQh+iOU=} + resolution: {integrity: sha512-vID8Fz6pPN5pJMdlUnNFSfrlcx5MUule4k9aKs/zbZPyXxMTcRrB0M4Tarw22L8afr8eYSWxDPYCob3TdrqtlA==} dependencies: babel-core: 6.26.3 object-assign: 4.1.1 @@ -12698,7 +12701,7 @@ packages: file-uri-to-path: 1.0.0 /bintrees/1.0.2: - resolution: {integrity: sha1-SfiW1uhYpKSZ34XDj7OZua/4QPg=} + resolution: {integrity: sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==} dev: false /bip32/2.0.6: @@ -13039,8 +13042,8 @@ packages: resolution: {integrity: sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ==} hasBin: true dependencies: - caniuse-lite: 1.0.30001341 - electron-to-chromium: 1.4.137 + caniuse-lite: 1.0.30001359 + electron-to-chromium: 1.4.168 dev: false /browserslist/4.20.3: @@ -13181,7 +13184,7 @@ packages: node-gyp-build: 4.3.0 /builtin-modules/1.1.1: - resolution: {integrity: sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=} + resolution: {integrity: sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ==} engines: {node: '>=0.10.0'} dev: false @@ -13380,7 +13383,6 @@ packages: /caniuse-lite/1.0.30001359: resolution: {integrity: sha512-Xln/BAsPzEuiVLgJ2/45IaqD9jShtk3Y33anKb4+yLwQzws3+v6odKfpgES/cDEaZMLzSChpIGdbOYtH9MyuHw==} - dev: true /canonicalize/1.0.8: resolution: {integrity: sha512-0CNTVCLZggSh7bc5VkX5WWPWO+cyZbNd07IHIsSXLia/eAq+r836hgk+8BKoEh7949Mda87VUOitx5OddVj64A==} @@ -13477,7 +13479,7 @@ packages: dev: false /checkpoint-store/1.1.0: - resolution: {integrity: sha1-BOTLUWuRQziTWB5tRgGnjpVS6gY=} + resolution: {integrity: sha512-J/NdY2WvIx654cc6LWSq/IYFFCUf75fFTgwzFnmbqyORH4MwgiQCgswLLKBGzmsyTI5V7i5bp/So6sMbDWhedg==} dependencies: functional-red-black-tree: 1.0.1 dev: false @@ -14215,7 +14217,7 @@ packages: /core-js/2.6.12: resolution: {integrity: sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==} - deprecated: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js. + deprecated: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js. dev: false /core-js/3.23.1: @@ -15201,7 +15203,7 @@ packages: isobject: 3.0.1 /defined/1.0.0: - resolution: {integrity: sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=} + resolution: {integrity: sha512-Y2caI5+ZwS5c3RiNDJ6u53VhQHv+hHKwhkI1iHvceKUHw9Df6EK2zRLfjejRgMuCuxK7PfSWIMwWecceVvThjQ==} dev: false /del/4.1.1: @@ -15272,7 +15274,7 @@ packages: dev: true /detect-indent/4.0.0: - resolution: {integrity: sha1-920GQ1LN9Docts5hnE7jqUdd4gg=} + resolution: {integrity: sha512-BDKtmHlOzwI7iRuEkhzsnPoi5ypEhWAJB5RvHWe1kMr06js3uK5B3734i3ui5Yd+wOJV1cpE4JnivPD283GU/A==} engines: {node: '>=0.10.0'} dependencies: repeating: 2.0.1 @@ -15424,7 +15426,7 @@ packages: dev: false /doctrine/0.7.2: - resolution: {integrity: sha1-fLhgNZujvpDgQLJrcpzkv6ZUxSM=} + resolution: {integrity: sha512-qiB/Rir6Un6Ad/TIgTRzsremsTGWzs8j7woXvp14jgq00676uBiBT5eUOi+FgRywZFVy5Us/c04ISRpZhRbS6w==} engines: {node: '>=0.10.0'} dependencies: esutils: 1.1.6 @@ -15625,7 +15627,6 @@ packages: /electron-to-chromium/1.4.168: resolution: {integrity: sha512-yz247hclRBaP8ABB1hf9kL7AMfa+yC2hB9F3XF8Y87VWMnYgq4QYvV6acRACcDkTDxfGQ4GYK/aZPQiuFMGbaA==} - dev: true /elliptic/6.5.4: resolution: {integrity: sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==} @@ -15653,7 +15654,7 @@ packages: optional: true /emailjs/2.2.0: - resolution: {integrity: sha1-ulsj5KSwpFEPZS6HOxVOlAe2ygM=} + resolution: {integrity: sha512-J9HNx13GA5DnJma10YxsSqYCErTyB0KoVflTddPTyKlEVHM0MckZXn/zDqovdacwWkHCxqC9AKVY8GMPaGvaGQ==} dependencies: addressparser: 0.3.2 emailjs-mime-codec: 2.0.9 @@ -15899,35 +15900,6 @@ packages: unbox-primitive: 1.0.1 dev: true - /es-abstract/1.20.0: - resolution: {integrity: sha512-URbD8tgRthKD3YcC39vbvSDrX23upXnPcnGAjQfgxXF5ID75YcENawc9ZX/9iTP9ptUyfCLIxTTuMYoRfiOVKA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.2 - es-to-primitive: 1.2.1 - function-bind: 1.1.1 - function.prototype.name: 1.1.5 - get-intrinsic: 1.1.1 - get-symbol-description: 1.0.0 - has: 1.0.3 - has-property-descriptors: 1.0.0 - has-symbols: 1.0.3 - internal-slot: 1.0.3 - is-callable: 1.2.4 - is-negative-zero: 2.0.2 - is-regex: 1.1.4 - is-shared-array-buffer: 1.0.2 - is-string: 1.0.7 - is-weakref: 1.0.2 - object-inspect: 1.12.0 - object-keys: 1.1.1 - object.assign: 4.1.2 - regexp.prototype.flags: 1.4.3 - string.prototype.trimend: 1.0.5 - string.prototype.trimstart: 1.0.5 - unbox-primitive: 1.0.2 - dev: false - /es-abstract/1.20.1: resolution: {integrity: sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==} engines: {node: '>= 0.4'} @@ -16401,7 +16373,7 @@ packages: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} /esutils/1.1.6: - resolution: {integrity: sha1-wBzKqa5LiXxtDD4hCuUvPHqEQ3U=} + resolution: {integrity: sha512-RG1ZkUT7iFJG9LSHr7KDuuMSlujfeTtMNIcInURxKAxhMtwQhI3NrQhz26gZQYlsYZQKzsnwtpKrFKj9K9Qu1A==} engines: {node: '>=0.10.0'} dev: false @@ -16466,7 +16438,7 @@ packages: dev: false /eth-query/2.1.2: - resolution: {integrity: sha1-1nQdkAAQa1FRDHLbktY2VFam2l4=} + resolution: {integrity: sha512-srES0ZcvwkR/wd5OQBRA1bIJMww1skfGS0s8wlwK3/oNP4+wnds60krvu5R1QbpRQjMmpG5OMIWro5s7gvDPsA==} dependencies: json-rpc-random-id: 1.0.1 xtend: 4.0.2 @@ -16479,7 +16451,7 @@ packages: dev: false /eth-sig-util/1.4.2: - resolution: {integrity: sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=} + resolution: {integrity: sha512-iNZ576iTOGcfllftB73cPB5AN+XUQAT/T8xzsILsghXC1o8gJUqe3RHlcDqagu+biFpYQ61KQrZZJza8eRSYqw==} deprecated: Deprecated in favor of '@metamask/eth-sig-util' dependencies: ethereumjs-abi: github.com/ethereumjs/ethereumjs-abi/ee3994657fa7a427238e6ba92a84d0b529bbcde0 @@ -16496,7 +16468,7 @@ packages: js-sha3: 0.8.0 /ethereum-common/0.0.18: - resolution: {integrity: sha1-L9w1dvIykDNYl26znaeDIT/5Uj8=} + resolution: {integrity: sha512-EoltVQTRNg2Uy4o84qpa2aXymXDJhxm7eos/ACOg0DG4baAbMjhbdAEsx9GeE8sC3XCxnYvrrzZDH8D8MtA2iQ==} dev: false /ethereum-common/0.2.0: @@ -17141,7 +17113,7 @@ packages: dev: false /fake-merkle-patricia-tree/1.0.1: - resolution: {integrity: sha1-S4w6z7Ugr635hgsfFM2M40As3dM=} + resolution: {integrity: sha512-Tgq37lkc9pUIgIKw5uitNUKcgcYL3R6JvXtKQbOf/ZSavXbidsksgp/pAY6p//uhw0I4yoMsvTSovvVIsk/qxA==} dependencies: checkpoint-store: 1.1.0 dev: false @@ -17294,7 +17266,7 @@ packages: dev: false /fetch-ponyfill/4.1.0: - resolution: {integrity: sha1-rjzl9zLGReq4fkroeTQUcJsjmJM=} + resolution: {integrity: sha512-knK9sGskIg2T7OnYLdZ2hZXn0CtDrAIBxYQLpmEf0BqfdWnwmM1weccUl5+4EdA44tzNSFAuxITPbXtPehUB3g==} dependencies: node-fetch: 1.7.3 dev: false @@ -17448,7 +17420,7 @@ packages: path-exists: 4.0.0 /find-versions/2.0.0: - resolution: {integrity: sha1-KtkNSQ9oKMGqQCks9wmsMxghDDw=} + resolution: {integrity: sha512-nzvoTkgyiTcXOT9PNHYWP2wlAoNbXanK/FnlHnB6v2yA1HoyDNTxN08+NobUIXL0qnBZPtegjXgohsQa8YiT+Q==} engines: {node: '>=0.10.0'} dependencies: array-uniq: 1.0.3 @@ -17757,7 +17729,7 @@ packages: dev: true /fs-extra/0.30.0: - resolution: {integrity: sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=} + resolution: {integrity: sha512-UvSPKyhMn6LEd/WpUaV9C9t3zATuqoqfWc3QdPhPLb58prN9tqYPlPWi8Krxi44loBoUzlobqZ3+8tGpxxSzwA==} dependencies: graceful-fs: 4.2.10 jsonfile: 2.4.0 @@ -17916,6 +17888,7 @@ packages: function-bind: 1.1.1 has: 1.0.3 has-symbols: 1.0.3 + dev: true /get-intrinsic/1.1.2: resolution: {integrity: sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==} @@ -18424,7 +18397,7 @@ packages: engines: {node: '>=6'} /has-ansi/2.0.0: - resolution: {integrity: sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=} + resolution: {integrity: sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==} engines: {node: '>=0.10.0'} dependencies: ansi-regex: 2.1.1 @@ -18647,7 +18620,7 @@ packages: dev: false /home-or-tmp/2.0.0: - resolution: {integrity: sha1-42w/LSyufXRqhX440Y1fMqeILbg=} + resolution: {integrity: sha512-ycURW7oUxE2sNiPVw1HVEFsW+ecOpJ5zaj7eC0RlwhibhRBod20muUN8qu/gzx956YrLolVvs1MTXwKgC2rVEg==} engines: {node: '>=0.10.0'} dependencies: os-homedir: 1.0.2 @@ -19477,7 +19450,7 @@ packages: engines: {node: '>=0.10.0'} /is-fn/1.0.0: - resolution: {integrity: sha1-lUPV3nvPWwiiLsiiC65uKG1RDYw=} + resolution: {integrity: sha512-XoFPJQmsAShb3jEQRfzf2rqXavq7fIqF/jOekp308JlThqrODnMpweVSGilKTCXELfLhltGP2AGgbQGVP8F1dg==} engines: {node: '>=0.10.0'} dev: false @@ -20554,7 +20527,7 @@ packages: dev: false /js-sha3/0.6.1: - resolution: {integrity: sha1-W4n3enR3Z5h39YxKB1JAk0sflcA=} + resolution: {integrity: sha512-2OHj7sAZ9gnJS4lQsgIsTslmqVrNQdDC99bvwYGQKU1w6k/gwsTLeGBfWt8yHCuTOGqk7DXzuVlK8J+dDXnG7A==} dev: false /js-sha3/0.7.0: @@ -20653,7 +20626,7 @@ packages: dev: false /json-rpc-error/2.0.0: - resolution: {integrity: sha1-p6+cICg4tekFxyUOVH8a/3cligI=} + resolution: {integrity: sha512-EwUeWP+KgAZ/xqFpaP6YDAXMtCJi+o/QQpCQFIYyxr01AdADi2y413eM8hSqJcoQym9WMePAJWoaODEJufC4Ug==} dependencies: inherits: 2.0.4 dev: false @@ -20730,7 +20703,7 @@ packages: hasBin: true /jsonfile/2.4.0: - resolution: {integrity: sha1-NzaitCi4e72gzIO1P6PWM6NcKug=} + resolution: {integrity: sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw==} optionalDependencies: graceful-fs: 4.2.10 dev: false @@ -20850,7 +20823,7 @@ packages: engines: {node: '>=0.10.0'} /klaw/1.3.1: - resolution: {integrity: sha1-QIhDO0azsbolnXh4XY6W9zugJDk=} + resolution: {integrity: sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw==} optionalDependencies: graceful-fs: 4.2.10 dev: false @@ -20948,7 +20921,7 @@ packages: dev: false /level-iterator-stream/1.3.1: - resolution: {integrity: sha1-5Dt4sagUPm+pek9IXrjqUwNS8u0=} + resolution: {integrity: sha512-1qua0RHNtr4nrZBgYlpV0qHHeHpcRRWTxEZJ8xsemoHAXNL5tbooh4tPEEqIqsbWCAJBmUmkwYK/sW5OrFjWWw==} dependencies: inherits: 2.0.4 level-errors: 1.0.5 @@ -21158,7 +21131,7 @@ packages: dev: false /lodash.assign/4.2.0: - resolution: {integrity: sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=} + resolution: {integrity: sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==} dev: false /lodash.clonedeep/4.5.0: @@ -21195,7 +21168,7 @@ packages: dev: true /lodash.values/4.3.0: - resolution: {integrity: sha1-o6bCsOvsxcLLocF+bmIP6BtT00c=} + resolution: {integrity: sha512-r0RwvdCv8id9TUblb/O7rYPwVy6lerCbcawrfdo9iC/1t1wsNMJknO79WNBgwkH0hIeJ08jmvvESbFpNb4jH0Q==} dev: false /lodash/4.17.21: @@ -21304,7 +21277,7 @@ packages: dev: false /ltgt/2.2.1: - resolution: {integrity: sha1-81ypHEk/e3PaDgdJUwTxezH4fuU=} + resolution: {integrity: sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA==} dev: false /magic-string/0.25.9: @@ -21462,7 +21435,7 @@ packages: dev: true /memdown/1.4.1: - resolution: {integrity: sha1-tOThkhdGZP+65BNhqlAPMRnv4hU=} + resolution: {integrity: sha512-iVrGHZB8i4OQfM155xx8akvG9FIj+ht14DX5CQkCTG4EHzZ3d3sgckIf/Lm9ivZalEsFuEVnWv2B2WZvbrro2w==} dependencies: abstract-leveldown: 2.7.2 functional-red-black-tree: 1.0.1 @@ -21507,7 +21480,7 @@ packages: dev: true /memorystream/0.3.1: - resolution: {integrity: sha1-htcJCzDORV1j+64S3aUaR93K+bI=} + resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==} engines: {node: '>= 0.10.0'} dev: false @@ -22516,6 +22489,7 @@ packages: /object-inspect/1.12.0: resolution: {integrity: sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==} + dev: true /object-inspect/1.12.2: resolution: {integrity: sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==} @@ -23538,7 +23512,7 @@ packages: dev: true /promise-to-callback/1.0.0: - resolution: {integrity: sha1-XSp0kBC/tn2WNZj805YHRqaP7vc=} + resolution: {integrity: sha512-uhMIZmKM5ZteDMfLgJnoSq9GCwsNKrYau73Awf1jIy6/eUcuuZ3P+CD9zUv0kJsIUbU+x6uLNIhXhLHDs1pNPA==} engines: {node: '>=0.10.0'} dependencies: is-fn: 1.0.0 @@ -24575,7 +24549,7 @@ packages: dev: true /regexpu-core/2.0.0: - resolution: {integrity: sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=} + resolution: {integrity: sha512-tJ9+S4oKjxY8IZ9jmjnp/mtytu1u3iyIQAfmI51IKWH6bFf7XR1ybtaO6j7INhZKXOTYADk7V5qxaqLkmNxiZQ==} dependencies: regenerate: 1.4.2 regjsgen: 0.2.0 @@ -24595,7 +24569,7 @@ packages: dev: true /regjsgen/0.2.0: - resolution: {integrity: sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=} + resolution: {integrity: sha512-x+Y3yA24uF68m5GA+tBjbGYo64xXVJpbToBaWCoSNSc1hdk6dfctaRWrNFTVJZIIhL5GxW8zwjoixbnifnK59g==} dev: false /regjsgen/0.6.0: @@ -24603,7 +24577,7 @@ packages: dev: true /regjsparser/0.1.5: - resolution: {integrity: sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=} + resolution: {integrity: sha512-jlQ9gYLfk2p3V5Ag5fYhA7fv7OHzd1KUH0PRP46xc3TgwjwgROIW572AfYg/X9kaNq/LJnu6oJcFRXlIrGoTRw==} hasBin: true dependencies: jsesc: 0.5.0 @@ -24793,7 +24767,7 @@ packages: engines: {node: '>=0.10.0'} /require-from-string/1.2.1: - resolution: {integrity: sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg=} + resolution: {integrity: sha512-H7AkJWMobeskkttHyhTVtS0fxpFLjxhbfMa6Bk3wimP7sdPRGL3EyCg3sAQenFfAe+xQ+oAc85Nmtvq0ROM83Q==} engines: {node: '>=0.10.0'} dev: false @@ -24911,7 +24885,7 @@ packages: dev: true /resumer/0.0.0: - resolution: {integrity: sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k=} + resolution: {integrity: sha512-Fn9X8rX8yYF4m81rZCK/5VmrmsSbqS/i3rDLl6ZZHAXgC2nTAx3dhwG8q8odP/RmdLa2YrybDJaAMg+X1ajY3w==} dependencies: through: 2.3.8 dev: false @@ -25281,7 +25255,7 @@ packages: dev: true /semver-regex/1.0.0: - resolution: {integrity: sha1-kqSWkGX5xwxpR1PVUkj8aPj2Usk=} + resolution: {integrity: sha512-1vZcoRC+LPtHFkLUPyrabsATDSHerxW+hJBN8h04HZOZBuewbXaNROtUVdEPrTdZsWNq6sfsXDhd48GB2xTG4g==} engines: {node: '>=0.10.0'} dev: false @@ -25477,7 +25451,7 @@ packages: dev: false /set-immediate-shim/1.0.1: - resolution: {integrity: sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=} + resolution: {integrity: sha512-Li5AOqrZWCVA2n5kryzEmqai6bKSIvpz5oUJHPVj6+dsbD3X1ixtsY5tEnsaNpH3pFAHmG8eIHUrtEtohrg+UQ==} engines: {node: '>=0.10.0'} dev: false @@ -25585,7 +25559,7 @@ packages: dev: true /slash/1.0.0: - resolution: {integrity: sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=} + resolution: {integrity: sha512-3TYDR7xWt4dIqV2JauJr+EJeW356RXijHeUlO+8djJ+uBXPn8/2dpzBc8yQhh583sVvc9CvFAeQVgijsH+PNNg==} engines: {node: '>=0.10.0'} dev: false @@ -26240,7 +26214,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.4 - es-abstract: 1.20.0 + es-abstract: 1.20.1 dev: false /string.prototype.trimend/1.0.4: @@ -26566,7 +26540,7 @@ packages: inherits: 2.0.4 is-regex: 1.1.4 minimist: 1.2.6 - object-inspect: 1.12.0 + object-inspect: 1.12.2 resolve: 1.22.0 resumer: 0.0.0 string.prototype.trim: 1.2.6 @@ -26923,7 +26897,7 @@ packages: engines: {node: '>=4'} /to-no-case/1.0.2: - resolution: {integrity: sha1-xyKQcWTvaxeBMsjmmTAhLRtKoWo=} + resolution: {integrity: sha512-Z3g735FxuZY8rodxV4gH7LxClE4H0hTIyHNIHdk+vpQxjLm0cwnKXq/OFVZ76SOQmto7txVcwSCwkU5kqp+FKg==} dev: false /to-object-path/0.3.0: @@ -26960,13 +26934,13 @@ packages: safe-regex: 1.1.0 /to-snake-case/1.0.0: - resolution: {integrity: sha1-znRpE4l5RgGah+Yu366upMYIq4w=} + resolution: {integrity: sha512-joRpzBAk1Bhi2eGEYBjukEWHOe/IvclOkiJl3DtA91jV6NwQ3MwXA4FHYeqk8BNp/D8bmi9tcNbRu/SozP0jbQ==} dependencies: to-space-case: 1.0.0 dev: false /to-space-case/1.0.0: - resolution: {integrity: sha1-sFLar7Gysp3HcM6gFj5ewOvJ/Bc=} + resolution: {integrity: sha512-rLdvwXZ39VOn1IxGL3V6ZstoTbwLRckQmn/U8ZDLuWwIXNpuZDhQ3AiRUlhTbOXFVE9C+dR51wM0CBDhk31VcA==} dependencies: to-no-case: 1.0.2 dev: false @@ -27019,7 +26993,7 @@ packages: engines: {node: '>=8'} /trim-right/1.0.1: - resolution: {integrity: sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=} + resolution: {integrity: sha512-WZGXGstmCWgeevgTL54hrCuw1dyMQIzWy7ZfqRJfSmJZBwklI15egmQytFP6bPidmw3M8d5yEowl1niq4vmqZw==} engines: {node: '>=0.10.0'} dev: false @@ -27306,7 +27280,7 @@ packages: resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} /tslint-eslint-rules/4.1.1_ew7ikuw7vzbxz2yx5mufkmltai: - resolution: {integrity: sha1-fDDniC8mvCdr/5HSOEl1xp2viLo=} + resolution: {integrity: sha512-QS9o6vNZ2XwWxW+DE5uXde1dhQ2ebNuvebjfF/P4b9uACPdzxQCkaHjNU5GO+0UqPuOmZNR7mwsBaSlWQfCgVg==} peerDependencies: tslint: ^5.0.0 dependencies: @@ -27362,9 +27336,9 @@ packages: dev: false /tsutils/1.9.1_typescript@2.9.2: - resolution: {integrity: sha1-ufmrROVa+WgYMdXyjQrur1x1DLA=} + resolution: {integrity: sha512-Z4MMpdLvxER0Wz+l9TM71URBKGoHKBzArEraOFmTp44jxzdqiG8oTCtpjiZ9YtFXNwWQfMv+g8VAxTlBEVS6yw==} peerDependencies: - typescript: '>=2.0.0 || >=2.0.0-dev || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >= 2.4.0-dev || 4' + typescript: '>=2.0.0 || >=2.0.0-dev || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >= 2.4.0-dev' peerDependenciesMeta: typescript: optional: true @@ -27375,7 +27349,7 @@ packages: /tsutils/2.29.0_typescript@2.9.2: resolution: {integrity: sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==} peerDependencies: - typescript: '>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev || 4' + typescript: '>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev' peerDependenciesMeta: typescript: optional: true @@ -27510,7 +27484,7 @@ packages: dev: false /typed-promisify/0.4.0: - resolution: {integrity: sha1-reHT0yEwdnuk71OFFixyBpgQXQ8=} + resolution: {integrity: sha512-Nhj1AwKD59L/vW+gqobaeyrxERI9p1FWCjGif1cPvZwYXOXkbyQehe7Rt92++a/WMw6BebxdplhZYaLkUH8NQQ==} dev: false /typedarray-to-buffer/3.1.5: @@ -27635,7 +27609,7 @@ packages: optional: true /uglify-to-browserify/1.0.2: - resolution: {integrity: sha1-bgkk1r2mta/jSeOabWMoUKD4grc=} + resolution: {integrity: sha512-vb2s1lYx2xBtUgy+ta+b2J/GLVUR+wmpINwHePmPRhOsIVCG2wDzKJ0n14GslH1BifsqVzSOwQhRaCAsZ/nI4Q==} dev: false optional: true @@ -28063,7 +28037,7 @@ packages: dev: true /uuid/3.0.1: - resolution: {integrity: sha1-ZUS7ot/ajBzxfmKaOjBeK7H+5sE=} + resolution: {integrity: sha512-tyhM7iisckwwmyHVFcjTzISz/R1ss/bRudNgHFYsgeu7j4JbhRvjE+Hbcpr9y5xh+b+HxeFjuToDT4i9kQNrtA==} deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. hasBin: true dev: false @@ -28107,7 +28081,7 @@ packages: dev: true /valid-url/1.0.9: - resolution: {integrity: sha1-HBRHm0DxOXp1eC8RXkCGRHQzogA=} + resolution: {integrity: sha512-QQDsV8OnSf5Uc30CKSwG9lnhMPe6exHtTXLRYX8uMwKENy640pU+2BgBL0LRbDh/eYRahNCS7aewCx0wf3NYVA==} dev: false /validate-npm-package-license/3.0.4: @@ -29218,7 +29192,7 @@ packages: dev: false /window-size/0.2.0: - resolution: {integrity: sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU=} + resolution: {integrity: sha512-UD7d8HFA2+PZsbKyaOCEy8gMh1oDtHgJh1LfgjQ4zVXmYjAT/kvz3PueITKuqDiIXQe7yzpPnxX3lNc+AhQMyw==} engines: {node: '>= 0.10.0'} hasBin: true dev: false @@ -29555,7 +29529,7 @@ packages: dev: false /yargs-parser/2.4.1: - resolution: {integrity: sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=} + resolution: {integrity: sha512-9pIKIJhnI5tonzG6OnCFlz/yln8xHYcGl+pn3xR0Vzff0vzN1PbNRaelgfgRUwZ3s4i3jvxT9WhmUGL4whnasA==} dependencies: camelcase: 3.0.0 lodash.assign: 4.2.0 @@ -29685,7 +29659,7 @@ packages: dev: false /yargs/4.8.1: - resolution: {integrity: sha1-wMQpJMpKqmsObaFznfshZDn53cA=} + resolution: {integrity: sha512-LqodLrnIDM3IFT+Hf/5sxBnEGECrfdC1uIbgZeJmESCSo4HoCAaKEus8MylXHAkdacGc0ye+Qa+dpkuom8uVYA==} dependencies: cliui: 3.2.0 decamelize: 1.2.0 @@ -29750,7 +29724,7 @@ packages: dev: false /yn/2.0.0: - resolution: {integrity: sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=} + resolution: {integrity: sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==} engines: {node: '>=4'} dev: false @@ -29815,7 +29789,7 @@ packages: '@0xproject/utils': 0.1.3 '@0xproject/web3-wrapper': 0.1.14 '@types/lodash': 4.14.182 - '@types/node': 17.0.34 + '@types/node': 17.0.45 0x.js: 0.29.2 awesome-typescript-loader: 3.5.0_typescript@2.9.2 bn.js: 4.12.0 From 2ca96669e59c8106f58f33dfe02e819104afce89 Mon Sep 17 00:00:00 2001 From: lelenei <72531217+lelenei@users.noreply.github.com> Date: Mon, 11 Jul 2022 21:39:54 +0800 Subject: [PATCH 065/128] fix: css style for retry button atnsnapshot (#6747) * fix: css style at snapshot * fix: margin size --- .../Snapshot/SNSAdaptor/LoadingFailCard.tsx | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/packages/mask/src/plugins/Snapshot/SNSAdaptor/LoadingFailCard.tsx b/packages/mask/src/plugins/Snapshot/SNSAdaptor/LoadingFailCard.tsx index 26b3473ea946..840ea0002b8c 100644 --- a/packages/mask/src/plugins/Snapshot/SNSAdaptor/LoadingFailCard.tsx +++ b/packages/mask/src/plugins/Snapshot/SNSAdaptor/LoadingFailCard.tsx @@ -36,15 +36,28 @@ export class LoadingFailCard extends Component< ) : ( - Loading fails due to Snapshot API service breakdown. - + + + Loading fails due to Snapshot API service breakdown. + + + ) } From d9552441297225bcf0e20c08a3a2c1ed2c2c4232 Mon Sep 17 00:00:00 2001 From: guanbinrui Date: Mon, 11 Jul 2022 21:56:14 +0800 Subject: [PATCH 066/128] fix: typo --- packages/shared/src/hooks/useImageBase64.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/shared/src/hooks/useImageBase64.ts b/packages/shared/src/hooks/useImageBase64.ts index 81867e1726a9..0a6935afc1b5 100644 --- a/packages/shared/src/hooks/useImageBase64.ts +++ b/packages/shared/src/hooks/useImageBase64.ts @@ -29,7 +29,7 @@ export function useAccessibleUrl( }, ) { const fetch = options?.fetch ?? globalThis.fetch - const [avaliableUrl, setAvaliableUrl] = useState(() => { + const [availableUrl, setAvailableUrl] = useState(() => { const hit = cache.get(key) return typeof hit === 'string' ? hit : '' }) @@ -38,10 +38,10 @@ export function useAccessibleUrl( if (!key) return const hit = cache.get(key) if (typeof hit === 'string') { - setAvaliableUrl(hit) + setAvailableUrl(hit) return } else if (hit instanceof Promise) { - setAvaliableUrl(await responseToBase64((await hit).clone())) + setAvailableUrl(await responseToBase64((await hit).clone())) return } @@ -57,8 +57,8 @@ export function useAccessibleUrl( const blob = await response.blob() const dataURL = await readAsDataURL(blob) cache.set(key, dataURL) - setAvaliableUrl(dataURL) + setAvailableUrl(dataURL) }, [key, url]) - return avaliableUrl + return availableUrl } From 5f2d90e5ca8465bc26bb165e54209c974143cce0 Mon Sep 17 00:00:00 2001 From: Randolph314 <97870249+Randolph314@users.noreply.github.com> Date: Tue, 12 Jul 2022 10:09:17 +0800 Subject: [PATCH 067/128] fix: copy audit (#6763) * fix: mf 1441 * feat: change linkIcon UI Co-authored-by: Randolph <840094513@qq.com> --- packages/dashboard/src/locales/en-US.json | 6 +++--- packages/mask/shared-ui/locales/en-US.json | 2 +- packages/mask/src/plugins/Avatar/locales/en-US.json | 2 +- .../src/SNSAdaptor/components/SecurityPanel.tsx | 4 +++- .../src/SNSAdaptor/components/TokenPanel.tsx | 8 ++++++-- .../UI/components/TokenSecurity/components/TokenPanel.tsx | 4 ++-- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/dashboard/src/locales/en-US.json b/packages/dashboard/src/locales/en-US.json index 057814034962..a9a0a674284b 100644 --- a/packages/dashboard/src/locales/en-US.json +++ b/packages/dashboard/src/locales/en-US.json @@ -33,7 +33,7 @@ "about_dialog_touch": "Get in touch", "about_dialog_description": "Mask Network is the portal to the new, open internet. Mask allows you to send encrypted posts on social networks. We provide more functions such as sending encrypted lucky drops, purchasing cryptocurrencies, file service, etc.", "setup_page_title": "Welcome to Mask Network", - "setup_page_description": "Encrypt your posts & chats on social networks, allow only your friends to decrypt.", + "setup_page_description": "Encrypt your posts on social medias, only your friends can decrypt it.", "setup_page_create_account_title": "Create an Identity", "setup_page_create_account_subtitle": "Create your digital identity system, explore Web 3.0", "setup_page_create_account_button": "Create", @@ -52,7 +52,7 @@ "create_account_connect_social_media_button": "Create", "create_account_connect_social_media": "Connect to {{type}}", "create_account_persona_title": "Welcome to Mask Network", - "create_account_persona_subtitle": "You can create personas and connect social accounts", + "create_account_persona_subtitle": "Connect to social media accounts with your personas.", "create_account_persona_successfully": "Persona created successfully.", "create_account_connect_social_media_title": "Connect Social Media", "create_account_failed": "Create Account Failed", @@ -197,7 +197,7 @@ "wallets_empty_history_tips": "No transaction history", "wallets_loading_token": "Loading Token", "personas_setup_connect_tips": "Please connect to your {{type}} account.", - "personas_setup_tip": "Please to create/restore persona.", + "personas_setup_tip": "Please create/restore persona.", "personas_setup_connect": "Connect", "personas_name_maximum_tips": "Maximum length is {{length}} characters long.", "personas_name_existed": "The persona name already exists", diff --git a/packages/mask/shared-ui/locales/en-US.json b/packages/mask/shared-ui/locales/en-US.json index 7fd4b4a393a2..3c8652e6d9a5 100644 --- a/packages/mask/shared-ui/locales/en-US.json +++ b/packages/mask/shared-ui/locales/en-US.json @@ -369,7 +369,7 @@ "plugin_wallet_cancel_sign": "Signature canceled.", "plugin_web3_profile_recommend_feature_description": "Choose and showcase your Web3 footprints on Twitter.", "plugin_nft_avatar_recommend_feature_description": "Set your NFT as profile picture with exclusive aura.", - "application_hint": "Socialize and show off your NFTs. People can bid,buy, view your valuable NFTs without leaving Twitter.", + "application_hint": "Socialize and show off your NFTs. People can bid, buy and view your valuable NFTs without leaving Twitter.", "plugin_goPlusSecurity_description": "Provide you with fast, reliable and convenient security services", "plugin_red_packet_create": "Create a Lucky Drop", "plugin_red_packet_claimed": "Claimed", diff --git a/packages/mask/src/plugins/Avatar/locales/en-US.json b/packages/mask/src/plugins/Avatar/locales/en-US.json index 52e185d34e2a..ea1a90515d65 100644 --- a/packages/mask/src/plugins/Avatar/locales/en-US.json +++ b/packages/mask/src/plugins/Avatar/locales/en-US.json @@ -22,7 +22,7 @@ "collectible_no_collectible": "No any collectible is available to preview.", "no_collectible_found": "No collectible found.", "retry": "Retry", - "application_hint": "Socialize and show off your NFTs. People can bid,buy, view your valuable NFTs without leaving Twitter.", + "application_hint": "Socialize and show off your NFTs. People can bid, buy and view your valuable NFTs without leaving Twitter.", "provider_by": "Provided by", "downloading_image": "Downloading image...", "saving": "Saving...", diff --git a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx index 9b8f59753155..12a067f6c7d9 100644 --- a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx +++ b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx @@ -169,7 +169,9 @@ export const SecurityPanel = memo(({ tokenSecurity, tokenInfo, t href={resolveGoLabLink(tokenSecurity.chainId, tokenSecurity.contract)} target="_blank" rel="noopener noreferrer"> - + diff --git a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/TokenPanel.tsx b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/TokenPanel.tsx index 8d5dcaf51b40..b7c57869d857 100644 --- a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/TokenPanel.tsx +++ b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/TokenPanel.tsx @@ -89,7 +89,9 @@ export const TokenPanel = React.forwardRef(({ tokenSecurity, tokenMarketCap }: T href={explorerResolver.fungibleTokenLink(tokenSecurity.chainId, tokenSecurity.contract)} target="_blank" rel="noopener noreferrer"> - {' '} + @@ -110,7 +112,9 @@ export const TokenPanel = React.forwardRef(({ tokenSecurity, tokenMarketCap }: T )} target="_blank" rel="noopener noreferrer"> - + )} diff --git a/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx b/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx index 4e2cd24f5598..b9aef2cc6deb 100644 --- a/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx +++ b/packages/shared/src/UI/components/TokenSecurity/components/TokenPanel.tsx @@ -33,8 +33,8 @@ const useStyles = makeStyles()((theme) => ({ }, linkIcon: { fill: theme.palette.maskColor.main, - width: 16, - height: 16, + width: 18, + height: 18, }, })) From 3f3c30dd54adaf8ecb121522f2fc12b2d81deb0d Mon Sep 17 00:00:00 2001 From: guanbinrui <52657989+guanbinrui@users.noreply.github.com> Date: Tue, 12 Jul 2022 10:09:36 +0800 Subject: [PATCH 068/128] fix: switch chain with fortmatic (#6762) --- packages/mask/src/web3/UI/ChainBoundary.tsx | 13 ++++---- .../SNSAdaptor/components/ConsoleContent.tsx | 4 +-- .../state/Connection/providers/Fortmatic.ts | 30 +++++++++++++++++-- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/packages/mask/src/web3/UI/ChainBoundary.tsx b/packages/mask/src/web3/UI/ChainBoundary.tsx index 2b6ca3010826..9d1db522a87a 100644 --- a/packages/mask/src/web3/UI/ChainBoundary.tsx +++ b/packages/mask/src/web3/UI/ChainBoundary.tsx @@ -12,6 +12,7 @@ import { useWeb3State, useWeb3Connection, useChainIdValid, + useProviderDescriptor, } from '@masknet/plugin-infra/web3' import { ChainId, ProviderType } from '@masknet/web3-shared-evm' import { useRemoteControlledDialog } from '@masknet/shared-base-ui' @@ -83,6 +84,7 @@ export function ChainBoundary(props: ChainBoundaryPro const { Others: actualOthers } = useWeb3State(actualPluginID) const actualChainId = useChainId(actualPluginID) const actualProviderType = useProviderType(actualPluginID) + const actualProviderDescriptor = useProviderDescriptor(actualPluginID) const actualChainName = actualOthers?.chainResolver.chainName(actualChainId) const account = useAccount(actualPluginID) @@ -135,10 +137,9 @@ export function ChainBoundary(props: ChainBoundaryPro openSelectProviderDialog, ]) - const fortmaticDisabled = useMemo(() => { - if (actualProviderType !== ProviderType.Fortmatic) return false - return !(expectedChainId === ChainId.Mainnet || expectedChainId === ChainId.BSC) - }, [actualProviderType, expectedChainId]) + const switchButtonDisabled = useMemo(() => { + return !(actualProviderDescriptor.enableRequirements?.supportedChainIds?.includes(expectedChainId) ?? false) + }, [expectedChainId, actualProviderDescriptor]) const renderBox = (children?: React.ReactNode, tips?: string) => { return ( @@ -251,7 +252,7 @@ export function ChainBoundary(props: ChainBoundaryPro size={18} /> } - disabled={actualProviderType === ProviderType.WalletConnect || fortmaticDisabled} + disabled={actualProviderType === ProviderType.WalletConnect || switchButtonDisabled} sx={props.ActionButtonPromiseProps?.sx} init={{t('plugin_wallet_switch_network', { network: expectedChainName })}} waiting={t('plugin_wallet_switch_network_under_going', { @@ -268,7 +269,7 @@ export function ChainBoundary(props: ChainBoundaryPro , actualProviderType === ProviderType.WalletConnect ? t('plugin_wallet_connect_tips') - : fortmaticDisabled + : switchButtonDisabled ? t('plugin_wallet_not_support_network') : '', ) diff --git a/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx b/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx index fe36f6c370e7..c9e158ea9ec3 100644 --- a/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx +++ b/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx @@ -268,9 +268,7 @@ export function ConsoleContent(props: ConsoleContentProps) { switch (pluginID) { case NetworkPluginID.PLUGIN_EVM: await onSwitchChain( - chainId === EVM_ChainId.Mainnet - ? EVM_ChainId.Matic - : EVM_ChainId.Mainnet, + chainId === EVM_ChainId.Mainnet ? EVM_ChainId.BSC : EVM_ChainId.Mainnet, ) break default: diff --git a/packages/plugins/EVM/src/state/Connection/providers/Fortmatic.ts b/packages/plugins/EVM/src/state/Connection/providers/Fortmatic.ts index 5db1b1dc093e..868d5ba3d1c0 100644 --- a/packages/plugins/EVM/src/state/Connection/providers/Fortmatic.ts +++ b/packages/plugins/EVM/src/state/Connection/providers/Fortmatic.ts @@ -1,8 +1,9 @@ import Fortmatic from 'fortmatic' +import { toHex } from 'web3-utils' import type { RequestArguments } from 'web3-core' import { first } from 'lodash-unified' import type { FmProvider } from 'fortmatic/dist/cjs/src/core/fm-provider' -import { ChainId, chainResolver, getRPCConstants } from '@masknet/web3-shared-evm' +import { ChainId, chainResolver, getRPCConstants, ProviderType } from '@masknet/web3-shared-evm' import { createLookupTableResolver } from '@masknet/web3-shared-base' import type { EVM_Provider } from '../types' import { BaseProvider } from './Base' @@ -50,16 +51,28 @@ export default class FortmaticProvider extends BaseProvider implements EVM_Provi private get chainId(): ChainIdFortmatic { const chainId = this.chainId_ if (!chainId) throw new Error('No connection.') - if (!isFortmaticSupported(chainId)) throw new Error(`Chain id ${chainId} is not supported.`) + if (!isFortmaticSupported(chainId)) throw new Error(`The chain id ${chainId} is not supported.`) return chainId } private set chainId(newChainId: ChainId) { const chainId = newChainId - if (!isFortmaticSupported(chainId)) throw new Error(`Chain id ${chainId} is not supported.`) + if (!isFortmaticSupported(chainId)) throw new Error(`The chain id ${chainId} is not supported.`) this.chainId_ = chainId } + protected onAccountsChanged(accounts: string[]) { + this.emitter.emit('accounts', accounts) + } + + protected onChainChanged(chainId: string) { + this.emitter.emit('chainId', chainId) + } + + protected onDisconnect() { + this.emitter.emit('disconnect', ProviderType.Fortmatic) + } + private createFortmatic(chainId: ChainIdFortmatic) { const rpcUrl = first(getRPCConstants(chainId).RPC_URLS) if (!rpcUrl) throw new Error('Failed to create provider.') @@ -85,11 +98,21 @@ export default class FortmaticProvider extends BaseProvider implements EVM_Provi return fm.user.logout() } + override async switchChain(chainId?: ChainId): Promise { + if (chainId) { + await this.connect(chainId) + return + } + throw new Error(`Failed to switch to ${chainResolver.chainFullName(chainId)}.`) + } + override async connect(chainId: ChainId) { try { this.chainId = chainId const accounts = await this.login() if (!accounts.length) throw new Error(`Failed to connect to ${chainResolver.chainFullName(this.chainId)}.`) + this.onAccountsChanged(accounts) + this.onChainChanged(toHex(chainId)) return { account: first(accounts)!, chainId, @@ -103,6 +126,7 @@ export default class FortmaticProvider extends BaseProvider implements EVM_Provi override async disconnect() { await this.logout() this.chainId_ = null + this.onDisconnect() } override request(requestArguments: RequestArguments) { From 000ca1b283fa54d2ef2d0de2ce277afc127c18e3 Mon Sep 17 00:00:00 2001 From: Randolph <840094513@qq.com> Date: Tue, 12 Jul 2022 13:43:18 +0800 Subject: [PATCH 069/128] fix: typo --- packages/dashboard/src/locales/en-US.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dashboard/src/locales/en-US.json b/packages/dashboard/src/locales/en-US.json index a9a0a674284b..75a8d98817a0 100644 --- a/packages/dashboard/src/locales/en-US.json +++ b/packages/dashboard/src/locales/en-US.json @@ -33,7 +33,7 @@ "about_dialog_touch": "Get in touch", "about_dialog_description": "Mask Network is the portal to the new, open internet. Mask allows you to send encrypted posts on social networks. We provide more functions such as sending encrypted lucky drops, purchasing cryptocurrencies, file service, etc.", "setup_page_title": "Welcome to Mask Network", - "setup_page_description": "Encrypt your posts on social medias, only your friends can decrypt it.", + "setup_page_description": "Encrypt your posts on social media, only your friends can decrypt it.", "setup_page_create_account_title": "Create an Identity", "setup_page_create_account_subtitle": "Create your digital identity system, explore Web 3.0", "setup_page_create_account_button": "Create", From 8d1ca3b290c2a807fc7b41d3352803c4e4f8b1e2 Mon Sep 17 00:00:00 2001 From: BillyS Date: Tue, 12 Jul 2022 13:47:40 +0800 Subject: [PATCH 070/128] fix: some fix issues (#6764) * fix: some fix issues * fix: account when not evm --- .../CyberConnect/src/SNSAdaptor/ConnectButton.tsx | 10 ++++++++-- .../plugins/CyberConnect/src/SNSAdaptor/FollowTab.tsx | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/plugins/CyberConnect/src/SNSAdaptor/ConnectButton.tsx b/packages/plugins/CyberConnect/src/SNSAdaptor/ConnectButton.tsx index 545e4a667a55..1cc4b27e21e7 100644 --- a/packages/plugins/CyberConnect/src/SNSAdaptor/ConnectButton.tsx +++ b/packages/plugins/CyberConnect/src/SNSAdaptor/ConnectButton.tsx @@ -92,7 +92,7 @@ export default function ConnectButton({ }) { const { classes, cx } = useStyles() const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM) - const myAddress = useAccount(NetworkPluginID.PLUGIN_EVM) + const myAddress = useAccount() const [cc, setCC] = useState(null) const [isFollowing, setFollowing] = useState(false) const [isLoading, setLoading] = useState(false) @@ -134,9 +134,15 @@ export default function ConnectButton({ } }, [cc, myAddress, isFollowing]) + if (!myAddress) + return ( + + Please connect your wallet first + + ) if (blockChainNetwork !== NetworkPluginID.PLUGIN_EVM) { return ( - + Please switch to EVM-based wallet to follow ) diff --git a/packages/plugins/CyberConnect/src/SNSAdaptor/FollowTab.tsx b/packages/plugins/CyberConnect/src/SNSAdaptor/FollowTab.tsx index ea74e6be060d..7fe5a1371463 100644 --- a/packages/plugins/CyberConnect/src/SNSAdaptor/FollowTab.tsx +++ b/packages/plugins/CyberConnect/src/SNSAdaptor/FollowTab.tsx @@ -89,6 +89,7 @@ export default function FollowTab({ sx={{ color: 'black', width: '100%', + boxSizing: 'border-box', }}> {followingList.map((f: IFollowIdentity) => { return @@ -100,6 +101,7 @@ export default function FollowTab({ sx={{ color: 'black', width: '100%', + boxSizing: 'border-box', }}> {followerList.map((f: IFollowIdentity) => { return From 2aff9a9621a4cec506c1430c9de88c00a7f3a099 Mon Sep 17 00:00:00 2001 From: BillyS Date: Tue, 12 Jul 2022 13:48:13 +0800 Subject: [PATCH 071/128] fix: fix history tab loading ui (#6765) --- .../src/plugins/Collectible/SNSAdaptor/HistoryTab/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mask/src/plugins/Collectible/SNSAdaptor/HistoryTab/index.tsx b/packages/mask/src/plugins/Collectible/SNSAdaptor/HistoryTab/index.tsx index 3833fa7786fd..18e99a08d994 100644 --- a/packages/mask/src/plugins/Collectible/SNSAdaptor/HistoryTab/index.tsx +++ b/packages/mask/src/plugins/Collectible/SNSAdaptor/HistoryTab/index.tsx @@ -58,7 +58,8 @@ export function HistoryTab(props: HistoryTabProps) {
) - if (events.length) + + if (!asset.value || asset.error || !events.length) return ( From b1d876365f37345d08b20f41a701c2cfd3062816 Mon Sep 17 00:00:00 2001 From: BillyS Date: Tue, 12 Jul 2022 14:08:43 +0800 Subject: [PATCH 072/128] fix: 2.1.0 Savings issues (#6766) * fix: some Saving ui issues * fix: withdraw reject + code style * fix: eth to seth --- .../Savings/SNSAdaptor/SavingsForm.tsx | 63 ++++--------------- .../Savings/SNSAdaptor/SavingsTable.tsx | 39 +++++++++++- .../plugins/Savings/protocols/AAVEProtocol.ts | 3 +- .../components/PluginWalletStatusBar.tsx | 2 +- 4 files changed, 53 insertions(+), 54 deletions(-) diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsForm.tsx b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsForm.tsx index 1b5da7267f83..555c8abe7ed7 100644 --- a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsForm.tsx +++ b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsForm.tsx @@ -1,8 +1,7 @@ -import { useState, useCallback, useMemo } from 'react' +import { useState, useMemo } from 'react' import { useAsync, useAsyncFn } from 'react-use' import type { AbiItem } from 'web3-utils' import BigNumber from 'bignumber.js' -import { unreachable } from '@dimensiondev/kit' import { isLessThan, rightShift, @@ -38,7 +37,6 @@ import { PluginWalletStatusBar, useI18N } from '../../../utils' import { WalletConnectedBoundary } from '../../../web3/UI/WalletConnectedBoundary' import { ChainBoundary } from '../../../web3/UI/ChainBoundary' import { PluginTraderMessages } from '../../Trader/messages' -import type { Coin } from '../../Trader/types' import { ProtocolType, SavingsProtocol, TabType } from '../types' import { useStyles } from './SavingsFormStyles' import { EthereumERC20TokenApprovedBoundary } from '../../../web3/UI/EthereumERC20TokenApprovedBoundary' @@ -76,22 +74,6 @@ export function SavingsFormDialog({ chainId, protocol, tab, onClose }: SavingsFo const { setDialog: openSwapDialog } = useRemoteControlledDialog(PluginTraderMessages.swapDialogUpdated) - const onConvertClick = useCallback(() => { - const token = protocol.stakeToken - openSwapDialog({ - open: true, - traderProps: { - defaultInputCoin: { - id: token.address, - name: token.name ?? '', - symbol: token.symbol ?? '', - contract_address: token.address, - decimals: token.decimals, - } as Coin, - }, - }) - }, [protocol, openSwapDialog]) - // #region form variables const { value: inputTokenBalance } = useFungibleTokenBalance( NetworkPluginID.PLUGIN_EVM, @@ -182,38 +164,19 @@ export function SavingsFormDialog({ chainId, protocol, tab, onClose }: SavingsFo }) const [, executor] = useAsyncFn(async () => { if (!web3) return - switch (tab) { - case TabType.Deposit: - const hash = await protocol.deposit(account, chainId, web3, tokenAmount) - if (typeof hash !== 'string') { - throw new Error('Failed to deposit token.') - } else { - await protocol.updateBalance(chainId, web3, account) - } - openShareTxDialog({ - hash, - onShare() { - activatedSocialNetworkUI.utils.share?.(shareText) - }, - }) - break - case TabType.Withdraw: - switch (protocol.type) { - case ProtocolType.Lido: - onClose?.() - onConvertClick() - return - default: - if (!(await protocol.withdraw(account, chainId, web3, tokenAmount))) { - throw new Error('Failed to withdraw token.') - } else { - await protocol.updateBalance(chainId, web3, account) - } - return - } - default: - unreachable(tab) + const methodName = tab === TabType.Deposit ? 'deposit' : 'withdraw' + const hash = await protocol[methodName](account, chainId, web3, tokenAmount) + if (typeof hash !== 'string') { + throw new Error('Failed to deposit token.') + } else { + await protocol.updateBalance(chainId, web3, account) } + openShareTxDialog({ + hash, + onShare() { + activatedSocialNetworkUI.utils.share?.(shareText) + }, + }) }, [tab, protocol, account, chainId, web3, tokenAmount, openShareTxDialog]) const buttonDom = useMemo(() => { diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx index f94dbd776e62..bb8e112ae82f 100644 --- a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx +++ b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx @@ -7,8 +7,13 @@ import { isZero, rightShift, formatBalance, isSameAddress, NetworkPluginID } fro import type { ChainId, Web3 } from '@masknet/web3-shared-evm' import { ProviderIconURLs } from './IconURL' import { useI18N } from '../../../utils' -import { SavingsProtocol, TabType } from '../types' +import { ProtocolType, SavingsProtocol, TabType } from '../types' import { useAccount, useWeb3, useFungibleAssets } from '@masknet/plugin-infra/web3' +import { useRemoteControlledDialog } from '@masknet/shared-base-ui' +import { useCallback } from 'react' +import { PluginTraderMessages } from '../../Trader/messages' +import { LDO_PAIRS } from '../constants' +import { TrendingCoinType } from '@masknet/web3-providers' const useStyles = makeStyles()((theme, props) => ({ containerWrap: { @@ -105,7 +110,7 @@ export function SavingsTable({ chainId, tab, protocols, setTab, setSelectedProto const account = useAccount(NetworkPluginID.PLUGIN_EVM) const { value: assets, loading: getAssetsLoading } = useFungibleAssets(NetworkPluginID.PLUGIN_EVM) - + const { setDialog: openSwapDialog } = useRemoteControlledDialog(PluginTraderMessages.swapDialogUpdated) // Only fetch protocol APR and Balance on chainId change const { loading } = useAsync(async () => { await Promise.all( @@ -115,6 +120,32 @@ export function SavingsTable({ chainId, tab, protocols, setTab, setSelectedProto }), ) }, [chainId, web3, account, protocols]) + + const onConvertClick = useCallback(() => { + const ETH = LDO_PAIRS[0][0] + const sETH = LDO_PAIRS[0][1] + openSwapDialog({ + open: true, + traderProps: { + defaultInputCoin: { + id: sETH.address, + name: sETH.name ?? '', + symbol: sETH.symbol ?? '', + contract_address: sETH.address, + decimals: sETH.decimals, + type: TrendingCoinType.Fungible, + }, + defaultOutputCoin: { + id: ETH.address, + name: ETH.name ?? '', + symbol: ETH.symbol ?? '', + contract_address: ETH.address, + decimals: ETH.decimals, + type: TrendingCoinType.Fungible, + }, + }, + }) + }, [openSwapDialog]) return ( @@ -188,6 +219,10 @@ export function SavingsTable({ chainId, tab, protocols, setTab, setSelectedProto color="primary" disabled={tab === TabType.Withdraw ? isZero(protocol.balance) : false} onClick={() => { + if (tab === TabType.Withdraw && protocol.type === ProtocolType.Lido) { + onConvertClick() + return + } setTab(tab) setSelectedProtocol(protocol) }}> diff --git a/packages/mask/src/plugins/Savings/protocols/AAVEProtocol.ts b/packages/mask/src/plugins/Savings/protocols/AAVEProtocol.ts index 4c1ddaf1e699..9d55bb937ef0 100644 --- a/packages/mask/src/plugins/Savings/protocols/AAVEProtocol.ts +++ b/packages/mask/src/plugins/Savings/protocols/AAVEProtocol.ts @@ -239,13 +239,14 @@ export class AAVEProtocol implements SavingsProtocol { poolAddress || ZERO_ADDRESS, AaveLendingPoolABI as AbiItem[], ) - return new Promise((resolve) => + return new Promise((resolve, reject) => contract?.methods .withdraw(this.bareToken.address, new BigNumber(value).toFixed(), account) .send({ from: account, gas: gasEstimate.toNumber(), }) + .once(TransactionEventType.ERROR, reject) .once(TransactionEventType.CONFIRMATION, (_, receipt) => { resolve(receipt.transactionHash) }), diff --git a/packages/mask/src/utils/components/PluginWalletStatusBar.tsx b/packages/mask/src/utils/components/PluginWalletStatusBar.tsx index ba08a4d784c3..69a4eb73975c 100644 --- a/packages/mask/src/utils/components/PluginWalletStatusBar.tsx +++ b/packages/mask/src/utils/components/PluginWalletStatusBar.tsx @@ -44,7 +44,7 @@ const useStyles = makeStyles()((theme) => ({ backgroundColor: isDashboard ? MaskColorVar.mainBackground : parseColor(theme.palette.maskColor.bottom).setAlpha(0.8).toRgbString(), - boxShadow: `0 0 20px ${parseColor(theme.palette.maskColor.highlight).setAlpha(0.05).toRgbString()}`, + boxShadow: `0 0 20px ${parseColor(theme.palette.maskColor.highlight).setAlpha(0.2).toRgbString()}`, backdropFilter: 'blur(16px)', padding: theme.spacing(2), borderRadius: '0 0 12px 12px', From a790da92095e08a02cf55c37c89322a0bcb86a00 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Tue, 12 Jul 2022 14:09:01 +0800 Subject: [PATCH 073/128] fix: bugfix for token icon --- .../mask/src/web3/UI/EthereumERC20TokenApprovedBoundary.tsx | 1 + .../src/web3/EVM/useERC20TokenApproveCallback.ts | 2 +- packages/shared/src/UI/components/TokenIcon/index.tsx | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/mask/src/web3/UI/EthereumERC20TokenApprovedBoundary.tsx b/packages/mask/src/web3/UI/EthereumERC20TokenApprovedBoundary.tsx index 5e33d87e5156..e146566acc85 100644 --- a/packages/mask/src/web3/UI/EthereumERC20TokenApprovedBoundary.tsx +++ b/packages/mask/src/web3/UI/EthereumERC20TokenApprovedBoundary.tsx @@ -117,6 +117,7 @@ export function EthereumERC20TokenApprovedBoundary(props: EthereumERC20TokenAppr address={token.address} chainId={token.chainId} name={token.name} + disableDefaultIcon classes={{ icon: classes.icon }} /> } diff --git a/packages/plugin-infra/src/web3/EVM/useERC20TokenApproveCallback.ts b/packages/plugin-infra/src/web3/EVM/useERC20TokenApproveCallback.ts index c55e74a3b219..e3c5c44fb269 100644 --- a/packages/plugin-infra/src/web3/EVM/useERC20TokenApproveCallback.ts +++ b/packages/plugin-infra/src/web3/EVM/useERC20TokenApproveCallback.ts @@ -48,7 +48,7 @@ export function useERC20TokenApproveCallback( // the computed approve state const approveStateType = useMemo(() => { - if (!amount || !spender) return ApproveStateType.UNKNOWN + if (isZero(amount) || !spender) return ApproveStateType.UNKNOWN if (loadingBalance || loadingAllowance) return ApproveStateType.UPDATING if (errorBalance || errorAllowance) return ApproveStateType.FAILED return isLessThan(allowance, amount) || (allowance === amount && isZero(amount)) diff --git a/packages/shared/src/UI/components/TokenIcon/index.tsx b/packages/shared/src/UI/components/TokenIcon/index.tsx index de06e60dd17e..7d0dc7fde8e9 100644 --- a/packages/shared/src/UI/components/TokenIcon/index.tsx +++ b/packages/shared/src/UI/components/TokenIcon/index.tsx @@ -22,11 +22,12 @@ export interface TokenIconProps extends withClasses<'icon'> { name?: string logoURL?: string isERC721?: boolean + disableDefaultIcon?: boolean AvatarProps?: Partial } export function TokenIcon(props: TokenIconProps) { - const { address, logoURL, name, AvatarProps, classes, isERC721 } = props + const { address, logoURL, name, AvatarProps, classes, isERC721, disableDefaultIcon } = props const chainId = useChainId(props.pluginID, props.chainId) const hub = useWeb3Hub(props.pluginID) @@ -41,6 +42,8 @@ export function TokenIcon(props: TokenIconProps) { const { urls = EMPTY_LIST, key } = value ?? {} const accessibleUrl = useAccessibleUrl(key, first(urls)) + if (!accessibleUrl && disableDefaultIcon) return null + return ( Date: Tue, 12 Jul 2022 14:17:46 +0800 Subject: [PATCH 074/128] fix: eslint --- packages/mask/src/web3/UI/ChainBoundary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mask/src/web3/UI/ChainBoundary.tsx b/packages/mask/src/web3/UI/ChainBoundary.tsx index 9d1db522a87a..18ce218c767a 100644 --- a/packages/mask/src/web3/UI/ChainBoundary.tsx +++ b/packages/mask/src/web3/UI/ChainBoundary.tsx @@ -14,7 +14,7 @@ import { useChainIdValid, useProviderDescriptor, } from '@masknet/plugin-infra/web3' -import { ChainId, ProviderType } from '@masknet/web3-shared-evm' +import { ProviderType } from '@masknet/web3-shared-evm' import { useRemoteControlledDialog } from '@masknet/shared-base-ui' import { delay } from '@dimensiondev/kit' import ActionButton, { From 445a4de4199516bdce09de31fa0e259d44573ad5 Mon Sep 17 00:00:00 2001 From: Randolph <840094513@qq.com> Date: Tue, 12 Jul 2022 14:34:08 +0800 Subject: [PATCH 075/128] feat: change cpoywriting of welcome page --- packages/dashboard/src/locales/en-US.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dashboard/src/locales/en-US.json b/packages/dashboard/src/locales/en-US.json index 75a8d98817a0..c8da88af397d 100644 --- a/packages/dashboard/src/locales/en-US.json +++ b/packages/dashboard/src/locales/en-US.json @@ -33,7 +33,7 @@ "about_dialog_touch": "Get in touch", "about_dialog_description": "Mask Network is the portal to the new, open internet. Mask allows you to send encrypted posts on social networks. We provide more functions such as sending encrypted lucky drops, purchasing cryptocurrencies, file service, etc.", "setup_page_title": "Welcome to Mask Network", - "setup_page_description": "Encrypt your posts on social media, only your friends can decrypt it.", + "setup_page_description": "Encrypt your posts on social media and only your friends on Mask can decrypt them.", "setup_page_create_account_title": "Create an Identity", "setup_page_create_account_subtitle": "Create your digital identity system, explore Web 3.0", "setup_page_create_account_button": "Create", From 1e93c33c6dc5acb6c8f8b859ff09e36b81b18b50 Mon Sep 17 00:00:00 2001 From: Hancheng Zhou Date: Tue, 12 Jul 2022 13:12:09 +0800 Subject: [PATCH 076/128] feat(lucky drop): pre gas minus (#6467) * feat(lucky drop): pre gas minus * chore: reply code review * chore: solve error * fix: solve conflict * chore: format balance * chore: apply confition apply only sum of gas and total greater than balance * chore: increase estimate gas * chore: format significant * chore: reply code review * chore: format significant * chore: i18n * chore: reply code review * chore: use big number * chore: add useTransactionValue hook --- .../RedPacket/SNSAdaptor/RedPacket/index.tsx | 6 +- .../SNSAdaptor/RedPacketConfirmDialog.tsx | 88 ++++++++++++++----- .../SNSAdaptor/hooks/useCreateCallback.tsx | 17 +++- .../plugins/RedPacket/SNSAdaptor/index.tsx | 24 ++++- .../src/plugins/RedPacket/locales/en-US.json | 3 + packages/plugin-infra/src/web3/EVM/index.ts | 1 + .../src/web3/EVM/useTransactionValue.ts | 27 ++++++ .../descriptors/RedPacket.ts | 7 +- 8 files changed, 140 insertions(+), 33 deletions(-) create mode 100644 packages/plugin-infra/src/web3/EVM/useTransactionValue.ts diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx index a5506723eb41..9dd91b337411 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx @@ -109,7 +109,7 @@ export function RedPacket(props: RedPacketProps) { return t.description_claimed( availability.claimed_amount ? { - amount: formatBalance(availability.claimed_amount, token.decimals, 8), + amount: formatBalance(availability.claimed_amount, token.decimals, 2), symbol: token.symbol, } : { amount: '-', symbol: '-' }, @@ -122,7 +122,7 @@ export function RedPacket(props: RedPacketProps) { if (listOfStatus.includes(RedPacketStatus.expired) && canRefund) return t.description_refund({ - balance: formatBalance(availability.balance, token.decimals), + balance: formatBalance(availability.balance, token.decimals, 2), symbol: token.symbol ?? '-', }) if (listOfStatus.includes(RedPacketStatus.refunded)) return t.description_refunded() @@ -130,7 +130,7 @@ export function RedPacket(props: RedPacketProps) { if (listOfStatus.includes(RedPacketStatus.empty)) return t.description_empty() if (!payload.password) return t.description_broken() return t.description_failover({ - total: formatBalance(payload.total, token.decimals), + total: formatBalance(payload.total, token.decimals, 2), symbol: token.symbol ?? '-', shares: payload.shares.toString() ?? '-', }) diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx index 646a83313ea8..b0bfe5d634e1 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx @@ -1,19 +1,28 @@ import BigNumber from 'bignumber.js' import classNames from 'classnames' import { useCallback, useEffect, useMemo, useRef } from 'react' +import { + useAccount, + useChainId, + useBalance, + useNetworkType, + useWeb3, + useNativeToken, + useNativeTokenAddress, +} from '@masknet/plugin-infra/web3' import { chainResolver, explorerResolver, isNativeTokenAddress, useRedPacketConstants } from '@masknet/web3-shared-evm' import { Grid, Link, Paper, Typography } from '@mui/material' import { makeStyles } from '@masknet/theme' import LaunchIcon from '@mui/icons-material/Launch' import { FormattedBalance, useOpenShareTxDialog } from '@masknet/shared' +import ActionButton from '../../../extension/options-page/DashboardComponents/ActionButton' import { useI18N } from '../locales' -import { RedPacketSettings, useCreateCallback } from './hooks/useCreateCallback' -import { useAccount, useChainId, useNetworkType, useWeb3 } from '@masknet/plugin-infra/web3' -import { NetworkPluginID, formatBalance } from '@masknet/web3-shared-base' +import { RedPacketSettings, useCreateCallback, useCreateParams } from './hooks/useCreateCallback' +import { useTransactionValue } from '@masknet/plugin-infra/web3-evm' +import { NetworkPluginID, formatBalance, isSameAddress } from '@masknet/web3-shared-base' import type { RedPacketJSONPayload, RedPacketRecord } from '../types' import { RedPacketRPC } from '../messages' import { PluginWalletStatusBar } from '../../../utils' -import ActionButton from '../../../extension/options-page/DashboardComponents/ActionButton' import { ChainBoundary } from '../../../web3/UI/ChainBoundary' const useStyles = makeStyles()((theme) => ({ @@ -81,6 +90,7 @@ export function RedPacketConfirmDialog(props: ConfirmRedPacketFormProps) { const t = useI18N() const { onBack, settings, onCreated, onClose } = props const { classes } = useStyles() + const { value: balance = '0', loading: loadingBalance } = useBalance(NetworkPluginID.PLUGIN_EVM) const chainId = useChainId(NetworkPluginID.PLUGIN_EVM) useEffect(() => { if (settings?.token?.chainId !== chainId) onClose() @@ -93,11 +103,27 @@ export function RedPacketConfirmDialog(props: ConfirmRedPacketFormProps) { const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM) const account = useAccount(NetworkPluginID.PLUGIN_EVM) const networkType = useNetworkType(NetworkPluginID.PLUGIN_EVM) + const nativeTokenAddress = useNativeTokenAddress(NetworkPluginID.PLUGIN_EVM) const { address: publicKey, privateKey } = useMemo( () => web3?.eth.accounts.create() ?? { address: '', privateKey: '' }, [web3], )! - const [{ loading: isCreating }, createCallback] = useCreateCallback(settings!, contract_version, publicKey) + const { value: nativeToken } = useNativeToken(NetworkPluginID.PLUGIN_EVM) + + // #region amount minus estimate gas fee + const { value: createParams } = useCreateParams(settings!, contract_version, publicKey) + const isNativeToken = isSameAddress(settings?.token?.address, nativeTokenAddress) + const { transactionValue, estimateGasFee } = useTransactionValue(settings?.total, createParams?.gas) + const isWaitGasBeMinus = (!estimateGasFee || loadingBalance) && isNativeToken + const isBalanceInsufficient = new BigNumber(transactionValue).isLessThanOrEqualTo(0) + const total = isNativeToken ? (isBalanceInsufficient ? '0' : transactionValue) : (settings?.total as string) + const formatTotal = formatBalance(total, settings?.token?.decimals ?? 18, isNativeToken ? 3 : 0) + const [{ loading: isCreating }, createCallback] = useCreateCallback( + { ...settings!, total }, + contract_version, + publicKey, + ) + // #endregion const openShareTxDialog = useOpenShareTxDialog() const createRedpacket = useCallback(async () => { const result = await createCallback() @@ -220,26 +246,45 @@ export function RedPacketConfirmDialog(props: ConfirmRedPacketFormProps) { - {settings?.isRandom ? null : ( + {!estimateGasFee ? null : ( <> - {t.amount_per_share()} + {t.estimate_gas_fee()} )} + {settings?.isRandom ? null : ( + <> + + + {t.amount_per_share()} + + + + + {isBalanceInsufficient + ? '0' + : new BigNumber(formatTotal).div(settings?.shares ?? 1).toFixed(6)}{' '} + {settings?.token?.symbol} + + + + )} + {t.total_amount()} @@ -247,12 +292,7 @@ export function RedPacketConfirmDialog(props: ConfirmRedPacketFormProps) { - + {formatTotal} {settings?.token?.symbol} @@ -265,11 +305,17 @@ export function RedPacketConfirmDialog(props: ConfirmRedPacketFormProps) { - - {t.send_symbol({ - amount: formatBalance(settings?.total, settings?.token?.decimals ?? 0), - symbol: settings?.token?.symbol ?? '-', - })} + + {!isBalanceInsufficient + ? t.send_symbol({ + amount: formatTotal, + symbol: settings?.token?.symbol ?? '-', + }) + : t.insufficient_balance()} diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/hooks/useCreateCallback.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/hooks/useCreateCallback.tsx index dd57a2476f68..9fef50607064 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/hooks/useCreateCallback.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/hooks/useCreateCallback.tsx @@ -1,5 +1,5 @@ import { useCallback } from 'react' -import { useAsyncFn } from 'react-use' +import { useAsync, useAsyncFn } from 'react-use' import Web3Utils from 'web3-utils' import { omit } from 'lodash-unified' import { useAccount, useChainId, useWeb3Connection, useWeb3 } from '@masknet/plugin-infra/web3' @@ -58,7 +58,11 @@ interface CreateParams { gasError: Error | null } -export function useCreateParams(redPacketSettings: RedPacketSettings | undefined, version: number, publicKey: string) { +export function useCreateParamsCallback( + redPacketSettings: RedPacketSettings | undefined, + version: number, + publicKey: string, +) { const account = useAccount(NetworkPluginID.PLUGIN_EVM) const chainId = useChainId(NetworkPluginID.PLUGIN_EVM) const { NATIVE_TOKEN_ADDRESS } = useTokenConstants(chainId) @@ -111,11 +115,16 @@ export function useCreateParams(redPacketSettings: RedPacketSettings | undefined return getCreateParams } +export function useCreateParams(redPacketSettings: RedPacketSettings, version: number, publicKey: string) { + const getCreateParams = useCreateParamsCallback(redPacketSettings, version, publicKey) + return useAsync(() => getCreateParams(), [redPacketSettings, version, publicKey]) +} + export function useCreateCallback(redPacketSettings: RedPacketSettings, version: number, publicKey: string) { const account = useAccount(NetworkPluginID.PLUGIN_EVM) const chainId = useChainId(NetworkPluginID.PLUGIN_EVM) const redPacketContract = useRedPacketContract(chainId, version) - const getCreateParams = useCreateParams(redPacketSettings, version, publicKey) + const getCreateParams = useCreateParamsCallback(redPacketSettings, version, publicKey) const connection = useWeb3Connection(NetworkPluginID.PLUGIN_EVM) const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM) @@ -162,5 +171,5 @@ export function useCreateCallback(redPacketSettings: RedPacketSettings, version: } } return { hash, receipt } - }, [account, connection, redPacketContract, redPacketSettings, chainId, getCreateParams]) + }, [account, connection, redPacketContract, redPacketSettings, chainId]) } diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/index.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/index.tsx index ab225bc6139c..caf55e2f65fa 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/index.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/index.tsx @@ -1,5 +1,12 @@ import { type Plugin, usePluginWrapper, PluginId } from '@masknet/plugin-infra/content-script' -import { ChainId, SchemaType, chainResolver, networkResolver, NetworkType } from '@masknet/web3-shared-evm' +import { + ChainId, + SchemaType, + chainResolver, + networkResolver, + NetworkType, + isNativeTokenAddress, +} from '@masknet/web3-shared-evm' import { base } from '../base' import { RedPacketMetaKey, RedPacketNftMetaKey } from '../constants' import { @@ -8,6 +15,7 @@ import { renderWithRedPacketMetadata, renderWithRedPacketNftMetadata, } from './helpers' +import { useI18N } from '../locales' import type { RedPacketJSONPayload, RedPacketNftJSONPayload } from '../types' import RedPacketDialog from './RedPacketDialog' import { RedPacketInPost } from './RedPacketInPost' @@ -148,6 +156,7 @@ interface ERC20RedpacketBadgeProps { function ERC20RedpacketBadge(props: ERC20RedpacketBadgeProps) { const { payload } = props + const t = useI18N() const { value: fetchedToken } = useFungibleToken( NetworkPluginID.PLUGIN_EVM, payload.token?.address ?? payload.token?.address, @@ -157,9 +166,16 @@ function ERC20RedpacketBadge(props: ERC20RedpacketBadgeProps) { const tokenDetailed = payload.token?.schema === SchemaType.Native ? nativeCurrency : payload.token ?? fetchedToken return (
- A Lucky Drop with{' '} - {formatBalance(payload.total, tokenDetailed?.decimals ?? 0)} $ - {tokenDetailed?.symbol ?? tokenDetailed?.name ?? 'Token'} from {payload.sender.name} + + {t.badge({ + balance: formatBalance( + payload.total, + tokenDetailed?.decimals ?? 0, + isNativeTokenAddress(payload.token?.address) ? 6 : 0, + ), + tokenName: tokenDetailed?.symbol ?? tokenDetailed?.name ?? 'Token', + sender: payload.sender.name, + })}
) } diff --git a/packages/mask/src/plugins/RedPacket/locales/en-US.json b/packages/mask/src/plugins/RedPacket/locales/en-US.json index fb7fb85fe4c0..8f79904442b5 100644 --- a/packages/mask/src/plugins/RedPacket/locales/en-US.json +++ b/packages/mask/src/plugins/RedPacket/locales/en-US.json @@ -2,6 +2,7 @@ "promote": "🧧🧧🧧 Try sending Lucky Drop to your friends with tokens or NFTs to share the joy now! Install Mask.io to send your first Lucky Drop.", "promote_short": "🧧🧧🧧 Try sending Lucky Drop to your friends with Mask.io.", "nft_shift_select_tip": "You can also use {{text}} to select multiple NFTs.", + "badge": "A Lucky Drop with {{balance}} {{tokenName}} from {{sender}}", "collections": "Collections", "select_a_token": "Select a Token", "search": "Search", @@ -53,10 +54,12 @@ "select_existing": "History", "create_new": "New", "send_symbol": "Send {{amount}} {{symbol}}", + "insufficient_balance": "Insufficient Balance", "back": "Back", "hint": "You can withdraw the remaining balance 24 hours after the Lucky Drop is sent.", "total_amount": "Total Amount", "amount_per_share": "Amount per Share", + "estimate_gas_fee": "Estimate gas fee", "shares": "Shares", "average": "Average", "random": "Random", diff --git a/packages/plugin-infra/src/web3/EVM/index.ts b/packages/plugin-infra/src/web3/EVM/index.ts index edb258a194ec..9076bf6a2163 100644 --- a/packages/plugin-infra/src/web3/EVM/index.ts +++ b/packages/plugin-infra/src/web3/EVM/index.ts @@ -8,6 +8,7 @@ export * from './useERC721ContractIsApproveForAll' export * from './useERC721ContractSetApproveForAllCallback' export * from './useERC721TokenTransferCallback' export * from './useGasConfig' +export * from './useTransactionValue' export * from './useMulticall' export * from './useNativeTokenTransferCallback' export * from './useNativeTokenWrapperCallback' diff --git a/packages/plugin-infra/src/web3/EVM/useTransactionValue.ts b/packages/plugin-infra/src/web3/EVM/useTransactionValue.ts new file mode 100644 index 000000000000..a3e53b2f9ec1 --- /dev/null +++ b/packages/plugin-infra/src/web3/EVM/useTransactionValue.ts @@ -0,0 +1,27 @@ +import { useBalance } from '../useBalance' +import BigNumber from 'bignumber.js' +import { useGasConfig } from './useGasConfig' +import { useChainId } from '../useChainId' +import { NetworkPluginID } from '@masknet/web3-shared-base' + +export function useTransactionValue(originalValue: BigNumber.Value | undefined, gas: number | undefined) { + const { value: balance = '0' } = useBalance(NetworkPluginID.PLUGIN_EVM) + const chainId = useChainId(NetworkPluginID.PLUGIN_EVM) + + // #region amount minus estimate gas fee + const { gasPrice } = useGasConfig(chainId) + + const estimateGasFee = !gas + ? undefined + : gasPrice && gasPrice !== '0' + ? new BigNumber(gasPrice).multipliedBy(gas * 1.5).toFixed() + : undefined + + const transactionValue = new BigNumber(balance).isLessThan( + new BigNumber(originalValue ?? '0').plus(new BigNumber(estimateGasFee ?? '0')), + ) + ? new BigNumber(originalValue ?? '0').minus(estimateGasFee ?? '0').toFixed() + : (originalValue as string) + + return { transactionValue, estimateGasFee } +} diff --git a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/RedPacket.ts b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/RedPacket.ts index 3023490d64fe..72a305dbf3ab 100644 --- a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/RedPacket.ts +++ b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/RedPacket.ts @@ -3,6 +3,7 @@ import { ChainId, getNftRedPacketConstants, getRedPacketConstants, + isNativeTokenAddress, TransactionParameter, } from '@masknet/web3-shared-evm' import type { TransactionDescriptor } from '../types' @@ -26,7 +27,11 @@ export class RedPacketDescriptor implements TransactionDescriptor { }) const token = await connection?.getFungibleToken(parameters?._token_addr ?? '') - const amount = formatBalance(parameters?._total_tokens, token?.decimals) + const amount = formatBalance( + parameters?._total_tokens, + token?.decimals, + isNativeTokenAddress(parameters?._token_addr) ? 6 : 0, + ) return { chainId: context.chainId, From 179e465aba758df21be4a357551b7e76e0a345e2 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Tue, 12 Jul 2022 15:21:12 +0800 Subject: [PATCH 077/128] fix: switch chain then revoke --- .../src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx | 4 +++- .../src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx | 4 +++- packages/mask/src/web3/UI/ChainBoundary.tsx | 4 ++-- .../plugin-infra/src/web3/EVM/useERC20TokenApproveCallback.ts | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx index 8eaeacea0207..8e8c03b43d29 100644 --- a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx +++ b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx @@ -118,7 +118,9 @@ function ApprovalNFTItem(props: ApprovalNFTItemProps) { expectedPluginID={NetworkPluginID.PLUGIN_EVM} className={classes.chainBoundary} classes={{ switchButton: classes.button }} - expectedChainIdSwitchedCallback={() => approveCallback()} + expectedChainIdSwitchedCallback={async () => { + await approveCallback() + }} ActionButtonPromiseProps={{ fullWidth: false, init: t.revoke(), diff --git a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx index 9e03fe19feed..af3554ab4305 100644 --- a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx +++ b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx @@ -100,7 +100,9 @@ function ApprovalTokenItem(props: ApprovalTokenItemProps) { expectedPluginID={NetworkPluginID.PLUGIN_EVM} className={classes.chainBoundary} classes={{ switchButton: classes.button }} - expectedChainIdSwitchedCallback={() => approveCallback(true, true)} + expectedChainIdSwitchedCallback={async () => { + await approveCallback(true, true) + }} ActionButtonPromiseProps={{ fullWidth: false, init: t.revoke(), diff --git a/packages/mask/src/web3/UI/ChainBoundary.tsx b/packages/mask/src/web3/UI/ChainBoundary.tsx index 18ce218c767a..980e66977df1 100644 --- a/packages/mask/src/web3/UI/ChainBoundary.tsx +++ b/packages/mask/src/web3/UI/ChainBoundary.tsx @@ -60,7 +60,7 @@ export interface ChainBoundaryProps extends withClass noSwitchNetworkTip?: boolean hiddenConnectButton?: boolean children?: React.ReactNode - expectedChainIdSwitchedCallback?: () => void + expectedChainIdSwitchedCallback?: () => Promise ActionButtonPromiseProps?: Partial } @@ -124,7 +124,7 @@ export function ChainBoundary(props: ChainBoundaryPro }) } - expectedChainIdSwitchedCallback?.() + await expectedChainIdSwitchedCallback?.() } return }, [ diff --git a/packages/plugin-infra/src/web3/EVM/useERC20TokenApproveCallback.ts b/packages/plugin-infra/src/web3/EVM/useERC20TokenApproveCallback.ts index e3c5c44fb269..c55e74a3b219 100644 --- a/packages/plugin-infra/src/web3/EVM/useERC20TokenApproveCallback.ts +++ b/packages/plugin-infra/src/web3/EVM/useERC20TokenApproveCallback.ts @@ -48,7 +48,7 @@ export function useERC20TokenApproveCallback( // the computed approve state const approveStateType = useMemo(() => { - if (isZero(amount) || !spender) return ApproveStateType.UNKNOWN + if (!amount || !spender) return ApproveStateType.UNKNOWN if (loadingBalance || loadingAllowance) return ApproveStateType.UPDATING if (errorBalance || errorAllowance) return ApproveStateType.FAILED return isLessThan(allowance, amount) || (allowance === amount && isZero(amount)) From 8e6da5bb96daa680690cedea4ebe2e3d0fca70b1 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Tue, 12 Jul 2022 15:23:33 +0800 Subject: [PATCH 078/128] fix: switch chain then revoke --- .../src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx | 4 +--- .../src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx | 4 +--- packages/mask/src/web3/UI/ChainBoundary.tsx | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx index 8e8c03b43d29..8eaeacea0207 100644 --- a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx +++ b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalNFTContent.tsx @@ -118,9 +118,7 @@ function ApprovalNFTItem(props: ApprovalNFTItemProps) { expectedPluginID={NetworkPluginID.PLUGIN_EVM} className={classes.chainBoundary} classes={{ switchButton: classes.button }} - expectedChainIdSwitchedCallback={async () => { - await approveCallback() - }} + expectedChainIdSwitchedCallback={() => approveCallback()} ActionButtonPromiseProps={{ fullWidth: false, init: t.revoke(), diff --git a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx index af3554ab4305..9e03fe19feed 100644 --- a/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx +++ b/packages/mask/src/plugins/Approval/SNSAdaptor/ApprovalTokenContent.tsx @@ -100,9 +100,7 @@ function ApprovalTokenItem(props: ApprovalTokenItemProps) { expectedPluginID={NetworkPluginID.PLUGIN_EVM} className={classes.chainBoundary} classes={{ switchButton: classes.button }} - expectedChainIdSwitchedCallback={async () => { - await approveCallback(true, true) - }} + expectedChainIdSwitchedCallback={() => approveCallback(true, true)} ActionButtonPromiseProps={{ fullWidth: false, init: t.revoke(), diff --git a/packages/mask/src/web3/UI/ChainBoundary.tsx b/packages/mask/src/web3/UI/ChainBoundary.tsx index 980e66977df1..18ce218c767a 100644 --- a/packages/mask/src/web3/UI/ChainBoundary.tsx +++ b/packages/mask/src/web3/UI/ChainBoundary.tsx @@ -60,7 +60,7 @@ export interface ChainBoundaryProps extends withClass noSwitchNetworkTip?: boolean hiddenConnectButton?: boolean children?: React.ReactNode - expectedChainIdSwitchedCallback?: () => Promise + expectedChainIdSwitchedCallback?: () => void ActionButtonPromiseProps?: Partial } @@ -124,7 +124,7 @@ export function ChainBoundary(props: ChainBoundaryPro }) } - await expectedChainIdSwitchedCallback?.() + expectedChainIdSwitchedCallback?.() } return }, [ From f6b20b0fd0a8399ea5575a79e82ed127124ddd65 Mon Sep 17 00:00:00 2001 From: lelenei <72531217+lelenei@users.noreply.github.com> Date: Tue, 12 Jul 2022 15:37:08 +0800 Subject: [PATCH 079/128] fix: add cache for getting avatar meta from kv at avatar plugin (#6733) * fix: add cache for getting avatar meta from kv at avatar plugin * fix: reply review * fix: pnpm-lock.yaml * refactor: reply review * fix: revert code * fix: reply review * fix: build error --- packages/mask/package.json | 2 + .../Avatar/hooks/usePersonaNFTAvatar.ts | 52 ++++++++++++++----- pnpm-lock.yaml | 4 ++ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/packages/mask/package.json b/packages/mask/package.json index bf8b312f4f1f..7116a3c103d4 100644 --- a/packages/mask/package.json +++ b/packages/mask/package.json @@ -97,6 +97,7 @@ "jsbi": "3.1.4", "json-stable-stringify": "^1.0.1", "json2csv": "^5.0.6", + "lru-cache": "^7.10.1", "millify": "^4.0.0", "next-tick": "^1.0.0", "opensea-js": "^1.2.7", @@ -143,6 +144,7 @@ "@nice-labs/emit-file-webpack-plugin": "^1.1.2", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.7", "@types/color": "^3.0.3", + "@types/lru-cache": "^7.10.10", "binaryen": "^107.0.0", "copy-webpack-plugin": "^11.0.0", "html-webpack-plugin": "^5.5.0", diff --git a/packages/mask/src/plugins/Avatar/hooks/usePersonaNFTAvatar.ts b/packages/mask/src/plugins/Avatar/hooks/usePersonaNFTAvatar.ts index d9fc5c6ee05d..fa34402cb68d 100644 --- a/packages/mask/src/plugins/Avatar/hooks/usePersonaNFTAvatar.ts +++ b/packages/mask/src/plugins/Avatar/hooks/usePersonaNFTAvatar.ts @@ -3,23 +3,49 @@ import { NetworkPluginID } from '@masknet/web3-shared-base' import { useAsyncRetry } from 'react-use' import { activatedSocialNetworkUI } from '../../../social-network' import type { RSS3_KEY_SNS } from '../constants' +import type { AvatarMetaDB, NextIDAvatarMeta } from '../types' import { getNFTAvatarByUserId } from '../utils' import { useGetNFTAvatar } from './useGetNFTAvatar' +import LRU from 'lru-cache' + +const cache = new LRU>({ + max: 500, + maxAge: 60 * 1000, +}) + +type GetNFTAvatar = ( + userId?: string, + network?: EnhanceableSite, + snsKey?: RSS3_KEY_SNS, +) => Promise export function usePersonaNFTAvatar(userId: string, avatarId: string, snsKey: RSS3_KEY_SNS) { const [, getNFTAvatar] = useGetNFTAvatar() + return useAsyncRetry(async () => { - const avatarMetaFromPersona = await getNFTAvatarByUserId(userId, avatarId) - if (avatarMetaFromPersona) return avatarMetaFromPersona - const avatarMeta = await getNFTAvatar( - userId, - activatedSocialNetworkUI.networkIdentifier as EnhanceableSite, - snsKey, - ) - if (!avatarMeta) return - if (avatarMeta.pluginId === NetworkPluginID.PLUGIN_SOLANA) { - return { imageUrl: '', nickname: '', ...avatarMeta, address: avatarMeta.tokenId } - } - return { imageUrl: '', nickname: '', ...avatarMeta } - }, [userId, getNFTAvatar, avatarId, snsKey]) + if (!userId) return + const key = `${userId}-${activatedSocialNetworkUI.networkIdentifier}` + if (!cache.has(key)) cache.set(key, getNFTAvatarForCache(userId, snsKey, avatarId, getNFTAvatar)) + const v = cache.get(key) + return v + }, [ + userId, + getNFTAvatar, + avatarId, + activatedSocialNetworkUI.networkIdentifier, + snsKey, + cache, + getNFTAvatarForCache, + ]) +} + +async function getNFTAvatarForCache(userId: string, snsKey: RSS3_KEY_SNS, avatarId: string, fn: GetNFTAvatar) { + const avatarMetaFromPersona = await getNFTAvatarByUserId(userId, avatarId) + if (avatarMetaFromPersona) return avatarMetaFromPersona + const avatarMeta = await fn(userId, activatedSocialNetworkUI.networkIdentifier as EnhanceableSite, snsKey) + if (!avatarMeta) return + if (avatarMeta.pluginId === NetworkPluginID.PLUGIN_SOLANA) { + return { imageUrl: '', nickname: '', ...avatarMeta, address: avatarMeta.tokenId } + } + return { imageUrl: '', nickname: '', ...avatarMeta } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c1861175333a..144ef7e10c0b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -421,6 +421,7 @@ importers: '@types/elliptic': ^6.4.14 '@types/json-stable-stringify': ^1.0.34 '@types/json2csv': ^5.0.3 + '@types/lru-cache': ^7.10.10 '@types/node': ^17.0.34 '@types/react-avatar-editor': ^12.0.0 '@types/react-highlight-words': ^0.16.4 @@ -461,6 +462,7 @@ importers: jsbi: 3.1.4 json-stable-stringify: ^1.0.1 json2csv: ^5.0.6 + lru-cache: ^7.10.1 millify: ^4.0.0 next-tick: ^1.0.0 opensea-js: ^1.2.7 @@ -605,6 +607,7 @@ importers: jsbi: 3.1.4 json-stable-stringify: 1.0.1 json2csv: 5.0.6 + lru-cache: 7.10.1 millify: 4.0.0 next-tick: 1.1.0 opensea-js: 1.2.7_webpack-cli@4.10.0 @@ -650,6 +653,7 @@ importers: '@nice-labs/emit-file-webpack-plugin': 1.1.2_webpack@5.73.0 '@pmmmwh/react-refresh-webpack-plugin': 0.5.7_g5otyhka3xgu4m6o2r25nvx6tm '@types/color': 3.0.3 + '@types/lru-cache': 7.10.10 binaryen: 107.0.0 copy-webpack-plugin: 11.0.0_webpack@5.73.0 html-webpack-plugin: 5.5.0_webpack@5.73.0 From 807ec9706b5c782526b014e0653e847da1bd12e8 Mon Sep 17 00:00:00 2001 From: lelenei <72531217+lelenei@users.noreply.github.com> Date: Tue, 12 Jul 2022 15:56:54 +0800 Subject: [PATCH 080/128] fix: tokenId at alchemy (#6742) * fix: tokenId at alchemy * fix: long long number to string * fix: use web3.utils.hexToNumberString --- packages/web3-providers/src/alchemy/index.ts | 25 ++++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/web3-providers/src/alchemy/index.ts b/packages/web3-providers/src/alchemy/index.ts index f9b841b335d0..ad132d316f34 100644 --- a/packages/web3-providers/src/alchemy/index.ts +++ b/packages/web3-providers/src/alchemy/index.ts @@ -17,6 +17,7 @@ import { import { ChainId as ChainId_FLOW, SchemaType as SchemaType_FLOW } from '@masknet/web3-shared-flow' import { first } from 'lodash-unified' import urlcat from 'urlcat' +import { hexToNumberString, isHex } from 'web3-utils' import type { NonFungibleTokenAPI } from '..' import { fetchJSON } from '../helpers' import { Alchemy_EVM_NetworkMap, Alchemy_FLOW_NetworkMap, FILTER_WORDS } from './constants' @@ -146,8 +147,10 @@ function createNftToken_EVM( asset: AlchemyNFT_EVM, ): NonFungibleAsset { const contractAddress = asset.contract?.address - const tokenId = asset.id?.tokenId ?? '' - + let tokenId = asset.id.tokenId + if (isHex(asset.id.tokenId)) { + tokenId = hexToNumberString(asset.id.tokenId) + } return { id: `${contractAddress}_${tokenId}`, chainId, @@ -198,6 +201,10 @@ function createNFTAsset_EVM( contractMetadataResponse?: AlchemyResponse_EVM_Contact_Metadata, ownersResponse?: AlchemyResponse_EVM_Owners, ): NonFungibleAsset { + let tokenId = metaDataResponse.id.tokenId + if (isHex(metaDataResponse.id.tokenId)) { + tokenId = hexToNumberString(metaDataResponse.id.tokenId) + } return { id: metaDataResponse.contract?.address, chainId, @@ -206,7 +213,7 @@ function createNFTAsset_EVM( metaDataResponse?.id?.tokenMetadata?.tokenType === 'ERC721' ? SchemaType_EVM.ERC721 : SchemaType_EVM.ERC1155, - tokenId: metaDataResponse.id?.tokenId, + tokenId, address: metaDataResponse.contract?.address, metadata: { chainId, @@ -252,12 +259,16 @@ function createNftToken_FLOW( chainId: ChainId_FLOW, asset: AlchemyNFT_FLOW, ): NonFungibleAsset { + let tokenId = asset.id.tokenId + if (isHex(asset.id.tokenId)) { + tokenId = hexToNumberString(asset.id.tokenId) + } return { id: asset.contract?.address, chainId, type: TokenType.NonFungible, schema: SchemaType_FLOW.NonFungible, - tokenId: asset.id?.tokenId ?? '', + tokenId, address: asset.contract?.address, metadata: { chainId, @@ -295,12 +306,16 @@ function createNFTAsset_FLOW( ownerAddress: string, metaDataResponse: AlchemyResponse_FLOW_Metadata, ): NonFungibleAsset { + let tokenId = metaDataResponse.id.tokenId + if (isHex(metaDataResponse.id.tokenId)) { + tokenId = hexToNumberString(metaDataResponse.id.tokenId) + } return { id: metaDataResponse.contract?.address, chainId, type: TokenType.NonFungible, schema: SchemaType_FLOW.NonFungible, - tokenId: metaDataResponse.id?.tokenId ?? '', + tokenId, address: metaDataResponse.contract?.address, metadata: { chainId, From d9df9e35d6ffe23a7f953e1615279a06f76abe52 Mon Sep 17 00:00:00 2001 From: guanbinrui <52657989+guanbinrui@users.noreply.github.com> Date: Tue, 12 Jul 2022 16:22:04 +0800 Subject: [PATCH 081/128] fix: sign transaction (#6752) * fix: failed to sign tx * fix: tx gas * fix: error message * chore: wip * refactor: revoke changes * fix: sign payload --- .../mask/src/plugins/Wallet/services/send.ts | 30 ++++++++++--------- packages/web3-shared/evm/utils/contract.ts | 4 +-- packages/web3-shared/evm/utils/payload.ts | 25 +++++++++++++++- packages/web3-shared/evm/utils/provider.ts | 9 ++++++ 4 files changed, 51 insertions(+), 17 deletions(-) diff --git a/packages/mask/src/plugins/Wallet/services/send.ts b/packages/mask/src/plugins/Wallet/services/send.ts index 30c627ddb7bd..1f79b681d5c0 100644 --- a/packages/mask/src/plugins/Wallet/services/send.ts +++ b/packages/mask/src/plugins/Wallet/services/send.ts @@ -1,11 +1,14 @@ import Web3 from 'web3' import type { HttpProvider } from 'web3-core' +import { isHex, hexToNumber } from 'web3-utils' import type { JsonRpcPayload, JsonRpcResponse } from 'web3-core-helpers' +import { isNil } from 'lodash-unified' import { defer } from '@dimensiondev/kit' import { ChainId, + createWeb3, EthereumMethodType, - getPayloadConfig, + getSignablePayloadConfig, getPayloadId, getRPCConstants, isRiskMethod, @@ -13,7 +16,6 @@ import { import { openPopupWindow, removePopupWindow } from '../../../../background/services/helper' import { nativeAPI } from '../../../../shared/native-rpc' import { WalletRPC } from '../messages' -import { isNil } from 'lodash-unified' enum JSON_RPC_ERROR_CODE { INVALID_REQUEST = -32600, @@ -119,34 +121,34 @@ export async function send( options?: Options, ) { const provider = await createProvider(options?.chainId) - const computedPayload = getPayloadConfig(payload) + switch (payload.method) { case EthereumMethodType.ETH_SEND_TRANSACTION: case EthereumMethodType.MASK_REPLACE_TRANSACTION: + const computedPayload = getSignablePayloadConfig(payload) if (!computedPayload?.from || !computedPayload.to || !options?.chainId) return - const rawTransaction = await WalletRPC.signTransaction(computedPayload.from as string, { - ...computedPayload, - chainId: options.chainId, - }) - if (!rawTransaction) break + const privateKey = await WalletRPC.exportPrivateKey(computedPayload.from as string) + const web3 = createWeb3(provider) + const transactionSigned = await web3.eth.accounts.signTransaction(computedPayload, `0x${privateKey}`) + if (!transactionSigned.rawTransaction) break return provider.send( { ...payload, method: EthereumMethodType.ETH_SEND_RAW_TRANSACTION, - params: [rawTransaction], + params: [transactionSigned.rawTransaction], }, callback, ) case EthereumMethodType.ETH_SIGN_TYPED_DATA: const [address, dataToSign] = payload.params as [string, string] - const signed = await WalletRPC.signTypedData(address, dataToSign) + const dataSigned = await WalletRPC.signTypedData(address, dataToSign) try { callback(null, { jsonrpc: '2.0', id: payload.id as number, - result: signed, + result: dataSigned, }) } catch (error) { callback(getError(error, null, 'Failed to sign message.')) @@ -154,12 +156,12 @@ export async function send( break case EthereumMethodType.PERSONAL_SIGN: const [data, account] = payload.params as [string, string] - const personalSigned = await WalletRPC.signPersonalMessage(data, account) + const messageSigned = await WalletRPC.signPersonalMessage(data, account) try { callback(null, { jsonrpc: '2.0', id: payload.id as number, - result: personalSigned, + result: messageSigned, }) } catch (error) { callback(getError(error, null, 'Failed to sign message.')) @@ -219,7 +221,7 @@ export async function confirmRequest(payload: JsonRpcPayload, options?: Options) return } if (response?.error) { - reject(new Error(`Failed to send transaction: ${response.error}`)) + reject(new Error(`Failed to send transaction: ${response.error?.message ?? response.error}`)) return } WalletRPC.deleteUnconfirmedRequest(payload) diff --git a/packages/web3-shared/evm/utils/contract.ts b/packages/web3-shared/evm/utils/contract.ts index 19d935af9259..46d2c0e53caf 100644 --- a/packages/web3-shared/evm/utils/contract.ts +++ b/packages/web3-shared/evm/utils/contract.ts @@ -57,9 +57,9 @@ export async function encodeContractTransaction( if (!tx.gas) { tx.gas = await transaction.estimateGas({ from: tx.from as string | undefined, - value: tx.value, - data: tx.data as string | undefined, to: tx.to as string | undefined, + data: tx.data as string | undefined, + value: tx.value, }) } diff --git a/packages/web3-shared/evm/utils/payload.ts b/packages/web3-shared/evm/utils/payload.ts index 58c2e282ac65..b4073caa5b22 100644 --- a/packages/web3-shared/evm/utils/payload.ts +++ b/packages/web3-shared/evm/utils/payload.ts @@ -1,6 +1,7 @@ import BigNumber from 'bignumber.js' -import { first } from 'lodash-unified' +import { first, isUndefined, omitBy } from 'lodash-unified' import type { JsonRpcPayload } from 'web3-core-helpers' +import { hexToNumber } from 'web3-utils' import { EthereumMethodType, Transaction } from '../types' export function addGasMargin(value: BigNumber.Value, scale = 3000) { @@ -56,3 +57,25 @@ export function getPayloadConfig(payload: JsonRpcPayload) { return } } + +export function getSignablePayloadConfig(payload: JsonRpcPayload) { + const raw = getPayloadConfig(payload) + if (!raw) return + + const parseHexNumber = (hex: string | number | undefined) => + typeof hex !== 'undefined' ? hexToNumber(hex ?? '0x0') : undefined + + return omitBy( + { + ...raw, + value: parseHexNumber(raw.value as string | undefined), + gas: parseHexNumber(raw.gas), + gasPrice: parseHexNumber(raw.gasPrice as string | undefined), + maxFeePerGas: parseHexNumber(raw.maxFeePerGas as string | undefined), + maxPriorityFeePerGas: parseHexNumber(raw.maxPriorityFeePerGas as string | undefined), + chainId: parseHexNumber(raw.chainId), + nonce: parseHexNumber(raw.nonce), + }, + isUndefined, + ) as Transaction +} diff --git a/packages/web3-shared/evm/utils/provider.ts b/packages/web3-shared/evm/utils/provider.ts index 4ec56364cdc1..2367e25a3568 100644 --- a/packages/web3-shared/evm/utils/provider.ts +++ b/packages/web3-shared/evm/utils/provider.ts @@ -12,6 +12,15 @@ export function createWeb3(provider: Provider) { return web3 } +export function createSignableWeb3(provider: Provider, keys: string[]) { + const web3 = createWeb3(provider) + if (keys.length) { + web3.eth.accounts.wallet.clear() + keys.forEach((k) => k && ['0x', '0x0'].includes(k) && web3.eth.accounts.wallet.add(k)) + } + return web3 +} + export function createWeb3Provider(request: (requestArguments: RequestArguments) => Promise): Web3Provider { const provider: Web3Provider = { on() { From 45d73f1a25a6b1912e03105c0a78b6355383515a Mon Sep 17 00:00:00 2001 From: Randolph <840094513@qq.com> Date: Tue, 12 Jul 2022 16:47:52 +0800 Subject: [PATCH 082/128] feat: welcome copywriting --- packages/dashboard/src/locales/en-US.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dashboard/src/locales/en-US.json b/packages/dashboard/src/locales/en-US.json index c8da88af397d..38f9884ec87d 100644 --- a/packages/dashboard/src/locales/en-US.json +++ b/packages/dashboard/src/locales/en-US.json @@ -197,7 +197,7 @@ "wallets_empty_history_tips": "No transaction history", "wallets_loading_token": "Loading Token", "personas_setup_connect_tips": "Please connect to your {{type}} account.", - "personas_setup_tip": "Please create/restore persona.", + "personas_setup_tip": "Please create or restore a Mask identity.", "personas_setup_connect": "Connect", "personas_name_maximum_tips": "Maximum length is {{length}} characters long.", "personas_name_existed": "The persona name already exists", From 9ea5a803cdb680fc8b9c64fb8589b5d308c8bc07 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Tue, 12 Jul 2022 16:44:17 +0800 Subject: [PATCH 083/128] fix: arbitrum symbol --- packages/web3-providers/src/debank/index.ts | 2 +- packages/web3-shared/evm/constants/chains.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web3-providers/src/debank/index.ts b/packages/web3-providers/src/debank/index.ts index 33f5f2e85d31..c6f073203f76 100644 --- a/packages/web3-providers/src/debank/index.ts +++ b/packages/web3-providers/src/debank/index.ts @@ -89,7 +89,7 @@ export class DeBankAPI options?.chainId, ), getAllEVMNativeAssets(), - (a, z) => a.symbol === z.symbol, + (a, z) => a.symbol === z.symbol && a.chainId === z.chainId, ), createIndicator(options?.indicator), ) diff --git a/packages/web3-shared/evm/constants/chains.json b/packages/web3-shared/evm/constants/chains.json index 725cccd2906c..010afa11552b 100644 --- a/packages/web3-shared/evm/constants/chains.json +++ b/packages/web3-shared/evm/constants/chains.json @@ -233,7 +233,7 @@ "nativeCurrency": { "chainId": 42161, "name": "Arbitrum Ether", - "symbol": "ARETH", + "symbol": "ETH", "decimals": 18, "logoURL": "https://assets.debank.com/static/media/arbitrum.8e326f58.svg" }, @@ -258,7 +258,7 @@ "nativeCurrency": { "chainId": 421611, "name": "Arbitrum Rinkeby Ether", - "symbol": "ARETH", + "symbol": "ETH", "decimals": 18 }, "infoURL": "https://arbitrum.io", From b6bca940fcaea4914d82bca54118cc1ed51d9c1f Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Tue, 12 Jul 2022 16:59:56 +0800 Subject: [PATCH 084/128] fix: eslint --- packages/mask/src/plugins/Wallet/services/send.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/mask/src/plugins/Wallet/services/send.ts b/packages/mask/src/plugins/Wallet/services/send.ts index 1f79b681d5c0..6177c84dc303 100644 --- a/packages/mask/src/plugins/Wallet/services/send.ts +++ b/packages/mask/src/plugins/Wallet/services/send.ts @@ -1,6 +1,5 @@ import Web3 from 'web3' import type { HttpProvider } from 'web3-core' -import { isHex, hexToNumber } from 'web3-utils' import type { JsonRpcPayload, JsonRpcResponse } from 'web3-core-helpers' import { isNil } from 'lodash-unified' import { defer } from '@dimensiondev/kit' From adb3475dfb67e254f9bd485492e33012dfc32537 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Tue, 12 Jul 2022 17:15:18 +0800 Subject: [PATCH 085/128] fix: prefix areth --- packages/web3-providers/src/debank/index.ts | 6 ++++++ packages/web3-shared/evm/constants/chains.json | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/web3-providers/src/debank/index.ts b/packages/web3-providers/src/debank/index.ts index c6f073203f76..c0e63f2ab71b 100644 --- a/packages/web3-providers/src/debank/index.ts +++ b/packages/web3-providers/src/debank/index.ts @@ -85,6 +85,12 @@ export class DeBankAPI // rename bsc to bnb id: x.id === 'bsc' ? 'bnb' : x.id, chain: x.chain === 'bsc' ? 'bnb' : x.chain, + // prefix ARETH + symbol: x.chain === 'arb' && x.symbol === 'ETH' ? 'ARETH' : x.symbol, + logo_url: + x.chain === 'arb' && x.symbol === 'ETH' + ? 'https://assets.debank.com/static/media/arbitrum.8e326f58.svg' + : x.logo_url, })), options?.chainId, ), diff --git a/packages/web3-shared/evm/constants/chains.json b/packages/web3-shared/evm/constants/chains.json index 010afa11552b..725cccd2906c 100644 --- a/packages/web3-shared/evm/constants/chains.json +++ b/packages/web3-shared/evm/constants/chains.json @@ -233,7 +233,7 @@ "nativeCurrency": { "chainId": 42161, "name": "Arbitrum Ether", - "symbol": "ETH", + "symbol": "ARETH", "decimals": 18, "logoURL": "https://assets.debank.com/static/media/arbitrum.8e326f58.svg" }, @@ -258,7 +258,7 @@ "nativeCurrency": { "chainId": 421611, "name": "Arbitrum Rinkeby Ether", - "symbol": "ETH", + "symbol": "ARETH", "decimals": 18 }, "infoURL": "https://arbitrum.io", From 897d58245d0a68cc3fd36f4871d94539a7e01327 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Tue, 12 Jul 2022 17:21:16 +0800 Subject: [PATCH 086/128] fix: next id app board --- .../mask/src/components/DataSource/useNextID.ts | 15 +++++++++++---- .../components/InjectedComponents/SetupGuide.tsx | 7 ------- .../InjectedComponents/ToolboxUnstyled.tsx | 12 +----------- .../src/components/shared/ApplicationBoard.tsx | 13 +++++++++---- packages/shared-base/src/Messages/Shared.ts | 1 - 5 files changed, 21 insertions(+), 27 deletions(-) diff --git a/packages/mask/src/components/DataSource/useNextID.ts b/packages/mask/src/components/DataSource/useNextID.ts index 8cfb9cb81e85..2783debe1bab 100644 --- a/packages/mask/src/components/DataSource/useNextID.ts +++ b/packages/mask/src/components/DataSource/useNextID.ts @@ -22,7 +22,7 @@ export const usePersonaBoundPlatform = (personaPublicKey: string) => { let isOpenedVerifyDialog = false let isOpenedFromButton = false -const verifyPersona = (personaIdentifier?: PersonaIdentifier, username?: string) => async () => { +export const verifyPersona = (personaIdentifier?: PersonaIdentifier, username?: string) => async () => { if (!personaIdentifier) return currentSetupGuideStatus[activatedSocialNetworkUI.networkIdentifier].value = stringify({ status: SetupGuideStep.VerifyOnNextID, @@ -59,7 +59,7 @@ export function useSetupGuideStatusState() { }, [lastState_]) } -export function useNextIDConnectStatus() { +export function useNextIDConnectStatus(disableInitialVerify = false) { const ui = activatedSocialNetworkUI const [enableNextID] = useState(ui.configuration.nextIDConfig?.enable) const personaConnectStatus = usePersonaConnectStatus() @@ -110,13 +110,20 @@ export function useNextIDConnectStatus() { ) if (isBound) return NextIDVerificationStatus.Verified - if (isOpenedFromButton) { + if (isOpenedFromButton && !disableInitialVerify) { verifyPersona(personaConnectStatus.currentConnectedPersona?.identifier)() } isOpenedVerifyDialog = true isOpenedFromButton = false return NextIDVerificationStatus.WaitingVerify - }, [username, enableNextID, isOpenedVerifyDialog, personaConnectStatus, currentPersonaIdentifier.value]) + }, [ + username, + enableNextID, + isOpenedVerifyDialog, + personaConnectStatus, + currentPersonaIdentifier.value, + disableInitialVerify, + ]) return { isVerified: VerificationStatus === NextIDVerificationStatus.Verified, diff --git a/packages/mask/src/components/InjectedComponents/SetupGuide.tsx b/packages/mask/src/components/InjectedComponents/SetupGuide.tsx index 04d5aac23cc1..c8481c53408d 100644 --- a/packages/mask/src/components/InjectedComponents/SetupGuide.tsx +++ b/packages/mask/src/components/InjectedComponents/SetupGuide.tsx @@ -20,7 +20,6 @@ import { fromHex, NextIDAction, EnhanceableSite, - CrossIsolationMessages, EncryptionTargetType, } from '@masknet/shared-base' import Services from '../../extension/service' @@ -101,12 +100,6 @@ function SetupGuideUI(props: SetupGuideUIProps) { return Services.Identity.queryPersona(persona) }, [persona]) - useEffect(() => { - return CrossIsolationMessages.events.verifyNextID.on(() => { - setStep(SetupGuideStep.VerifyOnNextID) - }) - }, []) - const onConnect = async () => { const id = ProfileIdentifier.of(ui.networkIdentifier, username) if (!id.some) return diff --git a/packages/mask/src/components/InjectedComponents/ToolboxUnstyled.tsx b/packages/mask/src/components/InjectedComponents/ToolboxUnstyled.tsx index a844efcda9cb..0de1e96c52ee 100644 --- a/packages/mask/src/components/InjectedComponents/ToolboxUnstyled.tsx +++ b/packages/mask/src/components/InjectedComponents/ToolboxUnstyled.tsx @@ -23,7 +23,7 @@ import { useChainIdMainnet, useRecentTransactions, } from '@masknet/plugin-infra/web3' -import { useCallback, useEffect } from 'react' +import { useCallback } from 'react' import { WalletIcon } from '@masknet/shared' import { useRemoteControlledDialog } from '@masknet/shared-base-ui' import { WalletMessages } from '../../plugins/Wallet/messages' @@ -33,7 +33,6 @@ import GuideStep from '../GuideStep' import { AccountBalanceWalletIcon } from '@masknet/icons' import { makeStyles } from '@masknet/theme' import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord' -import { NextIDVerificationStatus, useNextIDConnectStatus } from '../DataSource/useNextID' import { MaskIcon } from '../../resources/MaskIcon' const useStyles = makeStyles<{ iconFontSize?: string }>()((theme, { iconFontSize = '1.5rem' }) => ({ @@ -135,7 +134,6 @@ function ToolboxHintForApplication(props: ToolboxHintProps) { function ToolboxHintForWallet(props: ToolboxHintProps) { const { t } = useI18N() - const nextIDConnectStatus = useNextIDConnectStatus() const { ListItemButton = MuiListItemButton, ListItemText = MuiListItemText, @@ -154,14 +152,6 @@ function ToolboxHintForWallet(props: ToolboxHintProps) { const networkDescriptor = useNetworkDescriptor() const providerDescriptor = useProviderDescriptor() - useEffect(() => { - const { status, isVerified, action } = nextIDConnectStatus - if (isVerified || status === NextIDVerificationStatus.WaitingLocalConnect) return - if (action) { - action() - } - }, [nextIDConnectStatus.status]) - return ( diff --git a/packages/mask/src/components/shared/ApplicationBoard.tsx b/packages/mask/src/components/shared/ApplicationBoard.tsx index 0cf6f9bcd276..ca22e70fe9ea 100644 --- a/packages/mask/src/components/shared/ApplicationBoard.tsx +++ b/packages/mask/src/components/shared/ApplicationBoard.tsx @@ -11,7 +11,7 @@ import { useI18N } from '../../utils' import { Application, getUnlistedApp } from './ApplicationSettingPluginList' import { ApplicationRecommendArea } from './ApplicationRecommendArea' import { useRemoteControlledDialog } from '@masknet/shared-base-ui' -import { useNextIDConnectStatus } from '../DataSource/useNextID' +import { useNextIDConnectStatus, verifyPersona } from '../DataSource/useNextID' import { usePersonaConnectStatus } from '../DataSource/usePersonaConnectStatus' import { usePersonaAgainstSNSConnectStatus } from '../DataSource/usePersonaAgainstSNSConnectStatus' import { WalletMessages } from '../../plugins/Wallet/messages' @@ -313,7 +313,7 @@ const ApplicationEntryStatusContext = createContext) { const personaConnectStatus = usePersonaConnectStatus() - const nextIDConnectStatus = useNextIDConnectStatus() + const nextIDConnectStatus = useNextIDConnectStatus(true) const { value: ApplicationCurrentStatus, @@ -322,14 +322,19 @@ function ApplicationEntryStatusProvider(props: PropsWithChildren<{}>) { } = usePersonaAgainstSNSConnectStatus() useEffect(() => { - nextIDConnectStatus.reset() retry() + nextIDConnectStatus.reset() return MaskMessages.events.currentPersonaIdentifier.on(() => { retry() nextIDConnectStatus.reset() }) }, []) + const personaNextIDReset = useCallback(() => { + nextIDConnectStatus.reset() + verifyPersona(personaConnectStatus.currentConnectedPersona?.identifier)() + }, [nextIDConnectStatus, personaConnectStatus]) + const { isSNSConnectToCurrentPersona, currentPersonaPublicKey, currentSNSConnectedPersonaPublicKey } = ApplicationCurrentStatus ?? {} @@ -337,7 +342,7 @@ function ApplicationEntryStatusProvider(props: PropsWithChildren<{}>) { Date: Tue, 12 Jul 2022 17:42:38 +0800 Subject: [PATCH 087/128] fix: add priceToken property at FungibleToken (#6768) --- packages/mask/src/plugins/Avatar/hooks/useNFT.ts | 2 +- packages/web3-providers/src/opensea/index.ts | 6 ++++++ packages/web3-providers/src/opensea/types.ts | 1 + packages/web3-shared/base/src/specs/index.ts | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/mask/src/plugins/Avatar/hooks/useNFT.ts b/packages/mask/src/plugins/Avatar/hooks/useNFT.ts index 6df8705b0501..292cdd076893 100644 --- a/packages/mask/src/plugins/Avatar/hooks/useNFT.ts +++ b/packages/mask/src/plugins/Avatar/hooks/useNFT.ts @@ -24,7 +24,7 @@ export function useNFT( return { amount: asset?.price?.[CurrencyType.USD] ?? '0', name: asset?.contract?.name ?? '', - symbol: asset?.paymentTokens?.[0].symbol ?? 'ETH', + symbol: asset?.priceToken?.symbol ?? asset?.paymentTokens?.[0].symbol ?? 'ETH', image: asset?.metadata?.imageURL ?? '', owner: asset?.owner?.address ?? asset?.ownerId ?? '', slug: asset?.collection?.slug ?? '', diff --git a/packages/web3-providers/src/opensea/index.ts b/packages/web3-providers/src/opensea/index.ts index 5794f4d74f5d..a5ddde231e6f 100644 --- a/packages/web3-providers/src/opensea/index.ts +++ b/packages/web3-providers/src/opensea/index.ts @@ -169,6 +169,12 @@ function createNFTAsset(chainId: ChainId, asset: OpenSeaResponse): NonFungibleAs asset.last_sale?.payment_token.decimals, )?.toString(), }, + priceToken: createTokenDetailed(chainId, { + address: asset.last_sale?.payment_token.address ?? '', + decimals: Number(asset.last_sale?.payment_token.decimals ?? '0'), + name: '', + symbol: asset.last_sale?.payment_token.symbol ?? '', + }), orders: asset.orders ?.sort((a, z) => new BigNumber(getOrderUSDPrice(z.current_price, z.payment_token_contract?.usd_price) ?? 0) diff --git a/packages/web3-providers/src/opensea/types.ts b/packages/web3-providers/src/opensea/types.ts index 5a32c0d2484a..b42f69ddc804 100644 --- a/packages/web3-providers/src/opensea/types.ts +++ b/packages/web3-providers/src/opensea/types.ts @@ -61,6 +61,7 @@ export interface AssetEvent { decimals: number symbol: string usd_price: string + address: string } quantity: string } diff --git a/packages/web3-shared/base/src/specs/index.ts b/packages/web3-shared/base/src/specs/index.ts index 7d188f04d76d..8f43731cfae3 100644 --- a/packages/web3-shared/base/src/specs/index.ts +++ b/packages/web3-shared/base/src/specs/index.ts @@ -373,6 +373,7 @@ export interface NonFungibleAsset extends NonFungibleToken< orders?: Array> events?: Array> paymentTokens?: Array> + priceToken?: FungibleToken } /** From d4f23a6d9c080a0d47ea96340ee305f4aee362d0 Mon Sep 17 00:00:00 2001 From: Randolph314 <97870249+Randolph314@users.noreply.github.com> Date: Tue, 12 Jul 2022 18:02:38 +0800 Subject: [PATCH 088/128] fix : token security dialog width (#6770) * feat: change dialog width * feat: delete useless code Co-authored-by: Randolph <840094513@qq.com> --- .../TokenSecurity/CheckSecurityDialog.tsx | 21 +++++++------------ .../components/SecurityPanel.tsx | 8 +------ 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/packages/shared/src/UI/components/TokenSecurity/CheckSecurityDialog.tsx b/packages/shared/src/UI/components/TokenSecurity/CheckSecurityDialog.tsx index 868420c0fc9d..a47eb982e03d 100644 --- a/packages/shared/src/UI/components/TokenSecurity/CheckSecurityDialog.tsx +++ b/packages/shared/src/UI/components/TokenSecurity/CheckSecurityDialog.tsx @@ -12,13 +12,12 @@ import { useFungibleToken, useFungibleTokenPrice } from '@masknet/plugin-infra/w import { NetworkPluginID } from '@masknet/web3-shared-base' const useStyles = makeStyles()((theme) => ({ - root: { - width: 600, - }, content: { - height: 510, - maxHeight: 510, - padding: 16, + margin: 0, + padding: '0px !important', + '::-webkit-scrollbar': { + display: 'none', + }, }, footer: { boxShadow: @@ -30,7 +29,7 @@ const useStyles = makeStyles()((theme) => ({ }, })) -export interface BuyTokenDialogProps extends withClasses { +export interface BuyTokenDialogProps { open: boolean onClose(): void tokenSecurity: TokenSecurity @@ -53,13 +52,9 @@ export function CheckSecurityDialog(props: BuyTokenDialogProps) { }, [tokenSecurity]) return ( - + - + {loadingToken && (
diff --git a/packages/shared/src/UI/components/TokenSecurity/components/SecurityPanel.tsx b/packages/shared/src/UI/components/TokenSecurity/components/SecurityPanel.tsx index 7935137dde87..b2f55f3a569b 100644 --- a/packages/shared/src/UI/components/TokenSecurity/components/SecurityPanel.tsx +++ b/packages/shared/src/UI/components/TokenSecurity/components/SecurityPanel.tsx @@ -27,17 +27,11 @@ const useStyles = makeStyles()((theme) => ({ fontWeight: 700, fontSize: 18, }, - root: { - width: '600px', - }, detectionCard: { backgroundColor: theme.palette.background.default, }, detectionCollection: { overflowY: 'auto', - '&::-webkit-scrollbar': { - display: 'none', - }, }, icon: { width: '48px', @@ -101,7 +95,7 @@ export const SecurityPanel = memo(({ tokenSecurity, tokenInfo, t }, [riskyFactors, attentionFactors]) return ( - + Date: Tue, 12 Jul 2022 19:00:25 +0800 Subject: [PATCH 089/128] fix: crash --- packages/mask/src/web3/UI/ChainBoundary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mask/src/web3/UI/ChainBoundary.tsx b/packages/mask/src/web3/UI/ChainBoundary.tsx index 18ce218c767a..9b385174ecfb 100644 --- a/packages/mask/src/web3/UI/ChainBoundary.tsx +++ b/packages/mask/src/web3/UI/ChainBoundary.tsx @@ -138,7 +138,7 @@ export function ChainBoundary(props: ChainBoundaryPro ]) const switchButtonDisabled = useMemo(() => { - return !(actualProviderDescriptor.enableRequirements?.supportedChainIds?.includes(expectedChainId) ?? false) + return !(actualProviderDescriptor?.enableRequirements?.supportedChainIds?.includes(expectedChainId) ?? false) }, [expectedChainId, actualProviderDescriptor]) const renderBox = (children?: React.ReactNode, tips?: string) => { From 8cd373452ba99bf2b0dd227cae08cab78fbdaac7 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Tue, 12 Jul 2022 19:07:30 +0800 Subject: [PATCH 090/128] fix: lucky drop infinite loading --- .../plugins/RedPacket/SNSAdaptor/RedPacketInHistoryList.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketInHistoryList.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketInHistoryList.tsx index 6a8665b28fa0..90acf6bfc52f 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketInHistoryList.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketInHistoryList.tsx @@ -12,7 +12,6 @@ import REDPACKET_ABI from '@masknet/web3-contracts/abis/HappyRedPacketV4.json' import intervalToDuration from 'date-fns/intervalToDuration' import nextDay from 'date-fns/nextDay' import ActionButton from '../../../extension/options-page/DashboardComponents/ActionButton' -import { useI18N as useBaseI18N } from '../../../utils' import { Translate, useI18N } from '../locales' import { dateTimeFormat } from '../../ITO/assets/formatDate' import { StyledLinearProgress } from '../../ITO/SNSAdaptor/StyledLinearProgress' @@ -181,7 +180,6 @@ export interface RedPacketInHistoryListProps { } export function RedPacketInHistoryList(props: RedPacketInHistoryListProps) { const { history, onSelect } = props - const i18n = useBaseI18N() const t = useI18N() const { classes } = useStyles() const account = useAccount(NetworkPluginID.PLUGIN_EVM) @@ -245,7 +243,7 @@ export function RedPacketInHistoryList(props: RedPacketInHistoryListProps) { await refundCallback() revalidateAvailability() } - if (canSend) onSelect(removeUselessSendParams({ ...history, token: historyToken })) + if (canSend) onSelect(removeUselessSendParams({ ...history, token: historyToken, rpid })) }, [onSelect, refundCallback, canRefund, canSend, history, historyToken]) // #region password lost tips From a2a00b3ff52db21ab351a45440456c6ba36ee3fd Mon Sep 17 00:00:00 2001 From: Randolph314 <97870249+Randolph314@users.noreply.github.com> Date: Tue, 12 Jul 2022 19:09:24 +0800 Subject: [PATCH 091/128] feat: add empty status of main page (#6772) Co-authored-by: Randolph <840094513@qq.com> --- .../InjectedComponents/ProfileTabContent.tsx | 8 ++------ .../mask/src/plugins/NextID/components/NextIdPage.tsx | 4 ++-- .../Web3Profile/src/SNSAdaptor/components/Main.tsx | 10 +++++++++- packages/plugins/Web3Profile/src/locales/en-US.json | 3 ++- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx b/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx index 15f556b7f6ce..361db94198cc 100644 --- a/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx +++ b/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx @@ -12,7 +12,7 @@ import { useSocialAddressListAll, useAvailablePlugins } from '@masknet/plugin-in import { ConcealableTabs } from '@masknet/shared' import { CrossIsolationMessages, EMPTY_LIST, NextIDPlatform } from '@masknet/shared-base' import { makeStyles, useStylesExtends } from '@masknet/theme' -import { Box, CircularProgress, Typography } from '@mui/material' +import { Box, CircularProgress } from '@mui/material' import { activatedSocialNetworkUI } from '../../social-network' import { isTwitter } from '../../social-network-adaptor/twitter.com/base' import { MaskMessages, sortPersonaBindings, useI18N } from '../../utils' @@ -209,17 +209,13 @@ export function ProfileTabContent(props: ProfileTabContentProps) { return (
- {tabs.length ? ( + {tabs.length && ( tabs={tabs} selectedId={selectedTabId} onChange={setSelectedTab} tail={isOwn && } /> - ) : ( - - {t('web3_tab_hint')} - )}
{component}
diff --git a/packages/mask/src/plugins/NextID/components/NextIdPage.tsx b/packages/mask/src/plugins/NextID/components/NextIdPage.tsx index 5d4bf79ba397..9ce8a11f2529 100644 --- a/packages/mask/src/plugins/NextID/components/NextIdPage.tsx +++ b/packages/mask/src/plugins/NextID/components/NextIdPage.tsx @@ -94,12 +94,12 @@ const useStyles = makeStyles()((theme) => ({ marginTop: 2, }, item1: { - color: theme.palette.maskColor.second, + color: '#767f8d', fontSize: '14', fontWeight: 400, }, item2: { - color: theme.palette.maskColor.main, + color: '#07101B', fontSize: '14', fontWeight: 500, marginLeft: '2px', diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/components/Main.tsx b/packages/plugins/Web3Profile/src/SNSAdaptor/components/Main.tsx index bc5e7a4e03ad..528c8fd39ea9 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/components/Main.tsx +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/components/Main.tsx @@ -3,6 +3,9 @@ import type { PersonaInformation } from '@masknet/shared-base' import type { IdentityResolved } from '@masknet/plugin-infra' import type { AccountType } from '../types' import type { CURRENT_STATUS } from '../../constants' +import { Empty } from './Empty' +import { Box } from '@mui/material' +import { useI18N } from '../../locales' interface MainProps { persona?: PersonaInformation openImageSetting: (status: CURRENT_STATUS, accountId: string) => void @@ -10,6 +13,7 @@ interface MainProps { accountList?: AccountType[] } export function Main(props: MainProps) { + const t = useI18N() const { openImageSetting, currentVisitingProfile, accountList } = props return (
@@ -23,7 +27,11 @@ export function Main(props: MainProps) { currentPersona={currentVisitingProfile} isCurrent={account?.identity === currentVisitingProfile?.identifier?.userId?.toLowerCase()} /> - ))} + )) ?? ( + + + + )}
) } diff --git a/packages/plugins/Web3Profile/src/locales/en-US.json b/packages/plugins/Web3Profile/src/locales/en-US.json index 8116d5297dfd..f2adcfa8b843 100644 --- a/packages/plugins/Web3Profile/src/locales/en-US.json +++ b/packages/plugins/Web3Profile/src/locales/en-US.json @@ -52,5 +52,6 @@ "no_unlisted_collection": " Click to show your {{collection}} on Web3 profile.", "wallet_setting_hint": "Toggle the button to manage wallet display settings.", "no_authenticated_wallet": "That hasn't been authenticated yet.", - "no_items_found": "No Items found." + "no_items_found": "No Items found.", + "account_empty": "Please verify this persona to set your Web3 profile." } From 931da3c09d314ebaf9ce960bac4e427179e5128e Mon Sep 17 00:00:00 2001 From: BillyS Date: Tue, 12 Jul 2022 19:25:49 +0800 Subject: [PATCH 092/128] fix: add padding to dialog content (#6773) --- .../mask/src/components/CompositionDialog/Composition.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/mask/src/components/CompositionDialog/Composition.tsx b/packages/mask/src/components/CompositionDialog/Composition.tsx index 9098d7c87131..1dabce46e0c6 100644 --- a/packages/mask/src/components/CompositionDialog/Composition.tsx +++ b/packages/mask/src/components/CompositionDialog/Composition.tsx @@ -26,6 +26,9 @@ const useStyles = makeStyles()({ hideDialogRoot: { visibility: 'hidden', }, + dialogContent: { + padding: '20px 24px', + }, }) export interface PostDialogProps { type?: 'popup' | 'timeline' @@ -114,7 +117,7 @@ export function Composition({ type = 'timeline', requireClipboardPermission }: P open={open} onClose={onClose} title={t('post_dialog__title')}> - + Date: Tue, 12 Jul 2022 19:33:50 +0800 Subject: [PATCH 093/128] fix: plugin close dialog ui --- .../shared/CheckSecurityConfirmDialog.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/mask/src/components/shared/CheckSecurityConfirmDialog.tsx b/packages/mask/src/components/shared/CheckSecurityConfirmDialog.tsx index e168e3bcb314..af7dd35fd930 100644 --- a/packages/mask/src/components/shared/CheckSecurityConfirmDialog.tsx +++ b/packages/mask/src/components/shared/CheckSecurityConfirmDialog.tsx @@ -6,13 +6,10 @@ import { useI18N } from '../../utils' const useStyles = makeStyles()((theme) => ({ paper: { maxWidth: '320px !important', - padding: '24px', + padding: 0, }, content: { - marginLeft: 12, - marginRight: 12, - paddingLeft: 0, - paddingRight: 0, + padding: '48px 24px', '&::-webkit-scrollbar': { display: 'none', }, @@ -29,7 +26,7 @@ const useStyles = makeStyles()((theme) => ({ }, })) -interface CheckSecurityConfirmDialogProps extends withClasses { +interface CheckSecurityConfirmDialogProps { open: boolean onConfirm: () => void onClose: () => void @@ -41,7 +38,10 @@ function CheckSecurityConfirmDialog(props: CheckSecurityConfirmDialogProps) { const { classes } = useStyles() return ( - + {t('close_check_security')} From d351dd446ca65f9b580515c1809c9e78539215f1 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Tue, 12 Jul 2022 19:46:03 +0800 Subject: [PATCH 094/128] chore: nft lucky drop history --- .../RedPacket/SNSAdaptor/hooks/useNftAvailabilityComputed.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/hooks/useNftAvailabilityComputed.ts b/packages/mask/src/plugins/RedPacket/SNSAdaptor/hooks/useNftAvailabilityComputed.ts index c2f1ffd50d5c..2fbf18f4a9ce 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/hooks/useNftAvailabilityComputed.ts +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/hooks/useNftAvailabilityComputed.ts @@ -12,7 +12,7 @@ import { useAvailabilityNftRedPacket } from './useAvailabilityNftRedPacket' */ export function useNftAvailabilityComputed(account: string, payload: NftRedPacketJSONPayload) { const chainId = useChainId(NetworkPluginID.PLUGIN_EVM) - const asyncResult = useAvailabilityNftRedPacket(payload?.rpid, account) + const asyncResult = useAvailabilityNftRedPacket(payload?.rpid, account, chainId) const result = asyncResult const availability = result.value From 1c971b6aa12de0df6e7d846ed55ef1598701a69c Mon Sep 17 00:00:00 2001 From: guanbinrui <52657989+guanbinrui@users.noreply.github.com> Date: Tue, 12 Jul 2022 20:07:12 +0800 Subject: [PATCH 095/128] fix: nonce confliction (#6771) * feat(lucky drop): pre gas minus (#6467) * feat(lucky drop): pre gas minus * chore: reply code review * chore: solve error * fix: solve conflict * chore: format balance * chore: apply confition apply only sum of gas and total greater than balance * chore: increase estimate gas * chore: format significant * chore: reply code review * chore: format significant * chore: i18n * chore: reply code review * chore: use big number * chore: add useTransactionValue hook * refactor: unlock nft Co-authored-by: Hancheng Zhou --- .../TransactionFormatter/descriptors/ERC20.ts | 1 + .../TransactionFormatter/descriptors/ERC721.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts index cd6a08c79c1d..6ce497bb421d 100644 --- a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts +++ b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts @@ -14,6 +14,7 @@ export class ERC20Descriptor implements TransactionDescriptor { }) for (const method of context.methods) { const parameters = method.parameters + switch (method.name) { case 'approve': if (parameters?.spender === undefined || parameters?.value === undefined) break diff --git a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts index bcbf4dea0356..0048b51af5a8 100644 --- a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts +++ b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts @@ -1,5 +1,6 @@ import type { TransactionContext } from '@masknet/web3-shared-base' import type { ChainId, TransactionParameter } from '@masknet/web3-shared-evm' +import { Web3StateSettings } from '../../../settings' import type { TransactionDescriptor } from '../types' export class ERC721Descriptor implements TransactionDescriptor { @@ -10,6 +11,20 @@ export class ERC721Descriptor implements TransactionDescriptor { const parameters = method.parameters switch (method.name) { + case 'approve': + if (parameters?.to === undefined || parameters?.tokenId === undefined) break + + const connection = await Web3StateSettings.value.Connection?.getConnection?.({ + chainId: context.chainId, + }) + const contract = await connection?.getNonFungibleTokenContract(context.to) + + return { + chainId: context.chainId, + title: `Unlock ${contract?.symbol ?? 'token'} contract`, + description: `Unlock ${contract?.symbol ?? 'token'} contract`, + successfulDescription: `${contract?.symbol ?? 'token'} is unlocked successfully.`, + } case 'setApprovalForAll': if (parameters?.operator === undefined || parameters?.approved === undefined) break return { From 4f8b0ca55c2f28f818d09e8a5409055d8d9862cb Mon Sep 17 00:00:00 2001 From: guanbinrui <52657989+guanbinrui@users.noreply.github.com> Date: Tue, 12 Jul 2022 20:08:39 +0800 Subject: [PATCH 096/128] Revert "fix: nonce confliction (#6771)" (#6774) This reverts commit 1c971b6aa12de0df6e7d846ed55ef1598701a69c. --- .../TransactionFormatter/descriptors/ERC20.ts | 1 - .../TransactionFormatter/descriptors/ERC721.ts | 15 --------------- 2 files changed, 16 deletions(-) diff --git a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts index 6ce497bb421d..cd6a08c79c1d 100644 --- a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts +++ b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts @@ -14,7 +14,6 @@ export class ERC20Descriptor implements TransactionDescriptor { }) for (const method of context.methods) { const parameters = method.parameters - switch (method.name) { case 'approve': if (parameters?.spender === undefined || parameters?.value === undefined) break diff --git a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts index 0048b51af5a8..bcbf4dea0356 100644 --- a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts +++ b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts @@ -1,6 +1,5 @@ import type { TransactionContext } from '@masknet/web3-shared-base' import type { ChainId, TransactionParameter } from '@masknet/web3-shared-evm' -import { Web3StateSettings } from '../../../settings' import type { TransactionDescriptor } from '../types' export class ERC721Descriptor implements TransactionDescriptor { @@ -11,20 +10,6 @@ export class ERC721Descriptor implements TransactionDescriptor { const parameters = method.parameters switch (method.name) { - case 'approve': - if (parameters?.to === undefined || parameters?.tokenId === undefined) break - - const connection = await Web3StateSettings.value.Connection?.getConnection?.({ - chainId: context.chainId, - }) - const contract = await connection?.getNonFungibleTokenContract(context.to) - - return { - chainId: context.chainId, - title: `Unlock ${contract?.symbol ?? 'token'} contract`, - description: `Unlock ${contract?.symbol ?? 'token'} contract`, - successfulDescription: `${contract?.symbol ?? 'token'} is unlocked successfully.`, - } case 'setApprovalForAll': if (parameters?.operator === undefined || parameters?.approved === undefined) break return { From d6cd069887ff88f4fc3c580ecf90d43987e22680 Mon Sep 17 00:00:00 2001 From: guanbinrui <52657989+guanbinrui@users.noreply.github.com> Date: Tue, 12 Jul 2022 20:21:53 +0800 Subject: [PATCH 097/128] refactor: unlock nft (#6769) --- .../Wallet/ContractInteraction/index.tsx | 2 +- .../SNSAdaptor/components/ConsoleContent.tsx | 45 +++++++++++++++++++ .../EVM/src/state/Connection/connection.ts | 34 +++++++------- .../TransactionFormatter/descriptors/ERC20.ts | 1 + .../descriptors/ERC721.ts | 36 ++++++++++++--- 5 files changed, 96 insertions(+), 22 deletions(-) diff --git a/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx b/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx index 1f1b915f7a3d..b3d8ffcf90dc 100644 --- a/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx +++ b/packages/mask/src/extension/popups/pages/Wallet/ContractInteraction/index.tsx @@ -181,7 +181,7 @@ const ContractInteraction = memo(() => { for (const method of methods) { const parameters = method.parameters - if (method.name === 'approve' && parameters?.value) { + if (method.name === 'approve' || method.name === 'setApprovalForAll') { return { isNativeTokenInteraction: false, typeName: request.formatterTransaction?.title, diff --git a/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx b/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx index c9e158ea9ec3..c94174ec8b38 100644 --- a/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx +++ b/packages/plugins/Debugger/src/SNSAdaptor/components/ConsoleContent.tsx @@ -61,6 +61,7 @@ export function ConsoleContent(props: ConsoleContentProps) { const { value: balance = '0' } = useBalance() const { value: blockNumber = 0 } = useBlockNumber() const { value: blockTimestamp = 0 } = useBlockTimestamp() + const onTransferCallback = useCallback(() => { if (!NATIVE_TOKEN_ADDRESS) return return connection.transferFungibleToken( @@ -70,6 +71,26 @@ export function ConsoleContent(props: ConsoleContentProps) { ) }, [connection]) + const onApproveFungibleTokenCallback = useCallback(() => { + if (pluginID !== NetworkPluginID.PLUGIN_EVM) return + if (chainId !== ChainId.Mainnet) return + return connection.approveFungibleToken( + '0x6B175474E89094C44Da98b954EedeAC495271d0F', + '0x31f42841c2db5173425b5223809cf3a38fede360', + '1', + ) + }, [pluginID, connection]) + + const onApproveNonFungibleTokenCallback = useCallback(() => { + if (pluginID !== NetworkPluginID.PLUGIN_EVM) return + if (chainId !== ChainId.Mainnet) return + return connection.approveNonFungibleToken( + '0xd945f759d422ae30a6166838317b937de08380e3', + '0x31f42841c2db5173425b5223809cf3a38fede360', + '71050', + ) + }, [pluginID, connection]) + const onSignMessage = useCallback( async (type?: string) => { const message = 'Hello World' @@ -210,6 +231,30 @@ export function ConsoleContent(props: ConsoleContentProps) { + + + + Approve Fungible Token + + + + + + + + + + Approve Non-Fungible Token + + + + + + diff --git a/packages/plugins/EVM/src/state/Connection/connection.ts b/packages/plugins/EVM/src/state/Connection/connection.ts index cd439da4730d..56f6d443bbb8 100644 --- a/packages/plugins/EVM/src/state/Connection/connection.ts +++ b/packages/plugins/EVM/src/state/Connection/connection.ts @@ -337,26 +337,30 @@ class Connection implements EVM_Connection { const ERC721_ENUMERABLE_INTERFACE_ID = '0x780e9d63' const ERC1155_ENUMERABLE_INTERFACE_ID = '0xd9b67a26' - const erc165Contract = await this.getWeb3Contract(address, ERC165ABI as AbiItem[], options) + try { + const erc165Contract = await this.getWeb3Contract(address, ERC165ABI as AbiItem[], options) - const isERC165 = await erc165Contract?.methods - .supportsInterface(ERC165_INTERFACE_ID) - .call({ from: options.account }) + const isERC165 = await erc165Contract?.methods + .supportsInterface(ERC165_INTERFACE_ID) + .call({ from: options.account }) - const isERC721 = await erc165Contract?.methods - .supportsInterface(ERC721_ENUMERABLE_INTERFACE_ID) - .call({ from: options.account }) - if (isERC165 && isERC721) return SchemaType.ERC721 + const isERC721 = await erc165Contract?.methods + .supportsInterface(ERC721_ENUMERABLE_INTERFACE_ID) + .call({ from: options.account }) + if (isERC165 && isERC721) return SchemaType.ERC721 - const isERC1155 = await erc165Contract?.methods - .supportsInterface(ERC1155_ENUMERABLE_INTERFACE_ID) - .call({ from: options.account }) - if (isERC165 && isERC1155) return SchemaType.ERC1155 + const isERC1155 = await erc165Contract?.methods + .supportsInterface(ERC1155_ENUMERABLE_INTERFACE_ID) + .call({ from: options.account }) + if (isERC165 && isERC1155) return SchemaType.ERC1155 - const isERC20 = (await this.getCode(address, options)) !== '0x' - if (isERC20) return SchemaType.ERC20 + const isERC20 = (await this.getCode(address, options)) !== '0x' + if (isERC20) return SchemaType.ERC20 - return + return + } catch { + return + } } async getNonFungibleToken( address: string, diff --git a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts index cd6a08c79c1d..6ce497bb421d 100644 --- a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts +++ b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC20.ts @@ -14,6 +14,7 @@ export class ERC20Descriptor implements TransactionDescriptor { }) for (const method of context.methods) { const parameters = method.parameters + switch (method.name) { case 'approve': if (parameters?.spender === undefined || parameters?.value === undefined) break diff --git a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts index bcbf4dea0356..71e6cb0eb5cf 100644 --- a/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts +++ b/packages/plugins/EVM/src/state/TransactionFormatter/descriptors/ERC721.ts @@ -1,8 +1,17 @@ import type { TransactionContext } from '@masknet/web3-shared-base' import type { ChainId, TransactionParameter } from '@masknet/web3-shared-evm' +import { Web3StateSettings } from '../../../settings' import type { TransactionDescriptor } from '../types' export class ERC721Descriptor implements TransactionDescriptor { + async getContractSymbol(chainId: ChainId, address: string) { + const connection = await Web3StateSettings.value.Connection?.getConnection?.({ + chainId: chainId, + }) + const contract = await connection?.getNonFungibleTokenContract(address) + return contract?.symbol + } + async compute(context: TransactionContext) { if (!context.methods?.length) return @@ -10,16 +19,31 @@ export class ERC721Descriptor implements TransactionDescriptor { const parameters = method.parameters switch (method.name) { - case 'setApprovalForAll': + case 'approve': { + if (parameters?.to === undefined || parameters?.tokenId === undefined) break + + const symbol = await this.getContractSymbol(context.chainId, context.to) + + return { + chainId: context.chainId, + title: `Unlock ${symbol ?? 'token'} contract`, + description: `Unlock ${symbol ?? 'token'} contract`, + successfulDescription: `${symbol ?? 'token'} is unlocked successfully.`, + } + } + case 'setApprovalForAll': { if (parameters?.operator === undefined || parameters?.approved === undefined) break + + const action = parameters?.approved === false ? 'Revoke' : 'Unlock' + const symbol = await this.getContractSymbol(context.chainId, context.to) + return { chainId: context.chainId, - title: parameters?.approved === false ? 'Revoke' : 'Unlock', - description: `${ - parameters?.approved === false ? 'Revoke the approval for' : 'Unlock' - } the token.`, - successfulDescription: 'Revoke the approval successfully.', + title: `${action} ${symbol ?? 'token'} contract`, + description: `${action} ${symbol ?? 'token'} contract`, + successfulDescription: `${action} the approval successfully.`, } + } default: return From 53d4625a1ece281c5684e96fd39a09b0d565ff21 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Tue, 12 Jul 2022 20:59:27 +0800 Subject: [PATCH 098/128] fix: nft red packet button ui --- packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketNft.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketNft.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketNft.tsx index f1c3695a0283..0f2fe36b4a7f 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketNft.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketNft.tsx @@ -417,6 +417,7 @@ export function RedPacketNft({ payload }: RedPacketNftProps) { + return ( + + ) }, [personaConnectStatus, t]) const { value: currentPersona, loading: loadingPersona } = useAsyncRetry(async () => { From 5a88f1a77fefb8f59b7b1359fb02b921c0e15351 Mon Sep 17 00:00:00 2001 From: guanbinrui <52657989+guanbinrui@users.noreply.github.com> Date: Tue, 12 Jul 2022 22:32:32 +0800 Subject: [PATCH 103/128] refactor: remove legacy payload (#6776) --- .../encryption/src/image-steganography/index.ts | 3 +-- .../components/CompositionDialog/useSubmit.ts | 2 +- .../mask/src/resources/image-payload/index.ts | 1 - .../image-payload/wallet/payload-eth.png | Bin 58027 -> 0 bytes 4 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 packages/mask/src/resources/image-payload/wallet/payload-eth.png diff --git a/packages/encryption/src/image-steganography/index.ts b/packages/encryption/src/image-steganography/index.ts index baf1a29d041d..1a17b02459e0 100644 --- a/packages/encryption/src/image-steganography/index.ts +++ b/packages/encryption/src/image-steganography/index.ts @@ -6,7 +6,7 @@ import { omit } from 'lodash-unified' import { getDimension } from './utils' export { GrayscaleAlgorithm } from '@dimensiondev/stego-js/cjs/grayscale.js' -export type ImageTemplateTypes = 'v2' | 'eth' +export type ImageTemplateTypes = 'v2' interface Dimension { width: number @@ -34,7 +34,6 @@ const dimensionPreset: Preset[] = [ { width: 1200, height: 680, - template: 'eth', mask: new URL('./masks/mask-transparent.png', import.meta.url).toString(), options: { cropEdgePixels: true, diff --git a/packages/mask/src/components/CompositionDialog/useSubmit.ts b/packages/mask/src/components/CompositionDialog/useSubmit.ts index 398411a21650..0556fcc621aa 100644 --- a/packages/mask/src/components/CompositionDialog/useSubmit.ts +++ b/packages/mask/src/components/CompositionDialog/useSubmit.ts @@ -85,7 +85,7 @@ function decorateEncryptedText( if (RedPacketMetadataReader(meta).ok || RedPacketNftMetadataReader(meta).ok) { return [ - 'eth', + 'v2', hasOfficialAccount ? t('additional_post_box__encrypted_post_pre_red_packet_twitter_official_account', { encrypted, diff --git a/packages/mask/src/resources/image-payload/index.ts b/packages/mask/src/resources/image-payload/index.ts index 5657f8a46107..ea5d95676b1a 100644 --- a/packages/mask/src/resources/image-payload/index.ts +++ b/packages/mask/src/resources/image-payload/index.ts @@ -2,5 +2,4 @@ import type { ImageTemplateTypes } from '@masknet/encryption' export const ImagePayloadURLs: Readonly> = { v2: new URL('./normal/payload-v2.png', import.meta.url).toString(), - eth: new URL('./wallet/payload-eth.png', import.meta.url).toString(), } diff --git a/packages/mask/src/resources/image-payload/wallet/payload-eth.png b/packages/mask/src/resources/image-payload/wallet/payload-eth.png deleted file mode 100644 index e9f6d6a2614e180f226ea678b886717b328d52af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 58027 zcmc$Dhf`C}_cnr{1W^zY=?EWsf`uv|AWe`aH3XEF08#{{_fF`&DZTelLX{>EdM`qh zk|4bkdKLKbegBE~&Y7LLcV>5X&vW)U&p9_tLtT*)zyKg3BBFe!B(Ft8bhnC#h`9JZ z$?X@7(vz3BFQ*!+ItsI70ytXnzpph`KYiYe4ccqS+Uw0fSghGDi{A+JT2lEq|NPzl z0{URFdVit%;MNvv_oq-h-=miG&G2k8`+w2z2(v5hjWb zm+LoDk^A$Nhbs+hPL4a6^u77Y{lAq53+VZ0@Al>^4woAauoZjwTPt7lby?Cg-ovAI z$MQCdqV{ko0uF_HDzlAAUyJl1;L6q`y;tn*7Nv9ub7h3N(zQtMg_mkeZ}iq}> z^LV3mcQlVMTYNNAbG+Vqy3~F!Sh_n?c)Z@cJ6(9R*1S;_wKH9~H(7eL+O(b$bhOsA zQ4qc}U2wG8xP(Bggt#27G#;+}Sn;yooi5nT%Jx*& zdS1}R`1fsW?%Htt`f$Sb?;ISf)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zaF&{~Cx?ByR&UuI$>6O87KoT5oOkcyil0))P0V#;~Xd3ImZP)vcd$khPiTQn3HAwDq zV{dZ2iSw{amd1H#F7m)@u~QE;@VHVzc9PPBbheVL_aISZQ^=sn!8c2CRVq1m93s;K zU3rP)Kc8I<6_Kkpg3IchILayr4#YtZ!exbJr&Ajge~^=q(X|RCbdhZd$q3NWz#B&9 zOBJu9A0l5W&yBt?5>G1R#=XTY(b}0 zNg_6@UnXJNCsH(_i^$*H&z-i<5P1x~5v1r0?ltsMAR7;QpMO%Qci~4>%j5d%_l8e3 z+qRz<<}OMJpGgR->$KZ~U(4%;XohZAsX6xM3O*=2+3`|%OP8T=RsC6T-v;ls{+jE` zP-f1vwvYLsHj(EnazE37peAJcTbhzS>%$vWtbW9LNapb+TlRR)9=vU`uvW| z+d$QFs)y~Yj(QGW&G(-TtV&9KEQfNZn3-S(k`Sg=MLmuv7K+HP@*C9g#@1J~NZL%* znF09Y-<*BP6rJXPPH)M6F^YW7&_BgHq&Xoy=XMdiBG4wwNK{EL{Cu}##THR;2>`Q8 zs>85iy>e|oIG~o+OhDTJ;b20n!H!6}g>046)eVg&ZhgOZ`RnNqR( z5DE>_ZP38W+h=h_>kWF#LFd>*%$>7ZKabjYDjd(1?CTyE;N=%A-3ClO=2GNRi=L{FmR@Yn9r zM7L8w|NA@a|1bxV!>FF56G`(!Zv#a58e$Ojf8Hbs1kzX{Br%?Z0rCV(n1HDHNNYI4 Vf9bj;djChNp`M9uJ Date: Tue, 12 Jul 2022 22:56:31 +0800 Subject: [PATCH 104/128] fix: rounded dark button style --- .../InjectedComponents/DisabledPluginSuggestion.tsx | 2 +- .../mask/src/plugins/RedPacket/SNSAdaptor/RedPacketNft.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/mask/src/components/InjectedComponents/DisabledPluginSuggestion.tsx b/packages/mask/src/components/InjectedComponents/DisabledPluginSuggestion.tsx index 68a9c33a14b4..01f7a6f0c4c8 100644 --- a/packages/mask/src/components/InjectedComponents/DisabledPluginSuggestion.tsx +++ b/packages/mask/src/components/InjectedComponents/DisabledPluginSuggestion.tsx @@ -80,7 +80,7 @@ export function PossiblePluginSuggestionUI(props: { plugins: Plugin.DeferredDefi
- - - - - - {validationMessage || t.next()} - - - - - + + + + + + + {validationMessage || t.next()} + + + + + + ) } diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketERC721Form.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketERC721Form.tsx index e1fab8948164..a9d13f269519 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketERC721Form.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketERC721Form.tsx @@ -214,11 +214,11 @@ const useStyles = makeStyles()((theme) => { }) interface RedPacketERC721FormProps { onClose: () => void - setERC721DialogHeight?: (height: number) => void + setIsNFTRedPacketLoaded?: (x: boolean) => void } export function RedPacketERC721Form(props: RedPacketERC721FormProps) { const t = useI18N() - const { onClose, setERC721DialogHeight } = props + const { onClose, setIsNFTRedPacketLoaded } = props const { classes } = useStyles() const [open, setOpen] = useState(false) const [balance, setBalance] = useState(0) @@ -287,7 +287,7 @@ export function RedPacketERC721Form(props: RedPacketERC721FormProps) { return '' }, [tokenDetailedList.length, balance, t]) - setERC721DialogHeight?.(balance > 0 ? 690 : 350) + setIsNFTRedPacketLoaded?.(balance > 0) return ( <> diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedpacketNftConfirmDialog.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedpacketNftConfirmDialog.tsx index 6d8848871e28..980b6621a535 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedpacketNftConfirmDialog.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedpacketNftConfirmDialog.tsx @@ -11,7 +11,7 @@ import { import { InjectedDialog, NFTCardStyledAssetPlayer } from '@masknet/shared' import { useRemoteControlledDialog } from '@masknet/shared-base-ui' import classNames from 'classnames' -import { Grid, Link, Typography, DialogContent, List, ListItem } from '@mui/material' +import { Grid, Link, Typography, DialogContent, List, ListItem, Box } from '@mui/material' import { WalletConnectedBoundary } from '../../../web3/UI/WalletConnectedBoundary' import LaunchIcon from '@mui/icons-material/Launch' import { PluginWalletStatusBar, useI18N as useBaseI18N } from '../../../utils' @@ -32,6 +32,7 @@ import { ChainBoundary } from '../../../web3/UI/ChainBoundary' const useStyles = makeStyles()((theme) => ({ root: { fontSize: 16, + height: 700, }, link: { display: 'flex', @@ -85,7 +86,7 @@ const useStyles = makeStyles()((theme) => ({ marginBottom: theme.spacing(2.5), background: theme.palette.mode === 'light' ? '#fff' : '#2F3336', width: 120, - height: 180, + height: 195, overflow: 'hidden', }, nftImg: { @@ -320,28 +321,30 @@ export function RedpacketNftConfirmDialog(props: RedpacketNftConfirmDialogProps) - - - - - {t.send_symbol({ - amount: tokenList.length.toString(), - symbol: tokenList.length > 1 ? 'NFTs' : 'NFT', - })} - - - - + + + + + + {t.send_symbol({ + amount: tokenList.length.toString(), + symbol: tokenList.length > 1 ? 'NFTs' : 'NFT', + })} + + + + + ) diff --git a/packages/mask/src/social-network-adaptor/twitter.com/ui-provider.ts b/packages/mask/src/social-network-adaptor/twitter.com/ui-provider.ts index ea380420e0f0..c80f0e7f3332 100644 --- a/packages/mask/src/social-network-adaptor/twitter.com/ui-provider.ts +++ b/packages/mask/src/social-network-adaptor/twitter.com/ui-provider.ts @@ -51,7 +51,7 @@ const useInjectedDialogClassesOverwriteTwitter = makeStyles()((theme) => { paper: { width: '600px !important', minHeight: 400, - maxHeight: 620, + maxHeight: 770, maxWidth: 'none', boxShadow: 'none', backgroundImage: 'none', From 846b76200f297a0634f942476a3a919de2c332d6 Mon Sep 17 00:00:00 2001 From: Lantt Date: Wed, 13 Jul 2022 16:25:54 +0800 Subject: [PATCH 117/128] fix: trending contract address on uniswap --- .../plugins/Trader/SNSAdaptor/trending/CoinMenu.tsx | 1 - .../Trader/SNSAdaptor/trending/CoinMetadataTable.tsx | 11 ++++++++++- .../mask/src/plugins/Trader/trending/useTrending.ts | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMenu.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMenu.tsx index 0fc0c83ac5bc..54dd7cd763ab 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMenu.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMenu.tsx @@ -26,7 +26,6 @@ const useStyles = makeStyles()((theme) => ({ menuItem: { overflow: 'hidden', alignItems: 'stretch', - paddingRight: 0, height: 36, }, itemText: { diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMetadataTable.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMetadataTable.tsx index 23e0423d895f..b21082e2eebc 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMetadataTable.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMetadataTable.tsx @@ -95,7 +95,16 @@ export function CoinMetadataTable(props: CoinMetadataTableProps) { const metadataLinks = [['Website', trending.coin.home_urls]] as Array<[string, string[] | undefined]> - const contracts = trending.contracts ?? [] + const contracts = + trending.contracts ?? (trending.coin.chainId && trending.coin.contract_address) + ? [ + { + chainId: trending.coin.chainId!, + address: trending.coin.contract_address!, + iconURL: '', + }, + ] + : [] const [menu, openMenu] = useMenu( contracts.map((x) => ( diff --git a/packages/mask/src/plugins/Trader/trending/useTrending.ts b/packages/mask/src/plugins/Trader/trending/useTrending.ts index 346482b103cd..c77aff7fbc1d 100644 --- a/packages/mask/src/plugins/Trader/trending/useTrending.ts +++ b/packages/mask/src/plugins/Trader/trending/useTrending.ts @@ -22,8 +22,8 @@ export function useTrendingByKeyword(tagType: TagType, keyword: string, dataProv const coin = { ...trending?.coin, decimals: trending?.coin.decimals || detailedToken?.decimals || 0, - contract_address: trending?.contracts?.[0]?.address, - chainId: trending?.contracts?.[0]?.chainId, + contract_address: trending?.contracts?.[0]?.address ?? trending?.coin.contract_address, + chainId: trending?.contracts?.[0]?.chainId ?? trending?.coin.contract_address, } as Coin return { value: { From cb3416595d60b2d65afe7d5db581fc327361e94c Mon Sep 17 00:00:00 2001 From: Lantt Date: Wed, 13 Jul 2022 16:58:05 +0800 Subject: [PATCH 118/128] fix: workaround for nft coin menu auto add padding-right style --- .../mask/src/plugins/Trader/SNSAdaptor/trending/CoinMenu.tsx | 5 ++++- .../plugins/Trader/SNSAdaptor/trending/CoinSafetyAlert.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMenu.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMenu.tsx index 54dd7cd763ab..f7de1343b669 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMenu.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinMenu.tsx @@ -16,6 +16,10 @@ const useStyles = makeStyles()((theme) => ({ '&::-webkit-scrollbar': { display: 'none', }, + '& > ul': { + paddingRight: '0 !important', + width: '100% !important', + }, }, groupName: { height: 18, @@ -33,7 +37,6 @@ const useStyles = makeStyles()((theme) => ({ flexGrow: 1, justifyContent: 'space-around', gap: theme.spacing(1), - paddingRight: theme.spacing(1), alignItems: 'center', overflow: 'hidden', }, diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinSafetyAlert.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinSafetyAlert.tsx index 7f2881433af1..40db6ad85fb7 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinSafetyAlert.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/CoinSafetyAlert.tsx @@ -8,7 +8,7 @@ import { ChainId, explorerResolver } from '@masknet/web3-shared-evm' const useStyles = makeStyles()((theme) => { return { root: { - padding: theme.spacing(0, 2, 2, 2), + padding: theme.spacing(2), }, approve: { marginLeft: theme.spacing(1), From a8461e1016354ba9e2f83f16f68b88d9cc85afaf Mon Sep 17 00:00:00 2001 From: lelenei <72531217+lelenei@users.noreply.github.com> Date: Wed, 13 Jul 2022 17:02:15 +0800 Subject: [PATCH 119/128] fix: when change wallet, show network tab at avatar (#6745) * fix: when change wallet, show network tab at avatar * fix: show provider icon at avatar * fix: wallet name at avatar * fix: adjust padding size --- .../Avatar/Application/NFTListDialog.tsx | 10 +++++----- .../plugins/Avatar/Application/WalletList.tsx | 11 ++++++++++- .../Avatar/Application/WalletMenuUI.tsx | 19 ++++++++++++------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/packages/mask/src/plugins/Avatar/Application/NFTListDialog.tsx b/packages/mask/src/plugins/Avatar/Application/NFTListDialog.tsx index 0ad3f7c9f181..dbd0153b9a31 100644 --- a/packages/mask/src/plugins/Avatar/Application/NFTListDialog.tsx +++ b/packages/mask/src/plugins/Avatar/Application/NFTListDialog.tsx @@ -26,12 +26,11 @@ import { useNonFungibleAssets, useProviderType, useWallet, + useProviderDescriptor, } from '@masknet/plugin-infra/web3' import { NFTWalletConnect } from './WalletConnect' import { toPNG } from '../utils' import { NFTListPage } from './NFTListPage' -import { useSubscription } from 'use-subscription' -import { context } from '../context' import { NetworkTab } from '../../../components/shared/NetworkTab' import { useAsync } from 'react-use' import { WalletMessages, WalletRPC } from '../../Wallet/messages' @@ -175,7 +174,8 @@ export function NFTListDialog(props: NFTListDialogProps) { const [disabled, setDisabled] = useState(false) const t = useI18N() const [tokens, setTokens] = useState([]) - const lastRecognizedProfile = useSubscription(context.lastRecognizedProfile) + const providerType = useProviderType() + const providerDescriptor = useProviderDescriptor(currentPluginId, providerType) const { value: chains = EMPTY_LIST } = useAsync(async () => { const networks = await WalletRPC.getSupportedNetworks() @@ -320,8 +320,6 @@ export function NFTListDialog(props: NFTListDialogProps) { }) }, [chainId]) - const providerType = useProviderType() - const theme = useTheme() const walletItems = wallets @@ -352,6 +350,7 @@ export function NFTListDialog(props: NFTListDialogProps) { onConnectWallet={openSelectProviderDialog} onSelectedWallet={onChangeWallet} haveChangeWallet={Boolean(account)} + providerIcon={providerDescriptor.icon} /> ) : ( @@ -415,6 +414,7 @@ export function NFTListDialog(props: NFTListDialogProps) { chainId={chainId} setChainId={setChainId} classes={classes} + networkId={selectedPluginId} /> ) : null} diff --git a/packages/mask/src/plugins/Avatar/Application/WalletList.tsx b/packages/mask/src/plugins/Avatar/Application/WalletList.tsx index 5c636a3c889b..bbb0ef6b59e0 100644 --- a/packages/mask/src/plugins/Avatar/Application/WalletList.tsx +++ b/packages/mask/src/plugins/Avatar/Application/WalletList.tsx @@ -59,6 +59,7 @@ interface WalletItemProps { chainId: ChainId haveChangeWallet?: boolean onConnectWallet?: () => void + providerIcon?: URL } export function WalletItem(props: WalletItemProps) { const { classes } = useStyles() @@ -71,6 +72,7 @@ export function WalletItem(props: WalletItemProps) { onSelectedWallet, haveChangeWallet = false, onConnectWallet, + providerIcon, } = props const currentPluginId = useCurrentWeb3NetworkPluginID() const t = useI18N() @@ -97,7 +99,14 @@ export function WalletItem(props: WalletItemProps) { )} - + {haveChangeWallet && (
- + {t('plugin_trader_floor_price')} @@ -138,7 +138,7 @@ export function NonFungibleCoinMarketTable(props: CoinMarketTableProps) { - + {t('plugin_trader_volume_24')} @@ -152,7 +152,7 @@ export function NonFungibleCoinMarketTable(props: CoinMarketTableProps) { - + {t('plugin_trader_owners_count')} @@ -160,7 +160,7 @@ export function NonFungibleCoinMarketTable(props: CoinMarketTableProps) { {formatInteger(market?.owners_count, '--')} - + {t('plugin_trader_total_assets')} From 8aa121877aa790599e81bc87bf79a2bea21409ef Mon Sep 17 00:00:00 2001 From: UncleBill Date: Wed, 13 Jul 2022 18:30:45 +0800 Subject: [PATCH 123/128] fix: respect to typing (#6749) --- .../SNSAdaptor/trending/TrendingViewDeck.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx index a44f11883a32..4d13767a1e7e 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx @@ -158,19 +158,19 @@ export function TrendingViewDeck(props: TrendingViewDeckProps) { const isTokenSecurityEnable = !isNFT && !snsAdaptorMinimalPlugins.map((x) => x.ID).includes(PluginId.GoPlusSecurity) const { value: tokenSecurityInfo, error } = useTokenSecurity( - coin?.chainId ?? ChainId.Mainnet, + coin.chainId ?? ChainId.Mainnet, coin.contract_address?.trim(), isTokenSecurityEnable, ) - const isBuyable = !isNFT && transakPluginEnabled && !transakIsMinimalMode && trending.coin.symbol && isAllowanceCoin + const isBuyable = !isNFT && transakPluginEnabled && !transakIsMinimalMode && coin.symbol && isAllowanceCoin const onBuyButtonClicked = useCallback(() => { setBuyDialog({ open: true, code: coin.symbol, address: account, }) - }, [account, trending?.coin?.symbol]) + }, [account, coin.symbol]) // #endregion // #region sync with settings @@ -222,10 +222,10 @@ export function TrendingViewDeck(props: TrendingViewDeckProps) { From 2ae517aa149ddc17737ea2eda530d308a450e045 Mon Sep 17 00:00:00 2001 From: lelenei <72531217+lelenei@users.noreply.github.com> Date: Wed, 13 Jul 2022 20:07:22 +0800 Subject: [PATCH 124/128] fix: connot show web3 tab content when bind wallet (#6790) --- packages/mask/src/components/DataSource/useNextID.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mask/src/components/DataSource/useNextID.ts b/packages/mask/src/components/DataSource/useNextID.ts index 2783debe1bab..504e74c98e1d 100644 --- a/packages/mask/src/components/DataSource/useNextID.ts +++ b/packages/mask/src/components/DataSource/useNextID.ts @@ -34,7 +34,7 @@ export const verifyPersona = (personaIdentifier?: PersonaIdentifier, username?: export const useNextIDBoundByPlatform = (platform?: NextIDPlatform, userId?: string) => { const res = useAsyncRetry(async () => { if (!platform || !userId) return EMPTY_LIST - return NextIDProof.queryExistedBindingByPlatform(platform, userId) + return NextIDProof.queryAllExistedBindingsByPlatform(platform, userId) }, [platform, userId]) useEffect(() => MaskMessages.events.ownProofChanged.on(res.retry), [res.retry]) return res From a747a9dab41f72a79da681e2299aa99faa252e74 Mon Sep 17 00:00:00 2001 From: BillyS Date: Wed, 13 Jul 2022 20:53:45 +0800 Subject: [PATCH 125/128] fix: chainId outer useNonFungibleAsset (#6789) --- .../mask/src/plugins/Collectible/hooks/useCollectibleState.ts | 2 ++ packages/plugin-infra/src/web3/useNonFungibleAsset.ts | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/mask/src/plugins/Collectible/hooks/useCollectibleState.ts b/packages/mask/src/plugins/Collectible/hooks/useCollectibleState.ts index d79262cac0f2..1d241a2dc17e 100644 --- a/packages/mask/src/plugins/Collectible/hooks/useCollectibleState.ts +++ b/packages/mask/src/plugins/Collectible/hooks/useCollectibleState.ts @@ -3,6 +3,7 @@ import { createContainer } from 'unstated-next' import { CollectibleTab, CollectibleToken } from '../types' import { useNonFungibleAsset } from '@masknet/plugin-infra/web3' import { NetworkPluginID, SourceType } from '@masknet/web3-shared-base' +import { ChainId } from '@masknet/web3-shared-evm' function useCollectibleState(token?: CollectibleToken) { const [tabIndex, setTabIndex] = useState(CollectibleTab.ARTICLE) @@ -10,6 +11,7 @@ function useCollectibleState(token?: CollectibleToken) { const asset = useNonFungibleAsset(NetworkPluginID.PLUGIN_EVM, token?.contractAddress ?? '', token?.tokenId ?? '', { sourceType: provider, + chainId: ChainId.Mainnet, }) return { diff --git a/packages/plugin-infra/src/web3/useNonFungibleAsset.ts b/packages/plugin-infra/src/web3/useNonFungibleAsset.ts index dc2dcb44b9ff..045a3155b956 100644 --- a/packages/plugin-infra/src/web3/useNonFungibleAsset.ts +++ b/packages/plugin-infra/src/web3/useNonFungibleAsset.ts @@ -3,7 +3,6 @@ import type { NetworkPluginID } from '@masknet/web3-shared-base' import type { Web3Helper } from '../web3-helpers' import { useAccount } from '../entry-web3' import { useWeb3Hub } from './useWeb3Hub' -import { ChainId } from '@masknet/web3-shared-evm' export function useNonFungibleAsset( pluginID?: T, @@ -19,6 +18,6 @@ export function useNonFungibleAsset | undefined>(async () => { if (!address || !id || !hub) return - return hub.getNonFungibleAsset?.(address, id, { chainId: ChainId.Mainnet }) + return hub.getNonFungibleAsset?.(address, id) }, [address, id, hub]) } From cd8b16d5b53358f4bcb1056a1ca6c1952473a605 Mon Sep 17 00:00:00 2001 From: lelenei <72531217+lelenei@users.noreply.github.com> Date: Wed, 13 Jul 2022 22:29:23 +0800 Subject: [PATCH 126/128] fix: show nft amount at avatar (#6792) --- .../mask/src/plugins/Avatar/hooks/useNFT.ts | 4 ++-- packages/web3-providers/src/opensea/index.ts | 19 +++++++++++++------ packages/web3-shared/base/src/specs/index.ts | 7 ++++++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/packages/mask/src/plugins/Avatar/hooks/useNFT.ts b/packages/mask/src/plugins/Avatar/hooks/useNFT.ts index 292cdd076893..d5e4a1d60b94 100644 --- a/packages/mask/src/plugins/Avatar/hooks/useNFT.ts +++ b/packages/mask/src/plugins/Avatar/hooks/useNFT.ts @@ -22,9 +22,9 @@ export function useNFT( chainId, }) return { - amount: asset?.price?.[CurrencyType.USD] ?? '0', + amount: asset?.priceInToken?.amount ?? asset?.price?.[CurrencyType.USD] ?? '0', name: asset?.contract?.name ?? '', - symbol: asset?.priceToken?.symbol ?? asset?.paymentTokens?.[0].symbol ?? 'ETH', + symbol: asset?.priceInToken?.token.symbol ?? asset?.paymentTokens?.[0].symbol ?? 'ETH', image: asset?.metadata?.imageURL ?? '', owner: asset?.owner?.address ?? asset?.ownerId ?? '', slug: asset?.collection?.slug ?? '', diff --git a/packages/web3-providers/src/opensea/index.ts b/packages/web3-providers/src/opensea/index.ts index a5ddde231e6f..6d89e08d5ba2 100644 --- a/packages/web3-providers/src/opensea/index.ts +++ b/packages/web3-providers/src/opensea/index.ts @@ -19,6 +19,7 @@ import { createIndicator, createNextIndicator, NonFungibleAsset, + formatBalance, } from '@masknet/web3-shared-base' import { ChainId, SchemaType, createNativeToken, createERC20Token } from '@masknet/web3-shared-evm' import type { NonFungibleTokenAPI, TrendingAPI } from '../types' @@ -169,12 +170,18 @@ function createNFTAsset(chainId: ChainId, asset: OpenSeaResponse): NonFungibleAs asset.last_sale?.payment_token.decimals, )?.toString(), }, - priceToken: createTokenDetailed(chainId, { - address: asset.last_sale?.payment_token.address ?? '', - decimals: Number(asset.last_sale?.payment_token.decimals ?? '0'), - name: '', - symbol: asset.last_sale?.payment_token.symbol ?? '', - }), + priceInToken: { + token: createTokenDetailed(chainId, { + address: asset.last_sale?.payment_token.address ?? '', + decimals: Number(asset.last_sale?.payment_token.decimals ?? '0'), + name: '', + symbol: asset.last_sale?.payment_token.symbol ?? '', + }), + amount: formatBalance( + new BigNumber(asset.last_sale?.total_price ?? '0'), + asset.last_sale?.payment_token.decimals, + ), + }, orders: asset.orders ?.sort((a, z) => new BigNumber(getOrderUSDPrice(z.current_price, z.payment_token_contract?.usd_price) ?? 0) diff --git a/packages/web3-shared/base/src/specs/index.ts b/packages/web3-shared/base/src/specs/index.ts index 8f43731cfae3..500ac65bf1ec 100644 --- a/packages/web3-shared/base/src/specs/index.ts +++ b/packages/web3-shared/base/src/specs/index.ts @@ -354,6 +354,11 @@ export interface FungibleAsset extends FungibleToken { + amount: string + token: FungibleToken +} + /** * A non-fungible token but with more metadata */ @@ -373,7 +378,7 @@ export interface NonFungibleAsset extends NonFungibleToken< orders?: Array> events?: Array> paymentTokens?: Array> - priceToken?: FungibleToken + priceInToken?:PriceInToken } /** From b7533c507cf6a58088986d92d5c5798c33d4aa21 Mon Sep 17 00:00:00 2001 From: guanbinrui Date: Wed, 13 Jul 2022 23:11:30 +0800 Subject: [PATCH 127/128] fix: revert dialog change --- .../mask/src/social-network-adaptor/twitter.com/ui-provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mask/src/social-network-adaptor/twitter.com/ui-provider.ts b/packages/mask/src/social-network-adaptor/twitter.com/ui-provider.ts index c80f0e7f3332..ea380420e0f0 100644 --- a/packages/mask/src/social-network-adaptor/twitter.com/ui-provider.ts +++ b/packages/mask/src/social-network-adaptor/twitter.com/ui-provider.ts @@ -51,7 +51,7 @@ const useInjectedDialogClassesOverwriteTwitter = makeStyles()((theme) => { paper: { width: '600px !important', minHeight: 400, - maxHeight: 770, + maxHeight: 620, maxWidth: 'none', boxShadow: 'none', backgroundImage: 'none', From 687212048486edd33ae451a1ebe5c7cfa95de0f3 Mon Sep 17 00:00:00 2001 From: UncleBill Date: Thu, 14 Jul 2022 00:19:30 +0800 Subject: [PATCH 128/128] fix(nftscan): mf-1486 set name of meta data (#6791) * fix(nftscan): mf-1486 set name of meta data fix formatTokenId * fixup! fix(nftscan): mf-1486 set name of meta data * fixup! fix(nftscan): mf-1486 set name of meta data closes #6793 --- .../src/UI/components/NFTList/index.tsx | 24 ++++++++++++------- packages/web3-providers/src/NFTScan/index.ts | 2 +- packages/web3-shared/base/src/specs/index.ts | 1 + packages/web3-shared/evm/utils/formatter.ts | 11 ++++++--- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/packages/shared/src/UI/components/NFTList/index.tsx b/packages/shared/src/UI/components/NFTList/index.tsx index 37606c65d08b..9143372abde6 100644 --- a/packages/shared/src/UI/components/NFTList/index.tsx +++ b/packages/shared/src/UI/components/NFTList/index.tsx @@ -2,21 +2,21 @@ import { useChainId, useCurrentWeb3NetworkPluginID, useWeb3State, Web3Helper } f import { ElementAnchor, Linking, NFTCardStyledAssetPlayer, RetryHint } from '@masknet/shared' import { LoadingBase, makeStyles } from '@masknet/theme' import { isSameAddress, NetworkPluginID, NonFungibleToken } from '@masknet/web3-shared-base' -import { formatTokenId } from '@masknet/web3-shared-evm' +import type { ChainId, SchemaType } from '@masknet/web3-shared-evm' import { Checkbox, List, ListItem, Radio, Stack, Typography } from '@mui/material' import classnames from 'classnames' import { noop } from 'lodash-unified' import { FC, useCallback } from 'react' interface NFTItemProps { - token: NonFungibleToken + token: NonFungibleToken } export type NFTKeyPair = [address: string, tokenId: string] interface Props { selectable?: boolean - tokens: Array> + tokens: Array> selectedPairs?: NFTKeyPair[] onChange?: (id: string | null, contractAddress?: string) => void limit?: number @@ -28,7 +28,7 @@ interface Props { hasError?: boolean } -const useStyles = makeStyles<{ columns?: number; gap?: number }>()((theme, { columns, gap }) => { +const useStyles = makeStyles<{ columns?: number; gap?: number }>()((theme, { columns = 4, gap = 12 }) => { const isLight = theme.palette.mode === 'light' return { checkbox: { @@ -37,16 +37,17 @@ const useStyles = makeStyles<{ columns?: number; gap?: number }>()((theme, { col top: 0, }, list: { - gridGap: gap ?? 12, + gridGap: gap, padding: 0, display: 'grid', - gridTemplateColumns: `repeat(${columns ?? 4}, 1fr)`, + gridTemplateColumns: `repeat(${columns}, 1fr)`, }, nftContainer: { background: isLight ? '#EDEFEF' : '#2F3336', borderRadius: 8, width: '100%', transition: 'all 0.2s ease', + overflow: 'auto', '&:hover': { backgroundColor: isLight ? theme.palette.background.paper : undefined, boxShadow: isLight ? '0px 4px 30px rgba(0, 0, 0, 0.1)' : undefined, @@ -122,7 +123,10 @@ const useStyles = makeStyles<{ columns?: number; gap?: number }>()((theme, { col export const NFTItem: FC = ({ token }) => { const { classes } = useStyles({}) - const chainId = useChainId() + const chainId = useChainId(NetworkPluginID.PLUGIN_EVM) + const { Others } = useWeb3State(NetworkPluginID.PLUGIN_EVM) + const fullCaption = token.metadata?.name || token.tokenId + const caption = token.metadata?.name?.match(/#\d+$/) ? token.metadata.name : Others?.formatTokenId(token.tokenId) return (
= ({ token }) => { wrapper: classes.wrapper, }} /> - {formatTokenId(token.tokenId)} + + {caption} +
) } @@ -177,7 +183,7 @@ export const NFTList: FC = ({ } const SelectComponent = isRadio ? Radio : Checkbox - const { Others } = useWeb3State() + const { Others } = useWeb3State(NetworkPluginID.PLUGIN_EVM) return ( <> diff --git a/packages/web3-providers/src/NFTScan/index.ts b/packages/web3-providers/src/NFTScan/index.ts index b6d61a0b92a4..96c68def6c2a 100644 --- a/packages/web3-providers/src/NFTScan/index.ts +++ b/packages/web3-providers/src/NFTScan/index.ts @@ -218,7 +218,7 @@ export class NFTScanAPI implements NonFungibleTokenAPI.Provider { export interface NonFungibleTokenMetadata { chainId: ChainId + /** Might be the format `TheName #42` */ name: string symbol: string description?: string diff --git a/packages/web3-shared/evm/utils/formatter.ts b/packages/web3-shared/evm/utils/formatter.ts index e8bff3b48c65..f394f9dba98a 100644 --- a/packages/web3-shared/evm/utils/formatter.ts +++ b/packages/web3-shared/evm/utils/formatter.ts @@ -20,9 +20,14 @@ export function formatEthereumAddress(address: string, size = 0) { return `${address_.slice(0, Math.max(0, 2 + size))}...${address_.slice(-size)}` } -export function formatTokenId(tokenId: string, size = 0) { - if (tokenId.length < 9) return `#${tokenId}` - return `#${tokenId.slice(0, Math.max(0, 2 + size))}...${tokenId.slice(-size)}` +export function formatTokenId(tokenId: string, size = 4) { + size = Math.max(2, size) + const isHex = tokenId.toLowerCase().startsWith('0x') + const prefix = isHex ? '0x' : '#' + if (tokenId.length < size * 2 + prefix.length) return `#${tokenId}` + const head = tokenId.slice(0, isHex ? 2 + size : size) + const tail = tokenId.slice(-size) + return `${prefix}${head}...${tail}` } export function formatDomainName(domain: string, size = 4) {