@indexing/jiti 0.0.32 → 0.0.34

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
@@ -517,7 +517,7 @@ $parcel$exportWildcard($d7167569386d0d4c$exports, $414c83047563e72e$exports);
517
517
 
518
518
  const $8deaea1ef39b6485$var$NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
519
519
  const $8deaea1ef39b6485$export$5beebc5708fabf3c = {
520
- match: (block)=>true,
520
+ match: ()=>true,
521
521
  transform (block, _ctx) {
522
522
  const TOKEN_TYPES = _ctx.params.tokenTypes || [];
523
523
  let transfers = [];
@@ -654,6 +654,28 @@ const $8deaea1ef39b6485$export$5beebc5708fabf3c = {
654
654
  transactionHash: "0x69c9b12ccbe2d4f2f1dfc7c4a8557fc099fc5df276424417815acbc79a06fd56"
655
655
  }
656
656
  ]
657
+ },
658
+ {
659
+ params: {
660
+ network: "POLYGON",
661
+ walletAddress: "0x06D8c5E25B9aD46dA43FD71571E8a12aae341570",
662
+ contractAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"
663
+ },
664
+ payload: "https://jiti.indexing.co/networks/polygon/70623684",
665
+ output: [
666
+ {
667
+ amount: 4877821n,
668
+ blockNumber: 70623684,
669
+ from: "0xcb39c5b0db9c5b6bd1d9273dccc2f98f532a8bc6",
670
+ index: 0,
671
+ timestamp: "2025-04-22T17:51:55.000Z",
672
+ to: "0x06d8c5e25b9ad46da43fd71571e8a12aae341570",
673
+ token: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
674
+ tokenType: "TOKEN",
675
+ transactionGasFee: 8950898176621703n,
676
+ transactionHash: "0x5235cbe22deba5dd8a42f36024b1df1c0f82a8e901e6cc176a38e2fe49b1d2e3"
677
+ }
678
+ ]
657
679
  }
658
680
  ]
659
681
  };
@@ -949,7 +971,7 @@ const $290fd8bc430da9f0$export$1f0fe79deb1b813b = {
949
971
  transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
950
972
  }
951
973
  }
952
- for(let i = 1; i < solanaTx.meta.postBalances.length; i += 1){
974
+ for(let i = 0; i < solanaTx.meta.postBalances.length; i += 1){
953
975
  const post = solanaTx.meta.postBalances[i];
954
976
  const pre = solanaTx.meta.preBalances[i];
955
977
  if (post !== undefined && pre !== undefined && post !== pre) {
@@ -959,7 +981,7 @@ const $290fd8bc430da9f0$export$1f0fe79deb1b813b = {
959
981
  const txfer = {
960
982
  amount: diff,
961
983
  blockNumber: block.blockHeight,
962
- from: post > pre ? typeof allAccounts[0] === "string" ? allAccounts[0] : allAccounts[0]?.pubkey : typeof allAccounts[i] === "string" ? allAccounts[i] : allAccounts[i]?.pubkey,
984
+ from: typeof allAccounts[i] === "string" ? allAccounts[i] : allAccounts[i]?.pubkey,
963
985
  timestamp: timestamp,
964
986
  to: typeof allAccounts[i] === "string" ? allAccounts[i] : allAccounts[i]?.pubkey?.toString(),
965
987
  token: null,
@@ -967,9 +989,8 @@ const $290fd8bc430da9f0$export$1f0fe79deb1b813b = {
967
989
  transactionGasFee: txFee,
968
990
  transactionHash: txHash
969
991
  };
970
- if (post > pre) {
971
- if (transfersByKey[key]) delete txfer.from;
972
- } else delete txfer.to;
992
+ if (post > pre) delete txfer.from;
993
+ else delete txfer.to;
973
994
  transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
974
995
  }
975
996
  }
@@ -987,12 +1008,15 @@ const $290fd8bc430da9f0$export$1f0fe79deb1b813b = {
987
1008
  delete transfersByKey[key];
988
1009
  }
989
1010
  }
990
- for(const token in unmatchedFrom)if (unmatchedTo[token]?.length && unmatchedTo[token].reduce((a, b)=>a + BigInt(b.amount), BigInt(0)) - unmatchedFrom[token].reduce((a, b)=>a + BigInt(b.amount), BigInt(0)) === BigInt(0)) {
991
- unmatchedTo[token].sort((a, b)=>a.amount > b.amount ? 1 : -1);
992
- unmatchedFrom[token].forEach((um)=>{
993
- um.from = unmatchedTo[token][0].from;
994
- transfersByKey[`${token}-${um.amount.toString()}`] = um;
995
- });
1011
+ for(const token in unmatchedFrom)if (unmatchedTo[token]?.length && unmatchedFrom[token]?.length) {
1012
+ const unmatchedDiff = unmatchedTo[token].reduce((a, b)=>a + BigInt(b.amount), BigInt(0)) - unmatchedFrom[token].reduce((a, b)=>a + BigInt(b.amount), BigInt(0));
1013
+ if (unmatchedDiff === BigInt(0) || token === "null" && unmatchedDiff === txFee) {
1014
+ unmatchedTo[token].sort((a, b)=>a.amount > b.amount ? 1 : -1);
1015
+ unmatchedFrom[token].forEach((um)=>{
1016
+ um.from = unmatchedTo[token][0].from;
1017
+ transfersByKey[`${token}-${um.amount.toString()}`] = um;
1018
+ });
1019
+ }
996
1020
  }
997
1021
  transfers.push(...Object.values(transfersByKey));
998
1022
  }
@@ -1080,6 +1104,17 @@ const $290fd8bc430da9f0$export$1f0fe79deb1b813b = {
1080
1104
  },
1081
1105
  payload: "https://jiti.indexing.co/networks/solana/332450156",
1082
1106
  output: [
1107
+ {
1108
+ amount: 19796403663n,
1109
+ blockNumber: 310691098,
1110
+ timestamp: "2025-04-10T02:29:35.000Z",
1111
+ to: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
1112
+ transactionGasFee: 80001n,
1113
+ transactionHash: "32T7ANVqz1sHBoKhfk3omrRqwDCJFYMi6TfuAwyqHPCZPCihdWTU9t9i5D6tGwuytWRwRqnEXksMPMWbFbfBzVUk",
1114
+ token: "CniPCE4b3s8gSUPhUiyMjXnytrEqUrMfSsnbBjLCpump",
1115
+ tokenType: "TOKEN",
1116
+ from: "4acL7mD2J6GYJy2g3iVTvfpmHCQSZ1rb8DBuupjcVzHJ"
1117
+ },
1083
1118
  {
1084
1119
  amount: 402062750n,
1085
1120
  blockNumber: 310691098,
@@ -1101,17 +1136,6 @@ const $290fd8bc430da9f0$export$1f0fe79deb1b813b = {
1101
1136
  tokenType: "NATIVE",
1102
1137
  transactionGasFee: 80001n,
1103
1138
  transactionHash: "32T7ANVqz1sHBoKhfk3omrRqwDCJFYMi6TfuAwyqHPCZPCihdWTU9t9i5D6tGwuytWRwRqnEXksMPMWbFbfBzVUk"
1104
- },
1105
- {
1106
- amount: 19796403663n,
1107
- blockNumber: 310691098,
1108
- timestamp: "2025-04-10T02:29:35.000Z",
1109
- to: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
1110
- transactionGasFee: 80001n,
1111
- transactionHash: "32T7ANVqz1sHBoKhfk3omrRqwDCJFYMi6TfuAwyqHPCZPCihdWTU9t9i5D6tGwuytWRwRqnEXksMPMWbFbfBzVUk",
1112
- token: "CniPCE4b3s8gSUPhUiyMjXnytrEqUrMfSsnbBjLCpump",
1113
- tokenType: "TOKEN",
1114
- from: "4acL7mD2J6GYJy2g3iVTvfpmHCQSZ1rb8DBuupjcVzHJ"
1115
1139
  }
1116
1140
  ]
1117
1141
  },
@@ -1157,6 +1181,37 @@ const $290fd8bc430da9f0$export$1f0fe79deb1b813b = {
1157
1181
  transactionHash: "xKTWvnhSRErcHCMozRMEue4MriNr1Any6LiaQzXrR7imZ1MpZxRqbyv9LLg4JQoDq4oJZpDqPmzxLCtMCkgj2hn"
1158
1182
  }
1159
1183
  ]
1184
+ },
1185
+ {
1186
+ params: {
1187
+ network: "SOLANA",
1188
+ walletAddress: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz"
1189
+ },
1190
+ payload: "https://jiti.indexing.co/networks/solana/344836070",
1191
+ output: [
1192
+ {
1193
+ amount: 21234547656n,
1194
+ blockNumber: 323048342,
1195
+ from: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
1196
+ timestamp: "2025-06-05T18:30:59.000Z",
1197
+ transactionGasFee: 118174n,
1198
+ transactionHash: "2wQdUtEnCf77jiros6eCbQ1BrWrn1uw4nisy87kmgHhZMGX2CqBugaLdne6bvQR8mAdxinVLivcbVVfJAdTry2rw",
1199
+ token: "6MQpbiTC2YcogidTmKqMLK82qvE9z5QEm7EP3AEDpump",
1200
+ tokenType: "TOKEN",
1201
+ to: "ChkRerg6X89xHYqV4iBqcboBdU1WA8Uvs9fp2yZrqbg"
1202
+ },
1203
+ {
1204
+ amount: 3272427086n,
1205
+ blockNumber: 323048342,
1206
+ from: "DQwTf8dHkjtM6VuewpgET7MS7kX3EEXQDqvXkScC6tnB",
1207
+ timestamp: "2025-06-05T18:30:59.000Z",
1208
+ to: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
1209
+ token: null,
1210
+ tokenType: "NATIVE",
1211
+ transactionGasFee: 118174n,
1212
+ transactionHash: "2wQdUtEnCf77jiros6eCbQ1BrWrn1uw4nisy87kmgHhZMGX2CqBugaLdne6bvQR8mAdxinVLivcbVVfJAdTry2rw"
1213
+ }
1214
+ ]
1160
1215
  }
1161
1216
  ]
1162
1217
  };
@@ -1407,8 +1462,8 @@ const $990c4f660694d8bc$export$4f5322cf4718bd30 = {
1407
1462
  ].includes(block._network),
1408
1463
  transform (block) {
1409
1464
  let transfers = [];
1465
+ const timestamp = block.time ? new Date(block.time * 1000).toISOString() : null;
1410
1466
  for (const tx of block.tx){
1411
- const timestamp = tx.time ? new Date(tx.time * 1000).toISOString() : null;
1412
1467
  const vin = tx.vin[0];
1413
1468
  const vout = tx.vout;
1414
1469
  const fromVout = Math.min(vin.vout || 1000, vout.length - 1);