Skip to main content

Using Web3-React V6

The connector is available for web3-react V6. Please note that later versions of web3-react cannot be used with the Web3-React V6 connector due to breaking changes.

Installation

The connector maybe installed via the npm package:

 npm install @0xsequence/web3-react-v6-connector 0xsequence ethers

Usage

Initalization

The connector must be initialized similarly to other connectors.

import { SequenceConnector } from '@0xsequence/web3-react-v6-connector'

const options = {
appName: 'Web3 React Demo app'
}

export const sequence = new SequenceConnector({ chainId: 137, appName: options.appName })

Activation/Deactivation

The connection can be activated and deactivate from the initialized connector similarly to other connectors.

import { useWeb3React } from '@web3-react/core'
import { sequence as sequenceConnector } from './connectors/sequence'

const { activate } = useWeb3React()

const connectWeb3React = async () => {
activate(sequenceConnector);
}

const disconnectWeb3React = async () => {
sequenceConnector.deactivate();
}

Options

chainId

The default chain id as number that the Sequence wallet will attempt to connect to.

appName (optional)

The value of appName will be displayed by the Sequence wallet when initiating a connection.

Example

A demo app for Web3-React v6 is available here