@indexing/jiti 0.1.13 → 0.1.14
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 +372 -22
- package/dist/main.js.map +1 -1
- package/dist/module.js +365 -21
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +53 -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;
|
|
29
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
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
});
|
|
130
|
+
|
|
30
131
|
var $fde9406d76ec24a9$exports = {};
|
|
31
132
|
var $82293038337e7b3f$exports = {};
|
|
32
133
|
|
|
@@ -1351,6 +1452,219 @@ 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
|
+
function $cfe9a1176e32c0c3$var$shuffled(hosts) {
|
|
1557
|
+
const a = [
|
|
1558
|
+
...hosts
|
|
1559
|
+
];
|
|
1560
|
+
for(let i = a.length - 1; i > 0; i--){
|
|
1561
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
1562
|
+
[a[i], a[j]] = [
|
|
1563
|
+
a[j],
|
|
1564
|
+
a[i]
|
|
1565
|
+
];
|
|
1566
|
+
}
|
|
1567
|
+
return a;
|
|
1568
|
+
}
|
|
1569
|
+
async function $cfe9a1176e32c0c3$var$getHosts() {
|
|
1570
|
+
if ($cfe9a1176e32c0c3$var$orbsHosts.length && Date.now() - $cfe9a1176e32c0c3$var$orbsRefreshedAt < $cfe9a1176e32c0c3$var$ORBS_REFRESH_MS) return $cfe9a1176e32c0c3$var$shuffled($cfe9a1176e32c0c3$var$orbsHosts);
|
|
1571
|
+
try {
|
|
1572
|
+
const resp = await fetch($cfe9a1176e32c0c3$var$ORBS_MANAGER_URL, {
|
|
1573
|
+
signal: AbortSignal.timeout(8000)
|
|
1574
|
+
});
|
|
1575
|
+
const nodes = await resp.json();
|
|
1576
|
+
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`);
|
|
1577
|
+
if (healthy.length) {
|
|
1578
|
+
$cfe9a1176e32c0c3$var$orbsHosts = healthy;
|
|
1579
|
+
$cfe9a1176e32c0c3$var$orbsRefreshedAt = Date.now();
|
|
1580
|
+
}
|
|
1581
|
+
} catch {
|
|
1582
|
+
// keep prior cached set
|
|
1583
|
+
}
|
|
1584
|
+
return $cfe9a1176e32c0c3$var$shuffled($cfe9a1176e32c0c3$var$orbsHosts);
|
|
1585
|
+
}
|
|
1586
|
+
function $cfe9a1176e32c0c3$export$938b62d04991c792(addr) {
|
|
1587
|
+
try {
|
|
1588
|
+
return (0, $hgUW1$Address).parse(addr).toString({
|
|
1589
|
+
urlSafe: true,
|
|
1590
|
+
bounceable: true,
|
|
1591
|
+
testOnly: false
|
|
1592
|
+
});
|
|
1593
|
+
} catch {
|
|
1594
|
+
return addr;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
function $cfe9a1176e32c0c3$var$parseAddressFromStackEntry(entry) {
|
|
1598
|
+
// toncenter v2 runGetMethod returns slice/cell results as ['cell', { bytes: <base64 BoC> }].
|
|
1599
|
+
const value = entry?.[1];
|
|
1600
|
+
const b64 = typeof value === "string" ? value : value?.bytes;
|
|
1601
|
+
if (!b64) return null;
|
|
1602
|
+
return $cfe9a1176e32c0c3$export$938b62d04991c792((0, $hgUW1$Cell).fromBase64(b64).beginParse().loadAddress().toString());
|
|
1603
|
+
}
|
|
1604
|
+
async function $cfe9a1176e32c0c3$var$runGetMethod(host, address, method, stack) {
|
|
1605
|
+
const resp = await fetch(host, {
|
|
1606
|
+
method: "POST",
|
|
1607
|
+
headers: {
|
|
1608
|
+
"content-type": "application/json"
|
|
1609
|
+
},
|
|
1610
|
+
body: JSON.stringify({
|
|
1611
|
+
jsonrpc: "2.0",
|
|
1612
|
+
id: 1,
|
|
1613
|
+
method: "runGetMethod",
|
|
1614
|
+
params: {
|
|
1615
|
+
address: address,
|
|
1616
|
+
method: method,
|
|
1617
|
+
stack: stack
|
|
1618
|
+
}
|
|
1619
|
+
}),
|
|
1620
|
+
signal: AbortSignal.timeout(15000)
|
|
1621
|
+
});
|
|
1622
|
+
const json = await resp.json();
|
|
1623
|
+
if (!json.ok || !json.result) throw new Error(`TON runGetMethod ${method} error: ${json.error || "unknown"}`);
|
|
1624
|
+
return {
|
|
1625
|
+
exitCode: json.result.exit_code,
|
|
1626
|
+
stack: json.result.stack
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
async function $cfe9a1176e32c0c3$export$cef9e9799d863462(wallet) {
|
|
1630
|
+
const hosts = await $cfe9a1176e32c0c3$var$getHosts();
|
|
1631
|
+
if (!hosts.length) throw new Error("TON: no Orbs hosts available for get_wallet_data");
|
|
1632
|
+
let sawDefiniteMiss = false;
|
|
1633
|
+
let lastErr;
|
|
1634
|
+
for(let attempt = 0; attempt < 2; attempt++){
|
|
1635
|
+
for (const host of hosts)try {
|
|
1636
|
+
const { exitCode: exitCode, stack: stack } = await $cfe9a1176e32c0c3$var$runGetMethod(host, wallet, "get_wallet_data", []);
|
|
1637
|
+
if (exitCode !== 0) {
|
|
1638
|
+
sawDefiniteMiss = true; // no get_wallet_data → not a jetton wallet
|
|
1639
|
+
continue;
|
|
1640
|
+
}
|
|
1641
|
+
const owner = $cfe9a1176e32c0c3$var$parseAddressFromStackEntry(stack[1]);
|
|
1642
|
+
const master = $cfe9a1176e32c0c3$var$parseAddressFromStackEntry(stack[2]);
|
|
1643
|
+
if (owner && master) return {
|
|
1644
|
+
owner: owner,
|
|
1645
|
+
master: master
|
|
1646
|
+
};
|
|
1647
|
+
sawDefiniteMiss = true;
|
|
1648
|
+
} catch (e) {
|
|
1649
|
+
lastErr = e;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
if (sawDefiniteMiss) return null; // definitive: not a jetton wallet → negative-cache
|
|
1653
|
+
throw new Error(`TON: get_wallet_data failed for ${wallet}: ${lastErr?.message}`); // transient → don't cache
|
|
1654
|
+
}
|
|
1655
|
+
async function $cfe9a1176e32c0c3$export$77ffdf974cb300ec(storage, wallet) {
|
|
1656
|
+
return await (0, $692184cb0ed76c37$export$2aca74ef9665e35d)(storage, $cfe9a1176e32c0c3$export$a0a0f70252f1386f, $cfe9a1176e32c0c3$export$938b62d04991c792(wallet));
|
|
1657
|
+
}
|
|
1658
|
+
// Register on import: immutable mapping, resolve-on-miss via get_wallet_data; non-jetton
|
|
1659
|
+
// accounts negative-cached for a day.
|
|
1660
|
+
(0, $caa0db003a346aa2$export$2b845901f37b4099)($cfe9a1176e32c0c3$export$a0a0f70252f1386f, {
|
|
1661
|
+
resolve: (key)=>$cfe9a1176e32c0c3$export$cef9e9799d863462(key),
|
|
1662
|
+
ttlSeconds: null,
|
|
1663
|
+
negativeTtlSeconds: 86400
|
|
1664
|
+
});
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
|
|
1354
1668
|
const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
|
|
1355
1669
|
match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "RIPPLE",
|
|
1356
1670
|
transform (block) {
|
|
@@ -3766,6 +4080,27 @@ const $0ab1acc1eff391f6$var$UNIVERSAL_SUB_TEMPLATES = [
|
|
|
3766
4080
|
(0, $8d6646508fb2fa58$export$b5fd4920e8b7d913),
|
|
3767
4081
|
(0, $5ec62a2088d070a8$export$5beebc5708fabf3c)
|
|
3768
4082
|
];
|
|
4083
|
+
// Drops zero-amount + duplicate transfers and applies the optional contractAddress /
|
|
4084
|
+
// walletAddress / transactionHash param filters. Runs AFTER any jetton enrichment so the
|
|
4085
|
+
// filters see the resolved owner/master.
|
|
4086
|
+
function $0ab1acc1eff391f6$var$applyTransferFilters(transfers, _ctx) {
|
|
4087
|
+
const seenTransfers = new Set();
|
|
4088
|
+
return transfers.filter((txfer)=>{
|
|
4089
|
+
if (txfer.amount <= BigInt(0)) return false;
|
|
4090
|
+
if (_ctx?.params) {
|
|
4091
|
+
if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token) return false;
|
|
4092
|
+
if (_ctx.params.walletAddress && ![
|
|
4093
|
+
txfer.from,
|
|
4094
|
+
txfer.to
|
|
4095
|
+
].includes(_ctx.params.walletAddress)) return false;
|
|
4096
|
+
if (_ctx.params.transactionHash && txfer.transactionHash !== _ctx.params.transactionHash) return false;
|
|
4097
|
+
}
|
|
4098
|
+
const key = `${txfer.transactionHash}-${txfer.from}-${txfer.to}-${txfer.amount}-${txfer.token}-${txfer.index}`;
|
|
4099
|
+
if (seenTransfers.has(key)) return false;
|
|
4100
|
+
seenTransfers.add(key);
|
|
4101
|
+
return true;
|
|
4102
|
+
});
|
|
4103
|
+
}
|
|
3769
4104
|
const $0ab1acc1eff391f6$var$tokenTransfersTemplate = {
|
|
3770
4105
|
key: "token_transfers",
|
|
3771
4106
|
name: "Token Transfers",
|
|
@@ -3818,23 +4153,27 @@ const $0ab1acc1eff391f6$var$tokenTransfersTemplate = {
|
|
|
3818
4153
|
transfers = sub.transform(block, _ctx);
|
|
3819
4154
|
break;
|
|
3820
4155
|
}
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
4156
|
+
// Optional enrichment for account-model token transfers (TON jettons) where the block
|
|
4157
|
+
// only carries the token-WALLET address and no master: they come out as
|
|
4158
|
+
// `tokenType: 'TOKEN'`, `to` = wallet, `token` = undefined. When the caller injects a
|
|
4159
|
+
// `_ctx.cacheStorage` (durable cache), jiti resolves the wallet → { owner, master } via
|
|
4160
|
+
// its own cache+RPC and rewrites `to`/`token` BEFORE filtering, so contractAddress /
|
|
4161
|
+
// walletAddress filters match the real owner + master. jiti owns the cache + resolver
|
|
4162
|
+
// (get_wallet_data over Orbs); the consumer injects only storage. Async only when storage
|
|
4163
|
+
// is provided; the sync path is unchanged for every existing caller.
|
|
4164
|
+
const cacheStorage = _ctx?.cacheStorage;
|
|
4165
|
+
if (cacheStorage) return (async ()=>{
|
|
4166
|
+
await Promise.all(transfers.map(async (txfer)=>{
|
|
4167
|
+
if (txfer.tokenType !== "TOKEN" || txfer.token || !txfer.to) return;
|
|
4168
|
+
const info = await (0, $cfe9a1176e32c0c3$export$77ffdf974cb300ec)(cacheStorage, txfer.to);
|
|
4169
|
+
if (info) {
|
|
4170
|
+
txfer.to = info.owner;
|
|
4171
|
+
txfer.token = info.master;
|
|
4172
|
+
}
|
|
4173
|
+
}));
|
|
4174
|
+
return $0ab1acc1eff391f6$var$applyTransferFilters(transfers, _ctx);
|
|
4175
|
+
})();
|
|
4176
|
+
return $0ab1acc1eff391f6$var$applyTransferFilters(transfers, _ctx);
|
|
3838
4177
|
},
|
|
3839
4178
|
tests: $0ab1acc1eff391f6$var$SUB_TEMPLATES.concat($0ab1acc1eff391f6$var$UNIVERSAL_SUB_TEMPLATES).map((v)=>v.tests).flat()
|
|
3840
4179
|
};
|
|
@@ -11591,6 +11930,10 @@ $parcel$exportWildcard($a4e0e4b4a62175c4$exports, $f3761421850600fb$exports);
|
|
|
11591
11930
|
$parcel$exportWildcard($a4e0e4b4a62175c4$exports, $e64a550a52a9d690$exports);
|
|
11592
11931
|
|
|
11593
11932
|
|
|
11933
|
+
|
|
11934
|
+
|
|
11935
|
+
var $cP1H0 = parcelRequire("cP1H0");
|
|
11936
|
+
|
|
11594
11937
|
const $149c1bd638913645$export$eab97d15b1788b8d = {
|
|
11595
11938
|
...$fde9406d76ec24a9$exports
|
|
11596
11939
|
};
|
|
@@ -11605,5 +11948,6 @@ function $149c1bd638913645$export$a07bfd14bbc36e4b(key) {
|
|
|
11605
11948
|
}
|
|
11606
11949
|
|
|
11607
11950
|
|
|
11608
|
-
|
|
11951
|
+
var createPostgresCacheStorage = parcelRequire("cP1H0").createPostgresCacheStorage;
|
|
11952
|
+
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};
|
|
11609
11953
|
//# sourceMappingURL=module.js.map
|