This is a simple demo to show how to integrate with MetaMask and Keplr to read wallet balances.
Install dependencies.
npm install
Run React app.
npm start
For more details see comments on src/App.js
. Development was done on Windows 10 Pro 21H1 (19043.1586) and node v16.14.2.
Command to run test.
npm test
Command to run test.
npm run build
cd .\build\
npx serve
MetaMast integration went smooth since it's a more stable extension. I used ethers library in version 5.6.2 to display balance in readable format.
Unfortunately "Keplr extension manages only one address/public key pair" but it's enough for our read balance purposes of the first wallet.
Keplr documentation mentions also launchpad vs stargate versioning but it seems that that is not updated.
https://blog.cosmos.network/launchpad-a-pre-stargate-stable-version-of-the-cosmos-sdk-e0c58d8c4e24
Let's hope that in future integration with that extension will be improved like MetaMask but for now, we need RPC/REST call to the Cosmos SDK node to query that:
I used @cosmjs/stargate and RPC because of its lightweight payloads and high performance.
There is an example https://github.com/chainapsis/keplr-example/blob/master/src/main.js but it seems that is not working because of the versioning problem with @cosmjs/launchpad.