@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.
- package/dist/browser/index.d.ts +22 -2
- package/dist/browser/index.js +103 -40
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +22 -2
- package/dist/node/index.js +103 -40
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -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
|
-
|
|
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: "
|
|
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;
|
package/dist/browser/index.js
CHANGED
|
@@ -609,7 +609,7 @@ var IntentOrderStatus = Object.freeze({
|
|
|
609
609
|
USEROP_SUBMITTED: "USEROP_SUBMITTED",
|
|
610
610
|
FILLED: "FILLED",
|
|
611
611
|
PARTIAL_FILL: "PARTIAL_FILL",
|
|
612
|
-
|
|
612
|
+
EXPIRED: "EXPIRED",
|
|
613
613
|
FAILED: "FAILED"
|
|
614
614
|
});
|
|
615
615
|
|
|
@@ -3837,6 +3837,9 @@ var chainConfigs = {
|
|
|
3837
3837
|
UniversalRouter: "0x66a9893cc07d91d95644aedd05d03f95e1dba8af",
|
|
3838
3838
|
UniswapV3Quoter: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
|
|
3839
3839
|
UniswapV4Quoter: "0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203",
|
|
3840
|
+
UniswapV4PositionManager: "0xbd216513d74c8cf14cf4747e6aaa6420ff64ee9e",
|
|
3841
|
+
UniswapV4PoolManager: "0x000000000004444c5dc75cB358380D2e3dE08A90",
|
|
3842
|
+
UniswapV4StateView: "0x7ffe42c4a5deea5b0fec41c94c136cf115597227",
|
|
3840
3843
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
3841
3844
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3842
3845
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
@@ -3889,6 +3892,9 @@ var chainConfigs = {
|
|
|
3889
3892
|
UniversalRouter: "0xd9C500DfF816a1Da21A48A732d3498Bf09dc9AEB",
|
|
3890
3893
|
UniswapV3Quoter: "0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997",
|
|
3891
3894
|
UniswapV4Quoter: "0xd0737C9762912dD34c3271197E362Aa736Df0926",
|
|
3895
|
+
UniswapV4PositionManager: "0x7a4a5c919ae2541aed11041a1aeee68f1287f95b",
|
|
3896
|
+
UniswapV4PoolManager: "0x28e2ea090877bf75740558f6bfb36a5ffee9e9df",
|
|
3897
|
+
UniswapV4StateView: "0xd13dd3d6e93f276fafc9db9e6bb47c1180aee0c4",
|
|
3892
3898
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
3893
3899
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3894
3900
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
@@ -3943,6 +3949,9 @@ var chainConfigs = {
|
|
|
3943
3949
|
UniversalRouter: "0xa51afafe0263b40edaef0df8781ea9aa03e381a3",
|
|
3944
3950
|
UniswapV3Quoter: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
|
|
3945
3951
|
UniswapV4Quoter: "0x3972c00f7ed4885e145823eb7c655375d275a1c5",
|
|
3952
|
+
UniswapV4PositionManager: "0xd88f38f930b7952f2db2432cb002e7abbf3dd869",
|
|
3953
|
+
UniswapV4PoolManager: "0x360e68faccca8ca495c1b759fd9eee466db9fb32",
|
|
3954
|
+
UniswapV4StateView: "0x76fd297e2d437cd7f76d50f01afe6160f86e9990",
|
|
3946
3955
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
3947
3956
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3948
3957
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
@@ -3999,7 +4008,11 @@ var chainConfigs = {
|
|
|
3999
4008
|
UniswapV4Quoter: "0x0d5e0f971ed27fbff6c2837bf31316121532048d",
|
|
4000
4009
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
4001
4010
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4002
|
-
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
4011
|
+
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4012
|
+
AerodromeRouter: "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
|
|
4013
|
+
UniswapV4PositionManager: "0x7c5f5a4bbd8fd63184577525326123b519429bdc",
|
|
4014
|
+
UniswapV4PoolManager: "0x498581ff718922c3f8e6a244956af099b2652b2b",
|
|
4015
|
+
UniswapV4StateView: "0xa3c0c9b65bad0b08107aa264b0f3db444b867a71"
|
|
4003
4016
|
// Usdt0Oft: Not available on Base
|
|
4004
4017
|
},
|
|
4005
4018
|
rpcEnvKey: "BASE_MAINNET",
|
|
@@ -4051,6 +4064,9 @@ var chainConfigs = {
|
|
|
4051
4064
|
UniversalRouter: "0x1095692a6237d83c6a72f3f5efedb9a670c49223",
|
|
4052
4065
|
UniswapV3Quoter: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
|
|
4053
4066
|
UniswapV4Quoter: "0xb3d5c3dfc3a7aebff71895a7191796bffc2c81b9",
|
|
4067
|
+
UniswapV4PositionManager: "0x1ec2ebf4f37e7363fdfe3551602425af0b3ceef9",
|
|
4068
|
+
UniswapV4PoolManager: "0x67366782805870060151383f4bbff9dab53e5cd6",
|
|
4069
|
+
UniswapV4StateView: "0x5ea1bd7974c8a611cbab0bdcafcb1d9cc9b3ba5a",
|
|
4054
4070
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
4055
4071
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4056
4072
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
@@ -4095,6 +4111,9 @@ var chainConfigs = {
|
|
|
4095
4111
|
UniversalRouter: "0xef740bf23acae26f6492b10de645d6b98dc8eaf3",
|
|
4096
4112
|
UniswapV3Quoter: "0x385a5cf5f83e99f7bb2852b6a19c3538b9fa7658",
|
|
4097
4113
|
UniswapV4Quoter: "0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203",
|
|
4114
|
+
UniswapV4PositionManager: "0x4529a01c7a0410167c5740c487a8de60232617bf",
|
|
4115
|
+
UniswapV4PoolManager: "0x1f98400000000000000000000000000000000004",
|
|
4116
|
+
UniswapV4StateView: "0x86e8631a016f9068c3f085faf484ee3f5fdee8f2",
|
|
4098
4117
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
4099
4118
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4100
4119
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
@@ -4200,7 +4219,9 @@ var chainConfigs = {
|
|
|
4200
4219
|
UniswapV3Factory: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
4201
4220
|
Calldispatcher: "0xC71251c8b3e7B02697A84363Eef6DcE8DfBdF333",
|
|
4202
4221
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4203
|
-
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
4222
|
+
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4223
|
+
UniswapV4PositionManager: "0x3c3ea4b57a46241e54610e5f022e5c45859a1017",
|
|
4224
|
+
UniswapV4PoolManager: "0x9a13f98cb987694c9f086b1f5eb990eea8264ec3"
|
|
4204
4225
|
},
|
|
4205
4226
|
defaultRpcUrl: "https://mainnet.optimism.io",
|
|
4206
4227
|
consensusStateId: "ETH0",
|
|
@@ -4256,7 +4277,9 @@ var chainConfigs = {
|
|
|
4256
4277
|
addresses: {
|
|
4257
4278
|
TokenGateway: "0xCe304770236f39F9911BfCC51afBdfF3b8635718",
|
|
4258
4279
|
Host: "0x7F0165140D0f3251c8f6465e94E9d12C7FD40711",
|
|
4259
|
-
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
4280
|
+
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4281
|
+
UniswapV4PositionManager: "0x1b35d13a2e2528f192637f14b05f0dc0e7deb566",
|
|
4282
|
+
UniswapV4PoolManager: "0x360e68faccca8ca495c1b759fd9eee466db9fb32"
|
|
4260
4283
|
},
|
|
4261
4284
|
defaultRpcUrl: "https://rpc.soneium.org",
|
|
4262
4285
|
consensusStateId: "ETH0",
|
|
@@ -4450,6 +4473,9 @@ var ChainConfigService = class {
|
|
|
4450
4473
|
getUniswapRouterV2Address(chain) {
|
|
4451
4474
|
return this.getConfig(chain)?.addresses.UniswapRouter02 ?? "0x";
|
|
4452
4475
|
}
|
|
4476
|
+
getAerodromeRouterAddress(chain) {
|
|
4477
|
+
return this.getConfig(chain)?.addresses.AerodromeRouter ?? "0x";
|
|
4478
|
+
}
|
|
4453
4479
|
getUniswapV2FactoryAddress(chain) {
|
|
4454
4480
|
return this.getConfig(chain)?.addresses.UniswapV2Factory ?? "0x";
|
|
4455
4481
|
}
|
|
@@ -4465,6 +4491,15 @@ var ChainConfigService = class {
|
|
|
4465
4491
|
getUniswapV4QuoterAddress(chain) {
|
|
4466
4492
|
return this.getConfig(chain)?.addresses.UniswapV4Quoter ?? "0x";
|
|
4467
4493
|
}
|
|
4494
|
+
getUniswapV4PositionManagerAddress(chain) {
|
|
4495
|
+
return this.getConfig(chain)?.addresses.UniswapV4PositionManager ?? "0x";
|
|
4496
|
+
}
|
|
4497
|
+
getUniswapV4PoolManagerAddress(chain) {
|
|
4498
|
+
return this.getConfig(chain)?.addresses.UniswapV4PoolManager ?? "0x";
|
|
4499
|
+
}
|
|
4500
|
+
getUniswapV4StateViewAddress(chain) {
|
|
4501
|
+
return this.getConfig(chain)?.addresses.UniswapV4StateView ?? "0x";
|
|
4502
|
+
}
|
|
4468
4503
|
getPermit2Address(chain) {
|
|
4469
4504
|
return this.getConfig(chain)?.addresses.Permit2 ?? "0x";
|
|
4470
4505
|
}
|
|
@@ -7654,14 +7689,21 @@ var PolkadotHubChain = class _PolkadotHubChain {
|
|
|
7654
7689
|
childKeysHex,
|
|
7655
7690
|
blockHash
|
|
7656
7691
|
]);
|
|
7692
|
+
const childNodes = childRead.proof.map((p) => hexToBytes(p));
|
|
7657
7693
|
storageProofEncoded.set(
|
|
7658
7694
|
addr20,
|
|
7659
|
-
|
|
7695
|
+
childNodes
|
|
7660
7696
|
);
|
|
7661
7697
|
}
|
|
7698
|
+
const storageEntries = Array.from(storageProofEncoded.entries());
|
|
7699
|
+
const contractProofForEnc = mainProofBytes.map((b) => Array.from(b));
|
|
7700
|
+
const storageProofForEnc = storageEntries.map(([k, nodes]) => [
|
|
7701
|
+
Array.from(k),
|
|
7702
|
+
nodes.map((n) => Array.from(n))
|
|
7703
|
+
]);
|
|
7662
7704
|
const encoded = EvmStateProof.enc({
|
|
7663
|
-
contractProof:
|
|
7664
|
-
storageProof:
|
|
7705
|
+
contractProof: contractProofForEnc,
|
|
7706
|
+
storageProof: storageProofForEnc
|
|
7665
7707
|
});
|
|
7666
7708
|
return bytesToHex(encoded);
|
|
7667
7709
|
}
|
|
@@ -12624,7 +12666,9 @@ var BundlerMethod = {
|
|
|
12624
12666
|
/** Estimates gas limits for a UserOperation before submission. */
|
|
12625
12667
|
ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas",
|
|
12626
12668
|
/** Pimlico-specific method to fetch recommended EIP-1559 gas prices for UserOperations. */
|
|
12627
|
-
PIMLICO_GET_USER_OPERATION_GAS_PRICE: "pimlico_getUserOperationGasPrice"
|
|
12669
|
+
PIMLICO_GET_USER_OPERATION_GAS_PRICE: "pimlico_getUserOperationGasPrice",
|
|
12670
|
+
/** Alchemy (Rundler) method to fetch recommended priority fee for UserOperations. */
|
|
12671
|
+
RUNDLER_MAX_PRIORITY_FEE_PER_GAS: "rundler_maxPriorityFeePerGas"
|
|
12628
12672
|
};
|
|
12629
12673
|
|
|
12630
12674
|
// src/protocols/intents/CryptoUtils.ts
|
|
@@ -15285,10 +15329,11 @@ var OrderExecutor = class {
|
|
|
15285
15329
|
*
|
|
15286
15330
|
* **Status progression (same-chain orders):**
|
|
15287
15331
|
* `AWAITING_BIDS` → `BIDS_RECEIVED` → `BID_SELECTED` → `USEROP_SUBMITTED`
|
|
15288
|
-
* → (`FILLED` | `PARTIAL_FILL`)* → (`FILLED` | `
|
|
15332
|
+
* → (`FILLED` | `PARTIAL_FILL`)* → (`FILLED` | `EXPIRED`)
|
|
15289
15333
|
*
|
|
15290
|
-
* **Error statuses:** `FAILED` (
|
|
15291
|
-
* (deadline reached or no new bids
|
|
15334
|
+
* **Error statuses:** `FAILED` (retryable error during bid selection/submission,
|
|
15335
|
+
* triggers automatic retry) or `EXPIRED` (deadline reached or no new bids —
|
|
15336
|
+
* terminal, no further retries).
|
|
15292
15337
|
*
|
|
15293
15338
|
* @param options - Execution parameters including the placed order, its
|
|
15294
15339
|
* session private key, bid collection settings, and poll interval.
|
|
@@ -15341,19 +15386,14 @@ var OrderExecutor = class {
|
|
|
15341
15386
|
while (true) {
|
|
15342
15387
|
const currentBlock = await this.ctx.dest.client.getBlockNumber();
|
|
15343
15388
|
if (currentBlock >= order.deadline) {
|
|
15344
|
-
const isPartiallyFilled = totalFilledAssets.some((a) => a.amount > 0n);
|
|
15345
15389
|
const deadlineError = `Order deadline reached (block ${currentBlock} >= ${order.deadline})`;
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15351
|
-
|
|
15352
|
-
|
|
15353
|
-
};
|
|
15354
|
-
} else {
|
|
15355
|
-
yield { status: "FAILED", commitment, error: deadlineError };
|
|
15356
|
-
}
|
|
15390
|
+
yield {
|
|
15391
|
+
status: "EXPIRED",
|
|
15392
|
+
commitment,
|
|
15393
|
+
totalFilledAssets,
|
|
15394
|
+
remainingAssets,
|
|
15395
|
+
error: deadlineError
|
|
15396
|
+
};
|
|
15357
15397
|
return;
|
|
15358
15398
|
}
|
|
15359
15399
|
yield { status: "AWAITING_BIDS", commitment, totalFilledAssets, remainingAssets };
|
|
@@ -15383,20 +15423,16 @@ var OrderExecutor = class {
|
|
|
15383
15423
|
return !usedUserOps.has(key);
|
|
15384
15424
|
});
|
|
15385
15425
|
if (freshBids.length === 0) {
|
|
15386
|
-
const isPartiallyFilled = totalFilledAssets.some((a) => a.amount > 0n);
|
|
15387
15426
|
const solverClause = solver && !solverLockExpired ? ` for requested solver ${solver.address}` : "";
|
|
15427
|
+
const isPartiallyFilled = totalFilledAssets.some((a) => a.amount > 0n);
|
|
15388
15428
|
const noBidsError = isPartiallyFilled ? `No new bids${solverClause} after partial fill` : `No new bids${solverClause} available within ${bidTimeoutMs}ms timeout`;
|
|
15389
|
-
|
|
15390
|
-
|
|
15391
|
-
|
|
15392
|
-
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
};
|
|
15397
|
-
} else {
|
|
15398
|
-
yield { status: "FAILED", commitment, error: noBidsError };
|
|
15399
|
-
}
|
|
15429
|
+
yield {
|
|
15430
|
+
status: "EXPIRED",
|
|
15431
|
+
commitment,
|
|
15432
|
+
totalFilledAssets,
|
|
15433
|
+
remainingAssets,
|
|
15434
|
+
error: noBidsError
|
|
15435
|
+
};
|
|
15400
15436
|
return;
|
|
15401
15437
|
}
|
|
15402
15438
|
yield { status: "BIDS_RECEIVED", commitment, bidCount: freshBids.length, bids: freshBids };
|
|
@@ -15411,7 +15447,8 @@ var OrderExecutor = class {
|
|
|
15411
15447
|
remainingAssets,
|
|
15412
15448
|
error: `Failed to select bid and submit: ${err instanceof Error ? err.message : String(err)}`
|
|
15413
15449
|
};
|
|
15414
|
-
|
|
15450
|
+
await sleep(pollIntervalMs);
|
|
15451
|
+
continue;
|
|
15415
15452
|
}
|
|
15416
15453
|
const usedKey = userOpHashKey(result.userOp);
|
|
15417
15454
|
usedUserOps.add(usedKey);
|
|
@@ -15456,7 +15493,10 @@ var OrderExecutor = class {
|
|
|
15456
15493
|
remainingAssets = targetAssets.map((target) => {
|
|
15457
15494
|
const filled = totalFilledAssets.find((a) => a.token === target.token);
|
|
15458
15495
|
const filledAmt = filled?.amount ?? 0n;
|
|
15459
|
-
return {
|
|
15496
|
+
return {
|
|
15497
|
+
token: target.token,
|
|
15498
|
+
amount: filledAmt >= target.amount ? 0n : target.amount - filledAmt
|
|
15499
|
+
};
|
|
15460
15500
|
});
|
|
15461
15501
|
const fullyFilled = remainingAssets.every((a) => a.amount === 0n);
|
|
15462
15502
|
if (fullyFilled) {
|
|
@@ -18082,11 +18122,13 @@ var GasEstimator = class {
|
|
|
18082
18122
|
const entryPointAddress = this.ctx.dest.configService.getEntryPointV08Address(destStateMachineId);
|
|
18083
18123
|
const chainId = BigInt(Number.parseInt(destStateMachineId.split("-")[1]));
|
|
18084
18124
|
const totalEthValue = order.output.assets.filter((output) => bytes32ToBytes20(output.token) === ADDRESS_ZERO2).reduce((sum, output) => sum + output.amount, 0n);
|
|
18085
|
-
const [sourceFeeToken, destFeeToken, gasPrice] = await Promise.all([
|
|
18125
|
+
const [sourceFeeToken, destFeeToken, gasPrice, latestBlock] = await Promise.all([
|
|
18086
18126
|
getFeeToken(this.ctx, this.ctx.source.config.stateMachineId, this.ctx.source),
|
|
18087
18127
|
getFeeToken(this.ctx, this.ctx.dest.config.stateMachineId, this.ctx.dest),
|
|
18088
|
-
this.ctx.dest.client.getGasPrice()
|
|
18128
|
+
this.ctx.dest.client.getGasPrice(),
|
|
18129
|
+
this.ctx.dest.client.getBlock({ blockTag: "latest" })
|
|
18089
18130
|
]);
|
|
18131
|
+
const baseFeePerGas = latestBlock.baseFeePerGas ?? gasPrice;
|
|
18090
18132
|
const feeTokenAsBytes32 = bytes20ToBytes32(destFeeToken.address);
|
|
18091
18133
|
const assetsForOverrides = [...order.output.assets];
|
|
18092
18134
|
if (!assetsForOverrides.some((asset) => asset.token.toLowerCase() === feeTokenAsBytes32.toLowerCase())) {
|
|
@@ -18134,6 +18176,7 @@ var GasEstimator = class {
|
|
|
18134
18176
|
if (this.ctx.bundlerUrl) {
|
|
18135
18177
|
try {
|
|
18136
18178
|
const callData = this.crypto.encodeERC7821Execute([
|
|
18179
|
+
...params.prependCalls ?? [],
|
|
18137
18180
|
{ target: intentGatewayV2Address, value: totalNativeValue, data: fillOrderCalldata }
|
|
18138
18181
|
]);
|
|
18139
18182
|
const accountGasLimits = this.crypto.packGasLimits(100000n, callGasLimit);
|
|
@@ -18175,7 +18218,9 @@ var GasEstimator = class {
|
|
|
18175
18218
|
sessionSignature
|
|
18176
18219
|
]);
|
|
18177
18220
|
const bundlerUserOp = this.crypto.prepareBundlerCall(preliminaryUserOp);
|
|
18178
|
-
const
|
|
18221
|
+
const bundlerUrlLower = this.ctx.bundlerUrl.toLowerCase();
|
|
18222
|
+
const isPimlico = bundlerUrlLower.includes("pimlico.io");
|
|
18223
|
+
const isAlchemy = bundlerUrlLower.includes("alchemy.com");
|
|
18179
18224
|
const bundlerRequests = [
|
|
18180
18225
|
{
|
|
18181
18226
|
method: BundlerMethod.ETH_ESTIMATE_USER_OPERATION_GAS,
|
|
@@ -18188,14 +18233,24 @@ var GasEstimator = class {
|
|
|
18188
18233
|
params: []
|
|
18189
18234
|
});
|
|
18190
18235
|
}
|
|
18236
|
+
if (isAlchemy) {
|
|
18237
|
+
bundlerRequests.push({
|
|
18238
|
+
method: BundlerMethod.RUNDLER_MAX_PRIORITY_FEE_PER_GAS,
|
|
18239
|
+
params: []
|
|
18240
|
+
});
|
|
18241
|
+
}
|
|
18191
18242
|
let gasEstimate;
|
|
18192
18243
|
let pimlicoGasPrices = null;
|
|
18244
|
+
let alchemyMaxPriorityFee = null;
|
|
18193
18245
|
try {
|
|
18194
18246
|
const batchResults = await this.crypto.sendBundlerBatch(bundlerRequests);
|
|
18195
18247
|
gasEstimate = batchResults[0];
|
|
18196
18248
|
if (isPimlico && batchResults.length > 1) {
|
|
18197
18249
|
pimlicoGasPrices = batchResults[1];
|
|
18198
18250
|
}
|
|
18251
|
+
if (isAlchemy && batchResults.length > 1) {
|
|
18252
|
+
alchemyMaxPriorityFee = batchResults[1];
|
|
18253
|
+
}
|
|
18199
18254
|
} catch {
|
|
18200
18255
|
gasEstimate = await this.crypto.sendBundler(
|
|
18201
18256
|
BundlerMethod.ETH_ESTIMATE_USER_OPERATION_GAS,
|
|
@@ -18214,6 +18269,14 @@ var GasEstimator = class {
|
|
|
18214
18269
|
maxPriorityFeePerGas = pimMaxPriorityFeePerGas + pimMaxPriorityFeePerGas * BigInt(priorityFeeBumpPercent) / 100n;
|
|
18215
18270
|
}
|
|
18216
18271
|
}
|
|
18272
|
+
if (alchemyMaxPriorityFee) {
|
|
18273
|
+
const rundlerPriorityFee = BigInt(alchemyMaxPriorityFee);
|
|
18274
|
+
const isArbitrum = chainId === 42161n;
|
|
18275
|
+
const alchemyPrioBump = isArbitrum ? 0n : 25n;
|
|
18276
|
+
maxPriorityFeePerGas = rundlerPriorityFee + rundlerPriorityFee * alchemyPrioBump / 100n;
|
|
18277
|
+
const bufferedBaseFee = baseFeePerGas + baseFeePerGas * 50n / 100n;
|
|
18278
|
+
maxFeePerGas = bufferedBaseFee + maxPriorityFeePerGas;
|
|
18279
|
+
}
|
|
18217
18280
|
} catch (e) {
|
|
18218
18281
|
console.warn("Bundler gas estimation failed, using fallback values:", e);
|
|
18219
18282
|
}
|