erc2771-wrapper
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

ERC2771 wrapper

This package allows to wrap a transaction in to a meta tx in compatible with OpenZeppelin MinimalForwarder contract.

How to use

const Wrapper = require("erc2771-wrapper").default;
const provider = new ethers.providers.JsonRpcProvider(RPC_URL);
const wrapper = new Wrapper(
  {
    name: "MinimalForwarder",
    version: "0.0.1",
    chainId: "5",
    verifyingContract: forwarderDeployment.address,
  },
  provider // provider is needed to estimate gas costs of a transaction
);

const metaTx = await wrapper.signMetaTxRequest(this.signer, {
  from: signer.address,
  to: registry.address,
  data: registry.interface.encodeFunctionData("register", [randomName]),
});

/erc2771-wrapper/

    Package Sidebar

    Install

    npm i erc2771-wrapper

    Weekly Downloads

    0

    Version

    0.1.4

    License

    MIT

    Unpacked Size

    10.7 kB

    Total Files

    11

    Last publish

    Collaborators

    • peersky