diff --git a/src/components/Asset/AssetActions/Compute/FormComputeDataset.tsx b/src/components/Asset/AssetActions/Compute/FormComputeDataset.tsx index 6e8d43ec3..762acbca0 100644 --- a/src/components/Asset/AssetActions/Compute/FormComputeDataset.tsx +++ b/src/components/Asset/AssetActions/Compute/FormComputeDataset.tsx @@ -119,27 +119,28 @@ export default function FormStartCompute({ useEffect(() => { if (!asset?.accessDetails || !selectedAlgorithmAsset?.accessDetails) return - setDatasetOrderPrice( - datasetOrderPriceAndFees?.price || asset.accessDetails.price - ) - - setAlgoOrderPrice( - algoOrderPriceAndFees?.price || - selectedAlgorithmAsset?.accessDetails.price - ) const priceDataset = new Decimal( - hasPreviousOrder || hasDatatoken - ? 0 + isAssetNetwork + ? hasPreviousOrder || hasDatatoken + ? 0 + : datasetOrderPriceAndFees?.price || asset.accessDetails.price : datasetOrderPriceAndFees?.price || asset.accessDetails.price ).toDecimalPlaces(MAX_DECIMALS) - const priceAlgo = - hasPreviousOrderSelectedComputeAsset || hasDatatokenSelectedComputeAsset - ? new Decimal(0) - : new Decimal( - algoOrderPriceAndFees?.price || - selectedAlgorithmAsset.accessDetails.price - ).toDecimalPlaces(MAX_DECIMALS) + setDatasetOrderPrice(priceDataset.toString()) + + const priceAlgo = new Decimal( + isAssetNetwork + ? hasPreviousOrderSelectedComputeAsset || + hasDatatokenSelectedComputeAsset + ? 0 + : algoOrderPriceAndFees?.price || + selectedAlgorithmAsset.accessDetails.price + : algoOrderPriceAndFees?.price || + selectedAlgorithmAsset.accessDetails.price + ).toDecimalPlaces(MAX_DECIMALS) + + setAlgoOrderPrice(priceAlgo.toString()) const providerFees = providerFeeAmount ? new Decimal(providerFeeAmount).toDecimalPlaces(MAX_DECIMALS) @@ -160,7 +161,8 @@ export default function FormStartCompute({ hasDatatokenSelectedComputeAsset, datasetOrderPriceAndFees, algoOrderPriceAndFees, - providerFeeAmount + providerFeeAmount, + isAssetNetwork ]) useEffect(() => { @@ -175,6 +177,8 @@ export default function FormStartCompute({ ) }, [totalPrice, balance, dtBalance, asset?.accessDetails?.baseToken?.symbol]) + console.log(totalPrice, datasetOrderPrice, algoOrderPrice) + return (