@cowprotocol/hook-dapp-lib 2.0.8 → 2.0.10
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.
- package/consts.d.ts +10 -0
- package/hookDappIframeTransport.d.ts +19 -0
- package/hookDappsRegistry.d.ts +203 -0
- package/index.cjs +5 -0
- package/index.d.ts +6 -0
- package/index.js +274 -0
- package/initCoWHookDapp.d.ts +11 -0
- package/package.json +17 -5
- package/types.d.ts +120 -0
- package/utils.d.ts +14 -0
- package/CHANGELOG.md +0 -262
- package/demo.png +0 -0
- package/jest.config.ts +0 -10
- package/project.json +0 -51
- package/src/consts.ts +0 -13
- package/src/hookDappIframeTransport.ts +0 -23
- package/src/hookDappsRegistry.ts +0 -209
- package/src/index.ts +0 -6
- package/src/initCoWHookDapp.ts +0 -42
- package/src/types.ts +0 -141
- package/src/utils.ts +0 -68
- package/tsconfig.json +0 -22
- package/tsconfig.lib.json +0 -10
- package/tsconfig.spec.json +0 -9
package/types.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { HookDappType, HookDappWalletCompatibility } from './consts';
|
|
2
|
+
export interface CowHook {
|
|
3
|
+
target: string;
|
|
4
|
+
callData: string;
|
|
5
|
+
gasLimit: string;
|
|
6
|
+
dappId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface HookDappConditions {
|
|
9
|
+
position?: 'post' | 'pre';
|
|
10
|
+
walletCompatibility?: HookDappWalletCompatibility[];
|
|
11
|
+
supportedNetworks?: number[];
|
|
12
|
+
}
|
|
13
|
+
export interface CowHookCreation {
|
|
14
|
+
hook: Omit<CowHook, 'dappId'>;
|
|
15
|
+
recipientOverride?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TokenData {
|
|
18
|
+
address: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CowHookDetails extends CowHookCreation {
|
|
21
|
+
hook: CowHook;
|
|
22
|
+
uuid: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CowHookToEdit extends CowHookCreation {
|
|
25
|
+
uuid: string;
|
|
26
|
+
}
|
|
27
|
+
export interface CoWHookDappActions {
|
|
28
|
+
addHook(payload: CowHookCreation): void;
|
|
29
|
+
editHook(payload: CowHookToEdit): void;
|
|
30
|
+
setSellToken(token: TokenData): void;
|
|
31
|
+
setBuyToken(token: TokenData): void;
|
|
32
|
+
}
|
|
33
|
+
export interface HookDappOrderParams {
|
|
34
|
+
kind: 'buy' | 'sell';
|
|
35
|
+
validTo: number;
|
|
36
|
+
sellTokenAddress: string;
|
|
37
|
+
buyTokenAddress: string;
|
|
38
|
+
receiver: string;
|
|
39
|
+
sellAmount: string;
|
|
40
|
+
buyAmount: string;
|
|
41
|
+
}
|
|
42
|
+
declare enum SimpleTypeType {
|
|
43
|
+
Address = "address",
|
|
44
|
+
Bool = "bool",
|
|
45
|
+
Bytes = "bytes",
|
|
46
|
+
Slice = "slice",
|
|
47
|
+
String = "string",
|
|
48
|
+
Uint = "uint"
|
|
49
|
+
}
|
|
50
|
+
interface Type {
|
|
51
|
+
type: SimpleTypeType;
|
|
52
|
+
}
|
|
53
|
+
declare enum SoltypeType {
|
|
54
|
+
Address = "address",
|
|
55
|
+
Bool = "bool",
|
|
56
|
+
Bytes32 = "bytes32",
|
|
57
|
+
MappingAddressUint256 = "mapping (address => uint256)",
|
|
58
|
+
MappingUint256Uint256 = "mapping (uint256 => uint256)",
|
|
59
|
+
String = "string",
|
|
60
|
+
Tuple = "tuple",
|
|
61
|
+
TypeAddress = "address[]",
|
|
62
|
+
TypeTuple = "tuple[]",
|
|
63
|
+
Uint16 = "uint16",
|
|
64
|
+
Uint256 = "uint256",
|
|
65
|
+
Uint48 = "uint48",
|
|
66
|
+
Uint56 = "uint56",
|
|
67
|
+
Uint8 = "uint8"
|
|
68
|
+
}
|
|
69
|
+
declare enum StorageLocation {
|
|
70
|
+
Calldata = "calldata",
|
|
71
|
+
Default = "default",
|
|
72
|
+
Memory = "memory",
|
|
73
|
+
Storage = "storage"
|
|
74
|
+
}
|
|
75
|
+
interface SoltypeElement {
|
|
76
|
+
name: string;
|
|
77
|
+
type: SoltypeType;
|
|
78
|
+
storage_location: StorageLocation;
|
|
79
|
+
components: SoltypeElement[] | null;
|
|
80
|
+
offset: number;
|
|
81
|
+
index: string;
|
|
82
|
+
indexed: boolean;
|
|
83
|
+
simple_type?: Type;
|
|
84
|
+
}
|
|
85
|
+
interface RawElement {
|
|
86
|
+
address: string;
|
|
87
|
+
key: string;
|
|
88
|
+
original: string;
|
|
89
|
+
dirty: string;
|
|
90
|
+
}
|
|
91
|
+
export interface StateDiff {
|
|
92
|
+
address: string;
|
|
93
|
+
soltype: SoltypeElement | null;
|
|
94
|
+
original: string | Record<string, unknown>;
|
|
95
|
+
dirty: string | Record<string, unknown>;
|
|
96
|
+
raw: RawElement[];
|
|
97
|
+
}
|
|
98
|
+
export interface HookDappContext {
|
|
99
|
+
chainId: number;
|
|
100
|
+
account?: string;
|
|
101
|
+
orderParams: HookDappOrderParams | null;
|
|
102
|
+
hookToEdit?: CowHookDetails;
|
|
103
|
+
isSmartContract: boolean | undefined;
|
|
104
|
+
isPreHook: boolean;
|
|
105
|
+
isDarkMode: boolean;
|
|
106
|
+
balancesDiff: Record<string, Record<string, string>>;
|
|
107
|
+
stateDiff: StateDiff[];
|
|
108
|
+
}
|
|
109
|
+
export interface HookDappBase {
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
descriptionShort?: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
type: HookDappType;
|
|
115
|
+
version: string;
|
|
116
|
+
website: string;
|
|
117
|
+
image: string;
|
|
118
|
+
conditions?: HookDappConditions;
|
|
119
|
+
}
|
|
120
|
+
export {};
|
package/utils.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CowHook, HookDappBase } from './types';
|
|
2
|
+
type StrictCowHook = Omit<CowHook, 'dappId'> & {
|
|
3
|
+
dappId?: string;
|
|
4
|
+
};
|
|
5
|
+
export interface HookToDappMatch {
|
|
6
|
+
dapp: HookDappBase | null;
|
|
7
|
+
hook: CowHook;
|
|
8
|
+
}
|
|
9
|
+
export declare function matchHooksToDapps(hooks: StrictCowHook[], dapps: HookDappBase[]): HookToDappMatch[];
|
|
10
|
+
export declare function doesHookHavePermit(hook: {
|
|
11
|
+
callData: string;
|
|
12
|
+
}): boolean;
|
|
13
|
+
export declare function matchHooksToDappsRegistry(hooks: StrictCowHook[], additionalHookDapps?: HookDappBase[]): HookToDappMatch[];
|
|
14
|
+
export {};
|
package/CHANGELOG.md
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [2.0.8](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v2.0.7...hook-dapp-lib-v2.0.8) (2026-03-11)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### Dependencies
|
|
7
|
-
|
|
8
|
-
* The following workspace dependencies were updated
|
|
9
|
-
* dependencies
|
|
10
|
-
* @cowprotocol/iframe-transport bumped to 2.0.8
|
|
11
|
-
|
|
12
|
-
## [2.0.7](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v2.0.6...hook-dapp-lib-v2.0.7) (2026-03-10)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Dependencies
|
|
16
|
-
|
|
17
|
-
* The following workspace dependencies were updated
|
|
18
|
-
* dependencies
|
|
19
|
-
* @cowprotocol/iframe-transport bumped to 2.0.7
|
|
20
|
-
|
|
21
|
-
## [2.0.6](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v2.0.5...hook-dapp-lib-v2.0.6) (2026-02-25)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
### 🔧 Miscellaneous
|
|
25
|
-
|
|
26
|
-
* main -> dev ([9c6611e](https://github.com/cowprotocol/cowswap/commit/9c6611e90a4b23e23f6aaadc513de3c6d7f3b562))
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Dependencies
|
|
30
|
-
|
|
31
|
-
* The following workspace dependencies were updated
|
|
32
|
-
* dependencies
|
|
33
|
-
* @cowprotocol/iframe-transport bumped to 2.0.6
|
|
34
|
-
|
|
35
|
-
## [2.0.5](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v2.0.4...hook-dapp-lib-v2.0.5) (2026-02-24)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### 🔧 Miscellaneous
|
|
39
|
-
|
|
40
|
-
* merge main into dev 23 02 ([#7062](https://github.com/cowprotocol/cowswap/issues/7062)) ([ac48c9c](https://github.com/cowprotocol/cowswap/commit/ac48c9c83284c6228ba71392edc1c1e0483b53ff))
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### Dependencies
|
|
44
|
-
|
|
45
|
-
* The following workspace dependencies were updated
|
|
46
|
-
* dependencies
|
|
47
|
-
* @cowprotocol/iframe-transport bumped to 2.0.5
|
|
48
|
-
|
|
49
|
-
## [2.0.4](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v2.0.3...hook-dapp-lib-v2.0.4) (2026-02-20)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
### Dependencies
|
|
53
|
-
|
|
54
|
-
* The following workspace dependencies were updated
|
|
55
|
-
* dependencies
|
|
56
|
-
* @cowprotocol/iframe-transport bumped to 2.0.4
|
|
57
|
-
|
|
58
|
-
## [2.0.3](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v2.0.2...hook-dapp-lib-v2.0.3) (2026-02-13)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
### Dependencies
|
|
62
|
-
|
|
63
|
-
* The following workspace dependencies were updated
|
|
64
|
-
* dependencies
|
|
65
|
-
* @cowprotocol/iframe-transport bumped to 2.0.3
|
|
66
|
-
|
|
67
|
-
## [2.0.2](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v2.0.1...hook-dapp-lib-v2.0.2) (2026-02-05)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
### Dependencies
|
|
71
|
-
|
|
72
|
-
* The following workspace dependencies were updated
|
|
73
|
-
* dependencies
|
|
74
|
-
* @cowprotocol/iframe-transport bumped to 2.0.2
|
|
75
|
-
|
|
76
|
-
## [2.0.1](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v2.0.0...hook-dapp-lib-v2.0.1) (2026-02-02)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
### Dependencies
|
|
80
|
-
|
|
81
|
-
* The following workspace dependencies were updated
|
|
82
|
-
* dependencies
|
|
83
|
-
* @cowprotocol/iframe-transport bumped to 2.0.1
|
|
84
|
-
|
|
85
|
-
## [2.0.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.14.4...hook-dapp-lib-v2.0.0) (2026-01-28)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
### ⚠ BREAKING CHANGES
|
|
89
|
-
|
|
90
|
-
* migrate from yarn to pnpm ([#6847](https://github.com/cowprotocol/cowswap/issues/6847))
|
|
91
|
-
|
|
92
|
-
### Features
|
|
93
|
-
|
|
94
|
-
* migrate from yarn to pnpm ([#6847](https://github.com/cowprotocol/cowswap/issues/6847)) ([1c5d115](https://github.com/cowprotocol/cowswap/commit/1c5d11516d0ddb997b0ebbb4eee4adcb491204a4))
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
### Dependencies
|
|
98
|
-
|
|
99
|
-
* The following workspace dependencies were updated
|
|
100
|
-
* dependencies
|
|
101
|
-
* @cowprotocol/iframe-transport bumped to 2.0.0
|
|
102
|
-
|
|
103
|
-
## [1.14.4](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.14.3...hook-dapp-lib-v1.14.4) (2026-01-26)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
### Dependencies
|
|
107
|
-
|
|
108
|
-
* The following workspace dependencies were updated
|
|
109
|
-
* dependencies
|
|
110
|
-
* @cowprotocol/iframe-transport bumped from ^1.1.1 to ^1.2.0
|
|
111
|
-
|
|
112
|
-
## [1.14.3](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.14.2...hook-dapp-lib-v1.14.3) (2026-01-26)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
### Dependencies
|
|
116
|
-
|
|
117
|
-
* The following workspace dependencies were updated
|
|
118
|
-
* dependencies
|
|
119
|
-
* @cowprotocol/iframe-transport bumped from ^1.0.0 to ^1.1.1
|
|
120
|
-
|
|
121
|
-
## [1.14.2](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.14.1...hook-dapp-lib-v1.14.2) (2025-12-24)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
### Bug Fixes
|
|
125
|
-
|
|
126
|
-
* use aave token logo from cow cdn for aave img ([#6655](https://github.com/cowprotocol/cowswap/issues/6655)) ([b1acbfd](https://github.com/cowprotocol/cowswap/commit/b1acbfdf021fe53265b44c985baa5bf806571e7c))
|
|
127
|
-
|
|
128
|
-
## [1.14.1](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.14.0...hook-dapp-lib-v1.14.1) (2025-12-09)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
### Bug Fixes
|
|
132
|
-
|
|
133
|
-
* avoid using i18n in hookDappsRegistry ([#6633](https://github.com/cowprotocol/cowswap/issues/6633)) ([9cfeae0](https://github.com/cowprotocol/cowswap/commit/9cfeae0c107a632e78176c004aa3614fad12f68b))
|
|
134
|
-
|
|
135
|
-
## [1.14.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.13.0...hook-dapp-lib-v1.14.0) (2025-11-24)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
### Features
|
|
139
|
-
|
|
140
|
-
* **internationalization:** add internationalization to CoW Swap ([#6198](https://github.com/cowprotocol/cowswap/issues/6198)) ([bec1e54](https://github.com/cowprotocol/cowswap/commit/bec1e54643d9b20a8b6517eae188993e364fed90))
|
|
141
|
-
|
|
142
|
-
## [1.13.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.12.0...hook-dapp-lib-v1.13.0) (2025-11-05)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
### Features
|
|
146
|
-
|
|
147
|
-
* **hook-dapps:** register aave flash-loans hooks ([#6470](https://github.com/cowprotocol/cowswap/issues/6470)) ([a033304](https://github.com/cowprotocol/cowswap/commit/a033304a8a6376ccb28319e998c13a7916eebcd5))
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
### Bug Fixes
|
|
151
|
-
|
|
152
|
-
* update permit hook description ([#6412](https://github.com/cowprotocol/cowswap/issues/6412)) ([0342200](https://github.com/cowprotocol/cowswap/commit/03422007648aede61f75ac8b66b450e2a01bbe8a))
|
|
153
|
-
|
|
154
|
-
## [1.12.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.11.0...hook-dapp-lib-v1.12.0) (2025-10-02)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
### Features
|
|
158
|
-
|
|
159
|
-
* **bridge:** use best quote among all providers ([#6299](https://github.com/cowprotocol/cowswap/issues/6299)) ([ba90184](https://github.com/cowprotocol/cowswap/commit/ba901842f4f940e30dedda66b0b39273f53713ae))
|
|
160
|
-
|
|
161
|
-
## [1.11.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.10.0...hook-dapp-lib-v1.11.0) (2025-08-28)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
### Features
|
|
165
|
-
|
|
166
|
-
* **trade:** implement partial approve ([#6139](https://github.com/cowprotocol/cowswap/issues/6139)) ([6f9d6b0](https://github.com/cowprotocol/cowswap/commit/6f9d6b055323d25705ee88a533f71190944be6e2))
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
### Bug Fixes
|
|
170
|
-
|
|
171
|
-
* **lens:** follow up fixes ([#6176](https://github.com/cowprotocol/cowswap/issues/6176)) ([cd8f3c0](https://github.com/cowprotocol/cowswap/commit/cd8f3c0201b8f04fc31a59588b6d2d05d215e112))
|
|
172
|
-
|
|
173
|
-
## [1.10.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.9.0...hook-dapp-lib-v1.10.0) (2025-08-12)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
### Features
|
|
177
|
-
|
|
178
|
-
* rename Permit hook dapp id ([#6138](https://github.com/cowprotocol/cowswap/issues/6138)) ([41b0b18](https://github.com/cowprotocol/cowswap/commit/41b0b182d4a673bb1799a699ea83029ee8c6d73b))
|
|
179
|
-
|
|
180
|
-
## [1.9.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.8.0...hook-dapp-lib-v1.9.0) (2025-07-30)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
### Features
|
|
184
|
-
|
|
185
|
-
* **bridge:** add bungee to hook dapps registry ([#5974](https://github.com/cowprotocol/cowswap/issues/5974)) ([5cc9ee4](https://github.com/cowprotocol/cowswap/commit/5cc9ee4b293c7e662a6723ad37729cbc08296d23))
|
|
186
|
-
* **hooks:** add polygon to morpho and update info ([#5945](https://github.com/cowprotocol/cowswap/issues/5945)) ([6c47e0e](https://github.com/cowprotocol/cowswap/commit/6c47e0eb481ed4ce5af2b2e3c7cf4c61f4ba79e1))
|
|
187
|
-
|
|
188
|
-
## [1.8.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.7.1...hook-dapp-lib-v1.8.0) (2025-07-03)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
### Features
|
|
192
|
-
|
|
193
|
-
* **hooks:** add Morpho Lending hook to registry ([#5646](https://github.com/cowprotocol/cowswap/issues/5646)) ([198db52](https://github.com/cowprotocol/cowswap/commit/198db528011ebaf4c2787be1d3413e2e105d2125))
|
|
194
|
-
|
|
195
|
-
## [1.7.1](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.7.0...hook-dapp-lib-v1.7.1) (2025-05-16)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
### Bug Fixes
|
|
199
|
-
|
|
200
|
-
* **permit:** dai permit issues ([#5680](https://github.com/cowprotocol/cowswap/issues/5680)) ([a9e2da0](https://github.com/cowprotocol/cowswap/commit/a9e2da026cab2b0e001adc7fb0ebf11d1b028089))
|
|
201
|
-
|
|
202
|
-
## [1.7.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.6.0...hook-dapp-lib-v1.7.0) (2025-03-20)
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
### Features
|
|
206
|
-
|
|
207
|
-
* **hook-store:** add uni-v2 deposit hook dapp ([#5245](https://github.com/cowprotocol/cowswap/issues/5245)) ([f335a05](https://github.com/cowprotocol/cowswap/commit/f335a0575e624747714662e7237b8bd7b97bd49d))
|
|
208
|
-
|
|
209
|
-
## [1.6.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.5.0...hook-dapp-lib-v1.6.0) (2025-02-05)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
### Features
|
|
213
|
-
|
|
214
|
-
* **hook-store:** add Uniswap v2 withdraw hook dapp ([#5155](https://github.com/cowprotocol/cowswap/issues/5155)) ([2abaf53](https://github.com/cowprotocol/cowswap/commit/2abaf53a5f87c91521ed8dd94e2cd8aa5ecb8aec))
|
|
215
|
-
|
|
216
|
-
## [1.5.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.4.0...hook-dapp-lib-v1.5.0) (2025-01-09)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
### Features
|
|
220
|
-
|
|
221
|
-
* **swap:** partial approve ([#5256](https://github.com/cowprotocol/cowswap/issues/5256)) ([f080ffd](https://github.com/cowprotocol/cowswap/commit/f080ffdb098612e729f3a3f829410ce78697979f))
|
|
222
|
-
|
|
223
|
-
## [1.4.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.3.0...hook-dapp-lib-v1.4.0) (2024-12-11)
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
### Features
|
|
227
|
-
|
|
228
|
-
* **hook-store:** add cow amm deposit hook dapp ([#5069](https://github.com/cowprotocol/cowswap/issues/5069)) ([4b9331c](https://github.com/cowprotocol/cowswap/commit/4b9331cbfab92fc113043c4e204e280b55d09f62))
|
|
229
|
-
|
|
230
|
-
## [1.3.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.2.0...hook-dapp-lib-v1.3.0) (2024-10-29)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
### Features
|
|
234
|
-
|
|
235
|
-
* **hook-store:** create bundle hooks tenderly simulation ([#4943](https://github.com/cowprotocol/cowswap/issues/4943)) ([435bfdf](https://github.com/cowprotocol/cowswap/commit/435bfdfa3e68cea1652bc00dcf5908bbc991d7b1))
|
|
236
|
-
|
|
237
|
-
## [1.2.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.1.0...hook-dapp-lib-v1.2.0) (2024-10-18)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
### Features
|
|
241
|
-
|
|
242
|
-
* **hooks-store:** add claim vesting iframe hook ([#4924](https://github.com/cowprotocol/cowswap/issues/4924)) ([395f48f](https://github.com/cowprotocol/cowswap/commit/395f48f57d93de67305791fdb9a668bdd693074e))
|
|
243
|
-
* **hooks-store:** add sell/buy amounts to hook-dapp context ([#4990](https://github.com/cowprotocol/cowswap/issues/4990)) ([26cbffb](https://github.com/cowprotocol/cowswap/commit/26cbffbbfe8edbc0a4a9ba31fe9c0d42852118d9))
|
|
244
|
-
|
|
245
|
-
## [1.1.0](https://github.com/cowprotocol/cowswap/compare/hook-dapp-lib-v1.0.0...hook-dapp-lib-v1.1.0) (2024-10-10)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
### Features
|
|
249
|
-
|
|
250
|
-
* **explorer:** display order hooks details ([#4921](https://github.com/cowprotocol/cowswap/issues/4921)) ([9c364bd](https://github.com/cowprotocol/cowswap/commit/9c364bd81f2e392a8cece06f6470734ee3d7623c))
|
|
251
|
-
* **hooks-store:** add dapp id to hook callData ([#4920](https://github.com/cowprotocol/cowswap/issues/4920)) ([7111756](https://github.com/cowprotocol/cowswap/commit/7111756e359a8e52daa674068f99217efe27ee5b))
|
|
252
|
-
* **hooks-store:** style hook details ([#4932](https://github.com/cowprotocol/cowswap/issues/4932)) ([83184d2](https://github.com/cowprotocol/cowswap/commit/83184d23da3c812eff87bfc0ec5a2832af0ff235))
|
|
253
|
-
* **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))
|
|
254
|
-
* **swap:** display order hooks details ([#4925](https://github.com/cowprotocol/cowswap/issues/4925)) ([1e776fc](https://github.com/cowprotocol/cowswap/commit/1e776fc4f6dfb28eebf881e79bb45dbfd693e472))
|
|
255
|
-
|
|
256
|
-
## 1.0.0 (2024-09-30)
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
### Features
|
|
260
|
-
|
|
261
|
-
* **hooks-store:** import custom hook-dapps ([#4910](https://github.com/cowprotocol/cowswap/issues/4910)) ([5847017](https://github.com/cowprotocol/cowswap/commit/584701715500525365475660732edb6bbf7ba396))
|
|
262
|
-
* **hooks-store:** support iframe hook-dapps ([#4885](https://github.com/cowprotocol/cowswap/issues/4885)) ([5116f29](https://github.com/cowprotocol/cowswap/commit/5116f296a0e4866d0a51a806b7abe55e809d26e9))
|
package/demo.png
DELETED
|
Binary file
|
package/jest.config.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
displayName: 'hook-dapp-lib',
|
|
3
|
-
preset: '../../jest.preset.js',
|
|
4
|
-
transform: {
|
|
5
|
-
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
|
|
6
|
-
},
|
|
7
|
-
setupFilesAfterEnv: ['../../jest.setup.ts'],
|
|
8
|
-
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
9
|
-
coverageDirectory: '../../../coverage/libs/hook-dapp-lib',
|
|
10
|
-
}
|
package/project.json
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "hook-dapp-lib",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "libs/hook-dapp-lib/src",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"targets": {
|
|
7
|
-
"build": {
|
|
8
|
-
"executor": "@nx/js:tsc",
|
|
9
|
-
"outputs": ["{options.outputPath}"],
|
|
10
|
-
"options": {
|
|
11
|
-
"outputPath": "dist/libs/hook-dapp-lib",
|
|
12
|
-
"main": "libs/hook-dapp-lib/src/index.ts",
|
|
13
|
-
"tsConfig": "libs/hook-dapp-lib/tsconfig.lib.json",
|
|
14
|
-
"assets": ["libs/hook-dapp-lib/*.md"],
|
|
15
|
-
"updateBuildableProjectDepsInPackageJson": true,
|
|
16
|
-
"buildableProjectDepsInPackageJsonType": "dependencies"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"serve": {
|
|
20
|
-
"executor": "@nx/vite:dev-server",
|
|
21
|
-
"defaultConfiguration": "development",
|
|
22
|
-
"options": {
|
|
23
|
-
"buildTarget": "hook-dapp-lib:build",
|
|
24
|
-
"port": 3012
|
|
25
|
-
},
|
|
26
|
-
"configurations": {}
|
|
27
|
-
},
|
|
28
|
-
"lint": {
|
|
29
|
-
"executor": "@nx/eslint:lint",
|
|
30
|
-
"outputs": ["{options.outputFile}"],
|
|
31
|
-
"options": {
|
|
32
|
-
"lintFilePatterns": ["libs/hook-dapp-lib/**/*.ts"]
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"test": {
|
|
36
|
-
"executor": "@nx/jest:jest",
|
|
37
|
-
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
|
38
|
-
"options": {
|
|
39
|
-
"jestConfig": "libs/hook-dapp-lib/jest.config.ts",
|
|
40
|
-
"passWithNoTests": true
|
|
41
|
-
},
|
|
42
|
-
"configurations": {
|
|
43
|
-
"ci": {
|
|
44
|
-
"ci": true,
|
|
45
|
-
"codeCoverage": true
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"tags": []
|
|
51
|
-
}
|
package/src/consts.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export enum HookDappType {
|
|
2
|
-
INTERNAL = 'INTERNAL',
|
|
3
|
-
IFRAME = 'IFRAME',
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export enum HookDappWalletCompatibility {
|
|
7
|
-
EOA = 'EOA',
|
|
8
|
-
SMART_CONTRACT = 'SMART_CONTRACT',
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const HOOK_DAPP_ID_LENGTH = 64
|
|
12
|
-
|
|
13
|
-
export const PERMIT_HOOK_DAPP_ID = 'cow-swap://libs/hook-dapp-lib/permit'
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { IframeTransport } from '@cowprotocol/iframe-transport'
|
|
2
|
-
|
|
3
|
-
import { CowHookCreation, CowHookDetails, HookDappContext, TokenData } from './types'
|
|
4
|
-
|
|
5
|
-
export enum CoWHookDappEvents {
|
|
6
|
-
ACTIVATE = 'ACTIVATE',
|
|
7
|
-
CONTEXT_UPDATE = 'CONTEXT_UPDATE',
|
|
8
|
-
ADD_HOOK = 'ADD_HOOK',
|
|
9
|
-
EDIT_HOOK = 'EDIT_HOOK',
|
|
10
|
-
SET_SELL_TOKEN = 'SET_SELL_TOKEN',
|
|
11
|
-
SET_BUY_TOKEN = 'SET_BUY_TOKEN',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface HookDappEventsPayloadMap {
|
|
15
|
-
[CoWHookDappEvents.ACTIVATE]: void
|
|
16
|
-
[CoWHookDappEvents.CONTEXT_UPDATE]: HookDappContext
|
|
17
|
-
[CoWHookDappEvents.ADD_HOOK]: CowHookCreation
|
|
18
|
-
[CoWHookDappEvents.EDIT_HOOK]: CowHookDetails
|
|
19
|
-
[CoWHookDappEvents.SET_SELL_TOKEN]: TokenData
|
|
20
|
-
[CoWHookDappEvents.SET_BUY_TOKEN]: TokenData
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const hookDappIframeTransport = new IframeTransport<HookDappEventsPayloadMap>('cowSwapHookDapp')
|