From c7e5af8a004467097537ec387a7ec8c642db5cb9 Mon Sep 17 00:00:00 2001 From: Husien vora Date: Fri, 16 Aug 2024 15:08:44 +0530 Subject: [PATCH 1/2] adding getBalance function --- src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.js b/src/index.js index 2fecd01..c320ce2 100644 --- a/src/index.js +++ b/src/index.js @@ -512,4 +512,8 @@ class KeyringController extends EventEmitter { } } +const getBalance = async (address, web3) => { + const balance = await web3.eth.getBalance(address); + return { balance: web3.utils.fromWei(balance, "ether") }; +}; module.exports = { KeyringController, getBalance }; From 3ae5f2b39b812964180490d73668afbe32c7e071 Mon Sep 17 00:00:00 2001 From: Husien vora Date: Fri, 16 Aug 2024 15:09:58 +0530 Subject: [PATCH 2/2] updating changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53e26e0..76c2b45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,3 +5,4 @@ - Implemented Keyring functionality to manage accounts - Implemented functionality to sign a raw transaction - Implemented functionality to sign a message +- Implemented functionality to get coin balance for a wallet