mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Check maximum datatoken to receive for pool priced assets in compute and consume (#627)
* check the maximum available datatoken to receive before buy compute or consume * added previous order check in disable buy button logic when max dt in pool is bellow 1 datatoken * fixed lint errors * hide seccond message if one of the assets in compute has low liquidity
This commit is contained in:
parent
117c3af5f1
commit
15b947bb3f
src/components
@ -10,6 +10,7 @@ interface ButtonBuyProps {
|
|||||||
hasDatatoken: boolean
|
hasDatatoken: boolean
|
||||||
dtSymbol: string
|
dtSymbol: string
|
||||||
dtBalance: string
|
dtBalance: string
|
||||||
|
datasetLowPoolLiquidity: boolean
|
||||||
assetType: string
|
assetType: string
|
||||||
assetTimeout: string
|
assetTimeout: string
|
||||||
isConsumable: boolean
|
isConsumable: boolean
|
||||||
@ -18,6 +19,7 @@ interface ButtonBuyProps {
|
|||||||
hasDatatokenSelectedComputeAsset?: boolean
|
hasDatatokenSelectedComputeAsset?: boolean
|
||||||
dtSymbolSelectedComputeAsset?: string
|
dtSymbolSelectedComputeAsset?: string
|
||||||
dtBalanceSelectedComputeAsset?: string
|
dtBalanceSelectedComputeAsset?: string
|
||||||
|
selectedComputeAssetLowPoolLiquidity?: boolean
|
||||||
selectedComputeAssetType?: string
|
selectedComputeAssetType?: string
|
||||||
isLoading: boolean
|
isLoading: boolean
|
||||||
onClick?: (e: FormEvent<HTMLButtonElement>) => void
|
onClick?: (e: FormEvent<HTMLButtonElement>) => void
|
||||||
@ -33,6 +35,7 @@ function getConsumeHelpText(
|
|||||||
dtSymbol: string,
|
dtSymbol: string,
|
||||||
hasDatatoken: boolean,
|
hasDatatoken: boolean,
|
||||||
hasPreviousOrder: boolean,
|
hasPreviousOrder: boolean,
|
||||||
|
lowPoolLiquidity: boolean,
|
||||||
assetType: string,
|
assetType: string,
|
||||||
isConsumable: boolean,
|
isConsumable: boolean,
|
||||||
consumableFeedback: string
|
consumableFeedback: string
|
||||||
@ -44,8 +47,9 @@ function getConsumeHelpText(
|
|||||||
? `You bought this ${assetType} already allowing you to use it without paying again.`
|
? `You bought this ${assetType} already allowing you to use it without paying again.`
|
||||||
: hasDatatoken
|
: hasDatatoken
|
||||||
? `You own ${dtBalance} ${dtSymbol} allowing you to use this data set by spending 1 ${dtSymbol}, but without paying OCEAN again.`
|
? `You own ${dtBalance} ${dtSymbol} allowing you to use this data set by spending 1 ${dtSymbol}, but without paying OCEAN again.`
|
||||||
|
: lowPoolLiquidity
|
||||||
|
? `There are not enought ${dtSymbol} available in the pool for the transaction to take place`
|
||||||
: `For using this ${assetType}, you will buy 1 ${dtSymbol} and immediately spend it back to the publisher and pool.`
|
: `For using this ${assetType}, you will buy 1 ${dtSymbol} and immediately spend it back to the publisher and pool.`
|
||||||
|
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +58,7 @@ function getComputeAssetHelpText(
|
|||||||
hasDatatoken: boolean,
|
hasDatatoken: boolean,
|
||||||
dtSymbol: string,
|
dtSymbol: string,
|
||||||
dtBalance: string,
|
dtBalance: string,
|
||||||
|
lowPoolLiquidity: boolean,
|
||||||
assetType: string,
|
assetType: string,
|
||||||
isConsumable: boolean,
|
isConsumable: boolean,
|
||||||
consumableFeedback: string,
|
consumableFeedback: string,
|
||||||
@ -61,6 +66,7 @@ function getComputeAssetHelpText(
|
|||||||
hasDatatokenSelectedComputeAsset?: boolean,
|
hasDatatokenSelectedComputeAsset?: boolean,
|
||||||
dtSymbolSelectedComputeAsset?: string,
|
dtSymbolSelectedComputeAsset?: string,
|
||||||
dtBalanceSelectedComputeAsset?: string,
|
dtBalanceSelectedComputeAsset?: string,
|
||||||
|
selectedComputeAssettLowPoolLiquidity?: boolean,
|
||||||
selectedComputeAssetType?: string,
|
selectedComputeAssetType?: string,
|
||||||
algorithmConsumableStatus?: number
|
algorithmConsumableStatus?: number
|
||||||
) {
|
) {
|
||||||
@ -69,11 +75,12 @@ function getComputeAssetHelpText(
|
|||||||
dtSymbol,
|
dtSymbol,
|
||||||
hasDatatoken,
|
hasDatatoken,
|
||||||
hasPreviousOrder,
|
hasPreviousOrder,
|
||||||
|
lowPoolLiquidity,
|
||||||
assetType,
|
assetType,
|
||||||
isConsumable,
|
isConsumable,
|
||||||
consumableFeedback
|
consumableFeedback
|
||||||
)
|
)
|
||||||
const text =
|
const computeAlgoHelpText =
|
||||||
(!dtSymbolSelectedComputeAsset && !dtBalanceSelectedComputeAsset) ||
|
(!dtSymbolSelectedComputeAsset && !dtBalanceSelectedComputeAsset) ||
|
||||||
isConsumable === false
|
isConsumable === false
|
||||||
? ''
|
? ''
|
||||||
@ -87,9 +94,15 @@ function getComputeAssetHelpText(
|
|||||||
? `You already bought the selected ${selectedComputeAssetType}, allowing you to use it without paying again.`
|
? `You already bought the selected ${selectedComputeAssetType}, allowing you to use it without paying again.`
|
||||||
: hasDatatokenSelectedComputeAsset
|
: hasDatatokenSelectedComputeAsset
|
||||||
? `You own ${dtBalanceSelectedComputeAsset} ${dtSymbolSelectedComputeAsset} allowing you to use the selected ${selectedComputeAssetType} by spending 1 ${dtSymbolSelectedComputeAsset}, but without paying OCEAN again.`
|
? `You own ${dtBalanceSelectedComputeAsset} ${dtSymbolSelectedComputeAsset} allowing you to use the selected ${selectedComputeAssetType} by spending 1 ${dtSymbolSelectedComputeAsset}, but without paying OCEAN again.`
|
||||||
|
: selectedComputeAssettLowPoolLiquidity
|
||||||
|
? `There are not enought ${dtSymbolSelectedComputeAsset} available in the pool for the transaction to take place`
|
||||||
: `Additionally, you will buy 1 ${dtSymbolSelectedComputeAsset} for the ${selectedComputeAssetType} and spend it back to its publisher and pool.`
|
: `Additionally, you will buy 1 ${dtSymbolSelectedComputeAsset} for the ${selectedComputeAssetType} and spend it back to its publisher and pool.`
|
||||||
|
const computeHelpText = selectedComputeAssettLowPoolLiquidity
|
||||||
return `${computeAssetHelpText} ${text}`
|
? computeAlgoHelpText
|
||||||
|
: lowPoolLiquidity
|
||||||
|
? computeAssetHelpText
|
||||||
|
: `${computeAssetHelpText} ${computeAlgoHelpText}`
|
||||||
|
return computeHelpText
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ButtonBuy({
|
export default function ButtonBuy({
|
||||||
@ -99,6 +112,7 @@ export default function ButtonBuy({
|
|||||||
hasDatatoken,
|
hasDatatoken,
|
||||||
dtSymbol,
|
dtSymbol,
|
||||||
dtBalance,
|
dtBalance,
|
||||||
|
datasetLowPoolLiquidity,
|
||||||
assetType,
|
assetType,
|
||||||
assetTimeout,
|
assetTimeout,
|
||||||
isConsumable,
|
isConsumable,
|
||||||
@ -107,6 +121,7 @@ export default function ButtonBuy({
|
|||||||
hasDatatokenSelectedComputeAsset,
|
hasDatatokenSelectedComputeAsset,
|
||||||
dtSymbolSelectedComputeAsset,
|
dtSymbolSelectedComputeAsset,
|
||||||
dtBalanceSelectedComputeAsset,
|
dtBalanceSelectedComputeAsset,
|
||||||
|
selectedComputeAssetLowPoolLiquidity,
|
||||||
selectedComputeAssetType,
|
selectedComputeAssetType,
|
||||||
onClick,
|
onClick,
|
||||||
stepText,
|
stepText,
|
||||||
@ -150,6 +165,7 @@ export default function ButtonBuy({
|
|||||||
dtSymbol,
|
dtSymbol,
|
||||||
hasDatatoken,
|
hasDatatoken,
|
||||||
hasPreviousOrder,
|
hasPreviousOrder,
|
||||||
|
datasetLowPoolLiquidity,
|
||||||
assetType,
|
assetType,
|
||||||
isConsumable,
|
isConsumable,
|
||||||
consumableFeedback
|
consumableFeedback
|
||||||
@ -159,6 +175,7 @@ export default function ButtonBuy({
|
|||||||
hasDatatoken,
|
hasDatatoken,
|
||||||
dtSymbol,
|
dtSymbol,
|
||||||
dtBalance,
|
dtBalance,
|
||||||
|
datasetLowPoolLiquidity,
|
||||||
assetType,
|
assetType,
|
||||||
isConsumable,
|
isConsumable,
|
||||||
consumableFeedback,
|
consumableFeedback,
|
||||||
@ -166,6 +183,7 @@ export default function ButtonBuy({
|
|||||||
hasDatatokenSelectedComputeAsset,
|
hasDatatokenSelectedComputeAsset,
|
||||||
dtSymbolSelectedComputeAsset,
|
dtSymbolSelectedComputeAsset,
|
||||||
dtBalanceSelectedComputeAsset,
|
dtBalanceSelectedComputeAsset,
|
||||||
|
selectedComputeAssetLowPoolLiquidity,
|
||||||
selectedComputeAssetType,
|
selectedComputeAssetType,
|
||||||
algorithmConsumableStatus
|
algorithmConsumableStatus
|
||||||
)}
|
)}
|
||||||
|
@ -51,12 +51,14 @@ export default function FormStartCompute({
|
|||||||
hasPreviousOrder,
|
hasPreviousOrder,
|
||||||
hasDatatoken,
|
hasDatatoken,
|
||||||
dtBalance,
|
dtBalance,
|
||||||
|
datasetLowPoolLiquidity,
|
||||||
assetType,
|
assetType,
|
||||||
assetTimeout,
|
assetTimeout,
|
||||||
hasPreviousOrderSelectedComputeAsset,
|
hasPreviousOrderSelectedComputeAsset,
|
||||||
hasDatatokenSelectedComputeAsset,
|
hasDatatokenSelectedComputeAsset,
|
||||||
dtSymbolSelectedComputeAsset,
|
dtSymbolSelectedComputeAsset,
|
||||||
dtBalanceSelectedComputeAsset,
|
dtBalanceSelectedComputeAsset,
|
||||||
|
selectedComputeAssetLowPoolLiquidity,
|
||||||
selectedComputeAssetType,
|
selectedComputeAssetType,
|
||||||
selectedComputeAssetTimeout,
|
selectedComputeAssetTimeout,
|
||||||
stepText,
|
stepText,
|
||||||
@ -72,12 +74,14 @@ export default function FormStartCompute({
|
|||||||
hasPreviousOrder: boolean
|
hasPreviousOrder: boolean
|
||||||
hasDatatoken: boolean
|
hasDatatoken: boolean
|
||||||
dtBalance: string
|
dtBalance: string
|
||||||
|
datasetLowPoolLiquidity: boolean
|
||||||
assetType: string
|
assetType: string
|
||||||
assetTimeout: string
|
assetTimeout: string
|
||||||
hasPreviousOrderSelectedComputeAsset?: boolean
|
hasPreviousOrderSelectedComputeAsset?: boolean
|
||||||
hasDatatokenSelectedComputeAsset?: boolean
|
hasDatatokenSelectedComputeAsset?: boolean
|
||||||
dtSymbolSelectedComputeAsset?: string
|
dtSymbolSelectedComputeAsset?: string
|
||||||
dtBalanceSelectedComputeAsset?: string
|
dtBalanceSelectedComputeAsset?: string
|
||||||
|
selectedComputeAssetLowPoolLiquidity?: boolean
|
||||||
selectedComputeAssetType?: string
|
selectedComputeAssetType?: string
|
||||||
selectedComputeAssetTimeout?: string
|
selectedComputeAssetTimeout?: string
|
||||||
stepText: string
|
stepText: string
|
||||||
@ -177,6 +181,7 @@ export default function FormStartCompute({
|
|||||||
hasDatatoken={hasDatatoken}
|
hasDatatoken={hasDatatoken}
|
||||||
dtSymbol={ddo.dataTokenInfo.symbol}
|
dtSymbol={ddo.dataTokenInfo.symbol}
|
||||||
dtBalance={dtBalance}
|
dtBalance={dtBalance}
|
||||||
|
datasetLowPoolLiquidity={datasetLowPoolLiquidity}
|
||||||
assetTimeout={assetTimeout}
|
assetTimeout={assetTimeout}
|
||||||
assetType={assetType}
|
assetType={assetType}
|
||||||
hasPreviousOrderSelectedComputeAsset={
|
hasPreviousOrderSelectedComputeAsset={
|
||||||
@ -185,6 +190,9 @@ export default function FormStartCompute({
|
|||||||
hasDatatokenSelectedComputeAsset={hasDatatokenSelectedComputeAsset}
|
hasDatatokenSelectedComputeAsset={hasDatatokenSelectedComputeAsset}
|
||||||
dtSymbolSelectedComputeAsset={dtSymbolSelectedComputeAsset}
|
dtSymbolSelectedComputeAsset={dtSymbolSelectedComputeAsset}
|
||||||
dtBalanceSelectedComputeAsset={dtBalanceSelectedComputeAsset}
|
dtBalanceSelectedComputeAsset={dtBalanceSelectedComputeAsset}
|
||||||
|
selectedComputeAssetLowPoolLiquidity={
|
||||||
|
selectedComputeAssetLowPoolLiquidity
|
||||||
|
}
|
||||||
selectedComputeAssetType={selectedComputeAssetType}
|
selectedComputeAssetType={selectedComputeAssetType}
|
||||||
stepText={stepText}
|
stepText={stepText}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
|
@ -73,6 +73,8 @@ export default function Compute({
|
|||||||
const [ddoAlgorithmList, setDdoAlgorithmList] = useState<DDO[]>()
|
const [ddoAlgorithmList, setDdoAlgorithmList] = useState<DDO[]>()
|
||||||
const [selectedAlgorithmAsset, setSelectedAlgorithmAsset] = useState<DDO>()
|
const [selectedAlgorithmAsset, setSelectedAlgorithmAsset] = useState<DDO>()
|
||||||
const [hasAlgoAssetDatatoken, setHasAlgoAssetDatatoken] = useState<boolean>()
|
const [hasAlgoAssetDatatoken, setHasAlgoAssetDatatoken] = useState<boolean>()
|
||||||
|
const [datasetMaxDT, setDatasetMaxDT] = useState<number>(1)
|
||||||
|
const [algoMaxDT, setAlgoMaxDT] = useState<number>(1)
|
||||||
const [isPublished, setIsPublished] = useState(false)
|
const [isPublished, setIsPublished] = useState(false)
|
||||||
const [hasPreviousDatasetOrder, setHasPreviousDatasetOrder] = useState(false)
|
const [hasPreviousDatasetOrder, setHasPreviousDatasetOrder] = useState(false)
|
||||||
const [previousDatasetOrderId, setPreviousDatasetOrderId] = useState<string>()
|
const [previousDatasetOrderId, setPreviousDatasetOrderId] = useState<string>()
|
||||||
@ -85,13 +87,15 @@ export default function Compute({
|
|||||||
const [datasetTimeout, setDatasetTimeout] = useState<string>()
|
const [datasetTimeout, setDatasetTimeout] = useState<string>()
|
||||||
const [algorithmTimeout, setAlgorithmTimeout] = useState<string>()
|
const [algorithmTimeout, setAlgorithmTimeout] = useState<string>()
|
||||||
|
|
||||||
|
const hasDatatoken = Number(dtBalance) >= 1
|
||||||
|
|
||||||
const isComputeButtonDisabled =
|
const isComputeButtonDisabled =
|
||||||
isJobStarting === true ||
|
isJobStarting === true ||
|
||||||
file === null ||
|
file === null ||
|
||||||
!ocean ||
|
!ocean ||
|
||||||
!isBalanceSufficient ||
|
!isBalanceSufficient ||
|
||||||
!isConsumable
|
(!hasPreviousDatasetOrder && !hasDatatoken && !(datasetMaxDT >= 1)) ||
|
||||||
const hasDatatoken = Number(dtBalance) >= 1
|
(!hasPreviousAlgorithmOrder && !hasAlgoAssetDatatoken && !(algoMaxDT >= 1))
|
||||||
|
|
||||||
async function checkPreviousOrders(ddo: DDO) {
|
async function checkPreviousOrders(ddo: DDO) {
|
||||||
const { timeout } = (
|
const { timeout } = (
|
||||||
@ -121,6 +125,22 @@ export default function Compute({
|
|||||||
setHasAlgoAssetDatatoken(Number(AssetDtBalance) >= 1)
|
setHasAlgoAssetDatatoken(Number(AssetDtBalance) >= 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function checkAssetDTMaxBuyQuantity(
|
||||||
|
price: BestPrice,
|
||||||
|
assetType: string
|
||||||
|
) {
|
||||||
|
if (!ocean || !price || !assetType) return
|
||||||
|
const maxTokensInPool =
|
||||||
|
price.type === 'pool'
|
||||||
|
? await ocean.pool.getDTMaxBuyQuantity(price.address)
|
||||||
|
: 1
|
||||||
|
if (assetType === 'algorithm') {
|
||||||
|
setAlgoMaxDT(Number(maxTokensInPool))
|
||||||
|
} else {
|
||||||
|
setDatasetMaxDT(Number(maxTokensInPool))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getQuerryString(
|
function getQuerryString(
|
||||||
trustedAlgorithmList: publisherTrustedAlgorithm[]
|
trustedAlgorithmList: publisherTrustedAlgorithm[]
|
||||||
): SearchQuery {
|
): SearchQuery {
|
||||||
@ -188,6 +208,11 @@ export default function Compute({
|
|||||||
if (!ddo) return
|
if (!ddo) return
|
||||||
const price = await getPrice(ddo)
|
const price = await getPrice(ddo)
|
||||||
setAlgorithmPrice(price)
|
setAlgorithmPrice(price)
|
||||||
|
ocean &&
|
||||||
|
checkAssetDTMaxBuyQuantity(
|
||||||
|
price,
|
||||||
|
ddo.findServiceByType('metadata').attributes.main.type
|
||||||
|
)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -200,6 +225,10 @@ export default function Compute({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ocean || !accountId) return
|
if (!ocean || !accountId) return
|
||||||
checkPreviousOrders(ddo)
|
checkPreviousOrders(ddo)
|
||||||
|
checkAssetDTMaxBuyQuantity(
|
||||||
|
price,
|
||||||
|
ddo.findServiceByType('metadata').attributes.main.type
|
||||||
|
)
|
||||||
}, [ocean, ddo, accountId])
|
}, [ocean, ddo, accountId])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -416,6 +445,7 @@ export default function Compute({
|
|||||||
hasPreviousOrder={hasPreviousDatasetOrder}
|
hasPreviousOrder={hasPreviousDatasetOrder}
|
||||||
hasDatatoken={hasDatatoken}
|
hasDatatoken={hasDatatoken}
|
||||||
dtBalance={dtBalance}
|
dtBalance={dtBalance}
|
||||||
|
datasetLowPoolLiquidity={!(datasetMaxDT >= 1)}
|
||||||
assetType={type}
|
assetType={type}
|
||||||
assetTimeout={datasetTimeout}
|
assetTimeout={datasetTimeout}
|
||||||
hasPreviousOrderSelectedComputeAsset={hasPreviousAlgorithmOrder}
|
hasPreviousOrderSelectedComputeAsset={hasPreviousAlgorithmOrder}
|
||||||
@ -424,6 +454,7 @@ export default function Compute({
|
|||||||
selectedAlgorithmAsset?.dataTokenInfo?.symbol
|
selectedAlgorithmAsset?.dataTokenInfo?.symbol
|
||||||
}
|
}
|
||||||
dtBalanceSelectedComputeAsset={algorithmDTBalance}
|
dtBalanceSelectedComputeAsset={algorithmDTBalance}
|
||||||
|
selectedComputeAssetLowPoolLiquidity={!(algoMaxDT >= 1)}
|
||||||
selectedComputeAssetType="algorithm"
|
selectedComputeAssetType="algorithm"
|
||||||
selectedComputeAssetTimeout={algorithmTimeout}
|
selectedComputeAssetTimeout={algorithmTimeout}
|
||||||
stepText={pricingStepText || 'Starting Compute Job...'}
|
stepText={pricingStepText || 'Starting Compute Job...'}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { ReactElement, useEffect, useState } from 'react'
|
import React, { ReactElement, useEffect, useState } from 'react'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import { File as FileMetadata, DDO } from '@oceanprotocol/lib'
|
import { File as FileMetadata, DDO, BestPrice } from '@oceanprotocol/lib'
|
||||||
import File from '../../atoms/File'
|
import File from '../../atoms/File'
|
||||||
import Price from '../../atoms/Price'
|
import Price from '../../atoms/Price'
|
||||||
import Web3Feedback from '../../molecules/Wallet/Feedback'
|
import Web3Feedback from '../../molecules/Wallet/Feedback'
|
||||||
@ -60,6 +60,7 @@ export default function Consume({
|
|||||||
const { consumeStepText, consume, consumeError, isLoading } = useConsume()
|
const { consumeStepText, consume, consumeError, isLoading } = useConsume()
|
||||||
const [isDisabled, setIsDisabled] = useState(true)
|
const [isDisabled, setIsDisabled] = useState(true)
|
||||||
const [hasDatatoken, setHasDatatoken] = useState(false)
|
const [hasDatatoken, setHasDatatoken] = useState(false)
|
||||||
|
const [maxDt, setMaxDT] = useState<number>(1)
|
||||||
const [isConsumablePrice, setIsConsumablePrice] = useState(true)
|
const [isConsumablePrice, setIsConsumablePrice] = useState(true)
|
||||||
const [assetTimeout, setAssetTimeout] = useState('')
|
const [assetTimeout, setAssetTimeout] = useState('')
|
||||||
const { data } = useQuery<OrdersData>(previousOrderQuery, {
|
const { data } = useQuery<OrdersData>(previousOrderQuery, {
|
||||||
@ -70,6 +71,15 @@ export default function Consume({
|
|||||||
pollInterval: 5000
|
pollInterval: 5000
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function checkMaxAvaialableTokens(price: BestPrice) {
|
||||||
|
if (!ocean || !price) return
|
||||||
|
const maxTokensInPool =
|
||||||
|
price.type === 'pool'
|
||||||
|
? await ocean.pool.getDTMaxBuyQuantity(price.address)
|
||||||
|
: 1
|
||||||
|
setMaxDT(Number(maxTokensInPool))
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!data || !assetTimeout || data.tokenOrders.length === 0) return
|
if (!data || !assetTimeout || data.tokenOrders.length === 0) return
|
||||||
|
|
||||||
@ -100,6 +110,7 @@ export default function Consume({
|
|||||||
setIsConsumablePrice(
|
setIsConsumablePrice(
|
||||||
price.isConsumable !== undefined ? price.isConsumable === 'true' : true
|
price.isConsumable !== undefined ? price.isConsumable === 'true' : true
|
||||||
)
|
)
|
||||||
|
checkMaxAvaialableTokens(price)
|
||||||
}, [price])
|
}, [price])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -113,6 +124,7 @@ export default function Consume({
|
|||||||
!isBalanceSufficient ||
|
!isBalanceSufficient ||
|
||||||
typeof consumeStepText !== 'undefined' ||
|
typeof consumeStepText !== 'undefined' ||
|
||||||
pricingIsLoading ||
|
pricingIsLoading ||
|
||||||
|
(!hasPreviousOrder && !hasDatatoken && !(maxDt >= 1)) ||
|
||||||
!isConsumablePrice) &&
|
!isConsumablePrice) &&
|
||||||
!hasPreviousOrder &&
|
!hasPreviousOrder &&
|
||||||
!hasDatatoken)
|
!hasDatatoken)
|
||||||
@ -160,6 +172,7 @@ export default function Consume({
|
|||||||
hasDatatoken={hasDatatoken}
|
hasDatatoken={hasDatatoken}
|
||||||
dtSymbol={ddo.dataTokenInfo?.symbol}
|
dtSymbol={ddo.dataTokenInfo?.symbol}
|
||||||
dtBalance={dtBalance}
|
dtBalance={dtBalance}
|
||||||
|
datasetLowPoolLiquidity={!(maxDt >= 1)}
|
||||||
onClick={handleConsume}
|
onClick={handleConsume}
|
||||||
assetTimeout={secondsToString(parseInt(assetTimeout))}
|
assetTimeout={secondsToString(parseInt(assetTimeout))}
|
||||||
assetType={type}
|
assetType={type}
|
||||||
|
Loading…
Reference in New Issue
Block a user