From 7a6df34be42b1621782dad7286f7425e7ba194cd Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Thu, 16 Jun 2022 07:12:56 +0300 Subject: [PATCH] set providerFee amount only when avaialable --- .../Asset/AssetActions/Compute/index.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/Asset/AssetActions/Compute/index.tsx b/src/components/Asset/AssetActions/Compute/index.tsx index 16cc34119..5e2261e63 100644 --- a/src/components/Asset/AssetActions/Compute/index.tsx +++ b/src/components/Asset/AssetActions/Compute/index.tsx @@ -148,14 +148,16 @@ export default function Compute({ return } setInitializedProviderResponse(initializedProvider) - setProviderFeeAmount( - await unitsToAmount( - web3, - initializedProvider?.datasets?.[0]?.providerFee?.providerFeeToken, - initializedProviderResponse?.datasets?.[0]?.providerFee - ?.providerFeeAmount + if (initializedProviderResponse?.datasets?.[0]?.providerFee) { + setProviderFeeAmount( + await unitsToAmount( + web3, + initializedProvider?.datasets?.[0]?.providerFee?.providerFeeToken, + initializedProviderResponse?.datasets?.[0]?.providerFee + ?.providerFeeAmount + ) ) - ) + } const computeDuration = ( parseInt(initializedProvider?.datasets?.[0]?.providerFee?.validUntil) - Math.floor(Date.now() / 1000)