0.0.24 • Published 2 years ago

@skaleboarder/safe-tools v0.0.24

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

safe-tools

npm version

The SafeRelayer library allows you to implement a non-custodial sign-in system that enables in-browser transaction relay without requiring users to switch their wallets. It uses the Gnosis Safe for transaction processing and provides a seamless integration with your dApp.

Usage

Import the required modules and classes:

Import necessary modules and classes from the SafeRelayer library, ethers.js, and other required packages.

import { SafeRelayer, UserRelayerProps } from '@skaleboarder/safe-tools';
import { ethers } from 'ethers';

Create a relayer object:

Create a relayer object with the required configurations, such as signer, ethers, wallet deployer address, EnglishOwnerAdder address, network configuration, provider, and faucet function.

  const relayer = new SafeRelayer({
      ethers,
      signer: signers[1],
      walletDeployerAddress: walletDeployer.address,
      EnglishOwnerAdderAddress: deploys.EnglishOwnerAdder.address,
      networkConfig: contractNetworks,
      provider: deployer.provider!,
      faucet: async (address: string) => {
          await (await deployer.sendTransaction({
              to: address,
              value: ethers.utils.parseEther("2")
          })).wait()
      }
  })
  
  // we need to do this within the fixture so that the safe is created before the test runs
  // and when the state is snapshotted it all works.
  await relayer.ready

  // This can be used anywhere you'd usually use an ethers signer.
  const relayedEthersSigner = await relayer.wrappedSigner()

The returned signer is a drop-in replacement (a subclass) of an ethers.Signer. You can see how we use this in WAGMI

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.0

2 years ago