From bfe803e2f576caa03575efce2301d22778e850db Mon Sep 17 00:00:00 2001 From: vignesha22 <82584664+vignesha22@users.noreply.github.com> Date: Mon, 11 Sep 2023 20:32:02 +0530 Subject: [PATCH] added toString from number (#8) --- backend/src/paymaster/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/paymaster/index.ts b/backend/src/paymaster/index.ts index 7c5f235..8ae323e 100644 --- a/backend/src/paymaster/index.ts +++ b/backend/src/paymaster/index.ts @@ -168,10 +168,10 @@ export class Paymaster { const paymasterContract = new ethers.Contract(paymasterAddress, abi, provider); const signer = new Wallet(this.relayerKey, provider) const balance = await signer.getBalance(); - if (ethers.utils.parseEther(amount).gte(balance)) + if (ethers.utils.parseEther(amount.toString()).gte(balance)) throw new Error(`${signer.address} Balance is less than the amount to be deposited`) const encodedData = paymasterContract.interface.encodeFunctionData('depositFunds', []); - const tx = await signer.sendTransaction({ to: paymasterAddress, data: encodedData, value: ethers.utils.parseEther(amount) }); + const tx = await signer.sendTransaction({ to: paymasterAddress, data: encodedData, value: ethers.utils.parseEther(amount.toString()) }); await tx.wait(); return { message: `Successfully deposited with transaction Hash ${tx.hash}`