2.2.6 • Published 3 years ago

web3-wallet-connect v2.2.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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

MIT

2.2.1

3 years ago

2.1.2

3 years ago

2.2.0

3 years ago

2.1.1

3 years ago

2.0.2

3 years ago

2.2.3

3 years ago

2.1.4

3 years ago

2.0.5

3 years ago

2.2.2

3 years ago

2.1.3

3 years ago

2.0.4

3 years ago

2.2.5

3 years ago

2.1.6

3 years ago

2.0.7

3 years ago

2.2.4

3 years ago

2.1.5

3 years ago

2.0.6

3 years ago

2.1.8

3 years ago

2.0.9

3 years ago

2.2.6

3 years ago

2.1.7

3 years ago

2.0.8

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.1.9

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

1.0.0

3 years ago