@indexing/jiti 0.0.19 → 0.0.21
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 +549 -4
- package/dist/main.js.map +1 -1
- package/dist/module.js +549 -4
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -1
package/dist/module.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {Buffer as $hgUW1$Buffer} from "buffer";
|
|
2
|
+
import {decodeTxRaw as $hgUW1$decodeTxRaw, Registry as $hgUW1$Registry} from "@cosmjs/proto-signing";
|
|
3
|
+
import {defaultRegistryTypes as $hgUW1$defaultRegistryTypes} from "@cosmjs/stargate";
|
|
1
4
|
import {keccak256 as $hgUW1$keccak256, decodeEventLog as $hgUW1$decodeEventLog, parseAbi as $hgUW1$parseAbi} from "viem";
|
|
2
5
|
|
|
3
6
|
|
|
@@ -266,6 +269,10 @@ $parcel$exportWildcard($fde9406d76ec24a9$exports, $f6a81337d3532e59$exports);
|
|
|
266
269
|
$parcel$exportWildcard($fde9406d76ec24a9$exports, $8f1e0ae1ead9a2a9$exports);
|
|
267
270
|
|
|
268
271
|
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
var $c18434deda90759d$require$Buffer = $hgUW1$Buffer;
|
|
269
276
|
const $c18434deda90759d$var$NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
270
277
|
const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
271
278
|
key: "token_transfers",
|
|
@@ -315,9 +322,349 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
315
322
|
const TOKEN_TYPES = _ctx.params.tokenTypes || [];
|
|
316
323
|
let transfers = [];
|
|
317
324
|
switch(block._network){
|
|
318
|
-
|
|
319
|
-
|
|
325
|
+
case "APTOS":
|
|
326
|
+
case "APTOS_TESTNET":
|
|
327
|
+
for (const tx of block.transactions){
|
|
328
|
+
if (!tx?.events || !Array.isArray(tx.events)) break;
|
|
329
|
+
const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp) / 1000).toISOString() : null;
|
|
330
|
+
const txfersByKey = {};
|
|
331
|
+
for (const evt of tx.events)if ([
|
|
332
|
+
"0x1::coin::WithdrawEvent",
|
|
333
|
+
"0x1::coin::DepositEvent"
|
|
334
|
+
].includes(evt.type)) {
|
|
335
|
+
const amount = evt.data?.amount;
|
|
336
|
+
const key = `0x1-${amount}`;
|
|
337
|
+
txfersByKey[key] ||= {
|
|
338
|
+
amount: amount,
|
|
339
|
+
tokenAddress: null
|
|
340
|
+
};
|
|
341
|
+
if (evt.type.endsWith("WithdrawEvent")) txfersByKey[key].from = evt.guid?.account_address;
|
|
342
|
+
else txfersByKey[key].to = evt.guid?.account_address;
|
|
343
|
+
}
|
|
344
|
+
for (const partial of Object.values(txfersByKey)){
|
|
345
|
+
if (!partial.from || !partial.to) continue;
|
|
346
|
+
transfers.push({
|
|
347
|
+
amount: BigInt(partial.amount),
|
|
348
|
+
blockNumber: parseInt(block.block_height),
|
|
349
|
+
from: partial.from,
|
|
350
|
+
timestamp: timestamp,
|
|
351
|
+
to: partial.to,
|
|
352
|
+
token: partial.tokenAddress,
|
|
353
|
+
tokenType: "NATIVE",
|
|
354
|
+
transactionGasFee: BigInt(tx.gas_used),
|
|
355
|
+
transactionHash: tx.hash
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
break;
|
|
360
|
+
case "BITCOIN":
|
|
361
|
+
case "BITCOIN_TESTNET":
|
|
362
|
+
case "LITCOIN":
|
|
363
|
+
case "DOGECOIN":
|
|
364
|
+
for (const tx of block.tx){
|
|
365
|
+
const timestamp = tx.time ? new Date(tx.time * 1000).toISOString() : null;
|
|
366
|
+
const vin = tx.vin[0];
|
|
367
|
+
const vout = tx.vout;
|
|
368
|
+
const fromVout = Math.min(vin.vout || 1000, vout.length - 1);
|
|
369
|
+
const fromAddress = vin.prevout?.scriptPubKey?.address || vout[fromVout]?.scriptPubKey?.address || vout[fromVout]?.scriptPubKey?.addresses?.[0];
|
|
370
|
+
if (!fromAddress) break;
|
|
371
|
+
for (const v of vout)transfers.push({
|
|
372
|
+
amount: BigInt(Math.round(v.value * Math.pow(10, 8))),
|
|
373
|
+
blockNumber: block.height,
|
|
374
|
+
from: fromAddress,
|
|
375
|
+
timestamp: timestamp,
|
|
376
|
+
to: v.scriptPubKey.address || v.scriptPubKey.addresses?.[0],
|
|
377
|
+
transactionGasFee: BigInt(tx.fee || 0) * BigInt(Math.pow(10, 8)),
|
|
378
|
+
transactionHash: tx.txid,
|
|
379
|
+
token: null,
|
|
380
|
+
tokenType: "NATIVE"
|
|
381
|
+
});
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
break;
|
|
385
|
+
case "CARDANO":
|
|
386
|
+
{
|
|
387
|
+
const blockTimestamp = new Date(block.timestamp * 1000).toISOString();
|
|
388
|
+
for (const tx of block.transactions){
|
|
389
|
+
const typedTx = tx;
|
|
390
|
+
if (!Array.isArray(typedTx.operations)) continue;
|
|
391
|
+
const transactionHash = typedTx.transaction_identifier?.hash || "";
|
|
392
|
+
const inputs = typedTx.operations.filter((op)=>op.type === "input");
|
|
393
|
+
const outputs = typedTx.operations.filter((op)=>op.type === "output");
|
|
394
|
+
if (!inputs.length && !outputs.length) break;
|
|
395
|
+
const fromAddress = inputs[0]?.account?.address;
|
|
396
|
+
if (!fromAddress) continue;
|
|
397
|
+
const sumInputs = inputs.reduce((acc, op)=>{
|
|
398
|
+
const val = BigInt(op.amount?.value || "0");
|
|
399
|
+
return acc + val;
|
|
400
|
+
}, BigInt(0));
|
|
401
|
+
const sumOutputs = outputs.reduce((acc, op)=>{
|
|
402
|
+
const val = BigInt(op.amount?.value || "0");
|
|
403
|
+
return acc + val;
|
|
404
|
+
}, BigInt(0));
|
|
405
|
+
const transactionFee = sumInputs + BigInt(sumOutputs);
|
|
406
|
+
for (const out of outputs){
|
|
407
|
+
const rawValue = out.amount?.value || "0";
|
|
408
|
+
const absoluteValue = BigInt(rawValue);
|
|
409
|
+
transfers.push({
|
|
410
|
+
amount: absoluteValue < 0 ? -absoluteValue : absoluteValue,
|
|
411
|
+
blockNumber: block.block_identifier.index,
|
|
412
|
+
from: fromAddress,
|
|
413
|
+
timestamp: blockTimestamp,
|
|
414
|
+
to: out.account?.address || "",
|
|
415
|
+
token: out.amount?.currency?.symbol?.toUpperCase() === "ADA" ? null : out.amount?.currency?.symbol,
|
|
416
|
+
tokenType: out.amount?.currency?.symbol?.toUpperCase() === "ADA" ? "NATIVE" : "TOKEN",
|
|
417
|
+
transactionGasFee: transactionFee < 0 ? -transactionFee : transactionFee,
|
|
418
|
+
transactionHash: transactionHash
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
case "RIPPLE":
|
|
425
|
+
if (!Array.isArray(block.transactions)) break;
|
|
426
|
+
for (const rawTx of block.transactions){
|
|
427
|
+
const typedTx = rawTx;
|
|
428
|
+
if (typedTx.TransactionType !== "Payment") continue;
|
|
429
|
+
const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? "0";
|
|
430
|
+
let tokenSymbol = "XRP";
|
|
431
|
+
let tokenType = "NATIVE";
|
|
432
|
+
let parsedAmount;
|
|
433
|
+
if (typeof deliveredOrAmount === "object") {
|
|
434
|
+
tokenSymbol = deliveredOrAmount.currency?.toUpperCase() ?? "UNKNOWN";
|
|
435
|
+
tokenType = "TOKEN";
|
|
436
|
+
const floatVal = parseFloat(deliveredOrAmount.value);
|
|
437
|
+
const smallestUnit = Math.round(floatVal * 1000000);
|
|
438
|
+
parsedAmount = BigInt(smallestUnit);
|
|
439
|
+
} else parsedAmount = BigInt(String(deliveredOrAmount));
|
|
440
|
+
transfers.push({
|
|
441
|
+
amount: parsedAmount,
|
|
442
|
+
blockNumber: parseInt(block.ledger_index, 10),
|
|
443
|
+
from: typedTx.Account ?? "UNKNOWN",
|
|
444
|
+
timestamp: block.close_time_iso ? block.close_time_iso : null,
|
|
445
|
+
to: typedTx.Destination ?? "UNKNOWN",
|
|
446
|
+
token: tokenSymbol,
|
|
447
|
+
tokenType: tokenType,
|
|
448
|
+
transactionGasFee: BigInt(typedTx.Fee ?? "0"),
|
|
449
|
+
transactionHash: typedTx.hash ?? ""
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
break;
|
|
453
|
+
case "SOLANA":
|
|
454
|
+
for (const tx of block.transactions){
|
|
455
|
+
const solanaTx = tx;
|
|
456
|
+
const txHash = solanaTx.transaction.signatures[0];
|
|
457
|
+
const timestamp = block.blockTime ? new Date(block.blockTime * 1000).toISOString() : null;
|
|
458
|
+
let txFee = BigInt(solanaTx.meta.fee);
|
|
459
|
+
if (txFee < BigInt(10)) txFee = txFee * BigInt(Math.pow(10, 9));
|
|
460
|
+
const transfersByKey = {};
|
|
461
|
+
for (const post of solanaTx.meta.postTokenBalances){
|
|
462
|
+
let matched = false;
|
|
463
|
+
for (const pre of solanaTx.meta.preTokenBalances)if (post.mint === pre.mint && post.owner === pre.owner) {
|
|
464
|
+
let diff = BigInt(post.uiTokenAmount.amount) - BigInt(pre.uiTokenAmount.amount);
|
|
465
|
+
if (diff === BigInt(0)) continue;
|
|
466
|
+
if (diff < 0) diff = -diff;
|
|
467
|
+
const key = `${post.mint}-${diff.toString()}`;
|
|
468
|
+
const txfer = {
|
|
469
|
+
amount: diff,
|
|
470
|
+
blockNumber: block.blockHeight,
|
|
471
|
+
from: pre.owner,
|
|
472
|
+
timestamp: timestamp,
|
|
473
|
+
to: post.owner,
|
|
474
|
+
transactionGasFee: txFee,
|
|
475
|
+
transactionHash: txHash,
|
|
476
|
+
token: post.mint,
|
|
477
|
+
tokenType: "TOKEN"
|
|
478
|
+
};
|
|
479
|
+
if (transfersByKey[key]) {
|
|
480
|
+
if (diff > 0) delete txfer.from;
|
|
481
|
+
else delete txfer.to;
|
|
482
|
+
}
|
|
483
|
+
transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
|
|
484
|
+
matched = true;
|
|
485
|
+
}
|
|
486
|
+
if (!matched) {
|
|
487
|
+
let diff = BigInt(post.uiTokenAmount.amount);
|
|
488
|
+
if (diff < 0) diff = -diff;
|
|
489
|
+
const key = `${post.mint}-${diff.toString()}`;
|
|
490
|
+
const txfer = {
|
|
491
|
+
amount: diff,
|
|
492
|
+
blockNumber: block.blockHeight,
|
|
493
|
+
from: null,
|
|
494
|
+
timestamp: timestamp,
|
|
495
|
+
to: post.owner,
|
|
496
|
+
token: post.mint,
|
|
497
|
+
tokenType: "TOKEN",
|
|
498
|
+
transactionGasFee: txFee,
|
|
499
|
+
transactionHash: txHash
|
|
500
|
+
};
|
|
501
|
+
delete txfer.from;
|
|
502
|
+
transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
for(let i = 1; i < solanaTx.meta.postBalances.length; i += 1){
|
|
506
|
+
const post = solanaTx.meta.postBalances[i];
|
|
507
|
+
const pre = solanaTx.meta.preBalances[i];
|
|
508
|
+
if (post !== undefined && pre !== undefined && post !== pre) {
|
|
509
|
+
let diff = BigInt(post) - BigInt(pre);
|
|
510
|
+
if (diff < 0) diff = -diff;
|
|
511
|
+
const key = `null-${diff.toString()}`;
|
|
512
|
+
const txfer = {
|
|
513
|
+
amount: diff,
|
|
514
|
+
blockNumber: block.blockHeight,
|
|
515
|
+
from: post > pre ? typeof solanaTx.transaction.message.accountKeys[0] === "string" ? solanaTx.transaction.message.accountKeys[0] : solanaTx.transaction.message.accountKeys[0]?.pubkey : typeof solanaTx.transaction.message.accountKeys[i] === "string" ? solanaTx.transaction.message.accountKeys[i] : solanaTx.transaction.message.accountKeys[i]?.pubkey,
|
|
516
|
+
timestamp: timestamp,
|
|
517
|
+
to: typeof solanaTx.transaction.message.accountKeys[i] === "string" ? solanaTx.transaction.message.accountKeys[i] : solanaTx.transaction.message.accountKeys[i]?.pubkey?.toString(),
|
|
518
|
+
token: null,
|
|
519
|
+
tokenType: "NATIVE",
|
|
520
|
+
transactionGasFee: txFee,
|
|
521
|
+
transactionHash: txHash
|
|
522
|
+
};
|
|
523
|
+
if (transfersByKey[key]) {
|
|
524
|
+
if (post > pre) delete txfer.from;
|
|
525
|
+
else delete txfer.to;
|
|
526
|
+
}
|
|
527
|
+
transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
transfers.push(...Object.values(transfersByKey));
|
|
531
|
+
}
|
|
532
|
+
break;
|
|
533
|
+
case "STARKNET":
|
|
534
|
+
if (!Array.isArray(block.transactions)) break;
|
|
535
|
+
for (const tx of block.transactions){
|
|
536
|
+
const typedTx = tx;
|
|
537
|
+
const timestamp = block.timestamp ? new Date(block.timestamp * 1000).toISOString() : null;
|
|
538
|
+
let transactionGasFee = BigInt(0);
|
|
539
|
+
if (typedTx?.receipt?.actual_fee?.amount) transactionGasFee = BigInt(typedTx.receipt.actual_fee.amount);
|
|
540
|
+
const transactionHash = typedTx.transaction_hash;
|
|
541
|
+
if (!typedTx.receipt?.events) continue;
|
|
542
|
+
for (const event of typedTx.receipt.events){
|
|
543
|
+
if (!event.keys.includes("0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9")) continue;
|
|
544
|
+
if (event.data.length < 3) continue;
|
|
545
|
+
const [from, to, amountHex] = event.data;
|
|
546
|
+
const amount = BigInt(amountHex);
|
|
547
|
+
transfers.push({
|
|
548
|
+
amount: amount,
|
|
549
|
+
blockNumber: block.block_number,
|
|
550
|
+
from: from,
|
|
551
|
+
timestamp: timestamp,
|
|
552
|
+
to: to,
|
|
553
|
+
token: null,
|
|
554
|
+
tokenType: "NATIVE",
|
|
555
|
+
transactionGasFee: transactionGasFee,
|
|
556
|
+
transactionHash: transactionHash
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
break;
|
|
561
|
+
case "STELLAR":
|
|
562
|
+
for (const tx of block.transactions){
|
|
563
|
+
const typedTx = tx;
|
|
564
|
+
for (const op of typedTx.operations)if (op.type === "payment") transfers.push({
|
|
565
|
+
amount: BigInt(op.amount.replace(".", "")),
|
|
566
|
+
blockNumber: block.sequence,
|
|
567
|
+
from: op.from,
|
|
568
|
+
timestamp: typedTx.created_at,
|
|
569
|
+
to: op.to,
|
|
570
|
+
token: op.asset_type === "native" ? null : op.asset_issuer,
|
|
571
|
+
tokenType: op.asset_type === "native" ? "NATIVE" : "TOKEN",
|
|
572
|
+
transactionGasFee: BigInt(typedTx.fee_charged),
|
|
573
|
+
transactionHash: typedTx.hash
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
break;
|
|
577
|
+
case "SUI":
|
|
578
|
+
{
|
|
579
|
+
const blockNumber = block.sequence;
|
|
580
|
+
const blockTimestamp = new Date(block.timestamp).toISOString();
|
|
581
|
+
for (const tx of block.transactions || []){
|
|
582
|
+
const transactionHash = tx.digest;
|
|
583
|
+
const transactionGasFee = BigInt(tx.gasFee || "0");
|
|
584
|
+
for (const bc of tx.balanceChanges || [])transfers.push({
|
|
585
|
+
blockNumber: blockNumber,
|
|
586
|
+
from: tx.sender ? tx.sender : undefined,
|
|
587
|
+
to: tx.receiver ? tx.receiver : undefined,
|
|
588
|
+
amount: BigInt(bc.amount),
|
|
589
|
+
token: bc.coinRepr,
|
|
590
|
+
tokenType: "NATIVE",
|
|
591
|
+
timestamp: blockTimestamp,
|
|
592
|
+
transactionHash: transactionHash,
|
|
593
|
+
transactionGasFee: transactionGasFee
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
case "TON":
|
|
599
|
+
{
|
|
600
|
+
const blockNumber = block.seqno;
|
|
601
|
+
const blockTimestamp = new Date(block.shards?.[0]?.gen_utime * 1000).toISOString();
|
|
602
|
+
for (const shard of block.shards || [])for (const tx of shard.transactions || []){
|
|
603
|
+
const transactionLT = tx.transaction_id.lt;
|
|
604
|
+
const transactionHash = tx.transaction_id.hash;
|
|
605
|
+
const transactionFee = BigInt(tx.fee || "0");
|
|
606
|
+
const inVal = BigInt(tx.in_msg?.value || "0");
|
|
607
|
+
if (inVal > 0n) transfers.push({
|
|
608
|
+
blockNumber: blockNumber,
|
|
609
|
+
from: tx.in_msg?.source?.account_address,
|
|
610
|
+
to: tx.address?.account_address,
|
|
611
|
+
amount: inVal,
|
|
612
|
+
token: "TON",
|
|
613
|
+
tokenType: "NATIVE",
|
|
614
|
+
timestamp: blockTimestamp,
|
|
615
|
+
transactionHash: transactionHash,
|
|
616
|
+
transactionGasFee: transactionFee
|
|
617
|
+
});
|
|
618
|
+
for (const outMsg of tx.out_msgs || []){
|
|
619
|
+
const outVal = BigInt(outMsg.value || "0");
|
|
620
|
+
if (outVal > 0n) transfers.push({
|
|
621
|
+
blockNumber: blockNumber,
|
|
622
|
+
from: outMsg.source?.account_address,
|
|
623
|
+
to: outMsg.destination?.account_address,
|
|
624
|
+
amount: outVal,
|
|
625
|
+
token: "TON",
|
|
626
|
+
tokenType: "NATIVE",
|
|
627
|
+
timestamp: blockTimestamp,
|
|
628
|
+
transactionHash: transactionHash,
|
|
629
|
+
transactionGasFee: transactionFee
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
break;
|
|
634
|
+
}
|
|
635
|
+
// attempt to introspect data types
|
|
320
636
|
default:
|
|
637
|
+
// try Cosmos
|
|
638
|
+
if (block.block) {
|
|
639
|
+
const typedBlock = block;
|
|
640
|
+
const blockNumber = Number(typedBlock.block.header.height);
|
|
641
|
+
const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();
|
|
642
|
+
const blockHash = typedBlock.block_id.hash;
|
|
643
|
+
for (const txRaw of typedBlock.block.data.txs || []){
|
|
644
|
+
const decoded = (0, $hgUW1$decodeTxRaw)(new Uint8Array($c18434deda90759d$require$Buffer.from(txRaw, "base64")));
|
|
645
|
+
const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || "0");
|
|
646
|
+
const registry = new (0, $hgUW1$Registry)((0, $hgUW1$defaultRegistryTypes));
|
|
647
|
+
for (const message of decoded.body.messages)if ([
|
|
648
|
+
"/ibc.applications.transfer.v1.MsgTransfer",
|
|
649
|
+
"/cosmos.bank.v1beta1.MsgSend"
|
|
650
|
+
].includes(message.typeUrl)) {
|
|
651
|
+
const decodedMsg = registry.decode(message);
|
|
652
|
+
transfers.push({
|
|
653
|
+
blockNumber: blockNumber,
|
|
654
|
+
from: decodedMsg.sender,
|
|
655
|
+
to: decodedMsg.receiver,
|
|
656
|
+
amount: BigInt(decodedMsg.token.amount),
|
|
657
|
+
token: decodedMsg.token.denom,
|
|
658
|
+
tokenType: "NATIVE",
|
|
659
|
+
timestamp: blockTimestamp,
|
|
660
|
+
transactionHash: blockHash,
|
|
661
|
+
transactionGasFee: transactionGasFee
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
break;
|
|
666
|
+
}
|
|
667
|
+
// otherwise assume EVM
|
|
321
668
|
for (const tx of block.transactions){
|
|
322
669
|
if (!tx.receipt) continue;
|
|
323
670
|
const timestamp = new Date(block.timestamp * 1000).toISOString();
|
|
@@ -369,7 +716,6 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
369
716
|
transactionHash: tx.hash
|
|
370
717
|
});
|
|
371
718
|
}
|
|
372
|
-
// @TODO: add NFT transfers
|
|
373
719
|
if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("NFT")) for (const log of tx.receipt.logs){
|
|
374
720
|
const txfer = (0, $cfa23334cbdf9391$export$cf548b70626e2eb9)(log, [
|
|
375
721
|
"Transfer(address indexed from, address indexed to, uint256 indexed value)",
|
|
@@ -432,7 +778,7 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
432
778
|
}
|
|
433
779
|
transfers = transfers.filter((txfer)=>{
|
|
434
780
|
if (txfer.amount <= BigInt(0)) return false;
|
|
435
|
-
if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token) return false;
|
|
781
|
+
if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token && txfer.token) return false;
|
|
436
782
|
if (_ctx.params.walletAddress && ![
|
|
437
783
|
txfer.from,
|
|
438
784
|
txfer.to
|
|
@@ -442,6 +788,29 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
442
788
|
return transfers;
|
|
443
789
|
},
|
|
444
790
|
tests: [
|
|
791
|
+
// APTOS
|
|
792
|
+
{
|
|
793
|
+
params: {
|
|
794
|
+
network: "APTOS",
|
|
795
|
+
walletAddress: "0xb3589951a7d8579a2918a749260804047abc60438bf0738c4e67683e972b41cd",
|
|
796
|
+
contractAddress: "0x1"
|
|
797
|
+
},
|
|
798
|
+
payload: "https://jiti.indexing.co/networks/aptos/237372198",
|
|
799
|
+
output: [
|
|
800
|
+
{
|
|
801
|
+
amount: 12776498n,
|
|
802
|
+
blockNumber: 237372198,
|
|
803
|
+
from: "0xb3589951a7d8579a2918a749260804047abc60438bf0738c4e67683e972b41cd",
|
|
804
|
+
timestamp: "2024-10-10T16:59:34.414Z",
|
|
805
|
+
to: "0x1f5d15c9a1330389bda239ed2f40d8d2a2ba446e7a48ee57483a047d5ed1aafe",
|
|
806
|
+
token: null,
|
|
807
|
+
tokenType: "NATIVE",
|
|
808
|
+
transactionGasFee: 507n,
|
|
809
|
+
transactionHash: "0xbabaf20c07c80ace9f1f2f6539e0df6c57c9a6b24d5e62fa4989b46c0807d9bb"
|
|
810
|
+
}
|
|
811
|
+
]
|
|
812
|
+
},
|
|
813
|
+
// BASE
|
|
445
814
|
{
|
|
446
815
|
params: {
|
|
447
816
|
network: "BASE",
|
|
@@ -463,6 +832,182 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
463
832
|
transactionHash: "0x69c9b12ccbe2d4f2f1dfc7c4a8557fc099fc5df276424417815acbc79a06fd56"
|
|
464
833
|
}
|
|
465
834
|
]
|
|
835
|
+
},
|
|
836
|
+
// DOGECOIN
|
|
837
|
+
{
|
|
838
|
+
params: {
|
|
839
|
+
network: "DOGECOIN",
|
|
840
|
+
walletAddress: "DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP",
|
|
841
|
+
contractAddress: ""
|
|
842
|
+
},
|
|
843
|
+
payload: "https://jiti.indexing.co/networks/dogecoin/1000075",
|
|
844
|
+
output: [
|
|
845
|
+
{
|
|
846
|
+
amount: 1008521000000n,
|
|
847
|
+
blockNumber: 1000075,
|
|
848
|
+
from: "DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP",
|
|
849
|
+
to: "DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP",
|
|
850
|
+
token: null,
|
|
851
|
+
tokenType: "NATIVE",
|
|
852
|
+
transactionGasFee: 0n,
|
|
853
|
+
transactionHash: "9873fe46ab29f61cefdec498b691af68e0ad29a7599c94f42d2d4e9a5d461dbe",
|
|
854
|
+
timestamp: "2015-12-13T19:59:52.000Z"
|
|
855
|
+
}
|
|
856
|
+
]
|
|
857
|
+
},
|
|
858
|
+
// CARDANO
|
|
859
|
+
{
|
|
860
|
+
params: {
|
|
861
|
+
network: "CARDANO",
|
|
862
|
+
walletAddress: "addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund",
|
|
863
|
+
contractAddress: ""
|
|
864
|
+
},
|
|
865
|
+
payload: "https://jiti.indexing.co/networks/cardano/11443286",
|
|
866
|
+
output: [
|
|
867
|
+
{
|
|
868
|
+
amount: 1110000n,
|
|
869
|
+
blockNumber: 11443286,
|
|
870
|
+
from: "addr1qymdv285few5tyqvya86rl97r9e608njs37shfew6l2nn473aw2pcnrcvfwfgg2dnew99m4tjj0apsu7232w2euzwpysndh0h3",
|
|
871
|
+
timestamp: "+057068-01-19T05:23:20.000Z",
|
|
872
|
+
to: "addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund",
|
|
873
|
+
token: null,
|
|
874
|
+
tokenType: "NATIVE",
|
|
875
|
+
transactionGasFee: 174257n,
|
|
876
|
+
transactionHash: "261c42ba9124f55d8e169ebb692cd3759d796a54369acb316ee449b546e79309"
|
|
877
|
+
}
|
|
878
|
+
]
|
|
879
|
+
},
|
|
880
|
+
// RIPPLE
|
|
881
|
+
{
|
|
882
|
+
params: {
|
|
883
|
+
network: "RIPPLE",
|
|
884
|
+
walletAddress: "rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui",
|
|
885
|
+
contractAddress: ""
|
|
886
|
+
},
|
|
887
|
+
payload: "https://jiti.indexing.co/networks/ripple/88104659",
|
|
888
|
+
output: [
|
|
889
|
+
{
|
|
890
|
+
amount: 238n,
|
|
891
|
+
blockNumber: 88104659,
|
|
892
|
+
from: "rMAGnTv4eMWktZnhKa5cHcDiY84ZiKUaQm",
|
|
893
|
+
timestamp: "2024-05-19T22:18:52Z",
|
|
894
|
+
to: "rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui",
|
|
895
|
+
token: "XRP",
|
|
896
|
+
tokenType: "NATIVE",
|
|
897
|
+
transactionGasFee: 15n,
|
|
898
|
+
transactionHash: "03564E6109261CDE73FCC5062C2A0A70F365CB1A0F9408C065B60EC3E94E4DBF"
|
|
899
|
+
}
|
|
900
|
+
]
|
|
901
|
+
},
|
|
902
|
+
// STELLAR
|
|
903
|
+
{
|
|
904
|
+
params: {
|
|
905
|
+
network: "STELLAR",
|
|
906
|
+
walletAddress: "GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X",
|
|
907
|
+
contractAddress: "GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA"
|
|
908
|
+
},
|
|
909
|
+
payload: "https://jiti.indexing.co/networks/stellar/51720546",
|
|
910
|
+
output: [
|
|
911
|
+
{
|
|
912
|
+
amount: 150000n,
|
|
913
|
+
blockNumber: 51720546,
|
|
914
|
+
from: "GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X",
|
|
915
|
+
timestamp: "2024-05-18T04:41:39Z",
|
|
916
|
+
to: "GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA",
|
|
917
|
+
token: "GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA",
|
|
918
|
+
tokenType: "TOKEN",
|
|
919
|
+
transactionGasFee: 100n,
|
|
920
|
+
transactionHash: "4fb2441210cbe87f5003abdfa86f03bafa54f789ed041feccbda0bd054297c4d"
|
|
921
|
+
}
|
|
922
|
+
]
|
|
923
|
+
},
|
|
924
|
+
// STARKNET
|
|
925
|
+
{
|
|
926
|
+
params: {
|
|
927
|
+
network: "STARKNET",
|
|
928
|
+
walletAddress: "0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54",
|
|
929
|
+
contractAddress: ""
|
|
930
|
+
},
|
|
931
|
+
payload: "https://jiti.indexing.co/networks/starknet/1149460",
|
|
932
|
+
output: [
|
|
933
|
+
{
|
|
934
|
+
amount: 0x1c286f74458fc6n,
|
|
935
|
+
blockNumber: 1149460,
|
|
936
|
+
from: "0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54",
|
|
937
|
+
timestamp: "2025-02-13T17:36:52.000Z",
|
|
938
|
+
to: "0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8",
|
|
939
|
+
token: null,
|
|
940
|
+
tokenType: "NATIVE",
|
|
941
|
+
transactionGasFee: 7925758505095110n,
|
|
942
|
+
transactionHash: "0x707203dba31f442ae9a5477e6a8906f3676effa0f1d3bb19cbbc14e1ddfe21"
|
|
943
|
+
}
|
|
944
|
+
]
|
|
945
|
+
},
|
|
946
|
+
//SUI
|
|
947
|
+
{
|
|
948
|
+
params: {
|
|
949
|
+
network: "SUI",
|
|
950
|
+
walletAddress: "0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e",
|
|
951
|
+
contractAddress: ""
|
|
952
|
+
},
|
|
953
|
+
payload: "https://jiti.indexing.co/networks/sui/112336044",
|
|
954
|
+
output: [
|
|
955
|
+
{
|
|
956
|
+
blockNumber: 112336044,
|
|
957
|
+
from: "0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e",
|
|
958
|
+
to: undefined,
|
|
959
|
+
amount: 180772n,
|
|
960
|
+
token: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
961
|
+
tokenType: "NATIVE",
|
|
962
|
+
timestamp: "2025-02-13T23:10:54.529Z",
|
|
963
|
+
transactionHash: "336V3wP8cHDAnB1Aku3j6n9948i8FG5N1eVP6Ac68BaE",
|
|
964
|
+
transactionGasFee: -4165572n
|
|
965
|
+
}
|
|
966
|
+
]
|
|
967
|
+
},
|
|
968
|
+
// TON
|
|
969
|
+
{
|
|
970
|
+
params: {
|
|
971
|
+
network: "TON",
|
|
972
|
+
walletAddress: "EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40",
|
|
973
|
+
contractAddress: ""
|
|
974
|
+
},
|
|
975
|
+
payload: "https://jiti.indexing.co/networks/ton/44919328",
|
|
976
|
+
output: [
|
|
977
|
+
{
|
|
978
|
+
blockNumber: 44919328,
|
|
979
|
+
from: "EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40",
|
|
980
|
+
to: "EQCFTFAHOU3vFt2NiZhRD5dwuS0k7GS59vIg3WfCKwfaQGW2",
|
|
981
|
+
amount: 10000000n,
|
|
982
|
+
token: "TON",
|
|
983
|
+
tokenType: "NATIVE",
|
|
984
|
+
timestamp: "2025-02-13T23:10:18.000Z",
|
|
985
|
+
transactionHash: "Vh5cWr2uvCsdhoouBQ+EiUcF54os9oqvh8A/62EroQc=",
|
|
986
|
+
transactionGasFee: 2355233n
|
|
987
|
+
}
|
|
988
|
+
]
|
|
989
|
+
},
|
|
990
|
+
// COSMOS
|
|
991
|
+
{
|
|
992
|
+
params: {
|
|
993
|
+
network: "COSMOS",
|
|
994
|
+
walletAddress: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
995
|
+
contractAddress: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
|
|
996
|
+
},
|
|
997
|
+
payload: "https://jiti.indexing.co/networks/cosmos/24419691",
|
|
998
|
+
output: [
|
|
999
|
+
{
|
|
1000
|
+
blockNumber: 24419691,
|
|
1001
|
+
from: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
1002
|
+
to: "noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv",
|
|
1003
|
+
amount: 500000n,
|
|
1004
|
+
token: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013",
|
|
1005
|
+
tokenType: "NATIVE",
|
|
1006
|
+
timestamp: "2025-02-14T21:48:22.809Z",
|
|
1007
|
+
transactionHash: "DF5FB086E60EE2ADA3A842751337E06A40696D7983CC1C038ADE236B36ED8AEB",
|
|
1008
|
+
transactionGasFee: 4860n
|
|
1009
|
+
}
|
|
1010
|
+
]
|
|
466
1011
|
}
|
|
467
1012
|
]
|
|
468
1013
|
};
|