This package has been deprecated

Author message:

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

@gnosis.pm/safe-apps-web3-react
TypeScript icon, indicating that this package has built-in type declarations

1.5.3 • Public • Published

Safe Apps Web3-react connector

npm

A connector to be used with web3-react package

Installation

yarn add @gnosis.pm/safe-apps-web3-react

npm install @gnosis.pm/safe-apps-web3-react

Usage

import { SafeAppConnector } from '@gnosis.pm/safe-apps-web3-react';

The connector follows web3-react's connectors API convention. Visit web3-react repo for more details

Helper hook

You can use our helper hook to automatically connect to a safe, it will automatically connect to the Safe if it detects that it's loaded in Safe App context:

import { useSafeAppConnection, SafeAppConnector } from '@gnosis.pm/safe-apps-web3-react';

const safeMultisigConnector = new SafeAppConnector();

const App = () => {
  const triedToConnectToSafe = useSafeAppConnection(safeMultisigConnector);

  React.useEffect(() => {
    if (triedToConnectToSafe) {
      // fallback to other providers
    }
  }, [triedToConnectToSafe]);
};

More scenarios

For the SDK overview documentation, please refer to the safe-apps-sdk documentation

Package Sidebar

Install

npm i @gnosis.pm/safe-apps-web3-react

Weekly Downloads

6,085

Version

1.5.3

License

MIT

Unpacked Size

18.3 kB

Total Files

15

Last publish

Collaborators

  • dasanra
  • germartinez
  • katspaugh
  • mikheevm