@indexing/jiti 0.1.12 → 0.1.13
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 +122 -36
- package/dist/main.js.map +1 -1
- package/dist/module.js +122 -36
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/main.js
CHANGED
|
@@ -4,6 +4,7 @@ var $8zHUo$tronweb = require("tronweb");
|
|
|
4
4
|
var $8zHUo$cosmjsprotosigning = require("@cosmjs/proto-signing");
|
|
5
5
|
var $8zHUo$cosmjsstargate = require("@cosmjs/stargate");
|
|
6
6
|
var $8zHUo$bs58 = require("bs58");
|
|
7
|
+
var $8zHUo$toncore = require("@ton/core");
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
function $parcel$exportWildcard(dest, source) {
|
|
@@ -3533,65 +3534,150 @@ const $11a2c5b0fd56c033$export$bc6c7ab7e0727dd7 = {
|
|
|
3533
3534
|
|
|
3534
3535
|
|
|
3535
3536
|
|
|
3537
|
+
|
|
3538
|
+
|
|
3539
|
+
var $cd430dd11c31e572$require$Buffer = $8zHUo$buffer.Buffer;
|
|
3540
|
+
// TEP-74 jetton `internal_transfer` op-code. This is the message a recipient's
|
|
3541
|
+
// jetton wallet receives when it is credited, so it is the canonical signal of a
|
|
3542
|
+
// jetton deposit landing — and the only jetton message whose executing account
|
|
3543
|
+
// (`tx.address`) is the recipient jetton wallet itself.
|
|
3544
|
+
const $cd430dd11c31e572$var$JETTON_INTERNAL_TRANSFER_OP = 0x178d4519;
|
|
3545
|
+
// Decode a jetton `internal_transfer` message body (a base64-encoded BoC).
|
|
3546
|
+
// Returns null when the body is absent, is not a BoC, or carries a different
|
|
3547
|
+
// op-code (text comments, other jetton ops, arbitrary contract calls) — the
|
|
3548
|
+
// caller then falls back to the native path. Body layout (TEP-74):
|
|
3549
|
+
// internal_transfer#0x178d4519 query_id:uint64 amount:(VarUInteger 16)
|
|
3550
|
+
// from:MsgAddress response_address:MsgAddress ...
|
|
3551
|
+
function $cd430dd11c31e572$var$decodeJettonInternalTransfer(body) {
|
|
3552
|
+
if (!body) return null;
|
|
3553
|
+
try {
|
|
3554
|
+
const slice = (0, $8zHUo$toncore.Cell).fromBoc($cd430dd11c31e572$require$Buffer.from(body, "base64"))[0].beginParse();
|
|
3555
|
+
if (slice.loadUint(32) !== $cd430dd11c31e572$var$JETTON_INTERNAL_TRANSFER_OP) return null;
|
|
3556
|
+
slice.loadUintBig(64); // query_id
|
|
3557
|
+
const amount = slice.loadCoins();
|
|
3558
|
+
// `from` is the sending owner, read best-effort: it can be addr_none on some
|
|
3559
|
+
// mints/airdrops, and rare non-standard address encodings can throw. In
|
|
3560
|
+
// either case keep the (valid) amount and let the caller fall back to the
|
|
3561
|
+
// message source rather than dropping a real jetton transfer.
|
|
3562
|
+
let from;
|
|
3563
|
+
try {
|
|
3564
|
+
const fromAddress = slice.loadMaybeAddress();
|
|
3565
|
+
from = fromAddress ? fromAddress.toString({
|
|
3566
|
+
urlSafe: true,
|
|
3567
|
+
bounceable: true,
|
|
3568
|
+
testOnly: false
|
|
3569
|
+
}) : undefined;
|
|
3570
|
+
} catch {
|
|
3571
|
+
from = undefined;
|
|
3572
|
+
}
|
|
3573
|
+
return {
|
|
3574
|
+
amount: amount,
|
|
3575
|
+
from: from
|
|
3576
|
+
};
|
|
3577
|
+
} catch {
|
|
3578
|
+
return null;
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3536
3581
|
const $cd430dd11c31e572$export$608f3f42810b9879 = {
|
|
3537
3582
|
match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "TON",
|
|
3538
3583
|
transform (block) {
|
|
3539
|
-
|
|
3584
|
+
const transfers = [];
|
|
3540
3585
|
const typedBlock = block;
|
|
3541
3586
|
const blockNumber = typedBlock.seqno;
|
|
3542
|
-
const blockTimestamp = new Date(typedBlock.shards?.[0]?.gen_utime * 1000).toISOString();
|
|
3543
3587
|
for (const shard of typedBlock.shards || [])for (const tx of shard.transactions || []){
|
|
3544
|
-
const
|
|
3545
|
-
|
|
3546
|
-
const
|
|
3547
|
-
const
|
|
3548
|
-
|
|
3588
|
+
const inMsg = tx.in_msg;
|
|
3589
|
+
if (!inMsg) continue;
|
|
3590
|
+
const transactionHash = tx.transaction_id?.hash;
|
|
3591
|
+
const transactionGasFee = BigInt(tx.fee || "0");
|
|
3592
|
+
// Per-transaction time. shards[0].gen_utime — the previous source — is
|
|
3593
|
+
// wrong for any transaction outside the first shard and is undefined for
|
|
3594
|
+
// empty shards (producing `Invalid Date`).
|
|
3595
|
+
const timestamp = new Date((tx.utime || 0) * 1000).toISOString();
|
|
3596
|
+
// The account this transaction executed on: the recipient account for a
|
|
3597
|
+
// native transfer, or the recipient's jetton wallet for a jetton one
|
|
3598
|
+
// (== in_msg.destination).
|
|
3599
|
+
const to = tx.address?.account_address;
|
|
3600
|
+
// Walk `in_msg` only: every transfer is recorded once, at the
|
|
3601
|
+
// recipient's transaction, with `from` carried on the row so sender
|
|
3602
|
+
// queries still match. Walking `out_msgs` too would double-emit each hop
|
|
3603
|
+
// — the sender's and the recipient's transactions both fall in range.
|
|
3604
|
+
const jetton = $cd430dd11c31e572$var$decodeJettonInternalTransfer(inMsg.msg_data?.body);
|
|
3605
|
+
if (jetton) {
|
|
3606
|
+
// Jetton and native value are mutually exclusive per message: a jetton
|
|
3607
|
+
// `internal_transfer` also carries forwarded gas as `in_msg.value`, so
|
|
3608
|
+
// emitting a native transfer here too would surface a phantom TON hop.
|
|
3609
|
+
transfers.push({
|
|
3610
|
+
blockNumber: blockNumber,
|
|
3611
|
+
from: jetton.from || inMsg.source?.account_address,
|
|
3612
|
+
to: to,
|
|
3613
|
+
amount: jetton.amount,
|
|
3614
|
+
// The jetton master is not carried in the wallet-to-wallet
|
|
3615
|
+
// `internal_transfer`; a stateless template can't resolve it without
|
|
3616
|
+
// an RPC call, so `token` is intentionally left undefined.
|
|
3617
|
+
tokenType: "TOKEN",
|
|
3618
|
+
timestamp: timestamp,
|
|
3619
|
+
transactionHash: transactionHash,
|
|
3620
|
+
transactionGasFee: transactionGasFee
|
|
3621
|
+
});
|
|
3622
|
+
continue;
|
|
3623
|
+
}
|
|
3624
|
+
const inValue = BigInt(inMsg.value || "0");
|
|
3625
|
+
if (inValue > 0n) transfers.push({
|
|
3549
3626
|
blockNumber: blockNumber,
|
|
3550
|
-
from:
|
|
3551
|
-
to:
|
|
3552
|
-
amount:
|
|
3627
|
+
from: inMsg.source?.account_address,
|
|
3628
|
+
to: to,
|
|
3629
|
+
amount: inValue,
|
|
3553
3630
|
token: "TON",
|
|
3554
3631
|
tokenType: "NATIVE",
|
|
3555
|
-
timestamp:
|
|
3632
|
+
timestamp: timestamp,
|
|
3556
3633
|
transactionHash: transactionHash,
|
|
3557
|
-
transactionGasFee:
|
|
3634
|
+
transactionGasFee: transactionGasFee
|
|
3558
3635
|
});
|
|
3559
|
-
for (const outMsg of tx.out_msgs || []){
|
|
3560
|
-
const outVal = BigInt(outMsg.value || "0");
|
|
3561
|
-
if (outVal > 0n) transfers.push({
|
|
3562
|
-
blockNumber: blockNumber,
|
|
3563
|
-
from: outMsg.source?.account_address,
|
|
3564
|
-
to: outMsg.destination?.account_address,
|
|
3565
|
-
amount: outVal,
|
|
3566
|
-
token: "TON",
|
|
3567
|
-
tokenType: "NATIVE",
|
|
3568
|
-
timestamp: blockTimestamp,
|
|
3569
|
-
transactionHash: transactionHash,
|
|
3570
|
-
transactionGasFee: transactionFee
|
|
3571
|
-
});
|
|
3572
|
-
}
|
|
3573
3636
|
}
|
|
3574
3637
|
return transfers;
|
|
3575
3638
|
},
|
|
3576
3639
|
tests: [
|
|
3577
3640
|
{
|
|
3641
|
+
// Native TON transfer — `in_msg` carries value and no jetton body.
|
|
3578
3642
|
params: {
|
|
3579
3643
|
network: "TON",
|
|
3580
|
-
|
|
3581
|
-
contractAddress: ""
|
|
3644
|
+
transactionHash: "rwDRQeWniNdxBayFcDavE/Wo35B+MsfO4lJJmvz5Edk="
|
|
3582
3645
|
},
|
|
3583
|
-
payload: "https://jiti.indexing.co/networks/ton/
|
|
3646
|
+
payload: "https://jiti.indexing.co/networks/ton/71399000",
|
|
3584
3647
|
output: [
|
|
3585
3648
|
{
|
|
3586
|
-
blockNumber:
|
|
3587
|
-
from: "
|
|
3588
|
-
to: "
|
|
3589
|
-
amount:
|
|
3649
|
+
blockNumber: 71399000,
|
|
3650
|
+
from: "EQBkhlXTyZjri7SfyZcgFbRkjlLvq4kU3UjBTtiTtwLITn0H",
|
|
3651
|
+
to: "EQABGo8KCza3ea8DNHMnSWZmbRzW-05332eTdfvW-XDQEjQM",
|
|
3652
|
+
amount: 203686310466n,
|
|
3590
3653
|
token: "TON",
|
|
3591
3654
|
tokenType: "NATIVE",
|
|
3592
|
-
timestamp: "
|
|
3593
|
-
transactionHash: "
|
|
3594
|
-
transactionGasFee:
|
|
3655
|
+
timestamp: "2026-06-05T15:31:47.000Z",
|
|
3656
|
+
transactionHash: "rwDRQeWniNdxBayFcDavE/Wo35B+MsfO4lJJmvz5Edk=",
|
|
3657
|
+
transactionGasFee: 6668n
|
|
3658
|
+
}
|
|
3659
|
+
]
|
|
3660
|
+
},
|
|
3661
|
+
{
|
|
3662
|
+
// Jetton transfer — `in_msg` is an internal_transfer (op 0x178d4519). The
|
|
3663
|
+
// message also carries 49740664 nanoTON of forwarded gas, which must NOT
|
|
3664
|
+
// surface as a phantom native transfer. `token` is left undefined (the
|
|
3665
|
+
// jetton master is not in the wallet-to-wallet message).
|
|
3666
|
+
params: {
|
|
3667
|
+
network: "TON",
|
|
3668
|
+
transactionHash: "Tx+nOxUzqo8kYpNkX20C2OTg6Dd9d6MHadQsknv4620="
|
|
3669
|
+
},
|
|
3670
|
+
payload: "https://jiti.indexing.co/networks/ton/71399000",
|
|
3671
|
+
output: [
|
|
3672
|
+
{
|
|
3673
|
+
blockNumber: 71399000,
|
|
3674
|
+
from: "EQDshc_H_RAJNi5CG1oBQfUQ1lQBB6tz54Kf2h756Xp14_Cv",
|
|
3675
|
+
to: "EQBMzIc7YUB_WkSkmaIooZyONQDayNfipt3PQ4IJRsGXsPGI",
|
|
3676
|
+
amount: 2800000000n,
|
|
3677
|
+
tokenType: "TOKEN",
|
|
3678
|
+
timestamp: "2026-06-05T15:31:47.000Z",
|
|
3679
|
+
transactionHash: "Tx+nOxUzqo8kYpNkX20C2OTg6Dd9d6MHadQsknv4620=",
|
|
3680
|
+
transactionGasFee: 233386n
|
|
3595
3681
|
}
|
|
3596
3682
|
]
|
|
3597
3683
|
}
|