@skaleboarder/safe-tools
v0.0.24
Published
tools to interact with gnosis safe on sChains
Downloads
6
Readme
safe-tools
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