From 351994bd287d748da29ac036f011c258948e6cf5 Mon Sep 17 00:00:00 2001 From: Wukong Sun Date: Fri, 7 Mar 2025 19:05:01 +0800 Subject: [PATCH 1/3] fix: mf-6650 show tab arrow --- packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx b/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx index 1da28d8ae601..5357188094f9 100644 --- a/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx +++ b/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx @@ -97,7 +97,7 @@ export function NftHistory() { return (
- + {isLoading ? : !histories?.length ? From e66a52f0c8b744d5ab9c3b9ad87f2c0d4d46ce4b Mon Sep 17 00:00:00 2001 From: Wukong Sun Date: Fri, 7 Mar 2025 19:51:53 +0800 Subject: [PATCH 2/3] fix: mf-6653 narrow down nft default chains --- .../src/SiteAdaptor/views/NftHistory.tsx | 51 +++++++++++-------- packages/plugins/RedPacket/src/constants.ts | 15 +----- .../src/Chainbase/apis/RedPacketAPI.ts | 9 +++- packages/web3-shared/evm/src/types/index.ts | 1 + 4 files changed, 40 insertions(+), 36 deletions(-) diff --git a/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx b/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx index 5357188094f9..2196a3b46dfd 100644 --- a/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx +++ b/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx @@ -22,10 +22,10 @@ const useStyles = makeStyles()((theme) => { return { root: { display: 'flex', - width: 568, - padding: 0, + width: '100%', + minHeight: 0, boxSizing: 'border-box', - height: 474, + padding: theme.spacing(0, 2), flexDirection: 'column', margin: '0 auto', overflow: 'auto', @@ -38,6 +38,15 @@ const useStyles = makeStyles()((theme) => { display: 'none', }, }, + content: { + minHeight: 0, + flexGrow: 1, + overflow: 'auto', + scrollbarWidth: 'none', + '&::-webkit-scrollbar': { + display: 'none', + }, + }, item: { width: '100%', padding: 0, @@ -98,23 +107,25 @@ export function NftHistory() { return (
- {isLoading ? - - : !histories?.length ? - - - You haven't created any NFT lucky drop yet. Try to create one and share fortune with your - friends. - - - : - {histories.map((history) => ( - - - - ))} - - } +
+ {isLoading ? + + : !histories?.length ? + + + You haven't created any NFT lucky drop yet. Try to create one and share fortune with your + friends. + + + : + {histories.map((history) => ( + + + + ))} + + } +
) } diff --git a/packages/plugins/RedPacket/src/constants.ts b/packages/plugins/RedPacket/src/constants.ts index 4188874f5564..4b2234e998c9 100644 --- a/packages/plugins/RedPacket/src/constants.ts +++ b/packages/plugins/RedPacket/src/constants.ts @@ -42,28 +42,15 @@ export const enum RoutePaths { export const MAX_FILE_SIZE = 1.5 * 1024 * 1024 export const DURATION = 60 * 60 * 24 +// Chains that supported by the intersection of SimpleHash, Chainbase, and our deployed chains. export const NFT_DEFAULT_CHAINS = [ ChainId.Mainnet, ChainId.BSC, ChainId.Polygon, ChainId.Arbitrum, - ChainId.xDai, - ChainId.Fantom, ChainId.Avalanche, - ChainId.Celo, ChainId.Optimism, - ChainId.Aurora, - ChainId.Fuse, - ChainId.Boba, - ChainId.Moonriver, - ChainId.Conflux, - ChainId.Harmony, - ChainId.Metis, - ChainId.Astar, ChainId.Base, - ChainId.Scroll, - ChainId.XLayer, - ChainId.Sei, ] function createTheme(themeId: string, cover: string): FireflyRedPacketAPI.ThemeGroupSettings { diff --git a/packages/web3-providers/src/Chainbase/apis/RedPacketAPI.ts b/packages/web3-providers/src/Chainbase/apis/RedPacketAPI.ts index 9f0673bb3608..f79f7a522a5a 100644 --- a/packages/web3-providers/src/Chainbase/apis/RedPacketAPI.ts +++ b/packages/web3-providers/src/Chainbase/apis/RedPacketAPI.ts @@ -15,7 +15,7 @@ import type { RedPacketBaseAPI } from '../../entry-types.js' export class ChainbaseRedPacketAPI implements RedPacketBaseAPI.Provider { /** - * @see https://docs.chainbase.com/reference/supported-chains + * @see https://docs.chainbase.com/platform/supported-networks/supported-networks */ static isSupportedChain(chainId: ChainId) { const supported = [ @@ -25,9 +25,14 @@ export class ChainbaseRedPacketAPI implements RedPacketBaseAPI.Provider Date: Mon, 10 Mar 2025 11:33:20 +0800 Subject: [PATCH 3/3] fix: claim error --- .../src/SiteAdaptor/NftRedPacket/index.tsx | 15 ++++++++------- .../hooks/useClaimNftRedpacketCallback.ts | 2 +- .../src/SiteAdaptor/views/NftHistory.tsx | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/plugins/RedPacket/src/SiteAdaptor/NftRedPacket/index.tsx b/packages/plugins/RedPacket/src/SiteAdaptor/NftRedPacket/index.tsx index bd3f6f1e735d..eb64377d89ca 100644 --- a/packages/plugins/RedPacket/src/SiteAdaptor/NftRedPacket/index.tsx +++ b/packages/plugins/RedPacket/src/SiteAdaptor/NftRedPacket/index.tsx @@ -77,7 +77,6 @@ export function NftRedPacket({ payload, currentPluginID }: NftRedPacketProps) { useEffect(() => { retryAvailability() }, [account]) - console.log('availability', availability) const network = useNetwork(pluginID, payload.chainId) const outdated = !!(availability?.isClaimedAll || availability?.isCompleted || availability?.expired) @@ -152,12 +151,14 @@ export function NftRedPacket({ payload, currentPluginID }: NftRedPacketProps) { const { showSnackbar } = useCustomSnackbar() const claim = useCallback(async () => { - const hash = await claimCallback() - await checkResult() - if (typeof hash === 'string') { - retryAvailability() - } else if (hash instanceof Error) { - showSnackbar(hash.message, { + try { + const hash = await claimCallback() + await checkResult() + if (typeof hash === 'string') { + retryAvailability() + } + } catch (err) { + showSnackbar((err as Error).message, { variant: 'error', }) } diff --git a/packages/plugins/RedPacket/src/SiteAdaptor/hooks/useClaimNftRedpacketCallback.ts b/packages/plugins/RedPacket/src/SiteAdaptor/hooks/useClaimNftRedpacketCallback.ts index 71d280894e93..16d594a2d363 100644 --- a/packages/plugins/RedPacket/src/SiteAdaptor/hooks/useClaimNftRedpacketCallback.ts +++ b/packages/plugins/RedPacket/src/SiteAdaptor/hooks/useClaimNftRedpacketCallback.ts @@ -19,7 +19,7 @@ export function useClaimNftRedpacketCallback(payload: RedPacketNftJSONPayload, t const signedMsg = useMemo(() => { return signMessage(account, payload.privateKey).signature ?? '' }, [account, payload.privateKey]) - return useAsyncFn(async (): Promise => { + return useAsyncFn(async () => { if (!nftRedPacketContract || !id || !account || !totalAmount || !signedMsg) return const transaction = nftRedPacketContract.methods.claim(id, signedMsg, account) diff --git a/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx b/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx index 2196a3b46dfd..cfba144ba836 100644 --- a/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx +++ b/packages/plugins/RedPacket/src/SiteAdaptor/views/NftHistory.tsx @@ -25,7 +25,6 @@ const useStyles = makeStyles()((theme) => { width: '100%', minHeight: 0, boxSizing: 'border-box', - padding: theme.spacing(0, 2), flexDirection: 'column', margin: '0 auto', overflow: 'auto', @@ -41,6 +40,7 @@ const useStyles = makeStyles()((theme) => { content: { minHeight: 0, flexGrow: 1, + padding: theme.spacing(0, 2), overflow: 'auto', scrollbarWidth: 'none', '&::-webkit-scrollbar': {