@indexing/jiti 0.1.14 → 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/main.js CHANGED
@@ -144,6 +144,8 @@ $parcel$export(module.exports, "createPostgresCacheStorage", () => (parcelRequir
144
144
  $parcel$export(module.exports, "lookupJettonWallet", () => $b2a2726ff5c26695$export$77ffdf974cb300ec);
145
145
  $parcel$export(module.exports, "resolveJettonWalletData", () => $b2a2726ff5c26695$export$cef9e9799d863462);
146
146
  $parcel$export(module.exports, "TON_JETTON_NAMESPACE", () => $b2a2726ff5c26695$export$a0a0f70252f1386f);
147
+ $parcel$export(module.exports, "setRpcHosts", () => $eb4c6dcc5cce273f$export$7559df4097bd05d7);
148
+ $parcel$export(module.exports, "getRpcHosts", () => $eb4c6dcc5cce273f$export$62908ad6afd56388);
147
149
  var $d7167569386d0d4c$exports = {};
148
150
  var $56acd58307ebf8e6$exports = {};
149
151
 
@@ -1564,6 +1566,20 @@ async function $45fec2af5a17964d$export$59c69e19e33761f6(storage, namespace, key
1564
1566
 
1565
1567
 
1566
1568
 
1569
+ // Per-network RPC host registry. A jiti consumer injects the hosts a resolver should use for a
1570
+ // given chain — e.g. the indexer points the TON jetton resolver at the same hosts oscar uses
1571
+ // (BlockPi/QuickNode from network_connections) so jiti avoids Orbs's per-IP rate limit on the
1572
+ // oscar box. Generic so future resolvers (other chains) reuse it. Empty for a network ⇒ the
1573
+ // resolver falls back to its built-in default (e.g. Orbs discovery for TON).
1574
+ const $eb4c6dcc5cce273f$var$rpcHostsByNetwork = new Map();
1575
+ function $eb4c6dcc5cce273f$export$7559df4097bd05d7(network, hosts) {
1576
+ $eb4c6dcc5cce273f$var$rpcHostsByNetwork.set(network.toUpperCase(), (hosts || []).filter(Boolean));
1577
+ }
1578
+ function $eb4c6dcc5cce273f$export$62908ad6afd56388(network) {
1579
+ return $eb4c6dcc5cce273f$var$rpcHostsByNetwork.get(network.toUpperCase()) ?? [];
1580
+ }
1581
+
1582
+
1567
1583
  const $b2a2726ff5c26695$export$a0a0f70252f1386f = "ton-jetton-wallet";
1568
1584
  const $b2a2726ff5c26695$var$ORBS_MANAGER_URL = "https://ton.access.orbs.network/mngr/nodes";
1569
1585
  const $b2a2726ff5c26695$var$ORBS_REFRESH_MS = 300000;
@@ -1582,7 +1598,14 @@ function $b2a2726ff5c26695$var$shuffled(hosts) {
1582
1598
  }
1583
1599
  return a;
1584
1600
  }
1601
+ // toncenter v2 speaks JSON-RPC at `<host>/jsonRPC`. Orbs hosts already end in it; BlockPi-style
1602
+ // base hosts (…/rpc/<key>) need it appended — mirrors oscar's TON buildUrl.
1603
+ function $b2a2726ff5c26695$var$buildUrl(host) {
1604
+ return host.endsWith("/jsonRPC") ? host : `${host.replace(/\/$/, "")}/jsonRPC`;
1605
+ }
1585
1606
  async function $b2a2726ff5c26695$var$getHosts() {
1607
+ const configured = (0, $eb4c6dcc5cce273f$export$62908ad6afd56388)("TON");
1608
+ if (configured.length) return $b2a2726ff5c26695$var$shuffled(configured).map($b2a2726ff5c26695$var$buildUrl);
1586
1609
  if ($b2a2726ff5c26695$var$orbsHosts.length && Date.now() - $b2a2726ff5c26695$var$orbsRefreshedAt < $b2a2726ff5c26695$var$ORBS_REFRESH_MS) return $b2a2726ff5c26695$var$shuffled($b2a2726ff5c26695$var$orbsHosts);
1587
1610
  try {
1588
1611
  const resp = await fetch($b2a2726ff5c26695$var$ORBS_MANAGER_URL, {
@@ -11950,6 +11973,7 @@ $parcel$exportWildcard($b4b970cc11bce2a5$exports, $4a8e5fd52443a474$exports);
11950
11973
 
11951
11974
  var $lCdWD = parcelRequire("lCdWD");
11952
11975
 
11976
+
11953
11977
  const $882b6d93070905b3$export$eab97d15b1788b8d = {
11954
11978
  ...$d7167569386d0d4c$exports
11955
11979
  };