✒️ Owl Signer
This page explains the ethers Owl Signer
Owl Signer
OwlSigner
is our implementation of an Ethers Signer. It allows you to send transactions using your Safe Wallet deployed through Owl Protocol.
You can easily connect it to an ethers.Contract
instance to make calls to a given contract using your Safe Wallet.
In the example below, we assume you own an ERC20 token at the contract address contractAddress
and that the contract supports minting tokens.
We initialize the OwlSigner
, then mint some ERC20 token, and finally transfer it to another address.
Using Contract instances
import { IERC20Mintable } from "@owlprotocol/contracts/ethers/factoryInterfaceClasses";
import { OwlProvider, OwlSigner } from "@owlprotocol/signer";
// How many transactions to wait for as confirmation
const txWait = 1;
const provider = new OwlProvider(1337, API_TRPC_BASE_URL);
const signer = new OwlSigner({ apiKey: API_KEY }, API_TRPC_BASE_URL, txWait, provider);
const userSafeAddress = await signer.getAddress();
// Replace with your own ERC20 contract address
const contractAddress = "0x1111111111111111111111111111111111111111"
// Mint some token
const receiver = userSafeAddress;
// `IERC20Mintable.connect` returns an ethers.Contract instance
const erc20MintableContract = IERC20Mintable.connect(contractAddress, signer);
await erc20MintableContract.mint(userSafeAddress, 100);
// Transfer some of this token
// `IERC20.connect` returns an ethers.Contract instance
const erc20Contract = IERC20.connect(contractAddress, signer);
const to = "0x7777777777777777777777777777777777777777",
await erc20Contract.transfer(to, 100)
Arbitrary transactions
You can also use our signer to send an arbitrary transaction, including to simply transfer a native token.
import { OwlProvider, OwlSigner } from "@owlprotocol/signer";
// How many transactions to wait for as confirmation
const txWait = 1;
const provider = new OwlProvider(1337, API_TRPC_BASE_URL);
const signer = new OwlSigner({ apiKey: API_KEY }, API_TRPC_BASE_URL, txWait, provider);
const to = "0x7777777777777777777777777777777777777777",
// 100 wei
const value = "100";
await signer.sendTransaction({to, value})
Updated 20 days ago