Skip to content

Commit

Permalink
Implemented functionality to get coin balance
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham Singhal committed Jul 30, 2024
1 parent 02987aa commit 14ca7dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
- Implemented Keyring functionality to manage accounts
- Implemented functions to add account, export accounts & import accounts
- Implemented functionality to sign a message
- Implemented functionality to get coin balance for a wallet


7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,9 @@ class KeyringController extends EventEmitter {

}

module.exports = { KeyringController }
const getBalance = async (address, web3) => {
const balance = await web3.eth.getBalance(address);
return { balance: web3.utils.fromWei(balance, 'ether') }
}

module.exports = { KeyringController, getBalance }

0 comments on commit 14ca7dd

Please sign in to comment.