From 7fef77afefa69de1630c0de313a1286fefc414b2 Mon Sep 17 00:00:00 2001 From: EnzoVezzaro Date: Wed, 19 Oct 2022 06:14:15 -0400 Subject: [PATCH] fix web3 connection for unsupported assets price --- .../Asset/AssetActions/Compute/index.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/Asset/AssetActions/Compute/index.tsx b/src/components/Asset/AssetActions/Compute/index.tsx index 549f067d0..ffb59b3e8 100644 --- a/src/components/Asset/AssetActions/Compute/index.tsx +++ b/src/components/Asset/AssetActions/Compute/index.tsx @@ -57,7 +57,7 @@ export default function Compute({ fileIsLoading?: boolean consumableFeedback?: string }): ReactElement { - const { accountId, web3 } = useWeb3() + const { accountId, web3, isSupportedOceanNetwork } = useWeb3() const newAbortController = useAbortController() const newCancelToken = useCancelToken() @@ -140,14 +140,14 @@ export default function Compute({ setInitializedProviderResponse(initializedProvider) - setProviderFeeAmount( - await unitsToAmount( - web3 || (await getDummyWeb3(asset?.chainId)), - initializedProvider?.datasets?.[0]?.providerFee?.providerFeeToken, - initializedProvider?.datasets?.[0]?.providerFee?.providerFeeAmount - ) + const feeAmount = await unitsToAmount( + !isSupportedOceanNetwork ? await getDummyWeb3(asset?.chainId) : web3, + initializedProvider?.datasets?.[0]?.providerFee?.providerFeeToken, + initializedProvider?.datasets?.[0]?.providerFee?.providerFeeAmount ) + setProviderFeeAmount(feeAmount) + const computeDuration = ( parseInt(initializedProvider?.datasets?.[0]?.providerFee?.validUntil) - Math.floor(Date.now() / 1000)