@indexing/jiti 0.1.13 → 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 +387 -22
- package/dist/main.js.map +1 -1
- package/dist/module.js +379 -21
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +54 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -1
package/dist/module.js
CHANGED
|
@@ -3,10 +3,14 @@ import {sha256 as $hgUW1$sha256, keccak256 as $hgUW1$keccak256, decodeEventLog a
|
|
|
3
3
|
import $hgUW1$tronweb from "tronweb";
|
|
4
4
|
import {decodeTxRaw as $hgUW1$decodeTxRaw, Registry as $hgUW1$Registry} from "@cosmjs/proto-signing";
|
|
5
5
|
import {defaultRegistryTypes as $hgUW1$defaultRegistryTypes} from "@cosmjs/stargate";
|
|
6
|
+
import {Address as $hgUW1$Address, Cell as $hgUW1$Cell} from "@ton/core";
|
|
6
7
|
import $hgUW1$bs58 from "bs58";
|
|
7
|
-
import {Cell as $hgUW1$Cell} from "@ton/core";
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
function $parcel$export(e, n, v, s) {
|
|
11
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
function $parcel$exportWildcard(dest, source) {
|
|
11
15
|
Object.keys(source).forEach(function(key) {
|
|
12
16
|
if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {
|
|
@@ -24,9 +28,106 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
24
28
|
return dest;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
var $parcel$global = globalThis;
|
|
32
|
+
|
|
33
|
+
var $parcel$modules = {};
|
|
34
|
+
var $parcel$inits = {};
|
|
35
|
+
|
|
36
|
+
var parcelRequire = $parcel$global["parcelRequire3fdc"];
|
|
37
|
+
|
|
38
|
+
if (parcelRequire == null) {
|
|
39
|
+
parcelRequire = function(id) {
|
|
40
|
+
if (id in $parcel$modules) {
|
|
41
|
+
return $parcel$modules[id].exports;
|
|
42
|
+
}
|
|
43
|
+
if (id in $parcel$inits) {
|
|
44
|
+
var init = $parcel$inits[id];
|
|
45
|
+
delete $parcel$inits[id];
|
|
46
|
+
var module = {id: id, exports: {}};
|
|
47
|
+
$parcel$modules[id] = module;
|
|
48
|
+
init.call(module.exports, module, module.exports);
|
|
49
|
+
return module.exports;
|
|
50
|
+
}
|
|
51
|
+
var err = new Error("Cannot find module '" + id + "'");
|
|
52
|
+
err.code = 'MODULE_NOT_FOUND';
|
|
53
|
+
throw err;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
parcelRequire.register = function register(id, init) {
|
|
57
|
+
$parcel$inits[id] = init;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
$parcel$global["parcelRequire3fdc"] = parcelRequire;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var parcelRegister = parcelRequire.register;
|
|
64
|
+
parcelRegister("cP1H0", function(module, exports) {
|
|
65
|
+
|
|
66
|
+
$parcel$export(module.exports, "createPostgresCacheStorage", () => createPostgresCacheStorage);
|
|
67
|
+
function createPostgresCacheStorage(opts) {
|
|
68
|
+
const table = (opts.table ?? "jiti_cache").replace(/[^a-zA-Z0-9_]/g, "");
|
|
69
|
+
let pool = opts.pool;
|
|
70
|
+
function getPool() {
|
|
71
|
+
if (!pool) {
|
|
72
|
+
// Obscure the require so jiti's bundler leaves `pg` external (loaded from the consumer).
|
|
73
|
+
const requirePg = eval("require");
|
|
74
|
+
const pg = requirePg("pg");
|
|
75
|
+
pool = new pg.Pool({
|
|
76
|
+
connectionString: opts.connectionUri
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return pool;
|
|
80
|
+
}
|
|
81
|
+
let ready;
|
|
82
|
+
function ensureTable() {
|
|
83
|
+
if (!ready) ready = (async ()=>{
|
|
84
|
+
const p = getPool();
|
|
85
|
+
await p.query(`CREATE TABLE IF NOT EXISTS ${table} (
|
|
86
|
+
namespace text NOT NULL,
|
|
87
|
+
key text NOT NULL,
|
|
88
|
+
value jsonb,
|
|
89
|
+
found boolean NOT NULL DEFAULT true,
|
|
90
|
+
resolved_at timestamptz NOT NULL DEFAULT now(),
|
|
91
|
+
expires_at timestamptz,
|
|
92
|
+
PRIMARY KEY (namespace, key)
|
|
93
|
+
);`);
|
|
94
|
+
await p.query(`CREATE INDEX IF NOT EXISTS ${table}_expires_idx ON ${table} (expires_at) WHERE expires_at IS NOT NULL;`);
|
|
95
|
+
})();
|
|
96
|
+
return ready;
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
async get (namespace, key) {
|
|
100
|
+
await ensureTable();
|
|
101
|
+
const { rows } = await getPool().query(`SELECT value, found, expires_at FROM ${table} WHERE namespace = $1 AND key = $2`, [
|
|
102
|
+
namespace,
|
|
103
|
+
key
|
|
104
|
+
]);
|
|
105
|
+
if (!rows.length) return null;
|
|
106
|
+
const row = rows[0];
|
|
107
|
+
return {
|
|
108
|
+
value: row.value ?? null,
|
|
109
|
+
found: row.found,
|
|
110
|
+
expiresAt: row.expires_at ? new Date(row.expires_at).getTime() : null
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
async set (namespace, key, row) {
|
|
114
|
+
await ensureTable();
|
|
115
|
+
await getPool().query(`INSERT INTO ${table} (namespace, key, value, found, resolved_at, expires_at)
|
|
116
|
+
VALUES ($1, $2, $3::jsonb, $4, now(), $5)
|
|
117
|
+
ON CONFLICT (namespace, key) DO UPDATE
|
|
118
|
+
SET value = EXCLUDED.value, found = EXCLUDED.found, resolved_at = now(), expires_at = EXCLUDED.expires_at`, [
|
|
119
|
+
namespace,
|
|
120
|
+
key,
|
|
121
|
+
row.value === null || row.value === undefined ? null : JSON.stringify(row.value),
|
|
122
|
+
row.found,
|
|
123
|
+
row.expiresAt ? new Date(row.expiresAt).toISOString() : null
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
29
127
|
}
|
|
128
|
+
|
|
129
|
+
});
|
|
130
|
+
|
|
30
131
|
var $fde9406d76ec24a9$exports = {};
|
|
31
132
|
var $82293038337e7b3f$exports = {};
|
|
32
133
|
|
|
@@ -1351,6 +1452,233 @@ const $548ae36ea3681b01$export$d7ac970e8e789607 = {
|
|
|
1351
1452
|
|
|
1352
1453
|
|
|
1353
1454
|
|
|
1455
|
+
// Per-namespace policy registry. Namespaces differ only here: immutable vs TTL
|
|
1456
|
+
// (`ttlSeconds`), and resolve-on-miss vs externally-populated (presence of `resolve`).
|
|
1457
|
+
// jiti registers the namespaces it can resolve itself (e.g. ton-jetton-wallet); a consumer
|
|
1458
|
+
// may register its own (e.g. token-price with no resolver, populated via cacheSet).
|
|
1459
|
+
const $caa0db003a346aa2$var$REGISTRY = new Map();
|
|
1460
|
+
function $caa0db003a346aa2$export$2b845901f37b4099(namespace, policy) {
|
|
1461
|
+
$caa0db003a346aa2$var$REGISTRY.set(namespace, policy);
|
|
1462
|
+
}
|
|
1463
|
+
function $caa0db003a346aa2$export$d23e4dbc7b86eaca(namespace) {
|
|
1464
|
+
return $caa0db003a346aa2$var$REGISTRY.get(namespace) ?? {};
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
// cache-or-lookup core. jiti owns the orchestration — in-process L1, single-flight, negative
|
|
1469
|
+
// caching, TTL/immutability, read-through/write-through — and the per-namespace resolvers.
|
|
1470
|
+
// The consumer injects only durable storage (see createPostgresCacheStorage for a ready-made
|
|
1471
|
+
// Postgres adapter). With no storage available, callers simply don't invoke cacheGet.
|
|
1472
|
+
const $692184cb0ed76c37$var$L1_MAX = 50000;
|
|
1473
|
+
const $692184cb0ed76c37$var$L1 = new Map();
|
|
1474
|
+
function $692184cb0ed76c37$var$l1Get(id) {
|
|
1475
|
+
const e = $692184cb0ed76c37$var$L1.get(id);
|
|
1476
|
+
if (!e) return undefined;
|
|
1477
|
+
if (e.expiresAt !== null && e.expiresAt <= Date.now()) {
|
|
1478
|
+
$692184cb0ed76c37$var$L1.delete(id);
|
|
1479
|
+
return undefined;
|
|
1480
|
+
}
|
|
1481
|
+
$692184cb0ed76c37$var$L1.delete(id);
|
|
1482
|
+
$692184cb0ed76c37$var$L1.set(id, e); // bump recency
|
|
1483
|
+
return e;
|
|
1484
|
+
}
|
|
1485
|
+
function $692184cb0ed76c37$var$l1Set(id, value, expiresAt) {
|
|
1486
|
+
if ($692184cb0ed76c37$var$L1.size >= $692184cb0ed76c37$var$L1_MAX) {
|
|
1487
|
+
const oldest = $692184cb0ed76c37$var$L1.keys().next().value;
|
|
1488
|
+
if (oldest !== undefined) $692184cb0ed76c37$var$L1.delete(oldest);
|
|
1489
|
+
}
|
|
1490
|
+
$692184cb0ed76c37$var$L1.set(id, {
|
|
1491
|
+
value: value,
|
|
1492
|
+
expiresAt: expiresAt
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
const $692184cb0ed76c37$var$inflight = new Map();
|
|
1496
|
+
function $692184cb0ed76c37$var$cacheId(namespace, key) {
|
|
1497
|
+
return `${namespace} ${key}`;
|
|
1498
|
+
}
|
|
1499
|
+
async function $692184cb0ed76c37$export$2aca74ef9665e35d(storage, namespace, key) {
|
|
1500
|
+
const id = $692184cb0ed76c37$var$cacheId(namespace, key);
|
|
1501
|
+
const l1 = $692184cb0ed76c37$var$l1Get(id);
|
|
1502
|
+
if (l1) return l1.value;
|
|
1503
|
+
const existing = $692184cb0ed76c37$var$inflight.get(id);
|
|
1504
|
+
if (existing !== undefined) return existing;
|
|
1505
|
+
const p = (async ()=>{
|
|
1506
|
+
const row = await storage.get(namespace, key);
|
|
1507
|
+
if (row && (row.expiresAt === null || row.expiresAt > Date.now())) {
|
|
1508
|
+
const value = row.found ? row.value : null;
|
|
1509
|
+
$692184cb0ed76c37$var$l1Set(id, value, row.expiresAt);
|
|
1510
|
+
return value;
|
|
1511
|
+
}
|
|
1512
|
+
const policy = (0, $caa0db003a346aa2$export$d23e4dbc7b86eaca)(namespace);
|
|
1513
|
+
if (!policy.resolve) return null; // externally-populated namespace: miss ⇒ null (no write)
|
|
1514
|
+
let resolved = null;
|
|
1515
|
+
try {
|
|
1516
|
+
resolved = await policy.resolve(key);
|
|
1517
|
+
} catch {
|
|
1518
|
+
// Transient resolver failure (e.g. RPC) — do NOT cache so it retries next time.
|
|
1519
|
+
return null;
|
|
1520
|
+
}
|
|
1521
|
+
const found = resolved !== null && resolved !== undefined;
|
|
1522
|
+
const negativeTtl = policy.negativeTtlSeconds ?? 3600;
|
|
1523
|
+
if (!found && negativeTtl === 0) return null; // negative caching disabled for this namespace
|
|
1524
|
+
const ttlSeconds = found ? policy.ttlSeconds : negativeTtl;
|
|
1525
|
+
const expiresAt = ttlSeconds === null || ttlSeconds === undefined ? null : Date.now() + ttlSeconds * 1000;
|
|
1526
|
+
await storage.set(namespace, key, {
|
|
1527
|
+
value: found ? resolved : null,
|
|
1528
|
+
found: found,
|
|
1529
|
+
expiresAt: expiresAt
|
|
1530
|
+
});
|
|
1531
|
+
$692184cb0ed76c37$var$l1Set(id, found ? resolved : null, expiresAt);
|
|
1532
|
+
return found ? resolved : null;
|
|
1533
|
+
})().finally(()=>$692184cb0ed76c37$var$inflight.delete(id));
|
|
1534
|
+
$692184cb0ed76c37$var$inflight.set(id, p);
|
|
1535
|
+
return p;
|
|
1536
|
+
}
|
|
1537
|
+
async function $692184cb0ed76c37$export$59c69e19e33761f6(storage, namespace, key, value, ttlSecondsOverride) {
|
|
1538
|
+
const policy = (0, $caa0db003a346aa2$export$d23e4dbc7b86eaca)(namespace);
|
|
1539
|
+
const ttlSeconds = ttlSecondsOverride !== undefined ? ttlSecondsOverride : policy.ttlSeconds;
|
|
1540
|
+
const expiresAt = ttlSeconds === null || ttlSeconds === undefined ? null : Date.now() + ttlSeconds * 1000;
|
|
1541
|
+
await storage.set(namespace, key, {
|
|
1542
|
+
value: value,
|
|
1543
|
+
found: true,
|
|
1544
|
+
expiresAt: expiresAt
|
|
1545
|
+
});
|
|
1546
|
+
$692184cb0ed76c37$var$l1Set($692184cb0ed76c37$var$cacheId(namespace, key), value, expiresAt);
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
|
|
1550
|
+
|
|
1551
|
+
const $cfe9a1176e32c0c3$export$a0a0f70252f1386f = "ton-jetton-wallet";
|
|
1552
|
+
const $cfe9a1176e32c0c3$var$ORBS_MANAGER_URL = "https://ton.access.orbs.network/mngr/nodes";
|
|
1553
|
+
const $cfe9a1176e32c0c3$var$ORBS_REFRESH_MS = 300000;
|
|
1554
|
+
let $cfe9a1176e32c0c3$var$orbsHosts = [];
|
|
1555
|
+
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
|
+
function $cfe9a1176e32c0c3$var$shuffled(hosts) {
|
|
1565
|
+
const a = [
|
|
1566
|
+
...hosts
|
|
1567
|
+
];
|
|
1568
|
+
for(let i = a.length - 1; i > 0; i--){
|
|
1569
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
1570
|
+
[a[i], a[j]] = [
|
|
1571
|
+
a[j],
|
|
1572
|
+
a[i]
|
|
1573
|
+
];
|
|
1574
|
+
}
|
|
1575
|
+
return a;
|
|
1576
|
+
}
|
|
1577
|
+
// toncenter v2 speaks JSON-RPC at `<host>/jsonRPC`. Orbs hosts already end in it; BlockPi-style
|
|
1578
|
+
// base hosts (…/rpc/<key>) need it appended — mirrors oscar's TON buildUrl.
|
|
1579
|
+
function $cfe9a1176e32c0c3$var$buildUrl(host) {
|
|
1580
|
+
return host.endsWith("/jsonRPC") ? host : `${host.replace(/\/$/, "")}/jsonRPC`;
|
|
1581
|
+
}
|
|
1582
|
+
async function $cfe9a1176e32c0c3$var$getHosts() {
|
|
1583
|
+
if ($cfe9a1176e32c0c3$var$configuredHosts.length) return $cfe9a1176e32c0c3$var$shuffled($cfe9a1176e32c0c3$var$configuredHosts).map($cfe9a1176e32c0c3$var$buildUrl);
|
|
1584
|
+
if ($cfe9a1176e32c0c3$var$orbsHosts.length && Date.now() - $cfe9a1176e32c0c3$var$orbsRefreshedAt < $cfe9a1176e32c0c3$var$ORBS_REFRESH_MS) return $cfe9a1176e32c0c3$var$shuffled($cfe9a1176e32c0c3$var$orbsHosts);
|
|
1585
|
+
try {
|
|
1586
|
+
const resp = await fetch($cfe9a1176e32c0c3$var$ORBS_MANAGER_URL, {
|
|
1587
|
+
signal: AbortSignal.timeout(8000)
|
|
1588
|
+
});
|
|
1589
|
+
const nodes = await resp.json();
|
|
1590
|
+
const healthy = nodes.filter((n)=>n.Healthy === "1" && n.Mngr?.health?.["v2-mainnet"]).map((n)=>`https://ton.access.orbs.network/${n.NodeId}/1/mainnet/toncenter-api-v2/jsonRPC`);
|
|
1591
|
+
if (healthy.length) {
|
|
1592
|
+
$cfe9a1176e32c0c3$var$orbsHosts = healthy;
|
|
1593
|
+
$cfe9a1176e32c0c3$var$orbsRefreshedAt = Date.now();
|
|
1594
|
+
}
|
|
1595
|
+
} catch {
|
|
1596
|
+
// keep prior cached set
|
|
1597
|
+
}
|
|
1598
|
+
return $cfe9a1176e32c0c3$var$shuffled($cfe9a1176e32c0c3$var$orbsHosts);
|
|
1599
|
+
}
|
|
1600
|
+
function $cfe9a1176e32c0c3$export$938b62d04991c792(addr) {
|
|
1601
|
+
try {
|
|
1602
|
+
return (0, $hgUW1$Address).parse(addr).toString({
|
|
1603
|
+
urlSafe: true,
|
|
1604
|
+
bounceable: true,
|
|
1605
|
+
testOnly: false
|
|
1606
|
+
});
|
|
1607
|
+
} catch {
|
|
1608
|
+
return addr;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
function $cfe9a1176e32c0c3$var$parseAddressFromStackEntry(entry) {
|
|
1612
|
+
// toncenter v2 runGetMethod returns slice/cell results as ['cell', { bytes: <base64 BoC> }].
|
|
1613
|
+
const value = entry?.[1];
|
|
1614
|
+
const b64 = typeof value === "string" ? value : value?.bytes;
|
|
1615
|
+
if (!b64) return null;
|
|
1616
|
+
return $cfe9a1176e32c0c3$export$938b62d04991c792((0, $hgUW1$Cell).fromBase64(b64).beginParse().loadAddress().toString());
|
|
1617
|
+
}
|
|
1618
|
+
async function $cfe9a1176e32c0c3$var$runGetMethod(host, address, method, stack) {
|
|
1619
|
+
const resp = await fetch(host, {
|
|
1620
|
+
method: "POST",
|
|
1621
|
+
headers: {
|
|
1622
|
+
"content-type": "application/json"
|
|
1623
|
+
},
|
|
1624
|
+
body: JSON.stringify({
|
|
1625
|
+
jsonrpc: "2.0",
|
|
1626
|
+
id: 1,
|
|
1627
|
+
method: "runGetMethod",
|
|
1628
|
+
params: {
|
|
1629
|
+
address: address,
|
|
1630
|
+
method: method,
|
|
1631
|
+
stack: stack
|
|
1632
|
+
}
|
|
1633
|
+
}),
|
|
1634
|
+
signal: AbortSignal.timeout(15000)
|
|
1635
|
+
});
|
|
1636
|
+
const json = await resp.json();
|
|
1637
|
+
if (!json.ok || !json.result) throw new Error(`TON runGetMethod ${method} error: ${json.error || "unknown"}`);
|
|
1638
|
+
return {
|
|
1639
|
+
exitCode: json.result.exit_code,
|
|
1640
|
+
stack: json.result.stack
|
|
1641
|
+
};
|
|
1642
|
+
}
|
|
1643
|
+
async function $cfe9a1176e32c0c3$export$cef9e9799d863462(wallet) {
|
|
1644
|
+
const hosts = await $cfe9a1176e32c0c3$var$getHosts();
|
|
1645
|
+
if (!hosts.length) throw new Error("TON: no Orbs hosts available for get_wallet_data");
|
|
1646
|
+
let sawDefiniteMiss = false;
|
|
1647
|
+
let lastErr;
|
|
1648
|
+
for(let attempt = 0; attempt < 2; attempt++){
|
|
1649
|
+
for (const host of hosts)try {
|
|
1650
|
+
const { exitCode: exitCode, stack: stack } = await $cfe9a1176e32c0c3$var$runGetMethod(host, wallet, "get_wallet_data", []);
|
|
1651
|
+
if (exitCode !== 0) {
|
|
1652
|
+
sawDefiniteMiss = true; // no get_wallet_data → not a jetton wallet
|
|
1653
|
+
continue;
|
|
1654
|
+
}
|
|
1655
|
+
const owner = $cfe9a1176e32c0c3$var$parseAddressFromStackEntry(stack[1]);
|
|
1656
|
+
const master = $cfe9a1176e32c0c3$var$parseAddressFromStackEntry(stack[2]);
|
|
1657
|
+
if (owner && master) return {
|
|
1658
|
+
owner: owner,
|
|
1659
|
+
master: master
|
|
1660
|
+
};
|
|
1661
|
+
sawDefiniteMiss = true;
|
|
1662
|
+
} catch (e) {
|
|
1663
|
+
lastErr = e;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
if (sawDefiniteMiss) return null; // definitive: not a jetton wallet → negative-cache
|
|
1667
|
+
throw new Error(`TON: get_wallet_data failed for ${wallet}: ${lastErr?.message}`); // transient → don't cache
|
|
1668
|
+
}
|
|
1669
|
+
async function $cfe9a1176e32c0c3$export$77ffdf974cb300ec(storage, wallet) {
|
|
1670
|
+
return await (0, $692184cb0ed76c37$export$2aca74ef9665e35d)(storage, $cfe9a1176e32c0c3$export$a0a0f70252f1386f, $cfe9a1176e32c0c3$export$938b62d04991c792(wallet));
|
|
1671
|
+
}
|
|
1672
|
+
// Register on import: immutable mapping, resolve-on-miss via get_wallet_data; non-jetton
|
|
1673
|
+
// accounts negative-cached for a day.
|
|
1674
|
+
(0, $caa0db003a346aa2$export$2b845901f37b4099)($cfe9a1176e32c0c3$export$a0a0f70252f1386f, {
|
|
1675
|
+
resolve: (key)=>$cfe9a1176e32c0c3$export$cef9e9799d863462(key),
|
|
1676
|
+
ttlSeconds: null,
|
|
1677
|
+
negativeTtlSeconds: 86400
|
|
1678
|
+
});
|
|
1679
|
+
|
|
1680
|
+
|
|
1681
|
+
|
|
1354
1682
|
const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
|
|
1355
1683
|
match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "RIPPLE",
|
|
1356
1684
|
transform (block) {
|
|
@@ -3766,6 +4094,27 @@ const $0ab1acc1eff391f6$var$UNIVERSAL_SUB_TEMPLATES = [
|
|
|
3766
4094
|
(0, $8d6646508fb2fa58$export$b5fd4920e8b7d913),
|
|
3767
4095
|
(0, $5ec62a2088d070a8$export$5beebc5708fabf3c)
|
|
3768
4096
|
];
|
|
4097
|
+
// Drops zero-amount + duplicate transfers and applies the optional contractAddress /
|
|
4098
|
+
// walletAddress / transactionHash param filters. Runs AFTER any jetton enrichment so the
|
|
4099
|
+
// filters see the resolved owner/master.
|
|
4100
|
+
function $0ab1acc1eff391f6$var$applyTransferFilters(transfers, _ctx) {
|
|
4101
|
+
const seenTransfers = new Set();
|
|
4102
|
+
return transfers.filter((txfer)=>{
|
|
4103
|
+
if (txfer.amount <= BigInt(0)) return false;
|
|
4104
|
+
if (_ctx?.params) {
|
|
4105
|
+
if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token) return false;
|
|
4106
|
+
if (_ctx.params.walletAddress && ![
|
|
4107
|
+
txfer.from,
|
|
4108
|
+
txfer.to
|
|
4109
|
+
].includes(_ctx.params.walletAddress)) return false;
|
|
4110
|
+
if (_ctx.params.transactionHash && txfer.transactionHash !== _ctx.params.transactionHash) return false;
|
|
4111
|
+
}
|
|
4112
|
+
const key = `${txfer.transactionHash}-${txfer.from}-${txfer.to}-${txfer.amount}-${txfer.token}-${txfer.index}`;
|
|
4113
|
+
if (seenTransfers.has(key)) return false;
|
|
4114
|
+
seenTransfers.add(key);
|
|
4115
|
+
return true;
|
|
4116
|
+
});
|
|
4117
|
+
}
|
|
3769
4118
|
const $0ab1acc1eff391f6$var$tokenTransfersTemplate = {
|
|
3770
4119
|
key: "token_transfers",
|
|
3771
4120
|
name: "Token Transfers",
|
|
@@ -3818,23 +4167,27 @@ const $0ab1acc1eff391f6$var$tokenTransfersTemplate = {
|
|
|
3818
4167
|
transfers = sub.transform(block, _ctx);
|
|
3819
4168
|
break;
|
|
3820
4169
|
}
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
4170
|
+
// Optional enrichment for account-model token transfers (TON jettons) where the block
|
|
4171
|
+
// only carries the token-WALLET address and no master: they come out as
|
|
4172
|
+
// `tokenType: 'TOKEN'`, `to` = wallet, `token` = undefined. When the caller injects a
|
|
4173
|
+
// `_ctx.cacheStorage` (durable cache), jiti resolves the wallet → { owner, master } via
|
|
4174
|
+
// its own cache+RPC and rewrites `to`/`token` BEFORE filtering, so contractAddress /
|
|
4175
|
+
// walletAddress filters match the real owner + master. jiti owns the cache + resolver
|
|
4176
|
+
// (get_wallet_data over Orbs); the consumer injects only storage. Async only when storage
|
|
4177
|
+
// is provided; the sync path is unchanged for every existing caller.
|
|
4178
|
+
const cacheStorage = _ctx?.cacheStorage;
|
|
4179
|
+
if (cacheStorage) return (async ()=>{
|
|
4180
|
+
await Promise.all(transfers.map(async (txfer)=>{
|
|
4181
|
+
if (txfer.tokenType !== "TOKEN" || txfer.token || !txfer.to) return;
|
|
4182
|
+
const info = await (0, $cfe9a1176e32c0c3$export$77ffdf974cb300ec)(cacheStorage, txfer.to);
|
|
4183
|
+
if (info) {
|
|
4184
|
+
txfer.to = info.owner;
|
|
4185
|
+
txfer.token = info.master;
|
|
4186
|
+
}
|
|
4187
|
+
}));
|
|
4188
|
+
return $0ab1acc1eff391f6$var$applyTransferFilters(transfers, _ctx);
|
|
4189
|
+
})();
|
|
4190
|
+
return $0ab1acc1eff391f6$var$applyTransferFilters(transfers, _ctx);
|
|
3838
4191
|
},
|
|
3839
4192
|
tests: $0ab1acc1eff391f6$var$SUB_TEMPLATES.concat($0ab1acc1eff391f6$var$UNIVERSAL_SUB_TEMPLATES).map((v)=>v.tests).flat()
|
|
3840
4193
|
};
|
|
@@ -11591,6 +11944,10 @@ $parcel$exportWildcard($a4e0e4b4a62175c4$exports, $f3761421850600fb$exports);
|
|
|
11591
11944
|
$parcel$exportWildcard($a4e0e4b4a62175c4$exports, $e64a550a52a9d690$exports);
|
|
11592
11945
|
|
|
11593
11946
|
|
|
11947
|
+
|
|
11948
|
+
|
|
11949
|
+
var $cP1H0 = parcelRequire("cP1H0");
|
|
11950
|
+
|
|
11594
11951
|
const $149c1bd638913645$export$eab97d15b1788b8d = {
|
|
11595
11952
|
...$fde9406d76ec24a9$exports
|
|
11596
11953
|
};
|
|
@@ -11605,5 +11962,6 @@ function $149c1bd638913645$export$a07bfd14bbc36e4b(key) {
|
|
|
11605
11962
|
}
|
|
11606
11963
|
|
|
11607
11964
|
|
|
11608
|
-
|
|
11965
|
+
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};
|
|
11609
11967
|
//# sourceMappingURL=module.js.map
|