@hyperbridge/sdk 2.8.10 → 2.8.12
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 +220 -83
- package/dist/browser/index.js +336 -94
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +337 -95
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +2 -2
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +336 -94
- package/dist/node/index.js.map +1 -1
- package/dist/node/{intents-helpers-BKj42imQ.d.cts → intents-helpers-C9PJp8rx.d.cts} +639 -220
- package/dist/node/{intents-helpers-BKj42imQ.d.ts → intents-helpers-C9PJp8rx.d.ts} +639 -220
- package/dist/node/intents-helpers.cjs +301 -97
- package/dist/node/intents-helpers.cjs.map +1 -1
- package/dist/node/intents-helpers.d.cts +1 -1
- package/dist/node/intents-helpers.d.ts +1 -1
- package/dist/node/intents-helpers.js +300 -96
- package/dist/node/intents-helpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { bR as AggregationLogger, bS as BidNonceKeyFn, bT as BidSignature, bU as ENTRY_POINT_V08_ADDRESS, bV as FILL_ORDER_ABI, ai as FILL_ORDER_V1_ABI, bW as FetchLike, bX as FillData, bY as HexString, bZ as IntentGatewayV2, b_ as LpBalance, b$ as OrderCommitmentFn,
|
|
1
|
+
export { bR as AggregationLogger, bS as BidNonceKeyFn, bT as BidSignature, bU as ENTRY_POINT_V08_ADDRESS, bV as FILL_ORDER_ABI, ai as FILL_ORDER_V1_ABI, bW as FetchLike, bX as FillData, bY as HexString, bZ as IntentGatewayV2, b_ as LpBalance, b$ as OrderCommitmentFn, c0 as PhantomAggregation, c1 as PhantomLegAggregation, c2 as PhantomLegBidder, c3 as PoolAndPositionInfo, c4 as RecoverBidSigner, c5 as RpcBidInfo, c6 as SolverBalanceReader, c7 as SolverV4Position, be as UNISWAP_QUOTE_HAIRCUT_BPS, c8 as UniswapV4Contracts, c9 as V4PositionState, ca as YieldVaultMap, cb as aggregatePhantomBids, bg as applyProtocolFeeHaircut, bh as applyUniswapQuoteHaircut, bq as decodeAcceptedSourceChains, br as decodeERC7821ExecuteBatch, bt as decodePhantomBidDeclaration, bu as decodeUserOpScale, bw as encodeAcceptedSourceChains, bx as encodeERC7821ExecuteBatch, bA as encodePhantomBidDeclaration, bB as encodeUserOpScale, cc as extractFillData, cd as fetchBidsForOrder, ce as getTotalSolverBalance, cf as memoizedSolverBalance, cg as orderCommitmentFromDecoded, bL as poolSlug, ch as positionAmountOfToken, bM as readProtocolFeeHaircutBps, ci as readV4Position, cj as recoverBidSignerViem, ck as setAggregationFetch, bO as sortPoolSymbols, cl as splitBidSignature, cm as weightedMedian, cn as zipFillLegs } from './intents-helpers-C9PJp8rx.cjs';
|
|
2
2
|
import 'consola';
|
|
3
3
|
import 'decimal.js';
|
|
4
4
|
import 'graphql-request';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { bR as AggregationLogger, bS as BidNonceKeyFn, bT as BidSignature, bU as ENTRY_POINT_V08_ADDRESS, bV as FILL_ORDER_ABI, ai as FILL_ORDER_V1_ABI, bW as FetchLike, bX as FillData, bY as HexString, bZ as IntentGatewayV2, b_ as LpBalance, b$ as OrderCommitmentFn,
|
|
1
|
+
export { bR as AggregationLogger, bS as BidNonceKeyFn, bT as BidSignature, bU as ENTRY_POINT_V08_ADDRESS, bV as FILL_ORDER_ABI, ai as FILL_ORDER_V1_ABI, bW as FetchLike, bX as FillData, bY as HexString, bZ as IntentGatewayV2, b_ as LpBalance, b$ as OrderCommitmentFn, c0 as PhantomAggregation, c1 as PhantomLegAggregation, c2 as PhantomLegBidder, c3 as PoolAndPositionInfo, c4 as RecoverBidSigner, c5 as RpcBidInfo, c6 as SolverBalanceReader, c7 as SolverV4Position, be as UNISWAP_QUOTE_HAIRCUT_BPS, c8 as UniswapV4Contracts, c9 as V4PositionState, ca as YieldVaultMap, cb as aggregatePhantomBids, bg as applyProtocolFeeHaircut, bh as applyUniswapQuoteHaircut, bq as decodeAcceptedSourceChains, br as decodeERC7821ExecuteBatch, bt as decodePhantomBidDeclaration, bu as decodeUserOpScale, bw as encodeAcceptedSourceChains, bx as encodeERC7821ExecuteBatch, bA as encodePhantomBidDeclaration, bB as encodeUserOpScale, cc as extractFillData, cd as fetchBidsForOrder, ce as getTotalSolverBalance, cf as memoizedSolverBalance, cg as orderCommitmentFromDecoded, bL as poolSlug, ch as positionAmountOfToken, bM as readProtocolFeeHaircutBps, ci as readV4Position, cj as recoverBidSignerViem, ck as setAggregationFetch, bO as sortPoolSymbols, cl as splitBidSignature, cm as weightedMedian, cn as zipFillLegs } from './intents-helpers-C9PJp8rx.js';
|
|
2
2
|
import 'consola';
|
|
3
3
|
import 'decimal.js';
|
|
4
4
|
import 'graphql-request';
|
|
@@ -71,7 +71,7 @@ var ABI2 = [
|
|
|
71
71
|
type: "constructor",
|
|
72
72
|
inputs: [
|
|
73
73
|
{
|
|
74
|
-
name: "
|
|
74
|
+
name: "owner",
|
|
75
75
|
type: "address",
|
|
76
76
|
internalType: "address"
|
|
77
77
|
}
|
|
@@ -146,25 +146,6 @@ var ABI2 = [
|
|
|
146
146
|
],
|
|
147
147
|
stateMutability: "view"
|
|
148
148
|
},
|
|
149
|
-
{
|
|
150
|
-
type: "function",
|
|
151
|
-
name: "_instances",
|
|
152
|
-
inputs: [
|
|
153
|
-
{
|
|
154
|
-
name: "",
|
|
155
|
-
type: "bytes32",
|
|
156
|
-
internalType: "bytes32"
|
|
157
|
-
}
|
|
158
|
-
],
|
|
159
|
-
outputs: [
|
|
160
|
-
{
|
|
161
|
-
name: "",
|
|
162
|
-
type: "address",
|
|
163
|
-
internalType: "address"
|
|
164
|
-
}
|
|
165
|
-
],
|
|
166
|
-
stateMutability: "view"
|
|
167
|
-
},
|
|
168
149
|
{
|
|
169
150
|
type: "function",
|
|
170
151
|
name: "_nonce",
|
|
@@ -202,6 +183,19 @@ var ABI2 = [
|
|
|
202
183
|
],
|
|
203
184
|
stateMutability: "view"
|
|
204
185
|
},
|
|
186
|
+
{
|
|
187
|
+
type: "function",
|
|
188
|
+
name: "_owner",
|
|
189
|
+
inputs: [],
|
|
190
|
+
outputs: [
|
|
191
|
+
{
|
|
192
|
+
name: "",
|
|
193
|
+
type: "address",
|
|
194
|
+
internalType: "address"
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
stateMutability: "view"
|
|
198
|
+
},
|
|
205
199
|
{
|
|
206
200
|
type: "function",
|
|
207
201
|
name: "_partialFills",
|
|
@@ -617,6 +611,61 @@ var ABI2 = [
|
|
|
617
611
|
],
|
|
618
612
|
stateMutability: "view"
|
|
619
613
|
},
|
|
614
|
+
{
|
|
615
|
+
type: "function",
|
|
616
|
+
name: "initialize",
|
|
617
|
+
inputs: [
|
|
618
|
+
{
|
|
619
|
+
name: "p",
|
|
620
|
+
type: "tuple",
|
|
621
|
+
internalType: "struct Params",
|
|
622
|
+
components: [
|
|
623
|
+
{
|
|
624
|
+
name: "host",
|
|
625
|
+
type: "address",
|
|
626
|
+
internalType: "address"
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
name: "dispatcher",
|
|
630
|
+
type: "address",
|
|
631
|
+
internalType: "address"
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
name: "solverSelection",
|
|
635
|
+
type: "bool",
|
|
636
|
+
internalType: "bool"
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
name: "surplusShareBps",
|
|
640
|
+
type: "uint256",
|
|
641
|
+
internalType: "uint256"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
name: "protocolFeeBps",
|
|
645
|
+
type: "uint256",
|
|
646
|
+
internalType: "uint256"
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
name: "priceOracle",
|
|
650
|
+
type: "address",
|
|
651
|
+
internalType: "address"
|
|
652
|
+
}
|
|
653
|
+
]
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
name: "peerChains",
|
|
657
|
+
type: "bytes[]",
|
|
658
|
+
internalType: "bytes[]"
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
name: "relayer",
|
|
662
|
+
type: "address",
|
|
663
|
+
internalType: "address"
|
|
664
|
+
}
|
|
665
|
+
],
|
|
666
|
+
outputs: [],
|
|
667
|
+
stateMutability: "nonpayable"
|
|
668
|
+
},
|
|
620
669
|
{
|
|
621
670
|
type: "function",
|
|
622
671
|
name: "instance",
|
|
@@ -636,6 +685,19 @@ var ABI2 = [
|
|
|
636
685
|
],
|
|
637
686
|
stateMutability: "view"
|
|
638
687
|
},
|
|
688
|
+
{
|
|
689
|
+
type: "function",
|
|
690
|
+
name: "migrate",
|
|
691
|
+
inputs: [
|
|
692
|
+
{
|
|
693
|
+
name: "relayer",
|
|
694
|
+
type: "address",
|
|
695
|
+
internalType: "address"
|
|
696
|
+
}
|
|
697
|
+
],
|
|
698
|
+
outputs: [],
|
|
699
|
+
stateMutability: "nonpayable"
|
|
700
|
+
},
|
|
639
701
|
{
|
|
640
702
|
type: "function",
|
|
641
703
|
name: "onAccept",
|
|
@@ -1147,7 +1209,7 @@ var ABI2 = [
|
|
|
1147
1209
|
internalType: "uint256"
|
|
1148
1210
|
}
|
|
1149
1211
|
],
|
|
1150
|
-
stateMutability: "
|
|
1212
|
+
stateMutability: "nonpayable"
|
|
1151
1213
|
},
|
|
1152
1214
|
{
|
|
1153
1215
|
type: "function",
|
|
@@ -1203,6 +1265,19 @@ var ABI2 = [
|
|
|
1203
1265
|
internalType: "uint256"
|
|
1204
1266
|
}
|
|
1205
1267
|
],
|
|
1268
|
+
stateMutability: "nonpayable"
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
type: "function",
|
|
1272
|
+
name: "relayer",
|
|
1273
|
+
inputs: [],
|
|
1274
|
+
outputs: [
|
|
1275
|
+
{
|
|
1276
|
+
name: "",
|
|
1277
|
+
type: "address",
|
|
1278
|
+
internalType: "address"
|
|
1279
|
+
}
|
|
1280
|
+
],
|
|
1206
1281
|
stateMutability: "view"
|
|
1207
1282
|
},
|
|
1208
1283
|
{
|
|
@@ -1243,66 +1318,67 @@ var ABI2 = [
|
|
|
1243
1318
|
},
|
|
1244
1319
|
{
|
|
1245
1320
|
type: "function",
|
|
1246
|
-
name: "
|
|
1321
|
+
name: "setRelayer",
|
|
1247
1322
|
inputs: [
|
|
1248
1323
|
{
|
|
1249
|
-
name: "
|
|
1250
|
-
type: "
|
|
1251
|
-
internalType: "
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
type: "bool",
|
|
1266
|
-
internalType: "bool"
|
|
1267
|
-
},
|
|
1268
|
-
{
|
|
1269
|
-
name: "surplusShareBps",
|
|
1270
|
-
type: "uint256",
|
|
1271
|
-
internalType: "uint256"
|
|
1272
|
-
},
|
|
1273
|
-
{
|
|
1274
|
-
name: "protocolFeeBps",
|
|
1275
|
-
type: "uint256",
|
|
1276
|
-
internalType: "uint256"
|
|
1277
|
-
},
|
|
1278
|
-
{
|
|
1279
|
-
name: "priceOracle",
|
|
1280
|
-
type: "address",
|
|
1281
|
-
internalType: "address"
|
|
1282
|
-
}
|
|
1283
|
-
]
|
|
1324
|
+
name: "relayer",
|
|
1325
|
+
type: "address",
|
|
1326
|
+
internalType: "address"
|
|
1327
|
+
}
|
|
1328
|
+
],
|
|
1329
|
+
outputs: [],
|
|
1330
|
+
stateMutability: "nonpayable"
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
type: "function",
|
|
1334
|
+
name: "upgradeToAndCall",
|
|
1335
|
+
inputs: [
|
|
1336
|
+
{
|
|
1337
|
+
name: "newImplementation",
|
|
1338
|
+
type: "address",
|
|
1339
|
+
internalType: "address"
|
|
1284
1340
|
},
|
|
1285
1341
|
{
|
|
1286
|
-
name: "
|
|
1287
|
-
type: "
|
|
1288
|
-
internalType: "
|
|
1289
|
-
components: [
|
|
1290
|
-
{
|
|
1291
|
-
name: "chain",
|
|
1292
|
-
type: "bytes",
|
|
1293
|
-
internalType: "bytes"
|
|
1294
|
-
},
|
|
1295
|
-
{
|
|
1296
|
-
name: "gateway",
|
|
1297
|
-
type: "address",
|
|
1298
|
-
internalType: "address"
|
|
1299
|
-
}
|
|
1300
|
-
]
|
|
1342
|
+
name: "data",
|
|
1343
|
+
type: "bytes",
|
|
1344
|
+
internalType: "bytes"
|
|
1301
1345
|
}
|
|
1302
1346
|
],
|
|
1303
1347
|
outputs: [],
|
|
1304
1348
|
stateMutability: "nonpayable"
|
|
1305
1349
|
},
|
|
1350
|
+
{
|
|
1351
|
+
type: "function",
|
|
1352
|
+
name: "version",
|
|
1353
|
+
inputs: [],
|
|
1354
|
+
outputs: [
|
|
1355
|
+
{
|
|
1356
|
+
name: "",
|
|
1357
|
+
type: "uint64",
|
|
1358
|
+
internalType: "uint64"
|
|
1359
|
+
}
|
|
1360
|
+
],
|
|
1361
|
+
stateMutability: "view"
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
type: "event",
|
|
1365
|
+
name: "DeploymentAdded",
|
|
1366
|
+
inputs: [
|
|
1367
|
+
{
|
|
1368
|
+
name: "chain",
|
|
1369
|
+
type: "string",
|
|
1370
|
+
indexed: false,
|
|
1371
|
+
internalType: "string"
|
|
1372
|
+
},
|
|
1373
|
+
{
|
|
1374
|
+
name: "gateway",
|
|
1375
|
+
type: "address",
|
|
1376
|
+
indexed: false,
|
|
1377
|
+
internalType: "address"
|
|
1378
|
+
}
|
|
1379
|
+
],
|
|
1380
|
+
anonymous: false
|
|
1381
|
+
},
|
|
1306
1382
|
{
|
|
1307
1383
|
type: "event",
|
|
1308
1384
|
name: "DestinationProtocolFeeUpdated",
|
|
@@ -1436,16 +1512,29 @@ var ABI2 = [
|
|
|
1436
1512
|
},
|
|
1437
1513
|
{
|
|
1438
1514
|
type: "event",
|
|
1439
|
-
name: "
|
|
1515
|
+
name: "Initialized",
|
|
1440
1516
|
inputs: [
|
|
1441
1517
|
{
|
|
1442
|
-
name: "
|
|
1443
|
-
type: "
|
|
1518
|
+
name: "version",
|
|
1519
|
+
type: "uint64",
|
|
1444
1520
|
indexed: false,
|
|
1445
|
-
internalType: "
|
|
1521
|
+
internalType: "uint64"
|
|
1522
|
+
}
|
|
1523
|
+
],
|
|
1524
|
+
anonymous: false
|
|
1525
|
+
},
|
|
1526
|
+
{
|
|
1527
|
+
type: "event",
|
|
1528
|
+
name: "OrderCancelled",
|
|
1529
|
+
inputs: [
|
|
1530
|
+
{
|
|
1531
|
+
name: "commitment",
|
|
1532
|
+
type: "bytes32",
|
|
1533
|
+
indexed: true,
|
|
1534
|
+
internalType: "bytes32"
|
|
1446
1535
|
},
|
|
1447
1536
|
{
|
|
1448
|
-
name: "
|
|
1537
|
+
name: "canceller",
|
|
1449
1538
|
type: "address",
|
|
1450
1539
|
indexed: false,
|
|
1451
1540
|
internalType: "address"
|
|
@@ -1773,14 +1862,52 @@ var ABI2 = [
|
|
|
1773
1862
|
],
|
|
1774
1863
|
anonymous: false
|
|
1775
1864
|
},
|
|
1865
|
+
{
|
|
1866
|
+
type: "event",
|
|
1867
|
+
name: "RelayerUpdated",
|
|
1868
|
+
inputs: [
|
|
1869
|
+
{
|
|
1870
|
+
name: "previous",
|
|
1871
|
+
type: "address",
|
|
1872
|
+
indexed: false,
|
|
1873
|
+
internalType: "address"
|
|
1874
|
+
},
|
|
1875
|
+
{
|
|
1876
|
+
name: "current",
|
|
1877
|
+
type: "address",
|
|
1878
|
+
indexed: false,
|
|
1879
|
+
internalType: "address"
|
|
1880
|
+
}
|
|
1881
|
+
],
|
|
1882
|
+
anonymous: false
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
type: "event",
|
|
1886
|
+
name: "Upgraded",
|
|
1887
|
+
inputs: [
|
|
1888
|
+
{
|
|
1889
|
+
name: "implementation",
|
|
1890
|
+
type: "address",
|
|
1891
|
+
indexed: true,
|
|
1892
|
+
internalType: "address"
|
|
1893
|
+
}
|
|
1894
|
+
],
|
|
1895
|
+
anonymous: false
|
|
1896
|
+
},
|
|
1776
1897
|
{
|
|
1777
1898
|
type: "error",
|
|
1778
|
-
name: "
|
|
1779
|
-
inputs: [
|
|
1899
|
+
name: "AddressEmptyCode",
|
|
1900
|
+
inputs: [
|
|
1901
|
+
{
|
|
1902
|
+
name: "target",
|
|
1903
|
+
type: "address",
|
|
1904
|
+
internalType: "address"
|
|
1905
|
+
}
|
|
1906
|
+
]
|
|
1780
1907
|
},
|
|
1781
1908
|
{
|
|
1782
1909
|
type: "error",
|
|
1783
|
-
name: "
|
|
1910
|
+
name: "Cancelled",
|
|
1784
1911
|
inputs: []
|
|
1785
1912
|
},
|
|
1786
1913
|
{
|
|
@@ -1810,11 +1937,37 @@ var ABI2 = [
|
|
|
1810
1937
|
}
|
|
1811
1938
|
]
|
|
1812
1939
|
},
|
|
1940
|
+
{
|
|
1941
|
+
type: "error",
|
|
1942
|
+
name: "ERC1967InvalidImplementation",
|
|
1943
|
+
inputs: [
|
|
1944
|
+
{
|
|
1945
|
+
name: "implementation",
|
|
1946
|
+
type: "address",
|
|
1947
|
+
internalType: "address"
|
|
1948
|
+
}
|
|
1949
|
+
]
|
|
1950
|
+
},
|
|
1951
|
+
{
|
|
1952
|
+
type: "error",
|
|
1953
|
+
name: "ERC1967NonPayable",
|
|
1954
|
+
inputs: []
|
|
1955
|
+
},
|
|
1813
1956
|
{
|
|
1814
1957
|
type: "error",
|
|
1815
1958
|
name: "Expired",
|
|
1816
1959
|
inputs: []
|
|
1817
1960
|
},
|
|
1961
|
+
{
|
|
1962
|
+
type: "error",
|
|
1963
|
+
name: "FailedCall",
|
|
1964
|
+
inputs: []
|
|
1965
|
+
},
|
|
1966
|
+
{
|
|
1967
|
+
type: "error",
|
|
1968
|
+
name: "FillExpired",
|
|
1969
|
+
inputs: []
|
|
1970
|
+
},
|
|
1818
1971
|
{
|
|
1819
1972
|
type: "error",
|
|
1820
1973
|
name: "Filled",
|
|
@@ -1825,6 +1978,11 @@ var ABI2 = [
|
|
|
1825
1978
|
name: "InsufficientNativeToken",
|
|
1826
1979
|
inputs: []
|
|
1827
1980
|
},
|
|
1981
|
+
{
|
|
1982
|
+
type: "error",
|
|
1983
|
+
name: "InvalidInitialization",
|
|
1984
|
+
inputs: []
|
|
1985
|
+
},
|
|
1828
1986
|
{
|
|
1829
1987
|
type: "error",
|
|
1830
1988
|
name: "InvalidInput",
|
|
@@ -1840,6 +1998,21 @@ var ABI2 = [
|
|
|
1840
1998
|
name: "NotExpired",
|
|
1841
1999
|
inputs: []
|
|
1842
2000
|
},
|
|
2001
|
+
{
|
|
2002
|
+
type: "error",
|
|
2003
|
+
name: "NotInitializing",
|
|
2004
|
+
inputs: []
|
|
2005
|
+
},
|
|
2006
|
+
{
|
|
2007
|
+
type: "error",
|
|
2008
|
+
name: "PartialFillNotAllowed",
|
|
2009
|
+
inputs: []
|
|
2010
|
+
},
|
|
2011
|
+
{
|
|
2012
|
+
type: "error",
|
|
2013
|
+
name: "ReentrancyGuardReentrantCall",
|
|
2014
|
+
inputs: []
|
|
2015
|
+
},
|
|
1843
2016
|
{
|
|
1844
2017
|
type: "error",
|
|
1845
2018
|
name: "SafeERC20FailedOperation",
|
|
@@ -1877,6 +2050,11 @@ var ABI2 = [
|
|
|
1877
2050
|
name: "UnexpectedCall",
|
|
1878
2051
|
inputs: []
|
|
1879
2052
|
},
|
|
2053
|
+
{
|
|
2054
|
+
type: "error",
|
|
2055
|
+
name: "UnknownInstance",
|
|
2056
|
+
inputs: []
|
|
2057
|
+
},
|
|
1880
2058
|
{
|
|
1881
2059
|
type: "error",
|
|
1882
2060
|
name: "UnknownOrder",
|
|
@@ -2645,15 +2823,35 @@ function zipFillLegs(assets, outputs) {
|
|
|
2645
2823
|
});
|
|
2646
2824
|
}
|
|
2647
2825
|
var UNISWAP_QUOTE_HAIRCUT_BPS = 10n;
|
|
2648
|
-
var PHANTOM_QUOTE_HAIRCUT_BPS = 5n;
|
|
2649
2826
|
function haircut(amount, bps) {
|
|
2650
2827
|
return amount * (10000n - bps) / 10000n;
|
|
2651
2828
|
}
|
|
2652
2829
|
function applyUniswapQuoteHaircut(amount) {
|
|
2653
2830
|
return haircut(amount, UNISWAP_QUOTE_HAIRCUT_BPS);
|
|
2654
2831
|
}
|
|
2655
|
-
|
|
2656
|
-
|
|
2832
|
+
var SELECTOR_GATEWAY_PARAMS = "0xcff0ab96";
|
|
2833
|
+
var GATEWAY_PARAMS_WORDS = 6;
|
|
2834
|
+
var GATEWAY_PARAMS_FEE_WORD = 4;
|
|
2835
|
+
async function readProtocolFeeHaircutBps(evmRpcUrl, gatewayAddress) {
|
|
2836
|
+
const result = await rpcCall(evmRpcUrl, {
|
|
2837
|
+
id: 1,
|
|
2838
|
+
jsonrpc: "2.0",
|
|
2839
|
+
method: "eth_call",
|
|
2840
|
+
params: [{ to: gatewayAddress, data: SELECTOR_GATEWAY_PARAMS }, "latest"]
|
|
2841
|
+
});
|
|
2842
|
+
const hex = result.result;
|
|
2843
|
+
if (typeof hex !== "string" || hex.length < 2 + 64 * GATEWAY_PARAMS_WORDS) {
|
|
2844
|
+
throw new PhantomRpcError(`IntentGateway.params() returned no usable result from ${gatewayAddress} on ${evmRpcUrl}`);
|
|
2845
|
+
}
|
|
2846
|
+
const start = 2 + 64 * GATEWAY_PARAMS_FEE_WORD;
|
|
2847
|
+
const protocolFeeBps = BigInt(`0x${hex.slice(start, start + 64)}`);
|
|
2848
|
+
if (protocolFeeBps >= 10000n) {
|
|
2849
|
+
throw new PhantomRpcError(`IntentGateway ${gatewayAddress} reports an implausible protocol fee: ${protocolFeeBps} bps`);
|
|
2850
|
+
}
|
|
2851
|
+
return protocolFeeBps;
|
|
2852
|
+
}
|
|
2853
|
+
function applyProtocolFeeHaircut(amount, protocolFeeBps) {
|
|
2854
|
+
return haircut(amount, protocolFeeBps);
|
|
2657
2855
|
}
|
|
2658
2856
|
function weightedMedian(entries) {
|
|
2659
2857
|
const sorted = [...entries].sort((a, b) => a.price < b.price ? -1 : a.price > b.price ? 1 : 0);
|
|
@@ -2722,7 +2920,7 @@ var recoverBidSignerViem = async (userOp, entryPoint, chainId, solverSignature)
|
|
|
2722
2920
|
}
|
|
2723
2921
|
};
|
|
2724
2922
|
var DELEGATION_INDICATOR_PREFIX = "0xef0100";
|
|
2725
|
-
async function isDelegatedToSolverAccount(evmRpcUrl, account,
|
|
2923
|
+
async function isDelegatedToSolverAccount(evmRpcUrl, account, solverAccounts) {
|
|
2726
2924
|
const response = await rpcCall(evmRpcUrl, {
|
|
2727
2925
|
id: 1,
|
|
2728
2926
|
jsonrpc: "2.0",
|
|
@@ -2734,15 +2932,17 @@ async function isDelegatedToSolverAccount(evmRpcUrl, account, solverAccount) {
|
|
|
2734
2932
|
}
|
|
2735
2933
|
const code = response.result.toLowerCase();
|
|
2736
2934
|
if (!code.startsWith(DELEGATION_INDICATOR_PREFIX)) return false;
|
|
2737
|
-
|
|
2935
|
+
const delegate = `0x${code.slice(DELEGATION_INDICATOR_PREFIX.length)}`;
|
|
2936
|
+
return solverAccounts.some((solverAccount) => solverAccount.toLowerCase() === delegate);
|
|
2738
2937
|
}
|
|
2739
2938
|
function memoizedDelegationCheck() {
|
|
2740
2939
|
const cache = /* @__PURE__ */ new Map();
|
|
2741
|
-
return (evmRpcUrl, account,
|
|
2742
|
-
const
|
|
2940
|
+
return (evmRpcUrl, account, solverAccounts) => {
|
|
2941
|
+
const targets = solverAccounts.map((a) => a.toLowerCase()).sort().join(",");
|
|
2942
|
+
const key = `${evmRpcUrl}|${account.toLowerCase()}|${targets}`;
|
|
2743
2943
|
let pending = cache.get(key);
|
|
2744
2944
|
if (!pending) {
|
|
2745
|
-
pending = isDelegatedToSolverAccount(evmRpcUrl, account,
|
|
2945
|
+
pending = isDelegatedToSolverAccount(evmRpcUrl, account, solverAccounts).catch((err) => {
|
|
2746
2946
|
cache.delete(key);
|
|
2747
2947
|
throw err;
|
|
2748
2948
|
});
|
|
@@ -2762,7 +2962,7 @@ async function isVerifiedSolverBid(params) {
|
|
|
2762
2962
|
commitment,
|
|
2763
2963
|
sessionKey,
|
|
2764
2964
|
chainId,
|
|
2765
|
-
|
|
2965
|
+
solverAccounts,
|
|
2766
2966
|
evmRpcUrl,
|
|
2767
2967
|
recoverSigner,
|
|
2768
2968
|
bidNonceKey,
|
|
@@ -2791,8 +2991,8 @@ async function isVerifiedSolverBid(params) {
|
|
|
2791
2991
|
logger?.warn({ solver, commitment, signer }, "Rejecting phantom bid: signature does not recover to the sender");
|
|
2792
2992
|
return false;
|
|
2793
2993
|
}
|
|
2794
|
-
if (!await isDelegated(evmRpcUrl, solver,
|
|
2795
|
-
logger?.warn({ solver, commitment,
|
|
2994
|
+
if (!await isDelegated(evmRpcUrl, solver, solverAccounts)) {
|
|
2995
|
+
logger?.warn({ solver, commitment, solverAccounts }, "Rejecting phantom bid: sender is not a delegated solver");
|
|
2796
2996
|
return false;
|
|
2797
2997
|
}
|
|
2798
2998
|
return true;
|
|
@@ -2956,7 +3156,10 @@ async function aggregatePhantomBids(params) {
|
|
|
2956
3156
|
}
|
|
2957
3157
|
var AGGREGATION_ATTEMPTS = 5;
|
|
2958
3158
|
async function runAggregation(params, isDelegated) {
|
|
2959
|
-
const { nodeUrl, evmRpcUrls, chain, gatewayAddress, commitment, yieldVaults,
|
|
3159
|
+
const { nodeUrl, evmRpcUrls, chain, gatewayAddress, commitment, yieldVaults, logger } = params;
|
|
3160
|
+
const solverAccounts = (Array.isArray(params.solverAccount) ? params.solverAccount : [params.solverAccount]).filter(
|
|
3161
|
+
(a) => typeof a === "string" && a.length > 0
|
|
3162
|
+
);
|
|
2960
3163
|
const extractFill = params.extractFill ?? extractFillData;
|
|
2961
3164
|
const recoverSigner = params.recoverSigner ?? recoverBidSignerViem;
|
|
2962
3165
|
const bidNonceKey = params.bidNonceKey ?? CryptoUtils.bidNonceKey;
|
|
@@ -2964,12 +3167,13 @@ async function runAggregation(params, isDelegated) {
|
|
|
2964
3167
|
const destUrl = evmRpcUrls[chain];
|
|
2965
3168
|
if (!destUrl) return null;
|
|
2966
3169
|
const chainId = evmChainId(chain);
|
|
2967
|
-
if (
|
|
3170
|
+
if (solverAccounts.length === 0 || chainId === null) {
|
|
2968
3171
|
logger?.warn({ chain, commitment }, "Cannot verify phantom bids: no SolverAccount or chain id for chain");
|
|
2969
3172
|
return null;
|
|
2970
3173
|
}
|
|
2971
3174
|
const bids = await fetchBidsForOrder(nodeUrl, commitment);
|
|
2972
3175
|
if (bids.length === 0) return null;
|
|
3176
|
+
const protocolFeeHaircutBps = await readProtocolFeeHaircutBps(destUrl, gatewayAddress);
|
|
2973
3177
|
const v4Contracts = params.uniswapV4?.[chain];
|
|
2974
3178
|
const readPosition = memoizedV4Position(params.keccak ?? keccak256, logger);
|
|
2975
3179
|
const getBalance = params.getBalance ?? memoizedSolverBalance(yieldVaults);
|
|
@@ -2999,7 +3203,7 @@ async function runAggregation(params, isDelegated) {
|
|
|
2999
3203
|
commitment,
|
|
3000
3204
|
sessionKey,
|
|
3001
3205
|
chainId,
|
|
3002
|
-
|
|
3206
|
+
solverAccounts,
|
|
3003
3207
|
evmRpcUrl: destUrl,
|
|
3004
3208
|
recoverSigner,
|
|
3005
3209
|
bidNonceKey,
|
|
@@ -3016,7 +3220,7 @@ async function runAggregation(params, isDelegated) {
|
|
|
3016
3220
|
const declaration = decodePhantomBidDeclaration(decoded.paymasterAndData);
|
|
3017
3221
|
const acceptedSources = declaration.acceptedSources;
|
|
3018
3222
|
const poolPriced = declaration.uniswapV4Positions.length > 0;
|
|
3019
|
-
const applyHaircut = poolPriced ? applyUniswapQuoteHaircut :
|
|
3223
|
+
const applyHaircut = (amount) => poolPriced ? applyUniswapQuoteHaircut(amount) : applyProtocolFeeHaircut(amount, protocolFeeHaircutBps);
|
|
3020
3224
|
const quotedLegs = [...fillData.legs.entries()].map(([legIndex, leg]) => [
|
|
3021
3225
|
legIndex,
|
|
3022
3226
|
{ ...leg, solverAmount: applyHaircut(leg.solverAmount) }
|
|
@@ -3104,6 +3308,6 @@ async function runAggregation(params, isDelegated) {
|
|
|
3104
3308
|
return { legs, lpBalances, positions: verifiedPositions, solvers: [...countedSolvers] };
|
|
3105
3309
|
}
|
|
3106
3310
|
|
|
3107
|
-
export { ENTRY_POINT_V08_ADDRESS, FILL_ORDER_ABI, FILL_ORDER_V1_ABI, IntentGatewayV2_default as IntentGatewayV2,
|
|
3311
|
+
export { ENTRY_POINT_V08_ADDRESS, FILL_ORDER_ABI, FILL_ORDER_V1_ABI, IntentGatewayV2_default as IntentGatewayV2, UNISWAP_QUOTE_HAIRCUT_BPS, aggregatePhantomBids, applyProtocolFeeHaircut, applyUniswapQuoteHaircut, decodeAcceptedSourceChains, decodeERC7821ExecuteBatch, decodePhantomBidDeclaration, decodeUserOpScale, encodeAcceptedSourceChains, encodeERC7821ExecuteBatch, encodePhantomBidDeclaration, encodeUserOpScale, extractFillData, fetchBidsForOrder, getTotalSolverBalance, memoizedSolverBalance, orderCommitmentFromDecoded, poolSlug, positionAmountOfToken, readProtocolFeeHaircutBps, readV4Position, recoverBidSignerViem, setAggregationFetch, sortPoolSymbols, splitBidSignature, weightedMedian, zipFillLegs };
|
|
3108
3312
|
//# sourceMappingURL=intents-helpers.js.map
|
|
3109
3313
|
//# sourceMappingURL=intents-helpers.js.map
|