@indexing/jiti 0.0.27 → 0.0.28
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 +127 -51
- package/dist/main.js.map +1 -1
- package/dist/module.js +128 -52
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -278,6 +278,7 @@ $parcel$exportWildcard($d7167569386d0d4c$exports, $414c83047563e72e$exports);
|
|
|
278
278
|
|
|
279
279
|
|
|
280
280
|
|
|
281
|
+
|
|
281
282
|
var $6144a02851f23907$require$Buffer = $8zHUo$buffer.Buffer;
|
|
282
283
|
const $6144a02851f23907$var$NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
283
284
|
const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
@@ -332,32 +333,43 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
332
333
|
case "APTOS_TESTNET":
|
|
333
334
|
for (const tx of block.transactions){
|
|
334
335
|
if (!tx?.events || !Array.isArray(tx.events)) continue;
|
|
335
|
-
const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp) / 1000).toISOString() : null;
|
|
336
|
-
const
|
|
337
|
-
for (const evt of tx.events)
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
336
|
+
const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp, 10) / 1000).toISOString() : null;
|
|
337
|
+
const transfersByKey = {};
|
|
338
|
+
for (const evt of tx.events){
|
|
339
|
+
const evtType = evt.type;
|
|
340
|
+
if (/::(Withdraw|Deposit)[^:]*/.test(evtType)) {
|
|
341
|
+
const data = evt.data;
|
|
342
|
+
const amount = data.amount;
|
|
343
|
+
const accountAddr = data.store_owner || evt.guid?.account_address || "";
|
|
344
|
+
let tokenAddr = "0x1::aptos_coin::AptosCoin";
|
|
345
|
+
if (data.store) tokenAddr = tx.changes.find((c)=>c.address === data.store && c.data.type === "0x1::fungible_asset::FungibleStore")?.data?.data?.metadata?.inner || data.store;
|
|
346
|
+
const compositeKey = `${tx.hash}-${tokenAddr}-${amount}`;
|
|
347
|
+
if (!transfersByKey[compositeKey]) transfersByKey[compositeKey] = {
|
|
348
|
+
amount: amount,
|
|
349
|
+
tokenAddress: tokenAddr
|
|
350
|
+
};
|
|
351
|
+
if (/::Withdraw[^:]*/.test(evtType)) transfersByKey[compositeKey].from = accountAddr;
|
|
352
|
+
else transfersByKey[compositeKey].to = accountAddr;
|
|
353
|
+
}
|
|
349
354
|
}
|
|
350
|
-
for (const partial of Object.values(
|
|
355
|
+
for (const partial of Object.values(transfersByKey)){
|
|
351
356
|
if (!partial.from || !partial.to) continue;
|
|
357
|
+
const fromAddr = partial.from.length < 66 ? `0x0${partial.from.slice(2)}` : partial.from;
|
|
358
|
+
const toAddr = partial.to.length < 66 ? `0x0${partial.to.slice(2)}` : partial.to;
|
|
359
|
+
let finalToken = null;
|
|
360
|
+
let finalTokenType = "TOKEN";
|
|
361
|
+
if (partial.tokenAddress?.toLowerCase().includes("aptos_coin")) finalToken = null;
|
|
362
|
+
else finalToken = partial.tokenAddress?.toLowerCase();
|
|
363
|
+
const gasUsed = BigInt(tx.gas_used || "0");
|
|
352
364
|
transfers.push({
|
|
353
365
|
amount: BigInt(partial.amount),
|
|
354
|
-
blockNumber: parseInt(block.block_height),
|
|
355
|
-
from:
|
|
366
|
+
blockNumber: parseInt(block.block_height, 10),
|
|
367
|
+
from: fromAddr,
|
|
368
|
+
to: toAddr,
|
|
356
369
|
timestamp: timestamp,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
transactionGasFee: BigInt(tx.gas_used),
|
|
370
|
+
token: finalToken,
|
|
371
|
+
tokenType: finalTokenType,
|
|
372
|
+
transactionGasFee: gasUsed,
|
|
361
373
|
transactionHash: tx.hash
|
|
362
374
|
});
|
|
363
375
|
}
|
|
@@ -705,6 +717,38 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
705
717
|
}
|
|
706
718
|
break;
|
|
707
719
|
}
|
|
720
|
+
case "FILECOIN":
|
|
721
|
+
{
|
|
722
|
+
const typedBlock = block;
|
|
723
|
+
const blockNumber = typedBlock.Height;
|
|
724
|
+
const blockTimestamp = new Date(typedBlock.Blocks[0].Timestamp * 1000).toISOString();
|
|
725
|
+
const parentBaseFee = BigInt(typedBlock.Blocks[0].ParentBaseFee);
|
|
726
|
+
let receiptIndex = 0;
|
|
727
|
+
for (const msgGroup of typedBlock.messages){
|
|
728
|
+
const secpkMessages = msgGroup.blockMessages.SecpkMessages || [];
|
|
729
|
+
for (const msg of secpkMessages){
|
|
730
|
+
const receipt = typedBlock.receipts[receiptIndex++];
|
|
731
|
+
const gasUsed = BigInt(receipt.GasUsed);
|
|
732
|
+
const gasFeeCap = BigInt(msg.Message.GasFeeCap);
|
|
733
|
+
const gasPremium = BigInt(msg.Message.GasPremium);
|
|
734
|
+
const baseFeeBurn = gasUsed * parentBaseFee;
|
|
735
|
+
const minerTip = gasUsed * (gasPremium < gasFeeCap - parentBaseFee ? gasPremium : gasFeeCap - parentBaseFee);
|
|
736
|
+
const transactionGasFee = baseFeeBurn + minerTip;
|
|
737
|
+
transfers.push({
|
|
738
|
+
amount: BigInt(msg.Message.Value),
|
|
739
|
+
blockNumber: blockNumber,
|
|
740
|
+
from: msg.Message.From,
|
|
741
|
+
to: msg.Message.To,
|
|
742
|
+
token: null,
|
|
743
|
+
tokenType: "NATIVE",
|
|
744
|
+
timestamp: blockTimestamp,
|
|
745
|
+
transactionGasFee: transactionGasFee,
|
|
746
|
+
transactionHash: msg.CID["/"]
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
708
752
|
// attempt to introspect data types
|
|
709
753
|
default:
|
|
710
754
|
// try Cosmos
|
|
@@ -712,9 +756,9 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
712
756
|
const typedBlock = block;
|
|
713
757
|
const blockNumber = Number(typedBlock.block.header.height);
|
|
714
758
|
const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();
|
|
715
|
-
const blockHash = typedBlock.block_id.hash;
|
|
716
759
|
for (const txRaw of typedBlock.block.data.txs || []){
|
|
717
760
|
const decoded = (0, $8zHUo$cosmjsprotosigning.decodeTxRaw)(new Uint8Array($6144a02851f23907$require$Buffer.from(txRaw, "base64")));
|
|
761
|
+
const txHash = (0, $8zHUo$viem.sha256)(new Uint8Array($6144a02851f23907$require$Buffer.from(txRaw, "base64")));
|
|
718
762
|
const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || "0");
|
|
719
763
|
const registry = new (0, $8zHUo$cosmjsprotosigning.Registry)((0, $8zHUo$cosmjsstargate.defaultRegistryTypes));
|
|
720
764
|
for (const message of decoded.body.messages)if ([
|
|
@@ -730,7 +774,7 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
730
774
|
token: decodedMsg.token.denom,
|
|
731
775
|
tokenType: "NATIVE",
|
|
732
776
|
timestamp: blockTimestamp,
|
|
733
|
-
transactionHash:
|
|
777
|
+
transactionHash: txHash.slice(2).toUpperCase(),
|
|
734
778
|
transactionGasFee: transactionGasFee
|
|
735
779
|
});
|
|
736
780
|
}
|
|
@@ -869,24 +913,56 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
869
913
|
{
|
|
870
914
|
params: {
|
|
871
915
|
network: "APTOS",
|
|
872
|
-
walletAddress: "
|
|
873
|
-
contractAddress: "
|
|
916
|
+
walletAddress: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
917
|
+
contractAddress: "0x3b5d2e7e8da86903beb19d5a7135764aac812e18af193895d75f3a8f6a066cb0"
|
|
874
918
|
},
|
|
875
919
|
payload: "https://jiti.indexing.co/networks/aptos/297956660",
|
|
876
920
|
output: [
|
|
877
921
|
{
|
|
878
|
-
amount:
|
|
922
|
+
amount: 1611839920n,
|
|
879
923
|
blockNumber: 297956660,
|
|
880
924
|
from: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
925
|
+
to: "0x3b5d2e7e8da86903beb19d5a7135764aac812e18af193895d75f3a8f6a066cb0",
|
|
881
926
|
timestamp: "2025-03-02T21:07:06.002Z",
|
|
927
|
+
token: null,
|
|
928
|
+
tokenType: "TOKEN",
|
|
929
|
+
transactionGasFee: 13n,
|
|
930
|
+
transactionHash: "0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13"
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
amount: 1502138836n,
|
|
934
|
+
blockNumber: 297956660,
|
|
935
|
+
from: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
882
936
|
to: "0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e",
|
|
937
|
+
timestamp: "2025-03-02T21:07:06.002Z",
|
|
883
938
|
token: null,
|
|
884
|
-
tokenType: "
|
|
939
|
+
tokenType: "TOKEN",
|
|
885
940
|
transactionGasFee: 13n,
|
|
886
941
|
transactionHash: "0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13"
|
|
887
942
|
}
|
|
888
943
|
]
|
|
889
944
|
},
|
|
945
|
+
// APTOS
|
|
946
|
+
{
|
|
947
|
+
params: {
|
|
948
|
+
network: "APTOS",
|
|
949
|
+
contractAddress: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"
|
|
950
|
+
},
|
|
951
|
+
payload: "https://jiti.indexing.co/networks/aptos/303623631",
|
|
952
|
+
output: [
|
|
953
|
+
{
|
|
954
|
+
amount: 1000060n,
|
|
955
|
+
blockNumber: 303623631,
|
|
956
|
+
from: "0xa4e7455d27731ab857e9701b1e6ed72591132b909fe6e4fd99b66c1d6318d9e8",
|
|
957
|
+
timestamp: "2025-03-14T15:39:49.845Z",
|
|
958
|
+
to: "0x9317336bfc9ba6987d40492ddea8d41e11b7c2e473f3556a9c82309d326e79ce",
|
|
959
|
+
token: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b",
|
|
960
|
+
tokenType: "TOKEN",
|
|
961
|
+
transactionGasFee: 16n,
|
|
962
|
+
transactionHash: "0x24b8854bad1f6543b35069eacd6ec40a583ca7fa452b422b04d747d24b65279c"
|
|
963
|
+
}
|
|
964
|
+
]
|
|
965
|
+
},
|
|
890
966
|
// BASE
|
|
891
967
|
{
|
|
892
968
|
params: {
|
|
@@ -954,6 +1030,28 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
954
1030
|
}
|
|
955
1031
|
]
|
|
956
1032
|
},
|
|
1033
|
+
// COSMOS
|
|
1034
|
+
{
|
|
1035
|
+
params: {
|
|
1036
|
+
network: "COSMOS",
|
|
1037
|
+
walletAddress: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
1038
|
+
contractAddress: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
|
|
1039
|
+
},
|
|
1040
|
+
payload: "https://jiti.indexing.co/networks/cosmos/24419691",
|
|
1041
|
+
output: [
|
|
1042
|
+
{
|
|
1043
|
+
blockNumber: 24419691,
|
|
1044
|
+
from: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
1045
|
+
to: "noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv",
|
|
1046
|
+
amount: 500000n,
|
|
1047
|
+
token: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013",
|
|
1048
|
+
tokenType: "NATIVE",
|
|
1049
|
+
timestamp: "2025-02-14T21:48:22.809Z",
|
|
1050
|
+
transactionHash: "963D4D7BB59C1280F58A7ECA2F1934E2AA005109A989193C815C7B98EDCD7445",
|
|
1051
|
+
transactionGasFee: 4860n
|
|
1052
|
+
}
|
|
1053
|
+
]
|
|
1054
|
+
},
|
|
957
1055
|
// DOGECOIN
|
|
958
1056
|
{
|
|
959
1057
|
params: {
|
|
@@ -976,7 +1074,7 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
976
1074
|
}
|
|
977
1075
|
]
|
|
978
1076
|
},
|
|
979
|
-
//FILECOIN
|
|
1077
|
+
// FILECOIN
|
|
980
1078
|
{
|
|
981
1079
|
params: {
|
|
982
1080
|
network: "FILECOIN",
|
|
@@ -1064,7 +1162,7 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
1064
1162
|
}
|
|
1065
1163
|
]
|
|
1066
1164
|
},
|
|
1067
|
-
//SUI
|
|
1165
|
+
// SUI
|
|
1068
1166
|
{
|
|
1069
1167
|
params: {
|
|
1070
1168
|
network: "SUI",
|
|
@@ -1108,28 +1206,6 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
1108
1206
|
}
|
|
1109
1207
|
]
|
|
1110
1208
|
},
|
|
1111
|
-
// COSMOS
|
|
1112
|
-
{
|
|
1113
|
-
params: {
|
|
1114
|
-
network: "COSMOS",
|
|
1115
|
-
walletAddress: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
1116
|
-
contractAddress: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
|
|
1117
|
-
},
|
|
1118
|
-
payload: "https://jiti.indexing.co/networks/cosmos/24419691",
|
|
1119
|
-
output: [
|
|
1120
|
-
{
|
|
1121
|
-
blockNumber: 24419691,
|
|
1122
|
-
from: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
1123
|
-
to: "noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv",
|
|
1124
|
-
amount: 500000n,
|
|
1125
|
-
token: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013",
|
|
1126
|
-
tokenType: "NATIVE",
|
|
1127
|
-
timestamp: "2025-02-14T21:48:22.809Z",
|
|
1128
|
-
transactionHash: "DF5FB086E60EE2ADA3A842751337E06A40696D7983CC1C038ADE236B36ED8AEB",
|
|
1129
|
-
transactionGasFee: 4860n
|
|
1130
|
-
}
|
|
1131
|
-
]
|
|
1132
|
-
},
|
|
1133
1209
|
// SOLANA
|
|
1134
1210
|
{
|
|
1135
1211
|
params: {
|