@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/node/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/node/index.js
CHANGED
|
@@ -3744,7 +3744,8 @@ var chainConfigs = {
|
|
|
3744
3744
|
UniswapV2Factory: "0x0000000000000000000000000000000000000000",
|
|
3745
3745
|
UniswapV3Factory: "0x0000000000000000000000000000000000000000",
|
|
3746
3746
|
Calldispatcher: "0xC7f13b6D03A0A7F3239d38897503E90553ABe155",
|
|
3747
|
-
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
3747
|
+
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
3748
|
+
CirclePaymasterV08: "0x3BA9A96eE3eFf3A69E2B18886AcF52027EFF8966"
|
|
3748
3749
|
},
|
|
3749
3750
|
rpcEnvKey: "SEPOLIA",
|
|
3750
3751
|
defaultRpcUrl: "https://1rpc.io/sepolia",
|
|
@@ -3778,7 +3779,7 @@ var chainConfigs = {
|
|
|
3778
3779
|
addresses: {
|
|
3779
3780
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
3780
3781
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
3781
|
-
SolverAccount: "
|
|
3782
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
3782
3783
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
3783
3784
|
Host: "0x792A6236AF69787C40cF76b69B4c8c7B28c4cA20",
|
|
3784
3785
|
UniswapRouter02: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
|
|
@@ -3793,6 +3794,7 @@ var chainConfigs = {
|
|
|
3793
3794
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
3794
3795
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3795
3796
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
3797
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
3796
3798
|
Usdt0Oft: "0x6C96dE32CEa08842dcc4058c14d3aaAD7Fa41dee"
|
|
3797
3799
|
},
|
|
3798
3800
|
rpcEnvKey: "ETH_MAINNET",
|
|
@@ -3833,7 +3835,7 @@ var chainConfigs = {
|
|
|
3833
3835
|
addresses: {
|
|
3834
3836
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
3835
3837
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
3836
|
-
SolverAccount: "
|
|
3838
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
3837
3839
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
3838
3840
|
Host: "0x24B5d421Ec373FcA57325dd2F0C074009Af021F7",
|
|
3839
3841
|
UniswapRouter02: "0x10ED43C718714eb63d5aA57B78B54704E256024E",
|
|
@@ -3890,7 +3892,7 @@ var chainConfigs = {
|
|
|
3890
3892
|
addresses: {
|
|
3891
3893
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
3892
3894
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
3893
|
-
SolverAccount: "
|
|
3895
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
3894
3896
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
3895
3897
|
Host: "0xE05AFD4Eb2ce6d65c40e1048381BD0Ef8b4B299e",
|
|
3896
3898
|
UniswapRouter02: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
@@ -3905,6 +3907,7 @@ var chainConfigs = {
|
|
|
3905
3907
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
3906
3908
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3907
3909
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
3910
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
3908
3911
|
Usdt0Oft: "0x14E4A1B13bf7F943c8ff7C51fb60FA964A298D92"
|
|
3909
3912
|
},
|
|
3910
3913
|
rpcEnvKey: "ARBITRUM_MAINNET",
|
|
@@ -3947,7 +3950,7 @@ var chainConfigs = {
|
|
|
3947
3950
|
addresses: {
|
|
3948
3951
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
3949
3952
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
3950
|
-
SolverAccount: "
|
|
3953
|
+
SolverAccount: "0xb7d5Bb305Fd102C9B0a343978f3b9Accc00e9603",
|
|
3951
3954
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
3952
3955
|
Host: "0x6FFe92e4d7a9D589549644544780e6725E84b248",
|
|
3953
3956
|
UniswapRouter02: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
@@ -3959,6 +3962,7 @@ var chainConfigs = {
|
|
|
3959
3962
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
3960
3963
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3961
3964
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
3965
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
3962
3966
|
AerodromeRouter: "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
|
|
3963
3967
|
UniswapV4PositionManager: "0x7c5f5a4bbd8fd63184577525326123b519429bdc",
|
|
3964
3968
|
UniswapV4PoolManager: "0x498581ff718922c3f8e6a244956af099b2652b2b",
|
|
@@ -4005,7 +4009,7 @@ var chainConfigs = {
|
|
|
4005
4009
|
addresses: {
|
|
4006
4010
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
4007
4011
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
4008
|
-
SolverAccount: "
|
|
4012
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
4009
4013
|
TokenGateway: "0x8b536105b6Fae2aE9199f5146D3C57Dfe53b614E",
|
|
4010
4014
|
Host: "0xD8d3db17C1dF65b301D45C84405CcAC1395C559a",
|
|
4011
4015
|
UniswapRouter02: "0xd2f9496824951D5237cC71245D659E48d0d5f9E8",
|
|
@@ -4020,6 +4024,7 @@ var chainConfigs = {
|
|
|
4020
4024
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
4021
4025
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4022
4026
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4027
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
4023
4028
|
Usdt0Oft: "0x6BA10300f0DC58B7a1e4c0e41f5daBb7D7829e13"
|
|
4024
4029
|
},
|
|
4025
4030
|
rpcEnvKey: "POLYGON_MAINNET",
|
|
@@ -4052,7 +4057,7 @@ var chainConfigs = {
|
|
|
4052
4057
|
addresses: {
|
|
4053
4058
|
IntentGateway: "0x1a4ee689a004b10210a1df9f24a387ea13359acf",
|
|
4054
4059
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
4055
|
-
SolverAccount: "
|
|
4060
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
4056
4061
|
TokenGateway: "0x8b536105b6Fae2aE9199f5146D3C57Dfe53b614E",
|
|
4057
4062
|
Host: "0x2A17C1c3616Bbc33FCe5aF5B965F166ba76cEDAf",
|
|
4058
4063
|
UniswapRouter02: "0x284f11109359a7e1306c3e447ef14d38400063ff",
|
|
@@ -4067,6 +4072,7 @@ var chainConfigs = {
|
|
|
4067
4072
|
Calldispatcher: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
|
|
4068
4073
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4069
4074
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4075
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
4070
4076
|
Usdt0Oft: "0xc07be8994d035631c36fb4a89c918cefb2f03ec3"
|
|
4071
4077
|
},
|
|
4072
4078
|
rpcEnvKey: "UNICHAIN_MAINNET",
|
|
@@ -4137,6 +4143,7 @@ var chainConfigs = {
|
|
|
4137
4143
|
Calldispatcher: "0x876F1891982E260026630c233A4897160A281Fb8",
|
|
4138
4144
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4139
4145
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4146
|
+
CirclePaymasterV08: "0x3BA9A96eE3eFf3A69E2B18886AcF52027EFF8966",
|
|
4140
4147
|
SolverAccount: "0xCDFcFeD7A14154846808FddC8Ba971A2f8a830a3"
|
|
4141
4148
|
},
|
|
4142
4149
|
rpcEnvKey: "POLYGON_AMOY",
|
|
@@ -4161,7 +4168,7 @@ var chainConfigs = {
|
|
|
4161
4168
|
},
|
|
4162
4169
|
addresses: {
|
|
4163
4170
|
IntentGatewayV2: "0x2d61624A17f361020679FaA16fbB566C344AaF4B",
|
|
4164
|
-
SolverAccount: "
|
|
4171
|
+
SolverAccount: "0x66C4459fa61E5Ca647152EEb6dA56150EE975512",
|
|
4165
4172
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
4166
4173
|
Host: "0x78c8A5F27C06757EA0e30bEa682f1FD5C8d7645d",
|
|
4167
4174
|
UniswapRouter02: "0x4A7b5Da61326A6379179b40d00F57E5bbDC962c2",
|
|
@@ -4170,6 +4177,7 @@ var chainConfigs = {
|
|
|
4170
4177
|
Calldispatcher: "0xC71251c8b3e7B02697A84363Eef6DcE8DfBdF333",
|
|
4171
4178
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
4172
4179
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4180
|
+
CirclePaymasterV08: "0x0578cFB241215b77442a541325d6A4E6dFE700Ec",
|
|
4173
4181
|
UniswapV4PositionManager: "0x3c3ea4b57a46241e54610e5f022e5c45859a1017",
|
|
4174
4182
|
UniswapV4PoolManager: "0x9a13f98cb987694c9f086b1f5eb990eea8264ec3"
|
|
4175
4183
|
},
|
|
@@ -4253,7 +4261,8 @@ var chainConfigs = {
|
|
|
4253
4261
|
addresses: {
|
|
4254
4262
|
TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
|
|
4255
4263
|
Host: "0x3435bD7e5895356535459D6087D1eB982DAd90e7",
|
|
4256
|
-
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
4264
|
+
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4265
|
+
CirclePaymasterV08: "0x3BA9A96eE3eFf3A69E2B18886AcF52027EFF8966"
|
|
4257
4266
|
},
|
|
4258
4267
|
defaultRpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
|
|
4259
4268
|
consensusStateId: "ETH0",
|
|
@@ -4277,7 +4286,8 @@ var chainConfigs = {
|
|
|
4277
4286
|
addresses: {
|
|
4278
4287
|
TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
|
|
4279
4288
|
Host: "0x6d51b678836d8060d980605d2999eF211809f3C2",
|
|
4280
|
-
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
4289
|
+
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4290
|
+
CirclePaymasterV08: "0x3BA9A96eE3eFf3A69E2B18886AcF52027EFF8966"
|
|
4281
4291
|
},
|
|
4282
4292
|
defaultRpcUrl: "https://sepolia.optimism.io",
|
|
4283
4293
|
consensusStateId: "ETH0",
|
|
@@ -4301,7 +4311,8 @@ var chainConfigs = {
|
|
|
4301
4311
|
addresses: {
|
|
4302
4312
|
TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
|
|
4303
4313
|
Host: "0xD198c01839dd4843918617AfD1e4DDf44Cc3BB4a",
|
|
4304
|
-
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
|
|
4314
|
+
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
4315
|
+
CirclePaymasterV08: "0x3BA9A96eE3eFf3A69E2B18886AcF52027EFF8966"
|
|
4305
4316
|
},
|
|
4306
4317
|
defaultRpcUrl: "https://sepolia.base.org",
|
|
4307
4318
|
consensusStateId: "ETH0",
|
|
@@ -4485,6 +4496,9 @@ var ChainConfigService = class {
|
|
|
4485
4496
|
getEntryPointV08Address(chain) {
|
|
4486
4497
|
return this.getConfig(chain)?.addresses.EntryPointV08;
|
|
4487
4498
|
}
|
|
4499
|
+
getCirclePaymasterV08Address(chain) {
|
|
4500
|
+
return this.getConfig(chain)?.addresses.CirclePaymasterV08;
|
|
4501
|
+
}
|
|
4488
4502
|
getHyperbridgeAddress() {
|
|
4489
4503
|
return hyperbridgeAddress;
|
|
4490
4504
|
}
|
|
@@ -12801,8 +12815,11 @@ var CryptoUtils = class {
|
|
|
12801
12815
|
const factory = hasFactory ? `0x${userOp.initCode.slice(2, 42)}` : void 0;
|
|
12802
12816
|
const factoryData = hasFactory ? `0x${userOp.initCode.slice(42)}` : void 0;
|
|
12803
12817
|
const hasPaymaster = userOp.paymasterAndData && userOp.paymasterAndData !== "0x" && userOp.paymasterAndData.length > 2;
|
|
12804
|
-
const
|
|
12805
|
-
const
|
|
12818
|
+
const pmHex = hasPaymaster ? userOp.paymasterAndData.slice(2) : "";
|
|
12819
|
+
const paymaster = hasPaymaster ? `0x${pmHex.slice(0, 40)}` : void 0;
|
|
12820
|
+
const paymasterVerificationGasLimit = hasPaymaster ? BigInt(`0x${pmHex.slice(40, 72)}`) : void 0;
|
|
12821
|
+
const paymasterPostOpGasLimit = hasPaymaster ? BigInt(`0x${pmHex.slice(72, 104)}`) : void 0;
|
|
12822
|
+
const paymasterData = hasPaymaster ? `0x${pmHex.slice(104)}` : void 0;
|
|
12806
12823
|
const userOpBundler = {
|
|
12807
12824
|
sender: userOp.sender,
|
|
12808
12825
|
nonce: toHex(userOp.nonce),
|
|
@@ -12821,8 +12838,8 @@ var CryptoUtils = class {
|
|
|
12821
12838
|
if (paymaster) {
|
|
12822
12839
|
userOpBundler.paymaster = paymaster;
|
|
12823
12840
|
userOpBundler.paymasterData = paymasterData || "0x";
|
|
12824
|
-
userOpBundler.paymasterVerificationGasLimit = toHex(
|
|
12825
|
-
userOpBundler.paymasterPostOpGasLimit = toHex(
|
|
12841
|
+
userOpBundler.paymasterVerificationGasLimit = toHex(paymasterVerificationGasLimit);
|
|
12842
|
+
userOpBundler.paymasterPostOpGasLimit = toHex(paymasterPostOpGasLimit);
|
|
12826
12843
|
}
|
|
12827
12844
|
return userOpBundler;
|
|
12828
12845
|
}
|
|
@@ -15419,7 +15436,7 @@ var OrderExecutor = class {
|
|
|
15419
15436
|
async *executeOrder(options) {
|
|
15420
15437
|
const { order, sessionPrivateKey, auctionTimeMs, pollIntervalMs = DEFAULT_POLL_INTERVAL, solver } = options;
|
|
15421
15438
|
const commitment = order.id;
|
|
15422
|
-
|
|
15439
|
+
order.source === order.destination;
|
|
15423
15440
|
if (!this.ctx.intentsCoprocessor) {
|
|
15424
15441
|
yield { status: "FAILED", error: "IntentsCoprocessor required for order execution" };
|
|
15425
15442
|
return;
|
|
@@ -15448,10 +15465,15 @@ var OrderExecutor = class {
|
|
|
15448
15465
|
});
|
|
15449
15466
|
const deadlineTimeout = this.deadlineStream(order.deadline, commitment);
|
|
15450
15467
|
const combined = mergeRace(deadlineTimeout, executionStream);
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15468
|
+
try {
|
|
15469
|
+
for await (const update of combined) {
|
|
15470
|
+
yield update;
|
|
15471
|
+
if (update.status === "EXPIRED" || update.status === "FILLED") return;
|
|
15472
|
+
}
|
|
15473
|
+
} finally {
|
|
15474
|
+
console.log(`[OrderExecutor] Tearing down streams for commitment=${commitment}`);
|
|
15475
|
+
await executionStream.return(void 0);
|
|
15476
|
+
await deadlineTimeout.return(void 0);
|
|
15455
15477
|
}
|
|
15456
15478
|
}
|
|
15457
15479
|
/**
|
|
@@ -15472,6 +15494,12 @@ var OrderExecutor = class {
|
|
|
15472
15494
|
targetAssets
|
|
15473
15495
|
} = params;
|
|
15474
15496
|
let { totalFilledAssets, remainingAssets } = params;
|
|
15497
|
+
const MAX_BID_ATTEMPTS = 2;
|
|
15498
|
+
const bidFailCounts = /* @__PURE__ */ new Map();
|
|
15499
|
+
const isFreshBid = (bid) => {
|
|
15500
|
+
const key = userOpHashKey(bid.userOp);
|
|
15501
|
+
return !usedUserOps.has(key) && (bidFailCounts.get(key) ?? 0) < MAX_BID_ATTEMPTS;
|
|
15502
|
+
};
|
|
15475
15503
|
const solverLockStartTime = Date.now();
|
|
15476
15504
|
yield { status: "AWAITING_BIDS", commitment, totalFilledAssets, remainingAssets };
|
|
15477
15505
|
try {
|
|
@@ -15499,7 +15527,7 @@ var OrderExecutor = class {
|
|
|
15499
15527
|
let freshBids;
|
|
15500
15528
|
try {
|
|
15501
15529
|
const bids = await this.fetchBids({ commitment, solver, solverLockStartTime });
|
|
15502
|
-
freshBids = bids.filter(
|
|
15530
|
+
freshBids = bids.filter(isFreshBid);
|
|
15503
15531
|
} catch {
|
|
15504
15532
|
await sleep(pollIntervalMs);
|
|
15505
15533
|
continue;
|
|
@@ -15527,6 +15555,14 @@ var OrderExecutor = class {
|
|
|
15527
15555
|
remainingAssets,
|
|
15528
15556
|
error: `Failed to select bid and submit: ${err instanceof Error ? err.message : String(err)}`
|
|
15529
15557
|
};
|
|
15558
|
+
try {
|
|
15559
|
+
const sorted = await this.bidManager.validateAndSortBids(freshBids, order);
|
|
15560
|
+
if (sorted.length > 0) {
|
|
15561
|
+
const key = userOpHashKey(sorted[0].bid.userOp);
|
|
15562
|
+
bidFailCounts.set(key, (bidFailCounts.get(key) ?? 0) + 1);
|
|
15563
|
+
}
|
|
15564
|
+
} catch {
|
|
15565
|
+
}
|
|
15530
15566
|
await sleep(pollIntervalMs);
|
|
15531
15567
|
continue;
|
|
15532
15568
|
}
|
|
@@ -16065,7 +16101,8 @@ var BidManager = class {
|
|
|
16065
16101
|
preVerificationGas,
|
|
16066
16102
|
maxFeePerGas,
|
|
16067
16103
|
maxPriorityFeePerGas,
|
|
16068
|
-
callData
|
|
16104
|
+
callData,
|
|
16105
|
+
paymasterAndData = "0x"
|
|
16069
16106
|
} = options;
|
|
16070
16107
|
const chainId = BigInt(
|
|
16071
16108
|
this.ctx.dest.client.chain?.id ?? Number.parseInt(this.ctx.dest.config.stateMachineId.split("-")[1])
|
|
@@ -16080,7 +16117,7 @@ var BidManager = class {
|
|
|
16080
16117
|
accountGasLimits,
|
|
16081
16118
|
preVerificationGas,
|
|
16082
16119
|
gasFees,
|
|
16083
|
-
paymasterAndData
|
|
16120
|
+
paymasterAndData,
|
|
16084
16121
|
signature: "0x"
|
|
16085
16122
|
};
|
|
16086
16123
|
const userOpHash = this.crypto.computeUserOpHash(userOp, entryPointAddress, chainId);
|
|
@@ -18206,6 +18243,8 @@ var GasEstimator = class {
|
|
|
18206
18243
|
let callGasLimit = 500000n;
|
|
18207
18244
|
let verificationGasLimit = 100000n;
|
|
18208
18245
|
let preVerificationGas = 100000n;
|
|
18246
|
+
let paymasterVerificationGasLimit = 0n;
|
|
18247
|
+
let paymasterPostOpGasLimit = 0n;
|
|
18209
18248
|
if (this.ctx.bundlerUrl) {
|
|
18210
18249
|
try {
|
|
18211
18250
|
const callData = this.crypto.encodeERC7821Execute([
|
|
@@ -18293,6 +18332,12 @@ var GasEstimator = class {
|
|
|
18293
18332
|
callGasLimit = BigInt(gasEstimate.callGasLimit) * 160n / 100n;
|
|
18294
18333
|
verificationGasLimit = BigInt(gasEstimate.verificationGasLimit) * 105n / 100n;
|
|
18295
18334
|
preVerificationGas = BigInt(gasEstimate.preVerificationGas) * 105n / 100n;
|
|
18335
|
+
if (gasEstimate.paymasterVerificationGasLimit) {
|
|
18336
|
+
paymasterVerificationGasLimit = BigInt(gasEstimate.paymasterVerificationGasLimit) * 105n / 100n;
|
|
18337
|
+
}
|
|
18338
|
+
if (gasEstimate.paymasterPostOpGasLimit) {
|
|
18339
|
+
paymasterPostOpGasLimit = BigInt(gasEstimate.paymasterPostOpGasLimit) * 105n / 100n;
|
|
18340
|
+
}
|
|
18296
18341
|
if (pimlicoGasPrices) {
|
|
18297
18342
|
const level = pimlicoGasPrices.fast ?? pimlicoGasPrices.standard ?? pimlicoGasPrices.slow ?? null;
|
|
18298
18343
|
if (level) {
|
|
@@ -18329,7 +18374,7 @@ var GasEstimator = class {
|
|
|
18329
18374
|
console.warn("fillOrder gas estimation failed, using fallback:", e);
|
|
18330
18375
|
}
|
|
18331
18376
|
}
|
|
18332
|
-
const totalGas = callGasLimit + verificationGasLimit + preVerificationGas;
|
|
18377
|
+
const totalGas = callGasLimit + verificationGasLimit + preVerificationGas + paymasterVerificationGasLimit + paymasterPostOpGasLimit;
|
|
18333
18378
|
const rawTotalGasCostWei = totalGas * maxFeePerGas;
|
|
18334
18379
|
const totalGasInDestFeeToken = await convertGasToFeeToken(
|
|
18335
18380
|
this.ctx,
|
|
@@ -18344,6 +18389,8 @@ var GasEstimator = class {
|
|
|
18344
18389
|
callGasLimit,
|
|
18345
18390
|
verificationGasLimit,
|
|
18346
18391
|
preVerificationGas,
|
|
18392
|
+
paymasterVerificationGasLimit,
|
|
18393
|
+
paymasterPostOpGasLimit,
|
|
18347
18394
|
maxFeePerGas,
|
|
18348
18395
|
maxPriorityFeePerGas,
|
|
18349
18396
|
totalGasCostWei,
|