@hyperbridge/sdk 1.8.6-rc.1 → 1.8.8

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.
@@ -617,11 +617,15 @@ declare class ChainConfigService {
617
617
  getHyperbridgeChainId(): number;
618
618
  getRpcUrl(chain: string): string;
619
619
  getUniswapRouterV2Address(chain: string): HexString;
620
+ getAerodromeRouterAddress(chain: string): HexString;
620
621
  getUniswapV2FactoryAddress(chain: string): HexString;
621
622
  getUniswapV3FactoryAddress(chain: string): HexString;
622
623
  getUniversalRouterAddress(chain: string): HexString;
623
624
  getUniswapV3QuoterAddress(chain: string): HexString;
624
625
  getUniswapV4QuoterAddress(chain: string): HexString;
626
+ getUniswapV4PositionManagerAddress(chain: string): HexString;
627
+ getUniswapV4PoolManagerAddress(chain: string): HexString;
628
+ getUniswapV4StateViewAddress(chain: string): HexString;
625
629
  getPermit2Address(chain: string): HexString;
626
630
  getSolverAccountAddress(chain: string): HexString | undefined;
627
631
  getCoingeckoId(chain: string): string | undefined;
@@ -2803,6 +2807,12 @@ interface SubmitBidOptions {
2803
2807
  }
2804
2808
  interface EstimateFillOrderParams {
2805
2809
  order: Order;
2810
+ /**
2811
+ * Optional ERC-7821 calls to prepend before the fillOrder call in the
2812
+ * simulated UserOp. Used for funding calls (e.g. LP withdrawal) so the
2813
+ * bundler estimates gas for the complete atomic batch.
2814
+ */
2815
+ prependCalls?: ERC7821Call[];
2806
2816
  /**
2807
2817
  * Optional percentage to bump maxPriorityFeePerGas.
2808
2818
  * This is added on top of the base gasPrice.
@@ -2893,7 +2903,7 @@ declare const IntentOrderStatus: Readonly<{
2893
2903
  USEROP_SUBMITTED: "USEROP_SUBMITTED";
2894
2904
  FILLED: "FILLED";
2895
2905
  PARTIAL_FILL: "PARTIAL_FILL";
2896
- PARTIAL_FILL_EXHAUSTED: "PARTIAL_FILL_EXHAUSTED";
2906
+ EXPIRED: "EXPIRED";
2897
2907
  FAILED: "FAILED";
2898
2908
  }>;
2899
2909
  type IntentOrderStatus = typeof IntentOrderStatus;
@@ -2949,7 +2959,7 @@ type IntentOrderStatusUpdate = {
2949
2959
  totalFilledAssets: TokenInfo[];
2950
2960
  remainingAssets: TokenInfo[];
2951
2961
  } | {
2952
- status: "PARTIAL_FILL_EXHAUSTED";
2962
+ status: "EXPIRED";
2953
2963
  commitment: HexString;
2954
2964
  totalFilledAssets?: TokenInfo[];
2955
2965
  remainingAssets?: TokenInfo[];
@@ -3762,6 +3772,8 @@ declare const BundlerMethod: {
3762
3772
  readonly ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas";
3763
3773
  /** Pimlico-specific method to fetch recommended EIP-1559 gas prices for UserOperations. */
3764
3774
  readonly PIMLICO_GET_USER_OPERATION_GAS_PRICE: "pimlico_getUserOperationGasPrice";
3775
+ /** Alchemy (Rundler) method to fetch recommended priority fee for UserOperations. */
3776
+ readonly RUNDLER_MAX_PRIORITY_FEE_PER_GAS: "rundler_maxPriorityFeePerGas";
3765
3777
  };
3766
3778
  /** Union of all valid bundler RPC method name strings. */
3767
3779
  type BundlerMethod = (typeof BundlerMethod)[keyof typeof BundlerMethod];
@@ -8096,6 +8108,14 @@ interface ChainConfigData {
8096
8108
  Usdt0Oft?: `0x${string}`;
8097
8109
  /** SolverAccount contract address used for EIP-7702 delegation */
8098
8110
  SolverAccount?: `0x${string}`;
8111
+ /** Aerodrome (Solidly-style) router for LP removal / swaps on chains where Aerodrome is deployed */
8112
+ AerodromeRouter?: `0x${string}`;
8113
+ /** Uniswap V4 PositionManager (canonical CREATE2 address) for LP position management */
8114
+ UniswapV4PositionManager?: `0x${string}`;
8115
+ /** Uniswap V4 PoolManager (canonical CREATE2 address) for pool state reads via extsload */
8116
+ UniswapV4PoolManager?: `0x${string}`;
8117
+ /** Uniswap V4 StateView (canonical CREATE2 address) for pool state reads via extsload */
8118
+ UniswapV4StateView?: `0x${string}`;
8099
8119
  };
8100
8120
  rpcEnvKey?: string;
8101
8121
  defaultRpcUrl?: string;
@@ -559,7 +559,7 @@ var IntentOrderStatus = Object.freeze({
559
559
  USEROP_SUBMITTED: "USEROP_SUBMITTED",
560
560
  FILLED: "FILLED",
561
561
  PARTIAL_FILL: "PARTIAL_FILL",
562
- PARTIAL_FILL_EXHAUSTED: "PARTIAL_FILL_EXHAUSTED",
562
+ EXPIRED: "EXPIRED",
563
563
  FAILED: "FAILED"
564
564
  });
565
565
 
@@ -3787,6 +3787,9 @@ var chainConfigs = {
3787
3787
  UniversalRouter: "0x66a9893cc07d91d95644aedd05d03f95e1dba8af",
3788
3788
  UniswapV3Quoter: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
3789
3789
  UniswapV4Quoter: "0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203",
3790
+ UniswapV4PositionManager: "0xbd216513d74c8cf14cf4747e6aaa6420ff64ee9e",
3791
+ UniswapV4PoolManager: "0x000000000004444c5dc75cB358380D2e3dE08A90",
3792
+ UniswapV4StateView: "0x7ffe42c4a5deea5b0fec41c94c136cf115597227",
3790
3793
  Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
3791
3794
  Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
3792
3795
  EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
@@ -3839,6 +3842,9 @@ var chainConfigs = {
3839
3842
  UniversalRouter: "0xd9C500DfF816a1Da21A48A732d3498Bf09dc9AEB",
3840
3843
  UniswapV3Quoter: "0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997",
3841
3844
  UniswapV4Quoter: "0xd0737C9762912dD34c3271197E362Aa736Df0926",
3845
+ UniswapV4PositionManager: "0x7a4a5c919ae2541aed11041a1aeee68f1287f95b",
3846
+ UniswapV4PoolManager: "0x28e2ea090877bf75740558f6bfb36a5ffee9e9df",
3847
+ UniswapV4StateView: "0xd13dd3d6e93f276fafc9db9e6bb47c1180aee0c4",
3842
3848
  Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
3843
3849
  Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
3844
3850
  EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
@@ -3893,6 +3899,9 @@ var chainConfigs = {
3893
3899
  UniversalRouter: "0xa51afafe0263b40edaef0df8781ea9aa03e381a3",
3894
3900
  UniswapV3Quoter: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
3895
3901
  UniswapV4Quoter: "0x3972c00f7ed4885e145823eb7c655375d275a1c5",
3902
+ UniswapV4PositionManager: "0xd88f38f930b7952f2db2432cb002e7abbf3dd869",
3903
+ UniswapV4PoolManager: "0x360e68faccca8ca495c1b759fd9eee466db9fb32",
3904
+ UniswapV4StateView: "0x76fd297e2d437cd7f76d50f01afe6160f86e9990",
3896
3905
  Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
3897
3906
  Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
3898
3907
  EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
@@ -3949,7 +3958,11 @@ var chainConfigs = {
3949
3958
  UniswapV4Quoter: "0x0d5e0f971ed27fbff6c2837bf31316121532048d",
3950
3959
  Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
3951
3960
  Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
3952
- EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
3961
+ EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
3962
+ AerodromeRouter: "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
3963
+ UniswapV4PositionManager: "0x7c5f5a4bbd8fd63184577525326123b519429bdc",
3964
+ UniswapV4PoolManager: "0x498581ff718922c3f8e6a244956af099b2652b2b",
3965
+ UniswapV4StateView: "0xa3c0c9b65bad0b08107aa264b0f3db444b867a71"
3953
3966
  // Usdt0Oft: Not available on Base
3954
3967
  },
3955
3968
  rpcEnvKey: "BASE_MAINNET",
@@ -4001,6 +4014,9 @@ var chainConfigs = {
4001
4014
  UniversalRouter: "0x1095692a6237d83c6a72f3f5efedb9a670c49223",
4002
4015
  UniswapV3Quoter: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
4003
4016
  UniswapV4Quoter: "0xb3d5c3dfc3a7aebff71895a7191796bffc2c81b9",
4017
+ UniswapV4PositionManager: "0x1ec2ebf4f37e7363fdfe3551602425af0b3ceef9",
4018
+ UniswapV4PoolManager: "0x67366782805870060151383f4bbff9dab53e5cd6",
4019
+ UniswapV4StateView: "0x5ea1bd7974c8a611cbab0bdcafcb1d9cc9b3ba5a",
4004
4020
  Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
4005
4021
  Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
4006
4022
  EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
@@ -4045,6 +4061,9 @@ var chainConfigs = {
4045
4061
  UniversalRouter: "0xef740bf23acae26f6492b10de645d6b98dc8eaf3",
4046
4062
  UniswapV3Quoter: "0x385a5cf5f83e99f7bb2852b6a19c3538b9fa7658",
4047
4063
  UniswapV4Quoter: "0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203",
4064
+ UniswapV4PositionManager: "0x4529a01c7a0410167c5740c487a8de60232617bf",
4065
+ UniswapV4PoolManager: "0x1f98400000000000000000000000000000000004",
4066
+ UniswapV4StateView: "0x86e8631a016f9068c3f085faf484ee3f5fdee8f2",
4048
4067
  Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
4049
4068
  Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
4050
4069
  EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
@@ -4150,7 +4169,9 @@ var chainConfigs = {
4150
4169
  UniswapV3Factory: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
4151
4170
  Calldispatcher: "0xC71251c8b3e7B02697A84363Eef6DcE8DfBdF333",
4152
4171
  Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
4153
- EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
4172
+ EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
4173
+ UniswapV4PositionManager: "0x3c3ea4b57a46241e54610e5f022e5c45859a1017",
4174
+ UniswapV4PoolManager: "0x9a13f98cb987694c9f086b1f5eb990eea8264ec3"
4154
4175
  },
4155
4176
  defaultRpcUrl: "https://mainnet.optimism.io",
4156
4177
  consensusStateId: "ETH0",
@@ -4206,7 +4227,9 @@ var chainConfigs = {
4206
4227
  addresses: {
4207
4228
  TokenGateway: "0xCe304770236f39F9911BfCC51afBdfF3b8635718",
4208
4229
  Host: "0x7F0165140D0f3251c8f6465e94E9d12C7FD40711",
4209
- EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
4230
+ EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
4231
+ UniswapV4PositionManager: "0x1b35d13a2e2528f192637f14b05f0dc0e7deb566",
4232
+ UniswapV4PoolManager: "0x360e68faccca8ca495c1b759fd9eee466db9fb32"
4210
4233
  },
4211
4234
  defaultRpcUrl: "https://rpc.soneium.org",
4212
4235
  consensusStateId: "ETH0",
@@ -4400,6 +4423,9 @@ var ChainConfigService = class {
4400
4423
  getUniswapRouterV2Address(chain) {
4401
4424
  return this.getConfig(chain)?.addresses.UniswapRouter02 ?? "0x";
4402
4425
  }
4426
+ getAerodromeRouterAddress(chain) {
4427
+ return this.getConfig(chain)?.addresses.AerodromeRouter ?? "0x";
4428
+ }
4403
4429
  getUniswapV2FactoryAddress(chain) {
4404
4430
  return this.getConfig(chain)?.addresses.UniswapV2Factory ?? "0x";
4405
4431
  }
@@ -4415,6 +4441,15 @@ var ChainConfigService = class {
4415
4441
  getUniswapV4QuoterAddress(chain) {
4416
4442
  return this.getConfig(chain)?.addresses.UniswapV4Quoter ?? "0x";
4417
4443
  }
4444
+ getUniswapV4PositionManagerAddress(chain) {
4445
+ return this.getConfig(chain)?.addresses.UniswapV4PositionManager ?? "0x";
4446
+ }
4447
+ getUniswapV4PoolManagerAddress(chain) {
4448
+ return this.getConfig(chain)?.addresses.UniswapV4PoolManager ?? "0x";
4449
+ }
4450
+ getUniswapV4StateViewAddress(chain) {
4451
+ return this.getConfig(chain)?.addresses.UniswapV4StateView ?? "0x";
4452
+ }
4418
4453
  getPermit2Address(chain) {
4419
4454
  return this.getConfig(chain)?.addresses.Permit2 ?? "0x";
4420
4455
  }
@@ -7604,14 +7639,21 @@ var PolkadotHubChain = class _PolkadotHubChain {
7604
7639
  childKeysHex,
7605
7640
  blockHash
7606
7641
  ]);
7642
+ const childNodes = childRead.proof.map((p) => hexToBytes(p));
7607
7643
  storageProofEncoded.set(
7608
7644
  addr20,
7609
- childRead.proof.map((p) => hexToBytes(p))
7645
+ childNodes
7610
7646
  );
7611
7647
  }
7648
+ const storageEntries = Array.from(storageProofEncoded.entries());
7649
+ const contractProofForEnc = mainProofBytes.map((b) => Array.from(b));
7650
+ const storageProofForEnc = storageEntries.map(([k, nodes]) => [
7651
+ Array.from(k),
7652
+ nodes.map((n) => Array.from(n))
7653
+ ]);
7612
7654
  const encoded = EvmStateProof.enc({
7613
- contractProof: mainProofBytes,
7614
- storageProof: Array.from(storageProofEncoded.entries())
7655
+ contractProof: contractProofForEnc,
7656
+ storageProof: storageProofForEnc
7615
7657
  });
7616
7658
  return bytesToHex(encoded);
7617
7659
  }
@@ -12564,7 +12606,9 @@ var BundlerMethod = {
12564
12606
  /** Estimates gas limits for a UserOperation before submission. */
12565
12607
  ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas",
12566
12608
  /** Pimlico-specific method to fetch recommended EIP-1559 gas prices for UserOperations. */
12567
- PIMLICO_GET_USER_OPERATION_GAS_PRICE: "pimlico_getUserOperationGasPrice"
12609
+ PIMLICO_GET_USER_OPERATION_GAS_PRICE: "pimlico_getUserOperationGasPrice",
12610
+ /** Alchemy (Rundler) method to fetch recommended priority fee for UserOperations. */
12611
+ RUNDLER_MAX_PRIORITY_FEE_PER_GAS: "rundler_maxPriorityFeePerGas"
12568
12612
  };
12569
12613
 
12570
12614
  // src/protocols/intents/CryptoUtils.ts
@@ -15225,10 +15269,11 @@ var OrderExecutor = class {
15225
15269
  *
15226
15270
  * **Status progression (same-chain orders):**
15227
15271
  * `AWAITING_BIDS` → `BIDS_RECEIVED` → `BID_SELECTED` → `USEROP_SUBMITTED`
15228
- * → (`FILLED` | `PARTIAL_FILL`)* → (`FILLED` | `PARTIAL_FILL_EXHAUSTED`)
15272
+ * → (`FILLED` | `PARTIAL_FILL`)* → (`FILLED` | `EXPIRED`)
15229
15273
  *
15230
- * **Error statuses:** `FAILED` (fatal, no fills) or `PARTIAL_FILL_EXHAUSTED`
15231
- * (deadline reached or no new bids after at least one partial fill).
15274
+ * **Error statuses:** `FAILED` (retryable error during bid selection/submission,
15275
+ * triggers automatic retry) or `EXPIRED` (deadline reached or no new bids
15276
+ * terminal, no further retries).
15232
15277
  *
15233
15278
  * @param options - Execution parameters including the placed order, its
15234
15279
  * session private key, bid collection settings, and poll interval.
@@ -15281,19 +15326,14 @@ var OrderExecutor = class {
15281
15326
  while (true) {
15282
15327
  const currentBlock = await this.ctx.dest.client.getBlockNumber();
15283
15328
  if (currentBlock >= order.deadline) {
15284
- const isPartiallyFilled = totalFilledAssets.some((a) => a.amount > 0n);
15285
15329
  const deadlineError = `Order deadline reached (block ${currentBlock} >= ${order.deadline})`;
15286
- if (isPartiallyFilled) {
15287
- yield {
15288
- status: "PARTIAL_FILL_EXHAUSTED",
15289
- commitment,
15290
- totalFilledAssets,
15291
- remainingAssets,
15292
- error: deadlineError
15293
- };
15294
- } else {
15295
- yield { status: "FAILED", commitment, error: deadlineError };
15296
- }
15330
+ yield {
15331
+ status: "EXPIRED",
15332
+ commitment,
15333
+ totalFilledAssets,
15334
+ remainingAssets,
15335
+ error: deadlineError
15336
+ };
15297
15337
  return;
15298
15338
  }
15299
15339
  yield { status: "AWAITING_BIDS", commitment, totalFilledAssets, remainingAssets };
@@ -15323,20 +15363,16 @@ var OrderExecutor = class {
15323
15363
  return !usedUserOps.has(key);
15324
15364
  });
15325
15365
  if (freshBids.length === 0) {
15326
- const isPartiallyFilled = totalFilledAssets.some((a) => a.amount > 0n);
15327
15366
  const solverClause = solver && !solverLockExpired ? ` for requested solver ${solver.address}` : "";
15367
+ const isPartiallyFilled = totalFilledAssets.some((a) => a.amount > 0n);
15328
15368
  const noBidsError = isPartiallyFilled ? `No new bids${solverClause} after partial fill` : `No new bids${solverClause} available within ${bidTimeoutMs}ms timeout`;
15329
- if (isPartiallyFilled) {
15330
- yield {
15331
- status: "PARTIAL_FILL_EXHAUSTED",
15332
- commitment,
15333
- totalFilledAssets,
15334
- remainingAssets,
15335
- error: noBidsError
15336
- };
15337
- } else {
15338
- yield { status: "FAILED", commitment, error: noBidsError };
15339
- }
15369
+ yield {
15370
+ status: "EXPIRED",
15371
+ commitment,
15372
+ totalFilledAssets,
15373
+ remainingAssets,
15374
+ error: noBidsError
15375
+ };
15340
15376
  return;
15341
15377
  }
15342
15378
  yield { status: "BIDS_RECEIVED", commitment, bidCount: freshBids.length, bids: freshBids };
@@ -15351,7 +15387,8 @@ var OrderExecutor = class {
15351
15387
  remainingAssets,
15352
15388
  error: `Failed to select bid and submit: ${err instanceof Error ? err.message : String(err)}`
15353
15389
  };
15354
- return;
15390
+ await sleep(pollIntervalMs);
15391
+ continue;
15355
15392
  }
15356
15393
  const usedKey = userOpHashKey(result.userOp);
15357
15394
  usedUserOps.add(usedKey);
@@ -15396,7 +15433,10 @@ var OrderExecutor = class {
15396
15433
  remainingAssets = targetAssets.map((target) => {
15397
15434
  const filled = totalFilledAssets.find((a) => a.token === target.token);
15398
15435
  const filledAmt = filled?.amount ?? 0n;
15399
- return { token: target.token, amount: filledAmt >= target.amount ? 0n : target.amount - filledAmt };
15436
+ return {
15437
+ token: target.token,
15438
+ amount: filledAmt >= target.amount ? 0n : target.amount - filledAmt
15439
+ };
15400
15440
  });
15401
15441
  const fullyFilled = remainingAssets.every((a) => a.amount === 0n);
15402
15442
  if (fullyFilled) {
@@ -18022,11 +18062,13 @@ var GasEstimator = class {
18022
18062
  const entryPointAddress = this.ctx.dest.configService.getEntryPointV08Address(destStateMachineId);
18023
18063
  const chainId = BigInt(Number.parseInt(destStateMachineId.split("-")[1]));
18024
18064
  const totalEthValue = order.output.assets.filter((output) => bytes32ToBytes20(output.token) === ADDRESS_ZERO2).reduce((sum, output) => sum + output.amount, 0n);
18025
- const [sourceFeeToken, destFeeToken, gasPrice] = await Promise.all([
18065
+ const [sourceFeeToken, destFeeToken, gasPrice, latestBlock] = await Promise.all([
18026
18066
  getFeeToken(this.ctx, this.ctx.source.config.stateMachineId, this.ctx.source),
18027
18067
  getFeeToken(this.ctx, this.ctx.dest.config.stateMachineId, this.ctx.dest),
18028
- this.ctx.dest.client.getGasPrice()
18068
+ this.ctx.dest.client.getGasPrice(),
18069
+ this.ctx.dest.client.getBlock({ blockTag: "latest" })
18029
18070
  ]);
18071
+ const baseFeePerGas = latestBlock.baseFeePerGas ?? gasPrice;
18030
18072
  const feeTokenAsBytes32 = bytes20ToBytes32(destFeeToken.address);
18031
18073
  const assetsForOverrides = [...order.output.assets];
18032
18074
  if (!assetsForOverrides.some((asset) => asset.token.toLowerCase() === feeTokenAsBytes32.toLowerCase())) {
@@ -18074,6 +18116,7 @@ var GasEstimator = class {
18074
18116
  if (this.ctx.bundlerUrl) {
18075
18117
  try {
18076
18118
  const callData = this.crypto.encodeERC7821Execute([
18119
+ ...params.prependCalls ?? [],
18077
18120
  { target: intentGatewayV2Address, value: totalNativeValue, data: fillOrderCalldata }
18078
18121
  ]);
18079
18122
  const accountGasLimits = this.crypto.packGasLimits(100000n, callGasLimit);
@@ -18115,7 +18158,9 @@ var GasEstimator = class {
18115
18158
  sessionSignature
18116
18159
  ]);
18117
18160
  const bundlerUserOp = this.crypto.prepareBundlerCall(preliminaryUserOp);
18118
- const isPimlico = this.ctx.bundlerUrl.toLowerCase().includes("pimlico.io");
18161
+ const bundlerUrlLower = this.ctx.bundlerUrl.toLowerCase();
18162
+ const isPimlico = bundlerUrlLower.includes("pimlico.io");
18163
+ const isAlchemy = bundlerUrlLower.includes("alchemy.com");
18119
18164
  const bundlerRequests = [
18120
18165
  {
18121
18166
  method: BundlerMethod.ETH_ESTIMATE_USER_OPERATION_GAS,
@@ -18128,14 +18173,24 @@ var GasEstimator = class {
18128
18173
  params: []
18129
18174
  });
18130
18175
  }
18176
+ if (isAlchemy) {
18177
+ bundlerRequests.push({
18178
+ method: BundlerMethod.RUNDLER_MAX_PRIORITY_FEE_PER_GAS,
18179
+ params: []
18180
+ });
18181
+ }
18131
18182
  let gasEstimate;
18132
18183
  let pimlicoGasPrices = null;
18184
+ let alchemyMaxPriorityFee = null;
18133
18185
  try {
18134
18186
  const batchResults = await this.crypto.sendBundlerBatch(bundlerRequests);
18135
18187
  gasEstimate = batchResults[0];
18136
18188
  if (isPimlico && batchResults.length > 1) {
18137
18189
  pimlicoGasPrices = batchResults[1];
18138
18190
  }
18191
+ if (isAlchemy && batchResults.length > 1) {
18192
+ alchemyMaxPriorityFee = batchResults[1];
18193
+ }
18139
18194
  } catch {
18140
18195
  gasEstimate = await this.crypto.sendBundler(
18141
18196
  BundlerMethod.ETH_ESTIMATE_USER_OPERATION_GAS,
@@ -18154,6 +18209,14 @@ var GasEstimator = class {
18154
18209
  maxPriorityFeePerGas = pimMaxPriorityFeePerGas + pimMaxPriorityFeePerGas * BigInt(priorityFeeBumpPercent) / 100n;
18155
18210
  }
18156
18211
  }
18212
+ if (alchemyMaxPriorityFee) {
18213
+ const rundlerPriorityFee = BigInt(alchemyMaxPriorityFee);
18214
+ const isArbitrum = chainId === 42161n;
18215
+ const alchemyPrioBump = isArbitrum ? 0n : 25n;
18216
+ maxPriorityFeePerGas = rundlerPriorityFee + rundlerPriorityFee * alchemyPrioBump / 100n;
18217
+ const bufferedBaseFee = baseFeePerGas + baseFeePerGas * 50n / 100n;
18218
+ maxFeePerGas = bufferedBaseFee + maxPriorityFeePerGas;
18219
+ }
18157
18220
  } catch (e) {
18158
18221
  console.warn("Bundler gas estimation failed, using fallback values:", e);
18159
18222
  }