0.6.0 • Published 3 years ago

@giacomo.licari/safe-apps-web3modal v0.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Safe Apps Web3Modal

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 @giacomo.licari/safe-apps-web3modal @giacomo.licari/safe-apps-sdk web3modal 

yarn add @giacomo.licari/safe-apps-web3modal @giacomo.licari/safe-apps-sdk web3modal 
  • Use SafeAppWeb3Modal
import { SafeAppWeb3Modal } from '@giacomo.licari/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()