@indexing/jiti 0.1.5 → 0.1.7
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 +303 -31
- package/dist/main.js.map +1 -1
- package/dist/module.js +303 -31
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/fixtures/stellar/61961851.json +3 -0
- package/package.json +1 -1
package/dist/module.js
CHANGED
|
@@ -1458,6 +1458,23 @@ const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
|
|
|
1458
1458
|
if (!Array.isArray(typedBlock.transactions)) return [];
|
|
1459
1459
|
for (const typedTx of typedBlock.transactions || []){
|
|
1460
1460
|
if (typedTx.TransactionType !== "Payment") continue;
|
|
1461
|
+
// Failed XRPL payments still burn Fee. Emit a fee-only transfer (to: null) so
|
|
1462
|
+
// callers account for the gas, and skip the payment amount that never landed.
|
|
1463
|
+
if (typedTx.metaData?.TransactionResult && typedTx.metaData.TransactionResult !== "tesSUCCESS") {
|
|
1464
|
+
transfers.push({
|
|
1465
|
+
amount: BigInt(typedTx.Fee ?? "0"),
|
|
1466
|
+
blockNumber: parseInt(typedBlock.ledger_index, 10),
|
|
1467
|
+
from: typedTx.Account ?? "UNKNOWN",
|
|
1468
|
+
memo: typedTx.DestinationTag,
|
|
1469
|
+
timestamp: typedBlock.close_time_iso || null,
|
|
1470
|
+
to: null,
|
|
1471
|
+
token: "XRP",
|
|
1472
|
+
tokenType: "NATIVE",
|
|
1473
|
+
transactionGasFee: BigInt(typedTx.Fee ?? "0"),
|
|
1474
|
+
transactionHash: typedTx.hash ?? ""
|
|
1475
|
+
});
|
|
1476
|
+
continue;
|
|
1477
|
+
}
|
|
1461
1478
|
const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? "0";
|
|
1462
1479
|
let tokenSymbol = "XRP";
|
|
1463
1480
|
let tokenType = "NATIVE";
|
|
@@ -1506,6 +1523,45 @@ const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
|
|
|
1506
1523
|
transactionHash: "B32A6A5455777283212407FBD8CCA701505C654E5F4ADFFBE9D4D22F00889D87"
|
|
1507
1524
|
}
|
|
1508
1525
|
]
|
|
1526
|
+
},
|
|
1527
|
+
// Failed XRPL payments emit ONLY a fee transfer (to: null) — the payment Amount
|
|
1528
|
+
// never reached the Destination, but the Fee was still burned.
|
|
1529
|
+
{
|
|
1530
|
+
params: {
|
|
1531
|
+
network: "RIPPLE"
|
|
1532
|
+
},
|
|
1533
|
+
payload: {
|
|
1534
|
+
_network: "RIPPLE",
|
|
1535
|
+
ledger_index: "100000000",
|
|
1536
|
+
close_time_iso: "2026-04-04T08:02:44Z",
|
|
1537
|
+
transactions: [
|
|
1538
|
+
{
|
|
1539
|
+
TransactionType: "Payment",
|
|
1540
|
+
Account: "rFAILFROMxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
1541
|
+
Destination: "rFAILTOxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
1542
|
+
Amount: "1000000",
|
|
1543
|
+
Fee: "10",
|
|
1544
|
+
hash: "FAILEDXRPLTXHASH",
|
|
1545
|
+
metaData: {
|
|
1546
|
+
TransactionResult: "tecPATH_DRY"
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
]
|
|
1550
|
+
},
|
|
1551
|
+
output: [
|
|
1552
|
+
{
|
|
1553
|
+
amount: 10n,
|
|
1554
|
+
blockNumber: 100000000,
|
|
1555
|
+
from: "rFAILFROMxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
1556
|
+
memo: undefined,
|
|
1557
|
+
timestamp: "2026-04-04T08:02:44Z",
|
|
1558
|
+
to: null,
|
|
1559
|
+
token: "XRP",
|
|
1560
|
+
tokenType: "NATIVE",
|
|
1561
|
+
transactionGasFee: 10n,
|
|
1562
|
+
transactionHash: "FAILEDXRPLTXHASH"
|
|
1563
|
+
}
|
|
1564
|
+
]
|
|
1509
1565
|
}
|
|
1510
1566
|
]
|
|
1511
1567
|
};
|
|
@@ -3236,58 +3292,274 @@ const $f7da547a9d6b4fc0$export$36783fc9701281c6 = {
|
|
|
3236
3292
|
|
|
3237
3293
|
|
|
3238
3294
|
|
|
3295
|
+
// Stellar amounts are stringified decimals with 7 fractional digits ("12.3456789"),
|
|
3296
|
+
// but jiti expresses everything in stroops (smallest unit). Stripping the dot is
|
|
3297
|
+
// equivalent to multiplying by 10^7.
|
|
3298
|
+
const $725699ccb951d76d$var$toStroops = (s)=>BigInt(s.replace(".", ""));
|
|
3299
|
+
const $725699ccb951d76d$var$effectAsset = (e)=>{
|
|
3300
|
+
if (e.asset_type === "native") return {
|
|
3301
|
+
token: null,
|
|
3302
|
+
tokenType: "NATIVE"
|
|
3303
|
+
};
|
|
3304
|
+
if (e.asset_issuer) return {
|
|
3305
|
+
token: e.asset_issuer,
|
|
3306
|
+
tokenType: "TOKEN"
|
|
3307
|
+
};
|
|
3308
|
+
// contract_* effects expose `asset` as a single string ("CODE:ISSUER" or "native").
|
|
3309
|
+
if (e.asset && e.asset !== "native") {
|
|
3310
|
+
const [, issuer] = e.asset.split(":");
|
|
3311
|
+
return {
|
|
3312
|
+
token: issuer ?? e.asset,
|
|
3313
|
+
tokenType: "TOKEN"
|
|
3314
|
+
};
|
|
3315
|
+
}
|
|
3316
|
+
return {
|
|
3317
|
+
token: null,
|
|
3318
|
+
tokenType: "NATIVE"
|
|
3319
|
+
};
|
|
3320
|
+
};
|
|
3321
|
+
const $725699ccb951d76d$var$sameAsset = (a, b)=>a.asset_type === b.asset_type && a.asset_code === b.asset_code && a.asset_issuer === b.asset_issuer && a.asset === b.asset;
|
|
3322
|
+
// Pair account_debited/account_credited effects within a single op into transfers.
|
|
3323
|
+
// Used for ops where amount/asset isn't reliably on the op body (offer fills,
|
|
3324
|
+
// account_merge, claim_claimable_balance, liquidity_pool_*, invoke_host_function).
|
|
3325
|
+
// Unpaired sides become one-sided transfers (e.g. claim_claimable_balance has no
|
|
3326
|
+
// debit because the source is a protocol-managed escrow).
|
|
3327
|
+
function $725699ccb951d76d$var$effectsToTransfers(typedTx, op, typedBlock) {
|
|
3328
|
+
const transfers = [];
|
|
3329
|
+
const effects = (op.effects || []).filter((e)=>typeof e.amount === "string");
|
|
3330
|
+
const debits = effects.filter((e)=>e.type === "account_debited" || e.type === "contract_debited");
|
|
3331
|
+
const credits = effects.filter((e)=>e.type === "account_credited" || e.type === "contract_credited");
|
|
3332
|
+
const baseFields = {
|
|
3333
|
+
blockNumber: typedBlock.sequence,
|
|
3334
|
+
memo: typedTx.memo,
|
|
3335
|
+
timestamp: typedTx.created_at,
|
|
3336
|
+
transactionGasFee: BigInt(typedTx.fee_charged),
|
|
3337
|
+
transactionHash: typedTx.hash
|
|
3338
|
+
};
|
|
3339
|
+
const usedCredit = new Set();
|
|
3340
|
+
for (const d of debits){
|
|
3341
|
+
if (!d.amount) continue;
|
|
3342
|
+
const idx = credits.findIndex((c, i)=>!usedCredit.has(i) && $725699ccb951d76d$var$sameAsset(d, c) && c.amount === d.amount);
|
|
3343
|
+
const { token: token, tokenType: tokenType } = $725699ccb951d76d$var$effectAsset(d);
|
|
3344
|
+
if (idx !== -1) {
|
|
3345
|
+
const c = credits[idx];
|
|
3346
|
+
usedCredit.add(idx);
|
|
3347
|
+
transfers.push({
|
|
3348
|
+
...baseFields,
|
|
3349
|
+
amount: $725699ccb951d76d$var$toStroops(d.amount),
|
|
3350
|
+
from: d.account || d.contract || null,
|
|
3351
|
+
to: c.account || c.contract || null,
|
|
3352
|
+
token: token,
|
|
3353
|
+
tokenType: tokenType
|
|
3354
|
+
});
|
|
3355
|
+
} else transfers.push({
|
|
3356
|
+
...baseFields,
|
|
3357
|
+
amount: $725699ccb951d76d$var$toStroops(d.amount),
|
|
3358
|
+
from: d.account || d.contract || null,
|
|
3359
|
+
to: null,
|
|
3360
|
+
token: token,
|
|
3361
|
+
tokenType: tokenType
|
|
3362
|
+
});
|
|
3363
|
+
}
|
|
3364
|
+
for(let i = 0; i < credits.length; i++){
|
|
3365
|
+
if (usedCredit.has(i)) continue;
|
|
3366
|
+
const c = credits[i];
|
|
3367
|
+
if (!c.amount) continue;
|
|
3368
|
+
const { token: token, tokenType: tokenType } = $725699ccb951d76d$var$effectAsset(c);
|
|
3369
|
+
transfers.push({
|
|
3370
|
+
...baseFields,
|
|
3371
|
+
amount: $725699ccb951d76d$var$toStroops(c.amount),
|
|
3372
|
+
from: null,
|
|
3373
|
+
to: c.account || c.contract || null,
|
|
3374
|
+
token: token,
|
|
3375
|
+
tokenType: tokenType
|
|
3376
|
+
});
|
|
3377
|
+
}
|
|
3378
|
+
return transfers;
|
|
3379
|
+
}
|
|
3239
3380
|
const $725699ccb951d76d$export$681f497010b17679 = {
|
|
3240
3381
|
match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "STELLAR",
|
|
3241
3382
|
transform (block) {
|
|
3242
|
-
|
|
3383
|
+
const transfers = [];
|
|
3243
3384
|
const typedBlock = block;
|
|
3244
3385
|
for (const typedTx of typedBlock.transactions || []){
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3386
|
+
// Failed txs still burn fee_charged — emit a fee transfer (to: null) so callers
|
|
3387
|
+
// can account for the gas, but skip the ops that never actually moved funds.
|
|
3388
|
+
if (!typedTx.successful) {
|
|
3389
|
+
transfers.push({
|
|
3390
|
+
amount: BigInt(typedTx.fee_charged),
|
|
3391
|
+
blockNumber: typedBlock.sequence,
|
|
3392
|
+
from: typedTx.source_account,
|
|
3393
|
+
memo: typedTx.memo,
|
|
3394
|
+
timestamp: typedTx.created_at,
|
|
3395
|
+
to: null,
|
|
3396
|
+
token: null,
|
|
3397
|
+
tokenType: "NATIVE",
|
|
3398
|
+
transactionGasFee: BigInt(typedTx.fee_charged),
|
|
3399
|
+
transactionHash: typedTx.hash
|
|
3400
|
+
});
|
|
3401
|
+
continue;
|
|
3402
|
+
}
|
|
3403
|
+
for (const op of typedTx.operations){
|
|
3404
|
+
const baseFields = {
|
|
3405
|
+
blockNumber: typedBlock.sequence,
|
|
3406
|
+
memo: typedTx.memo,
|
|
3407
|
+
timestamp: typedTx.created_at,
|
|
3408
|
+
transactionGasFee: BigInt(typedTx.fee_charged),
|
|
3409
|
+
transactionHash: typedTx.hash
|
|
3410
|
+
};
|
|
3411
|
+
if (op.type === "payment") transfers.push({
|
|
3412
|
+
...baseFields,
|
|
3413
|
+
amount: $725699ccb951d76d$var$toStroops(op.amount),
|
|
3414
|
+
from: op.from,
|
|
3415
|
+
to: op.to,
|
|
3416
|
+
token: op.asset_type === "native" ? null : op.asset_issuer,
|
|
3417
|
+
tokenType: op.asset_type === "native" ? "NATIVE" : "TOKEN"
|
|
3418
|
+
});
|
|
3419
|
+
else if (op.type === "create_account") // create_account funds a new account with native XLM via starting_balance —
|
|
3420
|
+
// economically a native payment from funder → account, but a different op
|
|
3421
|
+
// type because it also creates the destination ledger entry.
|
|
3422
|
+
transfers.push({
|
|
3423
|
+
...baseFields,
|
|
3424
|
+
amount: $725699ccb951d76d$var$toStroops(op.starting_balance),
|
|
3425
|
+
from: op.funder,
|
|
3426
|
+
to: op.account,
|
|
3427
|
+
token: null,
|
|
3428
|
+
tokenType: "NATIVE"
|
|
3429
|
+
});
|
|
3430
|
+
else if (op.type === "path_payment_strict_send" || op.type === "path_payment_strict_receive") {
|
|
3431
|
+
// Path payments swap source_asset → asset along a DEX path. Both legs are
|
|
3432
|
+
// emitted as separate transfers (different assets, different amounts) so the
|
|
3433
|
+
// sender debit and receiver credit are both visible from op fields alone.
|
|
3434
|
+
transfers.push({
|
|
3435
|
+
...baseFields,
|
|
3436
|
+
amount: $725699ccb951d76d$var$toStroops(op.source_amount),
|
|
3437
|
+
from: op.from,
|
|
3438
|
+
to: op.to,
|
|
3439
|
+
token: op.source_asset_type === "native" ? null : op.source_asset_issuer,
|
|
3440
|
+
tokenType: op.source_asset_type === "native" ? "NATIVE" : "TOKEN"
|
|
3441
|
+
});
|
|
3442
|
+
transfers.push({
|
|
3443
|
+
...baseFields,
|
|
3444
|
+
amount: $725699ccb951d76d$var$toStroops(op.amount),
|
|
3445
|
+
from: op.from,
|
|
3446
|
+
to: op.to,
|
|
3447
|
+
token: op.asset_type === "native" ? null : op.asset_issuer,
|
|
3448
|
+
tokenType: op.asset_type === "native" ? "NATIVE" : "TOKEN"
|
|
3449
|
+
});
|
|
3450
|
+
} else // Everything else — manage_*_offer fills, account_merge, claim_claimable_balance,
|
|
3451
|
+
// liquidity_pool_*, invoke_host_function (Soroban) — surfaces fund movements
|
|
3452
|
+
// only via Horizon effects. Requires oscar to attach `op.effects` (#38).
|
|
3453
|
+
transfers.push(...$725699ccb951d76d$var$effectsToTransfers(typedTx, op, typedBlock));
|
|
3454
|
+
}
|
|
3257
3455
|
}
|
|
3258
3456
|
return transfers;
|
|
3259
3457
|
},
|
|
3260
3458
|
tests: [
|
|
3459
|
+
// Single-op token payment: source wallet → dest wallet, USDC asset.
|
|
3261
3460
|
{
|
|
3262
3461
|
params: {
|
|
3263
3462
|
network: "STELLAR",
|
|
3264
|
-
|
|
3463
|
+
transactionHash: "e08e8dd92bde178c554146475cafdf00cef8a8874541b1bb568760b5bd33c6e6"
|
|
3265
3464
|
},
|
|
3266
|
-
payload: "https://jiti.indexing.co/networks/stellar/
|
|
3465
|
+
payload: "https://jiti.indexing.co/networks/stellar/62312535",
|
|
3267
3466
|
output: [
|
|
3268
3467
|
{
|
|
3269
|
-
amount:
|
|
3270
|
-
blockNumber:
|
|
3271
|
-
from: "
|
|
3272
|
-
memo:
|
|
3273
|
-
timestamp: "
|
|
3274
|
-
to: "
|
|
3468
|
+
amount: 100000000n,
|
|
3469
|
+
blockNumber: 62312535,
|
|
3470
|
+
from: "GAUA7XL5K54CC2DDGP77FJ2YBHRJLT36CPZDXWPM6MP7MANOGG77PNJU",
|
|
3471
|
+
memo: undefined,
|
|
3472
|
+
timestamp: "2026-04-27T16:14:30Z",
|
|
3473
|
+
to: "GBTPFDSY7NFLFXAXXU725NUB2CXYM57RXG4ATYWBTK7RB57DFFNIU7RH",
|
|
3275
3474
|
token: "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
|
|
3276
3475
|
tokenType: "TOKEN",
|
|
3277
3476
|
transactionGasFee: 200n,
|
|
3278
|
-
transactionHash: "
|
|
3279
|
-
}
|
|
3477
|
+
transactionHash: "e08e8dd92bde178c554146475cafdf00cef8a8874541b1bb568760b5bd33c6e6"
|
|
3478
|
+
}
|
|
3479
|
+
]
|
|
3480
|
+
},
|
|
3481
|
+
// path_payment_strict_send swaps source_asset → asset along a DEX path. Both legs
|
|
3482
|
+
// are emitted as separate transfers so the sender debit and receiver credit are
|
|
3483
|
+
// visible. Self-swap here (source==dest) but logic handles distinct accounts the
|
|
3484
|
+
// same way.
|
|
3485
|
+
{
|
|
3486
|
+
params: {
|
|
3487
|
+
network: "STELLAR",
|
|
3488
|
+
transactionHash: "f036756ae1cbf61d8e43af39b24b991b59c3684fc030de42f5d8fc2c96a672eb"
|
|
3489
|
+
},
|
|
3490
|
+
payload: "https://jiti.indexing.co/networks/stellar/62312422",
|
|
3491
|
+
output: [
|
|
3280
3492
|
{
|
|
3281
|
-
amount:
|
|
3282
|
-
blockNumber:
|
|
3283
|
-
from: "
|
|
3493
|
+
amount: 1000000n,
|
|
3494
|
+
blockNumber: 62312422,
|
|
3495
|
+
from: "GCY7AY7OOO2XKZUCKLOZL3MJ62DW5UNL3ISFWDEDEEJM7JFGYZEUS55Z",
|
|
3284
3496
|
memo: undefined,
|
|
3285
|
-
timestamp: "
|
|
3286
|
-
to: "
|
|
3287
|
-
token: "
|
|
3497
|
+
timestamp: "2026-04-27T16:03:47Z",
|
|
3498
|
+
to: "GCY7AY7OOO2XKZUCKLOZL3MJ62DW5UNL3ISFWDEDEEJM7JFGYZEUS55Z",
|
|
3499
|
+
token: "GARDNV3Q7YGT4AKSDF25LT32YSCCW4EV22Y2TV3I2PU2MMXJTEDL5T55",
|
|
3288
3500
|
tokenType: "TOKEN",
|
|
3289
|
-
transactionGasFee:
|
|
3290
|
-
transactionHash: "
|
|
3501
|
+
transactionGasFee: 200n,
|
|
3502
|
+
transactionHash: "f036756ae1cbf61d8e43af39b24b991b59c3684fc030de42f5d8fc2c96a672eb"
|
|
3503
|
+
},
|
|
3504
|
+
{
|
|
3505
|
+
amount: 1000179n,
|
|
3506
|
+
blockNumber: 62312422,
|
|
3507
|
+
from: "GCY7AY7OOO2XKZUCKLOZL3MJ62DW5UNL3ISFWDEDEEJM7JFGYZEUS55Z",
|
|
3508
|
+
memo: undefined,
|
|
3509
|
+
timestamp: "2026-04-27T16:03:47Z",
|
|
3510
|
+
to: "GCY7AY7OOO2XKZUCKLOZL3MJ62DW5UNL3ISFWDEDEEJM7JFGYZEUS55Z",
|
|
3511
|
+
token: null,
|
|
3512
|
+
tokenType: "NATIVE",
|
|
3513
|
+
transactionGasFee: 200n,
|
|
3514
|
+
transactionHash: "f036756ae1cbf61d8e43af39b24b991b59c3684fc030de42f5d8fc2c96a672eb"
|
|
3515
|
+
}
|
|
3516
|
+
]
|
|
3517
|
+
},
|
|
3518
|
+
// create_account funds a new account with native XLM — emit it as a NATIVE
|
|
3519
|
+
// transfer (funder → account) using starting_balance.
|
|
3520
|
+
{
|
|
3521
|
+
params: {
|
|
3522
|
+
network: "STELLAR",
|
|
3523
|
+
transactionHash: "a11add92603c4cab2396804f26acfe6fb9b0f938dc7dfa9f2ed017eb75ca039a"
|
|
3524
|
+
},
|
|
3525
|
+
payload: "https://jiti.indexing.co/networks/stellar/62080113",
|
|
3526
|
+
output: [
|
|
3527
|
+
{
|
|
3528
|
+
amount: 344880700n,
|
|
3529
|
+
blockNumber: 62080113,
|
|
3530
|
+
from: "GDF4UGQSY6VHWN7T4XJEZ6WYJEREMZYLNYZ5CCKYVS3V3MNYIBMTB354",
|
|
3531
|
+
memo: undefined,
|
|
3532
|
+
timestamp: "2026-04-12T04:27:18Z",
|
|
3533
|
+
to: "GBJO6JIIPD4JEKDTKY4CKOSQZU3ETIKVWAWU56A46W72G377BGG4PS44",
|
|
3534
|
+
token: null,
|
|
3535
|
+
tokenType: "NATIVE",
|
|
3536
|
+
transactionGasFee: 100n,
|
|
3537
|
+
transactionHash: "a11add92603c4cab2396804f26acfe6fb9b0f938dc7dfa9f2ed017eb75ca039a"
|
|
3538
|
+
}
|
|
3539
|
+
]
|
|
3540
|
+
},
|
|
3541
|
+
// Failed Stellar txs emit ONLY a fee transfer (to: null), never the failed payment
|
|
3542
|
+
// operations. Ledger 61961851 / tx 9024ba4b... is the Mesh incident — the source
|
|
3543
|
+
// tried to send 1_000_000_000 stroops to GAGLH6..., the tx reverted, and the only
|
|
3544
|
+
// on-chain effect was the 100-stroop fee being charged.
|
|
3545
|
+
{
|
|
3546
|
+
params: {
|
|
3547
|
+
network: "STELLAR",
|
|
3548
|
+
transactionHash: "9024ba4b558b09042cb02afd1d46eea72597891691801375acee332273c5c26d"
|
|
3549
|
+
},
|
|
3550
|
+
payload: "https://jiti.indexing.co/networks/stellar/61961851",
|
|
3551
|
+
output: [
|
|
3552
|
+
{
|
|
3553
|
+
amount: 100n,
|
|
3554
|
+
blockNumber: 61961851,
|
|
3555
|
+
from: "GCP7I54JXTOZ4SJG4UARWJOMJ25JQXRHSHXQWDSV4TRVRJFDG67VUEXP",
|
|
3556
|
+
memo: undefined,
|
|
3557
|
+
timestamp: "2026-04-04T08:02:44Z",
|
|
3558
|
+
to: null,
|
|
3559
|
+
token: null,
|
|
3560
|
+
tokenType: "NATIVE",
|
|
3561
|
+
transactionGasFee: 100n,
|
|
3562
|
+
transactionHash: "9024ba4b558b09042cb02afd1d46eea72597891691801375acee332273c5c26d"
|
|
3291
3563
|
}
|
|
3292
3564
|
]
|
|
3293
3565
|
}
|