@indexing/jiti 0.1.14 → 0.1.15

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/main.js CHANGED
@@ -143,6 +143,7 @@ $parcel$export(module.exports, "registerCacheNamespace", () => $226820b1648da9ad
143
143
  $parcel$export(module.exports, "createPostgresCacheStorage", () => (parcelRequire("lCdWD")).createPostgresCacheStorage);
144
144
  $parcel$export(module.exports, "lookupJettonWallet", () => $b2a2726ff5c26695$export$77ffdf974cb300ec);
145
145
  $parcel$export(module.exports, "resolveJettonWalletData", () => $b2a2726ff5c26695$export$cef9e9799d863462);
146
+ $parcel$export(module.exports, "setTonRpcHosts", () => $b2a2726ff5c26695$export$c9db54a59e1b6652);
146
147
  $parcel$export(module.exports, "TON_JETTON_NAMESPACE", () => $b2a2726ff5c26695$export$a0a0f70252f1386f);
147
148
  var $d7167569386d0d4c$exports = {};
148
149
  var $56acd58307ebf8e6$exports = {};
@@ -1569,6 +1570,14 @@ const $b2a2726ff5c26695$var$ORBS_MANAGER_URL = "https://ton.access.orbs.network/
1569
1570
  const $b2a2726ff5c26695$var$ORBS_REFRESH_MS = 300000;
1570
1571
  let $b2a2726ff5c26695$var$orbsHosts = [];
1571
1572
  let $b2a2726ff5c26695$var$orbsRefreshedAt = 0;
1573
+ // Consumer-injected TON RPC hosts (toncenter v2 jsonRPC-compatible base hosts). When set, the
1574
+ // resolver uses THESE instead of Orbs discovery — e.g. the indexer injects oscar's configured
1575
+ // TON hosts (BlockPi/QuickNode from network_connections) so jiti hits the same hosts oscar uses
1576
+ // and avoids Orbs's per-IP rate limit on the oscar box. Empty ⇒ fall back to Orbs discovery.
1577
+ let $b2a2726ff5c26695$var$configuredHosts = [];
1578
+ function $b2a2726ff5c26695$export$c9db54a59e1b6652(hosts) {
1579
+ $b2a2726ff5c26695$var$configuredHosts = (hosts || []).filter(Boolean);
1580
+ }
1572
1581
  function $b2a2726ff5c26695$var$shuffled(hosts) {
1573
1582
  const a = [
1574
1583
  ...hosts
@@ -1582,7 +1591,13 @@ function $b2a2726ff5c26695$var$shuffled(hosts) {
1582
1591
  }
1583
1592
  return a;
1584
1593
  }
1594
+ // toncenter v2 speaks JSON-RPC at `<host>/jsonRPC`. Orbs hosts already end in it; BlockPi-style
1595
+ // base hosts (…/rpc/<key>) need it appended — mirrors oscar's TON buildUrl.
1596
+ function $b2a2726ff5c26695$var$buildUrl(host) {
1597
+ return host.endsWith("/jsonRPC") ? host : `${host.replace(/\/$/, "")}/jsonRPC`;
1598
+ }
1585
1599
  async function $b2a2726ff5c26695$var$getHosts() {
1600
+ if ($b2a2726ff5c26695$var$configuredHosts.length) return $b2a2726ff5c26695$var$shuffled($b2a2726ff5c26695$var$configuredHosts).map($b2a2726ff5c26695$var$buildUrl);
1586
1601
  if ($b2a2726ff5c26695$var$orbsHosts.length && Date.now() - $b2a2726ff5c26695$var$orbsRefreshedAt < $b2a2726ff5c26695$var$ORBS_REFRESH_MS) return $b2a2726ff5c26695$var$shuffled($b2a2726ff5c26695$var$orbsHosts);
1587
1602
  try {
1588
1603
  const resp = await fetch($b2a2726ff5c26695$var$ORBS_MANAGER_URL, {