hermes-swap 0.0.11 → 0.0.12
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 +2 -0
- package/dist/cjs/abis/quoter.d.ts +80 -0
- package/dist/cjs/abis/quoter.js +524 -0
- package/dist/cjs/bridge/index.d.ts +0 -0
- package/dist/cjs/bridge/index.js +0 -0
- package/dist/cjs/dex/index.d.ts +0 -0
- package/dist/cjs/dex/index.js +0 -0
- package/dist/cjs/index.d.ts +13 -2
- package/dist/cjs/index.js +128 -3
- package/dist/cjs/types.d.ts +194 -0
- package/dist/cjs/types.js +190 -0
- package/dist/esm/abis/quoter.d.ts +80 -0
- package/dist/esm/abis/quoter.js +381 -0
- package/dist/esm/bridge/index.d.ts +0 -0
- package/dist/esm/bridge/index.js +0 -0
- package/dist/esm/dex/index.d.ts +0 -0
- package/dist/esm/dex/index.js +5 -0
- package/dist/esm/index.d.ts +13 -2
- package/dist/esm/index.js +244 -4
- package/dist/esm/types.d.ts +194 -0
- package/dist/esm/types.js +175 -1
- package/package.json +5 -1
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
var QuoterAbi = [{
|
|
2
|
+
"type": "constructor",
|
|
3
|
+
"inputs": [{
|
|
4
|
+
"name": "_owner",
|
|
5
|
+
"type": "address",
|
|
6
|
+
"internalType": "address"
|
|
7
|
+
}, {
|
|
8
|
+
"name": "_executor",
|
|
9
|
+
"type": "address",
|
|
10
|
+
"internalType": "address"
|
|
11
|
+
}],
|
|
12
|
+
"stateMutability": "nonpayable"
|
|
13
|
+
}, {
|
|
14
|
+
"type": "function",
|
|
15
|
+
"name": "addContract",
|
|
16
|
+
"inputs": [{
|
|
17
|
+
"name": "contractType",
|
|
18
|
+
"type": "string",
|
|
19
|
+
"internalType": "string"
|
|
20
|
+
}, {
|
|
21
|
+
"name": "contractAddress",
|
|
22
|
+
"type": "address",
|
|
23
|
+
"internalType": "address"
|
|
24
|
+
}],
|
|
25
|
+
"outputs": [],
|
|
26
|
+
"stateMutability": "nonpayable"
|
|
27
|
+
}, {
|
|
28
|
+
"type": "function",
|
|
29
|
+
"name": "batchMultiQuote",
|
|
30
|
+
"inputs": [{
|
|
31
|
+
"name": "amountInArr",
|
|
32
|
+
"type": "uint256[]",
|
|
33
|
+
"internalType": "uint256[]"
|
|
34
|
+
}, {
|
|
35
|
+
"name": "quoteParamsArr",
|
|
36
|
+
"type": "tuple[][]",
|
|
37
|
+
"internalType": "struct MultiQuoteParam[][]",
|
|
38
|
+
"components": [{
|
|
39
|
+
"name": "dexType",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"internalType": "string"
|
|
42
|
+
}, {
|
|
43
|
+
"name": "pool",
|
|
44
|
+
"type": "address",
|
|
45
|
+
"internalType": "address"
|
|
46
|
+
}, {
|
|
47
|
+
"name": "fromCoin",
|
|
48
|
+
"type": "address",
|
|
49
|
+
"internalType": "address"
|
|
50
|
+
}, {
|
|
51
|
+
"name": "toCoin",
|
|
52
|
+
"type": "address",
|
|
53
|
+
"internalType": "address"
|
|
54
|
+
}, {
|
|
55
|
+
"name": "extra",
|
|
56
|
+
"type": "bytes",
|
|
57
|
+
"internalType": "bytes"
|
|
58
|
+
}]
|
|
59
|
+
}],
|
|
60
|
+
"outputs": [{
|
|
61
|
+
"name": "amountOutListArr",
|
|
62
|
+
"type": "uint256[][]",
|
|
63
|
+
"internalType": "uint256[][]"
|
|
64
|
+
}],
|
|
65
|
+
"stateMutability": "view"
|
|
66
|
+
}, {
|
|
67
|
+
"type": "function",
|
|
68
|
+
"name": "contractList",
|
|
69
|
+
"inputs": [{
|
|
70
|
+
"name": "",
|
|
71
|
+
"type": "uint256",
|
|
72
|
+
"internalType": "uint256"
|
|
73
|
+
}],
|
|
74
|
+
"outputs": [{
|
|
75
|
+
"name": "contractType",
|
|
76
|
+
"type": "string",
|
|
77
|
+
"internalType": "string"
|
|
78
|
+
}, {
|
|
79
|
+
"name": "contractAddress",
|
|
80
|
+
"type": "address",
|
|
81
|
+
"internalType": "address"
|
|
82
|
+
}],
|
|
83
|
+
"stateMutability": "view"
|
|
84
|
+
}, {
|
|
85
|
+
"type": "function",
|
|
86
|
+
"name": "contractMap",
|
|
87
|
+
"inputs": [{
|
|
88
|
+
"name": "",
|
|
89
|
+
"type": "string",
|
|
90
|
+
"internalType": "string"
|
|
91
|
+
}],
|
|
92
|
+
"outputs": [{
|
|
93
|
+
"name": "",
|
|
94
|
+
"type": "address",
|
|
95
|
+
"internalType": "address"
|
|
96
|
+
}],
|
|
97
|
+
"stateMutability": "view"
|
|
98
|
+
}, {
|
|
99
|
+
"type": "function",
|
|
100
|
+
"name": "executor",
|
|
101
|
+
"inputs": [],
|
|
102
|
+
"outputs": [{
|
|
103
|
+
"name": "",
|
|
104
|
+
"type": "address",
|
|
105
|
+
"internalType": "address"
|
|
106
|
+
}],
|
|
107
|
+
"stateMutability": "view"
|
|
108
|
+
}, {
|
|
109
|
+
"type": "function",
|
|
110
|
+
"name": "getAddressList",
|
|
111
|
+
"inputs": [],
|
|
112
|
+
"outputs": [{
|
|
113
|
+
"name": "",
|
|
114
|
+
"type": "address[]",
|
|
115
|
+
"internalType": "address[]"
|
|
116
|
+
}],
|
|
117
|
+
"stateMutability": "view"
|
|
118
|
+
}, {
|
|
119
|
+
"type": "function",
|
|
120
|
+
"name": "isAddressist",
|
|
121
|
+
"inputs": [{
|
|
122
|
+
"name": "_address",
|
|
123
|
+
"type": "address",
|
|
124
|
+
"internalType": "address"
|
|
125
|
+
}],
|
|
126
|
+
"outputs": [{
|
|
127
|
+
"name": "",
|
|
128
|
+
"type": "bool",
|
|
129
|
+
"internalType": "bool"
|
|
130
|
+
}],
|
|
131
|
+
"stateMutability": "view"
|
|
132
|
+
}, {
|
|
133
|
+
"type": "function",
|
|
134
|
+
"name": "isWhitelist",
|
|
135
|
+
"inputs": [{
|
|
136
|
+
"name": "_address",
|
|
137
|
+
"type": "address",
|
|
138
|
+
"internalType": "address"
|
|
139
|
+
}],
|
|
140
|
+
"outputs": [{
|
|
141
|
+
"name": "",
|
|
142
|
+
"type": "bool",
|
|
143
|
+
"internalType": "bool"
|
|
144
|
+
}],
|
|
145
|
+
"stateMutability": "view"
|
|
146
|
+
}, {
|
|
147
|
+
"type": "function",
|
|
148
|
+
"name": "multiQuote",
|
|
149
|
+
"inputs": [{
|
|
150
|
+
"name": "amountIn",
|
|
151
|
+
"type": "uint256",
|
|
152
|
+
"internalType": "uint256"
|
|
153
|
+
}, {
|
|
154
|
+
"name": "quoteParams",
|
|
155
|
+
"type": "tuple[]",
|
|
156
|
+
"internalType": "struct MultiQuoteParam[]",
|
|
157
|
+
"components": [{
|
|
158
|
+
"name": "dexType",
|
|
159
|
+
"type": "string",
|
|
160
|
+
"internalType": "string"
|
|
161
|
+
}, {
|
|
162
|
+
"name": "pool",
|
|
163
|
+
"type": "address",
|
|
164
|
+
"internalType": "address"
|
|
165
|
+
}, {
|
|
166
|
+
"name": "fromCoin",
|
|
167
|
+
"type": "address",
|
|
168
|
+
"internalType": "address"
|
|
169
|
+
}, {
|
|
170
|
+
"name": "toCoin",
|
|
171
|
+
"type": "address",
|
|
172
|
+
"internalType": "address"
|
|
173
|
+
}, {
|
|
174
|
+
"name": "extra",
|
|
175
|
+
"type": "bytes",
|
|
176
|
+
"internalType": "bytes"
|
|
177
|
+
}]
|
|
178
|
+
}],
|
|
179
|
+
"outputs": [{
|
|
180
|
+
"name": "amountOutList",
|
|
181
|
+
"type": "uint256[]",
|
|
182
|
+
"internalType": "uint256[]"
|
|
183
|
+
}],
|
|
184
|
+
"stateMutability": "view"
|
|
185
|
+
}, {
|
|
186
|
+
"type": "function",
|
|
187
|
+
"name": "owner",
|
|
188
|
+
"inputs": [],
|
|
189
|
+
"outputs": [{
|
|
190
|
+
"name": "",
|
|
191
|
+
"type": "address",
|
|
192
|
+
"internalType": "address"
|
|
193
|
+
}],
|
|
194
|
+
"stateMutability": "view"
|
|
195
|
+
}, {
|
|
196
|
+
"type": "function",
|
|
197
|
+
"name": "quote",
|
|
198
|
+
"inputs": [{
|
|
199
|
+
"name": "quoteParam",
|
|
200
|
+
"type": "tuple",
|
|
201
|
+
"internalType": "struct SingleQuoteParam",
|
|
202
|
+
"components": [{
|
|
203
|
+
"name": "amountIn",
|
|
204
|
+
"type": "uint256",
|
|
205
|
+
"internalType": "uint256"
|
|
206
|
+
}, {
|
|
207
|
+
"name": "dexType",
|
|
208
|
+
"type": "string",
|
|
209
|
+
"internalType": "string"
|
|
210
|
+
}, {
|
|
211
|
+
"name": "pool",
|
|
212
|
+
"type": "address",
|
|
213
|
+
"internalType": "address"
|
|
214
|
+
}, {
|
|
215
|
+
"name": "fromCoin",
|
|
216
|
+
"type": "address",
|
|
217
|
+
"internalType": "address"
|
|
218
|
+
}, {
|
|
219
|
+
"name": "toCoin",
|
|
220
|
+
"type": "address",
|
|
221
|
+
"internalType": "address"
|
|
222
|
+
}, {
|
|
223
|
+
"name": "extra",
|
|
224
|
+
"type": "bytes",
|
|
225
|
+
"internalType": "bytes"
|
|
226
|
+
}]
|
|
227
|
+
}],
|
|
228
|
+
"outputs": [{
|
|
229
|
+
"name": "amountOut",
|
|
230
|
+
"type": "uint256",
|
|
231
|
+
"internalType": "uint256"
|
|
232
|
+
}],
|
|
233
|
+
"stateMutability": "view"
|
|
234
|
+
}, {
|
|
235
|
+
"type": "function",
|
|
236
|
+
"name": "quoteBridge",
|
|
237
|
+
"inputs": [{
|
|
238
|
+
"name": "bridgeParams",
|
|
239
|
+
"type": "tuple",
|
|
240
|
+
"internalType": "struct BridgeParams",
|
|
241
|
+
"components": [{
|
|
242
|
+
"name": "bridge",
|
|
243
|
+
"type": "string",
|
|
244
|
+
"internalType": "string"
|
|
245
|
+
}, {
|
|
246
|
+
"name": "bridgeParam",
|
|
247
|
+
"type": "tuple",
|
|
248
|
+
"internalType": "struct BridgeParam",
|
|
249
|
+
"components": [{
|
|
250
|
+
"name": "token",
|
|
251
|
+
"type": "address",
|
|
252
|
+
"internalType": "address"
|
|
253
|
+
}, {
|
|
254
|
+
"name": "amount",
|
|
255
|
+
"type": "uint256",
|
|
256
|
+
"internalType": "uint256"
|
|
257
|
+
}, {
|
|
258
|
+
"name": "bridgeAddress",
|
|
259
|
+
"type": "address",
|
|
260
|
+
"internalType": "address"
|
|
261
|
+
}, {
|
|
262
|
+
"name": "refundAddress",
|
|
263
|
+
"type": "address",
|
|
264
|
+
"internalType": "address"
|
|
265
|
+
}, {
|
|
266
|
+
"name": "destinationChain",
|
|
267
|
+
"type": "string",
|
|
268
|
+
"internalType": "string"
|
|
269
|
+
}, {
|
|
270
|
+
"name": "adapterParams",
|
|
271
|
+
"type": "bytes",
|
|
272
|
+
"internalType": "bytes"
|
|
273
|
+
}]
|
|
274
|
+
}]
|
|
275
|
+
}],
|
|
276
|
+
"outputs": [{
|
|
277
|
+
"name": "bridgeFee",
|
|
278
|
+
"type": "uint256",
|
|
279
|
+
"internalType": "uint256"
|
|
280
|
+
}],
|
|
281
|
+
"stateMutability": "view"
|
|
282
|
+
}, {
|
|
283
|
+
"type": "function",
|
|
284
|
+
"name": "removeContract",
|
|
285
|
+
"inputs": [{
|
|
286
|
+
"name": "contractType",
|
|
287
|
+
"type": "string",
|
|
288
|
+
"internalType": "string"
|
|
289
|
+
}],
|
|
290
|
+
"outputs": [],
|
|
291
|
+
"stateMutability": "nonpayable"
|
|
292
|
+
}, {
|
|
293
|
+
"type": "function",
|
|
294
|
+
"name": "setExecutor",
|
|
295
|
+
"inputs": [{
|
|
296
|
+
"name": "_executor",
|
|
297
|
+
"type": "address",
|
|
298
|
+
"internalType": "address"
|
|
299
|
+
}],
|
|
300
|
+
"outputs": [],
|
|
301
|
+
"stateMutability": "nonpayable"
|
|
302
|
+
}, {
|
|
303
|
+
"type": "function",
|
|
304
|
+
"name": "updateContract",
|
|
305
|
+
"inputs": [{
|
|
306
|
+
"name": "contractType",
|
|
307
|
+
"type": "string",
|
|
308
|
+
"internalType": "string"
|
|
309
|
+
}, {
|
|
310
|
+
"name": "contractAddress",
|
|
311
|
+
"type": "address",
|
|
312
|
+
"internalType": "address"
|
|
313
|
+
}],
|
|
314
|
+
"outputs": [],
|
|
315
|
+
"stateMutability": "nonpayable"
|
|
316
|
+
}, {
|
|
317
|
+
"type": "function",
|
|
318
|
+
"name": "whitelistMap",
|
|
319
|
+
"inputs": [{
|
|
320
|
+
"name": "",
|
|
321
|
+
"type": "address",
|
|
322
|
+
"internalType": "address"
|
|
323
|
+
}],
|
|
324
|
+
"outputs": [{
|
|
325
|
+
"name": "",
|
|
326
|
+
"type": "bool",
|
|
327
|
+
"internalType": "bool"
|
|
328
|
+
}],
|
|
329
|
+
"stateMutability": "view"
|
|
330
|
+
}, {
|
|
331
|
+
"type": "event",
|
|
332
|
+
"name": "ContractAdded",
|
|
333
|
+
"inputs": [{
|
|
334
|
+
"name": "contractType",
|
|
335
|
+
"type": "string",
|
|
336
|
+
"indexed": false,
|
|
337
|
+
"internalType": "string"
|
|
338
|
+
}, {
|
|
339
|
+
"name": "contractAddress",
|
|
340
|
+
"type": "address",
|
|
341
|
+
"indexed": false,
|
|
342
|
+
"internalType": "address"
|
|
343
|
+
}],
|
|
344
|
+
"anonymous": false
|
|
345
|
+
}, {
|
|
346
|
+
"type": "event",
|
|
347
|
+
"name": "ContractRemoved",
|
|
348
|
+
"inputs": [{
|
|
349
|
+
"name": "contractType",
|
|
350
|
+
"type": "string",
|
|
351
|
+
"indexed": false,
|
|
352
|
+
"internalType": "string"
|
|
353
|
+
}],
|
|
354
|
+
"anonymous": false
|
|
355
|
+
}, {
|
|
356
|
+
"type": "event",
|
|
357
|
+
"name": "ContractUpdated",
|
|
358
|
+
"inputs": [{
|
|
359
|
+
"name": "contractType",
|
|
360
|
+
"type": "string",
|
|
361
|
+
"indexed": false,
|
|
362
|
+
"internalType": "string"
|
|
363
|
+
}, {
|
|
364
|
+
"name": "contractAddress",
|
|
365
|
+
"type": "address",
|
|
366
|
+
"indexed": false,
|
|
367
|
+
"internalType": "address"
|
|
368
|
+
}],
|
|
369
|
+
"anonymous": false
|
|
370
|
+
}, {
|
|
371
|
+
"type": "event",
|
|
372
|
+
"name": "ExecutorUpdated",
|
|
373
|
+
"inputs": [{
|
|
374
|
+
"name": "executor",
|
|
375
|
+
"type": "address",
|
|
376
|
+
"indexed": false,
|
|
377
|
+
"internalType": "address"
|
|
378
|
+
}],
|
|
379
|
+
"anonymous": false
|
|
380
|
+
}];
|
|
381
|
+
export default QuoterAbi;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
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
|
-
|
|
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 getAllTokenPair;
|
|
16
|
+
private getTokenPair;
|
|
17
|
+
private getQuoterAddress;
|
|
18
|
+
private getAggregatorAddress;
|
|
8
19
|
}
|
|
9
20
|
export default Hermes;
|