@uniswap/token-list-bridge-utils 2.6.0 → 2.8.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.
@@ -1296,7 +1296,7 @@ var ArbitrumMappingProvider = /*#__PURE__*/function () {
1296
1296
 
1297
1297
  _proto.provide = /*#__PURE__*/function () {
1298
1298
  var _provide = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
1299
- var tokens, _yield$getNetworkConf, l1, l2, tokenAddresses, l2AddressesFromL1;
1299
+ var tokens, _yield$getNetworkConf, l1, l2, tokenAddresses, batchSize, batches, i, batch, batchResults, filteredResults;
1300
1300
 
1301
1301
  return _regeneratorRuntime.wrap(function _callee$(_context) {
1302
1302
  while (1) {
@@ -1312,20 +1312,43 @@ var ArbitrumMappingProvider = /*#__PURE__*/function () {
1312
1312
  l2 = _yield$getNetworkConf.l2;
1313
1313
  tokenAddresses = this.l1TokenList.tokens.map(function (token) {
1314
1314
  return token.address.toLowerCase();
1315
+ }); // batching calls to avoid rpc response size limits
1316
+
1317
+ batchSize = 100;
1318
+ batches = [];
1319
+ i = 0;
1320
+
1321
+ case 10:
1322
+ if (!(i < tokenAddresses.length)) {
1323
+ _context.next = 20;
1324
+ break;
1325
+ }
1326
+
1327
+ batch = tokenAddresses.slice(i, i + batchSize);
1328
+ _context.next = 14;
1329
+ return getL2TokenAddressesFromL1(batch, l1.multiCaller, l2.network.tokenBridge.l1GatewayRouter);
1330
+
1331
+ case 14:
1332
+ batchResults = _context.sent;
1333
+ filteredResults = batchResults.filter(function (addr) {
1334
+ return addr !== undefined;
1315
1335
  });
1316
- _context.next = 9;
1317
- return getL2TokenAddressesFromL1(tokenAddresses, l1.multiCaller, l2.network.tokenBridge.l1GatewayRouter);
1336
+ batches.push.apply(batches, filteredResults);
1318
1337
 
1319
- case 9:
1320
- l2AddressesFromL1 = _context.sent;
1338
+ case 17:
1339
+ i += batchSize;
1340
+ _context.next = 10;
1341
+ break;
1342
+
1343
+ case 20:
1321
1344
  tokens = tokenAddresses.reduce(function (obj, key, index) {
1322
1345
  var _extends2;
1323
1346
 
1324
- return _extends({}, obj, (_extends2 = {}, _extends2[key] = l2AddressesFromL1[index], _extends2));
1347
+ return _extends({}, obj, (_extends2 = {}, _extends2[key] = batches[index], _extends2));
1325
1348
  }, {});
1326
1349
  return _context.abrupt("return", tokens);
1327
1350
 
1328
- case 12:
1351
+ case 22:
1329
1352
  case "end":
1330
1353
  return _context.stop();
1331
1354
  }
@@ -6075,10 +6098,6 @@ var unichainMappings = {
6075
6098
  "0x594daad7d77592a2b97b725a7ad59d7e188b5bfa": {
6076
6099
  childToken: "0xcdfce5eb357e8976a80be84e94a03ba963b9e379",
6077
6100
  decimals: 18
6078
- },
6079
- "0x58d97b57bb95320f9a05dc918aef65434969c2b2": {
6080
- childToken: "0x6695a2692dcd2a53e7766492447b5254a56425ad",
6081
- decimals: 18
6082
6101
  },
6083
6102
  "0x8df723295214ea6f21026eeeb4382d475f146f9f": {
6084
6103
  childToken: "0xec42461d9bbdf4efb6481099253bbb7324d7d72d",