@gitmyabi/cicada-maker 0.0.0-stage → 1.0.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.
- package/README.md +107 -2
- package/contracts/HashflowPool.d.ts +1565 -0
- package/contracts/HashflowPool.js +1541 -0
- package/contracts/HashflowPool.ts +2019 -0
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +7 -0
- package/contracts/index.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +40 -3
|
@@ -0,0 +1,1541 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HashflowPool = exports.HashflowPoolAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* HashflowPool ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.HashflowPoolAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "address",
|
|
15
|
+
"name": "weth",
|
|
16
|
+
"type": "address"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"stateMutability": "nonpayable",
|
|
20
|
+
"type": "constructor"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"anonymous": false,
|
|
24
|
+
"inputs": [
|
|
25
|
+
{
|
|
26
|
+
"indexed": false,
|
|
27
|
+
"internalType": "uint8",
|
|
28
|
+
"name": "version",
|
|
29
|
+
"type": "uint8"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"name": "Initialized",
|
|
33
|
+
"type": "event"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"anonymous": false,
|
|
37
|
+
"inputs": [
|
|
38
|
+
{
|
|
39
|
+
"indexed": false,
|
|
40
|
+
"internalType": "address",
|
|
41
|
+
"name": "token",
|
|
42
|
+
"type": "address"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"indexed": false,
|
|
46
|
+
"internalType": "address",
|
|
47
|
+
"name": "recipient",
|
|
48
|
+
"type": "address"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"indexed": false,
|
|
52
|
+
"internalType": "uint256",
|
|
53
|
+
"name": "withdrawAmount",
|
|
54
|
+
"type": "uint256"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"name": "RemoveLiquidity",
|
|
58
|
+
"type": "event"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"anonymous": false,
|
|
62
|
+
"inputs": [
|
|
63
|
+
{
|
|
64
|
+
"indexed": false,
|
|
65
|
+
"internalType": "address",
|
|
66
|
+
"name": "trader",
|
|
67
|
+
"type": "address"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"indexed": false,
|
|
71
|
+
"internalType": "address",
|
|
72
|
+
"name": "effectiveTrader",
|
|
73
|
+
"type": "address"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"indexed": false,
|
|
77
|
+
"internalType": "bytes32",
|
|
78
|
+
"name": "txid",
|
|
79
|
+
"type": "bytes32"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"indexed": false,
|
|
83
|
+
"internalType": "address",
|
|
84
|
+
"name": "baseToken",
|
|
85
|
+
"type": "address"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"indexed": false,
|
|
89
|
+
"internalType": "address",
|
|
90
|
+
"name": "quoteToken",
|
|
91
|
+
"type": "address"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"indexed": false,
|
|
95
|
+
"internalType": "uint256",
|
|
96
|
+
"name": "baseTokenAmount",
|
|
97
|
+
"type": "uint256"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"indexed": false,
|
|
101
|
+
"internalType": "uint256",
|
|
102
|
+
"name": "quoteTokenAmount",
|
|
103
|
+
"type": "uint256"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"name": "Trade",
|
|
107
|
+
"type": "event"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"anonymous": false,
|
|
111
|
+
"inputs": [
|
|
112
|
+
{
|
|
113
|
+
"indexed": false,
|
|
114
|
+
"internalType": "address",
|
|
115
|
+
"name": "signer",
|
|
116
|
+
"type": "address"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"indexed": false,
|
|
120
|
+
"internalType": "address",
|
|
121
|
+
"name": "prevSigner",
|
|
122
|
+
"type": "address"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"name": "UpdateSigner",
|
|
126
|
+
"type": "event"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"anonymous": false,
|
|
130
|
+
"inputs": [
|
|
131
|
+
{
|
|
132
|
+
"indexed": false,
|
|
133
|
+
"internalType": "address",
|
|
134
|
+
"name": "account",
|
|
135
|
+
"type": "address"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"indexed": false,
|
|
139
|
+
"internalType": "bool",
|
|
140
|
+
"name": "authorized",
|
|
141
|
+
"type": "bool"
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"name": "UpdateWithdrawalAccount",
|
|
145
|
+
"type": "event"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"anonymous": false,
|
|
149
|
+
"inputs": [
|
|
150
|
+
{
|
|
151
|
+
"indexed": false,
|
|
152
|
+
"internalType": "uint16",
|
|
153
|
+
"name": "dstChainId",
|
|
154
|
+
"type": "uint16"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"indexed": false,
|
|
158
|
+
"internalType": "bytes32",
|
|
159
|
+
"name": "dstPool",
|
|
160
|
+
"type": "bytes32"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"indexed": false,
|
|
164
|
+
"internalType": "address",
|
|
165
|
+
"name": "trader",
|
|
166
|
+
"type": "address"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"indexed": false,
|
|
170
|
+
"internalType": "bytes32",
|
|
171
|
+
"name": "dstTrader",
|
|
172
|
+
"type": "bytes32"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"indexed": false,
|
|
176
|
+
"internalType": "bytes32",
|
|
177
|
+
"name": "txid",
|
|
178
|
+
"type": "bytes32"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"indexed": false,
|
|
182
|
+
"internalType": "address",
|
|
183
|
+
"name": "baseToken",
|
|
184
|
+
"type": "address"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"indexed": false,
|
|
188
|
+
"internalType": "bytes32",
|
|
189
|
+
"name": "quoteToken",
|
|
190
|
+
"type": "bytes32"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"indexed": false,
|
|
194
|
+
"internalType": "uint256",
|
|
195
|
+
"name": "baseTokenAmount",
|
|
196
|
+
"type": "uint256"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"indexed": false,
|
|
200
|
+
"internalType": "uint256",
|
|
201
|
+
"name": "quoteTokenAmount",
|
|
202
|
+
"type": "uint256"
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
"name": "XChainTrade",
|
|
206
|
+
"type": "event"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"anonymous": false,
|
|
210
|
+
"inputs": [
|
|
211
|
+
{
|
|
212
|
+
"indexed": false,
|
|
213
|
+
"internalType": "bytes32",
|
|
214
|
+
"name": "txid",
|
|
215
|
+
"type": "bytes32"
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
"name": "XChainTradeFill",
|
|
219
|
+
"type": "event"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"inputs": [],
|
|
223
|
+
"name": "_WETH",
|
|
224
|
+
"outputs": [
|
|
225
|
+
{
|
|
226
|
+
"internalType": "address",
|
|
227
|
+
"name": "",
|
|
228
|
+
"type": "address"
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"stateMutability": "view",
|
|
232
|
+
"type": "function"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"inputs": [
|
|
236
|
+
{
|
|
237
|
+
"internalType": "address",
|
|
238
|
+
"name": "token",
|
|
239
|
+
"type": "address"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"internalType": "address",
|
|
243
|
+
"name": "spender",
|
|
244
|
+
"type": "address"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"internalType": "uint256",
|
|
248
|
+
"name": "amount",
|
|
249
|
+
"type": "uint256"
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
"name": "approveToken",
|
|
253
|
+
"outputs": [],
|
|
254
|
+
"stateMutability": "nonpayable",
|
|
255
|
+
"type": "function"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"inputs": [
|
|
259
|
+
{
|
|
260
|
+
"internalType": "address",
|
|
261
|
+
"name": "token",
|
|
262
|
+
"type": "address"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"internalType": "address",
|
|
266
|
+
"name": "spender",
|
|
267
|
+
"type": "address"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"internalType": "uint256",
|
|
271
|
+
"name": "amount",
|
|
272
|
+
"type": "uint256"
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
"name": "decreaseTokenAllowance",
|
|
276
|
+
"outputs": [],
|
|
277
|
+
"stateMutability": "nonpayable",
|
|
278
|
+
"type": "function"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"inputs": [
|
|
282
|
+
{
|
|
283
|
+
"internalType": "address",
|
|
284
|
+
"name": "externalAccount",
|
|
285
|
+
"type": "address"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"internalType": "bytes32",
|
|
289
|
+
"name": "txid",
|
|
290
|
+
"type": "bytes32"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"internalType": "address",
|
|
294
|
+
"name": "trader",
|
|
295
|
+
"type": "address"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"internalType": "address",
|
|
299
|
+
"name": "quoteToken",
|
|
300
|
+
"type": "address"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"internalType": "uint256",
|
|
304
|
+
"name": "quoteTokenAmount",
|
|
305
|
+
"type": "uint256"
|
|
306
|
+
}
|
|
307
|
+
],
|
|
308
|
+
"name": "fillXChain",
|
|
309
|
+
"outputs": [],
|
|
310
|
+
"stateMutability": "nonpayable",
|
|
311
|
+
"type": "function"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"inputs": [
|
|
315
|
+
{
|
|
316
|
+
"internalType": "address",
|
|
317
|
+
"name": "token",
|
|
318
|
+
"type": "address"
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
"name": "getReserves",
|
|
322
|
+
"outputs": [
|
|
323
|
+
{
|
|
324
|
+
"internalType": "uint256",
|
|
325
|
+
"name": "",
|
|
326
|
+
"type": "uint256"
|
|
327
|
+
}
|
|
328
|
+
],
|
|
329
|
+
"stateMutability": "view",
|
|
330
|
+
"type": "function"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"inputs": [
|
|
334
|
+
{
|
|
335
|
+
"internalType": "address",
|
|
336
|
+
"name": "token",
|
|
337
|
+
"type": "address"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"internalType": "address",
|
|
341
|
+
"name": "spender",
|
|
342
|
+
"type": "address"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"internalType": "uint256",
|
|
346
|
+
"name": "amount",
|
|
347
|
+
"type": "uint256"
|
|
348
|
+
}
|
|
349
|
+
],
|
|
350
|
+
"name": "increaseTokenAllowance",
|
|
351
|
+
"outputs": [],
|
|
352
|
+
"stateMutability": "nonpayable",
|
|
353
|
+
"type": "function"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"inputs": [
|
|
357
|
+
{
|
|
358
|
+
"internalType": "string",
|
|
359
|
+
"name": "_name",
|
|
360
|
+
"type": "string"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"internalType": "address",
|
|
364
|
+
"name": "_signer",
|
|
365
|
+
"type": "address"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"internalType": "address",
|
|
369
|
+
"name": "_operations",
|
|
370
|
+
"type": "address"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"internalType": "address",
|
|
374
|
+
"name": "_router",
|
|
375
|
+
"type": "address"
|
|
376
|
+
}
|
|
377
|
+
],
|
|
378
|
+
"name": "initialize",
|
|
379
|
+
"outputs": [],
|
|
380
|
+
"stateMutability": "nonpayable",
|
|
381
|
+
"type": "function"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"inputs": [
|
|
385
|
+
{
|
|
386
|
+
"internalType": "bytes32",
|
|
387
|
+
"name": "hash",
|
|
388
|
+
"type": "bytes32"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"internalType": "bytes",
|
|
392
|
+
"name": "signature",
|
|
393
|
+
"type": "bytes"
|
|
394
|
+
}
|
|
395
|
+
],
|
|
396
|
+
"name": "isValidSignature",
|
|
397
|
+
"outputs": [
|
|
398
|
+
{
|
|
399
|
+
"internalType": "bytes4",
|
|
400
|
+
"name": "magicValue",
|
|
401
|
+
"type": "bytes4"
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
"stateMutability": "view",
|
|
405
|
+
"type": "function"
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
"inputs": [
|
|
409
|
+
{
|
|
410
|
+
"internalType": "bool",
|
|
411
|
+
"name": "enabled",
|
|
412
|
+
"type": "bool"
|
|
413
|
+
}
|
|
414
|
+
],
|
|
415
|
+
"name": "killswitchOperations",
|
|
416
|
+
"outputs": [],
|
|
417
|
+
"stateMutability": "nonpayable",
|
|
418
|
+
"type": "function"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"inputs": [],
|
|
422
|
+
"name": "name",
|
|
423
|
+
"outputs": [
|
|
424
|
+
{
|
|
425
|
+
"internalType": "string",
|
|
426
|
+
"name": "",
|
|
427
|
+
"type": "string"
|
|
428
|
+
}
|
|
429
|
+
],
|
|
430
|
+
"stateMutability": "view",
|
|
431
|
+
"type": "function"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"inputs": [
|
|
435
|
+
{
|
|
436
|
+
"internalType": "address",
|
|
437
|
+
"name": "",
|
|
438
|
+
"type": "address"
|
|
439
|
+
}
|
|
440
|
+
],
|
|
441
|
+
"name": "nonces",
|
|
442
|
+
"outputs": [
|
|
443
|
+
{
|
|
444
|
+
"internalType": "uint256",
|
|
445
|
+
"name": "",
|
|
446
|
+
"type": "uint256"
|
|
447
|
+
}
|
|
448
|
+
],
|
|
449
|
+
"stateMutability": "view",
|
|
450
|
+
"type": "function"
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"inputs": [],
|
|
454
|
+
"name": "operations",
|
|
455
|
+
"outputs": [
|
|
456
|
+
{
|
|
457
|
+
"internalType": "address",
|
|
458
|
+
"name": "",
|
|
459
|
+
"type": "address"
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
"stateMutability": "view",
|
|
463
|
+
"type": "function"
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"inputs": [
|
|
467
|
+
{
|
|
468
|
+
"internalType": "address",
|
|
469
|
+
"name": "token",
|
|
470
|
+
"type": "address"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"internalType": "address",
|
|
474
|
+
"name": "recipient",
|
|
475
|
+
"type": "address"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"internalType": "uint256",
|
|
479
|
+
"name": "amount",
|
|
480
|
+
"type": "uint256"
|
|
481
|
+
}
|
|
482
|
+
],
|
|
483
|
+
"name": "removeLiquidity",
|
|
484
|
+
"outputs": [],
|
|
485
|
+
"stateMutability": "nonpayable",
|
|
486
|
+
"type": "function"
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"inputs": [],
|
|
490
|
+
"name": "router",
|
|
491
|
+
"outputs": [
|
|
492
|
+
{
|
|
493
|
+
"internalType": "address",
|
|
494
|
+
"name": "",
|
|
495
|
+
"type": "address"
|
|
496
|
+
}
|
|
497
|
+
],
|
|
498
|
+
"stateMutability": "view",
|
|
499
|
+
"type": "function"
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
"inputs": [],
|
|
503
|
+
"name": "signerConfiguration",
|
|
504
|
+
"outputs": [
|
|
505
|
+
{
|
|
506
|
+
"internalType": "address",
|
|
507
|
+
"name": "signer",
|
|
508
|
+
"type": "address"
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"internalType": "bool",
|
|
512
|
+
"name": "enabled",
|
|
513
|
+
"type": "bool"
|
|
514
|
+
}
|
|
515
|
+
],
|
|
516
|
+
"stateMutability": "view",
|
|
517
|
+
"type": "function"
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"inputs": [
|
|
521
|
+
{
|
|
522
|
+
"components": [
|
|
523
|
+
{
|
|
524
|
+
"internalType": "address",
|
|
525
|
+
"name": "pool",
|
|
526
|
+
"type": "address"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
"internalType": "address",
|
|
530
|
+
"name": "externalAccount",
|
|
531
|
+
"type": "address"
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"internalType": "address",
|
|
535
|
+
"name": "trader",
|
|
536
|
+
"type": "address"
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
"internalType": "address",
|
|
540
|
+
"name": "baseToken",
|
|
541
|
+
"type": "address"
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"internalType": "address",
|
|
545
|
+
"name": "quoteToken",
|
|
546
|
+
"type": "address"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"internalType": "uint256",
|
|
550
|
+
"name": "baseTokenAmount",
|
|
551
|
+
"type": "uint256"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"internalType": "uint256",
|
|
555
|
+
"name": "quoteTokenAmount",
|
|
556
|
+
"type": "uint256"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
"internalType": "uint256",
|
|
560
|
+
"name": "quoteExpiry",
|
|
561
|
+
"type": "uint256"
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
"internalType": "bytes32",
|
|
565
|
+
"name": "txid",
|
|
566
|
+
"type": "bytes32"
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"internalType": "bytes",
|
|
570
|
+
"name": "takerSignature",
|
|
571
|
+
"type": "bytes"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
"internalType": "bytes",
|
|
575
|
+
"name": "makerSignature",
|
|
576
|
+
"type": "bytes"
|
|
577
|
+
}
|
|
578
|
+
],
|
|
579
|
+
"internalType": "struct IQuote.RFQMQuote",
|
|
580
|
+
"name": "quote",
|
|
581
|
+
"type": "tuple"
|
|
582
|
+
}
|
|
583
|
+
],
|
|
584
|
+
"name": "tradeRFQM",
|
|
585
|
+
"outputs": [],
|
|
586
|
+
"stateMutability": "nonpayable",
|
|
587
|
+
"type": "function"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"inputs": [
|
|
591
|
+
{
|
|
592
|
+
"components": [
|
|
593
|
+
{
|
|
594
|
+
"internalType": "address",
|
|
595
|
+
"name": "pool",
|
|
596
|
+
"type": "address"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
"internalType": "address",
|
|
600
|
+
"name": "externalAccount",
|
|
601
|
+
"type": "address"
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
"internalType": "address",
|
|
605
|
+
"name": "trader",
|
|
606
|
+
"type": "address"
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
"internalType": "address",
|
|
610
|
+
"name": "effectiveTrader",
|
|
611
|
+
"type": "address"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"internalType": "address",
|
|
615
|
+
"name": "baseToken",
|
|
616
|
+
"type": "address"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
"internalType": "address",
|
|
620
|
+
"name": "quoteToken",
|
|
621
|
+
"type": "address"
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
"internalType": "uint256",
|
|
625
|
+
"name": "effectiveBaseTokenAmount",
|
|
626
|
+
"type": "uint256"
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
"internalType": "uint256",
|
|
630
|
+
"name": "baseTokenAmount",
|
|
631
|
+
"type": "uint256"
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
"internalType": "uint256",
|
|
635
|
+
"name": "quoteTokenAmount",
|
|
636
|
+
"type": "uint256"
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"internalType": "uint256",
|
|
640
|
+
"name": "quoteExpiry",
|
|
641
|
+
"type": "uint256"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
"internalType": "uint256",
|
|
645
|
+
"name": "nonce",
|
|
646
|
+
"type": "uint256"
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
"internalType": "bytes32",
|
|
650
|
+
"name": "txid",
|
|
651
|
+
"type": "bytes32"
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
"internalType": "bytes",
|
|
655
|
+
"name": "signature",
|
|
656
|
+
"type": "bytes"
|
|
657
|
+
}
|
|
658
|
+
],
|
|
659
|
+
"internalType": "struct IQuote.RFQTQuote",
|
|
660
|
+
"name": "quote",
|
|
661
|
+
"type": "tuple"
|
|
662
|
+
}
|
|
663
|
+
],
|
|
664
|
+
"name": "tradeRFQT",
|
|
665
|
+
"outputs": [],
|
|
666
|
+
"stateMutability": "payable",
|
|
667
|
+
"type": "function"
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
"inputs": [
|
|
671
|
+
{
|
|
672
|
+
"components": [
|
|
673
|
+
{
|
|
674
|
+
"internalType": "uint16",
|
|
675
|
+
"name": "srcChainId",
|
|
676
|
+
"type": "uint16"
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
"internalType": "uint16",
|
|
680
|
+
"name": "dstChainId",
|
|
681
|
+
"type": "uint16"
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
"internalType": "address",
|
|
685
|
+
"name": "srcPool",
|
|
686
|
+
"type": "address"
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
"internalType": "bytes32",
|
|
690
|
+
"name": "dstPool",
|
|
691
|
+
"type": "bytes32"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
"internalType": "address",
|
|
695
|
+
"name": "srcExternalAccount",
|
|
696
|
+
"type": "address"
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
"internalType": "bytes32",
|
|
700
|
+
"name": "dstExternalAccount",
|
|
701
|
+
"type": "bytes32"
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
"internalType": "address",
|
|
705
|
+
"name": "trader",
|
|
706
|
+
"type": "address"
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"internalType": "bytes32",
|
|
710
|
+
"name": "dstTrader",
|
|
711
|
+
"type": "bytes32"
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
"internalType": "address",
|
|
715
|
+
"name": "baseToken",
|
|
716
|
+
"type": "address"
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"internalType": "bytes32",
|
|
720
|
+
"name": "quoteToken",
|
|
721
|
+
"type": "bytes32"
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
"internalType": "uint256",
|
|
725
|
+
"name": "baseTokenAmount",
|
|
726
|
+
"type": "uint256"
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"internalType": "uint256",
|
|
730
|
+
"name": "quoteTokenAmount",
|
|
731
|
+
"type": "uint256"
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"internalType": "uint256",
|
|
735
|
+
"name": "quoteExpiry",
|
|
736
|
+
"type": "uint256"
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
"internalType": "bytes32",
|
|
740
|
+
"name": "txid",
|
|
741
|
+
"type": "bytes32"
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
"internalType": "address",
|
|
745
|
+
"name": "xChainMessenger",
|
|
746
|
+
"type": "address"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"internalType": "bytes",
|
|
750
|
+
"name": "takerSignature",
|
|
751
|
+
"type": "bytes"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
"internalType": "bytes",
|
|
755
|
+
"name": "makerSignature",
|
|
756
|
+
"type": "bytes"
|
|
757
|
+
}
|
|
758
|
+
],
|
|
759
|
+
"internalType": "struct IQuote.XChainRFQMQuote",
|
|
760
|
+
"name": "quote",
|
|
761
|
+
"type": "tuple"
|
|
762
|
+
}
|
|
763
|
+
],
|
|
764
|
+
"name": "tradeXChainRFQM",
|
|
765
|
+
"outputs": [],
|
|
766
|
+
"stateMutability": "nonpayable",
|
|
767
|
+
"type": "function"
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
"inputs": [
|
|
771
|
+
{
|
|
772
|
+
"components": [
|
|
773
|
+
{
|
|
774
|
+
"internalType": "uint16",
|
|
775
|
+
"name": "srcChainId",
|
|
776
|
+
"type": "uint16"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
"internalType": "uint16",
|
|
780
|
+
"name": "dstChainId",
|
|
781
|
+
"type": "uint16"
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
"internalType": "address",
|
|
785
|
+
"name": "srcPool",
|
|
786
|
+
"type": "address"
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
"internalType": "bytes32",
|
|
790
|
+
"name": "dstPool",
|
|
791
|
+
"type": "bytes32"
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
"internalType": "address",
|
|
795
|
+
"name": "srcExternalAccount",
|
|
796
|
+
"type": "address"
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"internalType": "bytes32",
|
|
800
|
+
"name": "dstExternalAccount",
|
|
801
|
+
"type": "bytes32"
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
"internalType": "bytes32",
|
|
805
|
+
"name": "dstTrader",
|
|
806
|
+
"type": "bytes32"
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
"internalType": "address",
|
|
810
|
+
"name": "baseToken",
|
|
811
|
+
"type": "address"
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
"internalType": "bytes32",
|
|
815
|
+
"name": "quoteToken",
|
|
816
|
+
"type": "bytes32"
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
"internalType": "uint256",
|
|
820
|
+
"name": "effectiveBaseTokenAmount",
|
|
821
|
+
"type": "uint256"
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
"internalType": "uint256",
|
|
825
|
+
"name": "baseTokenAmount",
|
|
826
|
+
"type": "uint256"
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
"internalType": "uint256",
|
|
830
|
+
"name": "quoteTokenAmount",
|
|
831
|
+
"type": "uint256"
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
"internalType": "uint256",
|
|
835
|
+
"name": "quoteExpiry",
|
|
836
|
+
"type": "uint256"
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
"internalType": "uint256",
|
|
840
|
+
"name": "nonce",
|
|
841
|
+
"type": "uint256"
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
"internalType": "bytes32",
|
|
845
|
+
"name": "txid",
|
|
846
|
+
"type": "bytes32"
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
"internalType": "address",
|
|
850
|
+
"name": "xChainMessenger",
|
|
851
|
+
"type": "address"
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
"internalType": "bytes",
|
|
855
|
+
"name": "signature",
|
|
856
|
+
"type": "bytes"
|
|
857
|
+
}
|
|
858
|
+
],
|
|
859
|
+
"internalType": "struct IQuote.XChainRFQTQuote",
|
|
860
|
+
"name": "quote",
|
|
861
|
+
"type": "tuple"
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
"internalType": "address",
|
|
865
|
+
"name": "trader",
|
|
866
|
+
"type": "address"
|
|
867
|
+
}
|
|
868
|
+
],
|
|
869
|
+
"name": "tradeXChainRFQT",
|
|
870
|
+
"outputs": [],
|
|
871
|
+
"stateMutability": "payable",
|
|
872
|
+
"type": "function"
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
"inputs": [
|
|
876
|
+
{
|
|
877
|
+
"internalType": "address",
|
|
878
|
+
"name": "newSigner",
|
|
879
|
+
"type": "address"
|
|
880
|
+
}
|
|
881
|
+
],
|
|
882
|
+
"name": "updateSigner",
|
|
883
|
+
"outputs": [],
|
|
884
|
+
"stateMutability": "nonpayable",
|
|
885
|
+
"type": "function"
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
"inputs": [
|
|
889
|
+
{
|
|
890
|
+
"internalType": "address[]",
|
|
891
|
+
"name": "withdrawalAccounts",
|
|
892
|
+
"type": "address[]"
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
"internalType": "bool",
|
|
896
|
+
"name": "authorized",
|
|
897
|
+
"type": "bool"
|
|
898
|
+
}
|
|
899
|
+
],
|
|
900
|
+
"name": "updateWithdrawalAccount",
|
|
901
|
+
"outputs": [],
|
|
902
|
+
"stateMutability": "nonpayable",
|
|
903
|
+
"type": "function"
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
"inputs": [
|
|
907
|
+
{
|
|
908
|
+
"internalType": "address",
|
|
909
|
+
"name": "xChainMessenger",
|
|
910
|
+
"type": "address"
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
"internalType": "bool",
|
|
914
|
+
"name": "authorized",
|
|
915
|
+
"type": "bool"
|
|
916
|
+
}
|
|
917
|
+
],
|
|
918
|
+
"name": "updateXChainMessengerAuthorization",
|
|
919
|
+
"outputs": [],
|
|
920
|
+
"stateMutability": "nonpayable",
|
|
921
|
+
"type": "function"
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
"inputs": [
|
|
925
|
+
{
|
|
926
|
+
"components": [
|
|
927
|
+
{
|
|
928
|
+
"internalType": "uint16",
|
|
929
|
+
"name": "chainId",
|
|
930
|
+
"type": "uint16"
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
"internalType": "bytes32",
|
|
934
|
+
"name": "pool",
|
|
935
|
+
"type": "bytes32"
|
|
936
|
+
}
|
|
937
|
+
],
|
|
938
|
+
"internalType": "struct IHashflowPool.AuthorizedXChainPool[]",
|
|
939
|
+
"name": "pools",
|
|
940
|
+
"type": "tuple[]"
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
"internalType": "bool",
|
|
944
|
+
"name": "status",
|
|
945
|
+
"type": "bool"
|
|
946
|
+
}
|
|
947
|
+
],
|
|
948
|
+
"name": "updateXChainPoolAuthorization",
|
|
949
|
+
"outputs": [],
|
|
950
|
+
"stateMutability": "nonpayable",
|
|
951
|
+
"type": "function"
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
"inputs": [
|
|
955
|
+
{
|
|
956
|
+
"internalType": "bytes32",
|
|
957
|
+
"name": "",
|
|
958
|
+
"type": "bytes32"
|
|
959
|
+
}
|
|
960
|
+
],
|
|
961
|
+
"name": "xChainNonces",
|
|
962
|
+
"outputs": [
|
|
963
|
+
{
|
|
964
|
+
"internalType": "uint256",
|
|
965
|
+
"name": "",
|
|
966
|
+
"type": "uint256"
|
|
967
|
+
}
|
|
968
|
+
],
|
|
969
|
+
"stateMutability": "view",
|
|
970
|
+
"type": "function"
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
"stateMutability": "payable",
|
|
974
|
+
"type": "receive"
|
|
975
|
+
}
|
|
976
|
+
];
|
|
977
|
+
/**
|
|
978
|
+
* HashflowPool Contract Class
|
|
979
|
+
*
|
|
980
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
981
|
+
*
|
|
982
|
+
* @example
|
|
983
|
+
* ```typescript
|
|
984
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
985
|
+
* import { mainnet } from 'viem/chains';
|
|
986
|
+
* import { HashflowPool } from 'HashflowPool';
|
|
987
|
+
*
|
|
988
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
989
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
990
|
+
*
|
|
991
|
+
* const contract = new HashflowPool('0x...', { publicClient, walletClient });
|
|
992
|
+
*
|
|
993
|
+
* // Read functions
|
|
994
|
+
* const result = await contract.balanceOf('0x...');
|
|
995
|
+
*
|
|
996
|
+
* // Write functions
|
|
997
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
998
|
+
*
|
|
999
|
+
* // Simulate transactions (dry-run)
|
|
1000
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
1001
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
1002
|
+
*
|
|
1003
|
+
* // Watch events
|
|
1004
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1005
|
+
* console.log('Transfer event:', event);
|
|
1006
|
+
* });
|
|
1007
|
+
* ```
|
|
1008
|
+
*/
|
|
1009
|
+
class HashflowPool {
|
|
1010
|
+
constructor(address, clients) {
|
|
1011
|
+
this.contractAddress = address;
|
|
1012
|
+
this.publicClient = clients.publicClient;
|
|
1013
|
+
this.contract = (0, viem_1.getContract)({
|
|
1014
|
+
address,
|
|
1015
|
+
abi: exports.HashflowPoolAbi,
|
|
1016
|
+
client: {
|
|
1017
|
+
public: clients.publicClient,
|
|
1018
|
+
wallet: clients.walletClient,
|
|
1019
|
+
},
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* Get the contract address
|
|
1024
|
+
*/
|
|
1025
|
+
get address() {
|
|
1026
|
+
return this.contractAddress;
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Get the underlying viem contract instance.
|
|
1030
|
+
*/
|
|
1031
|
+
getContract() {
|
|
1032
|
+
return this.contract;
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* _WETH
|
|
1036
|
+
* view
|
|
1037
|
+
*/
|
|
1038
|
+
async _WETH() {
|
|
1039
|
+
return this.contract.read._WETH();
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* getReserves
|
|
1043
|
+
* view
|
|
1044
|
+
*/
|
|
1045
|
+
async getReserves(token) {
|
|
1046
|
+
return this.contract.read.getReserves([token]);
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* isValidSignature
|
|
1050
|
+
* view
|
|
1051
|
+
*/
|
|
1052
|
+
async isValidSignature(hash, signature) {
|
|
1053
|
+
return this.contract.read.isValidSignature([hash, signature]);
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* name
|
|
1057
|
+
* view
|
|
1058
|
+
*/
|
|
1059
|
+
async name() {
|
|
1060
|
+
return this.contract.read.name();
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* nonces
|
|
1064
|
+
* view
|
|
1065
|
+
*/
|
|
1066
|
+
async nonces(arg0) {
|
|
1067
|
+
return this.contract.read.nonces([arg0]);
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* operations
|
|
1071
|
+
* view
|
|
1072
|
+
*/
|
|
1073
|
+
async operations() {
|
|
1074
|
+
return this.contract.read.operations();
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* router
|
|
1078
|
+
* view
|
|
1079
|
+
*/
|
|
1080
|
+
async router() {
|
|
1081
|
+
return this.contract.read.router();
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* signerConfiguration
|
|
1085
|
+
* view
|
|
1086
|
+
*/
|
|
1087
|
+
async signerConfiguration() {
|
|
1088
|
+
return this.contract.read.signerConfiguration();
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* xChainNonces
|
|
1092
|
+
* view
|
|
1093
|
+
*/
|
|
1094
|
+
async xChainNonces(arg0) {
|
|
1095
|
+
return this.contract.read.xChainNonces([arg0]);
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* approveToken
|
|
1099
|
+
* nonpayable
|
|
1100
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1101
|
+
*/
|
|
1102
|
+
async approveToken(token, spender, amount, options) {
|
|
1103
|
+
if (!this.contract.write) {
|
|
1104
|
+
throw new Error('Wallet client is required for write operations');
|
|
1105
|
+
}
|
|
1106
|
+
return this.contract.write.approveToken([token, spender, amount], options);
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* decreaseTokenAllowance
|
|
1110
|
+
* nonpayable
|
|
1111
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1112
|
+
*/
|
|
1113
|
+
async decreaseTokenAllowance(token, spender, amount, options) {
|
|
1114
|
+
if (!this.contract.write) {
|
|
1115
|
+
throw new Error('Wallet client is required for write operations');
|
|
1116
|
+
}
|
|
1117
|
+
return this.contract.write.decreaseTokenAllowance([token, spender, amount], options);
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* fillXChain
|
|
1121
|
+
* nonpayable
|
|
1122
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1123
|
+
*/
|
|
1124
|
+
async fillXChain(externalAccount, txid, trader, quoteToken, quoteTokenAmount, options) {
|
|
1125
|
+
if (!this.contract.write) {
|
|
1126
|
+
throw new Error('Wallet client is required for write operations');
|
|
1127
|
+
}
|
|
1128
|
+
return this.contract.write.fillXChain([externalAccount, txid, trader, quoteToken, quoteTokenAmount], options);
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* increaseTokenAllowance
|
|
1132
|
+
* nonpayable
|
|
1133
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1134
|
+
*/
|
|
1135
|
+
async increaseTokenAllowance(token, spender, amount, options) {
|
|
1136
|
+
if (!this.contract.write) {
|
|
1137
|
+
throw new Error('Wallet client is required for write operations');
|
|
1138
|
+
}
|
|
1139
|
+
return this.contract.write.increaseTokenAllowance([token, spender, amount], options);
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* initialize
|
|
1143
|
+
* nonpayable
|
|
1144
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1145
|
+
*/
|
|
1146
|
+
async initialize(_name, _signer, _operations, _router, options) {
|
|
1147
|
+
if (!this.contract.write) {
|
|
1148
|
+
throw new Error('Wallet client is required for write operations');
|
|
1149
|
+
}
|
|
1150
|
+
return this.contract.write.initialize([_name, _signer, _operations, _router], options);
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* killswitchOperations
|
|
1154
|
+
* nonpayable
|
|
1155
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1156
|
+
*/
|
|
1157
|
+
async killswitchOperations(enabled, options) {
|
|
1158
|
+
if (!this.contract.write) {
|
|
1159
|
+
throw new Error('Wallet client is required for write operations');
|
|
1160
|
+
}
|
|
1161
|
+
return this.contract.write.killswitchOperations([enabled], options);
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* removeLiquidity
|
|
1165
|
+
* nonpayable
|
|
1166
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1167
|
+
*/
|
|
1168
|
+
async removeLiquidity(token, recipient, amount, options) {
|
|
1169
|
+
if (!this.contract.write) {
|
|
1170
|
+
throw new Error('Wallet client is required for write operations');
|
|
1171
|
+
}
|
|
1172
|
+
return this.contract.write.removeLiquidity([token, recipient, amount], options);
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* tradeRFQM
|
|
1176
|
+
* nonpayable
|
|
1177
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1178
|
+
*/
|
|
1179
|
+
async tradeRFQM(quote, options) {
|
|
1180
|
+
if (!this.contract.write) {
|
|
1181
|
+
throw new Error('Wallet client is required for write operations');
|
|
1182
|
+
}
|
|
1183
|
+
return this.contract.write.tradeRFQM([quote], options);
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* tradeRFQT
|
|
1187
|
+
* payable
|
|
1188
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1189
|
+
*/
|
|
1190
|
+
async tradeRFQT(quote, options) {
|
|
1191
|
+
if (!this.contract.write) {
|
|
1192
|
+
throw new Error('Wallet client is required for write operations');
|
|
1193
|
+
}
|
|
1194
|
+
return this.contract.write.tradeRFQT([quote], options);
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* tradeXChainRFQM
|
|
1198
|
+
* nonpayable
|
|
1199
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1200
|
+
*/
|
|
1201
|
+
async tradeXChainRFQM(quote, options) {
|
|
1202
|
+
if (!this.contract.write) {
|
|
1203
|
+
throw new Error('Wallet client is required for write operations');
|
|
1204
|
+
}
|
|
1205
|
+
return this.contract.write.tradeXChainRFQM([quote], options);
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* tradeXChainRFQT
|
|
1209
|
+
* payable
|
|
1210
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1211
|
+
*/
|
|
1212
|
+
async tradeXChainRFQT(quote, trader, options) {
|
|
1213
|
+
if (!this.contract.write) {
|
|
1214
|
+
throw new Error('Wallet client is required for write operations');
|
|
1215
|
+
}
|
|
1216
|
+
return this.contract.write.tradeXChainRFQT([quote, trader], options);
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* updateSigner
|
|
1220
|
+
* nonpayable
|
|
1221
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1222
|
+
*/
|
|
1223
|
+
async updateSigner(newSigner, options) {
|
|
1224
|
+
if (!this.contract.write) {
|
|
1225
|
+
throw new Error('Wallet client is required for write operations');
|
|
1226
|
+
}
|
|
1227
|
+
return this.contract.write.updateSigner([newSigner], options);
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* updateWithdrawalAccount
|
|
1231
|
+
* nonpayable
|
|
1232
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1233
|
+
*/
|
|
1234
|
+
async updateWithdrawalAccount(withdrawalAccounts, authorized, options) {
|
|
1235
|
+
if (!this.contract.write) {
|
|
1236
|
+
throw new Error('Wallet client is required for write operations');
|
|
1237
|
+
}
|
|
1238
|
+
return this.contract.write.updateWithdrawalAccount([withdrawalAccounts, authorized], options);
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* updateXChainMessengerAuthorization
|
|
1242
|
+
* nonpayable
|
|
1243
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1244
|
+
*/
|
|
1245
|
+
async updateXChainMessengerAuthorization(xChainMessenger, authorized, options) {
|
|
1246
|
+
if (!this.contract.write) {
|
|
1247
|
+
throw new Error('Wallet client is required for write operations');
|
|
1248
|
+
}
|
|
1249
|
+
return this.contract.write.updateXChainMessengerAuthorization([xChainMessenger, authorized], options);
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* updateXChainPoolAuthorization
|
|
1253
|
+
* nonpayable
|
|
1254
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1255
|
+
*/
|
|
1256
|
+
async updateXChainPoolAuthorization(pools, status, options) {
|
|
1257
|
+
if (!this.contract.write) {
|
|
1258
|
+
throw new Error('Wallet client is required for write operations');
|
|
1259
|
+
}
|
|
1260
|
+
return this.contract.write.updateXChainPoolAuthorization([pools, status], options);
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
1264
|
+
*
|
|
1265
|
+
* @example
|
|
1266
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
1267
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
1268
|
+
* console.log('Would succeed:', result.result);
|
|
1269
|
+
*/
|
|
1270
|
+
get simulate() {
|
|
1271
|
+
const contract = this.contract;
|
|
1272
|
+
if (!contract.simulate) {
|
|
1273
|
+
throw new Error('Public client is required for simulation');
|
|
1274
|
+
}
|
|
1275
|
+
return {
|
|
1276
|
+
/**
|
|
1277
|
+
* Simulate approveToken
|
|
1278
|
+
* Returns gas estimate and result without sending transaction
|
|
1279
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1280
|
+
*/
|
|
1281
|
+
async approveToken(token, spender, amount, options) {
|
|
1282
|
+
return contract.simulate.approveToken([token, spender, amount], options);
|
|
1283
|
+
},
|
|
1284
|
+
/**
|
|
1285
|
+
* Simulate decreaseTokenAllowance
|
|
1286
|
+
* Returns gas estimate and result without sending transaction
|
|
1287
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1288
|
+
*/
|
|
1289
|
+
async decreaseTokenAllowance(token, spender, amount, options) {
|
|
1290
|
+
return contract.simulate.decreaseTokenAllowance([token, spender, amount], options);
|
|
1291
|
+
},
|
|
1292
|
+
/**
|
|
1293
|
+
* Simulate fillXChain
|
|
1294
|
+
* Returns gas estimate and result without sending transaction
|
|
1295
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1296
|
+
*/
|
|
1297
|
+
async fillXChain(externalAccount, txid, trader, quoteToken, quoteTokenAmount, options) {
|
|
1298
|
+
return contract.simulate.fillXChain([externalAccount, txid, trader, quoteToken, quoteTokenAmount], options);
|
|
1299
|
+
},
|
|
1300
|
+
/**
|
|
1301
|
+
* Simulate increaseTokenAllowance
|
|
1302
|
+
* Returns gas estimate and result without sending transaction
|
|
1303
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1304
|
+
*/
|
|
1305
|
+
async increaseTokenAllowance(token, spender, amount, options) {
|
|
1306
|
+
return contract.simulate.increaseTokenAllowance([token, spender, amount], options);
|
|
1307
|
+
},
|
|
1308
|
+
/**
|
|
1309
|
+
* Simulate initialize
|
|
1310
|
+
* Returns gas estimate and result without sending transaction
|
|
1311
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1312
|
+
*/
|
|
1313
|
+
async initialize(_name, _signer, _operations, _router, options) {
|
|
1314
|
+
return contract.simulate.initialize([_name, _signer, _operations, _router], options);
|
|
1315
|
+
},
|
|
1316
|
+
/**
|
|
1317
|
+
* Simulate killswitchOperations
|
|
1318
|
+
* Returns gas estimate and result without sending transaction
|
|
1319
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1320
|
+
*/
|
|
1321
|
+
async killswitchOperations(enabled, options) {
|
|
1322
|
+
return contract.simulate.killswitchOperations([enabled], options);
|
|
1323
|
+
},
|
|
1324
|
+
/**
|
|
1325
|
+
* Simulate removeLiquidity
|
|
1326
|
+
* Returns gas estimate and result without sending transaction
|
|
1327
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1328
|
+
*/
|
|
1329
|
+
async removeLiquidity(token, recipient, amount, options) {
|
|
1330
|
+
return contract.simulate.removeLiquidity([token, recipient, amount], options);
|
|
1331
|
+
},
|
|
1332
|
+
/**
|
|
1333
|
+
* Simulate tradeRFQM
|
|
1334
|
+
* Returns gas estimate and result without sending transaction
|
|
1335
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1336
|
+
*/
|
|
1337
|
+
async tradeRFQM(quote, options) {
|
|
1338
|
+
return contract.simulate.tradeRFQM([quote], options);
|
|
1339
|
+
},
|
|
1340
|
+
/**
|
|
1341
|
+
* Simulate tradeRFQT
|
|
1342
|
+
* Returns gas estimate and result without sending transaction
|
|
1343
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1344
|
+
*/
|
|
1345
|
+
async tradeRFQT(quote, options) {
|
|
1346
|
+
return contract.simulate.tradeRFQT([quote], options);
|
|
1347
|
+
},
|
|
1348
|
+
/**
|
|
1349
|
+
* Simulate tradeXChainRFQM
|
|
1350
|
+
* Returns gas estimate and result without sending transaction
|
|
1351
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1352
|
+
*/
|
|
1353
|
+
async tradeXChainRFQM(quote, options) {
|
|
1354
|
+
return contract.simulate.tradeXChainRFQM([quote], options);
|
|
1355
|
+
},
|
|
1356
|
+
/**
|
|
1357
|
+
* Simulate tradeXChainRFQT
|
|
1358
|
+
* Returns gas estimate and result without sending transaction
|
|
1359
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1360
|
+
*/
|
|
1361
|
+
async tradeXChainRFQT(quote, trader, options) {
|
|
1362
|
+
return contract.simulate.tradeXChainRFQT([quote, trader], options);
|
|
1363
|
+
},
|
|
1364
|
+
/**
|
|
1365
|
+
* Simulate updateSigner
|
|
1366
|
+
* Returns gas estimate and result without sending transaction
|
|
1367
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1368
|
+
*/
|
|
1369
|
+
async updateSigner(newSigner, options) {
|
|
1370
|
+
return contract.simulate.updateSigner([newSigner], options);
|
|
1371
|
+
},
|
|
1372
|
+
/**
|
|
1373
|
+
* Simulate updateWithdrawalAccount
|
|
1374
|
+
* Returns gas estimate and result without sending transaction
|
|
1375
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1376
|
+
*/
|
|
1377
|
+
async updateWithdrawalAccount(withdrawalAccounts, authorized, options) {
|
|
1378
|
+
return contract.simulate.updateWithdrawalAccount([withdrawalAccounts, authorized], options);
|
|
1379
|
+
},
|
|
1380
|
+
/**
|
|
1381
|
+
* Simulate updateXChainMessengerAuthorization
|
|
1382
|
+
* Returns gas estimate and result without sending transaction
|
|
1383
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1384
|
+
*/
|
|
1385
|
+
async updateXChainMessengerAuthorization(xChainMessenger, authorized, options) {
|
|
1386
|
+
return contract.simulate.updateXChainMessengerAuthorization([xChainMessenger, authorized], options);
|
|
1387
|
+
},
|
|
1388
|
+
/**
|
|
1389
|
+
* Simulate updateXChainPoolAuthorization
|
|
1390
|
+
* Returns gas estimate and result without sending transaction
|
|
1391
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1392
|
+
*/
|
|
1393
|
+
async updateXChainPoolAuthorization(pools, status, options) {
|
|
1394
|
+
return contract.simulate.updateXChainPoolAuthorization([pools, status], options);
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Watch contract events
|
|
1400
|
+
*
|
|
1401
|
+
* @example
|
|
1402
|
+
* // Watch all Transfer events
|
|
1403
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1404
|
+
* console.log('Transfer:', event);
|
|
1405
|
+
* });
|
|
1406
|
+
*
|
|
1407
|
+
* // Stop watching
|
|
1408
|
+
* unwatch();
|
|
1409
|
+
*/
|
|
1410
|
+
get watch() {
|
|
1411
|
+
return {
|
|
1412
|
+
/**
|
|
1413
|
+
* Watch Initialized events
|
|
1414
|
+
* @param callback Function to call when event is emitted
|
|
1415
|
+
* @param filter Optional filter for indexed parameters
|
|
1416
|
+
* @returns Unwatch function to stop listening
|
|
1417
|
+
*/
|
|
1418
|
+
Initialized: (callback) => {
|
|
1419
|
+
return this.publicClient.watchContractEvent({
|
|
1420
|
+
address: this.contractAddress,
|
|
1421
|
+
abi: exports.HashflowPoolAbi,
|
|
1422
|
+
eventName: 'Initialized',
|
|
1423
|
+
onLogs: (logs) => {
|
|
1424
|
+
logs.forEach((log) => {
|
|
1425
|
+
callback(log.args);
|
|
1426
|
+
});
|
|
1427
|
+
},
|
|
1428
|
+
});
|
|
1429
|
+
},
|
|
1430
|
+
/**
|
|
1431
|
+
* Watch RemoveLiquidity events
|
|
1432
|
+
* @param callback Function to call when event is emitted
|
|
1433
|
+
* @param filter Optional filter for indexed parameters
|
|
1434
|
+
* @returns Unwatch function to stop listening
|
|
1435
|
+
*/
|
|
1436
|
+
RemoveLiquidity: (callback) => {
|
|
1437
|
+
return this.publicClient.watchContractEvent({
|
|
1438
|
+
address: this.contractAddress,
|
|
1439
|
+
abi: exports.HashflowPoolAbi,
|
|
1440
|
+
eventName: 'RemoveLiquidity',
|
|
1441
|
+
onLogs: (logs) => {
|
|
1442
|
+
logs.forEach((log) => {
|
|
1443
|
+
callback(log.args);
|
|
1444
|
+
});
|
|
1445
|
+
},
|
|
1446
|
+
});
|
|
1447
|
+
},
|
|
1448
|
+
/**
|
|
1449
|
+
* Watch Trade events
|
|
1450
|
+
* @param callback Function to call when event is emitted
|
|
1451
|
+
* @param filter Optional filter for indexed parameters
|
|
1452
|
+
* @returns Unwatch function to stop listening
|
|
1453
|
+
*/
|
|
1454
|
+
Trade: (callback) => {
|
|
1455
|
+
return this.publicClient.watchContractEvent({
|
|
1456
|
+
address: this.contractAddress,
|
|
1457
|
+
abi: exports.HashflowPoolAbi,
|
|
1458
|
+
eventName: 'Trade',
|
|
1459
|
+
onLogs: (logs) => {
|
|
1460
|
+
logs.forEach((log) => {
|
|
1461
|
+
callback(log.args);
|
|
1462
|
+
});
|
|
1463
|
+
},
|
|
1464
|
+
});
|
|
1465
|
+
},
|
|
1466
|
+
/**
|
|
1467
|
+
* Watch UpdateSigner events
|
|
1468
|
+
* @param callback Function to call when event is emitted
|
|
1469
|
+
* @param filter Optional filter for indexed parameters
|
|
1470
|
+
* @returns Unwatch function to stop listening
|
|
1471
|
+
*/
|
|
1472
|
+
UpdateSigner: (callback) => {
|
|
1473
|
+
return this.publicClient.watchContractEvent({
|
|
1474
|
+
address: this.contractAddress,
|
|
1475
|
+
abi: exports.HashflowPoolAbi,
|
|
1476
|
+
eventName: 'UpdateSigner',
|
|
1477
|
+
onLogs: (logs) => {
|
|
1478
|
+
logs.forEach((log) => {
|
|
1479
|
+
callback(log.args);
|
|
1480
|
+
});
|
|
1481
|
+
},
|
|
1482
|
+
});
|
|
1483
|
+
},
|
|
1484
|
+
/**
|
|
1485
|
+
* Watch UpdateWithdrawalAccount events
|
|
1486
|
+
* @param callback Function to call when event is emitted
|
|
1487
|
+
* @param filter Optional filter for indexed parameters
|
|
1488
|
+
* @returns Unwatch function to stop listening
|
|
1489
|
+
*/
|
|
1490
|
+
UpdateWithdrawalAccount: (callback) => {
|
|
1491
|
+
return this.publicClient.watchContractEvent({
|
|
1492
|
+
address: this.contractAddress,
|
|
1493
|
+
abi: exports.HashflowPoolAbi,
|
|
1494
|
+
eventName: 'UpdateWithdrawalAccount',
|
|
1495
|
+
onLogs: (logs) => {
|
|
1496
|
+
logs.forEach((log) => {
|
|
1497
|
+
callback(log.args);
|
|
1498
|
+
});
|
|
1499
|
+
},
|
|
1500
|
+
});
|
|
1501
|
+
},
|
|
1502
|
+
/**
|
|
1503
|
+
* Watch XChainTrade events
|
|
1504
|
+
* @param callback Function to call when event is emitted
|
|
1505
|
+
* @param filter Optional filter for indexed parameters
|
|
1506
|
+
* @returns Unwatch function to stop listening
|
|
1507
|
+
*/
|
|
1508
|
+
XChainTrade: (callback) => {
|
|
1509
|
+
return this.publicClient.watchContractEvent({
|
|
1510
|
+
address: this.contractAddress,
|
|
1511
|
+
abi: exports.HashflowPoolAbi,
|
|
1512
|
+
eventName: 'XChainTrade',
|
|
1513
|
+
onLogs: (logs) => {
|
|
1514
|
+
logs.forEach((log) => {
|
|
1515
|
+
callback(log.args);
|
|
1516
|
+
});
|
|
1517
|
+
},
|
|
1518
|
+
});
|
|
1519
|
+
},
|
|
1520
|
+
/**
|
|
1521
|
+
* Watch XChainTradeFill events
|
|
1522
|
+
* @param callback Function to call when event is emitted
|
|
1523
|
+
* @param filter Optional filter for indexed parameters
|
|
1524
|
+
* @returns Unwatch function to stop listening
|
|
1525
|
+
*/
|
|
1526
|
+
XChainTradeFill: (callback) => {
|
|
1527
|
+
return this.publicClient.watchContractEvent({
|
|
1528
|
+
address: this.contractAddress,
|
|
1529
|
+
abi: exports.HashflowPoolAbi,
|
|
1530
|
+
eventName: 'XChainTradeFill',
|
|
1531
|
+
onLogs: (logs) => {
|
|
1532
|
+
logs.forEach((log) => {
|
|
1533
|
+
callback(log.args);
|
|
1534
|
+
});
|
|
1535
|
+
},
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
exports.HashflowPool = HashflowPool;
|