hermes-swap 0.0.21 → 0.0.22
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/dist/cjs/index.js +23 -4
- package/dist/cjs/types.d.ts +41 -4
- package/dist/esm/index.js +23 -4
- package/dist/esm/types.d.ts +41 -4
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -55,7 +55,6 @@ var Hermes = class {
|
|
|
55
55
|
this.walletMap.set(chainName, new import_ethers.ethers.Wallet(rpc.privateKey, provider));
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
console.log(Object.entries(this.config.rpc), this.walletMap);
|
|
59
58
|
for (const [chainName, quoterAddress] of Object.entries(this.config.quoterAddress)) {
|
|
60
59
|
this.quoterAddressMap.set(chainName, quoterAddress);
|
|
61
60
|
}
|
|
@@ -146,17 +145,37 @@ var Hermes = class {
|
|
|
146
145
|
return {
|
|
147
146
|
fromToken: fromTokenAddress,
|
|
148
147
|
toToken: toTokenAddress,
|
|
149
|
-
amountOut
|
|
148
|
+
amountOut,
|
|
149
|
+
hash: receipt.hash,
|
|
150
|
+
from: receipt.from,
|
|
151
|
+
to: receipt.from,
|
|
152
|
+
logs: receipt.logs
|
|
150
153
|
};
|
|
151
154
|
}
|
|
152
155
|
async bridge(params) {
|
|
153
156
|
this.validateParams(params);
|
|
154
|
-
const receipt = {
|
|
157
|
+
const receipt = {
|
|
158
|
+
fromToken: params.tokenAddress,
|
|
159
|
+
toToken: params.tokenAddress,
|
|
160
|
+
amountOut: params.amountInWei,
|
|
161
|
+
hash: "",
|
|
162
|
+
from: "",
|
|
163
|
+
to: "",
|
|
164
|
+
logs: []
|
|
165
|
+
};
|
|
155
166
|
return Promise.resolve(receipt);
|
|
156
167
|
}
|
|
157
168
|
async swapAndBridge(params) {
|
|
158
169
|
this.validateParams(params);
|
|
159
|
-
const receipt = {
|
|
170
|
+
const receipt = {
|
|
171
|
+
fromToken: params.path[0].fromCoinAddress,
|
|
172
|
+
toToken: params.path[params.path.length - 1].toCoinAddress,
|
|
173
|
+
amountOut: params.minAmountOutList[params.minAmountOutList.length - 1],
|
|
174
|
+
hash: "",
|
|
175
|
+
from: "",
|
|
176
|
+
to: "",
|
|
177
|
+
logs: []
|
|
178
|
+
};
|
|
160
179
|
return Promise.resolve(receipt);
|
|
161
180
|
}
|
|
162
181
|
validateParams(params) {
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BytesLike } from 'ethers';
|
|
1
|
+
import type { BytesLike, JsonRpcProvider } from 'ethers';
|
|
2
2
|
export interface IConfig {
|
|
3
3
|
rpc: Record<string, IRpcConfig>;
|
|
4
4
|
quoterAddress: Record<string, string>;
|
|
@@ -39,9 +39,46 @@ export interface ISwapAndBridgeParams {
|
|
|
39
39
|
extra?: BytesLike;
|
|
40
40
|
}
|
|
41
41
|
export interface IReceipt {
|
|
42
|
-
fromToken
|
|
43
|
-
toToken
|
|
44
|
-
amountOut
|
|
42
|
+
fromToken: string;
|
|
43
|
+
toToken: string;
|
|
44
|
+
amountOut: bigint;
|
|
45
|
+
hash: string;
|
|
46
|
+
from: string;
|
|
47
|
+
to: string;
|
|
48
|
+
logs: ILog[];
|
|
49
|
+
}
|
|
50
|
+
export interface IEthersReceipt {
|
|
51
|
+
provider: JsonRpcProvider;
|
|
52
|
+
to: string;
|
|
53
|
+
from: string;
|
|
54
|
+
contractAddress: string | null;
|
|
55
|
+
hash: string;
|
|
56
|
+
index: number;
|
|
57
|
+
blockHash: string;
|
|
58
|
+
blockNumber: number;
|
|
59
|
+
logsBloom: string;
|
|
60
|
+
gasUsed: bigint;
|
|
61
|
+
blobGasUsed: null;
|
|
62
|
+
cumulativeGasUsed: bigint;
|
|
63
|
+
gasPrice: bigint;
|
|
64
|
+
blobGasPrice: null;
|
|
65
|
+
type: number;
|
|
66
|
+
status: number;
|
|
67
|
+
root: undefined;
|
|
68
|
+
logs: ILog[];
|
|
69
|
+
}
|
|
70
|
+
export interface ILog {
|
|
71
|
+
provider: JsonRpcProvider;
|
|
72
|
+
transactionHash: string;
|
|
73
|
+
blockHash: string;
|
|
74
|
+
blockNumber: number;
|
|
75
|
+
removed: undefined;
|
|
76
|
+
address: string;
|
|
77
|
+
data: string;
|
|
78
|
+
topics: string[];
|
|
79
|
+
index: number;
|
|
80
|
+
transactionIndex: number;
|
|
81
|
+
args: any[];
|
|
45
82
|
}
|
|
46
83
|
export declare enum DexType {
|
|
47
84
|
FX = "f(x)"
|
package/dist/esm/index.js
CHANGED
|
@@ -43,7 +43,6 @@ var Hermes = /*#__PURE__*/function () {
|
|
|
43
43
|
this.walletMap.set(chainName, new ethers.Wallet(rpc.privateKey, provider));
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
console.log(Object.entries(this.config.rpc), this.walletMap);
|
|
47
46
|
for (var _i2 = 0, _Object$entries2 = Object.entries(this.config.quoterAddress); _i2 < _Object$entries2.length; _i2++) {
|
|
48
47
|
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
49
48
|
_chainName = _Object$entries2$_i[0],
|
|
@@ -247,7 +246,11 @@ var Hermes = /*#__PURE__*/function () {
|
|
|
247
246
|
return _context2.abrupt("return", {
|
|
248
247
|
fromToken: fromTokenAddress,
|
|
249
248
|
toToken: toTokenAddress,
|
|
250
|
-
amountOut: amountOut
|
|
249
|
+
amountOut: amountOut,
|
|
250
|
+
hash: receipt.hash,
|
|
251
|
+
from: receipt.from,
|
|
252
|
+
to: receipt.from,
|
|
253
|
+
logs: receipt.logs
|
|
251
254
|
});
|
|
252
255
|
case 76:
|
|
253
256
|
case "end":
|
|
@@ -269,7 +272,15 @@ var Hermes = /*#__PURE__*/function () {
|
|
|
269
272
|
while (1) switch (_context3.prev = _context3.next) {
|
|
270
273
|
case 0:
|
|
271
274
|
this.validateParams(params);
|
|
272
|
-
receipt = {
|
|
275
|
+
receipt = {
|
|
276
|
+
fromToken: params.tokenAddress,
|
|
277
|
+
toToken: params.tokenAddress,
|
|
278
|
+
amountOut: params.amountInWei,
|
|
279
|
+
hash: '',
|
|
280
|
+
from: '',
|
|
281
|
+
to: '',
|
|
282
|
+
logs: []
|
|
283
|
+
};
|
|
273
284
|
return _context3.abrupt("return", Promise.resolve(receipt));
|
|
274
285
|
case 3:
|
|
275
286
|
case "end":
|
|
@@ -291,7 +302,15 @@ var Hermes = /*#__PURE__*/function () {
|
|
|
291
302
|
while (1) switch (_context4.prev = _context4.next) {
|
|
292
303
|
case 0:
|
|
293
304
|
this.validateParams(params);
|
|
294
|
-
receipt = {
|
|
305
|
+
receipt = {
|
|
306
|
+
fromToken: params.path[0].fromCoinAddress,
|
|
307
|
+
toToken: params.path[params.path.length - 1].toCoinAddress,
|
|
308
|
+
amountOut: params.minAmountOutList[params.minAmountOutList.length - 1],
|
|
309
|
+
hash: '',
|
|
310
|
+
from: '',
|
|
311
|
+
to: '',
|
|
312
|
+
logs: []
|
|
313
|
+
};
|
|
295
314
|
return _context4.abrupt("return", Promise.resolve(receipt));
|
|
296
315
|
case 3:
|
|
297
316
|
case "end":
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BytesLike } from 'ethers';
|
|
1
|
+
import type { BytesLike, JsonRpcProvider } from 'ethers';
|
|
2
2
|
export interface IConfig {
|
|
3
3
|
rpc: Record<string, IRpcConfig>;
|
|
4
4
|
quoterAddress: Record<string, string>;
|
|
@@ -39,9 +39,46 @@ export interface ISwapAndBridgeParams {
|
|
|
39
39
|
extra?: BytesLike;
|
|
40
40
|
}
|
|
41
41
|
export interface IReceipt {
|
|
42
|
-
fromToken
|
|
43
|
-
toToken
|
|
44
|
-
amountOut
|
|
42
|
+
fromToken: string;
|
|
43
|
+
toToken: string;
|
|
44
|
+
amountOut: bigint;
|
|
45
|
+
hash: string;
|
|
46
|
+
from: string;
|
|
47
|
+
to: string;
|
|
48
|
+
logs: ILog[];
|
|
49
|
+
}
|
|
50
|
+
export interface IEthersReceipt {
|
|
51
|
+
provider: JsonRpcProvider;
|
|
52
|
+
to: string;
|
|
53
|
+
from: string;
|
|
54
|
+
contractAddress: string | null;
|
|
55
|
+
hash: string;
|
|
56
|
+
index: number;
|
|
57
|
+
blockHash: string;
|
|
58
|
+
blockNumber: number;
|
|
59
|
+
logsBloom: string;
|
|
60
|
+
gasUsed: bigint;
|
|
61
|
+
blobGasUsed: null;
|
|
62
|
+
cumulativeGasUsed: bigint;
|
|
63
|
+
gasPrice: bigint;
|
|
64
|
+
blobGasPrice: null;
|
|
65
|
+
type: number;
|
|
66
|
+
status: number;
|
|
67
|
+
root: undefined;
|
|
68
|
+
logs: ILog[];
|
|
69
|
+
}
|
|
70
|
+
export interface ILog {
|
|
71
|
+
provider: JsonRpcProvider;
|
|
72
|
+
transactionHash: string;
|
|
73
|
+
blockHash: string;
|
|
74
|
+
blockNumber: number;
|
|
75
|
+
removed: undefined;
|
|
76
|
+
address: string;
|
|
77
|
+
data: string;
|
|
78
|
+
topics: string[];
|
|
79
|
+
index: number;
|
|
80
|
+
transactionIndex: number;
|
|
81
|
+
args: any[];
|
|
45
82
|
}
|
|
46
83
|
export declare enum DexType {
|
|
47
84
|
FX = "f(x)"
|