-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreparePermit2BatchData.ts
More file actions
41 lines (39 loc) · 1.27 KB
/
Copy pathpreparePermit2BatchData.ts
File metadata and controls
41 lines (39 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import type { PermitBatch } from "@uniswap/permit2-sdk";
import type { BatchPermitOptions } from "@uniswap/v4-sdk";
import type { TypedDataDomain, TypedDataField } from "ethers";
import type { Address, Hex } from "viem";
/**
* Interface for the parameters required to generate a Permit2 batch signature
*/
export interface PreparePermit2BatchDataParams {
/** Array of token addresses to permit */
tokens: (Address | string)[];
/** Address that will be allowed to spend the tokens */
spender: Address | string;
/** User's wallet address */
owner: Address | string;
/** Signature deadline in seconds */
sigDeadline?: number;
}
/**
* Interface for the return value of the function
*/
export interface PreparePermit2BatchDataResult {
/** Function to build the permit2 batch data with a signature */
buildPermit2BatchDataWithSignature: (
signature: string | Hex,
) => BatchPermitOptions;
/** User's wallet address */
owner: Address | string;
/** Permit2 batch data */
permitBatch: PermitBatch;
/** Data needed to sign the permit2 batch data */
toSign: {
/** Domain of the permit2 batch data */
domain: TypedDataDomain;
/** Types of the permit2 batch data */
types: Record<string, TypedDataField[]>;
/** Values of the permit2 batch data */
values: PermitBatch;
};
}