This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

web3-wallet-connect

2.2.6 • Public • Published

Web3 Wallet Connect

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

sponsor github profile readme generator Buy Coffee for rahuldkjain

License

MIT


Developed with ❤️ in India 🇮🇳

Package Sidebar

Install

npm i web3-wallet-connect

Weekly Downloads

1

Version

2.2.6

License

MIT

Unpacked Size

864 kB

Total Files

6

Last publish

Collaborators

  • saura3h