@hyperbridge/sdk 1.9.3 → 1.9.5
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 +18 -0
- package/dist/browser/index.js +71 -24
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +18 -0
- package/dist/node/index.js +71 -24
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -638,6 +638,7 @@ declare class ChainConfigService {
|
|
|
638
638
|
getPopularTokens(chain: string): string[];
|
|
639
639
|
getIntentGatewayV2Address(chain: string): HexString;
|
|
640
640
|
getEntryPointV08Address(chain: string): HexString;
|
|
641
|
+
getCirclePaymasterV08Address(chain: string): HexString | undefined;
|
|
641
642
|
getHyperbridgeAddress(): string;
|
|
642
643
|
/**
|
|
643
644
|
* Get the LayerZero Endpoint ID for the chain
|
|
@@ -2788,6 +2789,11 @@ interface SigningAccount {
|
|
|
2788
2789
|
s: HexString;
|
|
2789
2790
|
yParity: number;
|
|
2790
2791
|
}>;
|
|
2792
|
+
/**
|
|
2793
|
+
* Signs an EIP-712 typed-data payload (e.g. an EIP-2612 USDC permit for the Circle paymaster).
|
|
2794
|
+
* The shape of `typedData` matches viem's `TypedDataDefinition` (domain + types + message).
|
|
2795
|
+
*/
|
|
2796
|
+
signTypedData: (typedData: unknown, chainId?: number) => Promise<HexString>;
|
|
2791
2797
|
}
|
|
2792
2798
|
interface SubmitBidOptions {
|
|
2793
2799
|
order: Order;
|
|
@@ -2804,6 +2810,12 @@ interface SubmitBidOptions {
|
|
|
2804
2810
|
maxPriorityFeePerGas: bigint;
|
|
2805
2811
|
/** Pre-built ERC-7821 calldata encoding the UserOp execution (approvals + fillOrder). */
|
|
2806
2812
|
callData: HexString;
|
|
2813
|
+
/**
|
|
2814
|
+
* Optional packed paymasterAndData for EntryPoint v0.8.
|
|
2815
|
+
* Must be built BEFORE calling prepareSubmitBid so the hash covers paymaster bytes.
|
|
2816
|
+
* Defaults to "0x" (EntryPoint deposit pays gas).
|
|
2817
|
+
*/
|
|
2818
|
+
paymasterAndData?: HexString;
|
|
2807
2819
|
}
|
|
2808
2820
|
interface EstimateFillOrderParams {
|
|
2809
2821
|
order: Order;
|
|
@@ -2831,6 +2843,10 @@ interface FillOrderEstimate {
|
|
|
2831
2843
|
callGasLimit: bigint;
|
|
2832
2844
|
verificationGasLimit: bigint;
|
|
2833
2845
|
preVerificationGas: bigint;
|
|
2846
|
+
/** Paymaster verification gas limit from bundler estimate, or Circle's cap if absent. 0n when no paymaster. */
|
|
2847
|
+
paymasterVerificationGasLimit: bigint;
|
|
2848
|
+
/** Paymaster postOp gas limit from bundler estimate, or Circle's cap if absent. 0n when no paymaster. */
|
|
2849
|
+
paymasterPostOpGasLimit: bigint;
|
|
2834
2850
|
maxFeePerGas: bigint;
|
|
2835
2851
|
maxPriorityFeePerGas: bigint;
|
|
2836
2852
|
totalGasCostWei: bigint;
|
|
@@ -8153,6 +8169,8 @@ interface ChainConfigData {
|
|
|
8153
8169
|
UniswapV4PoolManager?: `0x${string}`;
|
|
8154
8170
|
/** Uniswap V4 StateView (canonical CREATE2 address) for pool state reads via extsload */
|
|
8155
8171
|
UniswapV4StateView?: `0x${string}`;
|
|
8172
|
+
/** Circle Paymaster v0.8 contract address (ERC-4337 onchain USDC paymaster) */
|
|
8173
|
+
CirclePaymasterV08?: `0x${string}`;
|
|
8156
8174
|
};
|
|
8157
8175
|
rpcEnvKey?: string;
|
|
8158
8176
|
defaultRpcUrl?: string;
|
package/dist/browser/index.js
CHANGED
|
@@ -3794,7 +3794,8 @@ var chainConfigs = {
|
|
|
3794
3794
|
UniswapV2Factory: "0x0000000000000000000000000000000000000000",
|
|
3795
3795
|
UniswapV3Factory: "0x0000000000000000000000000000000000000000",
|
|
3796
3796
|
Calldispatcher: "0xC7f13b6D03A0A7F3239d38897503E90553ABe155",
|
|
3797
|
-
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
3797
|
+
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
3798
|
+
CirclePaymasterV08: "0x3BA9A96eE3eFf3A69E2B18886AcF52027EFF8966"
|
|
3798
3799
|
},
|
|
3799
3800
|
rpcEnvKey: "SEPOLIA",
|
|
3800
3801
|
defaultRpcUrl: "https://1rpc.io/sepolia",
|
|
@@ -3828,7 +3829,7 @@ var chainConfigs = {
|
|
|
3828
3829
|
addresses: {
|
|
3829
3830
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
3830
3831
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
3831
|
-
SolverAccount: "
|
|
3832
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
3832
3833
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
3833
3834
|
Host: "0x792A6236AF69787C40cF76b69B4c8c7B28c4cA20",
|
|
3834
3835
|
UniswapRouter02: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
|
|
@@ -3843,6 +3844,7 @@ var chainConfigs = {
|
|
|
3843
3844
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
3844
3845
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3845
3846
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
3847
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
3846
3848
|
Usdt0Oft: "0x6C96dE32CEa08842dcc4058c14d3aaAD7Fa41dee"
|
|
3847
3849
|
},
|
|
3848
3850
|
rpcEnvKey: "ETH_MAINNET",
|
|
@@ -3883,7 +3885,7 @@ var chainConfigs = {
|
|
|
3883
3885
|
addresses: {
|
|
3884
3886
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
3885
3887
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
3886
|
-
SolverAccount: "
|
|
3888
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
3887
3889
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
3888
3890
|
Host: "0x24B5d421Ec373FcA57325dd2F0C074009Af021F7",
|
|
3889
3891
|
UniswapRouter02: "0x10ED43C718714eb63d5aA57B78B54704E256024E",
|
|
@@ -3940,7 +3942,7 @@ var chainConfigs = {
|
|
|
3940
3942
|
addresses: {
|
|
3941
3943
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
3942
3944
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
3943
|
-
SolverAccount: "
|
|
3945
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
3944
3946
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
3945
3947
|
Host: "0xE05AFD4Eb2ce6d65c40e1048381BD0Ef8b4B299e",
|
|
3946
3948
|
UniswapRouter02: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
@@ -3955,6 +3957,7 @@ var chainConfigs = {
|
|
|
3955
3957
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
3956
3958
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3957
3959
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
3960
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
3958
3961
|
Usdt0Oft: "0x14E4A1B13bf7F943c8ff7C51fb60FA964A298D92"
|
|
3959
3962
|
},
|
|
3960
3963
|
rpcEnvKey: "ARBITRUM_MAINNET",
|
|
@@ -3997,7 +4000,7 @@ var chainConfigs = {
|
|
|
3997
4000
|
addresses: {
|
|
3998
4001
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
3999
4002
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
4000
|
-
SolverAccount: "
|
|
4003
|
+
SolverAccount: "0xb7d5Bb305Fd102C9B0a343978f3b9Accc00e9603",
|
|
4001
4004
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
4002
4005
|
Host: "0x6FFe92e4d7a9D589549644544780e6725E84b248",
|
|
4003
4006
|
UniswapRouter02: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
@@ -4009,6 +4012,7 @@ var chainConfigs = {
|
|
|
4009
4012
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
4010
4013
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4011
4014
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4015
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
4012
4016
|
AerodromeRouter: "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
|
|
4013
4017
|
UniswapV4PositionManager: "0x7c5f5a4bbd8fd63184577525326123b519429bdc",
|
|
4014
4018
|
UniswapV4PoolManager: "0x498581ff718922c3f8e6a244956af099b2652b2b",
|
|
@@ -4055,7 +4059,7 @@ var chainConfigs = {
|
|
|
4055
4059
|
addresses: {
|
|
4056
4060
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
4057
4061
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
4058
|
-
SolverAccount: "
|
|
4062
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
4059
4063
|
TokenGateway: "0x8b536105b6Fae2aE9199f5146D3C57Dfe53b614E",
|
|
4060
4064
|
Host: "0xD8d3db17C1dF65b301D45C84405CcAC1395C559a",
|
|
4061
4065
|
UniswapRouter02: "0xd2f9496824951D5237cC71245D659E48d0d5f9E8",
|
|
@@ -4070,6 +4074,7 @@ var chainConfigs = {
|
|
|
4070
4074
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
4071
4075
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4072
4076
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4077
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
4073
4078
|
Usdt0Oft: "0x6BA10300f0DC58B7a1e4c0e41f5daBb7D7829e13"
|
|
4074
4079
|
},
|
|
4075
4080
|
rpcEnvKey: "POLYGON_MAINNET",
|
|
@@ -4102,7 +4107,7 @@ var chainConfigs = {
|
|
|
4102
4107
|
addresses: {
|
|
4103
4108
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
4104
4109
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
4105
|
-
SolverAccount: "
|
|
4110
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
4106
4111
|
TokenGateway: "0x8b536105b6Fae2aE9199f5146D3C57Dfe53b614E",
|
|
4107
4112
|
Host: "0x2A17C1c3616Bbc33FCe5aF5B965F166ba76cEDAf",
|
|
4108
4113
|
UniswapRouter02: "0x284f11109359a7e1306c3e447ef14d38400063ff",
|
|
@@ -4117,6 +4122,7 @@ var chainConfigs = {
|
|
|
4117
4122
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
4118
4123
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4119
4124
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4125
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
4120
4126
|
Usdt0Oft: "0xc07be8994d035631c36fb4a89c918cefb2f03ec3"
|
|
4121
4127
|
},
|
|
4122
4128
|
rpcEnvKey: "UNICHAIN_MAINNET",
|
|
@@ -4187,6 +4193,7 @@ var chainConfigs = {
|
|
|
4187
4193
|
Calldispatcher: "0x876F1891982E260026630c233A4897160A281Fb8",
|
|
4188
4194
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4189
4195
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4196
|
+
CirclePaymasterV08: "0x3BA9A96eE3eFf3A69E2B18886AcF52027EFF8966",
|
|
4190
4197
|
SolverAccount: "0xCDFcFeD7A14154846808FddC8Ba971A2f8a830a3"
|
|
4191
4198
|
},
|
|
4192
4199
|
rpcEnvKey: "POLYGON_AMOY",
|
|
@@ -4211,7 +4218,7 @@ var chainConfigs = {
|
|
|
4211
4218
|
},
|
|
4212
4219
|
addresses: {
|
|
4213
4220
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
4214
|
-
SolverAccount: "
|
|
4221
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
4215
4222
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
4216
4223
|
Host: "0x78c8A5F27C06757EA0e30bEa682f1FD5C8d7645d",
|
|
4217
4224
|
UniswapRouter02: "0x4A7b5Da61326A6379179b40d00F57E5bbDC962c2",
|
|
@@ -4220,6 +4227,7 @@ var chainConfigs = {
|
|
|
4220
4227
|
Calldispatcher: "0xC71251c8b3e7B02697A84363Eef6DcE8DfBdF333",
|
|
4221
4228
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4222
4229
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4230
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
4223
4231
|
UniswapV4PositionManager: "0x3c3ea4b57a46241e54610e5f022e5c45859a1017",
|
|
4224
4232
|
UniswapV4PoolManager: "0x9a13f98cb987694c9f086b1f5eb990eea8264ec3"
|
|
4225
4233
|
},
|
|
@@ -4303,7 +4311,8 @@ var chainConfigs = {
|
|
|
4303
4311
|
addresses: {
|
|
4304
4312
|
TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
|
|
4305
4313
|
Host: "0x3435bD7e5895356535459D6087D1eB982DAd90e7",
|
|
4306
|
-
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
4314
|
+
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4315
|
+
CirclePaymasterV08: "0x3BA9A96eE3eFf3A69E2B18886AcF52027EFF8966"
|
|
4307
4316
|
},
|
|
4308
4317
|
defaultRpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
|
|
4309
4318
|
consensusStateId: "ETH0",
|
|
@@ -4327,7 +4336,8 @@ var chainConfigs = {
|
|
|
4327
4336
|
addresses: {
|
|
4328
4337
|
TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
|
|
4329
4338
|
Host: "0x6d51b678836d8060d980605d2999eF211809f3C2",
|
|
4330
|
-
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
4339
|
+
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4340
|
+
CirclePaymasterV08: "0x3BA9A96eE3eFf3A69E2B18886AcF52027EFF8966"
|
|
4331
4341
|
},
|
|
4332
4342
|
defaultRpcUrl: "https://sepolia.optimism.io",
|
|
4333
4343
|
consensusStateId: "ETH0",
|
|
@@ -4351,7 +4361,8 @@ var chainConfigs = {
|
|
|
4351
4361
|
addresses: {
|
|
4352
4362
|
TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
|
|
4353
4363
|
Host: "0xD198c01839dd4843918617AfD1e4DDf44Cc3BB4a",
|
|
4354
|
-
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
4364
|
+
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4365
|
+
CirclePaymasterV08: "0x3BA9A96eE3eFf3A69E2B18886AcF52027EFF8966"
|
|
4355
4366
|
},
|
|
4356
4367
|
defaultRpcUrl: "https://sepolia.base.org",
|
|
4357
4368
|
consensusStateId: "ETH0",
|
|
@@ -4535,6 +4546,9 @@ var ChainConfigService = class {
|
|
|
4535
4546
|
getEntryPointV08Address(chain) {
|
|
4536
4547
|
return this.getConfig(chain)?.addresses.EntryPointV08;
|
|
4537
4548
|
}
|
|
4549
|
+
getCirclePaymasterV08Address(chain) {
|
|
4550
|
+
return this.getConfig(chain)?.addresses.CirclePaymasterV08;
|
|
4551
|
+
}
|
|
4538
4552
|
getHyperbridgeAddress() {
|
|
4539
4553
|
return hyperbridgeAddress;
|
|
4540
4554
|
}
|
|
@@ -12861,8 +12875,11 @@ var CryptoUtils = class {
|
|
|
12861
12875
|
const factory = hasFactory ? `0x${userOp.initCode.slice(2, 42)}` : void 0;
|
|
12862
12876
|
const factoryData = hasFactory ? `0x${userOp.initCode.slice(42)}` : void 0;
|
|
12863
12877
|
const hasPaymaster = userOp.paymasterAndData && userOp.paymasterAndData !== "0x" && userOp.paymasterAndData.length > 2;
|
|
12864
|
-
const
|
|
12865
|
-
const
|
|
12878
|
+
const pmHex = hasPaymaster ? userOp.paymasterAndData.slice(2) : "";
|
|
12879
|
+
const paymaster = hasPaymaster ? `0x${pmHex.slice(0, 40)}` : void 0;
|
|
12880
|
+
const paymasterVerificationGasLimit = hasPaymaster ? BigInt(`0x${pmHex.slice(40, 72)}`) : void 0;
|
|
12881
|
+
const paymasterPostOpGasLimit = hasPaymaster ? BigInt(`0x${pmHex.slice(72, 104)}`) : void 0;
|
|
12882
|
+
const paymasterData = hasPaymaster ? `0x${pmHex.slice(104)}` : void 0;
|
|
12866
12883
|
const userOpBundler = {
|
|
12867
12884
|
sender: userOp.sender,
|
|
12868
12885
|
nonce: toHex(userOp.nonce),
|
|
@@ -12881,8 +12898,8 @@ var CryptoUtils = class {
|
|
|
12881
12898
|
if (paymaster) {
|
|
12882
12899
|
userOpBundler.paymaster = paymaster;
|
|
12883
12900
|
userOpBundler.paymasterData = paymasterData || "0x";
|
|
12884
|
-
userOpBundler.paymasterVerificationGasLimit = toHex(
|
|
12885
|
-
userOpBundler.paymasterPostOpGasLimit = toHex(
|
|
12901
|
+
userOpBundler.paymasterVerificationGasLimit = toHex(paymasterVerificationGasLimit);
|
|
12902
|
+
userOpBundler.paymasterPostOpGasLimit = toHex(paymasterPostOpGasLimit);
|
|
12886
12903
|
}
|
|
12887
12904
|
return userOpBundler;
|
|
12888
12905
|
}
|
|
@@ -15479,7 +15496,7 @@ var OrderExecutor = class {
|
|
|
15479
15496
|
async *executeOrder(options) {
|
|
15480
15497
|
const { order, sessionPrivateKey, auctionTimeMs, pollIntervalMs = DEFAULT_POLL_INTERVAL, solver } = options;
|
|
15481
15498
|
const commitment = order.id;
|
|
15482
|
-
|
|
15499
|
+
order.source === order.destination;
|
|
15483
15500
|
if (!this.ctx.intentsCoprocessor) {
|
|
15484
15501
|
yield { status: "FAILED", error: "IntentsCoprocessor required for order execution" };
|
|
15485
15502
|
return;
|
|
@@ -15508,10 +15525,15 @@ var OrderExecutor = class {
|
|
|
15508
15525
|
});
|
|
15509
15526
|
const deadlineTimeout = this.deadlineStream(order.deadline, commitment);
|
|
15510
15527
|
const combined = mergeRace(deadlineTimeout, executionStream);
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
|
|
15514
|
-
|
|
15528
|
+
try {
|
|
15529
|
+
for await (const update of combined) {
|
|
15530
|
+
yield update;
|
|
15531
|
+
if (update.status === "EXPIRED" || update.status === "FILLED") return;
|
|
15532
|
+
}
|
|
15533
|
+
} finally {
|
|
15534
|
+
console.log(`[OrderExecutor] Tearing down streams for commitment=${commitment}`);
|
|
15535
|
+
await executionStream.return(void 0);
|
|
15536
|
+
await deadlineTimeout.return(void 0);
|
|
15515
15537
|
}
|
|
15516
15538
|
}
|
|
15517
15539
|
/**
|
|
@@ -15532,6 +15554,12 @@ var OrderExecutor = class {
|
|
|
15532
15554
|
targetAssets
|
|
15533
15555
|
} = params;
|
|
15534
15556
|
let { totalFilledAssets, remainingAssets } = params;
|
|
15557
|
+
const MAX_BID_ATTEMPTS = 2;
|
|
15558
|
+
const bidFailCounts = /* @__PURE__ */ new Map();
|
|
15559
|
+
const isFreshBid = (bid) => {
|
|
15560
|
+
const key = userOpHashKey(bid.userOp);
|
|
15561
|
+
return !usedUserOps.has(key) && (bidFailCounts.get(key) ?? 0) < MAX_BID_ATTEMPTS;
|
|
15562
|
+
};
|
|
15535
15563
|
const solverLockStartTime = Date.now();
|
|
15536
15564
|
yield { status: "AWAITING_BIDS", commitment, totalFilledAssets, remainingAssets };
|
|
15537
15565
|
try {
|
|
@@ -15559,7 +15587,7 @@ var OrderExecutor = class {
|
|
|
15559
15587
|
let freshBids;
|
|
15560
15588
|
try {
|
|
15561
15589
|
const bids = await this.fetchBids({ commitment, solver, solverLockStartTime });
|
|
15562
|
-
freshBids = bids.filter(
|
|
15590
|
+
freshBids = bids.filter(isFreshBid);
|
|
15563
15591
|
} catch {
|
|
15564
15592
|
await sleep(pollIntervalMs);
|
|
15565
15593
|
continue;
|
|
@@ -15587,6 +15615,14 @@ var OrderExecutor = class {
|
|
|
15587
15615
|
remainingAssets,
|
|
15588
15616
|
error: `Failed to select bid and submit: ${err instanceof Error ? err.message : String(err)}`
|
|
15589
15617
|
};
|
|
15618
|
+
try {
|
|
15619
|
+
const sorted = await this.bidManager.validateAndSortBids(freshBids, order);
|
|
15620
|
+
if (sorted.length > 0) {
|
|
15621
|
+
const key = userOpHashKey(sorted[0].bid.userOp);
|
|
15622
|
+
bidFailCounts.set(key, (bidFailCounts.get(key) ?? 0) + 1);
|
|
15623
|
+
}
|
|
15624
|
+
} catch {
|
|
15625
|
+
}
|
|
15590
15626
|
await sleep(pollIntervalMs);
|
|
15591
15627
|
continue;
|
|
15592
15628
|
}
|
|
@@ -16125,7 +16161,8 @@ var BidManager = class {
|
|
|
16125
16161
|
preVerificationGas,
|
|
16126
16162
|
maxFeePerGas,
|
|
16127
16163
|
maxPriorityFeePerGas,
|
|
16128
|
-
callData
|
|
16164
|
+
callData,
|
|
16165
|
+
paymasterAndData = "0x"
|
|
16129
16166
|
} = options;
|
|
16130
16167
|
const chainId = BigInt(
|
|
16131
16168
|
this.ctx.dest.client.chain?.id ?? Number.parseInt(this.ctx.dest.config.stateMachineId.split("-")[1])
|
|
@@ -16140,7 +16177,7 @@ var BidManager = class {
|
|
|
16140
16177
|
accountGasLimits,
|
|
16141
16178
|
preVerificationGas,
|
|
16142
16179
|
gasFees,
|
|
16143
|
-
paymasterAndData
|
|
16180
|
+
paymasterAndData,
|
|
16144
16181
|
signature: "0x"
|
|
16145
16182
|
};
|
|
16146
16183
|
const userOpHash = this.crypto.computeUserOpHash(userOp, entryPointAddress, chainId);
|
|
@@ -18266,6 +18303,8 @@ var GasEstimator = class {
|
|
|
18266
18303
|
let callGasLimit = 500000n;
|
|
18267
18304
|
let verificationGasLimit = 100000n;
|
|
18268
18305
|
let preVerificationGas = 100000n;
|
|
18306
|
+
let paymasterVerificationGasLimit = 0n;
|
|
18307
|
+
let paymasterPostOpGasLimit = 0n;
|
|
18269
18308
|
if (this.ctx.bundlerUrl) {
|
|
18270
18309
|
try {
|
|
18271
18310
|
const callData = this.crypto.encodeERC7821Execute([
|
|
@@ -18353,6 +18392,12 @@ var GasEstimator = class {
|
|
|
18353
18392
|
callGasLimit = BigInt(gasEstimate.callGasLimit) * 160n / 100n;
|
|
18354
18393
|
verificationGasLimit = BigInt(gasEstimate.verificationGasLimit) * 105n / 100n;
|
|
18355
18394
|
preVerificationGas = BigInt(gasEstimate.preVerificationGas) * 105n / 100n;
|
|
18395
|
+
if (gasEstimate.paymasterVerificationGasLimit) {
|
|
18396
|
+
paymasterVerificationGasLimit = BigInt(gasEstimate.paymasterVerificationGasLimit) * 105n / 100n;
|
|
18397
|
+
}
|
|
18398
|
+
if (gasEstimate.paymasterPostOpGasLimit) {
|
|
18399
|
+
paymasterPostOpGasLimit = BigInt(gasEstimate.paymasterPostOpGasLimit) * 105n / 100n;
|
|
18400
|
+
}
|
|
18356
18401
|
if (pimlicoGasPrices) {
|
|
18357
18402
|
const level = pimlicoGasPrices.fast ?? pimlicoGasPrices.standard ?? pimlicoGasPrices.slow ?? null;
|
|
18358
18403
|
if (level) {
|
|
@@ -18389,7 +18434,7 @@ var GasEstimator = class {
|
|
|
18389
18434
|
console.warn("fillOrder gas estimation failed, using fallback:", e);
|
|
18390
18435
|
}
|
|
18391
18436
|
}
|
|
18392
|
-
const totalGas = callGasLimit + verificationGasLimit + preVerificationGas;
|
|
18437
|
+
const totalGas = callGasLimit + verificationGasLimit + preVerificationGas + paymasterVerificationGasLimit + paymasterPostOpGasLimit;
|
|
18393
18438
|
const rawTotalGasCostWei = totalGas * maxFeePerGas;
|
|
18394
18439
|
const totalGasInDestFeeToken = await convertGasToFeeToken(
|
|
18395
18440
|
this.ctx,
|
|
@@ -18404,6 +18449,8 @@ var GasEstimator = class {
|
|
|
18404
18449
|
callGasLimit,
|
|
18405
18450
|
verificationGasLimit,
|
|
18406
18451
|
preVerificationGas,
|
|
18452
|
+
paymasterVerificationGasLimit,
|
|
18453
|
+
paymasterPostOpGasLimit,
|
|
18407
18454
|
maxFeePerGas,
|
|
18408
18455
|
maxPriorityFeePerGas,
|
|
18409
18456
|
totalGasCostWei,
|