Skip to content

Commit

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

* fix: mf-6128 add XLayer Chain (#11564)

* fixup! fix: mf-6128 add XLayer Chain (#11565)

* chore: rename XLayer to X Layer (#11566)

* fix: correct x layer contract address (#11567)

* fixup! fix: correct x layer contract address (#11569)

* fix: scam sniffer (#11568)

* fix: polyfill is missing regenerator-runtime tslib and reflect-metadata

* chore: remove console.log

* fix: scam sniffer

---------

Co-authored-by: Jack Works <[email protected]>

* fix: history for X Layer is not avaliable for now (#11570)

---------

Co-authored-by: Wukong Sun <[email protected]>
Co-authored-by: nuanyang233 <[email protected]>
Co-authored-by: Jack Works <[email protected]>
  • Loading branch information
4 people authored Apr 16, 2024
1 parent 27d368e commit 743cc7e
Show file tree
Hide file tree
Showing 25 changed files with 93 additions and 96 deletions.
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@
"wmatic",
"xdai",
"xlarge",
"xlayer",
"zerion",
"zilliqa",
"zksync",
Expand Down
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.24.7",
"version": "2.24.8",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ const AssetItem = memo(function AssetItem({ asset, onItemClick, ...rest }: Asset
const providerURL = network?.isCustomized ? network.rpcUrl : undefined
const [seen, ref] = useEverSeen<HTMLLIElement>()
// Debank might not provide asset from current custom network
// TODO Temporarily get X1 Testnet balance via rpc
// TODO Temporarily get XLayer balance via rpc
const tryRpc =
(!asset.balance || isZero(asset.balance)) &&
(network?.isCustomized || network?.chainId === ChainId.X1_Testnet) &&
(network?.isCustomized || network?.chainId === ChainId.XLayer) &&
seen
const { data: rpcBalance, isPending } = useFungibleTokenBalance(
NetworkPluginID.PLUGIN_EVM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { type NetworkPluginID } from '@masknet/shared-base'
import { makeStyles } from '@masknet/theme'
import { useChainContext } from '@masknet/web3-hooks-base'
import { type RedPacketJSONPayload } from '@masknet/web3-providers/types'
import { ChainId } from '@masknet/web3-shared-evm'
import { List } from '@mui/material'
import { memo } from 'react'
import { useRedPacketTrans } from '../locales/index.js'
Expand Down Expand Up @@ -47,7 +48,13 @@ export const RedPacketHistoryList = memo(function RedPacketHistoryList({ onSelec

if (isPending) return <LoadingStatus className={classes.placeholder} iconSize={30} />

if (!histories?.length) return <EmptyStatus className={classes.placeholder}>{t.search_no_result()}</EmptyStatus>
if (!histories?.length) {
return (
<EmptyStatus className={classes.placeholder}>
{ChainId.XLayer === chainId ? t.coming_soon() : t.search_no_result()}
</EmptyStatus>
)
}

return (
<div className={classes.root}>
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/RedPacket/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const base: Plugin.Shared.Definition = {
ChainId.Astar,
ChainId.Scroll,
ChainId.Metis,
ChainId.X1_Testnet,
ChainId.XLayer,
],
},
[NetworkPluginID.PLUGIN_FLOW]: { supportedChainIds: [] },
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/RedPacket/src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"search": "Search",
"loading_token": "Loading token...",
"search_no_result": "No results",
"coming_soon": "Coming soon",
"nft_already_added": "The collectible has already been added.",
"nft_invalid_owner": "The collectible does not belong to you.",
"nft_max_shares": "The maximum number of NFTs to be sold in NFT lucky drop contract is {{- amount}}.",
Expand Down
14 changes: 8 additions & 6 deletions packages/plugins/ScamSniffer/src/SiteAdaptor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ function Renderer(
project: ScamResult
}>,
) {
usePluginWrapper(true)
return <ScamAlert result={props.project} />
}

Expand Down Expand Up @@ -53,7 +52,7 @@ const site: Plugin.SiteAdaptor.Definition = {
}),
[id?.postID, author?.userId, nickname, links, content],
)
const { data: scamProject, isLoading } = useQuery({
const { data: scamProject, isFetching } = useQuery({
queryKey: ['scam-sniffer', 'check-post', id?.postID, nickname, author?.userId, links, content],
enabled: isTwitter,
queryFn: () => {
Expand All @@ -64,18 +63,20 @@ const site: Plugin.SiteAdaptor.Definition = {
const origins = links.map((link) => new URL(link).origin)
const queries = useQueries({
queries: origins.map((origin) => ({
enabled: !scamProject && !isLoading,
enabled: !scamProject && !isFetching,
queryKey: ['scam-sniffer', 'check-url', origin],
queryFn: async () => {
const url = urlcat('https://domain-api.scamsniffer.io/check', {
url: origin,
api_key: API_KEY,
})
const res = await fetchJSON<CheckResult>(url)

return res
},
})),
})

const firstHit = first(
compact(queries.filter((x) => x.isSuccess && x.data.status === 'BLOCKED').map((x) => x.data)),
)
Expand All @@ -90,10 +91,11 @@ const site: Plugin.SiteAdaptor.Definition = {
matchType: 'sim',
} satisfies ScamResult
}, [firstHit?.host, firstHit?.url, author?.userId, nickname])

if (!isTwitter) return null
const project = scamProject || fallbackScamProject
if (!project) return null

usePluginWrapper(!!project)

if (!project || !isTwitter) return null

return <Renderer project={project} />
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/Tips/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const base: Plugin.Shared.Definition = {
ChainId.Scroll,
ChainId.Optimism,
ChainId.Metis,
ChainId.X1_Testnet,
ChainId.XLayer,
],
},
[NetworkPluginID.PLUGIN_FLOW]: { supportedChainIds: [] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ export function getEVMAvailableTraderProviders(networkType?: NetworkType) {
case NetworkType.Conflux:
case NetworkType.Moonbeam:
case NetworkType.CustomNetwork:
case NetworkType.X1:
case NetworkType.X1_Testnet:
case NetworkType.XLayer:
console.error('To be implement network:', networkType)
return EMPTY_LIST
default:
Expand Down
3 changes: 1 addition & 2 deletions packages/plugins/Trader/src/providers/ZeroX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ function getNativeTokenLabel(networkType: NetworkType) {
case NetworkType.Scroll:
case NetworkType.Moonbeam:
case NetworkType.CustomNetwork:
case NetworkType.X1:
case NetworkType.X1_Testnet:
case NetworkType.XLayer:
return ZRX_NATIVE_TOKEN_ADDRESS
default:
safeUnreachable(networkType)
Expand Down
11 changes: 6 additions & 5 deletions packages/polyfills/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ const { list } = compat({
modules: ['core-js/stable'],
})

const ecmascriptPolyfill = list
.map((item) => require.resolve(`core-js/modules/${item}.js`))
.concat(require.resolve('./runtime/transpiler.js'))
.map((x) => `import '${x}'\n`)
.join('')
export default defineConfig([
{
input: 'entry',
Expand All @@ -39,11 +44,7 @@ globalThis[Symbol.for('mask_init_polyfill')] = true;
},
plugins: [
virtual({
entry: list
.map((item) => require.resolve(`core-js/modules/${item}.js`))
.concat(require.resolve('./runtime/transpiler.js'))
.map((x) => `import '${x}'\n`)
.join(''),
entry: ecmascriptPolyfill,
}),
...plugins(),
],
Expand Down
2 changes: 1 addition & 1 deletion packages/polyfills/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@masknet/polyfill",
"version": "0.0.0",
"private": true,
"sideEffects": false,
"sideEffects": ["./runtime/*.js"],
"type": "module",
"scripts": {
"build": "rollup -c"
Expand Down
2 changes: 1 addition & 1 deletion packages/polyfills/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const lockfilePath = fileURLToPath(new URL('../../pnpm-lock.yaml', import.meta.u
const lockfile = await readFile(lockfilePath)
const hash = createHash('sha256')
hash.update(lockfile)
const polyfillVersion = 'v0' + hash.digest('hex')
const polyfillVersion = 'v1_' + hash.digest('hex')

const versionFilePath = fileURLToPath(new URL('./dist/version.txt', import.meta.url))
const built = (await readFile(versionFilePath, 'utf-8').catch(() => '')) === polyfillVersion
Expand Down
8 changes: 4 additions & 4 deletions packages/web3-constants/evm/ethereum.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"Astar": "0xf5056B96ab242C566002852d0b98ce0BcDf1af51",
"Scroll": "0xbC7d98985966f56A66B0cB5F23d865676dc2ac84",
"Metis": "0xC119574D5Fb333F5AC018658D4d8b5035E16bf39",
"X1": "0x8A42F70047a99298822dD1dbA34b454fc49913F2",
"X1_Testnet": "0x8A42F70047a99298822dD1dbA34b454fc49913F2"
"XLayer": "0x87EDa3a18e8C005e120B235AC52F3305186d5d25",
"XLayer_Testnet": "0x8A42F70047a99298822dD1dbA34b454fc49913F2"
},
"MULTICALL_ADDRESS": {
"Mainnet": "0x1F98415757620B543A52E61c46B32eB19261F984",
Expand All @@ -50,8 +50,8 @@
"Astar": "0x1410304B91a280ad083196B0B50e9d8df749d860",
"Scroll": "0x20Ee232E34B87061fE3ba0DB738A3531A3e915BF",
"Metis": "0x6cc1b1058F9153358278C35E0b2D382f1585854B",
"X1": "0xF8935Df67cAB7BfcA9532D1Ac2088C5c39b995b5",
"X1_Testnet": "0xF8935Df67cAB7BfcA9532D1Ac2088C5c39b995b5"
"XLayer": "0x8A42F70047a99298822dD1dbA34b454fc49913F2",
"XLayer_Testnet": "0xF8935Df67cAB7BfcA9532D1Ac2088C5c39b995b5"
},
"ENS_REGISTRAR_ADDRESS": {
"Mainnet": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
Expand Down
8 changes: 4 additions & 4 deletions packages/web3-constants/evm/nft-red-packet.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"Astar": "0xc3e62b2CC70439C32a381Bfc056aCEd1d7162cef",
"Scroll": "0x727F8030964CCEC6B0E344399c8d8E2B4C837351",
"Metis": "0x812463356F58fc8194645A1838ee6C52D8ca2D26",
"X1": "0xd81c16d71432d7df04575ffe9fed76f837fea0cc",
"X1_Testnet": "0xd81c16d71432d7df04575ffe9fed76f837fea0cc"
"XLayer": "0x977baB5f7e2cEd0C91fDA890Ed1DBDfD3Ee9AE81",
"XLayer_Testnet": "0xd81c16d71432d7df04575ffe9fed76f837fea0cc"
},
"NFT_RED_PACKET_ADDRESS_BLOCK_HEIGHT": {
"Mainnet": 13229711,
Expand Down Expand Up @@ -46,7 +46,7 @@
"Astar": 0,
"Scroll": 96705,
"Metis": 1702933,
"X1": 0,
"X1_Testnet": 7319723
"XLayer": 0,
"XLayer_Testnet": 7319723
}
}
8 changes: 4 additions & 4 deletions packages/web3-constants/evm/red-packet.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"Astar": "0x2cF46Db820e279c5fBF778367D49d9C931D54524",
"Scroll": "0x16f61cb37169523635B6761f3C946892fb3c18fB",
"Metis": "0x2cf91AD8C175305EBe6970Bd8f81231585EFbd77",
"X1": "0x977baB5f7e2cEd0C91fDA890Ed1DBDfD3Ee9AE81",
"X1_Testnet": "0x977baB5f7e2cEd0C91fDA890Ed1DBDfD3Ee9AE81"
"XLayer": "0xDb847f1D8099C5b15519ECfd0b0C981d719bccE6",
"XLayer_Testnet": "0x977baB5f7e2cEd0C91fDA890Ed1DBDfD3Ee9AE81"
},
"HAPPY_RED_PACKET_ADDRESS_V4_BLOCK_HEIGHT": {
"Mainnet": 12939427,
Expand Down Expand Up @@ -69,7 +69,7 @@
"Astar": 910985,
"Scroll": 96705,
"Metis": 1702860,
"X1": 0,
"X1_Testnet": 7320220
"XLayer": 0,
"XLayer_Testnet": 7320220
}
}
12 changes: 6 additions & 6 deletions packages/web3-constants/evm/rpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
"Astar": ["https://astar.api.onfinality.io/public"],
"Scroll": ["https://rpc.scroll.io"],
"Metis": ["https://andromeda.metis.io/?owner=1088"],
"X1": ["https://rpc.x1.tech"],
"X1_Testnet": ["https://testrpc.x1.tech"]
"XLayer": ["https://rpc.xlayer.tech"],
"XLayer_Testnet": ["https://testrpc.xlayer.tech"]
},
"RPC_URLS_OFFICIAL": {
"Mainnet": ["https://mainnet.infura.io/v3/d65858b010d249419cf8687eca12b094"],
Expand Down Expand Up @@ -103,8 +103,8 @@
"Astar": ["https://rpc.astar.network:8545"],
"Scroll": ["https://rpc.scroll.io"],
"Metis": ["https://andromeda.metis.io/?owner=1088"],
"X1": ["https://rpc.x1.tech"],
"X1_Testnet": ["https://testrpc.x1.tech"]
"XLayer": ["https://rpc.xlayer.tech"],
"XLayer_Testnet": ["https://testrpc.xlayer.tech"]
},
"RPC_WEIGHTS": {
"Mainnet": [0, 1, 2, 3, 4],
Expand Down Expand Up @@ -134,7 +134,7 @@
"Astar": [0, 0, 0, 0, 0],
"Scroll": [0, 0, 0, 0, 0],
"Metis": [0, 0, 0, 0, 0],
"X1": [0, 0, 0, 0, 0],
"X1_Testnet": [0, 0, 0, 0, 0]
"XLayer": [0, 0, 0, 0, 0],
"XLayer_Testnet": [0, 0, 0, 0, 0]
}
}
4 changes: 2 additions & 2 deletions packages/web3-constants/evm/token-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"Astar": ["https://tokens.r2d2.to/latest/592/tokens.json"],
"Scroll": ["https://tokens.r2d2.to/latest/534352/tokens.json"],
"Metis": ["https://tokens.r2d2.to/latest/1088/tokens.json"],
"X1": ["https://tokens.r2d2.to/latest/196/tokens.json"],
"X1_Testnet": ["https://tokens.r2d2.to/latest/195/tokens.json"]
"XLayer": ["https://tokens.r2d2.to/latest/196/tokens.json"],
"XLayer_Testnet": ["https://tokens.r2d2.to/latest/195/tokens.json"]
}
}
16 changes: 8 additions & 8 deletions packages/web3-constants/evm/token.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"Astar": "0xaeaaf0e2c81af264101b9129c00f4440ccf0f720",
"Scroll": "0x5300000000000000000000000000000000000004",
"Metis": "0x420000000000000000000000000000000000000A",
"X1": "0x049a970485cf54904a6da1e1cea2ac18c9b8fb9f",
"X1_Testnet": "0x049a970485cf54904a6da1e1cea2ac18c9b8fb9f"
"XLayer": "0x5a77f1443d16ee5761d310e38b62f77f726bc71c",
"XLayer_Testnet": "0x049a970485cf54904a6da1e1cea2ac18c9b8fb9f"
},
"LDO_stETH_ADDRESS": {
"Mainnet": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
Expand Down Expand Up @@ -57,8 +57,8 @@
"Aurora": "0xb12bfca5a55806aaf64e99521918a4bf0fc40802",
"Astar": "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98",
"Scroll": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4",
"X1": "0x2e1cba4a9f6e69d27e65046fc93b873b05f79a39",
"X1_Testnet": "0x2e1cba4a9f6e69d27e65046fc93b873b05f79a39"
"XLayer": "0x74b7f16337b8972027f6196a17a631ac6de26d22",
"XLayer_Testnet": "0x2e1cba4a9f6e69d27e65046fc93b873b05f79a39"
},
"USDT_ADDRESS": {
"Mainnet": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
Expand All @@ -74,8 +74,8 @@
"Aurora": "0x4988a896b1227218e4a686fde5eabdcabd91571f",
"Astar": "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283",
"Scroll": "0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df",
"X1": "0xb81fe42de28e7452088b77f3eb9685487734e088",
"X1_Testnet": "0xb81fe42de28e7452088b77f3eb9685487734e088"
"XLayer": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"XLayer_Testnet": "0xb81fe42de28e7452088b77f3eb9685487734e088"
},
"aUSDT_ADDRESS": {
"Mainnet": "0x71fc860F7D3A592A4a98740e39dB31d25db65ae8",
Expand Down Expand Up @@ -318,8 +318,8 @@
"Astar": "0x0000000000000000000000000000000000000000",
"Scroll": "0x0000000000000000000000000000000000000000",
"Metis": "0x0000000000000000000000000000000000000000",
"X1": "0x0000000000000000000000000000000000000000",
"X1_Testnet": "0x0000000000000000000000000000000000000000"
"XLayer": "0x0000000000000000000000000000000000000000",
"XLayer_Testnet": "0x0000000000000000000000000000000000000000"
},
"WETH_ADDRESS": {
"Mainnet": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
Expand Down
File renamed without changes
Loading

0 comments on commit 743cc7e

Please sign in to comment.