@indexing/jiti 0.0.27 → 0.0.29
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 +174 -75
- package/dist/main.js.map +1 -1
- package/dist/module.js +175 -76
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/module.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Buffer as $hgUW1$Buffer} from "buffer";
|
|
2
2
|
import {decodeTxRaw as $hgUW1$decodeTxRaw, Registry as $hgUW1$Registry} from "@cosmjs/proto-signing";
|
|
3
3
|
import {defaultRegistryTypes as $hgUW1$defaultRegistryTypes} from "@cosmjs/stargate";
|
|
4
|
-
import {keccak256 as $hgUW1$keccak256, decodeEventLog as $hgUW1$decodeEventLog, parseAbi as $hgUW1$parseAbi} from "viem";
|
|
4
|
+
import {sha256 as $hgUW1$sha256, keccak256 as $hgUW1$keccak256, decodeEventLog as $hgUW1$decodeEventLog, parseAbi as $hgUW1$parseAbi} from "viem";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
function $parcel$exportWildcard(dest, source) {
|
|
@@ -272,6 +272,7 @@ $parcel$exportWildcard($fde9406d76ec24a9$exports, $8f1e0ae1ead9a2a9$exports);
|
|
|
272
272
|
|
|
273
273
|
|
|
274
274
|
|
|
275
|
+
|
|
275
276
|
var $c18434deda90759d$require$Buffer = $hgUW1$Buffer;
|
|
276
277
|
const $c18434deda90759d$var$NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
277
278
|
const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
@@ -326,32 +327,43 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
326
327
|
case "APTOS_TESTNET":
|
|
327
328
|
for (const tx of block.transactions){
|
|
328
329
|
if (!tx?.events || !Array.isArray(tx.events)) continue;
|
|
329
|
-
const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp) / 1000).toISOString() : null;
|
|
330
|
-
const
|
|
331
|
-
for (const evt of tx.events)
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
330
|
+
const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp, 10) / 1000).toISOString() : null;
|
|
331
|
+
const transfersByKey = {};
|
|
332
|
+
for (const evt of tx.events){
|
|
333
|
+
const evtType = evt.type;
|
|
334
|
+
if (/::(Withdraw|Deposit)[^:]*/.test(evtType)) {
|
|
335
|
+
const data = evt.data;
|
|
336
|
+
const amount = data.amount;
|
|
337
|
+
const accountAddr = data.store_owner || evt.guid?.account_address || "";
|
|
338
|
+
let tokenAddr = "0x1::aptos_coin::AptosCoin";
|
|
339
|
+
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;
|
|
340
|
+
const compositeKey = `${tx.hash}-${tokenAddr}-${amount}`;
|
|
341
|
+
if (!transfersByKey[compositeKey]) transfersByKey[compositeKey] = {
|
|
342
|
+
amount: amount,
|
|
343
|
+
tokenAddress: tokenAddr
|
|
344
|
+
};
|
|
345
|
+
if (/::Withdraw[^:]*/.test(evtType)) transfersByKey[compositeKey].from = accountAddr;
|
|
346
|
+
else transfersByKey[compositeKey].to = accountAddr;
|
|
347
|
+
}
|
|
343
348
|
}
|
|
344
|
-
for (const partial of Object.values(
|
|
349
|
+
for (const partial of Object.values(transfersByKey)){
|
|
345
350
|
if (!partial.from || !partial.to) continue;
|
|
351
|
+
const fromAddr = partial.from.length < 66 ? `0x0${partial.from.slice(2)}` : partial.from;
|
|
352
|
+
const toAddr = partial.to.length < 66 ? `0x0${partial.to.slice(2)}` : partial.to;
|
|
353
|
+
let finalToken = null;
|
|
354
|
+
let finalTokenType = "TOKEN";
|
|
355
|
+
if (partial.tokenAddress?.toLowerCase().includes("aptos_coin")) finalToken = null;
|
|
356
|
+
else finalToken = partial.tokenAddress?.toLowerCase();
|
|
357
|
+
const gasUsed = BigInt(tx.gas_used || "0");
|
|
346
358
|
transfers.push({
|
|
347
359
|
amount: BigInt(partial.amount),
|
|
348
|
-
blockNumber: parseInt(block.block_height),
|
|
349
|
-
from:
|
|
360
|
+
blockNumber: parseInt(block.block_height, 10),
|
|
361
|
+
from: fromAddr,
|
|
362
|
+
to: toAddr,
|
|
350
363
|
timestamp: timestamp,
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
transactionGasFee: BigInt(tx.gas_used),
|
|
364
|
+
token: finalToken,
|
|
365
|
+
tokenType: finalTokenType,
|
|
366
|
+
transactionGasFee: gasUsed,
|
|
355
367
|
transactionHash: tx.hash
|
|
356
368
|
});
|
|
357
369
|
}
|
|
@@ -580,22 +592,44 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
580
592
|
break;
|
|
581
593
|
case "SUI":
|
|
582
594
|
{
|
|
583
|
-
const blockNumber = block.sequence;
|
|
584
|
-
const blockTimestamp = new Date(block.timestamp).toISOString();
|
|
585
|
-
|
|
595
|
+
const blockNumber = parseInt(block.sequence, 10);
|
|
596
|
+
const blockTimestamp = new Date(parseInt(block.timestamp, 10)).toISOString();
|
|
597
|
+
const transactions = block.transactions || [];
|
|
598
|
+
for (const tx of transactions){
|
|
586
599
|
const transactionHash = tx.digest;
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
600
|
+
let transactionGasFee = BigInt(0);
|
|
601
|
+
if (tx.effects?.gasUsed) {
|
|
602
|
+
const gu = tx.effects.gasUsed;
|
|
603
|
+
transactionGasFee = BigInt(gu.computationCost) + BigInt(gu.storageCost) - BigInt(gu.storageRebate) + BigInt(gu.nonRefundableStorageFee);
|
|
604
|
+
if (transactionGasFee < 0n) transactionGasFee = 0n;
|
|
605
|
+
}
|
|
606
|
+
const balanceChanges = tx.balanceChanges || [];
|
|
607
|
+
for (const bc of balanceChanges){
|
|
608
|
+
let rawAmt = BigInt(bc.amount);
|
|
609
|
+
if (rawAmt === 0n) continue;
|
|
610
|
+
let fromAddr;
|
|
611
|
+
let toAddr;
|
|
612
|
+
const rawOwner = bc.owner?.AddressOwner || bc.owner?.ObjectOwner || bc.owner?.Shared?.initial_shared_version || "UNKNOWN_OWNER";
|
|
613
|
+
if (rawAmt < 0n) {
|
|
614
|
+
fromAddr = String(rawOwner);
|
|
615
|
+
toAddr = undefined;
|
|
616
|
+
rawAmt = -rawAmt;
|
|
617
|
+
} else {
|
|
618
|
+
fromAddr = undefined;
|
|
619
|
+
toAddr = String(rawOwner);
|
|
620
|
+
}
|
|
621
|
+
transfers.push({
|
|
622
|
+
blockNumber: blockNumber,
|
|
623
|
+
from: fromAddr,
|
|
624
|
+
to: toAddr,
|
|
625
|
+
amount: rawAmt,
|
|
626
|
+
token: bc.coinType,
|
|
627
|
+
tokenType: "NATIVE",
|
|
628
|
+
timestamp: blockTimestamp,
|
|
629
|
+
transactionHash: transactionHash,
|
|
630
|
+
transactionGasFee: transactionGasFee
|
|
631
|
+
});
|
|
632
|
+
}
|
|
599
633
|
}
|
|
600
634
|
break;
|
|
601
635
|
}
|
|
@@ -706,9 +740,9 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
706
740
|
const typedBlock = block;
|
|
707
741
|
const blockNumber = Number(typedBlock.block.header.height);
|
|
708
742
|
const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();
|
|
709
|
-
const blockHash = typedBlock.block_id.hash;
|
|
710
743
|
for (const txRaw of typedBlock.block.data.txs || []){
|
|
711
744
|
const decoded = (0, $hgUW1$decodeTxRaw)(new Uint8Array($c18434deda90759d$require$Buffer.from(txRaw, "base64")));
|
|
745
|
+
const txHash = (0, $hgUW1$sha256)(new Uint8Array($c18434deda90759d$require$Buffer.from(txRaw, "base64")));
|
|
712
746
|
const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || "0");
|
|
713
747
|
const registry = new (0, $hgUW1$Registry)((0, $hgUW1$defaultRegistryTypes));
|
|
714
748
|
for (const message of decoded.body.messages)if ([
|
|
@@ -724,7 +758,7 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
724
758
|
token: decodedMsg.token.denom,
|
|
725
759
|
tokenType: "NATIVE",
|
|
726
760
|
timestamp: blockTimestamp,
|
|
727
|
-
transactionHash:
|
|
761
|
+
transactionHash: txHash.slice(2).toUpperCase(),
|
|
728
762
|
transactionGasFee: transactionGasFee
|
|
729
763
|
});
|
|
730
764
|
}
|
|
@@ -863,24 +897,56 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
863
897
|
{
|
|
864
898
|
params: {
|
|
865
899
|
network: "APTOS",
|
|
866
|
-
walletAddress: "
|
|
867
|
-
contractAddress: "
|
|
900
|
+
walletAddress: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
901
|
+
contractAddress: "0x3b5d2e7e8da86903beb19d5a7135764aac812e18af193895d75f3a8f6a066cb0"
|
|
868
902
|
},
|
|
869
903
|
payload: "https://jiti.indexing.co/networks/aptos/297956660",
|
|
870
904
|
output: [
|
|
871
905
|
{
|
|
872
|
-
amount:
|
|
906
|
+
amount: 1611839920n,
|
|
873
907
|
blockNumber: 297956660,
|
|
874
908
|
from: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
909
|
+
to: "0x3b5d2e7e8da86903beb19d5a7135764aac812e18af193895d75f3a8f6a066cb0",
|
|
875
910
|
timestamp: "2025-03-02T21:07:06.002Z",
|
|
911
|
+
token: null,
|
|
912
|
+
tokenType: "TOKEN",
|
|
913
|
+
transactionGasFee: 13n,
|
|
914
|
+
transactionHash: "0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13"
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
amount: 1502138836n,
|
|
918
|
+
blockNumber: 297956660,
|
|
919
|
+
from: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
876
920
|
to: "0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e",
|
|
921
|
+
timestamp: "2025-03-02T21:07:06.002Z",
|
|
877
922
|
token: null,
|
|
878
|
-
tokenType: "
|
|
923
|
+
tokenType: "TOKEN",
|
|
879
924
|
transactionGasFee: 13n,
|
|
880
925
|
transactionHash: "0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13"
|
|
881
926
|
}
|
|
882
927
|
]
|
|
883
928
|
},
|
|
929
|
+
// APTOS
|
|
930
|
+
{
|
|
931
|
+
params: {
|
|
932
|
+
network: "APTOS",
|
|
933
|
+
contractAddress: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"
|
|
934
|
+
},
|
|
935
|
+
payload: "https://jiti.indexing.co/networks/aptos/303623631",
|
|
936
|
+
output: [
|
|
937
|
+
{
|
|
938
|
+
amount: 1000060n,
|
|
939
|
+
blockNumber: 303623631,
|
|
940
|
+
from: "0xa4e7455d27731ab857e9701b1e6ed72591132b909fe6e4fd99b66c1d6318d9e8",
|
|
941
|
+
timestamp: "2025-03-14T15:39:49.845Z",
|
|
942
|
+
to: "0x9317336bfc9ba6987d40492ddea8d41e11b7c2e473f3556a9c82309d326e79ce",
|
|
943
|
+
token: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b",
|
|
944
|
+
tokenType: "TOKEN",
|
|
945
|
+
transactionGasFee: 16n,
|
|
946
|
+
transactionHash: "0x24b8854bad1f6543b35069eacd6ec40a583ca7fa452b422b04d747d24b65279c"
|
|
947
|
+
}
|
|
948
|
+
]
|
|
949
|
+
},
|
|
884
950
|
// BASE
|
|
885
951
|
{
|
|
886
952
|
params: {
|
|
@@ -948,6 +1014,28 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
948
1014
|
}
|
|
949
1015
|
]
|
|
950
1016
|
},
|
|
1017
|
+
// COSMOS
|
|
1018
|
+
{
|
|
1019
|
+
params: {
|
|
1020
|
+
network: "COSMOS",
|
|
1021
|
+
walletAddress: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
1022
|
+
contractAddress: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
|
|
1023
|
+
},
|
|
1024
|
+
payload: "https://jiti.indexing.co/networks/cosmos/24419691",
|
|
1025
|
+
output: [
|
|
1026
|
+
{
|
|
1027
|
+
blockNumber: 24419691,
|
|
1028
|
+
from: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
1029
|
+
to: "noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv",
|
|
1030
|
+
amount: 500000n,
|
|
1031
|
+
token: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013",
|
|
1032
|
+
tokenType: "NATIVE",
|
|
1033
|
+
timestamp: "2025-02-14T21:48:22.809Z",
|
|
1034
|
+
transactionHash: "963D4D7BB59C1280F58A7ECA2F1934E2AA005109A989193C815C7B98EDCD7445",
|
|
1035
|
+
transactionGasFee: 4860n
|
|
1036
|
+
}
|
|
1037
|
+
]
|
|
1038
|
+
},
|
|
951
1039
|
// DOGECOIN
|
|
952
1040
|
{
|
|
953
1041
|
params: {
|
|
@@ -970,7 +1058,7 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
970
1058
|
}
|
|
971
1059
|
]
|
|
972
1060
|
},
|
|
973
|
-
//FILECOIN
|
|
1061
|
+
// FILECOIN
|
|
974
1062
|
{
|
|
975
1063
|
params: {
|
|
976
1064
|
network: "FILECOIN",
|
|
@@ -1058,25 +1146,58 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
1058
1146
|
}
|
|
1059
1147
|
]
|
|
1060
1148
|
},
|
|
1061
|
-
//SUI
|
|
1149
|
+
// SUI
|
|
1062
1150
|
{
|
|
1063
1151
|
params: {
|
|
1064
1152
|
network: "SUI",
|
|
1065
|
-
walletAddress: "
|
|
1153
|
+
walletAddress: "0x39b9e5942df9a4686ebe727534077281d6adcee15a9bb74d3e052e56d78b2744",
|
|
1066
1154
|
contractAddress: ""
|
|
1067
1155
|
},
|
|
1068
|
-
payload: "https://jiti.indexing.co/networks/sui/
|
|
1156
|
+
payload: "https://jiti.indexing.co/networks/sui/132734364",
|
|
1069
1157
|
output: [
|
|
1070
1158
|
{
|
|
1071
|
-
blockNumber:
|
|
1072
|
-
from: "
|
|
1159
|
+
blockNumber: 132734364,
|
|
1160
|
+
from: "0x39b9e5942df9a4686ebe727534077281d6adcee15a9bb74d3e052e56d78b2744",
|
|
1161
|
+
to: undefined,
|
|
1162
|
+
amount: 5321172n,
|
|
1163
|
+
token: "0x2::sui::SUI",
|
|
1164
|
+
tokenType: "NATIVE",
|
|
1165
|
+
timestamp: "2025-04-11T14:57:40.091Z",
|
|
1166
|
+
transactionHash: "4JWC8DX8eKYhwvRgzesGNWsb5t5RUyQVSNibKxLRaN22",
|
|
1167
|
+
transactionGasFee: 5408344n
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
blockNumber: 132734364,
|
|
1171
|
+
from: "0x39b9e5942df9a4686ebe727534077281d6adcee15a9bb74d3e052e56d78b2744",
|
|
1172
|
+
to: undefined,
|
|
1173
|
+
amount: 825772n,
|
|
1174
|
+
token: "0x2::sui::SUI",
|
|
1175
|
+
tokenType: "NATIVE",
|
|
1176
|
+
timestamp: "2025-04-11T14:57:40.091Z",
|
|
1177
|
+
transactionHash: "5bXBDeoYqXTawkf2bCDriAE2M6Vu2EgYKEgJ1hW4qagZ",
|
|
1178
|
+
transactionGasFee: 901544n
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
blockNumber: 132734364,
|
|
1182
|
+
from: "0x39b9e5942df9a4686ebe727534077281d6adcee15a9bb74d3e052e56d78b2744",
|
|
1073
1183
|
to: undefined,
|
|
1074
|
-
amount:
|
|
1075
|
-
token: "
|
|
1184
|
+
amount: 5321248n,
|
|
1185
|
+
token: "0x2::sui::SUI",
|
|
1076
1186
|
tokenType: "NATIVE",
|
|
1077
|
-
timestamp: "2025-
|
|
1078
|
-
transactionHash: "
|
|
1079
|
-
transactionGasFee:
|
|
1187
|
+
timestamp: "2025-04-11T14:57:40.091Z",
|
|
1188
|
+
transactionHash: "6KZYwvaAk76AL9p5kjkA27Tj5Jy47ipCxLKiCXtBbngo",
|
|
1189
|
+
transactionGasFee: 5408496n
|
|
1190
|
+
},
|
|
1191
|
+
{
|
|
1192
|
+
blockNumber: 132734364,
|
|
1193
|
+
from: "0x39b9e5942df9a4686ebe727534077281d6adcee15a9bb74d3e052e56d78b2744",
|
|
1194
|
+
to: undefined,
|
|
1195
|
+
amount: 5321096n,
|
|
1196
|
+
token: "0x2::sui::SUI",
|
|
1197
|
+
tokenType: "NATIVE",
|
|
1198
|
+
timestamp: "2025-04-11T14:57:40.091Z",
|
|
1199
|
+
transactionHash: "HcJAHtSUypt8z2us2HqDm7PzB5HKS3ASY86pDKNAsgnE",
|
|
1200
|
+
transactionGasFee: 5408192n
|
|
1080
1201
|
}
|
|
1081
1202
|
]
|
|
1082
1203
|
},
|
|
@@ -1102,28 +1223,6 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
1102
1223
|
}
|
|
1103
1224
|
]
|
|
1104
1225
|
},
|
|
1105
|
-
// COSMOS
|
|
1106
|
-
{
|
|
1107
|
-
params: {
|
|
1108
|
-
network: "COSMOS",
|
|
1109
|
-
walletAddress: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
1110
|
-
contractAddress: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
|
|
1111
|
-
},
|
|
1112
|
-
payload: "https://jiti.indexing.co/networks/cosmos/24419691",
|
|
1113
|
-
output: [
|
|
1114
|
-
{
|
|
1115
|
-
blockNumber: 24419691,
|
|
1116
|
-
from: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
1117
|
-
to: "noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv",
|
|
1118
|
-
amount: 500000n,
|
|
1119
|
-
token: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013",
|
|
1120
|
-
tokenType: "NATIVE",
|
|
1121
|
-
timestamp: "2025-02-14T21:48:22.809Z",
|
|
1122
|
-
transactionHash: "DF5FB086E60EE2ADA3A842751337E06A40696D7983CC1C038ADE236B36ED8AEB",
|
|
1123
|
-
transactionGasFee: 4860n
|
|
1124
|
-
}
|
|
1125
|
-
]
|
|
1126
|
-
},
|
|
1127
1226
|
// SOLANA
|
|
1128
1227
|
{
|
|
1129
1228
|
params: {
|