A web3-react toolkit for Harmony wallets
Harmony-React adds support for using OneWallet and MathWallet together with web3-react.
Harmony-React is not a fork of web3-react, but rather built on top of web3-react to ensure that the library can be upgraded whenever web3-react gets updated.
Add web3-react/core
and the wallets you want to use (OneWallet, MathWallet or both) to package.json
:
Install using yarn install
or npm install
.
Import packages:
Instantiate wallets:
Store the wallet references in a store or a suitable structure, e.g:
For a more in-depth implementation example check here.
Create a wallet connection/unlock modal (or other suitable UI element):
Implement the Unlock
component:
And finally, implement the WalletComponent
:
For full reference implementations of Store
, UnlockModal
, Unlock
, and WalletComponent
: