diff --git a/src/@utils/order.ts b/src/@utils/order.ts index a0bfde14b..418a2f603 100644 --- a/src/@utils/order.ts +++ b/src/@utils/order.ts @@ -57,7 +57,9 @@ export async function order( _consumeMarketFee: { consumeMarketFeeAddress: marketFeeAddress, consumeMarketFeeAmount: consumeMarketOrderFee, - consumeMarketFeeToken: asset.accessDetails.baseToken.address + consumeMarketFeeToken: + asset?.accessDetails?.baseToken?.address || + '0x0000000000000000000000000000000000000000' } } as OrderParams diff --git a/src/components/Asset/AssetActions/Download.tsx b/src/components/Asset/AssetActions/Download.tsx index 84efbaacc..ac9e3f1a5 100644 --- a/src/components/Asset/AssetActions/Download.tsx +++ b/src/components/Asset/AssetActions/Download.tsx @@ -16,6 +16,7 @@ import { toast } from 'react-toastify' import { useIsMounted } from '@hooks/useIsMounted' import { useMarketMetadata } from '@context/MarketMetadata' import Alert from '@shared/atoms/Alert' +import Loader from '@shared/atoms/Loader' export default function Download({ asset, @@ -41,6 +42,7 @@ export default function Download({ const [hasDatatoken, setHasDatatoken] = useState(false) const [statusText, setStatusText] = useState('') const [isLoading, setIsLoading] = useState(false) + const [isPriceLoading, setIsPriceLoading] = useState(false) const [isOwned, setIsOwned] = useState(false) const [validOrderTx, setValidOrderTx] = useState('') const [orderPriceAndFees, setOrderPriceAndFees] = @@ -64,8 +66,11 @@ export default function Download({ ) return + !orderPriceAndFees && setIsPriceLoading(true) + const _orderPriceAndFees = await getOrderPriceAndFees(asset, ZERO_ADDRESS) setOrderPriceAndFees(_orderPriceAndFees) + !orderPriceAndFees && setIsPriceLoading(false) } init() @@ -84,6 +89,7 @@ export default function Download({ useEffect(() => { if ( + (asset?.accessDetails?.type === 'fixed' && !orderPriceAndFees) || !isMounted || !accountId || !asset?.accessDetails || @@ -112,7 +118,8 @@ export default function Download({ hasDatatoken, accountId, isOwned, - isUnsupportedPricing + isUnsupportedPricing, + orderPriceAndFees ]) async function handleOrderOrDownload() { @@ -184,12 +191,17 @@ export default function Download({ /> ) : ( <> - + {isPriceLoading ? ( + + ) : ( + + )} + {!isInPurgatory && } )}