@indexing/jiti 0.0.43 → 0.0.45

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/module.js CHANGED
@@ -5,10 +5,6 @@ import {defaultRegistryTypes as $hgUW1$defaultRegistryTypes} from "@cosmjs/starg
5
5
  import {sha256 as $hgUW1$sha256, keccak256 as $hgUW1$keccak256, decodeEventLog as $hgUW1$decodeEventLog, parseAbi as $hgUW1$parseAbi} from "viem";
6
6
 
7
7
 
8
- function $parcel$defineInteropFlag(a) {
9
- Object.defineProperty(a, '__esModule', {value: true, configurable: true});
10
- }
11
-
12
8
  function $parcel$export(e, n, v, s) {
13
9
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
14
10
  }
@@ -32,9 +28,7 @@ function $parcel$exportWildcard(dest, source) {
32
28
 
33
29
  var $09654dffcb68affa$exports = {};
34
30
 
35
- $parcel$defineInteropFlag($09654dffcb68affa$exports);
36
-
37
- $parcel$export($09654dffcb68affa$exports, "default", () => $09654dffcb68affa$export$2e2bcd8739ae039);
31
+ $parcel$export($09654dffcb68affa$exports, "blockToVM", () => $09654dffcb68affa$export$ae001c77434c5340);
38
32
  const $09654dffcb68affa$var$PARTIAL_VM_TO_NETWORK_MAP = {
39
33
  APTOS: [
40
34
  "APTOS",
@@ -75,7 +69,7 @@ const $09654dffcb68affa$var$PARTIAL_VM_TO_NETWORK_MAP = {
75
69
  "TON"
76
70
  ],
77
71
  UTXO: [
78
- "BTICOIN",
72
+ "BITCOIN",
79
73
  "BITCOIN_TESTNET",
80
74
  "DOGECOIN",
81
75
  "LITECOIN"
@@ -87,9 +81,10 @@ const $09654dffcb68affa$var$PARTIAL_NETWORK_TO_VM_MAP = Object.entries($09654dff
87
81
  ...a,
88
82
  ...b
89
83
  }), {});
90
- function $09654dffcb68affa$export$2e2bcd8739ae039(block) {
84
+ function $09654dffcb68affa$export$ae001c77434c5340(block) {
91
85
  if (!block) return null;
92
- if ($09654dffcb68affa$var$PARTIAL_NETWORK_TO_VM_MAP[block._network]) return $09654dffcb68affa$var$PARTIAL_NETWORK_TO_VM_MAP[block._network];
86
+ const network = block._network.toUpperCase();
87
+ if ($09654dffcb68affa$var$PARTIAL_NETWORK_TO_VM_MAP[network]) return $09654dffcb68affa$var$PARTIAL_NETWORK_TO_VM_MAP[network];
93
88
  if (!!block.block) return "COSMOS";
94
89
  // "safe" default
95
90
  return "EVM";
@@ -98,10 +93,10 @@ function $09654dffcb68affa$export$2e2bcd8739ae039(block) {
98
93
 
99
94
 
100
95
  const $bea1ed486f96b980$export$ace043a4f2efe476 = {
101
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "APTOS",
96
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "APTOS",
102
97
  transform (block) {
103
98
  let transfers = [];
104
- for (const tx of block.transactions){
99
+ for (const tx of block.transactions || []){
105
100
  if (!tx?.events || !Array.isArray(tx.events)) continue;
106
101
  const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp, 10) / 1000).toISOString() : null;
107
102
  const gasUsed = BigInt(tx.gas_used || "0");
@@ -312,11 +307,11 @@ const $bea1ed486f96b980$export$ace043a4f2efe476 = {
312
307
 
313
308
 
314
309
  const $8860a67278817de8$export$893111d8d332e195 = {
315
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "CARDANO",
310
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "CARDANO",
316
311
  transform (block) {
317
312
  let transfers = [];
318
313
  const blockTimestamp = new Date(block.timestamp * 1000).toISOString();
319
- for (const tx of block.transactions){
314
+ for (const tx of block.transactions || []){
320
315
  const typedTx = tx;
321
316
  if (!Array.isArray(typedTx.operations)) continue;
322
317
  const transactionHash = typedTx.transaction_identifier?.hash || "";
@@ -385,7 +380,7 @@ const $8860a67278817de8$export$893111d8d332e195 = {
385
380
 
386
381
  var $8d6646508fb2fa58$require$Buffer = $hgUW1$Buffer;
387
382
  const $8d6646508fb2fa58$export$b5fd4920e8b7d913 = {
388
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "COSMOS",
383
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "COSMOS",
389
384
  transform (block) {
390
385
  let transfers = [];
391
386
  const typedBlock = block;
@@ -445,12 +440,10 @@ const $8d6646508fb2fa58$export$b5fd4920e8b7d913 = {
445
440
  var $fde9406d76ec24a9$exports = {};
446
441
  var $cc5213c20a6615f3$exports = {};
447
442
 
448
- $parcel$defineInteropFlag($cc5213c20a6615f3$exports);
443
+ $parcel$export($cc5213c20a6615f3$exports, "blockToTimestamp", () => $cc5213c20a6615f3$export$ec64f6024312bb14);
449
444
 
450
- $parcel$export($cc5213c20a6615f3$exports, "default", () => $cc5213c20a6615f3$export$2e2bcd8739ae039);
451
-
452
- function $cc5213c20a6615f3$export$2e2bcd8739ae039(block) {
453
- const vm = (0, $09654dffcb68affa$export$2e2bcd8739ae039)(block);
445
+ function $cc5213c20a6615f3$export$ec64f6024312bb14(block) {
446
+ const vm = (0, $09654dffcb68affa$export$ae001c77434c5340)(block);
454
447
  switch(vm){
455
448
  case "APTOS":
456
449
  return new Date(parseInt(block.transactions[0].timestamp, 10) / 1000);
@@ -643,7 +636,7 @@ function $8f1e0ae1ead9a2a9$export$685b7dc2197cd06c(rawBlock) {
643
636
  for (const k of [
644
637
  "miner"
645
638
  ])rawBlock[k] = (0, $42564d9f228fe302$export$db81f9ea057ab646)(rawBlock[k]);
646
- rawBlock.transactions = rawBlock.transactions.map((tx)=>{
639
+ rawBlock.transactions = (rawBlock.transactions || []).map((tx)=>{
647
640
  for (const k of [
648
641
  "blockNumber",
649
642
  "cumulativeGasUsed",
@@ -702,11 +695,11 @@ $parcel$exportWildcard($fde9406d76ec24a9$exports, $8f1e0ae1ead9a2a9$exports);
702
695
 
703
696
  const $5ec62a2088d070a8$var$NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
704
697
  const $5ec62a2088d070a8$export$5beebc5708fabf3c = {
705
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "EVM",
698
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "EVM",
706
699
  transform (block, _ctx) {
707
700
  const TOKEN_TYPES = _ctx.params.tokenTypes || [];
708
701
  let transfers = [];
709
- for (const tx of block.transactions){
702
+ for (const tx of block.transactions || []){
710
703
  if (!tx.receipt) continue;
711
704
  const timestamp = new Date(block.timestamp * 1000).toISOString();
712
705
  const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);
@@ -868,7 +861,7 @@ const $5ec62a2088d070a8$export$5beebc5708fabf3c = {
868
861
 
869
862
 
870
863
  const $548ae36ea3681b01$export$d7ac970e8e789607 = {
871
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "FILECOIN",
864
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "FILECOIN",
872
865
  transform (block) {
873
866
  let transfers = [];
874
867
  const typedBlock = block;
@@ -928,11 +921,11 @@ const $548ae36ea3681b01$export$d7ac970e8e789607 = {
928
921
 
929
922
 
930
923
  const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
931
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "RIPPLE",
924
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "RIPPLE",
932
925
  transform (block) {
933
926
  let transfers = [];
934
927
  if (!Array.isArray(block.transactions)) return [];
935
- for (const rawTx of block.transactions){
928
+ for (const rawTx of block.transactions || []){
936
929
  const typedTx = rawTx;
937
930
  if (typedTx.TransactionType !== "Payment") continue;
938
931
  const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? "0";
@@ -988,7 +981,7 @@ const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
988
981
 
989
982
 
990
983
  const $f9f6601c9222cc8e$export$722698bc663d0ac0 = {
991
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "SUI",
984
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "SUI",
992
985
  transform (block) {
993
986
  let transfers = [];
994
987
  const blockNumber = parseInt(block.sequence, 10);
@@ -1093,10 +1086,10 @@ const $f9f6601c9222cc8e$export$722698bc663d0ac0 = {
1093
1086
 
1094
1087
 
1095
1088
  const $64e1e522540ffc4e$export$a51565c56ceacb0a = {
1096
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "SVM",
1089
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "SVM",
1097
1090
  transform (block) {
1098
1091
  let transfers = [];
1099
- for (const tx of block.transactions){
1092
+ for (const tx of block.transactions || []){
1100
1093
  const svmTx = tx;
1101
1094
  const txHash = svmTx.transaction.signatures[0];
1102
1095
  const timestamp = block.blockTime ? new Date(block.blockTime * 1000).toISOString() : null;
@@ -1505,11 +1498,11 @@ const $64e1e522540ffc4e$export$a51565c56ceacb0a = {
1505
1498
 
1506
1499
 
1507
1500
  const $f7da547a9d6b4fc0$export$36783fc9701281c6 = {
1508
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "STARKNET",
1501
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "STARKNET",
1509
1502
  transform (block) {
1510
1503
  let transfers = [];
1511
1504
  if (!Array.isArray(block.transactions)) return [];
1512
- for (const tx of block.transactions){
1505
+ for (const tx of block.transactions || []){
1513
1506
  const typedTx = tx;
1514
1507
  const timestamp = block.timestamp ? new Date(block.timestamp * 1000).toISOString() : null;
1515
1508
  let transactionGasFee = BigInt(0);
@@ -1564,10 +1557,10 @@ const $f7da547a9d6b4fc0$export$36783fc9701281c6 = {
1564
1557
 
1565
1558
 
1566
1559
  const $725699ccb951d76d$export$681f497010b17679 = {
1567
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "STELLAR",
1560
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "STELLAR",
1568
1561
  transform (block) {
1569
1562
  let transfers = [];
1570
- for (const tx of block.transactions){
1563
+ for (const tx of block.transactions || []){
1571
1564
  const typedTx = tx;
1572
1565
  for (const op of typedTx.operations)if (op.type === "payment") transfers.push({
1573
1566
  amount: BigInt(op.amount.replace(".", "")),
@@ -1611,7 +1604,7 @@ const $725699ccb951d76d$export$681f497010b17679 = {
1611
1604
 
1612
1605
 
1613
1606
  const $13c3ff41f568666f$export$bc6c7ab7e0727dd7 = {
1614
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "SUBSTRATE",
1607
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "SUBSTRATE",
1615
1608
  transform (block) {
1616
1609
  let transfers = [];
1617
1610
  const typedBlock = block;
@@ -1667,7 +1660,7 @@ const $13c3ff41f568666f$export$bc6c7ab7e0727dd7 = {
1667
1660
 
1668
1661
 
1669
1662
  const $e97546fe39f2692a$export$608f3f42810b9879 = {
1670
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "TON",
1663
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "TON",
1671
1664
  transform (block) {
1672
1665
  let transfers = [];
1673
1666
  const blockNumber = block.seqno;
@@ -1733,7 +1726,7 @@ const $e97546fe39f2692a$export$608f3f42810b9879 = {
1733
1726
 
1734
1727
 
1735
1728
  const $532fac82d96b89f2$export$4f5322cf4718bd30 = {
1736
- match: (block)=>(0, $09654dffcb68affa$export$2e2bcd8739ae039)(block) === "UTXO",
1729
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "UTXO",
1737
1730
  transform (block) {
1738
1731
  let transfers = [];
1739
1732
  const timestamp = block.time ? new Date(block.time * 1000).toISOString() : null;
@@ -1880,12 +1873,12 @@ const $dc0c078500ed1fea$var$filterValuesTemplate = {
1880
1873
  params: [],
1881
1874
  transform: (block)=>{
1882
1875
  let finalValues = [];
1883
- const vm = block._vm || (0, $09654dffcb68affa$export$2e2bcd8739ae039)(block);
1876
+ const vm = block._vm || (0, $09654dffcb68affa$export$ae001c77434c5340)(block);
1884
1877
  switch(vm){
1885
1878
  case "APTOS":
1886
1879
  {
1887
1880
  const values = new Set();
1888
- for (const tx of block.transactions){
1881
+ for (const tx of block.transactions || []){
1889
1882
  values.add(tx.sender);
1890
1883
  if (!Array.isArray(tx.events)) continue;
1891
1884
  for (const evt of tx.events)values.add(evt.guid?.account_address);
@@ -1975,7 +1968,7 @@ const $dc0c078500ed1fea$var$filterValuesTemplate = {
1975
1968
  case "STELLAR":
1976
1969
  {
1977
1970
  const values = new Set();
1978
- for (const tx of block.transactions){
1971
+ for (const tx of block.transactions || []){
1979
1972
  values.add(tx.source_account);
1980
1973
  tx.operations?.forEach((op)=>{
1981
1974
  values.add(op.from);
@@ -2003,7 +1996,7 @@ const $dc0c078500ed1fea$var$filterValuesTemplate = {
2003
1996
  case "SUI":
2004
1997
  {
2005
1998
  const values = new Set();
2006
- for (const tx of block.transactions){
1999
+ for (const tx of block.transactions || []){
2007
2000
  values.add(tx.sender);
2008
2001
  tx.balanceChanges?.forEach((bc)=>{
2009
2002
  values.add(bc.owner);
@@ -2016,7 +2009,7 @@ const $dc0c078500ed1fea$var$filterValuesTemplate = {
2016
2009
  case "SVM":
2017
2010
  {
2018
2011
  const values = new Set();
2019
- for (const tx of block.transactions){
2012
+ for (const tx of block.transactions || []){
2020
2013
  tx.transaction.message.accountKeys.forEach((a)=>values.add(typeof a === "string" ? a : a.pubkey));
2021
2014
  tx.meta.postTokenBalances.concat(tx.meta.preTokenBalances).forEach((tb)=>{
2022
2015
  values.add(tb.owner);