hermes-swap 0.0.11 → 0.0.13

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.
@@ -0,0 +1,80 @@
1
+ declare const QuoterAbi: ({
2
+ type: string;
3
+ inputs: {
4
+ name: string;
5
+ type: string;
6
+ internalType: string;
7
+ }[];
8
+ stateMutability: string;
9
+ name?: undefined;
10
+ outputs?: undefined;
11
+ anonymous?: undefined;
12
+ } | {
13
+ type: string;
14
+ name: string;
15
+ inputs: ({
16
+ name: string;
17
+ type: string;
18
+ internalType: string;
19
+ components?: undefined;
20
+ } | {
21
+ name: string;
22
+ type: string;
23
+ internalType: string;
24
+ components: {
25
+ name: string;
26
+ type: string;
27
+ internalType: string;
28
+ }[];
29
+ })[];
30
+ outputs: {
31
+ name: string;
32
+ type: string;
33
+ internalType: string;
34
+ }[];
35
+ stateMutability: string;
36
+ anonymous?: undefined;
37
+ } | {
38
+ type: string;
39
+ name: string;
40
+ inputs: {
41
+ name: string;
42
+ type: string;
43
+ internalType: string;
44
+ components: ({
45
+ name: string;
46
+ type: string;
47
+ internalType: string;
48
+ components?: undefined;
49
+ } | {
50
+ name: string;
51
+ type: string;
52
+ internalType: string;
53
+ components: {
54
+ name: string;
55
+ type: string;
56
+ internalType: string;
57
+ }[];
58
+ })[];
59
+ }[];
60
+ outputs: {
61
+ name: string;
62
+ type: string;
63
+ internalType: string;
64
+ }[];
65
+ stateMutability: string;
66
+ anonymous?: undefined;
67
+ } | {
68
+ type: string;
69
+ name: string;
70
+ inputs: {
71
+ name: string;
72
+ type: string;
73
+ indexed: boolean;
74
+ internalType: string;
75
+ }[];
76
+ anonymous: boolean;
77
+ stateMutability?: undefined;
78
+ outputs?: undefined;
79
+ })[];
80
+ export default QuoterAbi;
@@ -0,0 +1,524 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/abis/quoter.ts
20
+ var quoter_exports = {};
21
+ __export(quoter_exports, {
22
+ default: () => quoter_default
23
+ });
24
+ module.exports = __toCommonJS(quoter_exports);
25
+ var QuoterAbi = [
26
+ {
27
+ "type": "constructor",
28
+ "inputs": [
29
+ {
30
+ "name": "_owner",
31
+ "type": "address",
32
+ "internalType": "address"
33
+ },
34
+ {
35
+ "name": "_executor",
36
+ "type": "address",
37
+ "internalType": "address"
38
+ }
39
+ ],
40
+ "stateMutability": "nonpayable"
41
+ },
42
+ {
43
+ "type": "function",
44
+ "name": "addContract",
45
+ "inputs": [
46
+ {
47
+ "name": "contractType",
48
+ "type": "string",
49
+ "internalType": "string"
50
+ },
51
+ {
52
+ "name": "contractAddress",
53
+ "type": "address",
54
+ "internalType": "address"
55
+ }
56
+ ],
57
+ "outputs": [],
58
+ "stateMutability": "nonpayable"
59
+ },
60
+ {
61
+ "type": "function",
62
+ "name": "batchMultiQuote",
63
+ "inputs": [
64
+ {
65
+ "name": "amountInArr",
66
+ "type": "uint256[]",
67
+ "internalType": "uint256[]"
68
+ },
69
+ {
70
+ "name": "quoteParamsArr",
71
+ "type": "tuple[][]",
72
+ "internalType": "struct MultiQuoteParam[][]",
73
+ "components": [
74
+ {
75
+ "name": "dexType",
76
+ "type": "string",
77
+ "internalType": "string"
78
+ },
79
+ {
80
+ "name": "pool",
81
+ "type": "address",
82
+ "internalType": "address"
83
+ },
84
+ {
85
+ "name": "fromCoin",
86
+ "type": "address",
87
+ "internalType": "address"
88
+ },
89
+ {
90
+ "name": "toCoin",
91
+ "type": "address",
92
+ "internalType": "address"
93
+ },
94
+ {
95
+ "name": "extra",
96
+ "type": "bytes",
97
+ "internalType": "bytes"
98
+ }
99
+ ]
100
+ }
101
+ ],
102
+ "outputs": [
103
+ {
104
+ "name": "amountOutListArr",
105
+ "type": "uint256[][]",
106
+ "internalType": "uint256[][]"
107
+ }
108
+ ],
109
+ "stateMutability": "view"
110
+ },
111
+ {
112
+ "type": "function",
113
+ "name": "contractList",
114
+ "inputs": [
115
+ {
116
+ "name": "",
117
+ "type": "uint256",
118
+ "internalType": "uint256"
119
+ }
120
+ ],
121
+ "outputs": [
122
+ {
123
+ "name": "contractType",
124
+ "type": "string",
125
+ "internalType": "string"
126
+ },
127
+ {
128
+ "name": "contractAddress",
129
+ "type": "address",
130
+ "internalType": "address"
131
+ }
132
+ ],
133
+ "stateMutability": "view"
134
+ },
135
+ {
136
+ "type": "function",
137
+ "name": "contractMap",
138
+ "inputs": [
139
+ {
140
+ "name": "",
141
+ "type": "string",
142
+ "internalType": "string"
143
+ }
144
+ ],
145
+ "outputs": [
146
+ {
147
+ "name": "",
148
+ "type": "address",
149
+ "internalType": "address"
150
+ }
151
+ ],
152
+ "stateMutability": "view"
153
+ },
154
+ {
155
+ "type": "function",
156
+ "name": "executor",
157
+ "inputs": [],
158
+ "outputs": [
159
+ {
160
+ "name": "",
161
+ "type": "address",
162
+ "internalType": "address"
163
+ }
164
+ ],
165
+ "stateMutability": "view"
166
+ },
167
+ {
168
+ "type": "function",
169
+ "name": "getAddressList",
170
+ "inputs": [],
171
+ "outputs": [
172
+ {
173
+ "name": "",
174
+ "type": "address[]",
175
+ "internalType": "address[]"
176
+ }
177
+ ],
178
+ "stateMutability": "view"
179
+ },
180
+ {
181
+ "type": "function",
182
+ "name": "isAddressist",
183
+ "inputs": [
184
+ {
185
+ "name": "_address",
186
+ "type": "address",
187
+ "internalType": "address"
188
+ }
189
+ ],
190
+ "outputs": [
191
+ {
192
+ "name": "",
193
+ "type": "bool",
194
+ "internalType": "bool"
195
+ }
196
+ ],
197
+ "stateMutability": "view"
198
+ },
199
+ {
200
+ "type": "function",
201
+ "name": "isWhitelist",
202
+ "inputs": [
203
+ {
204
+ "name": "_address",
205
+ "type": "address",
206
+ "internalType": "address"
207
+ }
208
+ ],
209
+ "outputs": [
210
+ {
211
+ "name": "",
212
+ "type": "bool",
213
+ "internalType": "bool"
214
+ }
215
+ ],
216
+ "stateMutability": "view"
217
+ },
218
+ {
219
+ "type": "function",
220
+ "name": "multiQuote",
221
+ "inputs": [
222
+ {
223
+ "name": "amountIn",
224
+ "type": "uint256",
225
+ "internalType": "uint256"
226
+ },
227
+ {
228
+ "name": "quoteParams",
229
+ "type": "tuple[]",
230
+ "internalType": "struct MultiQuoteParam[]",
231
+ "components": [
232
+ {
233
+ "name": "dexType",
234
+ "type": "string",
235
+ "internalType": "string"
236
+ },
237
+ {
238
+ "name": "pool",
239
+ "type": "address",
240
+ "internalType": "address"
241
+ },
242
+ {
243
+ "name": "fromCoin",
244
+ "type": "address",
245
+ "internalType": "address"
246
+ },
247
+ {
248
+ "name": "toCoin",
249
+ "type": "address",
250
+ "internalType": "address"
251
+ },
252
+ {
253
+ "name": "extra",
254
+ "type": "bytes",
255
+ "internalType": "bytes"
256
+ }
257
+ ]
258
+ }
259
+ ],
260
+ "outputs": [
261
+ {
262
+ "name": "amountOutList",
263
+ "type": "uint256[]",
264
+ "internalType": "uint256[]"
265
+ }
266
+ ],
267
+ "stateMutability": "view"
268
+ },
269
+ {
270
+ "type": "function",
271
+ "name": "owner",
272
+ "inputs": [],
273
+ "outputs": [
274
+ {
275
+ "name": "",
276
+ "type": "address",
277
+ "internalType": "address"
278
+ }
279
+ ],
280
+ "stateMutability": "view"
281
+ },
282
+ {
283
+ "type": "function",
284
+ "name": "quote",
285
+ "inputs": [
286
+ {
287
+ "name": "quoteParam",
288
+ "type": "tuple",
289
+ "internalType": "struct SingleQuoteParam",
290
+ "components": [
291
+ {
292
+ "name": "amountIn",
293
+ "type": "uint256",
294
+ "internalType": "uint256"
295
+ },
296
+ {
297
+ "name": "dexType",
298
+ "type": "string",
299
+ "internalType": "string"
300
+ },
301
+ {
302
+ "name": "pool",
303
+ "type": "address",
304
+ "internalType": "address"
305
+ },
306
+ {
307
+ "name": "fromCoin",
308
+ "type": "address",
309
+ "internalType": "address"
310
+ },
311
+ {
312
+ "name": "toCoin",
313
+ "type": "address",
314
+ "internalType": "address"
315
+ },
316
+ {
317
+ "name": "extra",
318
+ "type": "bytes",
319
+ "internalType": "bytes"
320
+ }
321
+ ]
322
+ }
323
+ ],
324
+ "outputs": [
325
+ {
326
+ "name": "amountOut",
327
+ "type": "uint256",
328
+ "internalType": "uint256"
329
+ }
330
+ ],
331
+ "stateMutability": "view"
332
+ },
333
+ {
334
+ "type": "function",
335
+ "name": "quoteBridge",
336
+ "inputs": [
337
+ {
338
+ "name": "bridgeParams",
339
+ "type": "tuple",
340
+ "internalType": "struct BridgeParams",
341
+ "components": [
342
+ {
343
+ "name": "bridge",
344
+ "type": "string",
345
+ "internalType": "string"
346
+ },
347
+ {
348
+ "name": "bridgeParam",
349
+ "type": "tuple",
350
+ "internalType": "struct BridgeParam",
351
+ "components": [
352
+ {
353
+ "name": "token",
354
+ "type": "address",
355
+ "internalType": "address"
356
+ },
357
+ {
358
+ "name": "amount",
359
+ "type": "uint256",
360
+ "internalType": "uint256"
361
+ },
362
+ {
363
+ "name": "bridgeAddress",
364
+ "type": "address",
365
+ "internalType": "address"
366
+ },
367
+ {
368
+ "name": "refundAddress",
369
+ "type": "address",
370
+ "internalType": "address"
371
+ },
372
+ {
373
+ "name": "destinationChain",
374
+ "type": "string",
375
+ "internalType": "string"
376
+ },
377
+ {
378
+ "name": "adapterParams",
379
+ "type": "bytes",
380
+ "internalType": "bytes"
381
+ }
382
+ ]
383
+ }
384
+ ]
385
+ }
386
+ ],
387
+ "outputs": [
388
+ {
389
+ "name": "bridgeFee",
390
+ "type": "uint256",
391
+ "internalType": "uint256"
392
+ }
393
+ ],
394
+ "stateMutability": "view"
395
+ },
396
+ {
397
+ "type": "function",
398
+ "name": "removeContract",
399
+ "inputs": [
400
+ {
401
+ "name": "contractType",
402
+ "type": "string",
403
+ "internalType": "string"
404
+ }
405
+ ],
406
+ "outputs": [],
407
+ "stateMutability": "nonpayable"
408
+ },
409
+ {
410
+ "type": "function",
411
+ "name": "setExecutor",
412
+ "inputs": [
413
+ {
414
+ "name": "_executor",
415
+ "type": "address",
416
+ "internalType": "address"
417
+ }
418
+ ],
419
+ "outputs": [],
420
+ "stateMutability": "nonpayable"
421
+ },
422
+ {
423
+ "type": "function",
424
+ "name": "updateContract",
425
+ "inputs": [
426
+ {
427
+ "name": "contractType",
428
+ "type": "string",
429
+ "internalType": "string"
430
+ },
431
+ {
432
+ "name": "contractAddress",
433
+ "type": "address",
434
+ "internalType": "address"
435
+ }
436
+ ],
437
+ "outputs": [],
438
+ "stateMutability": "nonpayable"
439
+ },
440
+ {
441
+ "type": "function",
442
+ "name": "whitelistMap",
443
+ "inputs": [
444
+ {
445
+ "name": "",
446
+ "type": "address",
447
+ "internalType": "address"
448
+ }
449
+ ],
450
+ "outputs": [
451
+ {
452
+ "name": "",
453
+ "type": "bool",
454
+ "internalType": "bool"
455
+ }
456
+ ],
457
+ "stateMutability": "view"
458
+ },
459
+ {
460
+ "type": "event",
461
+ "name": "ContractAdded",
462
+ "inputs": [
463
+ {
464
+ "name": "contractType",
465
+ "type": "string",
466
+ "indexed": false,
467
+ "internalType": "string"
468
+ },
469
+ {
470
+ "name": "contractAddress",
471
+ "type": "address",
472
+ "indexed": false,
473
+ "internalType": "address"
474
+ }
475
+ ],
476
+ "anonymous": false
477
+ },
478
+ {
479
+ "type": "event",
480
+ "name": "ContractRemoved",
481
+ "inputs": [
482
+ {
483
+ "name": "contractType",
484
+ "type": "string",
485
+ "indexed": false,
486
+ "internalType": "string"
487
+ }
488
+ ],
489
+ "anonymous": false
490
+ },
491
+ {
492
+ "type": "event",
493
+ "name": "ContractUpdated",
494
+ "inputs": [
495
+ {
496
+ "name": "contractType",
497
+ "type": "string",
498
+ "indexed": false,
499
+ "internalType": "string"
500
+ },
501
+ {
502
+ "name": "contractAddress",
503
+ "type": "address",
504
+ "indexed": false,
505
+ "internalType": "address"
506
+ }
507
+ ],
508
+ "anonymous": false
509
+ },
510
+ {
511
+ "type": "event",
512
+ "name": "ExecutorUpdated",
513
+ "inputs": [
514
+ {
515
+ "name": "executor",
516
+ "type": "address",
517
+ "indexed": false,
518
+ "internalType": "address"
519
+ }
520
+ ],
521
+ "anonymous": false
522
+ }
523
+ ];
524
+ var quoter_default = QuoterAbi;
File without changes
File without changes
File without changes
File without changes
@@ -1,9 +1,18 @@
1
- import { IExpectParams, ISwapParams, IBridgeParams, ISwapAndBridgeParams, IReceipt } from './types';
1
+ import { IExpectParams, ISwapParams, IBridgeParams, ISwapAndBridgeParams, IReceipt, IConfig } from './types';
2
2
  declare class Hermes {
3
- constructor();
3
+ private config;
4
+ private providerMap;
5
+ private walletMap;
6
+ private quoterAddressMap;
7
+ private aggregatorAddressMap;
8
+ private executorMap;
9
+ constructor(config: IConfig);
4
10
  expect(params: IExpectParams): Promise<bigint>;
5
11
  swap(params: ISwapParams): Promise<IReceipt>;
6
12
  bridge(params: IBridgeParams): Promise<IReceipt>;
7
13
  swapAndBridge(params: ISwapAndBridgeParams): Promise<IReceipt>;
14
+ private validateParams;
15
+ private getQuoterAddress;
16
+ private getAggregatorAddress;
8
17
  }
9
18
  export default Hermes;