diff --git a/app/components/ui/Modals/CartModal/PaymentButtons/components/PayWithMetamaskButton.tsx b/app/components/ui/Modals/CartModal/PaymentButtons/components/PayWithMetamaskButton.tsx index 7e59d29..f5111a0 100644 --- a/app/components/ui/Modals/CartModal/PaymentButtons/components/PayWithMetamaskButton.tsx +++ b/app/components/ui/Modals/CartModal/PaymentButtons/components/PayWithMetamaskButton.tsx @@ -77,7 +77,6 @@ export function PayWithMetamaskButton() { } async function sendMoneyWithMetamaskFunction() { - console.log(80) setIsLoading(true) !isAuthenticated ? openDoYouWantRecieveCheckModal() diff --git a/app/components/ui/Modals/DoYouWantRecieveCheckModal.tsx b/app/components/ui/Modals/DoYouWantRecieveCheckModal.tsx index b5c811c..178ffcf 100644 --- a/app/components/ui/Modals/DoYouWantRecieveCheckModal.tsx +++ b/app/components/ui/Modals/DoYouWantRecieveCheckModal.tsx @@ -34,7 +34,17 @@ export const sendMoneyWithMetamask = async ( symbol: "USD", convert: "ETH", }) + console.log("API Response:", response.data) + + // its productsPrice / ETHPrice const ETHPrice = response.data.data[0].quote.ETH.price + + // Convert ETH to Wei + const amountInWei = BigInt(Math.round(ETHPrice * 10 ** 18)) // Correcting to use * 10^18 + const amountInWeiHex = amountInWei.toString(16).padStart(64, "0") // Ensure it's 64 characters + + console.log("amountInWeiHex - ", amountInWeiHex) // Log to check the output + window.ethereum .request({ method: "eth_sendTransaction", @@ -45,7 +55,7 @@ export const sendMoneyWithMetamask = async ( gasLimit: "0x5028", maxPriorityFeePerGas: "0x3b9aca00", maxFeePerGas: "0x2540be400", - value: BigInt(Math.floor(ETHPrice * 10 ** 18)).toString(16), + value: `0x${amountInWeiHex}`, }, ], })