sign-hbwallet
Installation
npm install sign-hbwallet --save
or
yarn add sign-hbwallet
This project was created by HB Wallet.
Available Function
In the project directory, you can run :
onConnectWallet
This will allow connection from your dapps website to Web3 in HBWallet .
This will return a status as object like
status: WEB3_STATUS constant network: NETWORK_ETHER constant address: Address of connected account
Available Constant
NETWORK_ETHER
key: 1 type: 'Mainnet' key: 2 type: 'Morden' key: 3 type: 'Ropsten' key: 4 type: 'Rinkeby' key: 42 type: 'Kovan' key: 5777 type: 'Private'
WEB3_STATUS
Loading: 'loading' NoWeb3: 'noweb3' Error: 'error' Locked: 'locked' ChangeAccount: 'changeaccount' Ready: 'ready'
Usage example
PureComponent { superprops thisstate = web3Wallet: {} } async { } refreshWeb3 = async { const web3Wallet = thisstate const newWeb3Status = await // Need to get signed in here if newWeb3Status && newWeb3Statusstatus !== web3Walletstatus this } { const web3Wallet = thisstate return <div> <h1>'HB Wallet'</h1> <div>'Your address: ' + web3Wallet && web3Walletaccount ? web3Walletaccount : '...'</div> <div>'Your network: ' + web3Wallet && web3Walletnetwork ? NETWORK_ETHERtype : '...'</div> </div> }