hermes-swap 0.6.2 → 0.6.4

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.
@@ -168,11 +168,7 @@ var _Aggregator = class {
168
168
  this.validateParams(params);
169
169
  const useBundle = this.shouldUseBundle(params.chain, txReq);
170
170
  const pathDesc = params.path.map((p) => `${p.dexType}:${p.poolAddress.slice(0, 10)}`).join("→");
171
- _Aggregator.traceLog(
172
- params.chain,
173
- "log",
174
- `swapByPath开始, user=${params.user}, amountIn=${params.amountInWei}, path=[${pathDesc}], useBundle=${useBundle}`
175
- );
171
+ _Aggregator.traceLog(params.chain, "log", `swapByPath开始, user=${params.user}, amountIn=${params.amountInWei}, path=[${pathDesc}], useBundle=${useBundle}`);
176
172
  const startTs = Date.now();
177
173
  let txHash;
178
174
  try {
@@ -345,11 +341,18 @@ var _Aggregator = class {
345
341
  let receipt;
346
342
  if (useBundle) {
347
343
  const calldata = iface.encodeFunctionData("multiSwapAndBridge", args);
348
- const { receipt: flashbotsReceipt, txHash: bundleTxHash, targetBlocks } = await this.submitBundleTx(params.chain, wallet, txReq, aggregatorAddress, calldata, txReq.value ?? 0n, bundleBlockCount);
344
+ const {
345
+ receipt: flashbotsReceipt,
346
+ txHash: bundleTxHash,
347
+ targetBlocks
348
+ } = await this.submitBundleTx(params.chain, wallet, txReq, aggregatorAddress, calldata, txReq.value ?? 0n, bundleBlockCount);
349
349
  txHash = bundleTxHash;
350
350
  if (!flashbotsReceipt) {
351
351
  throw new import_types.BundleNotIncludedError(`Bundle 未在目标区块上链, txHash=${bundleTxHash}, targetBlocks=[${targetBlocks.join(",")}]`, bundleTxHash);
352
352
  }
353
+ if (flashbotsReceipt.status === 0) {
354
+ throw new import_types.TransactionRevertedError(flashbotsReceipt.hash, flashbotsReceipt.gasUsed);
355
+ }
353
356
  receipt = flashbotsReceipt;
354
357
  } else {
355
358
  receipt = await this.sendContractTx(params.chain, aggregator, "multiSwapAndBridge", args, txReq);
@@ -380,11 +383,7 @@ var _Aggregator = class {
380
383
  const fromTokenAddress = ((_a = pathStart == null ? void 0 : pathStart[0]) == null ? void 0 : _a.fromCoinAddress) ?? "";
381
384
  const toTokenAddress = ((_b = pathEnd == null ? void 0 : pathEnd[pathEnd.length - 1]) == null ? void 0 : _b.toCoinAddress) ?? "";
382
385
  const totalAmountInFromEvent = amountInList.reduce((sum, amount) => sum + amount, 0n);
383
- _Aggregator.traceLog(
384
- params.chain,
385
- "log",
386
- `swapAndBridge完成, txHash=${receipt.hash}, amountOut=${amountOut}, useBundle=${useBundle}, 总耗时=${Date.now() - startTs}ms`
387
- );
386
+ _Aggregator.traceLog(params.chain, "log", `swapAndBridge完成, txHash=${receipt.hash}, amountOut=${amountOut}, useBundle=${useBundle}, 总耗时=${Date.now() - startTs}ms`);
388
387
  return {
389
388
  hash: receipt.hash,
390
389
  from: receipt.from,
@@ -400,11 +399,7 @@ var _Aggregator = class {
400
399
  async multiSwap(params, txReq = {}) {
401
400
  var _a;
402
401
  const useBundle = this.shouldUseBundle(params.chain, txReq);
403
- _Aggregator.traceLog(
404
- params.chain,
405
- "log",
406
- `multiSwap开始, user=${params.user}, pathsCount=${params.paths.length}, amountInWeis=[${params.amountInWeis.join(",")}], useBundle=${useBundle}`
407
- );
402
+ _Aggregator.traceLog(params.chain, "log", `multiSwap开始, user=${params.user}, pathsCount=${params.paths.length}, amountInWeis=[${params.amountInWeis.join(",")}], useBundle=${useBundle}`);
408
403
  const startTs = Date.now();
409
404
  let txHash;
410
405
  try {
@@ -458,11 +453,18 @@ var _Aggregator = class {
458
453
  let receipt;
459
454
  if (useBundle) {
460
455
  const calldata = iface.encodeFunctionData("multiSwap", [params.user, params.amountInWeis, swapParamsList, params.minAmountOutLists, params.totalMinAmountOut]);
461
- const { receipt: flashbotsReceipt, txHash: bundleTxHash, targetBlocks } = await this.submitBundleTx(params.chain, wallet, txReq, aggregatorAddress, calldata, txReq.value ?? 0n, bundleBlockCount);
456
+ const {
457
+ receipt: flashbotsReceipt,
458
+ txHash: bundleTxHash,
459
+ targetBlocks
460
+ } = await this.submitBundleTx(params.chain, wallet, txReq, aggregatorAddress, calldata, txReq.value ?? 0n, bundleBlockCount);
462
461
  txHash = bundleTxHash;
463
462
  if (!flashbotsReceipt) {
464
463
  throw new import_types.BundleNotIncludedError(`Bundle 未在目标区块上链, txHash=${bundleTxHash}, targetBlocks=[${targetBlocks.join(",")}]`, bundleTxHash);
465
464
  }
465
+ if (flashbotsReceipt.status === 0) {
466
+ throw new import_types.TransactionRevertedError(flashbotsReceipt.hash, flashbotsReceipt.gasUsed);
467
+ }
466
468
  receipt = flashbotsReceipt;
467
469
  } else {
468
470
  receipt = await this.sendContractTx(params.chain, aggregator, "multiSwap", [params.user, params.amountInWeis, swapParamsList, params.minAmountOutLists, params.totalMinAmountOut], txReq);
@@ -483,11 +485,7 @@ var _Aggregator = class {
483
485
  }
484
486
  if (!amountOutList)
485
487
  throw new Error(`MultiSwapped event not found: ${receipt.hash}`);
486
- _Aggregator.traceLog(
487
- params.chain,
488
- "log",
489
- `multiSwap完成, txHash=${receipt.hash}, amountOutList=[${amountOutList.join(",")}], useBundle=${useBundle}, 总耗时=${Date.now() - startTs}ms`
490
- );
488
+ _Aggregator.traceLog(params.chain, "log", `multiSwap完成, txHash=${receipt.hash}, amountOutList=[${amountOutList.join(",")}], useBundle=${useBundle}, 总耗时=${Date.now() - startTs}ms`);
491
489
  return {
492
490
  hash: receipt.hash,
493
491
  from: receipt.from,
@@ -553,11 +551,18 @@ var _Aggregator = class {
553
551
  let receipt;
554
552
  if (useBundle) {
555
553
  const calldata = iface.encodeFunctionData("batchMultiSwap", [params.users, params.amountInWeis, swapParamsList, params.minAmountOutLists]);
556
- const { receipt: flashbotsReceipt, txHash: bundleTxHash, targetBlocks } = await this.submitBundleTx(params.chain, wallet, txReq, aggregatorAddress, calldata, txReq.value ?? 0n, bundleBlockCount);
554
+ const {
555
+ receipt: flashbotsReceipt,
556
+ txHash: bundleTxHash,
557
+ targetBlocks
558
+ } = await this.submitBundleTx(params.chain, wallet, txReq, aggregatorAddress, calldata, txReq.value ?? 0n, bundleBlockCount);
557
559
  txHash = bundleTxHash;
558
560
  if (!flashbotsReceipt) {
559
561
  throw new import_types.BundleNotIncludedError(`Bundle 未在目标区块上链, txHash=${bundleTxHash}, targetBlocks=[${targetBlocks.join(",")}]`, bundleTxHash);
560
562
  }
563
+ if (flashbotsReceipt.status === 0) {
564
+ throw new import_types.TransactionRevertedError(flashbotsReceipt.hash, flashbotsReceipt.gasUsed);
565
+ }
561
566
  receipt = flashbotsReceipt;
562
567
  } else {
563
568
  receipt = await this.sendContractTx(params.chain, aggregator, "batchMultiSwap", [params.users, params.amountInWeis, swapParamsList, params.minAmountOutLists], txReq);
@@ -585,11 +590,7 @@ var _Aggregator = class {
585
590
  if (userList.length !== params.users.length || amountOutList.length !== params.users.length) {
586
591
  throw new Error(`MultiSwapped event length mismatch: ${receipt.hash}`);
587
592
  }
588
- _Aggregator.traceLog(
589
- params.chain,
590
- "log",
591
- `batchMultiSwap完成, txHash=${receipt.hash}, amountOutList=[${amountOutList.join(",")}], useBundle=${useBundle}, 总耗时=${Date.now() - startTs}ms`
592
- );
593
+ _Aggregator.traceLog(params.chain, "log", `batchMultiSwap完成, txHash=${receipt.hash}, amountOutList=[${amountOutList.join(",")}], useBundle=${useBundle}, 总耗时=${Date.now() - startTs}ms`);
593
594
  return {
594
595
  hash: receipt.hash,
595
596
  from: receipt.from,
@@ -684,21 +685,24 @@ var _Aggregator = class {
684
685
  if (useBundle) {
685
686
  const iface = new import_ethers.ethers.Interface(import_aggregator.default);
686
687
  const calldata = iface.encodeFunctionData("bridge", [params.user, bridgeArgs]);
687
- const { receipt: flashbotsReceipt, txHash: bundleTxHash, targetBlocks } = await this.submitBundleTx(params.chain, wallet, txReq, aggregatorAddress, calldata, txReq.value ?? 0n, bundleBlockCount);
688
+ const {
689
+ receipt: flashbotsReceipt,
690
+ txHash: bundleTxHash,
691
+ targetBlocks
692
+ } = await this.submitBundleTx(params.chain, wallet, txReq, aggregatorAddress, calldata, txReq.value ?? 0n, bundleBlockCount);
688
693
  txHash = bundleTxHash;
689
694
  if (!flashbotsReceipt) {
690
695
  throw new import_types.BundleNotIncludedError(`Bundle 未在目标区块上链, txHash=${bundleTxHash}, targetBlocks=[${targetBlocks.join(",")}]`, bundleTxHash);
691
696
  }
697
+ if (flashbotsReceipt.status === 0) {
698
+ throw new import_types.TransactionRevertedError(flashbotsReceipt.hash, flashbotsReceipt.gasUsed);
699
+ }
692
700
  txReceipt = flashbotsReceipt;
693
701
  } else {
694
702
  txReceipt = await this.sendContractTx(params.chain, aggregator, "bridge", [params.user, bridgeArgs], txReq);
695
703
  txHash = txReceipt.hash;
696
704
  }
697
- _Aggregator.traceLog(
698
- params.chain,
699
- "log",
700
- `bridge完成, txHash=${txReceipt.hash}, useBundle=${useBundle}, 总耗时=${Date.now() - startTs}ms`
701
- );
705
+ _Aggregator.traceLog(params.chain, "log", `bridge完成, txHash=${txReceipt.hash}, useBundle=${useBundle}, 总耗时=${Date.now() - startTs}ms`);
702
706
  return {
703
707
  fromToken: params.tokenAddress,
704
708
  toToken: params.tokenAddress,
@@ -954,7 +958,10 @@ var _Aggregator = class {
954
958
  const receipt2 = await txResponse.wait();
955
959
  const singleProvider = this.providerClient.getProvider(chain);
956
960
  const blockTs2 = await this.getBlockTimestampStr(singleProvider, receipt2.blockNumber);
957
- _Aggregator.traceLog(chain, "log", `单RPC上链确认, txHash=${receipt2.hash}, blockNumber=${receipt2.blockNumber}, 出块时间=${blockTs2}, gasUsed=${receipt2.gasUsed}`);
961
+ _Aggregator.traceLog(chain, "log", `单RPC上链确认, txHash=${receipt2.hash}, blockNumber=${receipt2.blockNumber}, 出块时间=${blockTs2}, gasUsed=${receipt2.gasUsed}, status=${receipt2.status}`);
962
+ if (receipt2.status === 0) {
963
+ throw new import_types.TransactionRevertedError(receipt2.hash, receipt2.gasUsed);
964
+ }
958
965
  return receipt2;
959
966
  }
960
967
  const wallet = this.providerClient.getWallet(chain);
@@ -970,10 +977,7 @@ var _Aggregator = class {
970
977
  provider: new import_ethers.ethers.JsonRpcProvider(url),
971
978
  label: `RPC[${i + 1}/${new URL(url).hostname}]`
972
979
  }));
973
- const allProviders = [
974
- { provider: mainProvider, label: "RPC[0/主]" },
975
- ...extraProviders
976
- ];
980
+ const allProviders = [{ provider: mainProvider, label: "RPC[0/主]" }, ...extraProviders];
977
981
  const ownedProviders = extraProviders.map((e) => e.provider);
978
982
  _Aggregator.traceLog(
979
983
  chain,
@@ -987,8 +991,11 @@ var _Aggregator = class {
987
991
  _Aggregator.traceLog(
988
992
  chain,
989
993
  "log",
990
- `多RPC广播上链确认, txHash=${receipt.hash}, blockNumber=${receipt.blockNumber}, 出块时间=${blockTs}, gasUsed=${receipt.gasUsed}, 总耗时=${Date.now() - broadcastTs}ms`
994
+ `多RPC广播上链确认, txHash=${receipt.hash}, blockNumber=${receipt.blockNumber}, 出块时间=${blockTs}, gasUsed=${receipt.gasUsed}, status=${receipt.status}, 总耗时=${Date.now() - broadcastTs}ms`
991
995
  );
996
+ if (receipt.status === 0) {
997
+ throw new import_types.TransactionRevertedError(receipt.hash, receipt.gasUsed);
998
+ }
992
999
  return receipt;
993
1000
  }
994
1001
  async submitBundleTx(chain, wallet, txReq, to, data, value, bundleBlockCount) {
@@ -1018,10 +1025,7 @@ var _Aggregator = class {
1018
1025
  baseTx.gasPrice = txReq.gasPrice;
1019
1026
  baseTx.type = 0;
1020
1027
  }
1021
- const [signTx, currentBlock] = await Promise.all([
1022
- wallet.signTransaction(baseTx),
1023
- provider.getBlockNumber()
1024
- ]);
1028
+ const [signTx, currentBlock] = await Promise.all([wallet.signTransaction(baseTx), provider.getBlockNumber()]);
1025
1029
  const rawTxs = [signTx];
1026
1030
  const txHash = import_ethers.ethers.keccak256(rawTxs[0]);
1027
1031
  const normalizedBundleBlockCount = this.normalizeBundleBlockCount(bundleBlockCount);
@@ -1064,11 +1068,7 @@ var _Aggregator = class {
1064
1068
  const [receipt] = await Promise.all([
1065
1069
  inclusionPromise,
1066
1070
  Promise.all(fireAndForget).then(() => {
1067
- _Aggregator.traceLog(
1068
- chain,
1069
- "log",
1070
- `Bundle发送完成, 成功=${totalSent}, 失败=${totalFailed}, 总请求=${fireAndForget.length}, 耗时=${Date.now() - sendBundleTs}ms, txHash=${txHash}`
1071
- );
1071
+ _Aggregator.traceLog(chain, "log", `Bundle发送完成, 成功=${totalSent}, 失败=${totalFailed}, 总请求=${fireAndForget.length}, 耗时=${Date.now() - sendBundleTs}ms, txHash=${txHash}`);
1072
1072
  if (totalSent === 0)
1073
1073
  abortController.abort();
1074
1074
  })
@@ -1081,11 +1081,7 @@ var _Aggregator = class {
1081
1081
  `Bundle上链确认, txHash=${receipt.hash}, blockNumber=${receipt.blockNumber}, 出块时间=${blockTs}, gasUsed=${receipt.gasUsed}, 等待耗时=${Date.now() - waitTs}ms`
1082
1082
  );
1083
1083
  } else {
1084
- _Aggregator.traceLog(
1085
- chain,
1086
- "warn",
1087
- `Bundle未在目标区块上链, txHash=${txHash}, 目标区块=[${targetBlocks.join(",")}], 等待耗时=${Date.now() - waitTs}ms`
1088
- );
1084
+ _Aggregator.traceLog(chain, "warn", `Bundle未在目标区块上链, txHash=${txHash}, 目标区块=[${targetBlocks.join(",")}], 等待耗时=${Date.now() - waitTs}ms`);
1089
1085
  }
1090
1086
  return { receipt, txHash, targetBlocks };
1091
1087
  }
@@ -1198,25 +1194,36 @@ var _Aggregator = class {
1198
1194
  }
1199
1195
  };
1200
1196
  var Aggregator = _Aggregator;
1197
+ // private static readonly DEFAULT_ETH_BUILDERS: Record<string, string> = {
1198
+ // 'beaverbuild.org': 'https://rpc.beaverbuild.org',
1199
+ // Titan: 'https://rpc.titanbuilder.xyz',
1200
+ // flashbots: 'https://relay.flashbots.net',
1201
+ // bloXroute: 'https://api.blxrbdn.com',
1202
+ // rsync: 'https://rsync-builder.xyz',
1203
+ // 'builder0x69.io': 'https://builder0x69.io',
1204
+ // bloxroute: 'https://bloxroute.max-profit.blxrbdn.com',
1205
+ // blocknative: 'https://builder.blocknative.com',
1206
+ // eden: 'https://relay.edennetwork.io',
1207
+ // ultra_sound_relay: 'https://relay.ultrasound.money',
1208
+ // lokibuilder: 'https://relay.lokibuilder.xyz',
1209
+ // penguinbuild: 'https://relay.penguinbuild.org',
1210
+ // gambit: 'https://builder.gmbit.co',
1211
+ // jetbuilder: 'https://relay.jetbld.xyz',
1212
+ // f1b: 'https://builder.f1b.io',
1213
+ // buildai: 'https://relay.buildai.net',
1214
+ // tbuilder: 'https://relay.tbuilder.xyz',
1215
+ // bobabuilder: 'https://relay.boba-builder.com',
1216
+ // };
1201
1217
  Aggregator.DEFAULT_ETH_BUILDERS = {
1202
1218
  "beaverbuild.org": "https://rpc.beaverbuild.org",
1203
1219
  Titan: "https://rpc.titanbuilder.xyz",
1204
1220
  flashbots: "https://relay.flashbots.net",
1205
- bloXroute: "https://api.blxrbdn.com",
1206
- rsync: "https://rsync-builder.xyz",
1207
- "builder0x69.io": "https://builder0x69.io",
1208
- bloxroute: "https://bloxroute.max-profit.blxrbdn.com",
1209
- blocknative: "https://builder.blocknative.com",
1210
- eden: "https://relay.edennetwork.io",
1211
- ultra_sound_relay: "https://relay.ultrasound.money",
1212
- lokibuilder: "https://relay.lokibuilder.xyz",
1213
- penguinbuild: "https://relay.penguinbuild.org",
1214
- gambit: "https://builder.gmbit.co",
1215
- jetbuilder: "https://relay.jetbld.xyz",
1216
- f1b: "https://builder.f1b.io",
1217
- buildai: "https://relay.buildai.net",
1218
- tbuilder: "https://relay.tbuilder.xyz",
1219
- bobabuilder: "https://relay.boba-builder.com"
1221
+ // bloXroute: 'https://mev.api.blxrbdn.com', // 旧 api.blxrbdn.com 也行,需配置 Authorization 头
1222
+ lightspeedbuilder: "https://rpc.lightspeedbuilder.info",
1223
+ // 新增,实测直接可用
1224
+ // buildernet: 'https://rpc.buildernet.org', // 新增,Flashbots 生态,需签名头(同 flashbots 格式)
1225
+ nfactorial: "https://rpc.nfactorial.xyz"
1226
+ // 新增,支持 bundle rebate
1220
1227
  };
1221
1228
  Aggregator.TX_CONFIRM_TIMEOUT_MS = 12e4;
1222
1229
  Aggregator.BUNDLE_POLL_INTERVAL_MS = 500;
@@ -40,6 +40,7 @@ __export(src_exports, {
40
40
  LayerZeroV1ChainNameMap: () => import_types.LayerZeroV1ChainNameMap,
41
41
  LayerZeroV2ChainIdMap: () => import_types.LayerZeroV2ChainIdMap,
42
42
  LayerZeroV2ChainNameMap: () => import_types.LayerZeroV2ChainNameMap,
43
+ TransactionRevertedError: () => import_types2.TransactionRevertedError,
43
44
  default: () => src_default
44
45
  });
45
46
  module.exports = __toCommonJS(src_exports);
@@ -144,5 +145,6 @@ var src_default = Hermes;
144
145
  LayerZeroV1ChainIdMap,
145
146
  LayerZeroV1ChainNameMap,
146
147
  LayerZeroV2ChainIdMap,
147
- LayerZeroV2ChainNameMap
148
+ LayerZeroV2ChainNameMap,
149
+ TransactionRevertedError
148
150
  });
@@ -2,8 +2,8 @@ import type { HermesTxRequest, IBatchMultiSwapParams, IBatchExpectParams, ISwapB
2
2
  import { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap } from './types.js';
3
3
  import { TransactionRequest } from 'ethers';
4
4
  export type { HermesTxRequest, IBatchMultiSwapAndBridgeParams, IExpectSplitOrderParams, IExpectSplitOrderResp, IMultiSwapParams, IBatchMultiSwapParams, IBatchExpectParams, IBatchReceipt, ISwapByPathParams as ISwapParams, IBridgeParams, ISwapAndBridgeParams, IReceipt, IConfig, IBuilderConfig, IExpectPayload, IRouterPath, SupportContracts, IHermesSignalResponse, IHermesSignalRoute, };
5
- import { BundleNotIncludedError } from './types.js';
6
- export { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap, BundleNotIncludedError };
5
+ import { BundleNotIncludedError, TransactionRevertedError } from './types.js';
6
+ export { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap, BundleNotIncludedError, TransactionRevertedError };
7
7
  declare class Hermes {
8
8
  private readonly config;
9
9
  private readonly providerClient;
@@ -28,7 +28,8 @@ __export(types_exports, {
28
28
  LayerZeroV1ChainIdMap: () => LayerZeroV1ChainIdMap,
29
29
  LayerZeroV1ChainNameMap: () => LayerZeroV1ChainNameMap,
30
30
  LayerZeroV2ChainIdMap: () => LayerZeroV2ChainIdMap,
31
- LayerZeroV2ChainNameMap: () => LayerZeroV2ChainNameMap
31
+ LayerZeroV2ChainNameMap: () => LayerZeroV2ChainNameMap,
32
+ TransactionRevertedError: () => TransactionRevertedError
32
33
  });
33
34
  module.exports = __toCommonJS(types_exports);
34
35
  var import_lz_definitions = require("@layerzerolabs/lz-definitions");
@@ -1050,6 +1051,14 @@ var BundleNotIncludedError = class extends Error {
1050
1051
  this.txHash = txHash;
1051
1052
  }
1052
1053
  };
1054
+ var TransactionRevertedError = class extends Error {
1055
+ constructor(txHash, gasUsed) {
1056
+ super(`Transaction reverted: ${txHash}, gasUsed=${gasUsed}`);
1057
+ this.name = "TransactionRevertedError";
1058
+ this.txHash = txHash;
1059
+ this.gasUsed = gasUsed;
1060
+ }
1061
+ };
1053
1062
  // Annotate the CommonJS export names for ESM import in node:
1054
1063
  0 && (module.exports = {
1055
1064
  AddressConst,
@@ -1061,5 +1070,6 @@ var BundleNotIncludedError = class extends Error {
1061
1070
  LayerZeroV1ChainIdMap,
1062
1071
  LayerZeroV1ChainNameMap,
1063
1072
  LayerZeroV2ChainIdMap,
1064
- LayerZeroV2ChainNameMap
1073
+ LayerZeroV2ChainNameMap,
1074
+ TransactionRevertedError
1065
1075
  });
@@ -516,3 +516,8 @@ export declare class BundleNotIncludedError extends Error {
516
516
  readonly txHash: string;
517
517
  constructor(message: string, txHash: string);
518
518
  }
519
+ export declare class TransactionRevertedError extends Error {
520
+ readonly txHash: string;
521
+ readonly gasUsed: bigint;
522
+ constructor(txHash: string, gasUsed: bigint);
523
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["aggregator.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2vClB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quoter.d.ts","sourceRoot":"","sources":["quoter.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2gBd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAA8B,kBAAkB,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEpG,OAAO,EAEL,aAAa,EACb,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,8BAA8B,EACnC,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,aAAa,EAElB,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EAEb,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGtB,MAAM,YAAY,CAAC;AAEpB,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,cAAM,UAAU;IACd,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,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AC;IAuEnJ,6BAA6B,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAa7F,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAW;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAO;IACtD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,2BAA2B,CAAU;YAE/C,sBAAsB;IAqBpC,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,cAAc;YA2DR,cAAc;YA2Dd,cAAc;YAyGd,eAAe;IAsD7B,OAAO,CAAC,eAAe;YAKT,YAAY;YAKZ,cAAc;IAU5B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,yBAAyB;CAMlC;AAED,eAAe,UAAU,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -34,7 +34,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
34
34
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
35
35
  import { AbiCoder, Contract, ethers } from 'ethers';
36
36
  import axios from 'axios';
37
- import { ChainNameEnum, IEstimateType, BundleNotIncludedError } from "./types.mjs";
37
+ import { ChainNameEnum, IEstimateType, BundleNotIncludedError, TransactionRevertedError } from "./types.mjs";
38
38
  import AggregatorAbi from "./abis/aggregator.mjs";
39
39
  import Provider from "./provider.mjs";
40
40
  import Quoter from "./quoter.mjs";
@@ -112,7 +112,26 @@ var Aggregator = /*#__PURE__*/function () {
112
112
  return _getBlockTimestampStr.apply(this, arguments);
113
113
  }
114
114
  return getBlockTimestampStr;
115
- }()
115
+ }() // private static readonly DEFAULT_ETH_BUILDERS: Record<string, string> = {
116
+ // 'beaverbuild.org': 'https://rpc.beaverbuild.org',
117
+ // Titan: 'https://rpc.titanbuilder.xyz',
118
+ // flashbots: 'https://relay.flashbots.net',
119
+ // bloXroute: 'https://api.blxrbdn.com',
120
+ // rsync: 'https://rsync-builder.xyz',
121
+ // 'builder0x69.io': 'https://builder0x69.io',
122
+ // bloxroute: 'https://bloxroute.max-profit.blxrbdn.com',
123
+ // blocknative: 'https://builder.blocknative.com',
124
+ // eden: 'https://relay.edennetwork.io',
125
+ // ultra_sound_relay: 'https://relay.ultrasound.money',
126
+ // lokibuilder: 'https://relay.lokibuilder.xyz',
127
+ // penguinbuild: 'https://relay.penguinbuild.org',
128
+ // gambit: 'https://builder.gmbit.co',
129
+ // jetbuilder: 'https://relay.jetbld.xyz',
130
+ // f1b: 'https://builder.f1b.io',
131
+ // buildai: 'https://relay.buildai.net',
132
+ // tbuilder: 'https://relay.tbuilder.xyz',
133
+ // bobabuilder: 'https://relay.boba-builder.com',
134
+ // };
116
135
  }, {
117
136
  key: "getAggregator",
118
137
  value: function getAggregator(chain) {
@@ -681,7 +700,7 @@ var Aggregator = /*#__PURE__*/function () {
681
700
  txReq = _context7.sent;
682
701
  iface = new ethers.Interface(AggregatorAbi);
683
702
  if (!useBundle) {
684
- _context7.next = 52;
703
+ _context7.next = 54;
685
704
  break;
686
705
  }
687
706
  calldata = iface.encodeFunctionData('multiSwapAndBridge', args);
@@ -699,69 +718,75 @@ var Aggregator = /*#__PURE__*/function () {
699
718
  }
700
719
  throw new BundleNotIncludedError("Bundle \u672A\u5728\u76EE\u6807\u533A\u5757\u4E0A\u94FE, txHash=".concat(bundleTxHash, ", targetBlocks=[").concat(targetBlocks.join(','), "]"), bundleTxHash);
701
720
  case 49:
721
+ if (!(flashbotsReceipt.status === 0)) {
722
+ _context7.next = 51;
723
+ break;
724
+ }
725
+ throw new TransactionRevertedError(flashbotsReceipt.hash, flashbotsReceipt.gasUsed);
726
+ case 51:
702
727
  receipt = flashbotsReceipt;
703
- _context7.next = 56;
728
+ _context7.next = 58;
704
729
  break;
705
- case 52:
706
- _context7.next = 54;
707
- return this.sendContractTx(params.chain, aggregator, 'multiSwapAndBridge', args, txReq);
708
730
  case 54:
731
+ _context7.next = 56;
732
+ return this.sendContractTx(params.chain, aggregator, 'multiSwapAndBridge', args, txReq);
733
+ case 56:
709
734
  receipt = _context7.sent;
710
735
  txHash = receipt.hash;
711
- case 56:
736
+ case 58:
712
737
  receiptUser = null;
713
738
  amountInList = null;
714
739
  amountOut = null;
715
740
  _iterator2 = _createForOfIteratorHelper(receipt.logs);
716
- _context7.prev = 60;
741
+ _context7.prev = 62;
717
742
  _iterator2.s();
718
- case 62:
743
+ case 64:
719
744
  if ((_step2 = _iterator2.n()).done) {
720
- _context7.next = 78;
745
+ _context7.next = 80;
721
746
  break;
722
747
  }
723
748
  log = _step2.value;
724
749
  if (!(log.address.toLowerCase() === aggregatorAddress.toLowerCase())) {
725
- _context7.next = 76;
750
+ _context7.next = 78;
726
751
  break;
727
752
  }
728
- _context7.prev = 65;
753
+ _context7.prev = 67;
729
754
  parsed = iface.parseLog(log);
730
755
  if (!(parsed && parsed.name === 'MultiSwapAndBridge' && parsed.args)) {
731
- _context7.next = 72;
756
+ _context7.next = 74;
732
757
  break;
733
758
  }
734
759
  receiptUser = parsed.args.user;
735
760
  amountInList = parsed.args.amountInList;
736
761
  amountOut = parsed.args.amountOut;
737
- return _context7.abrupt("break", 78);
738
- case 72:
739
- _context7.next = 76;
740
- break;
762
+ return _context7.abrupt("break", 80);
741
763
  case 74:
742
- _context7.prev = 74;
743
- _context7.t1 = _context7["catch"](65);
744
- case 76:
745
- _context7.next = 62;
764
+ _context7.next = 78;
746
765
  break;
766
+ case 76:
767
+ _context7.prev = 76;
768
+ _context7.t1 = _context7["catch"](67);
747
769
  case 78:
748
- _context7.next = 83;
770
+ _context7.next = 64;
749
771
  break;
750
772
  case 80:
751
- _context7.prev = 80;
752
- _context7.t2 = _context7["catch"](60);
773
+ _context7.next = 85;
774
+ break;
775
+ case 82:
776
+ _context7.prev = 82;
777
+ _context7.t2 = _context7["catch"](62);
753
778
  _iterator2.e(_context7.t2);
754
- case 83:
755
- _context7.prev = 83;
779
+ case 85:
780
+ _context7.prev = 85;
756
781
  _iterator2.f();
757
- return _context7.finish(83);
758
- case 86:
782
+ return _context7.finish(85);
783
+ case 88:
759
784
  if (!(!receiptUser || !amountInList || amountOut == null)) {
760
- _context7.next = 88;
785
+ _context7.next = 90;
761
786
  break;
762
787
  }
763
788
  throw new Error("MultiSwapAndBridge event not found: ".concat(receipt.hash));
764
- case 88:
789
+ case 90:
765
790
  pathStart = params.paths[0];
766
791
  pathEnd = params.paths[params.paths.length - 1];
767
792
  fromTokenAddress = (_pathStart$0$fromCoin = pathStart === null || pathStart === void 0 || (_pathStart$ = pathStart[0]) === null || _pathStart$ === void 0 ? void 0 : _pathStart$.fromCoinAddress) !== null && _pathStart$0$fromCoin !== void 0 ? _pathStart$0$fromCoin : '';
@@ -783,16 +808,16 @@ var Aggregator = /*#__PURE__*/function () {
783
808
  }],
784
809
  receipt: receipt
785
810
  });
786
- case 97:
787
- _context7.prev = 97;
811
+ case 99:
812
+ _context7.prev = 99;
788
813
  _context7.t3 = _context7["catch"](4);
789
814
  Aggregator.traceLog(params.chain, 'error', "swapAndBridge\u5F02\u5E38, rpcUrl=".concat(this.getRpcUrl(params.chain), ", txHash=").concat((_txHash2 = txHash) !== null && _txHash2 !== void 0 ? _txHash2 : 'N/A', ", \u603B\u8017\u65F6=").concat(Date.now() - startTs, "ms, error=").concat(_context7.t3));
790
815
  throw _context7.t3;
791
- case 101:
816
+ case 103:
792
817
  case "end":
793
818
  return _context7.stop();
794
819
  }
795
- }, _callee7, this, [[4, 97], [20, 26], [60, 80, 83, 86], [65, 74]]);
820
+ }, _callee7, this, [[4, 99], [20, 26], [62, 82, 85, 88], [67, 76]]);
796
821
  }));
797
822
  function swapAndBridge(_x17) {
798
823
  return _swapAndBridge.apply(this, arguments);
@@ -944,7 +969,7 @@ var Aggregator = /*#__PURE__*/function () {
944
969
  txReq = _context8.sent;
945
970
  iface = new ethers.Interface(AggregatorAbi);
946
971
  if (!useBundle) {
947
- _context8.next = 67;
972
+ _context8.next = 69;
948
973
  break;
949
974
  }
950
975
  calldata = iface.encodeFunctionData('multiSwap', [params.user, params.amountInWeis, swapParamsList, params.minAmountOutLists, params.totalMinAmountOut]);
@@ -962,65 +987,71 @@ var Aggregator = /*#__PURE__*/function () {
962
987
  }
963
988
  throw new BundleNotIncludedError("Bundle \u672A\u5728\u76EE\u6807\u533A\u5757\u4E0A\u94FE, txHash=".concat(bundleTxHash, ", targetBlocks=[").concat(targetBlocks.join(','), "]"), bundleTxHash);
964
989
  case 64:
990
+ if (!(flashbotsReceipt.status === 0)) {
991
+ _context8.next = 66;
992
+ break;
993
+ }
994
+ throw new TransactionRevertedError(flashbotsReceipt.hash, flashbotsReceipt.gasUsed);
995
+ case 66:
965
996
  receipt = flashbotsReceipt;
966
- _context8.next = 71;
997
+ _context8.next = 73;
967
998
  break;
968
- case 67:
969
- _context8.next = 69;
970
- return this.sendContractTx(params.chain, aggregator, 'multiSwap', [params.user, params.amountInWeis, swapParamsList, params.minAmountOutLists, params.totalMinAmountOut], txReq);
971
999
  case 69:
1000
+ _context8.next = 71;
1001
+ return this.sendContractTx(params.chain, aggregator, 'multiSwap', [params.user, params.amountInWeis, swapParamsList, params.minAmountOutLists, params.totalMinAmountOut], txReq);
1002
+ case 71:
972
1003
  receipt = _context8.sent;
973
1004
  txHash = receipt.hash;
974
- case 71:
1005
+ case 73:
975
1006
  amountOutList = null;
976
1007
  _iterator3 = _createForOfIteratorHelper(receipt.logs);
977
- _context8.prev = 73;
1008
+ _context8.prev = 75;
978
1009
  _iterator3.s();
979
- case 75:
1010
+ case 77:
980
1011
  if ((_step3 = _iterator3.n()).done) {
981
- _context8.next = 89;
1012
+ _context8.next = 91;
982
1013
  break;
983
1014
  }
984
1015
  log = _step3.value;
985
1016
  if (!(log.address.toLowerCase() === aggregatorAddress.toLowerCase())) {
986
- _context8.next = 87;
1017
+ _context8.next = 89;
987
1018
  break;
988
1019
  }
989
- _context8.prev = 78;
1020
+ _context8.prev = 80;
990
1021
  parsed = iface.parseLog(log);
991
1022
  if (!(parsed && parsed.name === 'MultiSwapped' && parsed.args)) {
992
- _context8.next = 83;
1023
+ _context8.next = 85;
993
1024
  break;
994
1025
  }
995
1026
  amountOutList = parsed.args.amountOutList;
996
- return _context8.abrupt("break", 89);
997
- case 83:
998
- _context8.next = 87;
999
- break;
1027
+ return _context8.abrupt("break", 91);
1000
1028
  case 85:
1001
- _context8.prev = 85;
1002
- _context8.t1 = _context8["catch"](78);
1003
- case 87:
1004
- _context8.next = 75;
1029
+ _context8.next = 89;
1005
1030
  break;
1031
+ case 87:
1032
+ _context8.prev = 87;
1033
+ _context8.t1 = _context8["catch"](80);
1006
1034
  case 89:
1007
- _context8.next = 94;
1035
+ _context8.next = 77;
1008
1036
  break;
1009
1037
  case 91:
1010
- _context8.prev = 91;
1011
- _context8.t2 = _context8["catch"](73);
1038
+ _context8.next = 96;
1039
+ break;
1040
+ case 93:
1041
+ _context8.prev = 93;
1042
+ _context8.t2 = _context8["catch"](75);
1012
1043
  _iterator3.e(_context8.t2);
1013
- case 94:
1014
- _context8.prev = 94;
1044
+ case 96:
1045
+ _context8.prev = 96;
1015
1046
  _iterator3.f();
1016
- return _context8.finish(94);
1017
- case 97:
1047
+ return _context8.finish(96);
1048
+ case 99:
1018
1049
  if (amountOutList) {
1019
- _context8.next = 99;
1050
+ _context8.next = 101;
1020
1051
  break;
1021
1052
  }
1022
1053
  throw new Error("MultiSwapped event not found: ".concat(receipt.hash));
1023
- case 99:
1054
+ case 101:
1024
1055
  Aggregator.traceLog(params.chain, 'log', "multiSwap\u5B8C\u6210, txHash=".concat(receipt.hash, ", amountOutList=[").concat(amountOutList.join(','), "], useBundle=").concat(useBundle, ", \u603B\u8017\u65F6=").concat(Date.now() - startTs, "ms"));
1025
1056
  return _context8.abrupt("return", {
1026
1057
  hash: receipt.hash,
@@ -1038,16 +1069,16 @@ var Aggregator = /*#__PURE__*/function () {
1038
1069
  }),
1039
1070
  receipt: receipt
1040
1071
  });
1041
- case 103:
1042
- _context8.prev = 103;
1072
+ case 105:
1073
+ _context8.prev = 105;
1043
1074
  _context8.t3 = _context8["catch"](4);
1044
1075
  Aggregator.traceLog(params.chain, 'error', "multiSwap\u5F02\u5E38, rpcUrl=".concat(this.getRpcUrl(params.chain), ", txHash=").concat((_txHash3 = txHash) !== null && _txHash3 !== void 0 ? _txHash3 : 'N/A', ", \u603B\u8017\u65F6=").concat(Date.now() - startTs, "ms, error=").concat(_context8.t3));
1045
1076
  throw _context8.t3;
1046
- case 107:
1077
+ case 109:
1047
1078
  case "end":
1048
1079
  return _context8.stop();
1049
1080
  }
1050
- }, _callee8, this, [[4, 103], [35, 41], [73, 91, 94, 97], [78, 85]]);
1081
+ }, _callee8, this, [[4, 105], [35, 41], [75, 93, 96, 99], [80, 87]]);
1051
1082
  }));
1052
1083
  function multiSwap(_x18) {
1053
1084
  return _multiSwap.apply(this, arguments);
@@ -1155,7 +1186,7 @@ var Aggregator = /*#__PURE__*/function () {
1155
1186
  txReq = _context9.sent;
1156
1187
  iface = new ethers.Interface(AggregatorAbi);
1157
1188
  if (!useBundle) {
1158
- _context9.next = 49;
1189
+ _context9.next = 51;
1159
1190
  break;
1160
1191
  }
1161
1192
  calldata = iface.encodeFunctionData('batchMultiSwap', [params.users, params.amountInWeis, swapParamsList, params.minAmountOutLists]);
@@ -1173,75 +1204,81 @@ var Aggregator = /*#__PURE__*/function () {
1173
1204
  }
1174
1205
  throw new BundleNotIncludedError("Bundle \u672A\u5728\u76EE\u6807\u533A\u5757\u4E0A\u94FE, txHash=".concat(bundleTxHash, ", targetBlocks=[").concat(targetBlocks.join(','), "]"), bundleTxHash);
1175
1206
  case 46:
1207
+ if (!(flashbotsReceipt.status === 0)) {
1208
+ _context9.next = 48;
1209
+ break;
1210
+ }
1211
+ throw new TransactionRevertedError(flashbotsReceipt.hash, flashbotsReceipt.gasUsed);
1212
+ case 48:
1176
1213
  receipt = flashbotsReceipt;
1177
- _context9.next = 53;
1214
+ _context9.next = 55;
1178
1215
  break;
1179
- case 49:
1180
- _context9.next = 51;
1181
- return this.sendContractTx(params.chain, aggregator, 'batchMultiSwap', [params.users, params.amountInWeis, swapParamsList, params.minAmountOutLists], txReq);
1182
1216
  case 51:
1217
+ _context9.next = 53;
1218
+ return this.sendContractTx(params.chain, aggregator, 'batchMultiSwap', [params.users, params.amountInWeis, swapParamsList, params.minAmountOutLists], txReq);
1219
+ case 53:
1183
1220
  receipt = _context9.sent;
1184
1221
  txHash = receipt.hash;
1185
- case 53:
1222
+ case 55:
1186
1223
  userList = null;
1187
1224
  amountInList = null;
1188
1225
  amountOutList = null;
1189
1226
  _iterator4 = _createForOfIteratorHelper(receipt.logs);
1190
- _context9.prev = 57;
1227
+ _context9.prev = 59;
1191
1228
  _iterator4.s();
1192
- case 59:
1229
+ case 61:
1193
1230
  if ((_step4 = _iterator4.n()).done) {
1194
- _context9.next = 75;
1231
+ _context9.next = 77;
1195
1232
  break;
1196
1233
  }
1197
1234
  log = _step4.value;
1198
1235
  if (!(log.address.toLowerCase() === aggregatorAddress.toLowerCase())) {
1199
- _context9.next = 73;
1236
+ _context9.next = 75;
1200
1237
  break;
1201
1238
  }
1202
- _context9.prev = 62;
1239
+ _context9.prev = 64;
1203
1240
  parsed = iface.parseLog(log);
1204
1241
  if (!(parsed && parsed.name === 'BatchMultiSwapped' && parsed.args)) {
1205
- _context9.next = 69;
1242
+ _context9.next = 71;
1206
1243
  break;
1207
1244
  }
1208
1245
  userList = parsed.args.userList;
1209
1246
  amountInList = parsed.args.amountInList;
1210
1247
  amountOutList = parsed.args.amountOutList;
1211
- return _context9.abrupt("break", 75);
1212
- case 69:
1213
- _context9.next = 73;
1214
- break;
1248
+ return _context9.abrupt("break", 77);
1215
1249
  case 71:
1216
- _context9.prev = 71;
1217
- _context9.t1 = _context9["catch"](62);
1218
- case 73:
1219
- _context9.next = 59;
1250
+ _context9.next = 75;
1220
1251
  break;
1252
+ case 73:
1253
+ _context9.prev = 73;
1254
+ _context9.t1 = _context9["catch"](64);
1221
1255
  case 75:
1222
- _context9.next = 80;
1256
+ _context9.next = 61;
1223
1257
  break;
1224
1258
  case 77:
1225
- _context9.prev = 77;
1226
- _context9.t2 = _context9["catch"](57);
1259
+ _context9.next = 82;
1260
+ break;
1261
+ case 79:
1262
+ _context9.prev = 79;
1263
+ _context9.t2 = _context9["catch"](59);
1227
1264
  _iterator4.e(_context9.t2);
1228
- case 80:
1229
- _context9.prev = 80;
1265
+ case 82:
1266
+ _context9.prev = 82;
1230
1267
  _iterator4.f();
1231
- return _context9.finish(80);
1232
- case 83:
1268
+ return _context9.finish(82);
1269
+ case 85:
1233
1270
  if (!(!userList || !amountInList || !amountOutList)) {
1234
- _context9.next = 85;
1271
+ _context9.next = 87;
1235
1272
  break;
1236
1273
  }
1237
1274
  throw new Error("MultiSwapped event not found: ".concat(receipt.hash));
1238
- case 85:
1275
+ case 87:
1239
1276
  if (!(userList.length !== params.users.length || amountOutList.length !== params.users.length)) {
1240
- _context9.next = 87;
1277
+ _context9.next = 89;
1241
1278
  break;
1242
1279
  }
1243
1280
  throw new Error("MultiSwapped event length mismatch: ".concat(receipt.hash));
1244
- case 87:
1281
+ case 89:
1245
1282
  Aggregator.traceLog(params.chain, 'log', "batchMultiSwap\u5B8C\u6210, txHash=".concat(receipt.hash, ", amountOutList=[").concat(amountOutList.join(','), "], useBundle=").concat(useBundle, ", \u603B\u8017\u65F6=").concat(Date.now() - startTs, "ms"));
1246
1283
  return _context9.abrupt("return", {
1247
1284
  hash: receipt.hash,
@@ -1259,16 +1296,16 @@ var Aggregator = /*#__PURE__*/function () {
1259
1296
  }),
1260
1297
  receipt: receipt
1261
1298
  });
1262
- case 91:
1263
- _context9.prev = 91;
1299
+ case 93:
1300
+ _context9.prev = 93;
1264
1301
  _context9.t3 = _context9["catch"](4);
1265
1302
  Aggregator.traceLog(params.chain, 'error', "batchMultiSwap\u5F02\u5E38, rpcUrl=".concat(this.getRpcUrl(params.chain), ", txHash=").concat((_txHash4 = txHash) !== null && _txHash4 !== void 0 ? _txHash4 : 'N/A', ", \u603B\u8017\u65F6=").concat(Date.now() - startTs, "ms, error=").concat(_context9.t3));
1266
1303
  throw _context9.t3;
1267
- case 95:
1304
+ case 97:
1268
1305
  case "end":
1269
1306
  return _context9.stop();
1270
1307
  }
1271
- }, _callee9, this, [[4, 91], [17, 23], [57, 77, 80, 83], [62, 71]]);
1308
+ }, _callee9, this, [[4, 93], [17, 23], [59, 79, 82, 85], [64, 73]]);
1272
1309
  }));
1273
1310
  function batchMultiSwap(_x19) {
1274
1311
  return _batchMultiSwap.apply(this, arguments);
@@ -1445,7 +1482,7 @@ var Aggregator = /*#__PURE__*/function () {
1445
1482
  case 39:
1446
1483
  txReq = _context11.sent;
1447
1484
  if (!useBundle) {
1448
- _context11.next = 55;
1485
+ _context11.next = 57;
1449
1486
  break;
1450
1487
  }
1451
1488
  iface = new ethers.Interface(AggregatorAbi);
@@ -1464,16 +1501,22 @@ var Aggregator = /*#__PURE__*/function () {
1464
1501
  }
1465
1502
  throw new BundleNotIncludedError("Bundle \u672A\u5728\u76EE\u6807\u533A\u5757\u4E0A\u94FE, txHash=".concat(bundleTxHash, ", targetBlocks=[").concat(targetBlocks.join(','), "]"), bundleTxHash);
1466
1503
  case 52:
1504
+ if (!(flashbotsReceipt.status === 0)) {
1505
+ _context11.next = 54;
1506
+ break;
1507
+ }
1508
+ throw new TransactionRevertedError(flashbotsReceipt.hash, flashbotsReceipt.gasUsed);
1509
+ case 54:
1467
1510
  txReceipt = flashbotsReceipt;
1468
- _context11.next = 59;
1511
+ _context11.next = 61;
1469
1512
  break;
1470
- case 55:
1471
- _context11.next = 57;
1472
- return this.sendContractTx(params.chain, aggregator, 'bridge', [params.user, bridgeArgs], txReq);
1473
1513
  case 57:
1514
+ _context11.next = 59;
1515
+ return this.sendContractTx(params.chain, aggregator, 'bridge', [params.user, bridgeArgs], txReq);
1516
+ case 59:
1474
1517
  txReceipt = _context11.sent;
1475
1518
  txHash = txReceipt.hash;
1476
- case 59:
1519
+ case 61:
1477
1520
  Aggregator.traceLog(params.chain, 'log', "bridge\u5B8C\u6210, txHash=".concat(txReceipt.hash, ", useBundle=").concat(useBundle, ", \u603B\u8017\u65F6=").concat(Date.now() - startTs, "ms"));
1478
1521
  return _context11.abrupt("return", {
1479
1522
  fromToken: params.tokenAddress,
@@ -1483,16 +1526,16 @@ var Aggregator = /*#__PURE__*/function () {
1483
1526
  from: txReceipt.from,
1484
1527
  to: (_txReceipt$to = txReceipt.to) !== null && _txReceipt$to !== void 0 ? _txReceipt$to : ''
1485
1528
  });
1486
- case 63:
1487
- _context11.prev = 63;
1529
+ case 65:
1530
+ _context11.prev = 65;
1488
1531
  _context11.t1 = _context11["catch"](4);
1489
1532
  Aggregator.traceLog(params.chain, 'error', "bridge\u5F02\u5E38, rpcUrl=".concat(this.getRpcUrl(params.chain), ", txHash=").concat((_txHash5 = txHash) !== null && _txHash5 !== void 0 ? _txHash5 : 'N/A', ", \u603B\u8017\u65F6=").concat(Date.now() - startTs, "ms, error=").concat(_context11.t1));
1490
1533
  throw _context11.t1;
1491
- case 67:
1534
+ case 69:
1492
1535
  case "end":
1493
1536
  return _context11.stop();
1494
1537
  }
1495
- }, _callee11, this, [[4, 63], [23, 29]]);
1538
+ }, _callee11, this, [[4, 65], [23, 29]]);
1496
1539
  }));
1497
1540
  function bridge(_x21) {
1498
1541
  return _bridge.apply(this, arguments);
@@ -1887,7 +1930,9 @@ var Aggregator = /*#__PURE__*/function () {
1887
1930
  var p = _step6.value;
1888
1931
  try {
1889
1932
  p.destroy();
1890
- } catch (_unused8) {/* ignore */}
1933
+ } catch (_unused8) {
1934
+ /* ignore */
1935
+ }
1891
1936
  }
1892
1937
  } catch (err) {
1893
1938
  _iterator6.e(err);
@@ -1953,7 +1998,7 @@ var Aggregator = /*#__PURE__*/function () {
1953
1998
  case 0:
1954
1999
  extraUrls = this.broadcastRpcsMap.get(chain);
1955
2000
  if (!(!extraUrls || extraUrls.length === 0)) {
1956
- _context16.next = 17;
2001
+ _context16.next = 19;
1957
2002
  break;
1958
2003
  }
1959
2004
  Aggregator.traceLog(chain, 'log', "\u6E20\u9053=\u5355RPC\u76F4\u53D1, method=".concat(method, ", nonce=").concat(txReq.nonce, ", gasLimit=").concat(txReq.gasLimit));
@@ -1972,29 +2017,35 @@ var Aggregator = /*#__PURE__*/function () {
1972
2017
  return this.getBlockTimestampStr(singleProvider, _receipt.blockNumber);
1973
2018
  case 14:
1974
2019
  _blockTs = _context16.sent;
1975
- Aggregator.traceLog(chain, 'log', "\u5355RPC\u4E0A\u94FE\u786E\u8BA4, txHash=".concat(_receipt.hash, ", blockNumber=").concat(_receipt.blockNumber, ", \u51FA\u5757\u65F6\u95F4=").concat(_blockTs, ", gasUsed=").concat(_receipt.gasUsed));
2020
+ Aggregator.traceLog(chain, 'log', "\u5355RPC\u4E0A\u94FE\u786E\u8BA4, txHash=".concat(_receipt.hash, ", blockNumber=").concat(_receipt.blockNumber, ", \u51FA\u5757\u65F6\u95F4=").concat(_blockTs, ", gasUsed=").concat(_receipt.gasUsed, ", status=").concat(_receipt.status));
2021
+ if (!(_receipt.status === 0)) {
2022
+ _context16.next = 18;
2023
+ break;
2024
+ }
2025
+ throw new TransactionRevertedError(_receipt.hash, _receipt.gasUsed);
2026
+ case 18:
1976
2027
  return _context16.abrupt("return", _receipt);
1977
- case 17:
2028
+ case 19:
1978
2029
  wallet = this.providerClient.getWallet(chain);
1979
- _context16.next = 20;
2030
+ _context16.next = 22;
1980
2031
  return (_method = contract[method]).populateTransaction.apply(_method, _toConsumableArray(args).concat([txReq]));
1981
- case 20:
2032
+ case 22:
1982
2033
  populated = _context16.sent;
1983
2034
  delete populated.from;
1984
- _context16.next = 24;
2035
+ _context16.next = 26;
1985
2036
  return wallet.provider.getNetwork();
1986
- case 24:
2037
+ case 26:
1987
2038
  network = _context16.sent;
1988
2039
  populated.chainId = network.chainId;
1989
- _context16.next = 28;
2040
+ _context16.next = 30;
1990
2041
  return wallet.signTransaction(populated);
1991
- case 28:
2042
+ case 30:
1992
2043
  signedTx = _context16.sent;
1993
2044
  txHash = ethers.keccak256(signedTx);
1994
2045
  mainProvider = wallet.provider;
1995
- _context16.next = 33;
2046
+ _context16.next = 35;
1996
2047
  return mainProvider.getBlockNumber();
1997
- case 33:
2048
+ case 35:
1998
2049
  currentBlock = _context16.sent;
1999
2050
  extraProviders = extraUrls.map(function (url, i) {
2000
2051
  return {
@@ -2012,17 +2063,23 @@ var Aggregator = /*#__PURE__*/function () {
2012
2063
  Aggregator.traceLog(chain, 'log', "\u6E20\u9053=\u591ARPC\u5E7F\u64AD, method=".concat(method, ", nonce=").concat(txReq.nonce, ", gasLimit=").concat(txReq.gasLimit, ", ") + "\u5F53\u524D\u533A\u5757=".concat(currentBlock, ", \u671F\u671B\u4E0A\u94FE\u533A\u5757=").concat(currentBlock + 1, ", txHash=").concat(txHash, ", ") + "RPC\u6570\u91CF=".concat(allProviders.length, "(\u4E3B1+\u526F").concat(extraUrls.length, ")"));
2013
2064
  broadcastTs = Date.now();
2014
2065
  this.broadcastToAll(chain, signedTx, txHash, allProviders);
2015
- _context16.next = 42;
2066
+ _context16.next = 44;
2016
2067
  return this.raceForReceipt(chain, txHash, allProviders, ownedProviders);
2017
- case 42:
2068
+ case 44:
2018
2069
  receipt = _context16.sent;
2019
- _context16.next = 45;
2070
+ _context16.next = 47;
2020
2071
  return this.getBlockTimestampStr(mainProvider, receipt.blockNumber);
2021
- case 45:
2072
+ case 47:
2022
2073
  blockTs = _context16.sent;
2023
- Aggregator.traceLog(chain, 'log', "\u591ARPC\u5E7F\u64AD\u4E0A\u94FE\u786E\u8BA4, txHash=".concat(receipt.hash, ", blockNumber=").concat(receipt.blockNumber, ", \u51FA\u5757\u65F6\u95F4=").concat(blockTs, ", gasUsed=").concat(receipt.gasUsed, ", ") + "\u603B\u8017\u65F6=".concat(Date.now() - broadcastTs, "ms"));
2074
+ Aggregator.traceLog(chain, 'log', "\u591ARPC\u5E7F\u64AD\u4E0A\u94FE\u786E\u8BA4, txHash=".concat(receipt.hash, ", blockNumber=").concat(receipt.blockNumber, ", \u51FA\u5757\u65F6\u95F4=").concat(blockTs, ", gasUsed=").concat(receipt.gasUsed, ", status=").concat(receipt.status, ", ") + "\u603B\u8017\u65F6=".concat(Date.now() - broadcastTs, "ms"));
2075
+ if (!(receipt.status === 0)) {
2076
+ _context16.next = 51;
2077
+ break;
2078
+ }
2079
+ throw new TransactionRevertedError(receipt.hash, receipt.gasUsed);
2080
+ case 51:
2024
2081
  return _context16.abrupt("return", receipt);
2025
- case 48:
2082
+ case 52:
2026
2083
  case "end":
2027
2084
  return _context16.stop();
2028
2085
  }
@@ -2504,21 +2561,11 @@ _defineProperty(Aggregator, "DEFAULT_ETH_BUILDERS", {
2504
2561
  'beaverbuild.org': 'https://rpc.beaverbuild.org',
2505
2562
  Titan: 'https://rpc.titanbuilder.xyz',
2506
2563
  flashbots: 'https://relay.flashbots.net',
2507
- bloXroute: 'https://api.blxrbdn.com',
2508
- rsync: 'https://rsync-builder.xyz',
2509
- 'builder0x69.io': 'https://builder0x69.io',
2510
- bloxroute: 'https://bloxroute.max-profit.blxrbdn.com',
2511
- blocknative: 'https://builder.blocknative.com',
2512
- eden: 'https://relay.edennetwork.io',
2513
- ultra_sound_relay: 'https://relay.ultrasound.money',
2514
- lokibuilder: 'https://relay.lokibuilder.xyz',
2515
- penguinbuild: 'https://relay.penguinbuild.org',
2516
- gambit: 'https://builder.gmbit.co',
2517
- jetbuilder: 'https://relay.jetbld.xyz',
2518
- f1b: 'https://builder.f1b.io',
2519
- buildai: 'https://relay.buildai.net',
2520
- tbuilder: 'https://relay.tbuilder.xyz',
2521
- bobabuilder: 'https://relay.boba-builder.com'
2564
+ // bloXroute: 'https://mev.api.blxrbdn.com', // 旧 api.blxrbdn.com 也行,需配置 Authorization 头
2565
+ lightspeedbuilder: 'https://rpc.lightspeedbuilder.info',
2566
+ // 新增,实测直接可用
2567
+ // buildernet: 'https://rpc.buildernet.org', // 新增,Flashbots 生态,需签名头(同 flashbots 格式)
2568
+ nfactorial: 'https://rpc.nfactorial.xyz' // 新增,支持 bundle rebate
2522
2569
  });
2523
2570
  _defineProperty(Aggregator, "TX_CONFIRM_TIMEOUT_MS", 120000);
2524
2571
  _defineProperty(Aggregator, "BUNDLE_POLL_INTERVAL_MS", 500);
@@ -2,8 +2,8 @@ import type { HermesTxRequest, IBatchMultiSwapParams, IBatchExpectParams, ISwapB
2
2
  import { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap } from './types.js';
3
3
  import { TransactionRequest } from 'ethers';
4
4
  export type { HermesTxRequest, IBatchMultiSwapAndBridgeParams, IExpectSplitOrderParams, IExpectSplitOrderResp, IMultiSwapParams, IBatchMultiSwapParams, IBatchExpectParams, IBatchReceipt, ISwapByPathParams as ISwapParams, IBridgeParams, ISwapAndBridgeParams, IReceipt, IConfig, IBuilderConfig, IExpectPayload, IRouterPath, SupportContracts, IHermesSignalResponse, IHermesSignalRoute, };
5
- import { BundleNotIncludedError } from './types.js';
6
- export { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap, BundleNotIncludedError };
5
+ import { BundleNotIncludedError, TransactionRevertedError } from './types.js';
6
+ export { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap, BundleNotIncludedError, TransactionRevertedError };
7
7
  declare class Hermes {
8
8
  private readonly config;
9
9
  private readonly providerClient;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,8BAA8B,EAC9B,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC7L,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAM5C,YAAY,EACV,eAAe,EACf,8BAA8B,EAC9B,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,IAAI,WAAW,EAChC,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,GACnB,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,CAAC;AAE7N,cAAM,MAAM;IACV,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,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;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;IAIxE,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAI/E,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,WAAW,CAAC,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAInJ,6BAA6B,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAIhF,yBAAyB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAIlF;;OAEG;IACH,wBAAwB,CAAC,MAAM,EAAE,oBAAoB,GAAG;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;CAGpG;AAGD,eAAe,MAAM,CAAC;AAGtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -15,8 +15,8 @@ import Provider from "./provider.mjs";
15
15
 
16
16
  // 导出所有类型定义,方便用户使用
17
17
 
18
- import { BundleNotIncludedError } from "./types.mjs";
19
- export { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap, BundleNotIncludedError };
18
+ import { BundleNotIncludedError, TransactionRevertedError } from "./types.mjs";
19
+ export { ChainNameEnum, AddressConst, DexType, BridgeType, IEstimateType, LayerZeroV1ChainIdMap, LayerZeroV1ChainNameMap, LayerZeroV2ChainIdMap, LayerZeroV2ChainNameMap, BundleNotIncludedError, TransactionRevertedError };
20
20
  var Hermes = /*#__PURE__*/function () {
21
21
  function Hermes(config) {
22
22
  _classCallCheck(this, Hermes);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAEzD,cAAM,QAAQ;IACZ,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,WAAW,CAAkD;IACrE,OAAO,CAAC,SAAS,CAAgD;gBAErD,MAAM,EAAE,OAAO;IAapB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAAC,QAAQ;IAO5C,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc7J,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM;CAMtD;AAED,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quoter.d.ts","sourceRoot":"","sources":["quoter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAU,KAAK,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEnE,OAAO,EAAgB,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,uBAAuB,EAAE,KAAK,qBAAqB,EAAuD,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE3P,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC,cAAM,MAAM;IACV,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAW;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAC5C,OAAO,CAAC,gBAAgB,CAAyC;IACjE,OAAO,CAAC,SAAS,CAA2C;gBAEhD,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,QAAQ;IAY/C,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ;IAOnC,YAAY,CAAC,MAAM,EAAE,mBAAmB,EAAE,KAAK,GAAE,kBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgB1F,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAiCzE,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IA0BzD,yBAAyB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAgB1F;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -516,3 +516,8 @@ export declare class BundleNotIncludedError extends Error {
516
516
  readonly txHash: string;
517
517
  constructor(message: string, txHash: string);
518
518
  }
519
+ export declare class TransactionRevertedError extends Error {
520
+ readonly txHash: string;
521
+ readonly gasUsed: bigint;
522
+ constructor(txHash: string, gasUsed: bigint);
523
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAGjG,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,WAAW,GAAG,MAAM,CAAC;IAC/B,MAAM,CAAC,EAA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M,WAAW,cAAc;CAAI;AACnC,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAEnB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAK5C;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAEpB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAM5C"}
@@ -443,4 +443,20 @@ export var BundleNotIncludedError = /*#__PURE__*/function (_Error) {
443
443
  return _this;
444
444
  }
445
445
  return _createClass(BundleNotIncludedError);
446
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
447
+ export var TransactionRevertedError = /*#__PURE__*/function (_Error2) {
448
+ _inherits(TransactionRevertedError, _Error2);
449
+ var _super2 = _createSuper(TransactionRevertedError);
450
+ function TransactionRevertedError(txHash, gasUsed) {
451
+ var _this2;
452
+ _classCallCheck(this, TransactionRevertedError);
453
+ _this2 = _super2.call(this, "Transaction reverted: ".concat(txHash, ", gasUsed=").concat(gasUsed));
454
+ _defineProperty(_assertThisInitialized(_this2), "txHash", void 0);
455
+ _defineProperty(_assertThisInitialized(_this2), "gasUsed", void 0);
456
+ _this2.name = 'TransactionRevertedError';
457
+ _this2.txHash = txHash;
458
+ _this2.gasUsed = gasUsed;
459
+ return _this2;
460
+ }
461
+ return _createClass(TransactionRevertedError);
446
462
  }( /*#__PURE__*/_wrapNativeSuper(Error));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-swap",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "A TypeScript utility library for swap and bridge",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.mjs",