From f4152e6283dd9db12785c30388041724bbf6aafe Mon Sep 17 00:00:00 2001 From: Lautaro Petaccio Date: Thu, 29 Feb 2024 17:33:43 -0300 Subject: [PATCH] fix: Name minting gas estimation --- .../src/components/Modals/BuyWithCryptoModal/hooks.ts | 1 + .../src/components/Modals/BuyWithCryptoModal/utils.ts | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/webapp/src/components/Modals/BuyWithCryptoModal/hooks.ts b/webapp/src/components/Modals/BuyWithCryptoModal/hooks.ts index 9617a9fbb..e15a24bf8 100644 --- a/webapp/src/components/Modals/BuyWithCryptoModal/hooks.ts +++ b/webapp/src/components/Modals/BuyWithCryptoModal/hooks.ts @@ -164,6 +164,7 @@ const useGasCost = ( if ( !shouldUseCrossChainProvider && wallet && + nativeChainToken && getNetwork(wallet.chainId) === assetNetwork ) { calculateGas() diff --git a/webapp/src/components/Modals/BuyWithCryptoModal/utils.ts b/webapp/src/components/Modals/BuyWithCryptoModal/utils.ts index a32b51ea0..127398435 100644 --- a/webapp/src/components/Modals/BuyWithCryptoModal/utils.ts +++ b/webapp/src/components/Modals/BuyWithCryptoModal/utils.ts @@ -222,7 +222,7 @@ export const estimateBuyNftGas = async ( wallet: Wallet, asset: NFT, order: Order -) => { +): Promise => { const networkProvider = await getNetworkProvider(selectedChain) const provider = new ethers.providers.Web3Provider(networkProvider) @@ -241,12 +241,10 @@ export const estimateNameMintingGas = async ( name: string, selectedChain: ChainId, ownerAddress: string -) => { +): Promise => { const networkProvider = await getNetworkProvider(selectedChain) const provider = new ethers.providers.Web3Provider(networkProvider) - - const contract = getContract(ContractName.DCLRegistrar, selectedChain) + const contract = getContract(ContractName.DCLControllerV2, selectedChain) const c = new ethers.Contract(contract.address, contract.abi, provider) - const estimation = await c.estimateGas.register(ownerAddress, name) - return estimation + return c.estimateGas.register(name, ownerAddress) }