From e51db0a7c92fb758c9083379bf78438afccfb19a Mon Sep 17 00:00:00 2001 From: Juanma Hidalgo Date: Thu, 11 Jul 2024 11:08:20 +0200 Subject: [PATCH] fix: fetch offchain contract just if the FF is ON (#2267) * fix: fetch offchain contract just if the FF is ON * feat: remove console.log --- webapp/src/components/BidPage/BidModal/BidModal.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/src/components/BidPage/BidModal/BidModal.tsx b/webapp/src/components/BidPage/BidModal/BidModal.tsx index 94febd4b1..b134fe3ad 100644 --- a/webapp/src/components/BidPage/BidModal/BidModal.tsx +++ b/webapp/src/components/BidPage/BidModal/BidModal.tsx @@ -52,7 +52,7 @@ const BidModal = (props: Props) => { network: asset.network }) - const offchainBidsContract = getDecentralandContract(ContractName.OffChainMarketplace, asset.chainId) + const offchainBidsContract = isBidsOffchainEnabled ? getDecentralandContract(ContractName.OffChainMarketplace, asset.chainId) : null if (!wallet || !mana || !bids) { return null @@ -67,10 +67,10 @@ const BidModal = (props: Props) => { onClearBidError() onAuthorizedAction({ targetContractName: ContractName.MANAToken, - authorizedAddress: isBidsOffchainEnabled ? offchainBidsContract.address : bids.address, + authorizedAddress: isBidsOffchainEnabled && !!offchainBidsContract ? offchainBidsContract.address : bids.address, targetContract: mana as Contract, authorizationType: AuthorizationType.ALLOWANCE, - authorizedContractLabel: isBidsOffchainEnabled ? offchainBidsContract.name : bids.label || bids.name, + authorizedContractLabel: isBidsOffchainEnabled && !!offchainBidsContract ? offchainBidsContract.name : bids.label || bids.name, requiredAllowanceInWei: ethers.utils.parseEther(price).toString(), onAuthorized: handlePlaceBid })