@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/main.js
CHANGED
|
@@ -3,9 +3,13 @@ var $8zHUo$viem = require("viem");
|
|
|
3
3
|
var $8zHUo$tronweb = require("tronweb");
|
|
4
4
|
var $8zHUo$cosmjsprotosigning = require("@cosmjs/proto-signing");
|
|
5
5
|
var $8zHUo$cosmjsstargate = require("@cosmjs/stargate");
|
|
6
|
-
var $8zHUo$bs58 = require("bs58");
|
|
7
6
|
var $8zHUo$toncore = require("@ton/core");
|
|
7
|
+
var $8zHUo$bs58 = require("bs58");
|
|
8
|
+
|
|
8
9
|
|
|
10
|
+
function $parcel$export(e, n, v, s) {
|
|
11
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
|
+
}
|
|
9
13
|
|
|
10
14
|
function $parcel$exportWildcard(dest, source) {
|
|
11
15
|
Object.keys(source).forEach(function(key) {
|
|
@@ -24,18 +28,122 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
24
28
|
return dest;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
function $parcel$export(e, n, v, s) {
|
|
28
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
31
|
function $parcel$interopDefault(a) {
|
|
32
32
|
return a && a.__esModule ? a.default : a;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
var $parcel$global = globalThis;
|
|
36
|
+
|
|
37
|
+
var $parcel$modules = {};
|
|
38
|
+
var $parcel$inits = {};
|
|
39
|
+
|
|
40
|
+
var parcelRequire = $parcel$global["parcelRequire3fdc"];
|
|
41
|
+
|
|
42
|
+
if (parcelRequire == null) {
|
|
43
|
+
parcelRequire = function(id) {
|
|
44
|
+
if (id in $parcel$modules) {
|
|
45
|
+
return $parcel$modules[id].exports;
|
|
46
|
+
}
|
|
47
|
+
if (id in $parcel$inits) {
|
|
48
|
+
var init = $parcel$inits[id];
|
|
49
|
+
delete $parcel$inits[id];
|
|
50
|
+
var module = {id: id, exports: {}};
|
|
51
|
+
$parcel$modules[id] = module;
|
|
52
|
+
init.call(module.exports, module, module.exports);
|
|
53
|
+
return module.exports;
|
|
54
|
+
}
|
|
55
|
+
var err = new Error("Cannot find module '" + id + "'");
|
|
56
|
+
err.code = 'MODULE_NOT_FOUND';
|
|
57
|
+
throw err;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
parcelRequire.register = function register(id, init) {
|
|
61
|
+
$parcel$inits[id] = init;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
$parcel$global["parcelRequire3fdc"] = parcelRequire;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var parcelRegister = parcelRequire.register;
|
|
68
|
+
parcelRegister("lCdWD", function(module, exports) {
|
|
69
|
+
|
|
70
|
+
$parcel$export(module.exports, "createPostgresCacheStorage", () => createPostgresCacheStorage);
|
|
71
|
+
function createPostgresCacheStorage(opts) {
|
|
72
|
+
const table = (opts.table ?? "jiti_cache").replace(/[^a-zA-Z0-9_]/g, "");
|
|
73
|
+
let pool = opts.pool;
|
|
74
|
+
function getPool() {
|
|
75
|
+
if (!pool) {
|
|
76
|
+
// Obscure the require so jiti's bundler leaves `pg` external (loaded from the consumer).
|
|
77
|
+
const requirePg = eval("require");
|
|
78
|
+
const pg = requirePg("pg");
|
|
79
|
+
pool = new pg.Pool({
|
|
80
|
+
connectionString: opts.connectionUri
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return pool;
|
|
84
|
+
}
|
|
85
|
+
let ready;
|
|
86
|
+
function ensureTable() {
|
|
87
|
+
if (!ready) ready = (async ()=>{
|
|
88
|
+
const p = getPool();
|
|
89
|
+
await p.query(`CREATE TABLE IF NOT EXISTS ${table} (
|
|
90
|
+
namespace text NOT NULL,
|
|
91
|
+
key text NOT NULL,
|
|
92
|
+
value jsonb,
|
|
93
|
+
found boolean NOT NULL DEFAULT true,
|
|
94
|
+
resolved_at timestamptz NOT NULL DEFAULT now(),
|
|
95
|
+
expires_at timestamptz,
|
|
96
|
+
PRIMARY KEY (namespace, key)
|
|
97
|
+
);`);
|
|
98
|
+
await p.query(`CREATE INDEX IF NOT EXISTS ${table}_expires_idx ON ${table} (expires_at) WHERE expires_at IS NOT NULL;`);
|
|
99
|
+
})();
|
|
100
|
+
return ready;
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
async get (namespace, key) {
|
|
104
|
+
await ensureTable();
|
|
105
|
+
const { rows } = await getPool().query(`SELECT value, found, expires_at FROM ${table} WHERE namespace = $1 AND key = $2`, [
|
|
106
|
+
namespace,
|
|
107
|
+
key
|
|
108
|
+
]);
|
|
109
|
+
if (!rows.length) return null;
|
|
110
|
+
const row = rows[0];
|
|
111
|
+
return {
|
|
112
|
+
value: row.value ?? null,
|
|
113
|
+
found: row.found,
|
|
114
|
+
expiresAt: row.expires_at ? new Date(row.expires_at).getTime() : null
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
async set (namespace, key, row) {
|
|
118
|
+
await ensureTable();
|
|
119
|
+
await getPool().query(`INSERT INTO ${table} (namespace, key, value, found, resolved_at, expires_at)
|
|
120
|
+
VALUES ($1, $2, $3::jsonb, $4, now(), $5)
|
|
121
|
+
ON CONFLICT (namespace, key) DO UPDATE
|
|
122
|
+
SET value = EXCLUDED.value, found = EXCLUDED.found, resolved_at = now(), expires_at = EXCLUDED.expires_at`, [
|
|
123
|
+
namespace,
|
|
124
|
+
key,
|
|
125
|
+
row.value === null || row.value === undefined ? null : JSON.stringify(row.value),
|
|
126
|
+
row.found,
|
|
127
|
+
row.expiresAt ? new Date(row.expiresAt).toISOString() : null
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
|
|
35
136
|
$parcel$export(module.exports, "utils", () => $882b6d93070905b3$export$eab97d15b1788b8d);
|
|
36
137
|
$parcel$export(module.exports, "templates", () => $882b6d93070905b3$export$a8fc3402335b0b04);
|
|
37
138
|
$parcel$export(module.exports, "getAllTemplates", () => $882b6d93070905b3$export$cceb5167b935aafb);
|
|
38
139
|
$parcel$export(module.exports, "getTemplateByKey", () => $882b6d93070905b3$export$a07bfd14bbc36e4b);
|
|
140
|
+
$parcel$export(module.exports, "cacheGet", () => $45fec2af5a17964d$export$2aca74ef9665e35d);
|
|
141
|
+
$parcel$export(module.exports, "cacheSet", () => $45fec2af5a17964d$export$59c69e19e33761f6);
|
|
142
|
+
$parcel$export(module.exports, "registerCacheNamespace", () => $226820b1648da9ad$export$2b845901f37b4099);
|
|
143
|
+
$parcel$export(module.exports, "createPostgresCacheStorage", () => (parcelRequire("lCdWD")).createPostgresCacheStorage);
|
|
144
|
+
$parcel$export(module.exports, "lookupJettonWallet", () => $b2a2726ff5c26695$export$77ffdf974cb300ec);
|
|
145
|
+
$parcel$export(module.exports, "resolveJettonWalletData", () => $b2a2726ff5c26695$export$cef9e9799d863462);
|
|
146
|
+
$parcel$export(module.exports, "TON_JETTON_NAMESPACE", () => $b2a2726ff5c26695$export$a0a0f70252f1386f);
|
|
39
147
|
var $d7167569386d0d4c$exports = {};
|
|
40
148
|
var $56acd58307ebf8e6$exports = {};
|
|
41
149
|
|
|
@@ -1360,6 +1468,219 @@ const $5a4d345db3c04a51$export$d7ac970e8e789607 = {
|
|
|
1360
1468
|
|
|
1361
1469
|
|
|
1362
1470
|
|
|
1471
|
+
// Per-namespace policy registry. Namespaces differ only here: immutable vs TTL
|
|
1472
|
+
// (`ttlSeconds`), and resolve-on-miss vs externally-populated (presence of `resolve`).
|
|
1473
|
+
// jiti registers the namespaces it can resolve itself (e.g. ton-jetton-wallet); a consumer
|
|
1474
|
+
// may register its own (e.g. token-price with no resolver, populated via cacheSet).
|
|
1475
|
+
const $226820b1648da9ad$var$REGISTRY = new Map();
|
|
1476
|
+
function $226820b1648da9ad$export$2b845901f37b4099(namespace, policy) {
|
|
1477
|
+
$226820b1648da9ad$var$REGISTRY.set(namespace, policy);
|
|
1478
|
+
}
|
|
1479
|
+
function $226820b1648da9ad$export$d23e4dbc7b86eaca(namespace) {
|
|
1480
|
+
return $226820b1648da9ad$var$REGISTRY.get(namespace) ?? {};
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
|
|
1484
|
+
// cache-or-lookup core. jiti owns the orchestration — in-process L1, single-flight, negative
|
|
1485
|
+
// caching, TTL/immutability, read-through/write-through — and the per-namespace resolvers.
|
|
1486
|
+
// The consumer injects only durable storage (see createPostgresCacheStorage for a ready-made
|
|
1487
|
+
// Postgres adapter). With no storage available, callers simply don't invoke cacheGet.
|
|
1488
|
+
const $45fec2af5a17964d$var$L1_MAX = 50000;
|
|
1489
|
+
const $45fec2af5a17964d$var$L1 = new Map();
|
|
1490
|
+
function $45fec2af5a17964d$var$l1Get(id) {
|
|
1491
|
+
const e = $45fec2af5a17964d$var$L1.get(id);
|
|
1492
|
+
if (!e) return undefined;
|
|
1493
|
+
if (e.expiresAt !== null && e.expiresAt <= Date.now()) {
|
|
1494
|
+
$45fec2af5a17964d$var$L1.delete(id);
|
|
1495
|
+
return undefined;
|
|
1496
|
+
}
|
|
1497
|
+
$45fec2af5a17964d$var$L1.delete(id);
|
|
1498
|
+
$45fec2af5a17964d$var$L1.set(id, e); // bump recency
|
|
1499
|
+
return e;
|
|
1500
|
+
}
|
|
1501
|
+
function $45fec2af5a17964d$var$l1Set(id, value, expiresAt) {
|
|
1502
|
+
if ($45fec2af5a17964d$var$L1.size >= $45fec2af5a17964d$var$L1_MAX) {
|
|
1503
|
+
const oldest = $45fec2af5a17964d$var$L1.keys().next().value;
|
|
1504
|
+
if (oldest !== undefined) $45fec2af5a17964d$var$L1.delete(oldest);
|
|
1505
|
+
}
|
|
1506
|
+
$45fec2af5a17964d$var$L1.set(id, {
|
|
1507
|
+
value: value,
|
|
1508
|
+
expiresAt: expiresAt
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
const $45fec2af5a17964d$var$inflight = new Map();
|
|
1512
|
+
function $45fec2af5a17964d$var$cacheId(namespace, key) {
|
|
1513
|
+
return `${namespace} ${key}`;
|
|
1514
|
+
}
|
|
1515
|
+
async function $45fec2af5a17964d$export$2aca74ef9665e35d(storage, namespace, key) {
|
|
1516
|
+
const id = $45fec2af5a17964d$var$cacheId(namespace, key);
|
|
1517
|
+
const l1 = $45fec2af5a17964d$var$l1Get(id);
|
|
1518
|
+
if (l1) return l1.value;
|
|
1519
|
+
const existing = $45fec2af5a17964d$var$inflight.get(id);
|
|
1520
|
+
if (existing !== undefined) return existing;
|
|
1521
|
+
const p = (async ()=>{
|
|
1522
|
+
const row = await storage.get(namespace, key);
|
|
1523
|
+
if (row && (row.expiresAt === null || row.expiresAt > Date.now())) {
|
|
1524
|
+
const value = row.found ? row.value : null;
|
|
1525
|
+
$45fec2af5a17964d$var$l1Set(id, value, row.expiresAt);
|
|
1526
|
+
return value;
|
|
1527
|
+
}
|
|
1528
|
+
const policy = (0, $226820b1648da9ad$export$d23e4dbc7b86eaca)(namespace);
|
|
1529
|
+
if (!policy.resolve) return null; // externally-populated namespace: miss ⇒ null (no write)
|
|
1530
|
+
let resolved = null;
|
|
1531
|
+
try {
|
|
1532
|
+
resolved = await policy.resolve(key);
|
|
1533
|
+
} catch {
|
|
1534
|
+
// Transient resolver failure (e.g. RPC) — do NOT cache so it retries next time.
|
|
1535
|
+
return null;
|
|
1536
|
+
}
|
|
1537
|
+
const found = resolved !== null && resolved !== undefined;
|
|
1538
|
+
const negativeTtl = policy.negativeTtlSeconds ?? 3600;
|
|
1539
|
+
if (!found && negativeTtl === 0) return null; // negative caching disabled for this namespace
|
|
1540
|
+
const ttlSeconds = found ? policy.ttlSeconds : negativeTtl;
|
|
1541
|
+
const expiresAt = ttlSeconds === null || ttlSeconds === undefined ? null : Date.now() + ttlSeconds * 1000;
|
|
1542
|
+
await storage.set(namespace, key, {
|
|
1543
|
+
value: found ? resolved : null,
|
|
1544
|
+
found: found,
|
|
1545
|
+
expiresAt: expiresAt
|
|
1546
|
+
});
|
|
1547
|
+
$45fec2af5a17964d$var$l1Set(id, found ? resolved : null, expiresAt);
|
|
1548
|
+
return found ? resolved : null;
|
|
1549
|
+
})().finally(()=>$45fec2af5a17964d$var$inflight.delete(id));
|
|
1550
|
+
$45fec2af5a17964d$var$inflight.set(id, p);
|
|
1551
|
+
return p;
|
|
1552
|
+
}
|
|
1553
|
+
async function $45fec2af5a17964d$export$59c69e19e33761f6(storage, namespace, key, value, ttlSecondsOverride) {
|
|
1554
|
+
const policy = (0, $226820b1648da9ad$export$d23e4dbc7b86eaca)(namespace);
|
|
1555
|
+
const ttlSeconds = ttlSecondsOverride !== undefined ? ttlSecondsOverride : policy.ttlSeconds;
|
|
1556
|
+
const expiresAt = ttlSeconds === null || ttlSeconds === undefined ? null : Date.now() + ttlSeconds * 1000;
|
|
1557
|
+
await storage.set(namespace, key, {
|
|
1558
|
+
value: value,
|
|
1559
|
+
found: true,
|
|
1560
|
+
expiresAt: expiresAt
|
|
1561
|
+
});
|
|
1562
|
+
$45fec2af5a17964d$var$l1Set($45fec2af5a17964d$var$cacheId(namespace, key), value, expiresAt);
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
|
|
1566
|
+
|
|
1567
|
+
const $b2a2726ff5c26695$export$a0a0f70252f1386f = "ton-jetton-wallet";
|
|
1568
|
+
const $b2a2726ff5c26695$var$ORBS_MANAGER_URL = "https://ton.access.orbs.network/mngr/nodes";
|
|
1569
|
+
const $b2a2726ff5c26695$var$ORBS_REFRESH_MS = 300000;
|
|
1570
|
+
let $b2a2726ff5c26695$var$orbsHosts = [];
|
|
1571
|
+
let $b2a2726ff5c26695$var$orbsRefreshedAt = 0;
|
|
1572
|
+
function $b2a2726ff5c26695$var$shuffled(hosts) {
|
|
1573
|
+
const a = [
|
|
1574
|
+
...hosts
|
|
1575
|
+
];
|
|
1576
|
+
for(let i = a.length - 1; i > 0; i--){
|
|
1577
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
1578
|
+
[a[i], a[j]] = [
|
|
1579
|
+
a[j],
|
|
1580
|
+
a[i]
|
|
1581
|
+
];
|
|
1582
|
+
}
|
|
1583
|
+
return a;
|
|
1584
|
+
}
|
|
1585
|
+
async function $b2a2726ff5c26695$var$getHosts() {
|
|
1586
|
+
if ($b2a2726ff5c26695$var$orbsHosts.length && Date.now() - $b2a2726ff5c26695$var$orbsRefreshedAt < $b2a2726ff5c26695$var$ORBS_REFRESH_MS) return $b2a2726ff5c26695$var$shuffled($b2a2726ff5c26695$var$orbsHosts);
|
|
1587
|
+
try {
|
|
1588
|
+
const resp = await fetch($b2a2726ff5c26695$var$ORBS_MANAGER_URL, {
|
|
1589
|
+
signal: AbortSignal.timeout(8000)
|
|
1590
|
+
});
|
|
1591
|
+
const nodes = await resp.json();
|
|
1592
|
+
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`);
|
|
1593
|
+
if (healthy.length) {
|
|
1594
|
+
$b2a2726ff5c26695$var$orbsHosts = healthy;
|
|
1595
|
+
$b2a2726ff5c26695$var$orbsRefreshedAt = Date.now();
|
|
1596
|
+
}
|
|
1597
|
+
} catch {
|
|
1598
|
+
// keep prior cached set
|
|
1599
|
+
}
|
|
1600
|
+
return $b2a2726ff5c26695$var$shuffled($b2a2726ff5c26695$var$orbsHosts);
|
|
1601
|
+
}
|
|
1602
|
+
function $b2a2726ff5c26695$export$938b62d04991c792(addr) {
|
|
1603
|
+
try {
|
|
1604
|
+
return (0, $8zHUo$toncore.Address).parse(addr).toString({
|
|
1605
|
+
urlSafe: true,
|
|
1606
|
+
bounceable: true,
|
|
1607
|
+
testOnly: false
|
|
1608
|
+
});
|
|
1609
|
+
} catch {
|
|
1610
|
+
return addr;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
function $b2a2726ff5c26695$var$parseAddressFromStackEntry(entry) {
|
|
1614
|
+
// toncenter v2 runGetMethod returns slice/cell results as ['cell', { bytes: <base64 BoC> }].
|
|
1615
|
+
const value = entry?.[1];
|
|
1616
|
+
const b64 = typeof value === "string" ? value : value?.bytes;
|
|
1617
|
+
if (!b64) return null;
|
|
1618
|
+
return $b2a2726ff5c26695$export$938b62d04991c792((0, $8zHUo$toncore.Cell).fromBase64(b64).beginParse().loadAddress().toString());
|
|
1619
|
+
}
|
|
1620
|
+
async function $b2a2726ff5c26695$var$runGetMethod(host, address, method, stack) {
|
|
1621
|
+
const resp = await fetch(host, {
|
|
1622
|
+
method: "POST",
|
|
1623
|
+
headers: {
|
|
1624
|
+
"content-type": "application/json"
|
|
1625
|
+
},
|
|
1626
|
+
body: JSON.stringify({
|
|
1627
|
+
jsonrpc: "2.0",
|
|
1628
|
+
id: 1,
|
|
1629
|
+
method: "runGetMethod",
|
|
1630
|
+
params: {
|
|
1631
|
+
address: address,
|
|
1632
|
+
method: method,
|
|
1633
|
+
stack: stack
|
|
1634
|
+
}
|
|
1635
|
+
}),
|
|
1636
|
+
signal: AbortSignal.timeout(15000)
|
|
1637
|
+
});
|
|
1638
|
+
const json = await resp.json();
|
|
1639
|
+
if (!json.ok || !json.result) throw new Error(`TON runGetMethod ${method} error: ${json.error || "unknown"}`);
|
|
1640
|
+
return {
|
|
1641
|
+
exitCode: json.result.exit_code,
|
|
1642
|
+
stack: json.result.stack
|
|
1643
|
+
};
|
|
1644
|
+
}
|
|
1645
|
+
async function $b2a2726ff5c26695$export$cef9e9799d863462(wallet) {
|
|
1646
|
+
const hosts = await $b2a2726ff5c26695$var$getHosts();
|
|
1647
|
+
if (!hosts.length) throw new Error("TON: no Orbs hosts available for get_wallet_data");
|
|
1648
|
+
let sawDefiniteMiss = false;
|
|
1649
|
+
let lastErr;
|
|
1650
|
+
for(let attempt = 0; attempt < 2; attempt++){
|
|
1651
|
+
for (const host of hosts)try {
|
|
1652
|
+
const { exitCode: exitCode, stack: stack } = await $b2a2726ff5c26695$var$runGetMethod(host, wallet, "get_wallet_data", []);
|
|
1653
|
+
if (exitCode !== 0) {
|
|
1654
|
+
sawDefiniteMiss = true; // no get_wallet_data → not a jetton wallet
|
|
1655
|
+
continue;
|
|
1656
|
+
}
|
|
1657
|
+
const owner = $b2a2726ff5c26695$var$parseAddressFromStackEntry(stack[1]);
|
|
1658
|
+
const master = $b2a2726ff5c26695$var$parseAddressFromStackEntry(stack[2]);
|
|
1659
|
+
if (owner && master) return {
|
|
1660
|
+
owner: owner,
|
|
1661
|
+
master: master
|
|
1662
|
+
};
|
|
1663
|
+
sawDefiniteMiss = true;
|
|
1664
|
+
} catch (e) {
|
|
1665
|
+
lastErr = e;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
if (sawDefiniteMiss) return null; // definitive: not a jetton wallet → negative-cache
|
|
1669
|
+
throw new Error(`TON: get_wallet_data failed for ${wallet}: ${lastErr?.message}`); // transient → don't cache
|
|
1670
|
+
}
|
|
1671
|
+
async function $b2a2726ff5c26695$export$77ffdf974cb300ec(storage, wallet) {
|
|
1672
|
+
return await (0, $45fec2af5a17964d$export$2aca74ef9665e35d)(storage, $b2a2726ff5c26695$export$a0a0f70252f1386f, $b2a2726ff5c26695$export$938b62d04991c792(wallet));
|
|
1673
|
+
}
|
|
1674
|
+
// Register on import: immutable mapping, resolve-on-miss via get_wallet_data; non-jetton
|
|
1675
|
+
// accounts negative-cached for a day.
|
|
1676
|
+
(0, $226820b1648da9ad$export$2b845901f37b4099)($b2a2726ff5c26695$export$a0a0f70252f1386f, {
|
|
1677
|
+
resolve: (key)=>$b2a2726ff5c26695$export$cef9e9799d863462(key),
|
|
1678
|
+
ttlSeconds: null,
|
|
1679
|
+
negativeTtlSeconds: 86400
|
|
1680
|
+
});
|
|
1681
|
+
|
|
1682
|
+
|
|
1683
|
+
|
|
1363
1684
|
const $2e46ec862e47c14f$export$400f08bfae9ee97f = {
|
|
1364
1685
|
match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "RIPPLE",
|
|
1365
1686
|
transform (block) {
|
|
@@ -3775,6 +4096,27 @@ const $7dd402f6ad0dab6a$var$UNIVERSAL_SUB_TEMPLATES = [
|
|
|
3775
4096
|
(0, $f9ab50a3e879ac1c$export$b5fd4920e8b7d913),
|
|
3776
4097
|
(0, $8deaea1ef39b6485$export$5beebc5708fabf3c)
|
|
3777
4098
|
];
|
|
4099
|
+
// Drops zero-amount + duplicate transfers and applies the optional contractAddress /
|
|
4100
|
+
// walletAddress / transactionHash param filters. Runs AFTER any jetton enrichment so the
|
|
4101
|
+
// filters see the resolved owner/master.
|
|
4102
|
+
function $7dd402f6ad0dab6a$var$applyTransferFilters(transfers, _ctx) {
|
|
4103
|
+
const seenTransfers = new Set();
|
|
4104
|
+
return transfers.filter((txfer)=>{
|
|
4105
|
+
if (txfer.amount <= BigInt(0)) return false;
|
|
4106
|
+
if (_ctx?.params) {
|
|
4107
|
+
if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token) return false;
|
|
4108
|
+
if (_ctx.params.walletAddress && ![
|
|
4109
|
+
txfer.from,
|
|
4110
|
+
txfer.to
|
|
4111
|
+
].includes(_ctx.params.walletAddress)) return false;
|
|
4112
|
+
if (_ctx.params.transactionHash && txfer.transactionHash !== _ctx.params.transactionHash) return false;
|
|
4113
|
+
}
|
|
4114
|
+
const key = `${txfer.transactionHash}-${txfer.from}-${txfer.to}-${txfer.amount}-${txfer.token}-${txfer.index}`;
|
|
4115
|
+
if (seenTransfers.has(key)) return false;
|
|
4116
|
+
seenTransfers.add(key);
|
|
4117
|
+
return true;
|
|
4118
|
+
});
|
|
4119
|
+
}
|
|
3778
4120
|
const $7dd402f6ad0dab6a$var$tokenTransfersTemplate = {
|
|
3779
4121
|
key: "token_transfers",
|
|
3780
4122
|
name: "Token Transfers",
|
|
@@ -3827,23 +4169,27 @@ const $7dd402f6ad0dab6a$var$tokenTransfersTemplate = {
|
|
|
3827
4169
|
transfers = sub.transform(block, _ctx);
|
|
3828
4170
|
break;
|
|
3829
4171
|
}
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
4172
|
+
// Optional enrichment for account-model token transfers (TON jettons) where the block
|
|
4173
|
+
// only carries the token-WALLET address and no master: they come out as
|
|
4174
|
+
// `tokenType: 'TOKEN'`, `to` = wallet, `token` = undefined. When the caller injects a
|
|
4175
|
+
// `_ctx.cacheStorage` (durable cache), jiti resolves the wallet → { owner, master } via
|
|
4176
|
+
// its own cache+RPC and rewrites `to`/`token` BEFORE filtering, so contractAddress /
|
|
4177
|
+
// walletAddress filters match the real owner + master. jiti owns the cache + resolver
|
|
4178
|
+
// (get_wallet_data over Orbs); the consumer injects only storage. Async only when storage
|
|
4179
|
+
// is provided; the sync path is unchanged for every existing caller.
|
|
4180
|
+
const cacheStorage = _ctx?.cacheStorage;
|
|
4181
|
+
if (cacheStorage) return (async ()=>{
|
|
4182
|
+
await Promise.all(transfers.map(async (txfer)=>{
|
|
4183
|
+
if (txfer.tokenType !== "TOKEN" || txfer.token || !txfer.to) return;
|
|
4184
|
+
const info = await (0, $b2a2726ff5c26695$export$77ffdf974cb300ec)(cacheStorage, txfer.to);
|
|
4185
|
+
if (info) {
|
|
4186
|
+
txfer.to = info.owner;
|
|
4187
|
+
txfer.token = info.master;
|
|
4188
|
+
}
|
|
4189
|
+
}));
|
|
4190
|
+
return $7dd402f6ad0dab6a$var$applyTransferFilters(transfers, _ctx);
|
|
4191
|
+
})();
|
|
4192
|
+
return $7dd402f6ad0dab6a$var$applyTransferFilters(transfers, _ctx);
|
|
3847
4193
|
},
|
|
3848
4194
|
tests: $7dd402f6ad0dab6a$var$SUB_TEMPLATES.concat($7dd402f6ad0dab6a$var$UNIVERSAL_SUB_TEMPLATES).map((v)=>v.tests).flat()
|
|
3849
4195
|
};
|
|
@@ -11600,6 +11946,10 @@ $parcel$exportWildcard($b4b970cc11bce2a5$exports, $4828ba704a8a504f$exports);
|
|
|
11600
11946
|
$parcel$exportWildcard($b4b970cc11bce2a5$exports, $4a8e5fd52443a474$exports);
|
|
11601
11947
|
|
|
11602
11948
|
|
|
11949
|
+
|
|
11950
|
+
|
|
11951
|
+
var $lCdWD = parcelRequire("lCdWD");
|
|
11952
|
+
|
|
11603
11953
|
const $882b6d93070905b3$export$eab97d15b1788b8d = {
|
|
11604
11954
|
...$d7167569386d0d4c$exports
|
|
11605
11955
|
};
|