Vue 2/3 wrapper for web3 built on top of react-web3@v6
Go to file
2021-08-28 21:25:47 +03:00
scripts Initial commit 2021-08-28 21:14:29 +03:00
src Initial commit 2021-08-28 21:14:29 +03:00
tests Initial commit 2021-08-28 21:14:29 +03:00
.gitignore Initial commit 2021-08-28 21:14:29 +03:00
.prettierrc Initial commit 2021-08-28 21:14:29 +03:00
build.config.ts Initial commit 2021-08-28 21:14:29 +03:00
jest.config.js Initial commit 2021-08-28 21:14:29 +03:00
package.json Update package.json 2021-08-28 21:25:47 +03:00
README.md Update README.md 2021-08-28 21:25:21 +03:00
renovate.json Initial commit 2021-08-28 21:14:29 +03:00
tsconfig.json Initial commit 2021-08-28 21:14:29 +03:00
yarn.lock Initial commit 2021-08-28 21:14:29 +03:00

@kabbouchi/vue-web3 - experimental

Vue 2/3 wrapper for web3 built on top of react-web3.

🚀 Quick Start

Install:

# npm
npm i @kabbouchi/vue-web3

# yarn
yarn add @kabbouchi/vue-web3

Usage:

import { useWeb3, setWeb3LibraryCallback } from '@kabbouchi/vue-web3'
import { InjectedConnector } from '@web3-react/injected-connector'
import { WalletConnectConnector } from '@web3-react/walletconnect-connector'

import Web3 from 'web3'

const injected = new InjectedConnector({
  supportedChainIds: [1, 137],
})

const walletconnect = new WalletConnectConnector({
  rpc: { 1: 'https://mainnet.infura.io/v3/YOUR_API_KEY' },
  qrcode: true,
})

setWeb3LibraryCallback((provider) => new Web3(provider))

defineComponent({
  setup() {
    const { active, activate, account, library } = useWeb3()

    const connectUsingMetamask = async () => {
      await activate(injected)
    }

    const connectUsingWalletConnect = async () => {
      await activate(walletconnect)
    }

    return {
      active,
      connect,
      connectUsingMetamask,
      connectUsingWalletConnect,
    }
  },
})