WalletConnect
Library to connect Dapps to mobile wallets using WalletConnect
You can read more about WalletConnect standard here: http://walletconnect.org/
Install package
yarn add walletconnect
npm install --save walletconnect
Getting Started
import WalletConnect from 'walletconnect'
const webConnector = new WalletConnect(
{
bridgeUrl: 'https://bridge.walletconnect.org',
dappName: 'INSERT_DAPP_NAME',
}
)
const session = await webConnector.initSession()
if (session.new) {
const { uri } = session;
const sessionStatus = await webConnector.listenSessionStatus()
const accounts = sessionStatus.data
} else {
const { accounts } = session
}
const tx = {from: '0xab12...1cd', to: '0x0', nonce: 1, gas: 100000, value: 0, data: '0x0'}
const transactionId = await webConnector.createTransaction(tx)
const transactionStatus = await webConnector.listenTransactionStatus(transactionId)
if (transactionStatus.success) {
const { txHash } = transactionStatus
}