Skip to content

Commit 445bb3f

Browse files
[Release] Hotfix 2.26.4 => 2.26.5 (patch) (#11703)
* chore: bump version to 2.26.5 * fix: fw-6308 celo icon doesn't show in collectible card, enable zora (#11704) * fix: fw-6308 celo icon doesn't show in collectible card * fix: enable zora for simplehash * fix: disable celo for simplehash (#11705) * fix: lazy load calendar data (#11706) --------- Co-authored-by: Wukong Sun <[email protected]>
1 parent bc8beee commit 445bb3f

File tree

13 files changed

+88
-21
lines changed

13 files changed

+88
-21
lines changed

Diff for: cspell.json

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"arweave",
3636
"astar",
3737
"astarexchange",
38+
"astria",
3839
"attrace",
3940
"avalanche",
4041
"avax",

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"yarn": ">=999.0.0",
99
"npm": ">=999.0.0"
1010
},
11-
"version": "2.26.4",
11+
"version": "2.26.5",
1212
"private": true,
1313
"license": "AGPL-3.0-or-later",
1414
"scripts": {

Diff for: packages/mask/.webpack/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export async function createConfiguration(_inputFlags: BuildFlags): Promise<webp
324324
path: flags.outputPath,
325325
filename: 'entry/[name].js',
326326
chunkFilename: productionLike ? 'bundled/[id].js' : 'bundled/chunk-[name].js',
327-
assetModuleFilename: 'assets/[hash][ext][query]',
327+
assetModuleFilename: productionLike ? 'assets/[hash][ext][query]' : 'assets/[name]-[hash][ext][query]',
328328
webassemblyModuleFilename: 'assets/[hash].wasm',
329329
hotUpdateMainFilename: 'hot/[runtime].[fullhash].json',
330330
hotUpdateChunkFilename: 'hot/[id].[fullhash].js',

Diff for: packages/plugins/Calendar/src/SiteAdaptor/CalendarContent.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ export function CalendarContent({ target, disableSetting }: Props) {
5151
const [currentTab, onChange, tabs] = useTabs('news', 'event', 'nfts')
5252
const [selectedDate, setSelectedDate] = useState(new Date())
5353
const [open, setOpen] = useState(false)
54-
const { data: eventList = EMPTY_OBJECT, isPending: eventLoading } = useEventList(selectedDate)
55-
const { data: newsList = EMPTY_OBJECT, isPending: newsLoading } = useNewsList(selectedDate)
56-
const { data: nftList = EMPTY_OBJECT, isPending: nftLoading } = useNFTList(selectedDate)
54+
const { data: eventList = EMPTY_OBJECT, isPending: eventLoading } = useEventList(
55+
selectedDate,
56+
currentTab === 'event',
57+
)
58+
const { data: newsList = EMPTY_OBJECT, isPending: newsLoading } = useNewsList(selectedDate, currentTab === 'news')
59+
const { data: nftList = EMPTY_OBJECT, isPending: nftLoading } = useNFTList(selectedDate, currentTab === 'nfts')
5760
const list = useMemo(() => {
5861
switch (currentTab) {
5962
case 'news':

Diff for: packages/plugins/Calendar/src/SiteAdaptor/components/DatePicker.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ export function DatePicker({ selectedDate, setSelectedDate, open, setOpen, curre
9090
const startingDayOfWeek = monthStart.getDay()
9191
const daysInMonth = endOfMonth(currentDate).getDate()
9292
const daysInPrevMonth = endOfMonth(addMonths(currentDate, -1)).getDate()
93-
const { data: eventList } = useEventList(monthStart)
94-
const { data: newsList } = useNewsList(monthStart)
95-
const { data: nftList } = useNFTList(monthStart)
93+
const { data: eventList } = useEventList(monthStart, currentTab === 'event')
94+
const { data: newsList } = useNewsList(monthStart, currentTab === 'news')
95+
const { data: nftList } = useNFTList(monthStart, currentTab === 'nfts')
9696
const list = useMemo(() => {
9797
switch (currentTab) {
9898
case 'news':

Diff for: packages/plugins/Calendar/src/hooks/useEventList.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import { EMPTY_OBJECT } from '@masknet/shared-base'
55
import type { UseQueryResult } from '@tanstack/react-query'
66
import { addDays } from 'date-fns/esm'
77

8-
export function useNewsList(date: Date): UseQueryResult<any> {
8+
export function useNewsList(date: Date, enabled = true): UseQueryResult<any> {
99
const startTime = startOfMonth(date).getTime() / 1000
1010
const endTime = Math.floor(addDays(date, 45).getTime() / 1000)
1111
return useQuery({
12+
enabled,
1213
queryKey: ['newsList', startTime, endTime],
1314
queryFn: async () => Calendar.getNewsList(startTime, endTime),
1415
select(data) {
@@ -24,10 +25,11 @@ export function useNewsList(date: Date): UseQueryResult<any> {
2425
})
2526
}
2627

27-
export function useEventList(date: Date) {
28+
export function useEventList(date: Date, enabled = true) {
2829
const startTime = startOfMonth(date).getTime() / 1000
2930
const endTime = Math.floor(addDays(date, 45).getTime() / 1000)
3031
return useQuery<any>({
32+
enabled,
3133
queryKey: ['eventList', startTime, endTime],
3234
queryFn: async () => Calendar.getEventList(startTime, endTime),
3335
select(data) {
@@ -43,10 +45,11 @@ export function useEventList(date: Date) {
4345
})
4446
}
4547

46-
export function useNFTList(date: Date) {
48+
export function useNFTList(date: Date, enabled = true) {
4749
const startTime = startOfMonth(date).getTime() / 1000
4850
const endTime = Math.floor(endOfMonth(date).getTime() / 1000)
4951
return useQuery<any>({
52+
enabled,
5053
queryKey: ['nftList', startTime, endTime],
5154
queryFn: async () => Calendar.getNFTList(startTime, endTime),
5255
select(data) {

Diff for: packages/shared/src/UI/components/AssetsManagement/ChainRuntimeProvider.tsx

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EMPTY_LIST, NetworkPluginID } from '@masknet/shared-base'
22
import type { Web3Helper } from '@masknet/web3-helpers'
3-
import { ChainId } from '@masknet/web3-shared-evm'
3+
import { CHAIN_DESCRIPTORS, ChainId, type NetworkType, type SchemaType } from '@masknet/web3-shared-evm'
44
import { ChainId as FlowChainId } from '@masknet/web3-shared-flow'
55
import { noop, sortBy } from 'lodash-es'
66
import { ChainId as SolanaChainId } from '@masknet/web3-shared-solana'
@@ -33,7 +33,8 @@ const ChainRuntimeContext = createContext<ChainRuntimeOptions>({
3333
networks: EMPTY_LIST,
3434
})
3535

36-
// https://docs.simplehash.com/reference/chains
36+
// https://docs.simplehash.com/reference/chains
37+
// sync `resolveChainId` and `ChainNameMap` in `web3-providers/src/SimpleHash/helpers.ts`
3738
const SimpleHashSupportedChains: Record<NetworkPluginID, number[]> = {
3839
[NetworkPluginID.PLUGIN_EVM]: [
3940
ChainId.Mainnet,
@@ -45,6 +46,7 @@ const SimpleHashSupportedChains: Record<NetworkPluginID, number[]> = {
4546
ChainId.Avalanche,
4647
ChainId.xDai,
4748
ChainId.Scroll,
49+
ChainId.Zora,
4850
],
4951
[NetworkPluginID.PLUGIN_SOLANA]: [SolanaChainId.Mainnet],
5052
[NetworkPluginID.PLUGIN_FLOW]: [FlowChainId.Mainnet],
@@ -64,10 +66,15 @@ export const ChainRuntimeProvider = memo<PropsWithChildren<ChainRuntimeProviderP
6466

6567
const networks = useMemo(() => {
6668
const supported = SimpleHashSupportedChains[pluginID]
67-
return sortBy(
68-
allNetworks.filter((x) => (x.network === 'mainnet' || x.isCustomized) && supported.includes(x.chainId)),
69-
(x) => supported.indexOf(x.chainId),
69+
const networks = allNetworks.filter(
70+
(x) => (x.network === 'mainnet' || x.isCustomized) && supported.includes(x.chainId),
7071
)
72+
// hard-coded for Zora
73+
if (pluginID === NetworkPluginID.PLUGIN_EVM) {
74+
const zora = CHAIN_DESCRIPTORS.find((x) => x.chainId === ChainId.Zora)
75+
if (zora) networks.push(zora as ReasonableNetwork<ChainId, SchemaType, NetworkType>)
76+
}
77+
return sortBy(networks, (x) => supported.indexOf(x.chainId))
7178
}, [allNetworks, pluginID])
7279

7380
const currentChainId = chainId ?? defaultChainId ?? (networks.length === 1 ? networks[0].chainId : chainId)

Diff for: packages/shared/src/UI/components/NetworkIcon/index.tsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import type { Web3Helper } from '@masknet/web3-helpers'
22
import { useNetwork } from '@masknet/web3-hooks-base'
3-
import type { NetworkPluginID } from '@masknet/shared-base'
3+
import { NetworkPluginID } from '@masknet/shared-base'
44
import { ImageIcon, type ImageIconProps } from '../ImageIcon/index.js'
55
import { ChainIcon } from '../index.js'
66
import { memo } from 'react'
77
import type { ReasonableNetwork } from '@masknet/web3-shared-base'
8+
import { CHAIN_DESCRIPTORS as EVM_CHAIN_DESCRIPTORS } from '@masknet/web3-shared-evm'
9+
import { CHAIN_DESCRIPTORS as SOLANA_CHAIN_DESCRIPTORS } from '@masknet/web3-shared-solana'
10+
import { CHAIN_DESCRIPTORS as FLOW_CHAIN_DESCRIPTORS } from '@masknet/web3-shared-flow'
811

912
export interface NetworkIconProps extends ImageIconProps {
1013
pluginID: NetworkPluginID
@@ -16,11 +19,17 @@ export interface NetworkIconProps extends ImageIconProps {
1619
network?: ReasonableNetwork<Web3Helper.ChainIdAll, Web3Helper.SchemaTypeAll, Web3Helper.NetworkTypeAll>
1720
}
1821

22+
const descriptorsMap = {
23+
[NetworkPluginID.PLUGIN_EVM]: EVM_CHAIN_DESCRIPTORS,
24+
[NetworkPluginID.PLUGIN_SOLANA]: SOLANA_CHAIN_DESCRIPTORS,
25+
[NetworkPluginID.PLUGIN_FLOW]: FLOW_CHAIN_DESCRIPTORS,
26+
} as const
27+
1928
export const NetworkIcon = memo(function NetworkIcon(props: NetworkIconProps) {
2029
const { pluginID, chainId, icon, network: expectedNetwork, ...rest } = props
2130
const fallbackNetwork = useNetwork(pluginID, chainId)
2231
const network = expectedNetwork || fallbackNetwork
23-
const iconUrl = network?.iconUrl || icon
32+
const iconUrl = network?.iconUrl || icon || descriptorsMap[pluginID].find((x) => x.chainId === chainId)?.iconUrl
2433

2534
if (iconUrl && !network?.isCustomized) return <ImageIcon size={20} {...rest} icon={iconUrl} />
2635
return (

Diff for: packages/web3-providers/src/SimpleHash/helpers.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export function createNonFungibleCollection(
140140
}
141141
}
142142

143-
export const resolveChainId: (chainId: string) => ChainId | undefined = memoize(function resolveChainId(
143+
export const resolveChainId: (chain: string) => ChainId | undefined = memoize(function resolveChainId(
144144
chain: string,
145145
): ChainId | undefined {
146146
// Some of the `chainResolver.chainId()` results do not match.
@@ -165,6 +165,10 @@ export const resolveChainId: (chainId: string) => ChainId | undefined = memoize(
165165
return ChainId.Scroll
166166
case 'celo':
167167
return ChainId.Celo
168+
case 'zora':
169+
return ChainId.Zora
170+
case 'fantom':
171+
return ChainId.Fantom
168172
default:
169173
return undefined
170174
}
@@ -181,7 +185,8 @@ const ChainNameMap: Record<NetworkPluginID, Record<number, string>> = {
181185
[ChainId.xDai]: 'gnosis',
182186
[ChainId.Base]: 'base',
183187
[ChainId.Scroll]: 'scroll',
184-
[ChainId.Celo]: 'celo',
188+
[ChainId.Zora]: 'zora',
189+
[ChainId.Fantom]: 'fantom',
185190
},
186191
[NetworkPluginID.PLUGIN_SOLANA]: {
187192
[SolanaChainId.Mainnet]: 'solana',

Diff for: packages/web3-shared/evm/src/assets/zora.png

4.85 KB
Loading

Diff for: packages/web3-shared/evm/src/constants/chains.json

+24
Original file line numberDiff line numberDiff line change
@@ -1328,5 +1328,29 @@
13281328
"url": "https://explorer.emerald.oasis.dev/"
13291329
}
13301330
]
1331+
},
1332+
{
1333+
"chainId": 7777777,
1334+
"name": "Zora",
1335+
"type": "Zora",
1336+
"network": "mainnet",
1337+
"features": [],
1338+
"nativeCurrency": {
1339+
"chainId": 42262,
1340+
"name": "Ether",
1341+
"symbol": "ETH",
1342+
"decimals": 18,
1343+
"logoURL": "https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/ethereum/info/logo.png/quality=85"
1344+
},
1345+
"defaultGasLimit": "90000",
1346+
"minGasLimit": "21000",
1347+
"infoURL": "https://zora.co/",
1348+
"shortName": "Zora",
1349+
"explorers": [
1350+
{
1351+
"name": "Zora Superscan",
1352+
"url": "https://zora.superscan.network/"
1353+
}
1354+
]
13311355
}
13321356
]

Diff for: packages/web3-shared/evm/src/constants/descriptors.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export const NETWORK_DESCRIPTORS: ReadonlyArray<NetworkDescriptor<ChainId, Netwo
195195
iconColor: 'rgb(53, 208, 127)',
196196
averageBlockDelay: 10,
197197
backgroundGradient: 'linear-gradient(180deg, rgba(251, 204, 92, 0.15) 0%, rgba(251, 204, 92, 0.05) 100%)',
198-
isMainnet: false,
198+
isMainnet: true,
199199
},
200200
{
201201
ID: `${PLUGIN_ID}_scroll`,
@@ -351,6 +351,18 @@ export const NETWORK_DESCRIPTORS: ReadonlyArray<NetworkDescriptor<ChainId, Netwo
351351
isMainnet: false,
352352
averageBlockDelay: 10,
353353
},
354+
{
355+
ID: `${PLUGIN_ID}_zora`,
356+
networkSupporterPluginID: PLUGIN_ID,
357+
chainId: ChainId.Zora,
358+
type: NetworkType.Zora,
359+
icon: new URL('../assets/zora.png', import.meta.url).href,
360+
iconColor: 'rgb(36, 150, 238)',
361+
name: 'Zora',
362+
// Won't list in network list
363+
isMainnet: false,
364+
averageBlockDelay: 10,
365+
},
354366
]
355367

356368
export const CHAIN_DESCRIPTORS: ReadonlyArray<ChainDescriptor<ChainId, SchemaType, NetworkType>> = CHAINS.map((x) => {

Diff for: packages/web3-shared/evm/src/types/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ export enum ChainId {
149149
/** BitTorrent Chain Mainnet */
150150
BitTorrent = 199,
151151

152+
Zora = 7777777,
153+
152154
// For any chains not supported yet.
153155
Invalid = 0,
154156
}
@@ -311,6 +313,7 @@ export enum NetworkType {
311313
Scroll = 'Scroll',
312314
Moonbeam = 'Moonbeam',
313315
XLayer = 'XLayer',
316+
Zora = 'Zora',
314317
CustomNetwork = 'CustomNetwork',
315318
}
316319

0 commit comments

Comments
 (0)