1.0.3 • Published 1 year ago

ethers-js-permit v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ethers-js-permit

Ethers-js-permit is a support library for ethers-js that allows for easy generation of signatures for ERC20Permit.

Install

yarn add ethers-js-permit

USAGE

  import { signPermitSigature } from 'ethers-js-permit'

  const wallet = Wallet.createRandom()
  const nonce = await erc20Permit.nonce(wallet.address)
  const name = await erc20Permit.name()
  const permitConfig = {
    nonce, // this should be take
    name,
    chainId: 1, // -> this should be 1 for ethereum.
    version: '1'
  }
  const deadline = 60 * 60 * 24

  const result = await signPermitSigature(
    wallet,
    wallet.address,
    erc20Permit.address,
    targetContract,
    BigNumber.from('100'),
    deadline,
    permitConfig
  )

  await targetContract.removeLiquidity( // contract call with permit
    ...,
    deadline,
    false,
    result.v,
    result.r,
    result.s
  )
1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago