@rhinestone/sdk 1.0.0-alpha.1 → 1.0.0-alpha.11

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 (102) hide show
  1. package/dist/src/accounts/error.d.ts.map +1 -1
  2. package/dist/src/accounts/error.js +2 -0
  3. package/dist/src/accounts/index.d.ts +15 -8
  4. package/dist/src/accounts/index.d.ts.map +1 -1
  5. package/dist/src/accounts/index.js +204 -164
  6. package/dist/src/accounts/index.test.js +2 -2
  7. package/dist/src/accounts/kernel.d.ts +7 -9
  8. package/dist/src/accounts/kernel.d.ts.map +1 -1
  9. package/dist/src/accounts/kernel.js +0 -9
  10. package/dist/src/accounts/kernel.test.js +6 -6
  11. package/dist/src/accounts/nexus.d.ts +14 -13
  12. package/dist/src/accounts/nexus.d.ts.map +1 -1
  13. package/dist/src/accounts/nexus.js +91 -88
  14. package/dist/src/accounts/nexus.test.js +10 -10
  15. package/dist/src/accounts/safe.d.ts +4 -6
  16. package/dist/src/accounts/safe.d.ts.map +1 -1
  17. package/dist/src/accounts/safe.js +20 -30
  18. package/dist/src/accounts/safe.test.js +6 -6
  19. package/dist/src/accounts/startale.d.ts +20 -0
  20. package/dist/src/accounts/startale.d.ts.map +1 -0
  21. package/dist/src/accounts/startale.js +100 -0
  22. package/dist/src/accounts/startale.test.d.ts +2 -0
  23. package/dist/src/accounts/startale.test.d.ts.map +1 -0
  24. package/dist/src/accounts/startale.test.js +97 -0
  25. package/dist/src/accounts/utils.d.ts +4 -3
  26. package/dist/src/accounts/utils.d.ts.map +1 -1
  27. package/dist/src/accounts/utils.js +44 -0
  28. package/dist/src/actions/index.d.ts +17 -7
  29. package/dist/src/actions/index.d.ts.map +1 -1
  30. package/dist/src/actions/index.js +108 -15
  31. package/dist/src/actions/index.test.js +35 -17
  32. package/dist/src/actions/smart-session.d.ts +2 -2
  33. package/dist/src/actions/smart-session.d.ts.map +1 -1
  34. package/dist/src/execution/compact.d.ts +6 -3
  35. package/dist/src/execution/compact.d.ts.map +1 -1
  36. package/dist/src/execution/compact.js +44 -1
  37. package/dist/src/execution/error.d.ts +2 -9
  38. package/dist/src/execution/error.d.ts.map +1 -1
  39. package/dist/src/execution/error.js +4 -13
  40. package/dist/src/execution/index.d.ts +2 -3
  41. package/dist/src/execution/index.d.ts.map +1 -1
  42. package/dist/src/execution/index.js +34 -49
  43. package/dist/src/execution/smart-session.d.ts +1 -1
  44. package/dist/src/execution/smart-session.d.ts.map +1 -1
  45. package/dist/src/execution/smart-session.js +12 -17
  46. package/dist/src/execution/utils.d.ts +13 -11
  47. package/dist/src/execution/utils.d.ts.map +1 -1
  48. package/dist/src/execution/utils.js +150 -84
  49. package/dist/src/index.d.ts +14 -14
  50. package/dist/src/index.d.ts.map +1 -1
  51. package/dist/src/index.js +24 -20
  52. package/dist/src/modules/index.d.ts +3 -7
  53. package/dist/src/modules/index.d.ts.map +1 -1
  54. package/dist/src/modules/index.js +1 -10
  55. package/dist/src/modules/index.test.js +2 -2
  56. package/dist/src/modules/omni-account.d.ts +1 -4
  57. package/dist/src/modules/omni-account.d.ts.map +1 -1
  58. package/dist/src/modules/omni-account.js +2 -8
  59. package/dist/src/modules/read.d.ts +5 -6
  60. package/dist/src/modules/read.d.ts.map +1 -1
  61. package/dist/src/modules/read.js +6 -37
  62. package/dist/src/modules/validators/core.d.ts +6 -7
  63. package/dist/src/modules/validators/core.d.ts.map +1 -1
  64. package/dist/src/modules/validators/core.js +83 -8
  65. package/dist/src/modules/validators/core.test.js +4 -4
  66. package/dist/src/modules/validators/smart-sessions.d.ts +3 -3
  67. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
  68. package/dist/src/modules/validators/smart-sessions.js +7 -6
  69. package/dist/src/modules/validators/smart-sessions.test.js +4 -4
  70. package/dist/src/orchestrator/client.d.ts +1 -0
  71. package/dist/src/orchestrator/client.d.ts.map +1 -1
  72. package/dist/src/orchestrator/client.js +136 -94
  73. package/dist/src/orchestrator/consts.d.ts +3 -3
  74. package/dist/src/orchestrator/consts.d.ts.map +1 -1
  75. package/dist/src/orchestrator/consts.js +4 -4
  76. package/dist/src/orchestrator/index.d.ts +2 -2
  77. package/dist/src/orchestrator/index.d.ts.map +1 -1
  78. package/dist/src/orchestrator/index.js +1 -7
  79. package/dist/src/orchestrator/registry.d.ts +31 -12
  80. package/dist/src/orchestrator/registry.d.ts.map +1 -1
  81. package/dist/src/orchestrator/registry.js +57 -380
  82. package/dist/src/orchestrator/registry.json +365 -0
  83. package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
  84. package/dist/src/orchestrator/registry.test.js +137 -0
  85. package/dist/src/orchestrator/types.d.ts +81 -14
  86. package/dist/src/orchestrator/types.d.ts.map +1 -1
  87. package/dist/src/orchestrator/utils.d.ts.map +1 -1
  88. package/dist/src/orchestrator/utils.js +2 -2
  89. package/dist/src/types.d.ts +42 -21
  90. package/dist/src/types.d.ts.map +1 -1
  91. package/dist/test/consts.d.ts +2 -2
  92. package/dist/test/consts.d.ts.map +1 -1
  93. package/package.json +1 -1
  94. package/dist/src/actions/registry.d.ts +0 -7
  95. package/dist/src/actions/registry.d.ts.map +0 -1
  96. package/dist/src/actions/registry.js +0 -7
  97. package/dist/src/actions/registry.test.d.ts.map +0 -1
  98. package/dist/src/actions/registry.test.js +0 -25
  99. package/dist/src/modules/registry.d.ts +0 -13
  100. package/dist/src/modules/registry.d.ts.map +0 -1
  101. package/dist/src/modules/registry.js +0 -67
  102. /package/dist/src/{actions → orchestrator}/registry.test.d.ts +0 -0
@@ -0,0 +1,365 @@
1
+ {
2
+ "1": {
3
+ "name": "Ethereum",
4
+ "contracts": {
5
+ "spokepool": "0x5c7BCd6E7De5423a257D81B442095A1a6ced35C5",
6
+ "hook": "0x0000000000f6Ed8Be424d673c63eeFF8b9267420",
7
+ "originModule": "0x0000000000AFc904aE9860D9c4B96D7c529c58b8",
8
+ "targetModule": "0x0000000000E5a37279A001301A837a91b5de1D5E",
9
+ "sameChainModule": "0x000000000043ff16d5776c7F0f65Ec485C17Ca04"
10
+ },
11
+ "tokens": [
12
+ {
13
+ "symbol": "ETH",
14
+ "address": "0x0000000000000000000000000000000000000000",
15
+ "decimals": 18,
16
+ "balanceSlot": null
17
+ },
18
+ {
19
+ "symbol": "USDC",
20
+ "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
21
+ "decimals": 6,
22
+ "balanceSlot": 9
23
+ },
24
+ {
25
+ "symbol": "USDT",
26
+ "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
27
+ "decimals": 6,
28
+ "balanceSlot": 2
29
+ },
30
+ {
31
+ "symbol": "WETH",
32
+ "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
33
+ "decimals": 18,
34
+ "balanceSlot": 3
35
+ }
36
+ ]
37
+ },
38
+ "10": {
39
+ "name": "Optimism",
40
+ "contracts": {
41
+ "spokepool": "0x20038b572633E45F3aB5b1a46CB85D0D241b80D8",
42
+ "hook": "0x0000000000f6Ed8Be424d673c63eeFF8b9267420",
43
+ "originModule": "0x0000000000AFc904aE9860D9c4B96D7c529c58b8",
44
+ "targetModule": "0x0000000000E5a37279A001301A837a91b5de1D5E",
45
+ "sameChainModule": "0x000000000043ff16d5776c7F0f65Ec485C17Ca04"
46
+ },
47
+ "tokens": [
48
+ {
49
+ "symbol": "ETH",
50
+ "address": "0x0000000000000000000000000000000000000000",
51
+ "decimals": 18,
52
+ "balanceSlot": null
53
+ },
54
+ {
55
+ "symbol": "USDC",
56
+ "address": "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
57
+ "decimals": 6,
58
+ "balanceSlot": 9
59
+ },
60
+ {
61
+ "symbol": "USDT",
62
+ "address": "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58",
63
+ "decimals": 6,
64
+ "balanceSlot": 0
65
+ },
66
+ {
67
+ "symbol": "WETH",
68
+ "address": "0x4200000000000000000000000000000000000006",
69
+ "decimals": 18,
70
+ "balanceSlot": 3
71
+ }
72
+ ]
73
+ },
74
+ "8453": {
75
+ "name": "Base",
76
+ "contracts": {
77
+ "spokepool": "0x20038b572633E45F3aB5b1a46CB85D0D241b80D8",
78
+ "hook": "0x0000000000f6Ed8Be424d673c63eeFF8b9267420",
79
+ "originModule": "0x0000000000AFc904aE9860D9c4B96D7c529c58b8",
80
+ "targetModule": "0x0000000000E5a37279A001301A837a91b5de1D5E",
81
+ "sameChainModule": "0x000000000043ff16d5776c7F0f65Ec485C17Ca04"
82
+ },
83
+ "tokens": [
84
+ {
85
+ "symbol": "ETH",
86
+ "address": "0x0000000000000000000000000000000000000000",
87
+ "decimals": 18,
88
+ "balanceSlot": null
89
+ },
90
+ {
91
+ "symbol": "USDC",
92
+ "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
93
+ "decimals": 6,
94
+ "balanceSlot": 9
95
+ },
96
+ {
97
+ "symbol": "USDT",
98
+ "address": "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
99
+ "decimals": 6,
100
+ "balanceSlot": 51
101
+ },
102
+ {
103
+ "symbol": "WETH",
104
+ "address": "0x4200000000000000000000000000000000000006",
105
+ "decimals": 18,
106
+ "balanceSlot": 3
107
+ }
108
+ ]
109
+ },
110
+ "42161": {
111
+ "name": "Arbitrum",
112
+ "contracts": {
113
+ "spokepool": "0x35F36B0ebfFe06Dc29e3d11ae8b335d3Af4D014A",
114
+ "hook": "0x0000000000f6Ed8Be424d673c63eeFF8b9267420",
115
+ "originModule": "0x0000000000AFc904aE9860D9c4B96D7c529c58b8",
116
+ "targetModule": "0x0000000000E5a37279A001301A837a91b5de1D5E",
117
+ "sameChainModule": "0x000000000043ff16d5776c7F0f65Ec485C17Ca04"
118
+ },
119
+ "tokens": [
120
+ {
121
+ "symbol": "ETH",
122
+ "address": "0x0000000000000000000000000000000000000000",
123
+ "decimals": 18,
124
+ "balanceSlot": null
125
+ },
126
+ {
127
+ "symbol": "USDC",
128
+ "address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
129
+ "decimals": 6,
130
+ "balanceSlot": 9
131
+ },
132
+ {
133
+ "symbol": "USDT",
134
+ "address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
135
+ "decimals": 6,
136
+ "balanceSlot": 51
137
+ },
138
+ {
139
+ "symbol": "WETH",
140
+ "address": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
141
+ "decimals": 18,
142
+ "balanceSlot": 51
143
+ }
144
+ ]
145
+ },
146
+ "137": {
147
+ "name": "Polygon",
148
+ "contracts": {
149
+ "spokepool": "0x35F36B0ebfFe06Dc29e3d11ae8b335d3Af4D014A",
150
+ "hook": "0x0000000000f6Ed8Be424d673c63eeFF8b9267420",
151
+ "originModule": "0x0000000000AFc904aE9860D9c4B96D7c529c58b8",
152
+ "targetModule": "0x0000000000E5a37279A001301A837a91b5de1D5E",
153
+ "sameChainModule": "0x000000000043ff16d5776c7F0f65Ec485C17Ca04"
154
+ },
155
+ "tokens": [
156
+ {
157
+ "symbol": "USDC",
158
+ "address": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
159
+ "decimals": 6,
160
+ "balanceSlot": 9
161
+ },
162
+ {
163
+ "symbol": "USDT",
164
+ "address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
165
+ "decimals": 6,
166
+ "balanceSlot": 0
167
+ },
168
+ {
169
+ "symbol": "WETH",
170
+ "address": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
171
+ "decimals": 18,
172
+ "balanceSlot": 3
173
+ }
174
+ ]
175
+ },
176
+ "324": {
177
+ "name": "ZkSync Era",
178
+ "contracts": {
179
+ "spokepool": "0x35F36B0ebfFe06Dc29e3d11ae8b335d3Af4D014A",
180
+ "hook": "0x0000000000f6Ed8Be424d673c63eeFF8b9267420",
181
+ "originModule": "0x0000000000AFc904aE9860D9c4B96D7c529c58b8",
182
+ "targetModule": "0x0000000000E5a37279A001301A837a91b5de1D5E",
183
+ "sameChainModule": "0x000000000043ff16d5776c7F0f65Ec485C17Ca04"
184
+ },
185
+ "tokens": [
186
+ {
187
+ "symbol": "ETH",
188
+ "address": "0x0000000000000000000000000000000000000000",
189
+ "decimals": 18,
190
+ "balanceSlot": null
191
+ },
192
+ {
193
+ "symbol": "USDC",
194
+ "address": "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4",
195
+ "decimals": 6,
196
+ "balanceSlot": 9
197
+ },
198
+ {
199
+ "symbol": "USDT",
200
+ "address": "0x493257fD37EDB34451f62EDf8D2a0C418852bA4C",
201
+ "decimals": 6,
202
+ "balanceSlot": 2
203
+ },
204
+ {
205
+ "symbol": "WETH",
206
+ "address": "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",
207
+ "decimals": 18,
208
+ "balanceSlot": 3
209
+ }
210
+ ]
211
+ },
212
+ "1868": {
213
+ "name": "Soneium",
214
+ "contracts": {
215
+ "spokepool": "0x3baD7AD0728f9917d1Bf08af5782dCbD516cDd96",
216
+ "hook": "0x0000000000f6Ed8Be424d673c63eeFF8b9267420",
217
+ "originModule": "0x0000000000AFc904aE9860D9c4B96D7c529c58b8",
218
+ "targetModule": "0x0000000000E5a37279A001301A837a91b5de1D5E",
219
+ "sameChainModule": "0x000000000043ff16d5776c7F0f65Ec485C17Ca04"
220
+ },
221
+ "tokens": [
222
+ {
223
+ "symbol": "ETH",
224
+ "address": "0x0000000000000000000000000000000000000000",
225
+ "decimals": 18,
226
+ "balanceSlot": null,
227
+ "approvalSlot": null
228
+ },
229
+ {
230
+ "symbol": "USDC",
231
+ "address": "0xbA9986D2381edf1DA03B0B9c1f8b00dc4AacC369",
232
+ "decimals": 6,
233
+ "balanceSlot": 9,
234
+ "approvalSlot": 10
235
+ },
236
+ {
237
+ "symbol": "WETH",
238
+ "address": "0x4200000000000000000000000000000000000006",
239
+ "decimals": 18,
240
+ "balanceSlot": 3,
241
+ "approvalSlot": 4
242
+ }
243
+ ]
244
+ },
245
+ "84532": {
246
+ "name": "Base-sepolia",
247
+ "contracts": {
248
+ "spokepool": "0x20038b572633E45F3aB5b1a46CB85D0D241b80D8",
249
+ "hook": "0x0000000000f6Ed8Be424d673c63eeFF8b9267420",
250
+ "originModule": "0x0000000000AFc904aE9860D9c4B96D7c529c58b8",
251
+ "targetModule": "0x0000000000E5a37279A001301A837a91b5de1D5E",
252
+ "sameChainModule": "0x000000000043ff16d5776c7F0f65Ec485C17Ca04"
253
+ },
254
+ "tokens": [
255
+ {
256
+ "symbol": "ETH",
257
+ "address": "0x0000000000000000000000000000000000000000",
258
+ "decimals": 18,
259
+ "balanceSlot": null
260
+ },
261
+ {
262
+ "symbol": "USDC",
263
+ "address": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
264
+ "decimals": 6,
265
+ "balanceSlot": 9
266
+ },
267
+ {
268
+ "symbol": "WETH",
269
+ "address": "0x4200000000000000000000000000000000000006",
270
+ "decimals": 18,
271
+ "balanceSlot": 3
272
+ }
273
+ ]
274
+ },
275
+ "421614": {
276
+ "name": "Arbitrum-sepolia",
277
+ "contracts": {
278
+ "spokepool": "0xAE6B1f4aA87e0F73DADb10B9CA4F8531BfaFAD19",
279
+ "hook": "0x0000000000f6Ed8Be424d673c63eeFF8b9267420",
280
+ "originModule": "0x0000000000AFc904aE9860D9c4B96D7c529c58b8",
281
+ "targetModule": "0x0000000000E5a37279A001301A837a91b5de1D5E",
282
+ "sameChainModule": "0x000000000043ff16d5776c7F0f65Ec485C17Ca04"
283
+ },
284
+ "tokens": [
285
+ {
286
+ "symbol": "ETH",
287
+ "address": "0x0000000000000000000000000000000000000000",
288
+ "decimals": 18,
289
+ "balanceSlot": null
290
+ },
291
+ {
292
+ "symbol": "USDC",
293
+ "address": "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
294
+ "decimals": 6,
295
+ "balanceSlot": 9
296
+ },
297
+ {
298
+ "symbol": "WETH",
299
+ "address": "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73",
300
+ "decimals": 18,
301
+ "balanceSlot": 51
302
+ }
303
+ ]
304
+ },
305
+ "11155111": {
306
+ "name": "Ethereum-sepolia",
307
+ "contracts": {
308
+ "spokepool": "0x2171A3C4592d5Ae06E0257728aB4E88E575f4cF3",
309
+ "hook": "0x0000000000f6Ed8Be424d673c63eeFF8b9267420",
310
+ "originModule": "0x0000000000AFc904aE9860D9c4B96D7c529c58b8",
311
+ "targetModule": "0x0000000000E5a37279A001301A837a91b5de1D5E",
312
+ "sameChainModule": "0x000000000043ff16d5776c7F0f65Ec485C17Ca04"
313
+ },
314
+ "tokens": [
315
+ {
316
+ "symbol": "ETH",
317
+ "address": "0x0000000000000000000000000000000000000000",
318
+ "decimals": 18,
319
+ "balanceSlot": null
320
+ },
321
+ {
322
+ "symbol": "USDC",
323
+ "address": "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
324
+ "decimals": 6,
325
+ "balanceSlot": 9
326
+ },
327
+ {
328
+ "symbol": "WETH",
329
+ "address": "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14",
330
+ "decimals": 18,
331
+ "balanceSlot": 3
332
+ }
333
+ ]
334
+ },
335
+ "11155420": {
336
+ "name": "Optimism-sepolia",
337
+ "contracts": {
338
+ "spokepool": "0x20038b572633E45F3aB5b1a46CB85D0D241b80D8",
339
+ "hook": "0x0000000000f6Ed8Be424d673c63eeFF8b9267420",
340
+ "originModule": "0x0000000000AFc904aE9860D9c4B96D7c529c58b8",
341
+ "targetModule": "0x0000000000E5a37279A001301A837a91b5de1D5E",
342
+ "sameChainModule": "0x000000000043ff16d5776c7F0f65Ec485C17Ca04"
343
+ },
344
+ "tokens": [
345
+ {
346
+ "symbol": "ETH",
347
+ "address": "0x0000000000000000000000000000000000000000",
348
+ "decimals": 18,
349
+ "balanceSlot": null
350
+ },
351
+ {
352
+ "symbol": "USDC",
353
+ "address": "0x5fd84259d66Cd46123540766Be93DFE6D43130D7",
354
+ "decimals": 6,
355
+ "balanceSlot": 9
356
+ },
357
+ {
358
+ "symbol": "WETH",
359
+ "address": "0x4200000000000000000000000000000000000006",
360
+ "decimals": 18,
361
+ "balanceSlot": 3
362
+ }
363
+ ]
364
+ }
365
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.test.d.ts","sourceRoot":"","sources":["../../../orchestrator/registry.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const viem_1 = require("viem");
4
+ const chains_1 = require("viem/chains");
5
+ const vitest_1 = require("vitest");
6
+ const registry_1 = require("./registry");
7
+ const DEPRECATED_CHAIN_ID = 5; // Goerli
8
+ const UNSUPPORTED_CHAIN_ID = 56; // BNB Chain
9
+ const TOKEN_SYMBOLS = {
10
+ ETH: 'ETH',
11
+ USDC: 'USDC',
12
+ USDT: 'USDT',
13
+ WETH: 'WETH',
14
+ };
15
+ const TOKEN_ADDRESSES = {
16
+ ETHEREUM_USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
17
+ BASE_WETH: '0x4200000000000000000000000000000000000006',
18
+ };
19
+ const UNSUPPORTED_TOKEN_ADDRESS = '0x1234567890123456789012345678901234567890';
20
+ (0, vitest_1.describe)('Registry', () => {
21
+ (0, vitest_1.describe)('getSupportedChainIds', () => {
22
+ (0, vitest_1.test)('returns supported chain IDs', () => {
23
+ const chainIds = (0, registry_1.getSupportedChainIds)();
24
+ (0, vitest_1.expect)(chainIds).toContain(chains_1.mainnet.id);
25
+ (0, vitest_1.expect)(chainIds).toContain(chains_1.base.id);
26
+ (0, vitest_1.expect)(chainIds).toContain(chains_1.sepolia.id);
27
+ });
28
+ (0, vitest_1.test)('does not include unsupported chains', () => {
29
+ const chainIds = (0, registry_1.getSupportedChainIds)();
30
+ (0, vitest_1.expect)(chainIds).not.toContain(DEPRECATED_CHAIN_ID);
31
+ (0, vitest_1.expect)(chainIds).not.toContain(UNSUPPORTED_CHAIN_ID);
32
+ });
33
+ });
34
+ (0, vitest_1.describe)('getTokenSymbol', () => {
35
+ (0, vitest_1.test)('returns correct symbol for supported token', () => {
36
+ const symbol = (0, registry_1.getTokenSymbol)(TOKEN_ADDRESSES.ETHEREUM_USDC, chains_1.mainnet.id);
37
+ (0, vitest_1.expect)(symbol).toBe(TOKEN_SYMBOLS.USDC);
38
+ });
39
+ (0, vitest_1.test)('throws error for unsupported chain', () => {
40
+ (0, vitest_1.expect)(() => (0, registry_1.getTokenSymbol)(TOKEN_ADDRESSES.ETHEREUM_USDC, UNSUPPORTED_CHAIN_ID)).toThrow(`Unsupported chain ${UNSUPPORTED_CHAIN_ID}`);
41
+ });
42
+ });
43
+ (0, vitest_1.describe)('getTokenAddress', () => {
44
+ (0, vitest_1.test)('returns zero address for ETH', () => {
45
+ const address = (0, registry_1.getTokenAddress)(TOKEN_SYMBOLS.ETH, chains_1.mainnet.id);
46
+ (0, vitest_1.expect)(address).toBe(viem_1.zeroAddress);
47
+ });
48
+ (0, vitest_1.test)('returns correct address for token symbol', () => {
49
+ const address = (0, registry_1.getTokenAddress)(TOKEN_SYMBOLS.USDC, chains_1.mainnet.id);
50
+ (0, vitest_1.expect)(address).toBe(TOKEN_ADDRESSES.ETHEREUM_USDC);
51
+ });
52
+ (0, vitest_1.test)('throws error for unsupported chain', () => {
53
+ (0, vitest_1.expect)(() => (0, registry_1.getTokenAddress)(TOKEN_SYMBOLS.USDC, UNSUPPORTED_CHAIN_ID)).toThrow(`Unsupported chain ${UNSUPPORTED_CHAIN_ID}`);
54
+ });
55
+ });
56
+ (0, vitest_1.describe)('getWethAddress', () => {
57
+ (0, vitest_1.test)('returns correct WETH address', () => {
58
+ const address = (0, registry_1.getWethAddress)(chains_1.base);
59
+ (0, vitest_1.expect)(address).toBe(TOKEN_ADDRESSES.BASE_WETH);
60
+ });
61
+ (0, vitest_1.test)('throws error for unsupported chain', () => {
62
+ const unsupportedChain = {
63
+ id: UNSUPPORTED_CHAIN_ID,
64
+ name: 'Unsupported',
65
+ };
66
+ (0, vitest_1.expect)(() => (0, registry_1.getWethAddress)(unsupportedChain)).toThrow(`Unsupported chain ${UNSUPPORTED_CHAIN_ID}`);
67
+ });
68
+ });
69
+ (0, vitest_1.describe)('getChainById', () => {
70
+ (0, vitest_1.test)('returns correct chain for supported ID', () => {
71
+ const chain = (0, registry_1.getChainById)(chains_1.mainnet.id);
72
+ (0, vitest_1.expect)(chain?.id).toBe(chains_1.mainnet.id);
73
+ (0, vitest_1.expect)(chain?.name).toBe(chains_1.mainnet.name);
74
+ });
75
+ (0, vitest_1.test)('returns undefined for unsupported chain', () => {
76
+ (0, vitest_1.expect)((0, registry_1.getChainById)(UNSUPPORTED_CHAIN_ID)).toBeUndefined();
77
+ });
78
+ });
79
+ (0, vitest_1.describe)('isTestnet', () => {
80
+ (0, vitest_1.test)('returns false for mainnet', () => {
81
+ (0, vitest_1.expect)((0, registry_1.isTestnet)(chains_1.mainnet.id)).toBe(false);
82
+ });
83
+ (0, vitest_1.test)('returns true for testnet', () => {
84
+ (0, vitest_1.expect)((0, registry_1.isTestnet)(chains_1.sepolia.id)).toBe(true);
85
+ });
86
+ (0, vitest_1.test)('throws error for unsupported chain', () => {
87
+ (0, vitest_1.expect)(() => (0, registry_1.isTestnet)(UNSUPPORTED_CHAIN_ID)).toThrow(`Chain not supported: ${UNSUPPORTED_CHAIN_ID}`);
88
+ });
89
+ });
90
+ (0, vitest_1.describe)('isTokenAddressSupported', () => {
91
+ (0, vitest_1.test)('returns true for supported token', () => {
92
+ const isSupported = (0, registry_1.isTokenAddressSupported)(TOKEN_ADDRESSES.ETHEREUM_USDC, chains_1.mainnet.id);
93
+ (0, vitest_1.expect)(isSupported).toBe(true);
94
+ });
95
+ (0, vitest_1.test)('returns false for unsupported token or chain', () => {
96
+ (0, vitest_1.expect)((0, registry_1.isTokenAddressSupported)(UNSUPPORTED_TOKEN_ADDRESS, chains_1.mainnet.id)).toBe(false);
97
+ (0, vitest_1.expect)((0, registry_1.isTokenAddressSupported)(TOKEN_ADDRESSES.ETHEREUM_USDC, UNSUPPORTED_CHAIN_ID)).toBe(false);
98
+ });
99
+ });
100
+ (0, vitest_1.describe)('getSupportedTokens', () => {
101
+ (0, vitest_1.test)('returns tokens for supported chain', () => {
102
+ const tokens = (0, registry_1.getSupportedTokens)(chains_1.mainnet.id);
103
+ (0, vitest_1.expect)(tokens.length).toBeGreaterThan(0);
104
+ (0, vitest_1.expect)(tokens.find((t) => t.symbol === TOKEN_SYMBOLS.USDC)).toBeDefined();
105
+ });
106
+ (0, vitest_1.test)('throws error for unsupported chain', () => {
107
+ (0, vitest_1.expect)(() => (0, registry_1.getSupportedTokens)(UNSUPPORTED_CHAIN_ID)).toThrow(`Chain not supported: ${UNSUPPORTED_CHAIN_ID}`);
108
+ });
109
+ });
110
+ (0, vitest_1.describe)('getDefaultAccountAccessList', () => {
111
+ (0, vitest_1.test)('filters chains by testnet status', () => {
112
+ const mainnetList = (0, registry_1.getDefaultAccountAccessList)(false);
113
+ const testnetList = (0, registry_1.getDefaultAccountAccessList)(true);
114
+ (0, vitest_1.expect)(mainnetList.chainIds).toContain(chains_1.mainnet.id);
115
+ (0, vitest_1.expect)(mainnetList.chainIds).not.toContain(chains_1.sepolia.id);
116
+ (0, vitest_1.expect)(testnetList.chainIds).toContain(chains_1.sepolia.id);
117
+ (0, vitest_1.expect)(testnetList.chainIds).not.toContain(chains_1.mainnet.id);
118
+ });
119
+ });
120
+ (0, vitest_1.describe)('resolveTokenAddress', () => {
121
+ (0, vitest_1.test)('returns address as-is when given valid address', () => {
122
+ const address = TOKEN_ADDRESSES.ETHEREUM_USDC;
123
+ const result = (0, registry_1.resolveTokenAddress)(address, chains_1.mainnet.id);
124
+ (0, vitest_1.expect)(result).toBe(address);
125
+ });
126
+ (0, vitest_1.test)('resolves token symbol to address', () => {
127
+ const result = (0, registry_1.resolveTokenAddress)(TOKEN_SYMBOLS.USDC, chains_1.mainnet.id);
128
+ (0, vitest_1.expect)(result).toBe(TOKEN_ADDRESSES.ETHEREUM_USDC);
129
+ });
130
+ (0, vitest_1.test)('throw error for unsupported token', () => {
131
+ (0, vitest_1.expect)(() => (0, registry_1.resolveTokenAddress)(TOKEN_SYMBOLS.USDT, chains_1.baseSepolia.id)).toThrow(`Unsupported token symbol ${TOKEN_SYMBOLS.USDT}`);
132
+ });
133
+ (0, vitest_1.test)('throws error for unsupported chain', () => {
134
+ (0, vitest_1.expect)(() => (0, registry_1.resolveTokenAddress)(TOKEN_SYMBOLS.USDC, UNSUPPORTED_CHAIN_ID)).toThrow(`Unsupported chain ${UNSUPPORTED_CHAIN_ID}`);
135
+ });
136
+ });
137
+ });
@@ -1,15 +1,15 @@
1
1
  import type { Address, Hex } from 'viem';
2
- import { UserOperationReceipt } from 'viem/account-abstraction';
3
- import type { arbitrum, arbitrumSepolia, base, baseSepolia, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, sepolia, zksync } from 'viem/chains';
4
- type SupportedTestnet = typeof sepolia.id | typeof baseSepolia.id | typeof arbitrumSepolia.id | typeof optimismSepolia.id | typeof polygonAmoy.id;
5
- type SupportedMainnet = typeof mainnet.id | typeof base.id | typeof arbitrum.id | typeof optimism.id | typeof polygon.id | typeof zksync.id;
6
- type SupportedOPStackMainnet = typeof optimism.id | typeof base.id;
2
+ import type { UserOperationReceipt } from 'viem/account-abstraction';
3
+ import type { arbitrum, arbitrumSepolia, base, baseSepolia, mainnet, optimism, optimismSepolia, polygon, sepolia, soneium, zksync } from 'viem/chains';
4
+ type SupportedTestnet = typeof sepolia.id | typeof baseSepolia.id | typeof arbitrumSepolia.id | typeof optimismSepolia.id;
5
+ type SupportedMainnet = typeof mainnet.id | typeof base.id | typeof arbitrum.id | typeof optimism.id | typeof polygon.id | typeof zksync.id | typeof soneium.id;
6
+ type SupportedOPStackMainnet = typeof optimism.id | typeof base.id | typeof soneium.id;
7
7
  type SupportedOPStackTestnet = typeof optimismSepolia.id | typeof baseSepolia.id;
8
8
  type SupportedChain = SupportedMainnet | SupportedTestnet;
9
9
  type SupportedTokenSymbol = 'ETH' | 'WETH' | 'USDC' | 'USDT';
10
10
  type SupportedToken = SupportedTokenSymbol | Address;
11
- type DeployedAccountStatus = 'ERC7579';
12
- type AccountStatus = 'NOT_DEPLOYED' | DeployedAccountStatus;
11
+ type SmartAccountType = 'GENERIC' | 'ERC7579';
12
+ type AccountStatus = 'NOT_DEPLOYED' | SmartAccountType;
13
13
  declare const INTENT_STATUS_PENDING = "PENDING";
14
14
  declare const INTENT_STATUS_FAILED = "FAILED";
15
15
  declare const INTENT_STATUS_EXPIRED = "EXPIRED";
@@ -46,6 +46,17 @@ interface Execution {
46
46
  value: bigint;
47
47
  data: Hex;
48
48
  }
49
+ type SettlementLayer = 'SAME_CHAIN' | 'ACROSS' | 'ECO';
50
+ interface IntentOptions {
51
+ topupCompact: boolean;
52
+ sponsorSettings?: SponsorSettings;
53
+ settlementLayers?: SettlementLayer[];
54
+ }
55
+ interface SponsorSettings {
56
+ gasSponsored: boolean;
57
+ bridgeFeesSponsored: boolean;
58
+ swapFeesSponsored: boolean;
59
+ }
49
60
  interface PortfolioToken {
50
61
  symbol: string;
51
62
  decimals: number;
@@ -64,7 +75,17 @@ interface PortfolioToken {
64
75
  }
65
76
  type Portfolio = PortfolioToken[];
66
77
  interface IntentInput {
67
- account: Address;
78
+ account: {
79
+ address: Address;
80
+ accountType: SmartAccountType;
81
+ setupOps: {
82
+ to: Address;
83
+ data: Hex;
84
+ }[];
85
+ delegations?: Record<number, {
86
+ contract: Address;
87
+ }>;
88
+ };
68
89
  destinationChainId: number;
69
90
  destinationExecutions: Execution[];
70
91
  destinationGasUnits?: bigint;
@@ -73,9 +94,7 @@ interface IntentInput {
73
94
  amount?: bigint;
74
95
  }[];
75
96
  accountAccessList?: AccountAccessList;
76
- smartAccount: {
77
- accountType: DeployedAccountStatus;
78
- };
97
+ options?: IntentOptions;
79
98
  }
80
99
  type SettlementSystem = 'SAME_CHAIN' | 'ACROSS';
81
100
  interface IntentCost {
@@ -103,7 +122,7 @@ interface IntentOpElement {
103
122
  chainId: string;
104
123
  idsAndAmounts: [[string, string]];
105
124
  beforeFill: boolean;
106
- smartAccountStatus: DeployedAccountStatus;
125
+ smartAccountStatus: SmartAccountType;
107
126
  mandate: {
108
127
  recipient: Address;
109
128
  tokenOut: [[string, string]];
@@ -124,7 +143,7 @@ interface IntentOp {
124
143
  elements: IntentOpElement[];
125
144
  serverSignature: string;
126
145
  signedMetadata: {
127
- quotes: unknown;
146
+ quotes: Record<Address, unknown[]>;
128
147
  tokenPrices: Record<string, number>;
129
148
  opGasParams: Record<string, {
130
149
  l1BaseFee: string;
@@ -135,8 +154,49 @@ interface IntentOp {
135
154
  estimatedCalldataSize: number;
136
155
  };
137
156
  gasPrices: Record<string, string>;
157
+ account: AccountWithContext;
138
158
  };
139
159
  }
160
+ interface Account {
161
+ address: Address;
162
+ accountType: SmartAccountType;
163
+ setupOps: Pick<Execution, 'to' | 'data'>[];
164
+ delegations?: Delegations;
165
+ emissaryConfig?: EmissarySetupConfig;
166
+ }
167
+ type AccountWithContext = Omit<Account, 'delegations'> & {
168
+ accountContext: {
169
+ [chainId: number]: AccountStatus;
170
+ };
171
+ requiredDelegations?: Delegations;
172
+ };
173
+ interface Delegation {
174
+ contract: Address;
175
+ }
176
+ type Delegations = Record<number, Delegation>;
177
+ interface EmissarySetupConfig {
178
+ configId: number;
179
+ validatorAddress: Address;
180
+ emissaryAddress: Address;
181
+ emissaryConfig: EmissaryConfig;
182
+ emissaryEnable: EmissaryEnable;
183
+ }
184
+ interface EmissaryConfig {
185
+ configId: number;
186
+ allocator: Address;
187
+ scope: number;
188
+ resetPeriod: number;
189
+ validator: Address;
190
+ validatorConfig: Hex;
191
+ }
192
+ interface EmissaryEnable {
193
+ allocatorSig: Hex;
194
+ userSig: Hex;
195
+ expires: bigint;
196
+ nonce: bigint;
197
+ allChainIds: bigint[];
198
+ chainIndex: bigint;
199
+ }
140
200
  interface IntentRoute {
141
201
  intentOp: IntentOp;
142
202
  intentCost: IntentCost;
@@ -150,12 +210,19 @@ interface IntentResult {
150
210
  type SignedIntentOp = IntentOp & {
151
211
  originSignatures: Hex[];
152
212
  destinationSignature: Hex;
213
+ signedAuthorizations?: readonly {
214
+ chainId: number;
215
+ address: Address;
216
+ nonce: number;
217
+ yParity: number;
218
+ r: Hex;
219
+ s: Hex;
220
+ }[];
153
221
  };
154
222
  interface TokenConfig {
155
223
  symbol: string;
156
224
  address: Address;
157
225
  decimals: number;
158
- balanceSlot: (address: Address) => Hex;
159
226
  }
160
227
  export type TokenPrices = {
161
228
  [key in SupportedTokenSymbol]?: number;