@indexing/jiti 0.0.35 → 0.0.37
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 +152 -10
- package/dist/main.js.map +1 -1
- package/dist/module.js +152 -10
- 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
|
@@ -68,7 +68,32 @@ const $bea1ed486f96b980$export$ace043a4f2efe476 = {
|
|
|
68
68
|
for (const tx of block.transactions){
|
|
69
69
|
if (!tx?.events || !Array.isArray(tx.events)) continue;
|
|
70
70
|
const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp, 10) / 1000).toISOString() : null;
|
|
71
|
+
const gasUsed = BigInt(tx.gas_used || "0");
|
|
71
72
|
const transfersByKey = {};
|
|
73
|
+
const sender = tx.sender;
|
|
74
|
+
const accountAddressMap = {};
|
|
75
|
+
const changes = tx.changes;
|
|
76
|
+
for(let ci = 0; ci < changes.length; ci += 1){
|
|
77
|
+
if (!changes[ci]?.data) continue;
|
|
78
|
+
const { address: accountAddress, data: { data: { balance: balance, metadata: metadata }, type: changeType } } = changes[ci];
|
|
79
|
+
if (changeType === "0x1::fungible_asset::FungibleStore") {
|
|
80
|
+
if (!accountAddressMap[accountAddress]) accountAddressMap[accountAddress] = changes[ci + 1]?.data.data.owner;
|
|
81
|
+
const to = accountAddressMap[accountAddress];
|
|
82
|
+
const tokenAddress = metadata?.inner;
|
|
83
|
+
if (!to || !tokenAddress || to === sender) continue;
|
|
84
|
+
transfers.push({
|
|
85
|
+
amount: BigInt(balance),
|
|
86
|
+
blockNumber: parseInt(block.block_height, 10),
|
|
87
|
+
from: sender,
|
|
88
|
+
to: to,
|
|
89
|
+
timestamp: timestamp,
|
|
90
|
+
token: tokenAddress,
|
|
91
|
+
tokenType: "TOKEN",
|
|
92
|
+
transactionGasFee: gasUsed,
|
|
93
|
+
transactionHash: tx.hash
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
72
97
|
for (const evt of tx.events){
|
|
73
98
|
const evtType = evt.type;
|
|
74
99
|
if (/::(Withdraw|Deposit)[^:]*/.test(evtType)) {
|
|
@@ -90,11 +115,11 @@ const $bea1ed486f96b980$export$ace043a4f2efe476 = {
|
|
|
90
115
|
if (!partial.from || !partial.to) continue;
|
|
91
116
|
const fromAddr = partial.from.length < 66 ? `0x0${partial.from.slice(2)}` : partial.from;
|
|
92
117
|
const toAddr = partial.to.length < 66 ? `0x0${partial.to.slice(2)}` : partial.to;
|
|
118
|
+
if (toAddr === "0x00") continue;
|
|
93
119
|
let finalToken = null;
|
|
94
120
|
let finalTokenType = "TOKEN";
|
|
95
121
|
if (partial.tokenAddress?.toLowerCase().includes("aptos_coin")) finalToken = null;
|
|
96
122
|
else finalToken = partial.tokenAddress?.toLowerCase();
|
|
97
|
-
const gasUsed = BigInt(tx.gas_used || "0");
|
|
98
123
|
transfers.push({
|
|
99
124
|
amount: BigInt(partial.amount),
|
|
100
125
|
blockNumber: parseInt(block.block_height, 10),
|
|
@@ -149,6 +174,17 @@ const $bea1ed486f96b980$export$ace043a4f2efe476 = {
|
|
|
149
174
|
},
|
|
150
175
|
payload: "https://jiti.indexing.co/networks/aptos/303623631",
|
|
151
176
|
output: [
|
|
177
|
+
{
|
|
178
|
+
amount: 3000160n,
|
|
179
|
+
blockNumber: 303623631,
|
|
180
|
+
from: "0xa4e7455d27731ab857e9701b1e6ed72591132b909fe6e4fd99b66c1d6318d9e8",
|
|
181
|
+
timestamp: "2025-03-14T15:39:49.845Z",
|
|
182
|
+
to: "0x9317336bfc9ba6987d40492ddea8d41e11b7c2e473f3556a9c82309d326e79ce",
|
|
183
|
+
token: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b",
|
|
184
|
+
tokenType: "TOKEN",
|
|
185
|
+
transactionGasFee: 16n,
|
|
186
|
+
transactionHash: "0x24b8854bad1f6543b35069eacd6ec40a583ca7fa452b422b04d747d24b65279c"
|
|
187
|
+
},
|
|
152
188
|
{
|
|
153
189
|
amount: 1000060n,
|
|
154
190
|
blockNumber: 303623631,
|
|
@@ -161,6 +197,27 @@ const $bea1ed486f96b980$export$ace043a4f2efe476 = {
|
|
|
161
197
|
transactionHash: "0x24b8854bad1f6543b35069eacd6ec40a583ca7fa452b422b04d747d24b65279c"
|
|
162
198
|
}
|
|
163
199
|
]
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
params: {
|
|
203
|
+
network: "APTOS",
|
|
204
|
+
contractAddress: "0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b",
|
|
205
|
+
walletAddress: "0x1a07942979574456e8197ac0ba8e3bfcf93d7922493cc3ca0c6b46b580b0a47e"
|
|
206
|
+
},
|
|
207
|
+
payload: "https://jiti.indexing.co/networks/aptos/326121833",
|
|
208
|
+
output: [
|
|
209
|
+
{
|
|
210
|
+
amount: 10000000n,
|
|
211
|
+
blockNumber: 326121833,
|
|
212
|
+
from: "0xd91c64b777e51395c6ea9dec562ed79a4afa0cd6dad5a87b187c37198a1f855a",
|
|
213
|
+
timestamp: "2025-04-19T08:57:28.135Z",
|
|
214
|
+
to: "0x1a07942979574456e8197ac0ba8e3bfcf93d7922493cc3ca0c6b46b580b0a47e",
|
|
215
|
+
token: "0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b",
|
|
216
|
+
tokenType: "TOKEN",
|
|
217
|
+
transactionGasFee: 10877n,
|
|
218
|
+
transactionHash: "0xc5a21679a947f986908b09091516bc3896245d974686ca2bd5709b7dbc5118fb"
|
|
219
|
+
}
|
|
220
|
+
]
|
|
164
221
|
}
|
|
165
222
|
]
|
|
166
223
|
};
|
|
@@ -941,7 +998,18 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
|
|
|
941
998
|
};
|
|
942
999
|
if (isNegDiff) delete txfer.to;
|
|
943
1000
|
else delete txfer.from;
|
|
944
|
-
transfersByKey[key]
|
|
1001
|
+
if (!transfersByKey[key]) transfersByKey[key] = [
|
|
1002
|
+
txfer
|
|
1003
|
+
];
|
|
1004
|
+
else {
|
|
1005
|
+
let didMerge = false;
|
|
1006
|
+
for(let tbi = 0; tbi < transfersByKey[key].length; tbi += 1)if (txfer.to && !transfersByKey[key][tbi].to || txfer.from && !transfersByKey[key][tbi].from) {
|
|
1007
|
+
didMerge = true;
|
|
1008
|
+
transfersByKey[key][tbi] = Object.assign(transfersByKey[key][tbi] || {}, txfer);
|
|
1009
|
+
break;
|
|
1010
|
+
}
|
|
1011
|
+
if (!didMerge) transfersByKey[key].push(txfer);
|
|
1012
|
+
}
|
|
945
1013
|
matched = true;
|
|
946
1014
|
}
|
|
947
1015
|
if (!matched) {
|
|
@@ -962,7 +1030,18 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
|
|
|
962
1030
|
};
|
|
963
1031
|
if (isNegDiff) delete txfer.to;
|
|
964
1032
|
else delete txfer.from;
|
|
965
|
-
transfersByKey[key]
|
|
1033
|
+
if (!transfersByKey[key]) transfersByKey[key] = [
|
|
1034
|
+
txfer
|
|
1035
|
+
];
|
|
1036
|
+
else {
|
|
1037
|
+
let didMerge = false;
|
|
1038
|
+
for(let tbi = 0; tbi < transfersByKey[key].length; tbi += 1)if (txfer.to && !transfersByKey[key][tbi].to || txfer.from && !transfersByKey[key][tbi].from) {
|
|
1039
|
+
didMerge = true;
|
|
1040
|
+
transfersByKey[key][tbi] = Object.assign(transfersByKey[key][tbi] || {}, txfer);
|
|
1041
|
+
break;
|
|
1042
|
+
}
|
|
1043
|
+
if (!didMerge) transfersByKey[key].push(txfer);
|
|
1044
|
+
}
|
|
966
1045
|
}
|
|
967
1046
|
}
|
|
968
1047
|
for(let i = 0; i < solanaTx.meta.postBalances.length; i += 1){
|
|
@@ -985,13 +1064,23 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
|
|
|
985
1064
|
};
|
|
986
1065
|
if (post > pre) delete txfer.from;
|
|
987
1066
|
else delete txfer.to;
|
|
988
|
-
transfersByKey[key]
|
|
1067
|
+
if (!transfersByKey[key]) transfersByKey[key] = [
|
|
1068
|
+
txfer
|
|
1069
|
+
];
|
|
1070
|
+
else {
|
|
1071
|
+
let didMerge = false;
|
|
1072
|
+
for(let tbi = 0; tbi < transfersByKey[key].length; tbi += 1)if (txfer.to && !transfersByKey[key][tbi].to || txfer.from && !transfersByKey[key][tbi].from) {
|
|
1073
|
+
didMerge = true;
|
|
1074
|
+
transfersByKey[key][tbi] = Object.assign(transfersByKey[key][tbi] || {}, txfer);
|
|
1075
|
+
break;
|
|
1076
|
+
}
|
|
1077
|
+
if (!didMerge) transfersByKey[key].push(txfer);
|
|
1078
|
+
}
|
|
989
1079
|
}
|
|
990
1080
|
}
|
|
991
1081
|
const unmatchedFrom = {};
|
|
992
1082
|
const unmatchedTo = {};
|
|
993
|
-
for(const key in transfersByKey){
|
|
994
|
-
const txfer = transfersByKey[key];
|
|
1083
|
+
for(const key in transfersByKey)for (const txfer of transfersByKey[key]){
|
|
995
1084
|
if (!txfer.from) {
|
|
996
1085
|
if (!unmatchedFrom[txfer.token]) unmatchedFrom[txfer.token] = [];
|
|
997
1086
|
unmatchedFrom[txfer.token].push(txfer);
|
|
@@ -1000,7 +1089,7 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
|
|
|
1000
1089
|
if (!unmatchedTo[txfer.token]) unmatchedTo[txfer.token] = [];
|
|
1001
1090
|
unmatchedTo[txfer.token].push(txfer);
|
|
1002
1091
|
delete transfersByKey[key];
|
|
1003
|
-
}
|
|
1092
|
+
} else transfers.push(txfer);
|
|
1004
1093
|
}
|
|
1005
1094
|
for(const token in unmatchedFrom)if (unmatchedTo[token]?.length && unmatchedFrom[token]?.length) {
|
|
1006
1095
|
const unmatchedDiff = unmatchedTo[token].reduce((a, b)=>a + BigInt(b.amount), BigInt(0)) - unmatchedFrom[token].reduce((a, b)=>a + BigInt(b.amount), BigInt(0));
|
|
@@ -1008,15 +1097,68 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
|
|
|
1008
1097
|
unmatchedTo[token].sort((a, b)=>a.amount > b.amount ? 1 : -1);
|
|
1009
1098
|
unmatchedFrom[token].forEach((um)=>{
|
|
1010
1099
|
um.from = unmatchedTo[token][0].from;
|
|
1011
|
-
|
|
1100
|
+
transfers.push(um);
|
|
1012
1101
|
});
|
|
1013
1102
|
}
|
|
1014
1103
|
}
|
|
1015
|
-
transfers.push(...Object.values(transfersByKey));
|
|
1016
1104
|
}
|
|
1017
1105
|
return transfers;
|
|
1018
1106
|
},
|
|
1019
1107
|
tests: [
|
|
1108
|
+
{
|
|
1109
|
+
params: {
|
|
1110
|
+
network: "SOLANA",
|
|
1111
|
+
walletAddress: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
|
|
1112
|
+
contractAddress: "6MQpbiTC2YcogidTmKqMLK82qvE9z5QEm7EP3AEDpump"
|
|
1113
|
+
},
|
|
1114
|
+
payload: "https://jiti.indexing.co/networks/solana/345871978",
|
|
1115
|
+
output: [
|
|
1116
|
+
{
|
|
1117
|
+
amount: 10492578617n,
|
|
1118
|
+
blockNumber: 324081557,
|
|
1119
|
+
from: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
|
|
1120
|
+
timestamp: "2025-06-10T12:06:56.000Z",
|
|
1121
|
+
to: "ChkRerg6X89xHYqV4iBqcboBdU1WA8Uvs9fp2yZrqbg",
|
|
1122
|
+
token: "6MQpbiTC2YcogidTmKqMLK82qvE9z5QEm7EP3AEDpump",
|
|
1123
|
+
tokenType: "TOKEN",
|
|
1124
|
+
transactionGasFee: 2506024n,
|
|
1125
|
+
transactionHash: "65sABMeYatoyzsp1mL6UjAXoBqUdw47HR33ouvR9BFNipTNydqvWTt8PMbVqZZfvnX3TzwB3XSdk55cy3N6u8okR"
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
amount: 10492578617n,
|
|
1129
|
+
blockNumber: 324081557,
|
|
1130
|
+
from: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
|
|
1131
|
+
timestamp: "2025-06-10T12:06:56.000Z",
|
|
1132
|
+
to: "3shatpFgdVVwy8Pr723iE9L1fozzaXNdGYKtgrSwHYeJ",
|
|
1133
|
+
token: "6MQpbiTC2YcogidTmKqMLK82qvE9z5QEm7EP3AEDpump",
|
|
1134
|
+
tokenType: "TOKEN",
|
|
1135
|
+
transactionGasFee: 2506024n,
|
|
1136
|
+
transactionHash: "65sABMeYatoyzsp1mL6UjAXoBqUdw47HR33ouvR9BFNipTNydqvWTt8PMbVqZZfvnX3TzwB3XSdk55cy3N6u8okR"
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
amount: 16788125787n,
|
|
1140
|
+
blockNumber: 324081557,
|
|
1141
|
+
from: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
|
|
1142
|
+
timestamp: "2025-06-10T12:06:56.000Z",
|
|
1143
|
+
to: "GWPLjamb5ZxrGbTsYNWW7V3p1pAMryZSfaPFTdaEsWgC",
|
|
1144
|
+
token: "6MQpbiTC2YcogidTmKqMLK82qvE9z5QEm7EP3AEDpump",
|
|
1145
|
+
tokenType: "TOKEN",
|
|
1146
|
+
transactionGasFee: 2506024n,
|
|
1147
|
+
transactionHash: "65sABMeYatoyzsp1mL6UjAXoBqUdw47HR33ouvR9BFNipTNydqvWTt8PMbVqZZfvnX3TzwB3XSdk55cy3N6u8okR"
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
amount: 4197031447n,
|
|
1151
|
+
blockNumber: 324081557,
|
|
1152
|
+
from: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
|
|
1153
|
+
timestamp: "2025-06-10T12:06:56.000Z",
|
|
1154
|
+
to: "ANcfLC9JcbYbEWu71fE8973V8S6vD5hS98RNrz56hrT7",
|
|
1155
|
+
token: "6MQpbiTC2YcogidTmKqMLK82qvE9z5QEm7EP3AEDpump",
|
|
1156
|
+
tokenType: "TOKEN",
|
|
1157
|
+
transactionGasFee: 2506024n,
|
|
1158
|
+
transactionHash: "65sABMeYatoyzsp1mL6UjAXoBqUdw47HR33ouvR9BFNipTNydqvWTt8PMbVqZZfvnX3TzwB3XSdk55cy3N6u8okR"
|
|
1159
|
+
}
|
|
1160
|
+
]
|
|
1161
|
+
},
|
|
1020
1162
|
{
|
|
1021
1163
|
params: {
|
|
1022
1164
|
network: "SOLANA",
|
|
@@ -1227,7 +1369,7 @@ const $f0bdc73ab4ea9846$export$1f0fe79deb1b813b = {
|
|
|
1227
1369
|
}
|
|
1228
1370
|
]
|
|
1229
1371
|
}
|
|
1230
|
-
]
|
|
1372
|
+
]
|
|
1231
1373
|
};
|
|
1232
1374
|
|
|
1233
1375
|
|