@hyperbridge/sdk 2.8.10 → 2.8.11

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.
@@ -73,7 +73,7 @@ var ABI2 = [
73
73
  type: "constructor",
74
74
  inputs: [
75
75
  {
76
- name: "admin",
76
+ name: "owner",
77
77
  type: "address",
78
78
  internalType: "address"
79
79
  }
@@ -148,25 +148,6 @@ var ABI2 = [
148
148
  ],
149
149
  stateMutability: "view"
150
150
  },
151
- {
152
- type: "function",
153
- name: "_instances",
154
- inputs: [
155
- {
156
- name: "",
157
- type: "bytes32",
158
- internalType: "bytes32"
159
- }
160
- ],
161
- outputs: [
162
- {
163
- name: "",
164
- type: "address",
165
- internalType: "address"
166
- }
167
- ],
168
- stateMutability: "view"
169
- },
170
151
  {
171
152
  type: "function",
172
153
  name: "_nonce",
@@ -204,6 +185,19 @@ var ABI2 = [
204
185
  ],
205
186
  stateMutability: "view"
206
187
  },
188
+ {
189
+ type: "function",
190
+ name: "_owner",
191
+ inputs: [],
192
+ outputs: [
193
+ {
194
+ name: "",
195
+ type: "address",
196
+ internalType: "address"
197
+ }
198
+ ],
199
+ stateMutability: "view"
200
+ },
207
201
  {
208
202
  type: "function",
209
203
  name: "_partialFills",
@@ -619,6 +613,61 @@ var ABI2 = [
619
613
  ],
620
614
  stateMutability: "view"
621
615
  },
616
+ {
617
+ type: "function",
618
+ name: "initialize",
619
+ inputs: [
620
+ {
621
+ name: "p",
622
+ type: "tuple",
623
+ internalType: "struct Params",
624
+ components: [
625
+ {
626
+ name: "host",
627
+ type: "address",
628
+ internalType: "address"
629
+ },
630
+ {
631
+ name: "dispatcher",
632
+ type: "address",
633
+ internalType: "address"
634
+ },
635
+ {
636
+ name: "solverSelection",
637
+ type: "bool",
638
+ internalType: "bool"
639
+ },
640
+ {
641
+ name: "surplusShareBps",
642
+ type: "uint256",
643
+ internalType: "uint256"
644
+ },
645
+ {
646
+ name: "protocolFeeBps",
647
+ type: "uint256",
648
+ internalType: "uint256"
649
+ },
650
+ {
651
+ name: "priceOracle",
652
+ type: "address",
653
+ internalType: "address"
654
+ }
655
+ ]
656
+ },
657
+ {
658
+ name: "peerChains",
659
+ type: "bytes[]",
660
+ internalType: "bytes[]"
661
+ },
662
+ {
663
+ name: "relayer",
664
+ type: "address",
665
+ internalType: "address"
666
+ }
667
+ ],
668
+ outputs: [],
669
+ stateMutability: "nonpayable"
670
+ },
622
671
  {
623
672
  type: "function",
624
673
  name: "instance",
@@ -638,6 +687,19 @@ var ABI2 = [
638
687
  ],
639
688
  stateMutability: "view"
640
689
  },
690
+ {
691
+ type: "function",
692
+ name: "migrate",
693
+ inputs: [
694
+ {
695
+ name: "relayer",
696
+ type: "address",
697
+ internalType: "address"
698
+ }
699
+ ],
700
+ outputs: [],
701
+ stateMutability: "nonpayable"
702
+ },
641
703
  {
642
704
  type: "function",
643
705
  name: "onAccept",
@@ -1149,7 +1211,7 @@ var ABI2 = [
1149
1211
  internalType: "uint256"
1150
1212
  }
1151
1213
  ],
1152
- stateMutability: "view"
1214
+ stateMutability: "nonpayable"
1153
1215
  },
1154
1216
  {
1155
1217
  type: "function",
@@ -1205,6 +1267,19 @@ var ABI2 = [
1205
1267
  internalType: "uint256"
1206
1268
  }
1207
1269
  ],
1270
+ stateMutability: "nonpayable"
1271
+ },
1272
+ {
1273
+ type: "function",
1274
+ name: "relayer",
1275
+ inputs: [],
1276
+ outputs: [
1277
+ {
1278
+ name: "",
1279
+ type: "address",
1280
+ internalType: "address"
1281
+ }
1282
+ ],
1208
1283
  stateMutability: "view"
1209
1284
  },
1210
1285
  {
@@ -1245,66 +1320,67 @@ var ABI2 = [
1245
1320
  },
1246
1321
  {
1247
1322
  type: "function",
1248
- name: "init",
1323
+ name: "setRelayer",
1249
1324
  inputs: [
1250
1325
  {
1251
- name: "p",
1252
- type: "tuple",
1253
- internalType: "struct Params",
1254
- components: [
1255
- {
1256
- name: "host",
1257
- type: "address",
1258
- internalType: "address"
1259
- },
1260
- {
1261
- name: "dispatcher",
1262
- type: "address",
1263
- internalType: "address"
1264
- },
1265
- {
1266
- name: "solverSelection",
1267
- type: "bool",
1268
- internalType: "bool"
1269
- },
1270
- {
1271
- name: "surplusShareBps",
1272
- type: "uint256",
1273
- internalType: "uint256"
1274
- },
1275
- {
1276
- name: "protocolFeeBps",
1277
- type: "uint256",
1278
- internalType: "uint256"
1279
- },
1280
- {
1281
- name: "priceOracle",
1282
- type: "address",
1283
- internalType: "address"
1284
- }
1285
- ]
1326
+ name: "relayer",
1327
+ type: "address",
1328
+ internalType: "address"
1329
+ }
1330
+ ],
1331
+ outputs: [],
1332
+ stateMutability: "nonpayable"
1333
+ },
1334
+ {
1335
+ type: "function",
1336
+ name: "upgradeToAndCall",
1337
+ inputs: [
1338
+ {
1339
+ name: "newImplementation",
1340
+ type: "address",
1341
+ internalType: "address"
1286
1342
  },
1287
1343
  {
1288
- name: "deployments",
1289
- type: "tuple[]",
1290
- internalType: "struct Deployment[]",
1291
- components: [
1292
- {
1293
- name: "chain",
1294
- type: "bytes",
1295
- internalType: "bytes"
1296
- },
1297
- {
1298
- name: "gateway",
1299
- type: "address",
1300
- internalType: "address"
1301
- }
1302
- ]
1344
+ name: "data",
1345
+ type: "bytes",
1346
+ internalType: "bytes"
1303
1347
  }
1304
1348
  ],
1305
1349
  outputs: [],
1306
1350
  stateMutability: "nonpayable"
1307
1351
  },
1352
+ {
1353
+ type: "function",
1354
+ name: "version",
1355
+ inputs: [],
1356
+ outputs: [
1357
+ {
1358
+ name: "",
1359
+ type: "uint64",
1360
+ internalType: "uint64"
1361
+ }
1362
+ ],
1363
+ stateMutability: "view"
1364
+ },
1365
+ {
1366
+ type: "event",
1367
+ name: "DeploymentAdded",
1368
+ inputs: [
1369
+ {
1370
+ name: "chain",
1371
+ type: "string",
1372
+ indexed: false,
1373
+ internalType: "string"
1374
+ },
1375
+ {
1376
+ name: "gateway",
1377
+ type: "address",
1378
+ indexed: false,
1379
+ internalType: "address"
1380
+ }
1381
+ ],
1382
+ anonymous: false
1383
+ },
1308
1384
  {
1309
1385
  type: "event",
1310
1386
  name: "DestinationProtocolFeeUpdated",
@@ -1438,16 +1514,29 @@ var ABI2 = [
1438
1514
  },
1439
1515
  {
1440
1516
  type: "event",
1441
- name: "DeploymentAdded",
1517
+ name: "Initialized",
1442
1518
  inputs: [
1443
1519
  {
1444
- name: "chain",
1445
- type: "string",
1520
+ name: "version",
1521
+ type: "uint64",
1446
1522
  indexed: false,
1447
- internalType: "string"
1523
+ internalType: "uint64"
1524
+ }
1525
+ ],
1526
+ anonymous: false
1527
+ },
1528
+ {
1529
+ type: "event",
1530
+ name: "OrderCancelled",
1531
+ inputs: [
1532
+ {
1533
+ name: "commitment",
1534
+ type: "bytes32",
1535
+ indexed: true,
1536
+ internalType: "bytes32"
1448
1537
  },
1449
1538
  {
1450
- name: "gateway",
1539
+ name: "canceller",
1451
1540
  type: "address",
1452
1541
  indexed: false,
1453
1542
  internalType: "address"
@@ -1775,14 +1864,52 @@ var ABI2 = [
1775
1864
  ],
1776
1865
  anonymous: false
1777
1866
  },
1867
+ {
1868
+ type: "event",
1869
+ name: "RelayerUpdated",
1870
+ inputs: [
1871
+ {
1872
+ name: "previous",
1873
+ type: "address",
1874
+ indexed: false,
1875
+ internalType: "address"
1876
+ },
1877
+ {
1878
+ name: "current",
1879
+ type: "address",
1880
+ indexed: false,
1881
+ internalType: "address"
1882
+ }
1883
+ ],
1884
+ anonymous: false
1885
+ },
1886
+ {
1887
+ type: "event",
1888
+ name: "Upgraded",
1889
+ inputs: [
1890
+ {
1891
+ name: "implementation",
1892
+ type: "address",
1893
+ indexed: true,
1894
+ internalType: "address"
1895
+ }
1896
+ ],
1897
+ anonymous: false
1898
+ },
1778
1899
  {
1779
1900
  type: "error",
1780
- name: "Cancelled",
1781
- inputs: []
1901
+ name: "AddressEmptyCode",
1902
+ inputs: [
1903
+ {
1904
+ name: "target",
1905
+ type: "address",
1906
+ internalType: "address"
1907
+ }
1908
+ ]
1782
1909
  },
1783
1910
  {
1784
1911
  type: "error",
1785
- name: "UnknownInstance",
1912
+ name: "Cancelled",
1786
1913
  inputs: []
1787
1914
  },
1788
1915
  {
@@ -1812,11 +1939,37 @@ var ABI2 = [
1812
1939
  }
1813
1940
  ]
1814
1941
  },
1942
+ {
1943
+ type: "error",
1944
+ name: "ERC1967InvalidImplementation",
1945
+ inputs: [
1946
+ {
1947
+ name: "implementation",
1948
+ type: "address",
1949
+ internalType: "address"
1950
+ }
1951
+ ]
1952
+ },
1953
+ {
1954
+ type: "error",
1955
+ name: "ERC1967NonPayable",
1956
+ inputs: []
1957
+ },
1815
1958
  {
1816
1959
  type: "error",
1817
1960
  name: "Expired",
1818
1961
  inputs: []
1819
1962
  },
1963
+ {
1964
+ type: "error",
1965
+ name: "FailedCall",
1966
+ inputs: []
1967
+ },
1968
+ {
1969
+ type: "error",
1970
+ name: "FillExpired",
1971
+ inputs: []
1972
+ },
1820
1973
  {
1821
1974
  type: "error",
1822
1975
  name: "Filled",
@@ -1827,6 +1980,11 @@ var ABI2 = [
1827
1980
  name: "InsufficientNativeToken",
1828
1981
  inputs: []
1829
1982
  },
1983
+ {
1984
+ type: "error",
1985
+ name: "InvalidInitialization",
1986
+ inputs: []
1987
+ },
1830
1988
  {
1831
1989
  type: "error",
1832
1990
  name: "InvalidInput",
@@ -1842,6 +2000,21 @@ var ABI2 = [
1842
2000
  name: "NotExpired",
1843
2001
  inputs: []
1844
2002
  },
2003
+ {
2004
+ type: "error",
2005
+ name: "NotInitializing",
2006
+ inputs: []
2007
+ },
2008
+ {
2009
+ type: "error",
2010
+ name: "PartialFillNotAllowed",
2011
+ inputs: []
2012
+ },
2013
+ {
2014
+ type: "error",
2015
+ name: "ReentrancyGuardReentrantCall",
2016
+ inputs: []
2017
+ },
1845
2018
  {
1846
2019
  type: "error",
1847
2020
  name: "SafeERC20FailedOperation",
@@ -1879,6 +2052,11 @@ var ABI2 = [
1879
2052
  name: "UnexpectedCall",
1880
2053
  inputs: []
1881
2054
  },
2055
+ {
2056
+ type: "error",
2057
+ name: "UnknownInstance",
2058
+ inputs: []
2059
+ },
1882
2060
  {
1883
2061
  type: "error",
1884
2062
  name: "UnknownOrder",
@@ -2724,7 +2902,7 @@ var recoverBidSignerViem = async (userOp, entryPoint, chainId, solverSignature)
2724
2902
  }
2725
2903
  };
2726
2904
  var DELEGATION_INDICATOR_PREFIX = "0xef0100";
2727
- async function isDelegatedToSolverAccount(evmRpcUrl, account, solverAccount) {
2905
+ async function isDelegatedToSolverAccount(evmRpcUrl, account, solverAccounts) {
2728
2906
  const response = await rpcCall(evmRpcUrl, {
2729
2907
  id: 1,
2730
2908
  jsonrpc: "2.0",
@@ -2736,15 +2914,17 @@ async function isDelegatedToSolverAccount(evmRpcUrl, account, solverAccount) {
2736
2914
  }
2737
2915
  const code = response.result.toLowerCase();
2738
2916
  if (!code.startsWith(DELEGATION_INDICATOR_PREFIX)) return false;
2739
- return `0x${code.slice(DELEGATION_INDICATOR_PREFIX.length)}` === solverAccount.toLowerCase();
2917
+ const delegate = `0x${code.slice(DELEGATION_INDICATOR_PREFIX.length)}`;
2918
+ return solverAccounts.some((solverAccount) => solverAccount.toLowerCase() === delegate);
2740
2919
  }
2741
2920
  function memoizedDelegationCheck() {
2742
2921
  const cache = /* @__PURE__ */ new Map();
2743
- return (evmRpcUrl, account, solverAccount) => {
2744
- const key = `${evmRpcUrl}|${account.toLowerCase()}|${solverAccount.toLowerCase()}`;
2922
+ return (evmRpcUrl, account, solverAccounts) => {
2923
+ const targets = solverAccounts.map((a) => a.toLowerCase()).sort().join(",");
2924
+ const key = `${evmRpcUrl}|${account.toLowerCase()}|${targets}`;
2745
2925
  let pending = cache.get(key);
2746
2926
  if (!pending) {
2747
- pending = isDelegatedToSolverAccount(evmRpcUrl, account, solverAccount).catch((err) => {
2927
+ pending = isDelegatedToSolverAccount(evmRpcUrl, account, solverAccounts).catch((err) => {
2748
2928
  cache.delete(key);
2749
2929
  throw err;
2750
2930
  });
@@ -2764,7 +2944,7 @@ async function isVerifiedSolverBid(params) {
2764
2944
  commitment,
2765
2945
  sessionKey,
2766
2946
  chainId,
2767
- solverAccount,
2947
+ solverAccounts,
2768
2948
  evmRpcUrl,
2769
2949
  recoverSigner,
2770
2950
  bidNonceKey,
@@ -2793,8 +2973,8 @@ async function isVerifiedSolverBid(params) {
2793
2973
  logger?.warn({ solver, commitment, signer }, "Rejecting phantom bid: signature does not recover to the sender");
2794
2974
  return false;
2795
2975
  }
2796
- if (!await isDelegated(evmRpcUrl, solver, solverAccount)) {
2797
- logger?.warn({ solver, commitment, solverAccount }, "Rejecting phantom bid: sender is not a delegated solver");
2976
+ if (!await isDelegated(evmRpcUrl, solver, solverAccounts)) {
2977
+ logger?.warn({ solver, commitment, solverAccounts }, "Rejecting phantom bid: sender is not a delegated solver");
2798
2978
  return false;
2799
2979
  }
2800
2980
  return true;
@@ -2958,7 +3138,10 @@ async function aggregatePhantomBids(params) {
2958
3138
  }
2959
3139
  var AGGREGATION_ATTEMPTS = 5;
2960
3140
  async function runAggregation(params, isDelegated) {
2961
- const { nodeUrl, evmRpcUrls, chain, gatewayAddress, commitment, yieldVaults, solverAccount, logger } = params;
3141
+ const { nodeUrl, evmRpcUrls, chain, gatewayAddress, commitment, yieldVaults, logger } = params;
3142
+ const solverAccounts = (Array.isArray(params.solverAccount) ? params.solverAccount : [params.solverAccount]).filter(
3143
+ (a) => typeof a === "string" && a.length > 0
3144
+ );
2962
3145
  const extractFill = params.extractFill ?? extractFillData;
2963
3146
  const recoverSigner = params.recoverSigner ?? recoverBidSignerViem;
2964
3147
  const bidNonceKey = params.bidNonceKey ?? CryptoUtils.bidNonceKey;
@@ -2966,7 +3149,7 @@ async function runAggregation(params, isDelegated) {
2966
3149
  const destUrl = evmRpcUrls[chain];
2967
3150
  if (!destUrl) return null;
2968
3151
  const chainId = evmChainId(chain);
2969
- if (!solverAccount || chainId === null) {
3152
+ if (solverAccounts.length === 0 || chainId === null) {
2970
3153
  logger?.warn({ chain, commitment }, "Cannot verify phantom bids: no SolverAccount or chain id for chain");
2971
3154
  return null;
2972
3155
  }
@@ -3001,7 +3184,7 @@ async function runAggregation(params, isDelegated) {
3001
3184
  commitment,
3002
3185
  sessionKey,
3003
3186
  chainId,
3004
- solverAccount,
3187
+ solverAccounts,
3005
3188
  evmRpcUrl: destUrl,
3006
3189
  recoverSigner,
3007
3190
  bidNonceKey,