Skip to content

Commit

Permalink
[Release] Hotfix 2.21.5 => 2.21.6 (patch) (#10370)
Browse files Browse the repository at this point in the history
* chore: bump version to 2.21.6

* feat: add base chain (#10368)

* chore: add base chain

* chore: network config

* chore: NetworkType

* refactor: constants

* chore: simplehash & base

* chore: tips & base

* chore: base & debank

* refactor: remove dead code

* fix: chain icon (#10383)

* fix: chain icon

* refactor: code style

* refactor: code stlye

---------

Co-authored-by: guanbinrui <guanbinrui@dimension.im>

* fix: nfts list (#10387)

* feat: update contract (#10393)

* fix: mf-4694 show lens by checking verified firefly records (#10224)

* chore: max chip style (#10407)

* fix: transfer erc721 (#10411)

---------

Co-authored-by: lelenei <72531217+lelenei@users.noreply.github.com>
Co-authored-by: UncleBill <billbill290@gmail.com>
Co-authored-by: nuanyang233 <nuanyang233@gmail.com>
  • Loading branch information
4 people committed Aug 15, 2023
1 parent e5ac023 commit cc59a7f
Show file tree
Hide file tree
Showing 65 changed files with 669 additions and 78 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"yarn": ">=999.0.0",
"npm": ">=999.0.0"
},
"version": "2.21.5",
"version": "2.21.6",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/mask/src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Mask Network",
"version": "2.21.5",
"version": "2.21.6",
"manifest_version": 2,
"permissions": ["storage", "downloads", "webNavigation", "activeTab"],
"optional_permissions": ["<all_urls>", "notifications", "clipboardRead"],
Expand Down
1 change: 1 addition & 0 deletions packages/mask/src/plugins/Tips/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const base: Plugin.Shared.Definition = {
supportedChainIds: [
ChainId.Mainnet,
ChainId.BSC,
ChainId.Base,
ChainId.Matic,
ChainId.Arbitrum,
ChainId.xDai,
Expand Down
1 change: 1 addition & 0 deletions packages/mask/src/plugins/Trader/constants/0x.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NetworkType } from '@masknet/web3-shared-evm'
export const ZRX_BASE_URL: Record<NetworkType, string> = {
[NetworkType.Ethereum]: 'https://api.0x.org',
[NetworkType.Binance]: 'https://bsc.api.0x.org/',
[NetworkType.Base]: '',
[NetworkType.Polygon]: 'https://polygon.api.0x.org/',
[NetworkType.Arbitrum]: 'https://arbitrum.api.0x.org/',
[NetworkType.xDai]: 'https://xdai.api.0x.org/',
Expand Down
2 changes: 2 additions & 0 deletions packages/mask/src/plugins/Trader/constants/trader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const BLOCK_TIME_SCALE: Record<ChainId, number> = {
[ChainId.Kovan]: 3,
[ChainId.BSC]: 6,
[ChainId.BSCT]: 6,
[ChainId.Base]: 6,
[ChainId.Base_Goerli]: 6,
[ChainId.Matic]: 6,
[ChainId.Mumbai]: 6,
[ChainId.Arbitrum]: 6,
Expand Down
13 changes: 7 additions & 6 deletions packages/mask/src/plugins/Trader/trader/0x/useTrade.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ChainId, chainResolver, isNativeTokenAddress, NetworkType } from '@masknet/web3-shared-evm'
import type { AsyncStateRetry } from 'react-use/lib/useAsyncRetry.js'
import { safeUnreachable } from '@masknet/kit'
import { isZero } from '@masknet/web3-shared-base'
import { NetworkPluginID } from '@masknet/shared-base'
import type { Web3Helper } from '@masknet/web3-helpers'
import { useChainContext, useCustomBlockBeatRetry, useNetworkContext } from '@masknet/web3-hooks-base'
import { ChainId, chainResolver, isNativeTokenAddress, NetworkType } from '@masknet/web3-shared-evm'
import { ZRX_AFFILIATE_ADDRESS } from '../../constants/index.js'
import { PluginTraderRPC } from '../../messages.js'
import { type SwapQuoteResponse, TradeStrategy } from '../../types/index.js'
import { useSlippageTolerance } from '../0x/useSlippageTolerance.js'
import { useChainContext, useCustomBlockBeatRetry, useNetworkContext } from '@masknet/web3-hooks-base'
import type { AsyncStateRetry } from 'react-use/lib/useAsyncRetry.js'
import { isZero } from '@masknet/web3-shared-base'
import { NetworkPluginID } from '@masknet/shared-base'
import type { Web3Helper } from '@masknet/web3-helpers'

const NATIVE_TOKEN_ADDRESS = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'

Expand All @@ -17,6 +17,7 @@ export function getNativeTokenLabel(networkType: NetworkType) {
case NetworkType.Ethereum:
return 'ETH'
case NetworkType.Binance:
case NetworkType.Base:
case NetworkType.Polygon:
case NetworkType.Arbitrum:
case NetworkType.xDai:
Expand Down
4 changes: 2 additions & 2 deletions packages/mask/src/plugins/Trader/trader/useBalancer.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useMemo } from 'react'
import { TradeProvider } from '@masknet/public-api'
import type { Web3Helper } from '@masknet/web3-helpers'
import { useChainContext, useCustomBlockBeatRetry } from '@masknet/web3-hooks-base'
import { NetworkPluginID } from '@masknet/shared-base'
import { useMemo } from 'react'
import { Balancer } from '@masknet/web3-providers'
import type { ChainId, NetworkType } from '@masknet/web3-shared-evm'
import type { TraderAPI } from '@masknet/web3-providers/types'
import { useSlippageTolerance } from './useSlippageTolerance.js'
import { getEVMAvailableTraderProviders } from '../utils.js'
import type { TraderAPI } from '@masknet/web3-providers/types'

export function useBalancer(
inputAmount_: string,
Expand Down
4 changes: 2 additions & 2 deletions packages/mask/src/plugins/Trader/trader/useBancor.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useMemo } from 'react'
import { TradeProvider } from '@masknet/public-api'
import type { Web3Helper } from '@masknet/web3-helpers'
import { useChainContext, useCustomBlockBeatRetry } from '@masknet/web3-hooks-base'
import { NetworkPluginID } from '@masknet/shared-base'
import { useMemo } from 'react'
import { Bancor } from '@masknet/web3-providers'
import type { TraderAPI } from '@masknet/web3-providers/types'
import type { ChainId, NetworkType } from '@masknet/web3-shared-evm'
import { useSlippageTolerance } from './useSlippageTolerance.js'
import { getEVMAvailableTraderProviders } from '../utils.js'
import type { TraderAPI } from '@masknet/web3-providers/types'

export function useBancor(
inputAmount_: string,
Expand Down
4 changes: 2 additions & 2 deletions packages/mask/src/plugins/Trader/trader/useOpenOcean.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useMemo } from 'react'
import { TradeProvider } from '@masknet/public-api'
import type { Web3Helper } from '@masknet/web3-helpers'
import { useChainContext, useCustomBlockBeatRetry } from '@masknet/web3-hooks-base'
import { NetworkPluginID } from '@masknet/shared-base'
import { useMemo } from 'react'
import { OpenOcean } from '@masknet/web3-providers'
import type { ChainId, NetworkType } from '@masknet/web3-shared-evm'
import type { TraderAPI } from '@masknet/web3-providers/types'
import { useSlippageTolerance } from './useSlippageTolerance.js'
import { getEVMAvailableTraderProviders } from '../utils.js'
import type { TraderAPI } from '@masknet/web3-providers/types'

export function useOpenOcean(
inputAmount_: string,
Expand Down
4 changes: 2 additions & 2 deletions packages/mask/src/plugins/Trader/trader/useUniSwapV3Like.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useMemo } from 'react'
import { TradeProvider } from '@masknet/public-api'
import type { Web3Helper } from '@masknet/web3-helpers'
import { useChainContext, useCustomBlockBeatRetry } from '@masknet/web3-hooks-base'
import { NetworkPluginID } from '@masknet/shared-base'
import { useMemo } from 'react'
import { UniSwapV3Like } from '@masknet/web3-providers'
import type { ChainId, NetworkType } from '@masknet/web3-shared-evm'
import type { TraderAPI } from '@masknet/web3-providers/types'
import { useSlippageTolerance } from './useSlippageTolerance.js'
import { getEVMAvailableTraderProviders } from '../utils.js'
import type { TraderAPI } from '@masknet/web3-providers/types'

export function useUniswapV3Like(
inputAmount_: string,
Expand Down
4 changes: 2 additions & 2 deletions packages/mask/src/plugins/Trader/trader/useUniswapV2Like.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useMemo } from 'react'
import { type TradeProvider } from '@masknet/public-api'
import type { Web3Helper } from '@masknet/web3-helpers'
import { useChainContext, useCustomBlockBeatRetry } from '@masknet/web3-hooks-base'
import { NetworkPluginID } from '@masknet/shared-base'
import { useMemo } from 'react'
import { UniSwapV2Like } from '@masknet/web3-providers'
import type { ChainId, NetworkType } from '@masknet/web3-shared-evm'
import type { TraderAPI } from '@masknet/web3-providers/types'
import { useSlippageTolerance } from './useSlippageTolerance.js'
import { getEVMAvailableTraderProviders } from '../utils.js'
import { BLOCK_TIME_SCALE } from '../constants/trader.js'
import type { TraderAPI } from '@masknet/web3-providers/types'

export function useUniswapV2Like(
traderProvider: TradeProvider,
Expand Down
4 changes: 2 additions & 2 deletions packages/mask/src/plugins/Trader/trader/useZrx.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useMemo } from 'react'
import { TradeProvider } from '@masknet/public-api'
import type { Web3Helper } from '@masknet/web3-helpers'
import { useChainContext, useCustomBlockBeatRetry } from '@masknet/web3-hooks-base'
import { NetworkPluginID } from '@masknet/shared-base'
import { useMemo } from 'react'
import { Zrx } from '@masknet/web3-providers'
import type { ChainId, NetworkType } from '@masknet/web3-shared-evm'
import type { TraderAPI } from '@masknet/web3-providers/types'
import { useSlippageTolerance } from './useSlippageTolerance.js'
import { getEVMAvailableTraderProviders } from '../utils.js'
import type { TraderAPI } from '@masknet/web3-providers/types'

export function useZrx(
inputAmount_: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useMemo } from 'react'
import type { NetworkType } from '@masknet/web3-shared-evm'
import type { TradeProvider } from '@masknet/public-api'
import { useChainContext, useNetworkContext, useWeb3Others } from '@masknet/web3-hooks-base'
import { NetworkPluginID } from '@masknet/shared-base'
import type { Web3Helper } from '@masknet/web3-helpers'
import { getEVMAvailableTraderProviders } from '../utils.js'
import { useMemo } from 'react'

export function useAvailableTraderProviders(targetChainId?: Web3Helper.ChainIdAll): TradeProvider[] {
const { chainId } = useChainContext({
Expand Down
2 changes: 2 additions & 0 deletions packages/mask/src/plugins/Trader/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export function getEVMAvailableTraderProviders(networkType?: NetworkType) {
TradeProvider.OPENOCEAN,
TradeProvider.MDEX,
]
case NetworkType.Base:
return EMPTY_LIST
case NetworkType.Arbitrum:
return [TradeProvider.UNISWAP_V3, TradeProvider.OPENOCEAN, TradeProvider.DODO]
case NetworkType.xDai:
Expand Down
21 changes: 11 additions & 10 deletions packages/plugins/Web3Profile/src/SNSAdaptor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { uniqBy } from 'lodash-es'
import { useEffect, useMemo } from 'react'
import { useQuery } from '@tanstack/react-query'
import { Trans } from 'react-i18next'
import { Plugin } from '@masknet/plugin-infra'
import { Icons } from '@masknet/icons'
import { ApplicationEntry } from '@masknet/shared'
import { PluginI18NFieldRender } from '@masknet/plugin-infra/content-script'
import { NextIdLensToFireflyLens } from './components/LensPopup.js'
import { ApplicationEntry } from '@masknet/shared'
import { CrossIsolationMessages, EMPTY_LIST, PluginID } from '@masknet/shared-base'
import { useFireflyLensAccounts } from '@masknet/web3-hooks-base'
import { NextIDProof } from '@masknet/web3-providers'
import { CrossIsolationMessages, EMPTY_LIST, PluginID } from '@masknet/shared-base'
import { base } from '../base.js'
import { LensBadge } from './components/LensBadge.js'
import { Web3ProfileGlobalInjection } from './Web3ProfileGlobalInjection.js'
import { LensBadge } from './components/LensBadge.js'
import { NextIdLensToFireflyLens } from './components/LensPopup.js'
import { setupContext, setupStorage } from './context.js'
import { useQuery } from '@tanstack/react-query'

const sns: Plugin.SNSAdaptor.Definition = {
...base,
Expand Down Expand Up @@ -74,13 +74,14 @@ const sns: Plugin.SNSAdaptor.Definition = {
ID: `${base.ID}_lens`,
UI: {
Content({ identity, slot, onStatusUpdate }) {
const { data: accounts = EMPTY_LIST } = useFireflyLensAccounts(identity?.userId)
const userId = identity?.userId
const { data: accounts = EMPTY_LIST } = useFireflyLensAccounts(userId, true)
const isProfile = slot === Plugin.SNSAdaptor.LensSlot.ProfileName

const handle = accounts[0]?.handle
const { data: nextIdLens = EMPTY_LIST } = useQuery({
queryKey: ['next-id', 'all-lens', identity?.userId],
enabled: isProfile && !!handle,
queryKey: ['next-id', 'all-lens', userId],
enabled: isProfile && !!handle && !!accounts?.length,
queryFn: async () => {
const lensAccounts = await NextIDProof.queryAllLens(handle)
return lensAccounts.map(NextIdLensToFireflyLens)
Expand All @@ -97,9 +98,9 @@ const sns: Plugin.SNSAdaptor.Definition = {
onStatusUpdate?.(hasLens)
}, [onStatusUpdate, hasLens])

if (!lensAccounts.length || !identity?.userId) return null
if (!accounts.length || !userId) return null

return <LensBadge slot={slot} accounts={lensAccounts} userId={identity.userId} />
return <LensBadge slot={slot} accounts={lensAccounts} userId={userId} />
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ const SimpleHashSupportedChains: Record<NetworkPluginID, number[]> = {
[NetworkPluginID.PLUGIN_EVM]: [
ChainId.Mainnet,
ChainId.BSC,
ChainId.Base,
ChainId.Matic,
ChainId.Arbitrum,
ChainId.Optimism,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const useStyles = makeStyles()((theme) => ({
justifyContent: 'center',
alignItems: 'center',
height: 18,
width: 30,
padding: '0 3px',
borderRadius: 4,
fontSize: 10,
marginLeft: 4,
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-constants/compile-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ compileConstants(join(__dirname, 'evm'), [
'Gorli',
'BSC',
'BSCT',
'Base',
'Base_Goerli',
'Matic',
'Mumbai',
'Arbitrum',
Expand Down
6 changes: 6 additions & 0 deletions packages/web3-constants/evm/aave.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"Gorli": "",
"BSC": "",
"BSCT": "",
"Base": "",
"Base_Goerli": "",
"Matic": "",
"Mumbai": "",
"Arbitrum": "",
Expand All @@ -32,6 +34,8 @@
"Gorli": "",
"BSC": "",
"BSCT": "",
"Base": "",
"Base_Goerli": "",
"Matic": "",
"Mumbai": "",
"Arbitrum": "",
Expand All @@ -57,6 +61,8 @@
"Gorli": "",
"BSC": "",
"BSCT": "",
"Base": "",
"Base_Goerli": "",
"Matic": "",
"Mumbai": "",
"Arbitrum": "",
Expand Down
4 changes: 4 additions & 0 deletions packages/web3-constants/evm/airdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"Gorli": "",
"BSC": "",
"BSCT": "",
"Base": "",
"Base_Goerli": "",
"Matic": "",
"Mumbai": "",
"Arbitrum": "https://raw.githubusercontent.com/DimensionDev/Mask-Arbitrum-Claimer/master/claimer.json",
Expand All @@ -32,6 +34,8 @@
"Gorli": "",
"BSC": "",
"BSCT": "",
"Base": "",
"Base_Goerli": "",
"Matic": "",
"Mumbai": "",
"Arbitrum": "0x9A359f736674913e405Eb64C2048c6293DC97CbF",
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-constants/evm/arb.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"Gorli": "",
"BSC": "",
"BSCT": "",
"Base": "",
"Base_Goerli": "",
"Matic": "",
"Mumbai": "",
"Arbitrum": "0x5d482D501b369F5bA034DEC5c5fb7A50d2D6Ca20",
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-constants/evm/artblocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"Gorli": "",
"BSC": "",
"BSCT": "",
"Base": "",
"Base_Goerli": "",
"Matic": "",
"Mumbai": "",
"Arbitrum": "",
Expand Down
6 changes: 5 additions & 1 deletion packages/web3-constants/evm/coingecko.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"Kovan": "",
"Gorli": "",
"BSC": "binance-smart-chain",
"BSCT": "",
"BSCT": "base",
"Base": "",
"Base_Goerli": "",
"Matic": "polygon-pos",
"Mumbai": "",
"Arbitrum": "arbitrum-one",
Expand All @@ -32,6 +34,8 @@
"Gorli": "",
"BSC": "binancecoin",
"BSCT": "",
"Base": "base",
"Base_Goerli": "",
"Matic": "matic-network",
"Mumbai": "",
"Arbitrum": "ethereum",
Expand Down
27 changes: 0 additions & 27 deletions packages/web3-constants/evm/coinmarketcap.json

This file was deleted.

2 changes: 2 additions & 0 deletions packages/web3-constants/evm/cryptopunks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"Gorli": "",
"BSC": "",
"BSCT": "",
"Base": "",
"Base_Goerli": "",
"Matic": "",
"Mumbai": "",
"Arbitrum": "",
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-constants/evm/debank.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"Gorli": "",
"BSC": "bsc",
"BSCT": "",
"Base": "base",
"Base_Goerli": "",
"Matic": "matic",
"Mumbai": "",
"Arbitrum": "arb",
Expand Down

0 comments on commit cc59a7f

Please sign in to comment.