Transferring Ether to another account

So far, you have a list of accounts in the sidebar and can see the balance of each account by selecting them. Now, it's time to implement transfers between accounts.

First of all, we need at least three parameters to perform a successful transaction:

  • Source account
  • Target account
  • Amount to transfer

We are going to use React Hooks since this is the most efficient and fastest way to get started. You need at least three pairs of hooks. Let's get started:

  1. Introduce a pair of React hooks for each attribute:
const [account, setAccount] = useState(null);const [targetAccount, setTargetAccount] = useState(null);const [transferAmount, setTransferAmount] = useState(0);

We already handle account selection via ...

Get Electron Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.