From fa7bb17f075886f870ffa0611387f4f1a2e93714 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 13 Jan 2020 22:07:21 +0100 Subject: [PATCH] fix ether -> wei conversion * should fix #210 --- src/components/molecules/Web3Donation/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/molecules/Web3Donation/index.tsx b/src/components/molecules/Web3Donation/index.tsx index 863f045c..0c28741b 100644 --- a/src/components/molecules/Web3Donation/index.tsx +++ b/src/components/molecules/Web3Donation/index.tsx @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react' +import { parseEther } from '@ethersproject/units' import useWeb3, { connectors, getErrorMessage } from '../../../hooks/use-web3' import InputGroup from './InputGroup' import Alert, { getTransactionMessage } from './Alert' @@ -38,7 +39,7 @@ export default function Web3Donation({ address }: { address: string }) { const tx = await signer.sendTransaction({ to: address, - value: amount * 1e18 // ETH -> Wei + value: parseEther(amount.toString()) // ETH -> Wei }) setTransactionHash(tx.hash) setMessage({