Skip to content

Commit

Permalink
Merge pull request #24 from windingtree/fix/usdc-permit
Browse files Browse the repository at this point in the history
fix: πŸ› Added salt support for permit signature utility
  • Loading branch information
kostysh authored Nov 10, 2022
2 parents fbd1183 + d63ae36 commit 24d59c4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ export const createPermitSignature = async (
owner: string,
spender: string,
value: BigNumber,
deadline: number
deadline: number,
salt?: string,
versionOverride?: string
): Promise<Signature> => {
const nonce = await contract.nonces(owner);
const name = await contract.name();
const version = '1';
const version = versionOverride || '1';
const chainId = await signer.getChainId();

return ethers.utils.splitSignature(
Expand All @@ -19,7 +21,8 @@ export const createPermitSignature = async (
name,
version,
chainId,
verifyingContract: contract.address
verifyingContract: contract.address,
...salt ? { salt } : {}
},
{
Permit: [
Expand Down

0 comments on commit 24d59c4

Please sign in to comment.