diff --git a/packages/kit-bg/src/services/ServiceToken.ts b/packages/kit-bg/src/services/ServiceToken.ts index d810ebdc53a..588595d0234 100644 --- a/packages/kit-bg/src/services/ServiceToken.ts +++ b/packages/kit-bg/src/services/ServiceToken.ts @@ -592,12 +592,12 @@ export default class ServiceToken extends ServiceBase { }) { const { engine } = this.backgroundApi; const tokens = await engine.getTokens(networkId); - if (type === 'buy') { - return tokens.filter((t) => { - const { onramperId } = t; - return typeof onramperId === 'string' && onramperId.length > 0; - }); - } + // if (type === 'buy') { + // return tokens.filter((t) => { + // const { onramperId } = t; + // return typeof onramperId === 'string' && onramperId.length > 0; + // }); + // } return tokens.filter((t) => { const { moonpayId } = t; return typeof moonpayId === 'string' && moonpayId.length > 0; diff --git a/packages/kit/src/views/FiatPay/SupportTokenList/index.tsx b/packages/kit/src/views/FiatPay/SupportTokenList/index.tsx index e818710450f..e677b499709 100644 --- a/packages/kit/src/views/FiatPay/SupportTokenList/index.tsx +++ b/packages/kit/src/views/FiatPay/SupportTokenList/index.tsx @@ -3,6 +3,7 @@ import { useCallback, useMemo, useState } from 'react'; import { useNavigation, useRoute } from '@react-navigation/native'; import Fuse from 'fuse.js'; +import { Spinner } from 'native-base'; import { useIntl } from 'react-intl'; import { @@ -139,7 +140,7 @@ const TokenListCell: FC = ({ const buyAction = useCallback(async () => { const signedUrl = await serviceFiatPay.getFiatPayUrl({ type, - cryptoCode: token.onramperId, + cryptoCode: token.moonpayId, address, }); if (signedUrl.length > 0) { @@ -147,7 +148,7 @@ const TokenListCell: FC = ({ url: signedUrl, }); } - }, [address, navigation, serviceFiatPay, token.onramperId, type]); + }, [address, navigation, serviceFiatPay, token.moonpayId, type]); const sellAction = useCallback(async () => { const signedUrl = await serviceFiatPay.getFiatPayUrl({ type, @@ -197,9 +198,8 @@ export const SupportTokenList: FC = () => { const intl = useIntl(); const route = useRoute(); const { networkId, accountId, type = 'buy' } = route.params; - const { tokenList } = useFiatPayTokens(networkId, type); + const { tokenList, loading } = useFiatPayTokens(networkId, type); const { account, network } = useActiveSideAccount({ networkId, accountId }); - const [searchResult, updateSearchResult] = useState([]); const [searchText, updateSearchText] = useState(''); @@ -222,8 +222,15 @@ export const SupportTokenList: FC = () => { [account?.address, accountId, network, networkId, type], ); - const ListEmptyComponent = useCallback( - () => ( + const ListEmptyComponent = useCallback(() => { + if (loading) { + return ( + + + + ); + } + return ( { icon="DatabaseMini" /> - ), - [intl, type], - ); + ); + }, [intl, loading, type]); const separator = useCallback(() => , []); diff --git a/packages/kit/src/views/Market/MarketDetail.tsx b/packages/kit/src/views/Market/MarketDetail.tsx index 8f1145bec6b..f9f38352562 100644 --- a/packages/kit/src/views/Market/MarketDetail.tsx +++ b/packages/kit/src/views/Market/MarketDetail.tsx @@ -227,7 +227,7 @@ const MarketDetailLayout: FC = ({ async (t: TokenType) => { const signedUrl = await backgroundApiProxy.serviceFiatPay.getFiatPayUrl({ type: 'buy', - cryptoCode: t.onramperId, + cryptoCode: t.moonpayId, }); if (signedUrl.length > 0) { navigation.navigate(RootRoutes.Modal, { @@ -292,7 +292,7 @@ const MarketDetailLayout: FC = ({ }} /> ) : null} - {token?.onramperId ? ( + {token?.moonpayId ? ( { buyAction(token); diff --git a/packages/kit/src/views/TokenDetail/TokenInfo/index.tsx b/packages/kit/src/views/TokenDetail/TokenInfo/index.tsx index df92a92830f..4343796f9cb 100644 --- a/packages/kit/src/views/TokenDetail/TokenInfo/index.tsx +++ b/packages/kit/src/views/TokenDetail/TokenInfo/index.tsx @@ -54,7 +54,7 @@ const TokenInfo: FC = ({ token, priceReady, sendAddress }) => { balance: '0', }; - const buyEnable = !!(token?.onramperId && token?.onramperId?.length > 0); + const buyEnable = !!(token?.moonpayId && token?.moonpayId?.length > 0); const sellEnable = !!(token?.moonpayId && token?.moonpayId?.length > 0); const buyAction = useCallback( @@ -62,7 +62,7 @@ const TokenInfo: FC = ({ token, priceReady, sendAddress }) => { const signedUrl = await backgroundApiProxy.serviceFiatPay.getFiatPayUrl({ type: 'buy', address: account?.address, - cryptoCode: t.onramperId, + cryptoCode: t.moonpayId, }); if (signedUrl) { navigation.navigate(RootRoutes.Modal, { @@ -84,7 +84,7 @@ const TokenInfo: FC = ({ token, priceReady, sendAddress }) => { const signedUrl = await backgroundApiProxy.serviceFiatPay.getFiatPayUrl({ type: 'sell', address: account?.id, - cryptoCode: t.onramperId, + cryptoCode: t.moonpayId, }); if (signedUrl) { navigation.navigate(RootRoutes.Modal, {