@hyperbridge/sdk 2.3.3 → 2.4.0
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 +51 -0
- package/dist/browser/index.js +88 -17
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +88 -17
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +51 -0
- package/dist/node/index.d.ts +51 -0
- package/dist/node/index.js +88 -17
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -2596,7 +2596,7 @@ var chainConfigs = {
|
|
|
2596
2596
|
UniswapV3Quoter: "0x0000000000000000000000000000000000000000",
|
|
2597
2597
|
UniswapV4Quoter: "0x0000000000000000000000000000000000000000",
|
|
2598
2598
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
2599
|
-
SolverAccount: "
|
|
2599
|
+
SolverAccount: "0x110C7E1814c923127469Ca8939a12dAa70B96a17"
|
|
2600
2600
|
},
|
|
2601
2601
|
rpcEnvKey: "BSC_CHAPEL",
|
|
2602
2602
|
defaultRpcUrl: "https://bnb-testnet.api.onfinality.io/public",
|
|
@@ -2704,7 +2704,7 @@ var chainConfigs = {
|
|
|
2704
2704
|
},
|
|
2705
2705
|
addresses: {
|
|
2706
2706
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
2707
|
-
SolverAccount: "
|
|
2707
|
+
SolverAccount: "0x3bdB532d91F165BeFad5542700205f5BB5152a82",
|
|
2708
2708
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
2709
2709
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
2710
2710
|
UniswapRouter02: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
|
|
@@ -2759,7 +2759,7 @@ var chainConfigs = {
|
|
|
2759
2759
|
},
|
|
2760
2760
|
addresses: {
|
|
2761
2761
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
2762
|
-
SolverAccount: "
|
|
2762
|
+
SolverAccount: "0x3bdB532d91F165BeFad5542700205f5BB5152a82",
|
|
2763
2763
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
2764
2764
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
2765
2765
|
UniswapRouter02: "0x10ED43C718714eb63d5aA57B78B54704E256024E",
|
|
@@ -2815,7 +2815,7 @@ var chainConfigs = {
|
|
|
2815
2815
|
},
|
|
2816
2816
|
addresses: {
|
|
2817
2817
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
2818
|
-
SolverAccount: "
|
|
2818
|
+
SolverAccount: "0x3bdB532d91F165BeFad5542700205f5BB5152a82",
|
|
2819
2819
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
2820
2820
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
2821
2821
|
UniswapRouter02: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
@@ -2872,7 +2872,7 @@ var chainConfigs = {
|
|
|
2872
2872
|
},
|
|
2873
2873
|
addresses: {
|
|
2874
2874
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
2875
|
-
SolverAccount: "
|
|
2875
|
+
SolverAccount: "0x3bdB532d91F165BeFad5542700205f5BB5152a82",
|
|
2876
2876
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
2877
2877
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
2878
2878
|
UniswapRouter02: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
@@ -2931,7 +2931,7 @@ var chainConfigs = {
|
|
|
2931
2931
|
},
|
|
2932
2932
|
addresses: {
|
|
2933
2933
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
2934
|
-
SolverAccount: "
|
|
2934
|
+
SolverAccount: "0x3bdB532d91F165BeFad5542700205f5BB5152a82",
|
|
2935
2935
|
TokenGateway: "0x8b536105b6Fae2aE9199f5146D3C57Dfe53b614E",
|
|
2936
2936
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
2937
2937
|
UniswapRouter02: "0xd2f9496824951D5237cC71245D659E48d0d5f9E8",
|
|
@@ -3018,7 +3018,7 @@ var chainConfigs = {
|
|
|
3018
3018
|
Calldispatcher: "0x876F1891982E260026630c233A4897160A281Fb8",
|
|
3019
3019
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3020
3020
|
EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
|
|
3021
|
-
SolverAccount: "
|
|
3021
|
+
SolverAccount: "0x110C7E1814c923127469Ca8939a12dAa70B96a17"
|
|
3022
3022
|
},
|
|
3023
3023
|
rpcEnvKey: "POLYGON_AMOY",
|
|
3024
3024
|
defaultRpcUrl: "https://rpc-amoy.polygon.technology",
|
|
@@ -3042,7 +3042,7 @@ var chainConfigs = {
|
|
|
3042
3042
|
},
|
|
3043
3043
|
addresses: {
|
|
3044
3044
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
3045
|
-
SolverAccount: "
|
|
3045
|
+
SolverAccount: "0x3bdB532d91F165BeFad5542700205f5BB5152a82",
|
|
3046
3046
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
3047
3047
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
3048
3048
|
UniswapRouter02: "0x4A7b5Da61326A6379179b40d00F57E5bbDC962c2",
|
|
@@ -3077,7 +3077,7 @@ var chainConfigs = {
|
|
|
3077
3077
|
},
|
|
3078
3078
|
addresses: {
|
|
3079
3079
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
3080
|
-
SolverAccount: "
|
|
3080
|
+
SolverAccount: "0x3bdB532d91F165BeFad5542700205f5BB5152a82",
|
|
3081
3081
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
3082
3082
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
3083
3083
|
UniswapRouter02: "0xB2e26652e4BAd1e56055A051f922E06760cA0BFE",
|
|
@@ -3232,7 +3232,7 @@ var chainConfigs = {
|
|
|
3232
3232
|
},
|
|
3233
3233
|
addresses: {
|
|
3234
3234
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
3235
|
-
SolverAccount: "
|
|
3235
|
+
SolverAccount: "0x3bdB532d91F165BeFad5542700205f5BB5152a82",
|
|
3236
3236
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
3237
3237
|
Calldispatcher: "0xE2C7e576E26E0bE7aC97c6fE925bcDAbD87c4bEd"
|
|
3238
3238
|
},
|
|
@@ -14774,6 +14774,67 @@ var CryptoUtils = class _CryptoUtils {
|
|
|
14774
14774
|
viem.encodePacked(["bytes1", "bytes1", "bytes32", "bytes32"], ["0x19", "0x01", domainSeparator, structHash])
|
|
14775
14775
|
);
|
|
14776
14776
|
}
|
|
14777
|
+
/**
|
|
14778
|
+
* Derives the ERC-4337 nonce key that binds a bid UserOperation to its
|
|
14779
|
+
* order and session key: the lower 192 bits of
|
|
14780
|
+
* `keccak256(commitment ‖ sessionKey)`. `SolverAccount` rejects bid
|
|
14781
|
+
* operations whose nonce key differs — this is what lets the solver sign
|
|
14782
|
+
* the plain userOpHash while staying committed to the order and to the
|
|
14783
|
+
* session key it bid against.
|
|
14784
|
+
*
|
|
14785
|
+
* @param commitment - The order commitment (`order.id`).
|
|
14786
|
+
* @param sessionKey - The order's session key address (`order.session`).
|
|
14787
|
+
* @returns The 192-bit nonce key as a bigint (pass to `EntryPoint.getNonce`).
|
|
14788
|
+
*/
|
|
14789
|
+
static bidNonceKey(commitment, sessionKey) {
|
|
14790
|
+
return BigInt(viem.keccak256(viem.encodePacked(["bytes32", "address"], [commitment, sessionKey]))) & (1n << 192n) - 1n;
|
|
14791
|
+
}
|
|
14792
|
+
/**
|
|
14793
|
+
* Builds the EIP-712 typed-data payload whose digest is the EntryPoint v0.8
|
|
14794
|
+
* `userOpHash` (i.e. `hashTypedData(packedUserOpTypedData(...)) ===
|
|
14795
|
+
* computeUserOpHash(...)`). Signing this typed data is bit-identical to
|
|
14796
|
+
* signing the raw userOpHash, but keeps the full operation visible to
|
|
14797
|
+
* signing infrastructure (hardware wallets, MPC/TEE policy engines) instead
|
|
14798
|
+
* of an opaque 32-byte digest.
|
|
14799
|
+
*
|
|
14800
|
+
* @param userOp - The packed UserOperation to sign (signature field ignored).
|
|
14801
|
+
* @param entryPoint - Address of the EntryPoint v0.8 contract.
|
|
14802
|
+
* @param chainId - Chain ID of the network on which the operation will execute.
|
|
14803
|
+
* @returns A viem `TypedDataDefinition` for the operation.
|
|
14804
|
+
*/
|
|
14805
|
+
static packedUserOpTypedData(userOp, entryPoint, chainId) {
|
|
14806
|
+
return {
|
|
14807
|
+
domain: {
|
|
14808
|
+
name: "ERC4337",
|
|
14809
|
+
version: "1",
|
|
14810
|
+
chainId,
|
|
14811
|
+
verifyingContract: entryPoint
|
|
14812
|
+
},
|
|
14813
|
+
types: {
|
|
14814
|
+
PackedUserOperation: [
|
|
14815
|
+
{ name: "sender", type: "address" },
|
|
14816
|
+
{ name: "nonce", type: "uint256" },
|
|
14817
|
+
{ name: "initCode", type: "bytes" },
|
|
14818
|
+
{ name: "callData", type: "bytes" },
|
|
14819
|
+
{ name: "accountGasLimits", type: "bytes32" },
|
|
14820
|
+
{ name: "preVerificationGas", type: "uint256" },
|
|
14821
|
+
{ name: "gasFees", type: "bytes32" },
|
|
14822
|
+
{ name: "paymasterAndData", type: "bytes" }
|
|
14823
|
+
]
|
|
14824
|
+
},
|
|
14825
|
+
primaryType: "PackedUserOperation",
|
|
14826
|
+
message: {
|
|
14827
|
+
sender: userOp.sender,
|
|
14828
|
+
nonce: userOp.nonce,
|
|
14829
|
+
initCode: userOp.initCode,
|
|
14830
|
+
callData: userOp.callData,
|
|
14831
|
+
accountGasLimits: userOp.accountGasLimits,
|
|
14832
|
+
preVerificationGas: userOp.preVerificationGas,
|
|
14833
|
+
gasFees: userOp.gasFees,
|
|
14834
|
+
paymasterAndData: userOp.paymasterAndData
|
|
14835
|
+
}
|
|
14836
|
+
};
|
|
14837
|
+
}
|
|
14777
14838
|
/**
|
|
14778
14839
|
* Computes the EIP-712 struct hash of a `PackedUserOperation`.
|
|
14779
14840
|
*
|
|
@@ -16282,9 +16343,12 @@ var BidManager = class {
|
|
|
16282
16343
|
* Constructs a signed `PackedUserOperation` that a solver can submit to the
|
|
16283
16344
|
* Hyperbridge coprocessor as a bid to fill an order.
|
|
16284
16345
|
*
|
|
16285
|
-
* The solver
|
|
16286
|
-
*
|
|
16287
|
-
*
|
|
16346
|
+
* The solver signs the operation as EntryPoint v0.8 EIP-712 typed data,
|
|
16347
|
+
* whose digest is the plain userOpHash. The binding to the order lives in
|
|
16348
|
+
* the operation itself: the 4337 nonce key must be the lower 192 bits of
|
|
16349
|
+
* the order commitment (`SolverAccount` enforces this during validation),
|
|
16350
|
+
* and the callData carries the order. This keeps the signed payload fully
|
|
16351
|
+
* transparent to signing infrastructure instead of an opaque digest.
|
|
16288
16352
|
*
|
|
16289
16353
|
* @param options - Parameters describing the solver account, gas limits, fee
|
|
16290
16354
|
* market values, and pre-built `callData` for the fill operation.
|
|
@@ -16322,10 +16386,17 @@ var BidManager = class {
|
|
|
16322
16386
|
paymasterAndData,
|
|
16323
16387
|
signature: "0x"
|
|
16324
16388
|
};
|
|
16325
|
-
const
|
|
16326
|
-
const
|
|
16327
|
-
|
|
16328
|
-
|
|
16389
|
+
const nonceKey = BigInt(nonce) >> 64n;
|
|
16390
|
+
const expectedKey = CryptoUtils.bidNonceKey(order.id, order.session);
|
|
16391
|
+
if (nonceKey !== expectedKey) {
|
|
16392
|
+
console.warn(
|
|
16393
|
+
`[BidManager] bid nonce key does not bind the order commitment and session key; on-chain validation will fail (order=${order.id})`
|
|
16394
|
+
);
|
|
16395
|
+
}
|
|
16396
|
+
const solverSignature = await solverSigner.signTypedData(
|
|
16397
|
+
CryptoUtils.packedUserOpTypedData(userOp, entryPointAddress, chainId),
|
|
16398
|
+
Number(chainId)
|
|
16399
|
+
);
|
|
16329
16400
|
const signature = viem.concat([order.id, solverSignature]);
|
|
16330
16401
|
return { ...userOp, signature };
|
|
16331
16402
|
}
|