@indexing/jiti 0.1.15 → 0.1.16

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/module.js CHANGED
@@ -1548,19 +1548,25 @@ async function $692184cb0ed76c37$export$59c69e19e33761f6(storage, namespace, key
1548
1548
 
1549
1549
 
1550
1550
 
1551
+ // Per-network RPC host registry. A jiti consumer injects the hosts a resolver should use for a
1552
+ // given chain — e.g. the indexer points the TON jetton resolver at the same hosts oscar uses
1553
+ // (BlockPi/QuickNode from network_connections) so jiti avoids Orbs's per-IP rate limit on the
1554
+ // oscar box. Generic so future resolvers (other chains) reuse it. Empty for a network ⇒ the
1555
+ // resolver falls back to its built-in default (e.g. Orbs discovery for TON).
1556
+ const $fd51662490d4092f$var$rpcHostsByNetwork = new Map();
1557
+ function $fd51662490d4092f$export$7559df4097bd05d7(network, hosts) {
1558
+ $fd51662490d4092f$var$rpcHostsByNetwork.set(network.toUpperCase(), (hosts || []).filter(Boolean));
1559
+ }
1560
+ function $fd51662490d4092f$export$62908ad6afd56388(network) {
1561
+ return $fd51662490d4092f$var$rpcHostsByNetwork.get(network.toUpperCase()) ?? [];
1562
+ }
1563
+
1564
+
1551
1565
  const $cfe9a1176e32c0c3$export$a0a0f70252f1386f = "ton-jetton-wallet";
1552
1566
  const $cfe9a1176e32c0c3$var$ORBS_MANAGER_URL = "https://ton.access.orbs.network/mngr/nodes";
1553
1567
  const $cfe9a1176e32c0c3$var$ORBS_REFRESH_MS = 300000;
1554
1568
  let $cfe9a1176e32c0c3$var$orbsHosts = [];
1555
1569
  let $cfe9a1176e32c0c3$var$orbsRefreshedAt = 0;
1556
- // Consumer-injected TON RPC hosts (toncenter v2 jsonRPC-compatible base hosts). When set, the
1557
- // resolver uses THESE instead of Orbs discovery — e.g. the indexer injects oscar's configured
1558
- // TON hosts (BlockPi/QuickNode from network_connections) so jiti hits the same hosts oscar uses
1559
- // and avoids Orbs's per-IP rate limit on the oscar box. Empty ⇒ fall back to Orbs discovery.
1560
- let $cfe9a1176e32c0c3$var$configuredHosts = [];
1561
- function $cfe9a1176e32c0c3$export$c9db54a59e1b6652(hosts) {
1562
- $cfe9a1176e32c0c3$var$configuredHosts = (hosts || []).filter(Boolean);
1563
- }
1564
1570
  function $cfe9a1176e32c0c3$var$shuffled(hosts) {
1565
1571
  const a = [
1566
1572
  ...hosts
@@ -1580,7 +1586,8 @@ function $cfe9a1176e32c0c3$var$buildUrl(host) {
1580
1586
  return host.endsWith("/jsonRPC") ? host : `${host.replace(/\/$/, "")}/jsonRPC`;
1581
1587
  }
1582
1588
  async function $cfe9a1176e32c0c3$var$getHosts() {
1583
- if ($cfe9a1176e32c0c3$var$configuredHosts.length) return $cfe9a1176e32c0c3$var$shuffled($cfe9a1176e32c0c3$var$configuredHosts).map($cfe9a1176e32c0c3$var$buildUrl);
1589
+ const configured = (0, $fd51662490d4092f$export$62908ad6afd56388)("TON");
1590
+ if (configured.length) return $cfe9a1176e32c0c3$var$shuffled(configured).map($cfe9a1176e32c0c3$var$buildUrl);
1584
1591
  if ($cfe9a1176e32c0c3$var$orbsHosts.length && Date.now() - $cfe9a1176e32c0c3$var$orbsRefreshedAt < $cfe9a1176e32c0c3$var$ORBS_REFRESH_MS) return $cfe9a1176e32c0c3$var$shuffled($cfe9a1176e32c0c3$var$orbsHosts);
1585
1592
  try {
1586
1593
  const resp = await fetch($cfe9a1176e32c0c3$var$ORBS_MANAGER_URL, {
@@ -11948,6 +11955,7 @@ $parcel$exportWildcard($a4e0e4b4a62175c4$exports, $e64a550a52a9d690$exports);
11948
11955
 
11949
11956
  var $cP1H0 = parcelRequire("cP1H0");
11950
11957
 
11958
+
11951
11959
  const $149c1bd638913645$export$eab97d15b1788b8d = {
11952
11960
  ...$fde9406d76ec24a9$exports
11953
11961
  };
@@ -11963,5 +11971,5 @@ function $149c1bd638913645$export$a07bfd14bbc36e4b(key) {
11963
11971
 
11964
11972
 
11965
11973
  var createPostgresCacheStorage = parcelRequire("cP1H0").createPostgresCacheStorage;
11966
- export {$149c1bd638913645$export$eab97d15b1788b8d as utils, $149c1bd638913645$export$a8fc3402335b0b04 as templates, $149c1bd638913645$export$cceb5167b935aafb as getAllTemplates, $149c1bd638913645$export$a07bfd14bbc36e4b as getTemplateByKey, $692184cb0ed76c37$export$2aca74ef9665e35d as cacheGet, $692184cb0ed76c37$export$59c69e19e33761f6 as cacheSet, $caa0db003a346aa2$export$2b845901f37b4099 as registerCacheNamespace, createPostgresCacheStorage as createPostgresCacheStorage, $cfe9a1176e32c0c3$export$77ffdf974cb300ec as lookupJettonWallet, $cfe9a1176e32c0c3$export$cef9e9799d863462 as resolveJettonWalletData, $cfe9a1176e32c0c3$export$c9db54a59e1b6652 as setTonRpcHosts, $cfe9a1176e32c0c3$export$a0a0f70252f1386f as TON_JETTON_NAMESPACE};
11974
+ export {$149c1bd638913645$export$eab97d15b1788b8d as utils, $149c1bd638913645$export$a8fc3402335b0b04 as templates, $149c1bd638913645$export$cceb5167b935aafb as getAllTemplates, $149c1bd638913645$export$a07bfd14bbc36e4b as getTemplateByKey, $692184cb0ed76c37$export$2aca74ef9665e35d as cacheGet, $692184cb0ed76c37$export$59c69e19e33761f6 as cacheSet, $caa0db003a346aa2$export$2b845901f37b4099 as registerCacheNamespace, createPostgresCacheStorage as createPostgresCacheStorage, $cfe9a1176e32c0c3$export$77ffdf974cb300ec as lookupJettonWallet, $cfe9a1176e32c0c3$export$cef9e9799d863462 as resolveJettonWalletData, $cfe9a1176e32c0c3$export$a0a0f70252f1386f as TON_JETTON_NAMESPACE, $fd51662490d4092f$export$7559df4097bd05d7 as setRpcHosts, $fd51662490d4092f$export$62908ad6afd56388 as getRpcHosts};
11967
11975
  //# sourceMappingURL=module.js.map