diff --git a/packages/app/hooks/creator-token/use-creator-token-approve.ts b/packages/app/hooks/creator-token/use-creator-token-approve.ts index 12ed51d07..ee8e1ec1e 100644 --- a/packages/app/hooks/creator-token/use-creator-token-approve.ts +++ b/packages/app/hooks/creator-token/use-creator-token-approve.ts @@ -50,34 +50,36 @@ export const useApproveToken = () => { maxFeePerGas, maxPriorityFeePerGas, }); - if (maxFeePerGas) { - const { request } = await publicClient.simulateContract({ - address: usdcAddress, - account: walletAddress, - abi: erc20Abi, - functionName: "approve", - args: [creatorTokenContract, maxPrice], - chain: chain, - maxFeePerGas, - maxPriorityFeePerGas, - }); + const { request } = await publicClient.simulateContract({ + address: usdcAddress, + account: walletAddress, + abi: erc20Abi, + functionName: "approve", + args: [creatorTokenContract, maxPrice], + chain: chain, + }); - const hash = await walletClient?.writeContract(request); - console.log("approve transaction hash ", hash); - if (hash) { - const transaction = await publicClient.waitForTransactionReceipt({ - hash, - pollingInterval: 2000, - confirmations: 3, - }); - if (transaction.status === "success") { - return true; - } + //@ts-ignore + const hash = await walletClient?.writeContract({ + ...request, + type: "eip1559", + maxFeePerGas, + maxPriorityFeePerGas, + }); + console.log("approve transaction hash ", hash); + if (hash) { + const transaction = await publicClient.waitForTransactionReceipt({ + hash, + pollingInterval: 2000, + confirmations: 3, + }); + if (transaction.status === "success") { + return true; } } - } else { - return true; } + } else { + return true; } } ); diff --git a/packages/app/hooks/creator-token/use-creator-token-buy.ts b/packages/app/hooks/creator-token/use-creator-token-buy.ts index c9e13306c..21a5e4b6c 100644 --- a/packages/app/hooks/creator-token/use-creator-token-buy.ts +++ b/packages/app/hooks/creator-token/use-creator-token-buy.ts @@ -91,9 +91,6 @@ export const useCreatorTokenBuy = (params: { functionName: "buy", args: [priceToBuyNext.data?.totalPrice], chain: baseChain, - type: "eip1559", - maxFeePerGas, - maxPriorityFeePerGas, }); requestPayload = request; console.log("token amount 1 simulation ", request); @@ -105,9 +102,6 @@ export const useCreatorTokenBuy = (params: { functionName: "bulkBuy", args: [tokenAmount, priceToBuyNext.data?.totalPrice], chain: baseChain, - type: "eip1559", - maxFeePerGas, - maxPriorityFeePerGas, }); console.log("bulk buy request", request); requestPayload = request; @@ -115,9 +109,12 @@ export const useCreatorTokenBuy = (params: { console.log("simulate ", requestPayload); - const transactionHash = await walletClient?.writeContract?.( - requestPayload - ); + const transactionHash = await walletClient?.writeContract?.({ + ...requestPayload, + type: "eip1559", + maxFeePerGas, + maxPriorityFeePerGas, + }); console.log("Buy transaction hash ", requestPayload); if (transactionHash) {