@cowprotocol/permit-utils 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/1inchPermitUtils-BDO_CqjL.cjs +1 -0
  2. package/1inchPermitUtils-CXu6m1-9.js +4 -0
  3. package/abi/versionAbis.d.ts +15 -0
  4. package/const.d.ts +24 -0
  5. package/consts/1inchPermitUtils.d.ts +25 -0
  6. package/{src/imports/1inchPermitUtils.ts → imports/1inchPermitUtils.d.ts} +1 -3
  7. package/index.cjs +1 -0
  8. package/{src/index.ts → index.d.ts} +8 -11
  9. package/index.js +547 -0
  10. package/lib/checkIsCallDataAValidPermit.d.ts +3 -0
  11. package/lib/generatePermitHook.d.ts +2 -0
  12. package/lib/getPermitUtilsInstance.d.ts +3 -0
  13. package/lib/getTokenPermitInfo.d.ts +2 -0
  14. package/package.json +19 -7
  15. package/types.d.ts +47 -0
  16. package/utils/PermitProviderConnector.d.ts +13 -0
  17. package/utils/buildPermitCallData.d.ts +3 -0
  18. package/utils/getContract.d.ts +3 -0
  19. package/utils/getEip712Domain.d.ts +13 -0
  20. package/utils/getPermitDeadline.d.ts +1 -0
  21. package/utils/getTokenName.d.ts +2 -0
  22. package/utils/getTokenPermitVersion.d.ts +2 -0
  23. package/utils/isSupportedPermitInfo.d.ts +2 -0
  24. package/CHANGELOG.md +0 -308
  25. package/jest.config.ts +0 -11
  26. package/project.json +0 -42
  27. package/src/abi/erc20.json +0 -59
  28. package/src/abi/versionAbis.ts +0 -37
  29. package/src/const.ts +0 -20
  30. package/src/consts/1inchPermitUtils.ts +0 -68
  31. package/src/lib/checkIsCallDataAValidPermit.ts +0 -64
  32. package/src/lib/generatePermitHook.ts +0 -133
  33. package/src/lib/getPermitUtilsInstance.ts +0 -51
  34. package/src/lib/getTokenPermitInfo.ts +0 -281
  35. package/src/types.ts +0 -61
  36. package/src/utils/PermitProviderConnector.ts +0 -75
  37. package/src/utils/buildPermitCallData.ts +0 -26
  38. package/src/utils/getContract.ts +0 -6
  39. package/src/utils/getEip712Domain.ts +0 -70
  40. package/src/utils/getPermitDeadline.ts +0 -7
  41. package/src/utils/getTokenName.ts +0 -13
  42. package/src/utils/getTokenPermitVersion.ts +0 -35
  43. package/src/utils/isSupportedPermitInfo.ts +0 -5
  44. package/tsconfig.json +0 -22
  45. package/tsconfig.lib.json +0 -10
  46. package/tsconfig.spec.json +0 -9
  47. package/vite.config.mts +0 -51
@@ -0,0 +1,2 @@
1
+ import { GetTokenPermitInfoParams, GetTokenPermitIntoResult } from '../types';
2
+ export declare function getTokenPermitInfo(params: GetTokenPermitInfoParams): Promise<GetTokenPermitIntoResult>;
package/package.json CHANGED
@@ -1,16 +1,22 @@
1
1
  {
2
2
  "name": "@cowprotocol/permit-utils",
3
- "version": "3.0.0",
4
- "type": "commonjs",
5
- "main": "./src/index.ts",
6
- "types": "./src/index.d.ts",
3
+ "version": "3.0.2",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/cowprotocol/cowswap.git",
7
+ "directory": "libs/permit-utils"
8
+ },
9
+ "type": "module",
10
+ "main": "./index.js",
11
+ "types": "./index.d.ts",
7
12
  "license": "ISC",
8
13
  "publishConfig": {
9
14
  "access": "public"
10
15
  },
11
16
  "dependencies": {
12
- "@cowprotocol/cow-sdk": "8.0.0",
17
+ "@cowprotocol/cow-sdk": "8.0.3",
13
18
  "@1inch/permit-signed-approvals-utils": "^1.5.1",
19
+ "@cowprotocol/hook-dapp-lib": "^2.0.10",
14
20
  "@ethersproject/abi": "5.7.0",
15
21
  "@ethersproject/abstract-signer": "5.7.0",
16
22
  "@ethersproject/address": "5.7.0",
@@ -21,10 +27,16 @@
21
27
  "@ethersproject/wallet": "5.7.0",
22
28
  "ethers": "5.7.2",
23
29
  "ms.macro": "^2.0.0",
24
- "viem": "^2.42.1",
25
- "@cowprotocol/hook-dapp-lib": "2.0.8"
30
+ "viem": "^2.42.1"
26
31
  },
27
32
  "devDependencies": {
28
33
  "@types/ms.macro": "^2.0.0"
34
+ },
35
+ "exports": {
36
+ ".": {
37
+ "types": "./index.d.ts",
38
+ "import": "./index.js",
39
+ "require": "./index.cjs"
40
+ }
29
41
  }
30
42
  }
package/types.d.ts ADDED
@@ -0,0 +1,47 @@
1
+ import { cowAppDataLatestScheme } from '@cowprotocol/cow-sdk';
2
+ import { JsonRpcProvider } from '@ethersproject/providers';
3
+ import { Eip2612PermitUtils } from '@1inch/permit-signed-approvals-utils';
4
+ export type PermitType = 'dai-like' | 'eip-2612' | 'unsupported';
5
+ export type PermitInfo = {
6
+ type: PermitType;
7
+ name?: string;
8
+ version?: string | undefined;
9
+ };
10
+ type TokenInfo = {
11
+ address: string;
12
+ name: string | undefined;
13
+ };
14
+ export type PermitHookParams = {
15
+ inputToken: TokenInfo;
16
+ spender: string;
17
+ chainId: number;
18
+ permitInfo: PermitInfo;
19
+ provider: JsonRpcProvider;
20
+ eip2612Utils: Eip2612PermitUtils;
21
+ account?: string;
22
+ nonce?: number;
23
+ amount?: bigint;
24
+ };
25
+ export type PermitHookData = cowAppDataLatestScheme.CoWHook;
26
+ type FailedToIdentify = {
27
+ error: string;
28
+ };
29
+ export type GetTokenPermitIntoResult = PermitInfo | FailedToIdentify;
30
+ type BasePermitCallDataParams = {
31
+ eip2612Utils: Eip2612PermitUtils;
32
+ };
33
+ export type BuildEip2612PermitCallDataParams = BasePermitCallDataParams & {
34
+ callDataParams: Parameters<Eip2612PermitUtils['buildPermitCallData']>;
35
+ };
36
+ export type BuildDaiLikePermitCallDataParams = BasePermitCallDataParams & {
37
+ callDataParams: Parameters<Eip2612PermitUtils['buildDaiLikePermitCallData']>;
38
+ };
39
+ export type GetTokenPermitInfoParams = {
40
+ spender: string;
41
+ tokenAddress: string;
42
+ chainId: number;
43
+ provider: JsonRpcProvider;
44
+ minGasLimit?: number | undefined;
45
+ amount?: bigint;
46
+ };
47
+ export {};
@@ -0,0 +1,13 @@
1
+ import { JsonRpcProvider } from '@ethersproject/providers';
2
+ import { Wallet } from '@ethersproject/wallet';
3
+ import { AbiInput, AbiItem, EIP712TypedData, ProviderConnector } from '@1inch/permit-signed-approvals-utils';
4
+ export declare class PermitProviderConnector implements ProviderConnector {
5
+ private provider;
6
+ private walletSigner?;
7
+ constructor(provider: JsonRpcProvider, walletSigner?: Wallet | undefined);
8
+ contractEncodeABI(abi: AbiItem[], address: string | null, methodName: string, methodParams: unknown[]): string;
9
+ signTypedData(_walletAddress: string, typedData: EIP712TypedData, _typedDataHash: string): Promise<string>;
10
+ ethCall(contractAddress: string, callData: string): Promise<string>;
11
+ decodeABIParameter<T>(type: string, hex: string): T;
12
+ decodeABIParameters<T>(types: AbiInput[], hex: string): T;
13
+ }
@@ -0,0 +1,3 @@
1
+ import { BuildDaiLikePermitCallDataParams, BuildEip2612PermitCallDataParams } from '../types';
2
+ export declare function buildEip2612PermitCallData({ eip2612Utils, callDataParams, }: BuildEip2612PermitCallDataParams): Promise<string>;
3
+ export declare function buildDaiLikePermitCallData({ eip2612Utils, callDataParams, }: BuildDaiLikePermitCallDataParams): Promise<string>;
@@ -0,0 +1,3 @@
1
+ import { Contract, ContractInterface } from '@ethersproject/contracts';
2
+ import { JsonRpcProvider } from '@ethersproject/providers';
3
+ export declare function getContract(address: string, abi: ContractInterface, provider: JsonRpcProvider): Contract;
@@ -0,0 +1,13 @@
1
+ import { JsonRpcProvider } from '@ethersproject/providers';
2
+ export declare function getEip712Domain(tokenAddress: string, chainId: number, provider: JsonRpcProvider): Promise<Eip712Domain>;
3
+ type Eip5267Return = {
4
+ fields: string;
5
+ name?: string;
6
+ version?: string;
7
+ chainId?: string;
8
+ verifyingContract?: string;
9
+ salt?: string;
10
+ extensions?: string[];
11
+ };
12
+ export type Eip712Domain = Omit<Eip5267Return, 'fields' | 'extensions'>;
13
+ export {};
@@ -0,0 +1 @@
1
+ export declare function getPermitDeadline(): number;
@@ -0,0 +1,2 @@
1
+ import { JsonRpcProvider } from '@ethersproject/providers';
2
+ export declare function getTokenName(tokenAddress: string, chainId: number, provider: JsonRpcProvider): Promise<string>;
@@ -0,0 +1,2 @@
1
+ import { JsonRpcProvider } from '@ethersproject/providers';
2
+ export declare function getTokenPermitVersion(tokenAddress: string, provider: JsonRpcProvider, index?: number): Promise<string>;
@@ -0,0 +1,2 @@
1
+ import { PermitInfo } from '../types';
2
+ export declare function isSupportedPermitInfo(p: PermitInfo | undefined): p is PermitInfo;
package/CHANGELOG.md DELETED
@@ -1,308 +0,0 @@
1
- # Changelog
2
-
3
- ## [3.0.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v2.4.0...permit-utils-v3.0.0) (2026-03-11)
4
-
5
-
6
- ### ⚠ BREAKING CHANGES
7
-
8
- * Remove support for Lens network ([#7128](https://github.com/cowprotocol/cowswap/issues/7128))
9
-
10
- ### ✨ Features
11
-
12
- * remove support for Lens network ([#7128](https://github.com/cowprotocol/cowswap/issues/7128)) ([ffdd36d](https://github.com/cowprotocol/cowswap/commit/ffdd36db765eb1feb7fc675347de40b1e6df2bdd))
13
-
14
-
15
- ### 🔧 Miscellaneous
16
-
17
- * **hotfix:** 2026-03-10 ([8c831f7](https://github.com/cowprotocol/cowswap/commit/8c831f70685c058f460d7a0fabbf2941163b9fba))
18
-
19
-
20
- ### Dependencies
21
-
22
- * The following workspace dependencies were updated
23
- * dependencies
24
- * @cowprotocol/hook-dapp-lib bumped to 2.0.8
25
-
26
- ## [2.4.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v2.3.2...permit-utils-v2.4.0) (2026-03-10)
27
-
28
-
29
- ### ✨ Features
30
-
31
- * integrate non-evm sdk changes ([#7085](https://github.com/cowprotocol/cowswap/issues/7085)) ([674602e](https://github.com/cowprotocol/cowswap/commit/674602e19bd97197a98733da51cda186d256384e))
32
-
33
-
34
- ### 🐛 Bug Fixes
35
-
36
- * use correct amounts to sign instead of afterSlippage ([#7022](https://github.com/cowprotocol/cowswap/issues/7022)) ([b1020c4](https://github.com/cowprotocol/cowswap/commit/b1020c44615b49c5f05f0a6dcf0d21b96b628846))
37
-
38
-
39
- ### 🔧 Miscellaneous
40
-
41
- * **release:** 2026-03-04 ([5612b59](https://github.com/cowprotocol/cowswap/commit/5612b59d690f9081e62d9efc5ea80774428f0366))
42
-
43
-
44
- ### Dependencies
45
-
46
- * The following workspace dependencies were updated
47
- * dependencies
48
- * @cowprotocol/hook-dapp-lib bumped to 2.0.7
49
-
50
- ## [2.3.2](https://github.com/cowprotocol/cowswap/compare/permit-utils-v2.3.1...permit-utils-v2.3.2) (2026-02-25)
51
-
52
-
53
- ### 🔧 Miscellaneous
54
-
55
- * main -&gt; dev ([9c6611e](https://github.com/cowprotocol/cowswap/commit/9c6611e90a4b23e23f6aaadc513de3c6d7f3b562))
56
-
57
-
58
- ### Dependencies
59
-
60
- * The following workspace dependencies were updated
61
- * dependencies
62
- * @cowprotocol/hook-dapp-lib bumped to 2.0.6
63
-
64
- ## [2.3.1](https://github.com/cowprotocol/cowswap/compare/permit-utils-v2.3.0...permit-utils-v2.3.1) (2026-02-24)
65
-
66
-
67
- ### 🔧 Miscellaneous
68
-
69
- * merge main into dev 23 02 ([#7062](https://github.com/cowprotocol/cowswap/issues/7062)) ([ac48c9c](https://github.com/cowprotocol/cowswap/commit/ac48c9c83284c6228ba71392edc1c1e0483b53ff))
70
-
71
-
72
- ### Dependencies
73
-
74
- * The following workspace dependencies were updated
75
- * dependencies
76
- * @cowprotocol/hook-dapp-lib bumped to 2.0.5
77
-
78
- ## [2.3.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v2.2.0...permit-utils-v2.3.0) (2026-02-20)
79
-
80
-
81
- ### ✨ Features
82
-
83
- * **chains:** disable Lens and support deprecating networks ([#7028](https://github.com/cowprotocol/cowswap/issues/7028)) ([c12d6c2](https://github.com/cowprotocol/cowswap/commit/c12d6c21ad69258c587378add9da86d72ff755b2))
84
-
85
-
86
- ### Dependencies
87
-
88
- * The following workspace dependencies were updated
89
- * dependencies
90
- * @cowprotocol/hook-dapp-lib bumped to 2.0.4
91
-
92
- ## [2.2.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v2.1.0...permit-utils-v2.2.0) (2026-02-13)
93
-
94
-
95
- ### ✨ Features
96
-
97
- * replace toLowerCase on getAddressKey ([#6866](https://github.com/cowprotocol/cowswap/issues/6866)) ([a41b23c](https://github.com/cowprotocol/cowswap/commit/a41b23c4384cdbcde9534abcdde37441121381e7))
98
-
99
-
100
- ### Dependencies
101
-
102
- * The following workspace dependencies were updated
103
- * dependencies
104
- * @cowprotocol/hook-dapp-lib bumped to 2.0.3
105
-
106
- ## [2.1.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v2.0.1...permit-utils-v2.1.0) (2026-02-05)
107
-
108
-
109
- ### ✨ Features
110
-
111
- * **trade:** upload appData to IPFS before signing ([#6922](https://github.com/cowprotocol/cowswap/issues/6922)) ([cb94104](https://github.com/cowprotocol/cowswap/commit/cb9410470c549bd5453a7933a0a224ba706ec2c2))
112
-
113
-
114
- ### 🔧 Miscellaneous
115
-
116
- * update sdk ([a20814b](https://github.com/cowprotocol/cowswap/commit/a20814b7caf16f495cd0292d5f3469bc552e4d97))
117
-
118
-
119
- ### Dependencies
120
-
121
- * The following workspace dependencies were updated
122
- * dependencies
123
- * @cowprotocol/hook-dapp-lib bumped to 2.0.2
124
-
125
- ## [2.0.1](https://github.com/cowprotocol/cowswap/compare/permit-utils-v2.0.0...permit-utils-v2.0.1) (2026-02-02)
126
-
127
-
128
- ### Bug Fixes
129
-
130
- * **protocol-fee:** support decimals in protocol fee ([#6948](https://github.com/cowprotocol/cowswap/issues/6948)) ([a572bbe](https://github.com/cowprotocol/cowswap/commit/a572bbe2899b0a48b2c0891922442a4420f6c3ef))
131
-
132
-
133
- ### Dependencies
134
-
135
- * The following workspace dependencies were updated
136
- * dependencies
137
- * @cowprotocol/hook-dapp-lib bumped to 2.0.1
138
-
139
- ## [2.0.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v1.0.1...permit-utils-v2.0.0) (2026-01-28)
140
-
141
-
142
- ### ⚠ BREAKING CHANGES
143
-
144
- * migrate from yarn to pnpm ([#6847](https://github.com/cowprotocol/cowswap/issues/6847))
145
-
146
- ### Features
147
-
148
- * migrate from yarn to pnpm ([#6847](https://github.com/cowprotocol/cowswap/issues/6847)) ([1c5d115](https://github.com/cowprotocol/cowswap/commit/1c5d11516d0ddb997b0ebbb4eee4adcb491204a4))
149
-
150
-
151
- ### Bug Fixes
152
-
153
- * optimize bundle size ([#6775](https://github.com/cowprotocol/cowswap/issues/6775)) ([287a94e](https://github.com/cowprotocol/cowswap/commit/287a94e807b3672dbbd291768fb2ad80dbd288e5))
154
-
155
-
156
- ### Dependencies
157
-
158
- * The following workspace dependencies were updated
159
- * dependencies
160
- * @cowprotocol/hook-dapp-lib bumped to 2.0.0
161
-
162
- ## [1.0.1](https://github.com/cowprotocol/cowswap/compare/permit-utils-v1.0.0...permit-utils-v1.0.1) (2025-12-16)
163
-
164
-
165
- ### Bug Fixes
166
-
167
- * update schema reference for app data ([#6626](https://github.com/cowprotocol/cowswap/issues/6626)) ([93e78e6](https://github.com/cowprotocol/cowswap/commit/93e78e69454039fc89eeeb170f076a7957db604f))
168
-
169
- ## [1.0.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.10.0...permit-utils-v1.0.0) (2025-09-12)
170
-
171
-
172
- ### ⚠ BREAKING CHANGES
173
-
174
- * add cow-sdk v7 ([#6165](https://github.com/cowprotocol/cowswap/issues/6165))
175
-
176
- ### Features
177
-
178
- * add cow-sdk v7 ([#6165](https://github.com/cowprotocol/cowswap/issues/6165)) ([46d7afe](https://github.com/cowprotocol/cowswap/commit/46d7afeab94c172dbad975f39b25033abd966498))
179
-
180
- ## [0.10.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.9.0...permit-utils-v0.10.0) (2025-08-28)
181
-
182
-
183
- ### Features
184
-
185
- * **trade:** implement partial approve ([#6139](https://github.com/cowprotocol/cowswap/issues/6139)) ([6f9d6b0](https://github.com/cowprotocol/cowswap/commit/6f9d6b055323d25705ee88a533f71190944be6e2))
186
-
187
- ## [0.9.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.8.0...permit-utils-v0.9.0) (2025-08-21)
188
-
189
-
190
- ### Features
191
-
192
- * **new-networks:** lens and bnb ([#5992](https://github.com/cowprotocol/cowswap/issues/5992)) ([19ac060](https://github.com/cowprotocol/cowswap/commit/19ac060f94088e7a1f6a2a891ef11d2c1ded4525))
193
-
194
- ## [0.8.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.7.0...permit-utils-v0.8.0) (2025-08-12)
195
-
196
-
197
- ### Features
198
-
199
- * rename Permit hook dapp id ([#6138](https://github.com/cowprotocol/cowswap/issues/6138)) ([41b0b18](https://github.com/cowprotocol/cowswap/commit/41b0b182d4a673bb1799a699ea83029ee8c6d73b))
200
-
201
-
202
- ### Bug Fixes
203
-
204
- * **dev-deps-update:** bump the dev-deps group with 76 updates ([#5663](https://github.com/cowprotocol/cowswap/issues/5663)) ([552b349](https://github.com/cowprotocol/cowswap/commit/552b349f53762a01ccf008e9a2083248424cbafa))
205
- * **permit:** dai permit issues ([#5680](https://github.com/cowprotocol/cowswap/issues/5680)) ([a9e2da0](https://github.com/cowprotocol/cowswap/commit/a9e2da026cab2b0e001adc7fb0ebf11d1b028089))
206
- * **permit:** nonce not supported [#5653](https://github.com/cowprotocol/cowswap/issues/5653) ([#5672](https://github.com/cowprotocol/cowswap/issues/5672)) ([a526222](https://github.com/cowprotocol/cowswap/commit/a526222e115c28540d68addd2476070815975846))
207
- * **trade:** use salt for eip712 if it's needed ([#6086](https://github.com/cowprotocol/cowswap/issues/6086)) ([bb6f26c](https://github.com/cowprotocol/cowswap/commit/bb6f26c72781df087e018ec14d9fefcbc225baa3))
208
-
209
- ## [0.7.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.6.2...permit-utils-v0.7.0) (2025-08-07)
210
-
211
-
212
- ### Bug Fixes
213
-
214
- * **trade:** use salt for eip712 if it's needed ([#6086](https://github.com/cowprotocol/cowswap/issues/6086)) ([bb6f26c](https://github.com/cowprotocol/cowswap/commit/bb6f26c72781df087e018ec14d9fefcbc225baa3))
215
-
216
- ## [0.6.2](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.6.1...permit-utils-v0.6.2) (2025-05-16)
217
-
218
-
219
- ### Bug Fixes
220
-
221
- * **permit:** dai permit issues ([#5680](https://github.com/cowprotocol/cowswap/issues/5680)) ([a9e2da0](https://github.com/cowprotocol/cowswap/commit/a9e2da026cab2b0e001adc7fb0ebf11d1b028089))
222
-
223
- ## [0.6.1](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.6.0...permit-utils-v0.6.1) (2025-05-08)
224
-
225
-
226
- ### Bug Fixes
227
-
228
- * **permit:** nonce not supported [#5653](https://github.com/cowprotocol/cowswap/issues/5653) ([#5672](https://github.com/cowprotocol/cowswap/issues/5672)) ([a526222](https://github.com/cowprotocol/cowswap/commit/a526222e115c28540d68addd2476070815975846))
229
-
230
- ## [0.6.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.5.0...permit-utils-v0.6.0) (2025-01-09)
231
-
232
-
233
- ### Features
234
-
235
- * **swap:** partial approve ([#5256](https://github.com/cowprotocol/cowswap/issues/5256)) ([f080ffd](https://github.com/cowprotocol/cowswap/commit/f080ffdb098612e729f3a3f829410ce78697979f))
236
-
237
- ## [0.5.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.4.0...permit-utils-v0.5.0) (2024-12-03)
238
-
239
-
240
- ### Features
241
-
242
- * **base:** add base chain support ([#5044](https://github.com/cowprotocol/cowswap/issues/5044)) ([4cf0c91](https://github.com/cowprotocol/cowswap/commit/4cf0c91a300d6fcdc026364e74c45e5b2f729f2b))
243
-
244
- ## [0.4.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.3.1...permit-utils-v0.4.0) (2024-10-10)
245
-
246
-
247
- ### Features
248
-
249
- * **hooks-store:** use dappId from hook model to match with dapp ([#4938](https://github.com/cowprotocol/cowswap/issues/4938)) ([46699cb](https://github.com/cowprotocol/cowswap/commit/46699cbe6df02b0f7a3c6c380a04842e9f403a88))
250
-
251
- ## [0.3.1](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.3.0...permit-utils-v0.3.1) (2024-07-17)
252
-
253
-
254
- ### Bug Fixes
255
-
256
- * **permit:** filter out permit signer and rotate it ([#4719](https://github.com/cowprotocol/cowswap/issues/4719)) ([bfb1f29](https://github.com/cowprotocol/cowswap/commit/bfb1f295997ba8cf16744afce45dbd19eb8990c6))
257
-
258
- ## [0.3.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.2.1...permit-utils-v0.3.0) (2024-05-29)
259
-
260
-
261
- ### Features
262
-
263
- * **arbitrum:** add arbitrum_one ([#4407](https://github.com/cowprotocol/cowswap/issues/4407)) ([166e33f](https://github.com/cowprotocol/cowswap/commit/166e33f3c494972738b154cf844584dd78e12c7d))
264
-
265
- ## [0.2.1](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.2.0...permit-utils-v0.2.1) (2024-05-02)
266
-
267
-
268
- ### Bug Fixes
269
-
270
- * **sentry:** fix unhandled permit failure ([#4275](https://github.com/cowprotocol/cowswap/issues/4275)) ([a774983](https://github.com/cowprotocol/cowswap/commit/a7749831a4874536423d6f65b1e17bfae8571d27))
271
-
272
- ## [0.2.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.1.2...permit-utils-v0.2.0) (2024-04-11)
273
-
274
-
275
- ### Features
276
-
277
- * **widget:** customize images ([#4159](https://github.com/cowprotocol/cowswap/issues/4159)) ([0b14b2b](https://github.com/cowprotocol/cowswap/commit/0b14b2b19279a1688f75dc4f2954b8c267e57c40))
278
-
279
-
280
- ### Bug Fixes
281
-
282
- * **permit:** gnosis chain permits ([#4152](https://github.com/cowprotocol/cowswap/issues/4152)) ([26b703f](https://github.com/cowprotocol/cowswap/commit/26b703f2a45715fce0c4418d1f45fdceab2a716e))
283
-
284
- ## [0.1.2](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.1.1...permit-utils-v0.1.2) (2024-02-01)
285
-
286
-
287
- ### Bug Fixes
288
-
289
- * **permit-utils:** aave permit ([#3684](https://github.com/cowprotocol/cowswap/issues/3684)) ([68566d8](https://github.com/cowprotocol/cowswap/commit/68566d882f0c0bebde93b8228645a59d76c2120d))
290
-
291
- ## [0.1.1](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.1.0...permit-utils-v0.1.1) (2024-01-24)
292
-
293
-
294
- ### Bug Fixes
295
-
296
- * **permit:** replace permit signer account ([#3691](https://github.com/cowprotocol/cowswap/issues/3691)) ([3ae286f](https://github.com/cowprotocol/cowswap/commit/3ae286f7e0f239a2843ce2a30138d23eceb1577f))
297
-
298
- ## [0.1.0](https://github.com/cowprotocol/cowswap/compare/permit-utils-v0.0.2...permit-utils-v0.1.0) (2024-01-17)
299
-
300
-
301
- ### Features
302
-
303
- * **networks:** support Sepolia ([#3558](https://github.com/cowprotocol/cowswap/issues/3558)) ([ab8b179](https://github.com/cowprotocol/cowswap/commit/ab8b1794fb60da851f3fccdd861ebef4b18df30e))
304
-
305
-
306
- ### Bug Fixes
307
-
308
- * **permit:** replace permit signer used for quoting ([#3562](https://github.com/cowprotocol/cowswap/issues/3562)) ([907d908](https://github.com/cowprotocol/cowswap/commit/907d90825643a5ad5824ed4ff5d24a9227f96f71))
package/jest.config.ts DELETED
@@ -1,11 +0,0 @@
1
- export default {
2
- displayName: 'permit-utils',
3
- preset: '../../jest.preset.js',
4
- testEnvironment: 'node',
5
- transform: {
6
- '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
7
- },
8
- setupFilesAfterEnv: ['../../jest.setup.ts'],
9
- moduleFileExtensions: ['ts', 'js', 'html'],
10
- coverageDirectory: '../../coverage/libs/permit-utils',
11
- }
package/project.json DELETED
@@ -1,42 +0,0 @@
1
- {
2
- "name": "permit-utils",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "libs/permit-utils/src",
5
- "projectType": "library",
6
- "targets": {
7
- "build": {
8
- "executor": "@nx/js:tsc",
9
- "outputs": ["{options.outputPath}"],
10
- "options": {
11
- "outputPath": "dist/libs/permit-utils",
12
- "main": "libs/permit-utils/src/index.ts",
13
- "tsConfig": "libs/permit-utils/tsconfig.lib.json",
14
- "assets": ["libs/permit-utils/*.md"],
15
- "updateBuildableProjectDepsInPackageJson": true,
16
- "buildableProjectDepsInPackageJsonType": "dependencies"
17
- }
18
- },
19
- "lint": {
20
- "executor": "@nx/eslint:lint",
21
- "outputs": ["{options.outputFile}"],
22
- "options": {
23
- "lintFilePatterns": ["libs/permit-utils/**/*.ts"]
24
- }
25
- },
26
- "test": {
27
- "executor": "@nx/jest:jest",
28
- "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
29
- "options": {
30
- "jestConfig": "libs/permit-utils/jest.config.ts",
31
- "passWithNoTests": true
32
- },
33
- "configurations": {
34
- "ci": {
35
- "ci": true,
36
- "codeCoverage": true
37
- }
38
- }
39
- }
40
- },
41
- "tags": []
42
- }
@@ -1,59 +0,0 @@
1
- [
2
- {
3
- "constant": true,
4
- "inputs": [],
5
- "name": "name",
6
- "outputs": [
7
- {
8
- "name": "",
9
- "type": "string"
10
- }
11
- ],
12
- "payable": false,
13
- "stateMutability": "view",
14
- "type": "function"
15
- },
16
- {
17
- "inputs": [],
18
- "name": "eip712Domain",
19
- "outputs": [
20
- {
21
- "internalType": "bytes1",
22
- "name": "fields",
23
- "type": "bytes1"
24
- },
25
- {
26
- "internalType": "string",
27
- "name": "name",
28
- "type": "string"
29
- },
30
- {
31
- "internalType": "string",
32
- "name": "version",
33
- "type": "string"
34
- },
35
- {
36
- "internalType": "uint256",
37
- "name": "chainId",
38
- "type": "uint256"
39
- },
40
- {
41
- "internalType": "address",
42
- "name": "verifyingContract",
43
- "type": "address"
44
- },
45
- {
46
- "internalType": "bytes32",
47
- "name": "salt",
48
- "type": "bytes32"
49
- },
50
- {
51
- "internalType": "uint256[]",
52
- "name": "extensions",
53
- "type": "uint256[]"
54
- }
55
- ],
56
- "stateMutability": "view",
57
- "type": "function"
58
- }
59
- ]
@@ -1,37 +0,0 @@
1
- /**
2
- * ABIs for fetching the version of different permit flavours
3
- */
4
- export const VERSION_ABIS = [
5
- [
6
- {
7
- constant: true,
8
- inputs: [],
9
- name: 'version',
10
- outputs: [
11
- {
12
- name: '',
13
- type: 'string',
14
- },
15
- ],
16
- payable: false,
17
- stateMutability: 'view',
18
- type: 'function',
19
- },
20
- ],
21
- [
22
- {
23
- constant: true,
24
- inputs: [],
25
- name: 'ERC712_VERSION',
26
- outputs: [
27
- {
28
- name: '',
29
- type: 'string',
30
- },
31
- ],
32
- payable: false,
33
- stateMutability: 'view',
34
- type: 'function',
35
- },
36
- ],
37
- ]
package/src/const.ts DELETED
@@ -1,20 +0,0 @@
1
- import { MaxUint256 } from '@ethersproject/constants'
2
- import { Wallet } from '@ethersproject/wallet'
3
-
4
- import ms from 'ms.macro'
5
- import { privateKeyToAccount } from 'viem/accounts'
6
-
7
- // PK used only for signing permit requests for quoting and identifying token 'permittability'
8
- // Do not use or try to send funds to it. Or do. It'll be your funds 🤷
9
- const PERMIT_PK = '0xa50dc0f7fc051309434deb3b1c71e927dbb711759231d8ecbf630c85d94a42fe' // address: 0xDa5F16F4ab0410096a4403e7223988649fac38cF
10
-
11
- export const PERMIT_ACCOUNT = privateKeyToAccount(PERMIT_PK)
12
- export const PERMIT_SIGNER = new Wallet(PERMIT_PK)
13
-
14
- export const DEFAULT_MIN_GAS_LIMIT = 55_000
15
-
16
- export const DEFAULT_PERMIT_GAS_LIMIT = '80000'
17
-
18
- export const DEFAULT_PERMIT_VALUE = MaxUint256.toBigInt()
19
-
20
- export const DEFAULT_PERMIT_DURATION = ms`5 years`