0.0.24 • Published 12 months ago

@skaleboarder/safe-tools v0.0.24

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months 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

12 months ago

0.0.21

12 months ago

0.0.22

12 months ago

0.0.23

12 months ago

0.0.24

12 months ago

0.0.15

12 months ago

0.0.16

12 months ago

0.0.17

12 months ago

0.0.18

12 months ago

0.0.19

12 months ago

0.0.12

12 months ago

0.0.13

12 months ago

0.0.14

12 months ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.0

1 year ago