@epoch-protocol/epoch-commons-sdk 0.1.0

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 (43) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/compact.d.ts +1 -0
  3. package/dist/constants/compact.js +5 -0
  4. package/dist/constants/contractAddresses.d.ts +57 -0
  5. package/dist/constants/contractAddresses.js +181 -0
  6. package/dist/constants/index.d.ts +2 -0
  7. package/dist/constants/index.js +18 -0
  8. package/dist/data/epochgraphmainnet.json +410 -0
  9. package/dist/data/epochgraphtestnet.json +532 -0
  10. package/dist/data/index.d.ts +3 -0
  11. package/dist/data/index.js +10 -0
  12. package/dist/index.d.ts +5 -0
  13. package/dist/index.js +22 -0
  14. package/dist/types/index.d.ts +322 -0
  15. package/dist/types/index.js +37 -0
  16. package/dist/utils/compact.d.ts +4 -0
  17. package/dist/utils/compact.js +58 -0
  18. package/dist/utils/index.d.ts +1 -0
  19. package/dist/utils/index.js +17 -0
  20. package/dist/utils/web3.d.ts +9 -0
  21. package/dist/utils/web3.js +115 -0
  22. package/dist/web3/abis/COMPACT_ABI.json +1529 -0
  23. package/dist/web3/abis/epochModuleAbi.d.ts +2 -0
  24. package/dist/web3/abis/epochModuleAbi.js +233 -0
  25. package/dist/web3/abis/erc20Abi.d.ts +2 -0
  26. package/dist/web3/abis/erc20Abi.js +224 -0
  27. package/dist/web3/abis/intentRegistryAbi.d.ts +2 -0
  28. package/dist/web3/abis/intentRegistryAbi.js +925 -0
  29. package/dist/web3/abis/safe7702ProxyFactoryAbi.d.ts +2 -0
  30. package/dist/web3/abis/safe7702ProxyFactoryAbi.js +107 -0
  31. package/dist/web3/abis/safeProxyFactoryAbi.d.ts +2 -0
  32. package/dist/web3/abis/safeProxyFactoryAbi.js +3 -0
  33. package/dist/web3/abis/solverRegistryAbi.d.ts +2 -0
  34. package/dist/web3/abis/solverRegistryAbi.js +236 -0
  35. package/dist/web3/index.d.ts +3 -0
  36. package/dist/web3/index.js +23 -0
  37. package/dist/web3/intents.d.ts +5 -0
  38. package/dist/web3/intents.js +32 -0
  39. package/dist/web3/registry.d.ts +5 -0
  40. package/dist/web3/registry.js +29 -0
  41. package/dist/web3/wallet.d.ts +26 -0
  42. package/dist/web3/wallet.js +390 -0
  43. package/package.json +41 -0
@@ -0,0 +1,2 @@
1
+ declare const _default: "[\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"internalType\": \"contract SafeEIP7702Proxy\",\n \"name\": \"proxy\",\n \"type\": \"address\"\n },\n {\n \"indexed\": false,\n \"internalType\": \"address\",\n \"name\": \"singleton\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"ProxyCreation\",\n \"type\": \"event\"\n },\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"_singleton\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"bytes\",\n \"name\": \"initializer\",\n \"type\": \"bytes\"\n },\n {\n \"internalType\": \"uint256\",\n \"name\": \"saltNonce\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"createChainSpecificProxyWithNonce\",\n \"outputs\": [\n {\n \"internalType\": \"contract SafeEIP7702Proxy\",\n \"name\": \"proxy\",\n \"type\": \"address\"\n }\n ],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"_singleton\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"bytes\",\n \"name\": \"initializer\",\n \"type\": \"bytes\"\n },\n {\n \"internalType\": \"uint256\",\n \"name\": \"saltNonce\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"createProxyWithNonce\",\n \"outputs\": [\n {\n \"internalType\": \"contract SafeEIP7702Proxy\",\n \"name\": \"proxy\",\n \"type\": \"address\"\n }\n ],\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [],\n \"name\": \"getChainId\",\n \"outputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n },\n {\n \"inputs\": [],\n \"name\": \"proxyCreationCode\",\n \"outputs\": [\n {\n \"internalType\": \"bytes\",\n \"name\": \"\",\n \"type\": \"bytes\"\n }\n ],\n \"stateMutability\": \"pure\",\n \"type\": \"function\"\n }\n]";
2
+ export default _default;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = `[
4
+ {
5
+ "anonymous": false,
6
+ "inputs": [
7
+ {
8
+ "indexed": true,
9
+ "internalType": "contract SafeEIP7702Proxy",
10
+ "name": "proxy",
11
+ "type": "address"
12
+ },
13
+ {
14
+ "indexed": false,
15
+ "internalType": "address",
16
+ "name": "singleton",
17
+ "type": "address"
18
+ }
19
+ ],
20
+ "name": "ProxyCreation",
21
+ "type": "event"
22
+ },
23
+ {
24
+ "inputs": [
25
+ {
26
+ "internalType": "address",
27
+ "name": "_singleton",
28
+ "type": "address"
29
+ },
30
+ {
31
+ "internalType": "bytes",
32
+ "name": "initializer",
33
+ "type": "bytes"
34
+ },
35
+ {
36
+ "internalType": "uint256",
37
+ "name": "saltNonce",
38
+ "type": "uint256"
39
+ }
40
+ ],
41
+ "name": "createChainSpecificProxyWithNonce",
42
+ "outputs": [
43
+ {
44
+ "internalType": "contract SafeEIP7702Proxy",
45
+ "name": "proxy",
46
+ "type": "address"
47
+ }
48
+ ],
49
+ "stateMutability": "nonpayable",
50
+ "type": "function"
51
+ },
52
+ {
53
+ "inputs": [
54
+ {
55
+ "internalType": "address",
56
+ "name": "_singleton",
57
+ "type": "address"
58
+ },
59
+ {
60
+ "internalType": "bytes",
61
+ "name": "initializer",
62
+ "type": "bytes"
63
+ },
64
+ {
65
+ "internalType": "uint256",
66
+ "name": "saltNonce",
67
+ "type": "uint256"
68
+ }
69
+ ],
70
+ "name": "createProxyWithNonce",
71
+ "outputs": [
72
+ {
73
+ "internalType": "contract SafeEIP7702Proxy",
74
+ "name": "proxy",
75
+ "type": "address"
76
+ }
77
+ ],
78
+ "stateMutability": "nonpayable",
79
+ "type": "function"
80
+ },
81
+ {
82
+ "inputs": [],
83
+ "name": "getChainId",
84
+ "outputs": [
85
+ {
86
+ "internalType": "uint256",
87
+ "name": "",
88
+ "type": "uint256"
89
+ }
90
+ ],
91
+ "stateMutability": "view",
92
+ "type": "function"
93
+ },
94
+ {
95
+ "inputs": [],
96
+ "name": "proxyCreationCode",
97
+ "outputs": [
98
+ {
99
+ "internalType": "bytes",
100
+ "name": "",
101
+ "type": "bytes"
102
+ }
103
+ ],
104
+ "stateMutability": "pure",
105
+ "type": "function"
106
+ }
107
+ ]`;
@@ -0,0 +1,2 @@
1
+ declare const _default: "[{\"type\":\"function\",\"name\":\"createChainSpecificProxyWithNonce\",\"inputs\":[{\"name\":\"_singleton\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"initializer\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"saltNonce\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"proxy\",\"type\":\"address\",\"internalType\":\"contract SafeProxy\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"createProxyWithCallback\",\"inputs\":[{\"name\":\"_singleton\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"initializer\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"saltNonce\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"callback\",\"type\":\"address\",\"internalType\":\"contract IProxyCreationCallback\"}],\"outputs\":[{\"name\":\"proxy\",\"type\":\"address\",\"internalType\":\"contract SafeProxy\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"createProxyWithNonce\",\"inputs\":[{\"name\":\"_singleton\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"initializer\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"saltNonce\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"proxy\",\"type\":\"address\",\"internalType\":\"contract SafeProxy\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getChainId\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proxyCreationCode\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"pure\"},{\"type\":\"event\",\"name\":\"ProxyCreation\",\"inputs\":[{\"name\":\"proxy\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"contract SafeProxy\"},{\"name\":\"singleton\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false}]";
2
+ export default _default;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = `[{"type":"function","name":"createChainSpecificProxyWithNonce","inputs":[{"name":"_singleton","type":"address","internalType":"address"},{"name":"initializer","type":"bytes","internalType":"bytes"},{"name":"saltNonce","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"proxy","type":"address","internalType":"contract SafeProxy"}],"stateMutability":"nonpayable"},{"type":"function","name":"createProxyWithCallback","inputs":[{"name":"_singleton","type":"address","internalType":"address"},{"name":"initializer","type":"bytes","internalType":"bytes"},{"name":"saltNonce","type":"uint256","internalType":"uint256"},{"name":"callback","type":"address","internalType":"contract IProxyCreationCallback"}],"outputs":[{"name":"proxy","type":"address","internalType":"contract SafeProxy"}],"stateMutability":"nonpayable"},{"type":"function","name":"createProxyWithNonce","inputs":[{"name":"_singleton","type":"address","internalType":"address"},{"name":"initializer","type":"bytes","internalType":"bytes"},{"name":"saltNonce","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"proxy","type":"address","internalType":"contract SafeProxy"}],"stateMutability":"nonpayable"},{"type":"function","name":"getChainId","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"proxyCreationCode","inputs":[],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"pure"},{"type":"event","name":"ProxyCreation","inputs":[{"name":"proxy","type":"address","indexed":true,"internalType":"contract SafeProxy"},{"name":"singleton","type":"address","indexed":false,"internalType":"address"}],"anonymous":false}]`;
@@ -0,0 +1,2 @@
1
+ declare const _default: "[\n {\n \"type\": \"function\",\n \"name\": \"addModule\",\n \"inputs\": [\n {\n \"name\": \"_solverAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_module\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"addSolver\",\n \"inputs\": [\n {\n \"name\": \"_solverAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_url\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n },\n {\n \"name\": \"_modules\",\n \"type\": \"string[]\",\n \"internalType\": \"string[]\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"allSolvers\",\n \"inputs\": [\n {\n \"name\": \"\",\n \"type\": \"uint256\",\n \"internalType\": \"uint256\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"changeUrl\",\n \"inputs\": [\n {\n \"name\": \"_solverAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_url\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"deregisterSolver\",\n \"inputs\": [\n {\n \"name\": \"_solverAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"getAllSolvers\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"tuple[]\",\n \"internalType\": \"struct SolverRegistry.Solver[]\",\n \"components\": [\n {\n \"name\": \"solverAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"url\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n },\n {\n \"name\": \"modules\",\n \"type\": \"string[]\",\n \"internalType\": \"string[]\"\n },\n {\n \"name\": \"status\",\n \"type\": \"uint8\",\n \"internalType\": \"enum SolverRegistry.Status\"\n }\n ]\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"getSolver\",\n \"inputs\": [\n {\n \"name\": \"_solverAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"tuple\",\n \"internalType\": \"struct SolverRegistry.Solver\",\n \"components\": [\n {\n \"name\": \"solverAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"url\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n },\n {\n \"name\": \"modules\",\n \"type\": \"string[]\",\n \"internalType\": \"string[]\"\n },\n {\n \"name\": \"status\",\n \"type\": \"uint8\",\n \"internalType\": \"enum SolverRegistry.Status\"\n }\n ]\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"removeModule\",\n \"inputs\": [\n {\n \"name\": \"_solverAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_module\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"setStatus\",\n \"inputs\": [\n {\n \"name\": \"_solverAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_status\",\n \"type\": \"uint8\",\n \"internalType\": \"enum SolverRegistry.Status\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"solvers\",\n \"inputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"solverAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"url\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n },\n {\n \"name\": \"status\",\n \"type\": \"uint8\",\n \"internalType\": \"enum SolverRegistry.Status\"\n }\n ],\n \"stateMutability\": \"view\"\n }\n]";
2
+ export default _default;
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = `[
4
+ {
5
+ "type": "function",
6
+ "name": "addModule",
7
+ "inputs": [
8
+ {
9
+ "name": "_solverAddress",
10
+ "type": "address",
11
+ "internalType": "address"
12
+ },
13
+ {
14
+ "name": "_module",
15
+ "type": "string",
16
+ "internalType": "string"
17
+ }
18
+ ],
19
+ "outputs": [],
20
+ "stateMutability": "nonpayable"
21
+ },
22
+ {
23
+ "type": "function",
24
+ "name": "addSolver",
25
+ "inputs": [
26
+ {
27
+ "name": "_solverAddress",
28
+ "type": "address",
29
+ "internalType": "address"
30
+ },
31
+ {
32
+ "name": "_url",
33
+ "type": "string",
34
+ "internalType": "string"
35
+ },
36
+ {
37
+ "name": "_modules",
38
+ "type": "string[]",
39
+ "internalType": "string[]"
40
+ }
41
+ ],
42
+ "outputs": [],
43
+ "stateMutability": "nonpayable"
44
+ },
45
+ {
46
+ "type": "function",
47
+ "name": "allSolvers",
48
+ "inputs": [
49
+ {
50
+ "name": "",
51
+ "type": "uint256",
52
+ "internalType": "uint256"
53
+ }
54
+ ],
55
+ "outputs": [
56
+ {
57
+ "name": "",
58
+ "type": "address",
59
+ "internalType": "address"
60
+ }
61
+ ],
62
+ "stateMutability": "view"
63
+ },
64
+ {
65
+ "type": "function",
66
+ "name": "changeUrl",
67
+ "inputs": [
68
+ {
69
+ "name": "_solverAddress",
70
+ "type": "address",
71
+ "internalType": "address"
72
+ },
73
+ {
74
+ "name": "_url",
75
+ "type": "string",
76
+ "internalType": "string"
77
+ }
78
+ ],
79
+ "outputs": [],
80
+ "stateMutability": "nonpayable"
81
+ },
82
+ {
83
+ "type": "function",
84
+ "name": "deregisterSolver",
85
+ "inputs": [
86
+ {
87
+ "name": "_solverAddress",
88
+ "type": "address",
89
+ "internalType": "address"
90
+ }
91
+ ],
92
+ "outputs": [],
93
+ "stateMutability": "nonpayable"
94
+ },
95
+ {
96
+ "type": "function",
97
+ "name": "getAllSolvers",
98
+ "inputs": [],
99
+ "outputs": [
100
+ {
101
+ "name": "",
102
+ "type": "tuple[]",
103
+ "internalType": "struct SolverRegistry.Solver[]",
104
+ "components": [
105
+ {
106
+ "name": "solverAddress",
107
+ "type": "address",
108
+ "internalType": "address"
109
+ },
110
+ {
111
+ "name": "url",
112
+ "type": "string",
113
+ "internalType": "string"
114
+ },
115
+ {
116
+ "name": "modules",
117
+ "type": "string[]",
118
+ "internalType": "string[]"
119
+ },
120
+ {
121
+ "name": "status",
122
+ "type": "uint8",
123
+ "internalType": "enum SolverRegistry.Status"
124
+ }
125
+ ]
126
+ }
127
+ ],
128
+ "stateMutability": "view"
129
+ },
130
+ {
131
+ "type": "function",
132
+ "name": "getSolver",
133
+ "inputs": [
134
+ {
135
+ "name": "_solverAddress",
136
+ "type": "address",
137
+ "internalType": "address"
138
+ }
139
+ ],
140
+ "outputs": [
141
+ {
142
+ "name": "",
143
+ "type": "tuple",
144
+ "internalType": "struct SolverRegistry.Solver",
145
+ "components": [
146
+ {
147
+ "name": "solverAddress",
148
+ "type": "address",
149
+ "internalType": "address"
150
+ },
151
+ {
152
+ "name": "url",
153
+ "type": "string",
154
+ "internalType": "string"
155
+ },
156
+ {
157
+ "name": "modules",
158
+ "type": "string[]",
159
+ "internalType": "string[]"
160
+ },
161
+ {
162
+ "name": "status",
163
+ "type": "uint8",
164
+ "internalType": "enum SolverRegistry.Status"
165
+ }
166
+ ]
167
+ }
168
+ ],
169
+ "stateMutability": "view"
170
+ },
171
+ {
172
+ "type": "function",
173
+ "name": "removeModule",
174
+ "inputs": [
175
+ {
176
+ "name": "_solverAddress",
177
+ "type": "address",
178
+ "internalType": "address"
179
+ },
180
+ {
181
+ "name": "_module",
182
+ "type": "string",
183
+ "internalType": "string"
184
+ }
185
+ ],
186
+ "outputs": [],
187
+ "stateMutability": "nonpayable"
188
+ },
189
+ {
190
+ "type": "function",
191
+ "name": "setStatus",
192
+ "inputs": [
193
+ {
194
+ "name": "_solverAddress",
195
+ "type": "address",
196
+ "internalType": "address"
197
+ },
198
+ {
199
+ "name": "_status",
200
+ "type": "uint8",
201
+ "internalType": "enum SolverRegistry.Status"
202
+ }
203
+ ],
204
+ "outputs": [],
205
+ "stateMutability": "nonpayable"
206
+ },
207
+ {
208
+ "type": "function",
209
+ "name": "solvers",
210
+ "inputs": [
211
+ {
212
+ "name": "",
213
+ "type": "address",
214
+ "internalType": "address"
215
+ }
216
+ ],
217
+ "outputs": [
218
+ {
219
+ "name": "solverAddress",
220
+ "type": "address",
221
+ "internalType": "address"
222
+ },
223
+ {
224
+ "name": "url",
225
+ "type": "string",
226
+ "internalType": "string"
227
+ },
228
+ {
229
+ "name": "status",
230
+ "type": "uint8",
231
+ "internalType": "enum SolverRegistry.Status"
232
+ }
233
+ ],
234
+ "stateMutability": "view"
235
+ }
236
+ ]`;
@@ -0,0 +1,3 @@
1
+ import COMPACT_ABI from "./abis/COMPACT_ABI.json";
2
+ export * from "./intents";
3
+ export { COMPACT_ABI };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.COMPACT_ABI = void 0;
21
+ const COMPACT_ABI_json_1 = __importDefault(require("./abis/COMPACT_ABI.json"));
22
+ exports.COMPACT_ABI = COMPACT_ABI_json_1.default;
23
+ __exportStar(require("./intents"), exports);
@@ -0,0 +1,5 @@
1
+ import { Intent } from "../types";
2
+ declare const getEncodedIntent: (intent: Intent) => Uint8Array<ArrayBufferLike>;
3
+ declare const getIntentHash: (intent: Intent) => string;
4
+ declare const getEIP191IntentHash: (intent: Intent) => string;
5
+ export { getEncodedIntent, getIntentHash, getEIP191IntentHash };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEIP191IntentHash = exports.getIntentHash = exports.getEncodedIntent = void 0;
4
+ const ethers_1 = require("ethers");
5
+ const getEncodedIntent = (intent) => {
6
+ const abiCoder = new ethers_1.ethers.AbiCoder();
7
+ const intentParamsType = `tuple(
8
+ address sender,
9
+ tuple(address tokenAddress, address spenderAddress, uint256 amount, uint256 chainId)[] approvals,
10
+ string task,
11
+ uint256 nonce,
12
+ tuple(bytes constraintData, bytes constraintResponse, string constraints, uint256 optimizationFactor, address[] preferredSolvers, uint256 deadline, string triggers) constraint,
13
+ uint256 proposedFeeRewards,
14
+ bool recurring,
15
+ uint32[] chainIds,
16
+ tuple(address target, uint256 value, bytes data)[] calldatas
17
+ )`;
18
+ const encodedIntent = abiCoder.encode([intentParamsType], [intent]);
19
+ return ethers_1.ethers.getBytes(encodedIntent);
20
+ };
21
+ exports.getEncodedIntent = getEncodedIntent;
22
+ const getIntentHash = (intent) => {
23
+ const encodedIntent = getEncodedIntent(intent);
24
+ const messageHash = ethers_1.ethers.keccak256(encodedIntent);
25
+ return messageHash;
26
+ };
27
+ exports.getIntentHash = getIntentHash;
28
+ const getEIP191IntentHash = (intent) => {
29
+ const encodedIntent = getEncodedIntent(intent);
30
+ return ethers_1.ethers.hashMessage(encodedIntent);
31
+ };
32
+ exports.getEIP191IntentHash = getEIP191IntentHash;
@@ -0,0 +1,5 @@
1
+ import { ethers } from "ethers";
2
+ import { Intent } from "../types";
3
+ export declare const getIntentRegistryInstance: (chainId: number) => ethers.Contract;
4
+ export declare const getEIP191IntentHashFromRegistry: (intent: Intent) => Promise<any>;
5
+ export declare const validateSignatureFromRegistry: (intent: Intent, signature: string) => Promise<any>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.validateSignatureFromRegistry = exports.getEIP191IntentHashFromRegistry = exports.getIntentRegistryInstance = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const constants_1 = require("../constants");
9
+ const intents_1 = require("./intents");
10
+ const intentRegistryAbi_1 = __importDefault(require("./abis/intentRegistryAbi"));
11
+ const getIntentRegistryInstance = (chainId) => {
12
+ const provider = new ethers_1.ethers.JsonRpcProvider(constants_1.RPC_ENDPOINTS[chainId]);
13
+ return new ethers_1.ethers.Contract(constants_1.INTENT_REGISTRY_ADDRESS[chainId], intentRegistryAbi_1.default, provider);
14
+ };
15
+ exports.getIntentRegistryInstance = getIntentRegistryInstance;
16
+ const getEIP191IntentHashFromRegistry = async (intent) => {
17
+ const registry = (0, exports.getIntentRegistryInstance)(constants_1.DEFAULT_CHAIN_ID);
18
+ const hash = await registry.getIntentEIP191Hash(intent);
19
+ return hash;
20
+ };
21
+ exports.getEIP191IntentHashFromRegistry = getEIP191IntentHashFromRegistry;
22
+ const validateSignatureFromRegistry = async (intent, signature) => {
23
+ const registry = (0, exports.getIntentRegistryInstance)(constants_1.DEFAULT_CHAIN_ID);
24
+ const epochModule = constants_1.EPOCH_MODULE_SAFE_ADDRESS[constants_1.DEFAULT_CHAIN_ID];
25
+ const encodedIntent = (0, intents_1.getEncodedIntent)(intent);
26
+ const isValid = await registry.validateSignature(epochModule, encodedIntent, signature);
27
+ return isValid;
28
+ };
29
+ exports.validateSignatureFromRegistry = validateSignatureFromRegistry;
@@ -0,0 +1,26 @@
1
+ import { BytesLike, ethers } from "ethers";
2
+ import { WalletClient } from "viem";
3
+ import { SignAuthorizationReturnType } from "viem/_types/accounts/utils/signAuthorization";
4
+ import { AuthorizationListEntryAny, CreateWalletData, CreateWalletOptions, WalletType } from "../types";
5
+ import { Implementation } from "@metamask/delegation-toolkit";
6
+ export declare const getSafeProxyFactoryInstance: (chainId: number, is7702?: boolean) => ethers.Contract;
7
+ export declare const calculateProxyAddress: (walletType: WalletType, options?: {
8
+ safeOptions?: {
9
+ factory: ethers.Contract;
10
+ singleton: string;
11
+ inititalizer: string;
12
+ nonce: number | string;
13
+ };
14
+ metamaskOptions?: {
15
+ userAddress: string;
16
+ userSigner: WalletClient;
17
+ };
18
+ }) => Promise<string>;
19
+ export declare const getMetamaskDelegatorInstance: (userAddress: string, userSigner: WalletClient, is7702?: boolean, isPasskey?: boolean, passkey?: any) => Promise<import("@metamask/delegation-toolkit").ToMetaMaskSmartAccountReturnType<Implementation.Stateless7702> | import("@metamask/delegation-toolkit").ToMetaMaskSmartAccountReturnType<Implementation.Hybrid>>;
20
+ export declare const getCreateWalletData: (userAddress: string, chainId: number, walletType: WalletType, options?: CreateWalletOptions) => Promise<CreateWalletData>;
21
+ export declare const set7702Delegator: (chainId: number, userAddress: string, userSafeAddress: string, initializerData: string, userWalletClient: WalletClient, relayer: ethers.SigningKey) => Promise<void>;
22
+ export declare const set7702DelegatorFromAuthorizationList: (chainId: number, userAddress: string, authorizationList: SignAuthorizationReturnType | AuthorizationListEntryAny[], initializerData: string, relayer: ethers.SigningKey) => Promise<void>;
23
+ export declare const set7702DelegatorManually: (chainId: number, userAddress: string, userSafeAddress: string, userSigner: ethers.Wallet | ethers.VoidSigner, relayer: ethers.SigningKey, initializerData: string) => Promise<boolean>;
24
+ export declare const set7702DelegatorFromAuthorizationListManually: (chainId: number, userAddress: string, userSafeAddress: string, authorizationList: SignAuthorizationReturnType | AuthorizationListEntryAny[], initializerData: string, relayer: ethers.SigningKey) => Promise<void>;
25
+ export declare const getProxyAddressFromReceipt: (txnReceipt: ethers.TransactionReceipt) => any;
26
+ export declare const validationEpochModuleSafeSignature: (sender: string, data: BytesLike, signature: string) => Promise<any>;