hermes-swap 0.0.30 → 0.0.31
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 +9 -10
- package/dist/cjs/types.d.ts +7 -1
- package/dist/cjs/types.js +7 -1
- package/dist/esm/index.js +9 -10
- package/dist/esm/types.d.ts +7 -1
- package/dist/esm/types.js +7 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -450,19 +450,18 @@ var Hermes = class {
|
|
|
450
450
|
toCoin: pathItem.toCoinAddress,
|
|
451
451
|
extra: pathItem.extra ?? "0x"
|
|
452
452
|
}));
|
|
453
|
-
const
|
|
453
|
+
const bridgeParam = {
|
|
454
454
|
bridge: params.bridgeType,
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
adapterParams: params.extra ?? "0x"
|
|
462
|
-
}
|
|
455
|
+
token: params.tokenAddress,
|
|
456
|
+
amount: params.amountInWei,
|
|
457
|
+
bridgeAddress: params.bridgeAddress,
|
|
458
|
+
destChain: params.destChain,
|
|
459
|
+
destUser: params.destUser,
|
|
460
|
+
extra: params.extra ?? "0x"
|
|
463
461
|
};
|
|
462
|
+
const amountIn = params.amountInWei;
|
|
464
463
|
const iface = new import_ethers.ethers.Interface(import_aggregator.default);
|
|
465
|
-
const calldata = iface.encodeFunctionData("swapAndBridge", [params.user,
|
|
464
|
+
const calldata = iface.encodeFunctionData("swapAndBridge", [params.user, amountIn, swapParams, params.minAmountOutList, bridgeParam]);
|
|
466
465
|
return {
|
|
467
466
|
to: aggregatorAddress,
|
|
468
467
|
data: calldata,
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -102,12 +102,14 @@ export declare enum DexType {
|
|
|
102
102
|
CURVE256 = "curve256",
|
|
103
103
|
CAMELOTV2 = "camelotv2",
|
|
104
104
|
PANCAKEV2 = "pancakev2",
|
|
105
|
+
AERODROME = "aerodrome",
|
|
105
106
|
PANCAKEV3 = "pancakev3",
|
|
106
107
|
CURVE128PAYABLE = "curve128_payable",
|
|
107
108
|
CURVE256PAYABLE = "curve256_payable",
|
|
108
109
|
VSDCRVWITHDRAW = "vsdCRV_withdraw",
|
|
109
110
|
VSDCRVDEPOSIT = "vsdCRV_deposit",
|
|
110
|
-
ASDCRVWITHDRAW = "asdCRV_withdraw"
|
|
111
|
+
ASDCRVWITHDRAW = "asdCRV_withdraw",
|
|
112
|
+
ASDCRVDEPOSIT = "asdCRV_deposit"
|
|
111
113
|
}
|
|
112
114
|
export declare enum IEstimateType {
|
|
113
115
|
BRIDGE = "bridge",
|
|
@@ -285,6 +287,7 @@ export declare const AddressConst: {
|
|
|
285
287
|
weth: {
|
|
286
288
|
eth: string;
|
|
287
289
|
arb: string;
|
|
290
|
+
base: string;
|
|
288
291
|
};
|
|
289
292
|
seth: {
|
|
290
293
|
eth: string;
|
|
@@ -315,6 +318,9 @@ export declare const AddressConst: {
|
|
|
315
318
|
asdcrv: {
|
|
316
319
|
eth: string;
|
|
317
320
|
};
|
|
321
|
+
emp: {
|
|
322
|
+
base: string;
|
|
323
|
+
};
|
|
318
324
|
arb: {
|
|
319
325
|
arb: string;
|
|
320
326
|
};
|
package/dist/cjs/types.js
CHANGED
|
@@ -35,12 +35,14 @@ var DexType = /* @__PURE__ */ ((DexType2) => {
|
|
|
35
35
|
DexType2["CURVE256"] = "curve256";
|
|
36
36
|
DexType2["CAMELOTV2"] = "camelotv2";
|
|
37
37
|
DexType2["PANCAKEV2"] = "pancakev2";
|
|
38
|
+
DexType2["AERODROME"] = "aerodrome";
|
|
38
39
|
DexType2["PANCAKEV3"] = "pancakev3";
|
|
39
40
|
DexType2["CURVE128PAYABLE"] = "curve128_payable";
|
|
40
41
|
DexType2["CURVE256PAYABLE"] = "curve256_payable";
|
|
41
42
|
DexType2["VSDCRVWITHDRAW"] = "vsdCRV_withdraw";
|
|
42
43
|
DexType2["VSDCRVDEPOSIT"] = "vsdCRV_deposit";
|
|
43
44
|
DexType2["ASDCRVWITHDRAW"] = "asdCRV_withdraw";
|
|
45
|
+
DexType2["ASDCRVDEPOSIT"] = "asdCRV_deposit";
|
|
44
46
|
return DexType2;
|
|
45
47
|
})(DexType || {});
|
|
46
48
|
var IEstimateType = /* @__PURE__ */ ((IEstimateType2) => {
|
|
@@ -217,7 +219,8 @@ var ChainNameEnum = /* @__PURE__ */ ((ChainNameEnum2) => {
|
|
|
217
219
|
var AddressConst = {
|
|
218
220
|
weth: {
|
|
219
221
|
eth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
220
|
-
arb: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"
|
|
222
|
+
arb: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
223
|
+
base: "0x4200000000000000000000000000000000000006"
|
|
221
224
|
},
|
|
222
225
|
seth: {
|
|
223
226
|
eth: "0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb"
|
|
@@ -249,6 +252,9 @@ var AddressConst = {
|
|
|
249
252
|
asdcrv: {
|
|
250
253
|
eth: "0x43E54C2E7b3e294De3A155785F52AB49d87B9922"
|
|
251
254
|
},
|
|
255
|
+
emp: {
|
|
256
|
+
base: "0x39D5313C3750140E5042887413bA8AA6145a9bd2"
|
|
257
|
+
},
|
|
252
258
|
arb: {
|
|
253
259
|
arb: "0x912CE59144191C1204E64559FE8253a0e49E6548"
|
|
254
260
|
},
|
package/dist/esm/index.js
CHANGED
|
@@ -853,22 +853,21 @@ var Hermes = /*#__PURE__*/function () {
|
|
|
853
853
|
});
|
|
854
854
|
|
|
855
855
|
// 准备 bridge 参数(对应合约中的 BridgeParam struct)
|
|
856
|
-
var
|
|
856
|
+
var bridgeParam = {
|
|
857
857
|
bridge: params.bridgeType,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
adapterParams: (_params$extra5 = params.extra) !== null && _params$extra5 !== void 0 ? _params$extra5 : '0x'
|
|
865
|
-
}
|
|
858
|
+
token: params.tokenAddress,
|
|
859
|
+
amount: params.amountInWei,
|
|
860
|
+
bridgeAddress: params.bridgeAddress,
|
|
861
|
+
destChain: params.destChain,
|
|
862
|
+
destUser: params.destUser,
|
|
863
|
+
extra: (_params$extra5 = params.extra) !== null && _params$extra5 !== void 0 ? _params$extra5 : '0x'
|
|
866
864
|
};
|
|
865
|
+
var amountIn = params.amountInWei;
|
|
867
866
|
|
|
868
867
|
// 使用 ethers Interface 编码 calldata
|
|
869
868
|
// 参数顺序: user, amountIn, swapParams, minAmountOutList, bridgeParam
|
|
870
869
|
var iface = new ethers.Interface(AggregatorAbi);
|
|
871
|
-
var calldata = iface.encodeFunctionData('swapAndBridge', [params.user,
|
|
870
|
+
var calldata = iface.encodeFunctionData('swapAndBridge', [params.user, amountIn, swapParams, params.minAmountOutList, bridgeParam]);
|
|
872
871
|
return {
|
|
873
872
|
to: aggregatorAddress,
|
|
874
873
|
data: calldata,
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -102,12 +102,14 @@ export declare enum DexType {
|
|
|
102
102
|
CURVE256 = "curve256",
|
|
103
103
|
CAMELOTV2 = "camelotv2",
|
|
104
104
|
PANCAKEV2 = "pancakev2",
|
|
105
|
+
AERODROME = "aerodrome",
|
|
105
106
|
PANCAKEV3 = "pancakev3",
|
|
106
107
|
CURVE128PAYABLE = "curve128_payable",
|
|
107
108
|
CURVE256PAYABLE = "curve256_payable",
|
|
108
109
|
VSDCRVWITHDRAW = "vsdCRV_withdraw",
|
|
109
110
|
VSDCRVDEPOSIT = "vsdCRV_deposit",
|
|
110
|
-
ASDCRVWITHDRAW = "asdCRV_withdraw"
|
|
111
|
+
ASDCRVWITHDRAW = "asdCRV_withdraw",
|
|
112
|
+
ASDCRVDEPOSIT = "asdCRV_deposit"
|
|
111
113
|
}
|
|
112
114
|
export declare enum IEstimateType {
|
|
113
115
|
BRIDGE = "bridge",
|
|
@@ -285,6 +287,7 @@ export declare const AddressConst: {
|
|
|
285
287
|
weth: {
|
|
286
288
|
eth: string;
|
|
287
289
|
arb: string;
|
|
290
|
+
base: string;
|
|
288
291
|
};
|
|
289
292
|
seth: {
|
|
290
293
|
eth: string;
|
|
@@ -315,6 +318,9 @@ export declare const AddressConst: {
|
|
|
315
318
|
asdcrv: {
|
|
316
319
|
eth: string;
|
|
317
320
|
};
|
|
321
|
+
emp: {
|
|
322
|
+
base: string;
|
|
323
|
+
};
|
|
318
324
|
arb: {
|
|
319
325
|
arb: string;
|
|
320
326
|
};
|
package/dist/esm/types.js
CHANGED
|
@@ -7,12 +7,14 @@ export var DexType = /*#__PURE__*/function (DexType) {
|
|
|
7
7
|
DexType["CURVE256"] = "curve256";
|
|
8
8
|
DexType["CAMELOTV2"] = "camelotv2";
|
|
9
9
|
DexType["PANCAKEV2"] = "pancakev2";
|
|
10
|
+
DexType["AERODROME"] = "aerodrome";
|
|
10
11
|
DexType["PANCAKEV3"] = "pancakev3";
|
|
11
12
|
DexType["CURVE128PAYABLE"] = "curve128_payable";
|
|
12
13
|
DexType["CURVE256PAYABLE"] = "curve256_payable";
|
|
13
14
|
DexType["VSDCRVWITHDRAW"] = "vsdCRV_withdraw";
|
|
14
15
|
DexType["VSDCRVDEPOSIT"] = "vsdCRV_deposit";
|
|
15
16
|
DexType["ASDCRVWITHDRAW"] = "asdCRV_withdraw";
|
|
17
|
+
DexType["ASDCRVDEPOSIT"] = "asdCRV_deposit";
|
|
16
18
|
return DexType;
|
|
17
19
|
}({});
|
|
18
20
|
export var IEstimateType = /*#__PURE__*/function (IEstimateType) {
|
|
@@ -189,7 +191,8 @@ export var ChainNameEnum = /*#__PURE__*/function (ChainNameEnum) {
|
|
|
189
191
|
export var AddressConst = {
|
|
190
192
|
weth: {
|
|
191
193
|
eth: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
192
|
-
arb: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1'
|
|
194
|
+
arb: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
|
|
195
|
+
base: '0x4200000000000000000000000000000000000006'
|
|
193
196
|
},
|
|
194
197
|
seth: {
|
|
195
198
|
eth: '0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb'
|
|
@@ -221,6 +224,9 @@ export var AddressConst = {
|
|
|
221
224
|
asdcrv: {
|
|
222
225
|
eth: '0x43E54C2E7b3e294De3A155785F52AB49d87B9922'
|
|
223
226
|
},
|
|
227
|
+
emp: {
|
|
228
|
+
base: '0x39D5313C3750140E5042887413bA8AA6145a9bd2'
|
|
229
|
+
},
|
|
224
230
|
arb: {
|
|
225
231
|
arb: '0x912CE59144191C1204E64559FE8253a0e49E6548'
|
|
226
232
|
},
|