2.2.6 • Published 2 years ago
web3-wallet-connect v2.2.6
Easily Integrate web3 wallets in your Dapp
See package visit
Installation
Install web3-wallet connect with npm
npm i web3-wallet-connect
Example Usage
Import Wallet
import { useMetamask, useWalletConnect } from "web3-wallet-connect";
Create wallet Object
// for Metamask object
const connect = new useMetamask();
// for WalletConnect Object
// pass rpc url object.
const connect = new useWalletConnect({ rpc: rpcUrlObject });
Connect to Wallet
//for Metamask
const wallet = await connect._connectMM();
//for WalletConnect
const wallet = await connect._connectWC();
Network Change
// This fn accepts a callback function
connect.onNetworkChange(cb);
const cb = (chainId) => {
console.log(parseInt(chainId));
};
Account Change
// This fn accepts a callback function
connect.onAccountChange(cb);
const cb = (walletAddress) => {
console.log(walletAddress);
};
Switch Network
//chainId should be integer eg 1,137,56,etc
const _result = await connect._switchNetwork(chainId);
Disconnect
//FOR WALLETCONNECT
await connect._disconnectWC();
Provider
// for metamask
const provider = connect.getProviderMM();
//for WalletConnect
const provider = connect.getProviderWC();
Sign Message
// For signing the message]
const result = await connect._signMessage(message);
Conncet Smart Contract
import { useContract } from "web3-wallet-connect";
const contract = useContract(CONTRACT_ADDRESS, ABI, PROVIDER);
import ethers
import { ethers } from "web3-wallet-connect";
🍰 Contributing
Before Contributing please read Contribute
💻 Built with
- Javascript
- Ether.js
🙏 Support
License
2.2.1
2 years ago
2.1.2
2 years ago
2.2.0
2 years ago
2.1.1
2 years ago
2.0.2
2 years ago
2.2.3
2 years ago
2.1.4
2 years ago
2.0.5
2 years ago
2.2.2
2 years ago
2.1.3
2 years ago
2.0.4
2 years ago
2.2.5
2 years ago
2.1.6
2 years ago
2.0.7
2 years ago
2.2.4
2 years ago
2.1.5
2 years ago
2.0.6
2 years ago
2.1.8
2 years ago
2.0.9
2 years ago
2.2.6
2 years ago
2.1.7
2 years ago
2.0.8
2 years ago
2.1.0
2 years ago
2.0.1
2 years ago
2.0.0
2 years ago
2.1.9
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago
1.0.0
2 years ago