@indexing/jiti 0.0.44 → 0.0.46

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 CHANGED
@@ -79,7 +79,7 @@ const $6bd2ca253e883278$var$PARTIAL_VM_TO_NETWORK_MAP = {
79
79
  "TON"
80
80
  ],
81
81
  UTXO: [
82
- "BTICOIN",
82
+ "BITCOIN",
83
83
  "BITCOIN_TESTNET",
84
84
  "DOGECOIN",
85
85
  "LITECOIN"
@@ -93,7 +93,8 @@ const $6bd2ca253e883278$var$PARTIAL_NETWORK_TO_VM_MAP = Object.entries($6bd2ca25
93
93
  }), {});
94
94
  function $6bd2ca253e883278$export$ae001c77434c5340(block) {
95
95
  if (!block) return null;
96
- if ($6bd2ca253e883278$var$PARTIAL_NETWORK_TO_VM_MAP[block._network]) return $6bd2ca253e883278$var$PARTIAL_NETWORK_TO_VM_MAP[block._network];
96
+ const network = block._network.toUpperCase();
97
+ if ($6bd2ca253e883278$var$PARTIAL_NETWORK_TO_VM_MAP[network]) return $6bd2ca253e883278$var$PARTIAL_NETWORK_TO_VM_MAP[network];
97
98
  if (!!block.block) return "COSMOS";
98
99
  // "safe" default
99
100
  return "EVM";
@@ -105,7 +106,7 @@ const $25d5bdd23cba31eb$export$ace043a4f2efe476 = {
105
106
  match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "APTOS",
106
107
  transform (block) {
107
108
  let transfers = [];
108
- for (const tx of block.transactions){
109
+ for (const tx of block.transactions || []){
109
110
  if (!tx?.events || !Array.isArray(tx.events)) continue;
110
111
  const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp, 10) / 1000).toISOString() : null;
111
112
  const gasUsed = BigInt(tx.gas_used || "0");
@@ -320,7 +321,7 @@ const $60d24c82dc5feb2e$export$893111d8d332e195 = {
320
321
  transform (block) {
321
322
  let transfers = [];
322
323
  const blockTimestamp = new Date(block.timestamp * 1000).toISOString();
323
- for (const tx of block.transactions){
324
+ for (const tx of block.transactions || []){
324
325
  const typedTx = tx;
325
326
  if (!Array.isArray(typedTx.operations)) continue;
326
327
  const transactionHash = typedTx.transaction_identifier?.hash || "";
@@ -645,7 +646,7 @@ function $414c83047563e72e$export$685b7dc2197cd06c(rawBlock) {
645
646
  for (const k of [
646
647
  "miner"
647
648
  ])rawBlock[k] = (0, $596a656635c74d50$export$db81f9ea057ab646)(rawBlock[k]);
648
- rawBlock.transactions = rawBlock.transactions.map((tx)=>{
649
+ rawBlock.transactions = (rawBlock.transactions || []).map((tx)=>{
649
650
  for (const k of [
650
651
  "blockNumber",
651
652
  "cumulativeGasUsed",
@@ -708,7 +709,7 @@ const $8deaea1ef39b6485$export$5beebc5708fabf3c = {
708
709
  transform (block, _ctx) {
709
710
  const TOKEN_TYPES = _ctx.params.tokenTypes || [];
710
711
  let transfers = [];
711
- for (const tx of block.transactions){
712
+ for (const tx of block.transactions || []){
712
713
  if (!tx.receipt) continue;
713
714
  const timestamp = new Date(block.timestamp * 1000).toISOString();
714
715
  const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);
@@ -934,7 +935,7 @@ const $2e46ec862e47c14f$export$400f08bfae9ee97f = {
934
935
  transform (block) {
935
936
  let transfers = [];
936
937
  if (!Array.isArray(block.transactions)) return [];
937
- for (const rawTx of block.transactions){
938
+ for (const rawTx of block.transactions || []){
938
939
  const typedTx = rawTx;
939
940
  if (typedTx.TransactionType !== "Payment") continue;
940
941
  const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? "0";
@@ -1098,7 +1099,7 @@ const $fc7ca671efecc378$export$a51565c56ceacb0a = {
1098
1099
  match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "SVM",
1099
1100
  transform (block) {
1100
1101
  let transfers = [];
1101
- for (const tx of block.transactions){
1102
+ for (const tx of block.transactions || []){
1102
1103
  const svmTx = tx;
1103
1104
  const txHash = svmTx.transaction.signatures[0];
1104
1105
  const timestamp = block.blockTime ? new Date(block.blockTime * 1000).toISOString() : null;
@@ -1511,7 +1512,7 @@ const $fc745f3cb8eb3f52$export$36783fc9701281c6 = {
1511
1512
  transform (block) {
1512
1513
  let transfers = [];
1513
1514
  if (!Array.isArray(block.transactions)) return [];
1514
- for (const tx of block.transactions){
1515
+ for (const tx of block.transactions || []){
1515
1516
  const typedTx = tx;
1516
1517
  const timestamp = block.timestamp ? new Date(block.timestamp * 1000).toISOString() : null;
1517
1518
  let transactionGasFee = BigInt(0);
@@ -1569,7 +1570,7 @@ const $3478cd776d185339$export$681f497010b17679 = {
1569
1570
  match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "STELLAR",
1570
1571
  transform (block) {
1571
1572
  let transfers = [];
1572
- for (const tx of block.transactions){
1573
+ for (const tx of block.transactions || []){
1573
1574
  const typedTx = tx;
1574
1575
  for (const op of typedTx.operations)if (op.type === "payment") transfers.push({
1575
1576
  amount: BigInt(op.amount.replace(".", "")),
@@ -1855,11 +1856,13 @@ const $7dd402f6ad0dab6a$var$tokenTransfersTemplate = {
1855
1856
  const seenTransfers = new Set();
1856
1857
  transfers = transfers.filter((txfer)=>{
1857
1858
  if (txfer.amount <= BigInt(0)) return false;
1858
- if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token) return false;
1859
- if (_ctx.params.walletAddress && ![
1860
- txfer.from,
1861
- txfer.to
1862
- ].includes(_ctx.params.walletAddress)) return false;
1859
+ if (_ctx?.params) {
1860
+ if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token) return false;
1861
+ if (_ctx.params.walletAddress && ![
1862
+ txfer.from,
1863
+ txfer.to
1864
+ ].includes(_ctx.params.walletAddress)) return false;
1865
+ }
1863
1866
  const key = `${txfer.transactionHash}-${txfer.from}-${txfer.to}-${txfer.amount}-${txfer.token}`;
1864
1867
  if (seenTransfers.has(key)) return false;
1865
1868
  seenTransfers.add(key);
@@ -1887,7 +1890,7 @@ const $9af31dbb692f94e3$var$filterValuesTemplate = {
1887
1890
  case "APTOS":
1888
1891
  {
1889
1892
  const values = new Set();
1890
- for (const tx of block.transactions){
1893
+ for (const tx of block.transactions || []){
1891
1894
  values.add(tx.sender);
1892
1895
  if (!Array.isArray(tx.events)) continue;
1893
1896
  for (const evt of tx.events)values.add(evt.guid?.account_address);
@@ -1977,7 +1980,7 @@ const $9af31dbb692f94e3$var$filterValuesTemplate = {
1977
1980
  case "STELLAR":
1978
1981
  {
1979
1982
  const values = new Set();
1980
- for (const tx of block.transactions){
1983
+ for (const tx of block.transactions || []){
1981
1984
  values.add(tx.source_account);
1982
1985
  tx.operations?.forEach((op)=>{
1983
1986
  values.add(op.from);
@@ -2005,7 +2008,7 @@ const $9af31dbb692f94e3$var$filterValuesTemplate = {
2005
2008
  case "SUI":
2006
2009
  {
2007
2010
  const values = new Set();
2008
- for (const tx of block.transactions){
2011
+ for (const tx of block.transactions || []){
2009
2012
  values.add(tx.sender);
2010
2013
  tx.balanceChanges?.forEach((bc)=>{
2011
2014
  values.add(bc.owner);
@@ -2018,7 +2021,7 @@ const $9af31dbb692f94e3$var$filterValuesTemplate = {
2018
2021
  case "SVM":
2019
2022
  {
2020
2023
  const values = new Set();
2021
- for (const tx of block.transactions){
2024
+ for (const tx of block.transactions || []){
2022
2025
  tx.transaction.message.accountKeys.forEach((a)=>values.add(typeof a === "string" ? a : a.pubkey));
2023
2026
  tx.meta.postTokenBalances.concat(tx.meta.preTokenBalances).forEach((tb)=>{
2024
2027
  values.add(tb.owner);