mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
minor fixes (#1639)
* minor fixes * error fix * add loading * add price loading * remove console.log Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
This commit is contained in:
parent
52ad877b13
commit
dc4add5c70
@ -57,7 +57,9 @@ export async function order(
|
|||||||
_consumeMarketFee: {
|
_consumeMarketFee: {
|
||||||
consumeMarketFeeAddress: marketFeeAddress,
|
consumeMarketFeeAddress: marketFeeAddress,
|
||||||
consumeMarketFeeAmount: consumeMarketOrderFee,
|
consumeMarketFeeAmount: consumeMarketOrderFee,
|
||||||
consumeMarketFeeToken: asset.accessDetails.baseToken.address
|
consumeMarketFeeToken:
|
||||||
|
asset?.accessDetails?.baseToken?.address ||
|
||||||
|
'0x0000000000000000000000000000000000000000'
|
||||||
}
|
}
|
||||||
} as OrderParams
|
} as OrderParams
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import { toast } from 'react-toastify'
|
|||||||
import { useIsMounted } from '@hooks/useIsMounted'
|
import { useIsMounted } from '@hooks/useIsMounted'
|
||||||
import { useMarketMetadata } from '@context/MarketMetadata'
|
import { useMarketMetadata } from '@context/MarketMetadata'
|
||||||
import Alert from '@shared/atoms/Alert'
|
import Alert from '@shared/atoms/Alert'
|
||||||
|
import Loader from '@shared/atoms/Loader'
|
||||||
|
|
||||||
export default function Download({
|
export default function Download({
|
||||||
asset,
|
asset,
|
||||||
@ -41,6 +42,7 @@ export default function Download({
|
|||||||
const [hasDatatoken, setHasDatatoken] = useState(false)
|
const [hasDatatoken, setHasDatatoken] = useState(false)
|
||||||
const [statusText, setStatusText] = useState('')
|
const [statusText, setStatusText] = useState('')
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
const [isPriceLoading, setIsPriceLoading] = useState(false)
|
||||||
const [isOwned, setIsOwned] = useState(false)
|
const [isOwned, setIsOwned] = useState(false)
|
||||||
const [validOrderTx, setValidOrderTx] = useState('')
|
const [validOrderTx, setValidOrderTx] = useState('')
|
||||||
const [orderPriceAndFees, setOrderPriceAndFees] =
|
const [orderPriceAndFees, setOrderPriceAndFees] =
|
||||||
@ -64,8 +66,11 @@ export default function Download({
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
!orderPriceAndFees && setIsPriceLoading(true)
|
||||||
|
|
||||||
const _orderPriceAndFees = await getOrderPriceAndFees(asset, ZERO_ADDRESS)
|
const _orderPriceAndFees = await getOrderPriceAndFees(asset, ZERO_ADDRESS)
|
||||||
setOrderPriceAndFees(_orderPriceAndFees)
|
setOrderPriceAndFees(_orderPriceAndFees)
|
||||||
|
!orderPriceAndFees && setIsPriceLoading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
init()
|
init()
|
||||||
@ -84,6 +89,7 @@ export default function Download({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
|
(asset?.accessDetails?.type === 'fixed' && !orderPriceAndFees) ||
|
||||||
!isMounted ||
|
!isMounted ||
|
||||||
!accountId ||
|
!accountId ||
|
||||||
!asset?.accessDetails ||
|
!asset?.accessDetails ||
|
||||||
@ -112,7 +118,8 @@ export default function Download({
|
|||||||
hasDatatoken,
|
hasDatatoken,
|
||||||
accountId,
|
accountId,
|
||||||
isOwned,
|
isOwned,
|
||||||
isUnsupportedPricing
|
isUnsupportedPricing,
|
||||||
|
orderPriceAndFees
|
||||||
])
|
])
|
||||||
|
|
||||||
async function handleOrderOrDownload() {
|
async function handleOrderOrDownload() {
|
||||||
@ -184,12 +191,17 @@ export default function Download({
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Price
|
{isPriceLoading ? (
|
||||||
accessDetails={asset.accessDetails}
|
<Loader message="Calculating full price (including fees)" />
|
||||||
orderPriceAndFees={orderPriceAndFees}
|
) : (
|
||||||
conversion
|
<Price
|
||||||
size="large"
|
accessDetails={asset.accessDetails}
|
||||||
/>
|
orderPriceAndFees={orderPriceAndFees}
|
||||||
|
conversion
|
||||||
|
size="large"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{!isInPurgatory && <PurchaseButton />}
|
{!isInPurgatory && <PurchaseButton />}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user