17.0.4 • Published 1 year ago

@gnosis.pm/safe-apps-web3modal v17.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Safe Apps Web3Modal

npm

This is a wrapper around web3modal that adds Safe Apps support.

If the app using the wrapper is run as a Safe App the connect method will automatically connect to the Safe App.

How to use

  • Install the package and its dependencies
npm i @gnosis.pm/safe-apps-web3modal @gnosis.pm/safe-apps-sdk web3modal

yarn add @gnosis.pm/safe-apps-web3modal @gnosis.pm/safe-apps-sdk web3modal
import { SafeAppWeb3Modal } from '@gnosis.pm/safe-apps-web3modal';
const modal = new SafeAppWeb3Modal(web3modalOptions);
  • Connect to the Safe
const provider = await modal.requestProvider();

This will connect to the Safe if it is available. Otherwise, it will fall back to web3modal's connect method and show a modal with available wallets.

  • Check if loaded as a Safe app
const loadedAsSafeApp = await modal.isSafeApp();

Know issues

NextJs

Is you use a server side rendering solution remember to instantiate the modal inside an useEffect to avoid NextJS to process this server side where the window object does not exist.

  const [provider, setProvider] = useState(null);

  useEffect(() => {
    (async () => {
      const modal = new SafeAppWeb3Modal();
      const provider = await modal.requestProvider();
      setProvider(provider);
    })();
  }, []);
17.0.3

1 year ago

17.0.4

1 year ago

17.0.2

2 years ago

17.0.1

2 years ago

17.0.0

2 years ago

16.0.0

2 years ago

15.0.0

2 years ago

14.0.0

2 years ago

13.0.0

2 years ago

13.0.1

2 years ago

12.0.0

2 years ago

10.0.0

2 years ago

7.0.0

2 years ago

8.0.0

2 years ago

9.0.0

2 years ago

11.0.0

2 years ago

6.0.1

2 years ago

5.0.0

3 years ago

6.0.0

2 years ago

4.0.0

3 years ago

4.0.0-next.2

3 years ago

3.0.1-next.0

3 years ago

3.0.1-next.1

3 years ago

3.0.0

3 years ago

3.0.0-next.3

3 years ago

3.0.0-next.2

3 years ago

3.0.0-next.1

3 years ago

3.0.0-next.0

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago

1.0.0-next.1

3 years ago

1.0.0-next.0

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.3.0

3 years ago

0.4.0

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.1.0-beta.0

3 years ago