@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/module.js CHANGED
@@ -511,7 +511,7 @@ $parcel$exportWildcard($fde9406d76ec24a9$exports, $8f1e0ae1ead9a2a9$exports);
511
511
 
512
512
  const $5ec62a2088d070a8$var$NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
513
513
  const $5ec62a2088d070a8$export$5beebc5708fabf3c = {
514
- match: (block)=>true,
514
+ match: ()=>true,
515
515
  transform (block, _ctx) {
516
516
  const TOKEN_TYPES = _ctx.params.tokenTypes || [];
517
517
  let transfers = [];
@@ -648,6 +648,28 @@ const $5ec62a2088d070a8$export$5beebc5708fabf3c = {
648
648
  transactionHash: "0x69c9b12ccbe2d4f2f1dfc7c4a8557fc099fc5df276424417815acbc79a06fd56"
649
649
  }
650
650
  ]
651
+ },
652
+ {
653
+ params: {
654
+ network: "POLYGON",
655
+ walletAddress: "0x06D8c5E25B9aD46dA43FD71571E8a12aae341570",
656
+ contractAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"
657
+ },
658
+ payload: "https://jiti.indexing.co/networks/polygon/70623684",
659
+ output: [
660
+ {
661
+ amount: 4877821n,
662
+ blockNumber: 70623684,
663
+ from: "0xcb39c5b0db9c5b6bd1d9273dccc2f98f532a8bc6",
664
+ index: 0,
665
+ timestamp: "2025-04-22T17:51:55.000Z",
666
+ to: "0x06d8c5e25b9ad46da43fd71571e8a12aae341570",
667
+ token: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
668
+ tokenType: "TOKEN",
669
+ transactionGasFee: 8950898176621703n,
670
+ transactionHash: "0x5235cbe22deba5dd8a42f36024b1df1c0f82a8e901e6cc176a38e2fe49b1d2e3"
671
+ }
672
+ ]
651
673
  }
652
674
  ]
653
675
  };
@@ -943,7 +965,7 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
943
965
  transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
944
966
  }
945
967
  }
946
- for(let i = 1; i < solanaTx.meta.postBalances.length; i += 1){
968
+ for(let i = 0; i < solanaTx.meta.postBalances.length; i += 1){
947
969
  const post = solanaTx.meta.postBalances[i];
948
970
  const pre = solanaTx.meta.preBalances[i];
949
971
  if (post !== undefined && pre !== undefined && post !== pre) {
@@ -953,7 +975,7 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
953
975
  const txfer = {
954
976
  amount: diff,
955
977
  blockNumber: block.blockHeight,
956
- from: post > pre ? typeof allAccounts[0] === "string" ? allAccounts[0] : allAccounts[0]?.pubkey : typeof allAccounts[i] === "string" ? allAccounts[i] : allAccounts[i]?.pubkey,
978
+ from: typeof allAccounts[i] === "string" ? allAccounts[i] : allAccounts[i]?.pubkey,
957
979
  timestamp: timestamp,
958
980
  to: typeof allAccounts[i] === "string" ? allAccounts[i] : allAccounts[i]?.pubkey?.toString(),
959
981
  token: null,
@@ -961,9 +983,8 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
961
983
  transactionGasFee: txFee,
962
984
  transactionHash: txHash
963
985
  };
964
- if (post > pre) {
965
- if (transfersByKey[key]) delete txfer.from;
966
- } else delete txfer.to;
986
+ if (post > pre) delete txfer.from;
987
+ else delete txfer.to;
967
988
  transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
968
989
  }
969
990
  }
@@ -981,12 +1002,15 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
981
1002
  delete transfersByKey[key];
982
1003
  }
983
1004
  }
984
- 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)) {
985
- unmatchedTo[token].sort((a, b)=>a.amount > b.amount ? 1 : -1);
986
- unmatchedFrom[token].forEach((um)=>{
987
- um.from = unmatchedTo[token][0].from;
988
- transfersByKey[`${token}-${um.amount.toString()}`] = um;
989
- });
1005
+ for(const token in unmatchedFrom)if (unmatchedTo[token]?.length && unmatchedFrom[token]?.length) {
1006
+ const unmatchedDiff = unmatchedTo[token].reduce((a, b)=>a + BigInt(b.amount), BigInt(0)) - unmatchedFrom[token].reduce((a, b)=>a + BigInt(b.amount), BigInt(0));
1007
+ if (unmatchedDiff === BigInt(0) || token === "null" && unmatchedDiff === txFee) {
1008
+ unmatchedTo[token].sort((a, b)=>a.amount > b.amount ? 1 : -1);
1009
+ unmatchedFrom[token].forEach((um)=>{
1010
+ um.from = unmatchedTo[token][0].from;
1011
+ transfersByKey[`${token}-${um.amount.toString()}`] = um;
1012
+ });
1013
+ }
990
1014
  }
991
1015
  transfers.push(...Object.values(transfersByKey));
992
1016
  }
@@ -1074,6 +1098,17 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
1074
1098
  },
1075
1099
  payload: "https://jiti.indexing.co/networks/solana/332450156",
1076
1100
  output: [
1101
+ {
1102
+ amount: 19796403663n,
1103
+ blockNumber: 310691098,
1104
+ timestamp: "2025-04-10T02:29:35.000Z",
1105
+ to: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
1106
+ transactionGasFee: 80001n,
1107
+ transactionHash: "32T7ANVqz1sHBoKhfk3omrRqwDCJFYMi6TfuAwyqHPCZPCihdWTU9t9i5D6tGwuytWRwRqnEXksMPMWbFbfBzVUk",
1108
+ token: "CniPCE4b3s8gSUPhUiyMjXnytrEqUrMfSsnbBjLCpump",
1109
+ tokenType: "TOKEN",
1110
+ from: "4acL7mD2J6GYJy2g3iVTvfpmHCQSZ1rb8DBuupjcVzHJ"
1111
+ },
1077
1112
  {
1078
1113
  amount: 402062750n,
1079
1114
  blockNumber: 310691098,
@@ -1095,17 +1130,6 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
1095
1130
  tokenType: "NATIVE",
1096
1131
  transactionGasFee: 80001n,
1097
1132
  transactionHash: "32T7ANVqz1sHBoKhfk3omrRqwDCJFYMi6TfuAwyqHPCZPCihdWTU9t9i5D6tGwuytWRwRqnEXksMPMWbFbfBzVUk"
1098
- },
1099
- {
1100
- amount: 19796403663n,
1101
- blockNumber: 310691098,
1102
- timestamp: "2025-04-10T02:29:35.000Z",
1103
- to: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
1104
- transactionGasFee: 80001n,
1105
- transactionHash: "32T7ANVqz1sHBoKhfk3omrRqwDCJFYMi6TfuAwyqHPCZPCihdWTU9t9i5D6tGwuytWRwRqnEXksMPMWbFbfBzVUk",
1106
- token: "CniPCE4b3s8gSUPhUiyMjXnytrEqUrMfSsnbBjLCpump",
1107
- tokenType: "TOKEN",
1108
- from: "4acL7mD2J6GYJy2g3iVTvfpmHCQSZ1rb8DBuupjcVzHJ"
1109
1133
  }
1110
1134
  ]
1111
1135
  },
@@ -1151,6 +1175,37 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
1151
1175
  transactionHash: "xKTWvnhSRErcHCMozRMEue4MriNr1Any6LiaQzXrR7imZ1MpZxRqbyv9LLg4JQoDq4oJZpDqPmzxLCtMCkgj2hn"
1152
1176
  }
1153
1177
  ]
1178
+ },
1179
+ {
1180
+ params: {
1181
+ network: "SOLANA",
1182
+ walletAddress: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz"
1183
+ },
1184
+ payload: "https://jiti.indexing.co/networks/solana/344836070",
1185
+ output: [
1186
+ {
1187
+ amount: 21234547656n,
1188
+ blockNumber: 323048342,
1189
+ from: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
1190
+ timestamp: "2025-06-05T18:30:59.000Z",
1191
+ transactionGasFee: 118174n,
1192
+ transactionHash: "2wQdUtEnCf77jiros6eCbQ1BrWrn1uw4nisy87kmgHhZMGX2CqBugaLdne6bvQR8mAdxinVLivcbVVfJAdTry2rw",
1193
+ token: "6MQpbiTC2YcogidTmKqMLK82qvE9z5QEm7EP3AEDpump",
1194
+ tokenType: "TOKEN",
1195
+ to: "ChkRerg6X89xHYqV4iBqcboBdU1WA8Uvs9fp2yZrqbg"
1196
+ },
1197
+ {
1198
+ amount: 3272427086n,
1199
+ blockNumber: 323048342,
1200
+ from: "DQwTf8dHkjtM6VuewpgET7MS7kX3EEXQDqvXkScC6tnB",
1201
+ timestamp: "2025-06-05T18:30:59.000Z",
1202
+ to: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
1203
+ token: null,
1204
+ tokenType: "NATIVE",
1205
+ transactionGasFee: 118174n,
1206
+ transactionHash: "2wQdUtEnCf77jiros6eCbQ1BrWrn1uw4nisy87kmgHhZMGX2CqBugaLdne6bvQR8mAdxinVLivcbVVfJAdTry2rw"
1207
+ }
1208
+ ]
1154
1209
  }
1155
1210
  ]
1156
1211
  };
@@ -1401,8 +1456,8 @@ const $532fac82d96b89f2$export$4f5322cf4718bd30 = {
1401
1456
  ].includes(block._network),
1402
1457
  transform (block) {
1403
1458
  let transfers = [];
1459
+ const timestamp = block.time ? new Date(block.time * 1000).toISOString() : null;
1404
1460
  for (const tx of block.tx){
1405
- const timestamp = tx.time ? new Date(tx.time * 1000).toISOString() : null;
1406
1461
  const vin = tx.vin[0];
1407
1462
  const vout = tx.vout;
1408
1463
  const fromVout = Math.min(vin.vout || 1000, vout.length - 1);