@indexing/jiti 0.0.30 → 0.0.32
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 +1049 -817
- package/dist/main.js.map +1 -1
- package/dist/module.js +1049 -817
- 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
|
@@ -64,6 +64,246 @@ const $59fb8e0333a5d25f$var$rawTemplate = {
|
|
|
64
64
|
var $59fb8e0333a5d25f$export$2e2bcd8739ae039 = $59fb8e0333a5d25f$var$rawTemplate;
|
|
65
65
|
|
|
66
66
|
|
|
67
|
+
const $25d5bdd23cba31eb$export$ace043a4f2efe476 = {
|
|
68
|
+
match: (block)=>[
|
|
69
|
+
"APTOS",
|
|
70
|
+
"APTOS_TESTNET"
|
|
71
|
+
].includes(block._network),
|
|
72
|
+
transform (block) {
|
|
73
|
+
let transfers = [];
|
|
74
|
+
for (const tx of block.transactions){
|
|
75
|
+
if (!tx?.events || !Array.isArray(tx.events)) continue;
|
|
76
|
+
const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp, 10) / 1000).toISOString() : null;
|
|
77
|
+
const transfersByKey = {};
|
|
78
|
+
for (const evt of tx.events){
|
|
79
|
+
const evtType = evt.type;
|
|
80
|
+
if (/::(Withdraw|Deposit)[^:]*/.test(evtType)) {
|
|
81
|
+
const data = evt.data;
|
|
82
|
+
const amount = data.amount;
|
|
83
|
+
const accountAddr = data.store_owner || evt.guid?.account_address || "";
|
|
84
|
+
let tokenAddr = "0x1::aptos_coin::AptosCoin";
|
|
85
|
+
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;
|
|
86
|
+
const compositeKey = `${tx.hash}-${tokenAddr}-${amount}`;
|
|
87
|
+
if (!transfersByKey[compositeKey]) transfersByKey[compositeKey] = {
|
|
88
|
+
amount: amount,
|
|
89
|
+
tokenAddress: tokenAddr
|
|
90
|
+
};
|
|
91
|
+
if (/::Withdraw[^:]*/.test(evtType)) transfersByKey[compositeKey].from = accountAddr;
|
|
92
|
+
else transfersByKey[compositeKey].to = accountAddr;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
for (const partial of Object.values(transfersByKey)){
|
|
96
|
+
if (!partial.from || !partial.to) continue;
|
|
97
|
+
const fromAddr = partial.from.length < 66 ? `0x0${partial.from.slice(2)}` : partial.from;
|
|
98
|
+
const toAddr = partial.to.length < 66 ? `0x0${partial.to.slice(2)}` : partial.to;
|
|
99
|
+
let finalToken = null;
|
|
100
|
+
let finalTokenType = "TOKEN";
|
|
101
|
+
if (partial.tokenAddress?.toLowerCase().includes("aptos_coin")) finalToken = null;
|
|
102
|
+
else finalToken = partial.tokenAddress?.toLowerCase();
|
|
103
|
+
const gasUsed = BigInt(tx.gas_used || "0");
|
|
104
|
+
transfers.push({
|
|
105
|
+
amount: BigInt(partial.amount),
|
|
106
|
+
blockNumber: parseInt(block.block_height, 10),
|
|
107
|
+
from: fromAddr,
|
|
108
|
+
to: toAddr,
|
|
109
|
+
timestamp: timestamp,
|
|
110
|
+
token: finalToken,
|
|
111
|
+
tokenType: finalTokenType,
|
|
112
|
+
transactionGasFee: gasUsed,
|
|
113
|
+
transactionHash: tx.hash
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return transfers;
|
|
118
|
+
},
|
|
119
|
+
tests: [
|
|
120
|
+
{
|
|
121
|
+
params: {
|
|
122
|
+
network: "APTOS",
|
|
123
|
+
walletAddress: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00"
|
|
124
|
+
},
|
|
125
|
+
payload: "https://jiti.indexing.co/networks/aptos/297956660",
|
|
126
|
+
output: [
|
|
127
|
+
{
|
|
128
|
+
amount: 1611839920n,
|
|
129
|
+
blockNumber: 297956660,
|
|
130
|
+
from: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
131
|
+
to: "0x3b5d2e7e8da86903beb19d5a7135764aac812e18af193895d75f3a8f6a066cb0",
|
|
132
|
+
timestamp: "2025-03-02T21:07:06.002Z",
|
|
133
|
+
token: null,
|
|
134
|
+
tokenType: "TOKEN",
|
|
135
|
+
transactionGasFee: 13n,
|
|
136
|
+
transactionHash: "0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
amount: 1502138836n,
|
|
140
|
+
blockNumber: 297956660,
|
|
141
|
+
from: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
142
|
+
to: "0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e",
|
|
143
|
+
timestamp: "2025-03-02T21:07:06.002Z",
|
|
144
|
+
token: null,
|
|
145
|
+
tokenType: "TOKEN",
|
|
146
|
+
transactionGasFee: 13n,
|
|
147
|
+
transactionHash: "0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
params: {
|
|
153
|
+
network: "APTOS",
|
|
154
|
+
contractAddress: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"
|
|
155
|
+
},
|
|
156
|
+
payload: "https://jiti.indexing.co/networks/aptos/303623631",
|
|
157
|
+
output: [
|
|
158
|
+
{
|
|
159
|
+
amount: 1000060n,
|
|
160
|
+
blockNumber: 303623631,
|
|
161
|
+
from: "0xa4e7455d27731ab857e9701b1e6ed72591132b909fe6e4fd99b66c1d6318d9e8",
|
|
162
|
+
timestamp: "2025-03-14T15:39:49.845Z",
|
|
163
|
+
to: "0x9317336bfc9ba6987d40492ddea8d41e11b7c2e473f3556a9c82309d326e79ce",
|
|
164
|
+
token: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b",
|
|
165
|
+
tokenType: "TOKEN",
|
|
166
|
+
transactionGasFee: 16n,
|
|
167
|
+
transactionHash: "0x24b8854bad1f6543b35069eacd6ec40a583ca7fa452b422b04d747d24b65279c"
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
const $60d24c82dc5feb2e$export$893111d8d332e195 = {
|
|
176
|
+
match: (block)=>[
|
|
177
|
+
"CARDANO"
|
|
178
|
+
].includes(block._network),
|
|
179
|
+
transform (block) {
|
|
180
|
+
let transfers = [];
|
|
181
|
+
const blockTimestamp = new Date(block.timestamp * 1000).toISOString();
|
|
182
|
+
for (const tx of block.transactions){
|
|
183
|
+
const typedTx = tx;
|
|
184
|
+
if (!Array.isArray(typedTx.operations)) continue;
|
|
185
|
+
const transactionHash = typedTx.transaction_identifier?.hash || "";
|
|
186
|
+
const inputs = typedTx.operations.filter((op)=>op.type === "input");
|
|
187
|
+
const outputs = typedTx.operations.filter((op)=>op.type === "output");
|
|
188
|
+
if (!inputs.length && !outputs.length) continue;
|
|
189
|
+
const fromAddress = inputs[0]?.account?.address;
|
|
190
|
+
if (!fromAddress) continue;
|
|
191
|
+
const sumInputs = inputs.reduce((acc, op)=>{
|
|
192
|
+
const val = BigInt(op.amount?.value || "0");
|
|
193
|
+
return acc + val;
|
|
194
|
+
}, BigInt(0));
|
|
195
|
+
const sumOutputs = outputs.reduce((acc, op)=>{
|
|
196
|
+
const val = BigInt(op.amount?.value || "0");
|
|
197
|
+
return acc + val;
|
|
198
|
+
}, BigInt(0));
|
|
199
|
+
const transactionFee = sumInputs + BigInt(sumOutputs);
|
|
200
|
+
for (const out of outputs){
|
|
201
|
+
const rawValue = out.amount?.value || "0";
|
|
202
|
+
const absoluteValue = BigInt(rawValue);
|
|
203
|
+
transfers.push({
|
|
204
|
+
amount: absoluteValue < 0 ? -absoluteValue : absoluteValue,
|
|
205
|
+
blockNumber: block.block_identifier.index,
|
|
206
|
+
from: fromAddress,
|
|
207
|
+
timestamp: blockTimestamp,
|
|
208
|
+
to: out.account?.address || "",
|
|
209
|
+
token: out.amount?.currency?.symbol?.toUpperCase() === "ADA" ? null : out.amount?.currency?.symbol,
|
|
210
|
+
tokenType: out.amount?.currency?.symbol?.toUpperCase() === "ADA" ? "NATIVE" : "TOKEN",
|
|
211
|
+
transactionGasFee: transactionFee < 0 ? -transactionFee : transactionFee,
|
|
212
|
+
transactionHash: transactionHash
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return transfers;
|
|
217
|
+
},
|
|
218
|
+
tests: [
|
|
219
|
+
{
|
|
220
|
+
params: {
|
|
221
|
+
network: "CARDANO",
|
|
222
|
+
walletAddress: "addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund",
|
|
223
|
+
contractAddress: ""
|
|
224
|
+
},
|
|
225
|
+
payload: "https://jiti.indexing.co/networks/cardano/11443286",
|
|
226
|
+
output: [
|
|
227
|
+
{
|
|
228
|
+
amount: 1110000n,
|
|
229
|
+
blockNumber: 11443286,
|
|
230
|
+
from: "addr1qymdv285few5tyqvya86rl97r9e608njs37shfew6l2nn473aw2pcnrcvfwfgg2dnew99m4tjj0apsu7232w2euzwpysndh0h3",
|
|
231
|
+
timestamp: "+057068-01-19T05:23:20.000Z",
|
|
232
|
+
to: "addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund",
|
|
233
|
+
token: null,
|
|
234
|
+
tokenType: "NATIVE",
|
|
235
|
+
transactionGasFee: 174257n,
|
|
236
|
+
transactionHash: "261c42ba9124f55d8e169ebb692cd3759d796a54369acb316ee449b546e79309"
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
var $f9ab50a3e879ac1c$require$Buffer = $8zHUo$buffer.Buffer;
|
|
249
|
+
const $f9ab50a3e879ac1c$export$b5fd4920e8b7d913 = {
|
|
250
|
+
match: (block)=>!!block.block,
|
|
251
|
+
transform (block) {
|
|
252
|
+
let transfers = [];
|
|
253
|
+
const typedBlock = block;
|
|
254
|
+
const blockNumber = Number(typedBlock.block.header.height);
|
|
255
|
+
const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();
|
|
256
|
+
for (const txRaw of typedBlock.block.data.txs || []){
|
|
257
|
+
const decoded = (0, $8zHUo$cosmjsprotosigning.decodeTxRaw)(new Uint8Array($f9ab50a3e879ac1c$require$Buffer.from(txRaw, "base64")));
|
|
258
|
+
const txHash = (0, $8zHUo$viem.sha256)(new Uint8Array($f9ab50a3e879ac1c$require$Buffer.from(txRaw, "base64")));
|
|
259
|
+
const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || "0");
|
|
260
|
+
const registry = new (0, $8zHUo$cosmjsprotosigning.Registry)((0, $8zHUo$cosmjsstargate.defaultRegistryTypes));
|
|
261
|
+
for (const message of decoded.body.messages)if ([
|
|
262
|
+
"/ibc.applications.transfer.v1.MsgTransfer",
|
|
263
|
+
"/cosmos.bank.v1beta1.MsgSend"
|
|
264
|
+
].includes(message.typeUrl)) {
|
|
265
|
+
const decodedMsg = registry.decode(message);
|
|
266
|
+
transfers.push({
|
|
267
|
+
blockNumber: blockNumber,
|
|
268
|
+
from: decodedMsg.sender,
|
|
269
|
+
to: decodedMsg.receiver,
|
|
270
|
+
amount: BigInt(decodedMsg.token.amount),
|
|
271
|
+
token: decodedMsg.token.denom,
|
|
272
|
+
tokenType: "NATIVE",
|
|
273
|
+
timestamp: blockTimestamp,
|
|
274
|
+
transactionHash: txHash.slice(2).toUpperCase(),
|
|
275
|
+
transactionGasFee: transactionGasFee
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return transfers;
|
|
280
|
+
},
|
|
281
|
+
tests: [
|
|
282
|
+
{
|
|
283
|
+
params: {
|
|
284
|
+
network: "COSMOS",
|
|
285
|
+
walletAddress: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
286
|
+
contractAddress: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
|
|
287
|
+
},
|
|
288
|
+
payload: "https://jiti.indexing.co/networks/cosmos/24419691",
|
|
289
|
+
output: [
|
|
290
|
+
{
|
|
291
|
+
blockNumber: 24419691,
|
|
292
|
+
from: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
293
|
+
to: "noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv",
|
|
294
|
+
amount: 500000n,
|
|
295
|
+
token: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013",
|
|
296
|
+
tokenType: "NATIVE",
|
|
297
|
+
timestamp: "2025-02-14T21:48:22.809Z",
|
|
298
|
+
transactionHash: "963D4D7BB59C1280F58A7ECA2F1934E2AA005109A989193C815C7B98EDCD7445",
|
|
299
|
+
transactionGasFee: 4860n
|
|
300
|
+
}
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
|
|
67
307
|
var $d7167569386d0d4c$exports = {};
|
|
68
308
|
var $596a656635c74d50$exports = {};
|
|
69
309
|
|
|
@@ -275,692 +515,131 @@ $parcel$exportWildcard($d7167569386d0d4c$exports, $f7a3fb164436c9c3$exports);
|
|
|
275
515
|
$parcel$exportWildcard($d7167569386d0d4c$exports, $414c83047563e72e$exports);
|
|
276
516
|
|
|
277
517
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
var $6144a02851f23907$require$Buffer = $8zHUo$buffer.Buffer;
|
|
283
|
-
const $6144a02851f23907$var$NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
284
|
-
const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
285
|
-
key: "token_transfers",
|
|
286
|
-
name: "Token Transfers",
|
|
287
|
-
description: "Get all token transfers for a set of token types.",
|
|
288
|
-
tags: [
|
|
289
|
-
"EVM",
|
|
290
|
-
"ERC20",
|
|
291
|
-
"ERC721",
|
|
292
|
-
"NFT",
|
|
293
|
-
"TOKEN"
|
|
294
|
-
],
|
|
295
|
-
disabled: false,
|
|
296
|
-
params: [
|
|
297
|
-
{
|
|
298
|
-
key: "network",
|
|
299
|
-
name: "Network",
|
|
300
|
-
type: "NETWORK",
|
|
301
|
-
optional: false
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
key: "contractAddress",
|
|
305
|
-
name: "Contract Address",
|
|
306
|
-
type: "ADDRESS",
|
|
307
|
-
optional: true
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
key: "walletAddress",
|
|
311
|
-
name: "Wallet Address",
|
|
312
|
-
type: "ADDRESS",
|
|
313
|
-
optional: true
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
key: "tokenTypes",
|
|
317
|
-
name: "Token Types",
|
|
318
|
-
type: "STRING",
|
|
319
|
-
multiple: true,
|
|
320
|
-
optional: true,
|
|
321
|
-
values: [
|
|
322
|
-
"NATIVE",
|
|
323
|
-
"TOKEN",
|
|
324
|
-
"NFT"
|
|
325
|
-
]
|
|
326
|
-
}
|
|
327
|
-
],
|
|
328
|
-
transform: (block, _ctx)=>{
|
|
518
|
+
const $8deaea1ef39b6485$var$NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
519
|
+
const $8deaea1ef39b6485$export$5beebc5708fabf3c = {
|
|
520
|
+
match: (block)=>true,
|
|
521
|
+
transform (block, _ctx) {
|
|
329
522
|
const TOKEN_TYPES = _ctx.params.tokenTypes || [];
|
|
330
523
|
let transfers = [];
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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
|
-
}
|
|
354
|
-
}
|
|
355
|
-
for (const partial of Object.values(transfersByKey)){
|
|
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");
|
|
364
|
-
transfers.push({
|
|
365
|
-
amount: BigInt(partial.amount),
|
|
366
|
-
blockNumber: parseInt(block.block_height, 10),
|
|
367
|
-
from: fromAddr,
|
|
368
|
-
to: toAddr,
|
|
369
|
-
timestamp: timestamp,
|
|
370
|
-
token: finalToken,
|
|
371
|
-
tokenType: finalTokenType,
|
|
372
|
-
transactionGasFee: gasUsed,
|
|
373
|
-
transactionHash: tx.hash
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
break;
|
|
378
|
-
case "BITCOIN":
|
|
379
|
-
case "BITCOIN_TESTNET":
|
|
380
|
-
case "LITCOIN":
|
|
381
|
-
case "DOGECOIN":
|
|
382
|
-
for (const tx of block.tx){
|
|
383
|
-
const timestamp = tx.time ? new Date(tx.time * 1000).toISOString() : null;
|
|
384
|
-
const vin = tx.vin[0];
|
|
385
|
-
const vout = tx.vout;
|
|
386
|
-
const fromVout = Math.min(vin.vout || 1000, vout.length - 1);
|
|
387
|
-
const fromAddress = vin.prevout?.scriptPubKey?.address || vout[fromVout]?.scriptPubKey?.address || vout[fromVout]?.scriptPubKey?.addresses?.[0];
|
|
388
|
-
if (!fromAddress) continue;
|
|
389
|
-
for (const v of vout)transfers.push({
|
|
390
|
-
amount: BigInt(Math.round(v.value * Math.pow(10, 8))),
|
|
391
|
-
blockNumber: block.height,
|
|
392
|
-
from: fromAddress,
|
|
393
|
-
timestamp: timestamp,
|
|
394
|
-
to: v.scriptPubKey.address || v.scriptPubKey.addresses?.[0],
|
|
395
|
-
transactionGasFee: BigInt(Math.round((tx.fee || 0) * Math.pow(10, 8))),
|
|
396
|
-
transactionHash: tx.txid,
|
|
397
|
-
token: null,
|
|
398
|
-
tokenType: "NATIVE"
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
break;
|
|
402
|
-
case "CARDANO":
|
|
403
|
-
{
|
|
404
|
-
const blockTimestamp = new Date(block.timestamp * 1000).toISOString();
|
|
405
|
-
for (const tx of block.transactions){
|
|
406
|
-
const typedTx = tx;
|
|
407
|
-
if (!Array.isArray(typedTx.operations)) continue;
|
|
408
|
-
const transactionHash = typedTx.transaction_identifier?.hash || "";
|
|
409
|
-
const inputs = typedTx.operations.filter((op)=>op.type === "input");
|
|
410
|
-
const outputs = typedTx.operations.filter((op)=>op.type === "output");
|
|
411
|
-
if (!inputs.length && !outputs.length) continue;
|
|
412
|
-
const fromAddress = inputs[0]?.account?.address;
|
|
413
|
-
if (!fromAddress) continue;
|
|
414
|
-
const sumInputs = inputs.reduce((acc, op)=>{
|
|
415
|
-
const val = BigInt(op.amount?.value || "0");
|
|
416
|
-
return acc + val;
|
|
417
|
-
}, BigInt(0));
|
|
418
|
-
const sumOutputs = outputs.reduce((acc, op)=>{
|
|
419
|
-
const val = BigInt(op.amount?.value || "0");
|
|
420
|
-
return acc + val;
|
|
421
|
-
}, BigInt(0));
|
|
422
|
-
const transactionFee = sumInputs + BigInt(sumOutputs);
|
|
423
|
-
for (const out of outputs){
|
|
424
|
-
const rawValue = out.amount?.value || "0";
|
|
425
|
-
const absoluteValue = BigInt(rawValue);
|
|
426
|
-
transfers.push({
|
|
427
|
-
amount: absoluteValue < 0 ? -absoluteValue : absoluteValue,
|
|
428
|
-
blockNumber: block.block_identifier.index,
|
|
429
|
-
from: fromAddress,
|
|
430
|
-
timestamp: blockTimestamp,
|
|
431
|
-
to: out.account?.address || "",
|
|
432
|
-
token: out.amount?.currency?.symbol?.toUpperCase() === "ADA" ? null : out.amount?.currency?.symbol,
|
|
433
|
-
tokenType: out.amount?.currency?.symbol?.toUpperCase() === "ADA" ? "NATIVE" : "TOKEN",
|
|
434
|
-
transactionGasFee: transactionFee < 0 ? -transactionFee : transactionFee,
|
|
435
|
-
transactionHash: transactionHash
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
break;
|
|
440
|
-
}
|
|
441
|
-
case "RIPPLE":
|
|
442
|
-
if (!Array.isArray(block.transactions)) break;
|
|
443
|
-
for (const rawTx of block.transactions){
|
|
444
|
-
const typedTx = rawTx;
|
|
445
|
-
if (typedTx.TransactionType !== "Payment") continue;
|
|
446
|
-
const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? "0";
|
|
447
|
-
let tokenSymbol = "XRP";
|
|
448
|
-
let tokenType = "NATIVE";
|
|
449
|
-
let parsedAmount;
|
|
450
|
-
if (typeof deliveredOrAmount === "object") {
|
|
451
|
-
tokenSymbol = deliveredOrAmount.currency?.toUpperCase() ?? "UNKNOWN";
|
|
452
|
-
tokenType = "TOKEN";
|
|
453
|
-
const floatVal = parseFloat(deliveredOrAmount.value);
|
|
454
|
-
const smallestUnit = Math.round(floatVal * 1000000);
|
|
455
|
-
parsedAmount = BigInt(smallestUnit);
|
|
456
|
-
} else parsedAmount = BigInt(String(deliveredOrAmount));
|
|
524
|
+
for (const tx of block.transactions){
|
|
525
|
+
if (!tx.receipt) continue;
|
|
526
|
+
const timestamp = new Date(block.timestamp * 1000).toISOString();
|
|
527
|
+
const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);
|
|
528
|
+
// track direct ETH transfers
|
|
529
|
+
if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("NATIVE")) {
|
|
530
|
+
// pull from traces, if available
|
|
531
|
+
if (Array.isArray(tx.traces)) for (const trace of tx.traces.filter((t)=>t.action)){
|
|
532
|
+
const action = trace.action;
|
|
533
|
+
if (!action?.value) continue;
|
|
457
534
|
transfers.push({
|
|
458
|
-
amount:
|
|
459
|
-
blockNumber:
|
|
460
|
-
from:
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
tokenType:
|
|
465
|
-
transactionGasFee:
|
|
466
|
-
transactionHash:
|
|
535
|
+
amount: BigInt(action.value),
|
|
536
|
+
blockNumber: tx.blockNumber,
|
|
537
|
+
from: action.from?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
538
|
+
index: trace.traceAddress?.join("-"),
|
|
539
|
+
timestamp: timestamp,
|
|
540
|
+
to: action.to?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
541
|
+
tokenType: "NATIVE",
|
|
542
|
+
transactionGasFee: transactionGasFee,
|
|
543
|
+
transactionHash: tx.hash
|
|
467
544
|
});
|
|
468
545
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
if (diff < 0) diff = -diff;
|
|
508
|
-
const key = `${post.mint}-${diff.toString()}`;
|
|
509
|
-
const txfer = {
|
|
510
|
-
amount: diff,
|
|
511
|
-
blockNumber: block.blockHeight,
|
|
512
|
-
from: null,
|
|
513
|
-
timestamp: timestamp,
|
|
514
|
-
to: post.owner,
|
|
515
|
-
token: post.mint,
|
|
516
|
-
tokenType: "TOKEN",
|
|
517
|
-
transactionGasFee: txFee,
|
|
518
|
-
transactionHash: txHash
|
|
519
|
-
};
|
|
520
|
-
if (transfersByKey[key]) {
|
|
521
|
-
if (isNegDiff) delete txfer.to;
|
|
522
|
-
else delete txfer.from;
|
|
523
|
-
}
|
|
524
|
-
transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
for(let i = 1; i < solanaTx.meta.postBalances.length; i += 1){
|
|
528
|
-
const post = solanaTx.meta.postBalances[i];
|
|
529
|
-
const pre = solanaTx.meta.preBalances[i];
|
|
530
|
-
if (post !== undefined && pre !== undefined && post !== pre) {
|
|
531
|
-
let diff = BigInt(post) - BigInt(pre);
|
|
532
|
-
if (diff < 0) diff = -diff;
|
|
533
|
-
const key = `null-${diff.toString()}`;
|
|
534
|
-
const txfer = {
|
|
535
|
-
amount: diff,
|
|
536
|
-
blockNumber: block.blockHeight,
|
|
537
|
-
from: post > pre ? typeof solanaTx.transaction.message.accountKeys[0] === "string" ? solanaTx.transaction.message.accountKeys[0] : solanaTx.transaction.message.accountKeys[0]?.pubkey : typeof solanaTx.transaction.message.accountKeys[i] === "string" ? solanaTx.transaction.message.accountKeys[i] : solanaTx.transaction.message.accountKeys[i]?.pubkey,
|
|
538
|
-
timestamp: timestamp,
|
|
539
|
-
to: typeof solanaTx.transaction.message.accountKeys[i] === "string" ? solanaTx.transaction.message.accountKeys[i] : solanaTx.transaction.message.accountKeys[i]?.pubkey?.toString(),
|
|
540
|
-
token: null,
|
|
541
|
-
tokenType: "NATIVE",
|
|
542
|
-
transactionGasFee: txFee,
|
|
543
|
-
transactionHash: txHash
|
|
544
|
-
};
|
|
545
|
-
if (transfersByKey[key]) {
|
|
546
|
-
if (post > pre) delete txfer.from;
|
|
547
|
-
else delete txfer.to;
|
|
548
|
-
}
|
|
549
|
-
transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
transfers.push(...Object.values(transfersByKey));
|
|
553
|
-
}
|
|
554
|
-
break;
|
|
555
|
-
case "STARKNET":
|
|
556
|
-
if (!Array.isArray(block.transactions)) break;
|
|
557
|
-
for (const tx of block.transactions){
|
|
558
|
-
const typedTx = tx;
|
|
559
|
-
const timestamp = block.timestamp ? new Date(block.timestamp * 1000).toISOString() : null;
|
|
560
|
-
let transactionGasFee = BigInt(0);
|
|
561
|
-
if (typedTx?.receipt?.actual_fee?.amount) transactionGasFee = BigInt(typedTx.receipt.actual_fee.amount);
|
|
562
|
-
const transactionHash = typedTx.transaction_hash;
|
|
563
|
-
if (!typedTx.receipt?.events) continue;
|
|
564
|
-
for (const event of typedTx.receipt.events){
|
|
565
|
-
if (!event.keys.includes("0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9")) continue;
|
|
566
|
-
if (event.data.length < 3) continue;
|
|
567
|
-
const [from, to, amountHex] = event.data;
|
|
568
|
-
const amount = BigInt(amountHex);
|
|
546
|
+
else if (tx.value?.length >= 3 || /\d+/.test(tx.value)) transfers.push({
|
|
547
|
+
amount: BigInt(tx.value),
|
|
548
|
+
blockNumber: tx.blockNumber,
|
|
549
|
+
from: tx.from?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
550
|
+
timestamp: timestamp,
|
|
551
|
+
to: tx.to?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
552
|
+
tokenType: "NATIVE",
|
|
553
|
+
transactionGasFee: transactionGasFee,
|
|
554
|
+
transactionHash: tx.hash
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
// track ERC20 transfers
|
|
558
|
+
if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("TOKEN")) for (const log of tx.receipt.logs){
|
|
559
|
+
const txfer = (0, $da55be3e40667945$export$cf548b70626e2eb9)(log, [
|
|
560
|
+
"Transfer(address indexed from, address indexed to, uint256 value)"
|
|
561
|
+
]);
|
|
562
|
+
if (txfer) transfers.push({
|
|
563
|
+
amount: txfer.decoded.value,
|
|
564
|
+
blockNumber: tx.blockNumber,
|
|
565
|
+
from: txfer.decoded.from?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
566
|
+
index: log.logIndex,
|
|
567
|
+
timestamp: timestamp,
|
|
568
|
+
to: txfer.decoded.to?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
569
|
+
token: log.address.toLowerCase(),
|
|
570
|
+
tokenType: "TOKEN",
|
|
571
|
+
transactionGasFee: transactionGasFee,
|
|
572
|
+
transactionHash: tx.hash
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("NFT")) for (const log of tx.receipt.logs){
|
|
576
|
+
const txfer = (0, $da55be3e40667945$export$cf548b70626e2eb9)(log, [
|
|
577
|
+
"Transfer(address indexed from, address indexed to, uint256 indexed value)",
|
|
578
|
+
"TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)",
|
|
579
|
+
"TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)"
|
|
580
|
+
]);
|
|
581
|
+
if (!txfer) continue;
|
|
582
|
+
switch(txfer.metadata.name){
|
|
583
|
+
case "Transfer":
|
|
569
584
|
transfers.push({
|
|
570
|
-
amount:
|
|
571
|
-
blockNumber:
|
|
572
|
-
from: from,
|
|
585
|
+
amount: 1,
|
|
586
|
+
blockNumber: tx.blockNumber,
|
|
587
|
+
from: txfer.decoded.from?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
588
|
+
index: log.logIndex,
|
|
573
589
|
timestamp: timestamp,
|
|
574
|
-
to: to,
|
|
575
|
-
token:
|
|
576
|
-
|
|
590
|
+
to: txfer.decoded.to?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
591
|
+
token: log.address.toLowerCase(),
|
|
592
|
+
tokenId: txfer.decoded.value.toString(),
|
|
593
|
+
tokenType: "NFT",
|
|
577
594
|
transactionGasFee: transactionGasFee,
|
|
578
|
-
transactionHash:
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
break;
|
|
583
|
-
case "STELLAR":
|
|
584
|
-
for (const tx of block.transactions){
|
|
585
|
-
const typedTx = tx;
|
|
586
|
-
for (const op of typedTx.operations)if (op.type === "payment") transfers.push({
|
|
587
|
-
amount: BigInt(op.amount.replace(".", "")),
|
|
588
|
-
blockNumber: block.sequence,
|
|
589
|
-
from: op.from,
|
|
590
|
-
timestamp: typedTx.created_at,
|
|
591
|
-
to: op.to,
|
|
592
|
-
token: op.asset_type === "native" ? null : op.asset_issuer,
|
|
593
|
-
tokenType: op.asset_type === "native" ? "NATIVE" : "TOKEN",
|
|
594
|
-
transactionGasFee: BigInt(typedTx.fee_charged),
|
|
595
|
-
transactionHash: typedTx.hash
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
break;
|
|
599
|
-
case "SUI":
|
|
600
|
-
{
|
|
601
|
-
const blockNumber = parseInt(block.sequence, 10);
|
|
602
|
-
const blockTimestamp = new Date(parseInt(block.timestamp, 10)).toISOString();
|
|
603
|
-
const transactions = block.transactions || [];
|
|
604
|
-
for (const tx of transactions){
|
|
605
|
-
const transactionHash = tx.digest;
|
|
606
|
-
let transactionGasFee = BigInt(0);
|
|
607
|
-
if (tx.effects?.gasUsed) {
|
|
608
|
-
const gu = tx.effects.gasUsed;
|
|
609
|
-
transactionGasFee = BigInt(gu.computationCost) + BigInt(gu.storageCost) - BigInt(gu.storageRebate) + BigInt(gu.nonRefundableStorageFee);
|
|
610
|
-
if (transactionGasFee < 0n) transactionGasFee = 0n;
|
|
611
|
-
}
|
|
612
|
-
const balanceChanges = tx.balanceChanges || [];
|
|
613
|
-
for (const bc of balanceChanges){
|
|
614
|
-
let rawAmt = BigInt(bc.amount);
|
|
615
|
-
if (rawAmt === 0n) continue;
|
|
616
|
-
let fromAddr;
|
|
617
|
-
let toAddr;
|
|
618
|
-
const rawOwner = bc.owner?.AddressOwner || bc.owner?.ObjectOwner || bc.owner?.Shared?.initial_shared_version || "UNKNOWN_OWNER";
|
|
619
|
-
if (rawAmt < 0n) {
|
|
620
|
-
fromAddr = String(rawOwner);
|
|
621
|
-
toAddr = undefined;
|
|
622
|
-
rawAmt = -rawAmt;
|
|
623
|
-
} else {
|
|
624
|
-
fromAddr = undefined;
|
|
625
|
-
toAddr = String(rawOwner);
|
|
626
|
-
}
|
|
627
|
-
transfers.push({
|
|
628
|
-
blockNumber: blockNumber,
|
|
629
|
-
from: fromAddr,
|
|
630
|
-
to: toAddr,
|
|
631
|
-
amount: rawAmt,
|
|
632
|
-
token: bc.coinType,
|
|
633
|
-
tokenType: "NATIVE",
|
|
634
|
-
timestamp: blockTimestamp,
|
|
635
|
-
transactionHash: transactionHash,
|
|
636
|
-
transactionGasFee: transactionGasFee
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
break;
|
|
641
|
-
}
|
|
642
|
-
case "TON":
|
|
643
|
-
{
|
|
644
|
-
const blockNumber = block.seqno;
|
|
645
|
-
const blockTimestamp = new Date(block.shards?.[0]?.gen_utime * 1000).toISOString();
|
|
646
|
-
for (const shard of block.shards || [])for (const tx of shard.transactions || []){
|
|
647
|
-
const transactionLT = tx.transaction_id.lt;
|
|
648
|
-
const transactionHash = tx.transaction_id.hash;
|
|
649
|
-
const transactionFee = BigInt(tx.fee || "0");
|
|
650
|
-
const inVal = BigInt(tx.in_msg?.value || "0");
|
|
651
|
-
if (inVal > 0n) transfers.push({
|
|
652
|
-
blockNumber: blockNumber,
|
|
653
|
-
from: tx.in_msg?.source?.account_address,
|
|
654
|
-
to: tx.address?.account_address,
|
|
655
|
-
amount: inVal,
|
|
656
|
-
token: "TON",
|
|
657
|
-
tokenType: "NATIVE",
|
|
658
|
-
timestamp: blockTimestamp,
|
|
659
|
-
transactionHash: transactionHash,
|
|
660
|
-
transactionGasFee: transactionFee
|
|
595
|
+
transactionHash: tx.hash
|
|
661
596
|
});
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
if (outVal > 0n) transfers.push({
|
|
665
|
-
blockNumber: blockNumber,
|
|
666
|
-
from: outMsg.source?.account_address,
|
|
667
|
-
to: outMsg.destination?.account_address,
|
|
668
|
-
amount: outVal,
|
|
669
|
-
token: "TON",
|
|
670
|
-
tokenType: "NATIVE",
|
|
671
|
-
timestamp: blockTimestamp,
|
|
672
|
-
transactionHash: transactionHash,
|
|
673
|
-
transactionGasFee: transactionFee
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
break;
|
|
678
|
-
}
|
|
679
|
-
case "ASTAR":
|
|
680
|
-
case "ENJIN":
|
|
681
|
-
case "KUSAMA":
|
|
682
|
-
case "POLKADOT":
|
|
683
|
-
case "BITTENSOR":
|
|
684
|
-
{
|
|
685
|
-
const typedBlock = block;
|
|
686
|
-
const blockNumber = typedBlock.blockNumber;
|
|
687
|
-
const timestampExtrinsic = typedBlock.extrinsics.find((ex)=>ex.method === "timestamp.set");
|
|
688
|
-
const blockTimestamp = timestampExtrinsic ? new Date(Number(timestampExtrinsic.args[0].toString().replace(/,/g, ""))).toISOString() : new Date().toISOString();
|
|
689
|
-
for (const extrinsic of typedBlock.extrinsics)if ([
|
|
690
|
-
"balances.transfer",
|
|
691
|
-
"balances.transferKeepAlive"
|
|
692
|
-
].includes(extrinsic.method)) {
|
|
693
|
-
const from = extrinsic.signer;
|
|
694
|
-
const to = extrinsic.args[0]?.Id || "";
|
|
695
|
-
const amount = BigInt(extrinsic.args[1].replace(/,/g, ""));
|
|
597
|
+
break;
|
|
598
|
+
case "TransferSingle":
|
|
696
599
|
transfers.push({
|
|
697
|
-
amount:
|
|
698
|
-
blockNumber: blockNumber,
|
|
699
|
-
from: from,
|
|
700
|
-
to: to,
|
|
701
|
-
token: null,
|
|
702
|
-
tokenType: "NATIVE",
|
|
703
|
-
timestamp: blockTimestamp,
|
|
704
|
-
transactionGasFee: 0n,
|
|
705
|
-
transactionHash: extrinsic.hash
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
break;
|
|
709
|
-
}
|
|
710
|
-
case "FILECOIN":
|
|
711
|
-
{
|
|
712
|
-
const typedBlock = block;
|
|
713
|
-
const blockNumber = typedBlock.Height;
|
|
714
|
-
const blockTimestamp = new Date(typedBlock.Blocks[0].Timestamp * 1000).toISOString();
|
|
715
|
-
const parentBaseFee = BigInt(typedBlock.Blocks[0].ParentBaseFee);
|
|
716
|
-
let receiptIndex = 0;
|
|
717
|
-
for (const msgGroup of typedBlock.messages){
|
|
718
|
-
const secpkMessages = msgGroup.blockMessages.SecpkMessages || [];
|
|
719
|
-
for (const msg of secpkMessages){
|
|
720
|
-
const receipt = typedBlock.receipts[receiptIndex++];
|
|
721
|
-
const gasUsed = receipt ? BigInt(receipt.GasUsed) : BigInt(0);
|
|
722
|
-
const gasFeeCap = BigInt(msg.Message.GasFeeCap);
|
|
723
|
-
const gasPremium = BigInt(msg.Message.GasPremium);
|
|
724
|
-
const baseFeeBurn = gasUsed * parentBaseFee;
|
|
725
|
-
const minerTip = gasUsed * (gasPremium < gasFeeCap - parentBaseFee ? gasPremium : gasFeeCap - parentBaseFee);
|
|
726
|
-
const transactionGasFee = baseFeeBurn + minerTip;
|
|
727
|
-
transfers.push({
|
|
728
|
-
amount: BigInt(msg.Message.Value),
|
|
729
|
-
blockNumber: blockNumber,
|
|
730
|
-
from: msg.Message.From,
|
|
731
|
-
to: msg.Message.To,
|
|
732
|
-
token: null,
|
|
733
|
-
tokenType: "NATIVE",
|
|
734
|
-
timestamp: blockTimestamp,
|
|
735
|
-
transactionGasFee: transactionGasFee,
|
|
736
|
-
transactionHash: msg.CID["/"]
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
break;
|
|
741
|
-
}
|
|
742
|
-
// attempt to introspect data types
|
|
743
|
-
default:
|
|
744
|
-
// try Cosmos
|
|
745
|
-
if (block.block) {
|
|
746
|
-
const typedBlock = block;
|
|
747
|
-
const blockNumber = Number(typedBlock.block.header.height);
|
|
748
|
-
const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();
|
|
749
|
-
for (const txRaw of typedBlock.block.data.txs || []){
|
|
750
|
-
const decoded = (0, $8zHUo$cosmjsprotosigning.decodeTxRaw)(new Uint8Array($6144a02851f23907$require$Buffer.from(txRaw, "base64")));
|
|
751
|
-
const txHash = (0, $8zHUo$viem.sha256)(new Uint8Array($6144a02851f23907$require$Buffer.from(txRaw, "base64")));
|
|
752
|
-
const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || "0");
|
|
753
|
-
const registry = new (0, $8zHUo$cosmjsprotosigning.Registry)((0, $8zHUo$cosmjsstargate.defaultRegistryTypes));
|
|
754
|
-
for (const message of decoded.body.messages)if ([
|
|
755
|
-
"/ibc.applications.transfer.v1.MsgTransfer",
|
|
756
|
-
"/cosmos.bank.v1beta1.MsgSend"
|
|
757
|
-
].includes(message.typeUrl)) {
|
|
758
|
-
const decodedMsg = registry.decode(message);
|
|
759
|
-
transfers.push({
|
|
760
|
-
blockNumber: blockNumber,
|
|
761
|
-
from: decodedMsg.sender,
|
|
762
|
-
to: decodedMsg.receiver,
|
|
763
|
-
amount: BigInt(decodedMsg.token.amount),
|
|
764
|
-
token: decodedMsg.token.denom,
|
|
765
|
-
tokenType: "NATIVE",
|
|
766
|
-
timestamp: blockTimestamp,
|
|
767
|
-
transactionHash: txHash.slice(2).toUpperCase(),
|
|
768
|
-
transactionGasFee: transactionGasFee
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
break;
|
|
773
|
-
}
|
|
774
|
-
// otherwise assume EVM
|
|
775
|
-
for (const tx of block.transactions){
|
|
776
|
-
if (!tx.receipt) continue;
|
|
777
|
-
const timestamp = new Date(block.timestamp * 1000).toISOString();
|
|
778
|
-
const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);
|
|
779
|
-
// track direct ETH transfers
|
|
780
|
-
if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("NATIVE")) {
|
|
781
|
-
// pull from traces, if available
|
|
782
|
-
if (Array.isArray(tx.traces)) for (const trace of tx.traces.filter((t)=>t.action)){
|
|
783
|
-
const action = trace.action;
|
|
784
|
-
if (!action?.value) continue;
|
|
785
|
-
transfers.push({
|
|
786
|
-
amount: BigInt(action.value),
|
|
787
|
-
blockNumber: tx.blockNumber,
|
|
788
|
-
from: action.from?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
789
|
-
index: trace.traceAddress?.join("-"),
|
|
790
|
-
timestamp: timestamp,
|
|
791
|
-
to: action.to?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
792
|
-
tokenType: "NATIVE",
|
|
793
|
-
transactionGasFee: transactionGasFee,
|
|
794
|
-
transactionHash: tx.hash
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
else if (tx.value?.length >= 3 || /\d+/.test(tx.value)) transfers.push({
|
|
798
|
-
amount: BigInt(tx.value),
|
|
600
|
+
amount: txfer.decoded.value,
|
|
799
601
|
blockNumber: tx.blockNumber,
|
|
800
|
-
from:
|
|
602
|
+
from: txfer.decoded.from?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
603
|
+
index: log.logIndex,
|
|
801
604
|
timestamp: timestamp,
|
|
802
|
-
to:
|
|
803
|
-
|
|
605
|
+
to: txfer.decoded.to?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
606
|
+
token: log.address.toLowerCase(),
|
|
607
|
+
tokenId: txfer.decoded.id.toString(),
|
|
608
|
+
tokenType: "NFT",
|
|
804
609
|
transactionGasFee: transactionGasFee,
|
|
805
610
|
transactionHash: tx.hash
|
|
806
611
|
});
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
"Transfer(address indexed from, address indexed to, uint256 value)"
|
|
812
|
-
]);
|
|
813
|
-
if (txfer) transfers.push({
|
|
814
|
-
amount: txfer.decoded.value,
|
|
612
|
+
break;
|
|
613
|
+
case "TransferBatch":
|
|
614
|
+
for(let i = 0; i < txfer.decoded.ids.length; i += 1)transfers.push({
|
|
615
|
+
amount: txfer.decoded.values[i],
|
|
815
616
|
blockNumber: tx.blockNumber,
|
|
816
|
-
from: txfer.decoded.from?.toLowerCase() || $
|
|
617
|
+
from: txfer.decoded.from?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
817
618
|
index: log.logIndex,
|
|
818
619
|
timestamp: timestamp,
|
|
819
|
-
to: txfer.decoded.to?.toLowerCase() || $
|
|
620
|
+
to: txfer.decoded.to?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
|
|
820
621
|
token: log.address.toLowerCase(),
|
|
821
|
-
|
|
622
|
+
tokenId: txfer.decoded.ids[i].toString(),
|
|
623
|
+
tokenType: "NFT",
|
|
822
624
|
transactionGasFee: transactionGasFee,
|
|
823
625
|
transactionHash: tx.hash
|
|
824
626
|
});
|
|
825
|
-
|
|
826
|
-
if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("NFT")) for (const log of tx.receipt.logs){
|
|
827
|
-
const txfer = (0, $da55be3e40667945$export$cf548b70626e2eb9)(log, [
|
|
828
|
-
"Transfer(address indexed from, address indexed to, uint256 indexed value)",
|
|
829
|
-
"TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)",
|
|
830
|
-
"TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)"
|
|
831
|
-
]);
|
|
832
|
-
if (!txfer) continue;
|
|
833
|
-
switch(txfer.metadata.name){
|
|
834
|
-
case "Transfer":
|
|
835
|
-
transfers.push({
|
|
836
|
-
amount: 1,
|
|
837
|
-
blockNumber: tx.blockNumber,
|
|
838
|
-
from: txfer.decoded.from?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
839
|
-
index: log.logIndex,
|
|
840
|
-
timestamp: timestamp,
|
|
841
|
-
to: txfer.decoded.to?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
842
|
-
token: log.address.toLowerCase(),
|
|
843
|
-
tokenId: txfer.decoded.value.toString(),
|
|
844
|
-
tokenType: "NFT",
|
|
845
|
-
transactionGasFee: transactionGasFee,
|
|
846
|
-
transactionHash: tx.hash
|
|
847
|
-
});
|
|
848
|
-
break;
|
|
849
|
-
case "TransferSingle":
|
|
850
|
-
transfers.push({
|
|
851
|
-
amount: txfer.decoded.value,
|
|
852
|
-
blockNumber: tx.blockNumber,
|
|
853
|
-
from: txfer.decoded.from?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
854
|
-
index: log.logIndex,
|
|
855
|
-
timestamp: timestamp,
|
|
856
|
-
to: txfer.decoded.to?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
857
|
-
token: log.address.toLowerCase(),
|
|
858
|
-
tokenId: txfer.decoded.id.toString(),
|
|
859
|
-
tokenType: "NFT",
|
|
860
|
-
transactionGasFee: transactionGasFee,
|
|
861
|
-
transactionHash: tx.hash
|
|
862
|
-
});
|
|
863
|
-
break;
|
|
864
|
-
case "TransferBatch":
|
|
865
|
-
for(let i = 0; i < txfer.decoded.ids.length; i += 1)transfers.push({
|
|
866
|
-
amount: txfer.decoded.values[i],
|
|
867
|
-
blockNumber: tx.blockNumber,
|
|
868
|
-
from: txfer.decoded.from?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
869
|
-
index: log.logIndex,
|
|
870
|
-
timestamp: timestamp,
|
|
871
|
-
to: txfer.decoded.to?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
872
|
-
token: log.address.toLowerCase(),
|
|
873
|
-
tokenId: txfer.decoded.ids[i].toString(),
|
|
874
|
-
tokenType: "NFT",
|
|
875
|
-
transactionGasFee: transactionGasFee,
|
|
876
|
-
transactionHash: tx.hash
|
|
877
|
-
});
|
|
878
|
-
break;
|
|
879
|
-
}
|
|
880
|
-
}
|
|
627
|
+
break;
|
|
881
628
|
}
|
|
882
|
-
|
|
883
|
-
if (typeof _ctx.params.walletAddress === "string") _ctx.params.walletAddress = _ctx.params.walletAddress.toLowerCase();
|
|
884
|
-
break;
|
|
629
|
+
}
|
|
885
630
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
if (txfer.amount <= BigInt(0)) return false;
|
|
889
|
-
if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token && txfer.token) return false;
|
|
890
|
-
if (_ctx.params.walletAddress && ![
|
|
891
|
-
txfer.from,
|
|
892
|
-
txfer.to
|
|
893
|
-
].includes(_ctx.params.walletAddress)) return false;
|
|
894
|
-
const key = `${txfer.transactionHash}-${txfer.from}-${txfer.to}-${txfer.amount}-${txfer.token}`;
|
|
895
|
-
if (seenTransfers.has(key)) return false;
|
|
896
|
-
seenTransfers.add(key);
|
|
897
|
-
return true;
|
|
898
|
-
});
|
|
631
|
+
if (typeof _ctx.params.contractAddress === "string") _ctx.params.contractAddress = _ctx.params.contractAddress.toLowerCase();
|
|
632
|
+
if (typeof _ctx.params.walletAddress === "string") _ctx.params.walletAddress = _ctx.params.walletAddress.toLowerCase();
|
|
899
633
|
return transfers;
|
|
900
634
|
},
|
|
901
635
|
tests: [
|
|
902
|
-
// APTOS
|
|
903
636
|
{
|
|
904
637
|
params: {
|
|
905
|
-
network: "
|
|
906
|
-
walletAddress: "
|
|
907
|
-
contractAddress: "
|
|
638
|
+
network: "BASE",
|
|
639
|
+
walletAddress: "0x4F80864cD68782144e3736626896990acAe15a11",
|
|
640
|
+
contractAddress: "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed"
|
|
908
641
|
},
|
|
909
|
-
payload: "https://jiti.indexing.co/networks/
|
|
910
|
-
output: [
|
|
911
|
-
{
|
|
912
|
-
amount: 1611839920n,
|
|
913
|
-
blockNumber: 297956660,
|
|
914
|
-
from: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
915
|
-
to: "0x3b5d2e7e8da86903beb19d5a7135764aac812e18af193895d75f3a8f6a066cb0",
|
|
916
|
-
timestamp: "2025-03-02T21:07:06.002Z",
|
|
917
|
-
token: null,
|
|
918
|
-
tokenType: "TOKEN",
|
|
919
|
-
transactionGasFee: 13n,
|
|
920
|
-
transactionHash: "0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13"
|
|
921
|
-
},
|
|
922
|
-
{
|
|
923
|
-
amount: 1502138836n,
|
|
924
|
-
blockNumber: 297956660,
|
|
925
|
-
from: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
926
|
-
to: "0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e",
|
|
927
|
-
timestamp: "2025-03-02T21:07:06.002Z",
|
|
928
|
-
token: null,
|
|
929
|
-
tokenType: "TOKEN",
|
|
930
|
-
transactionGasFee: 13n,
|
|
931
|
-
transactionHash: "0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13"
|
|
932
|
-
}
|
|
933
|
-
]
|
|
934
|
-
},
|
|
935
|
-
// APTOS
|
|
936
|
-
{
|
|
937
|
-
params: {
|
|
938
|
-
network: "APTOS",
|
|
939
|
-
contractAddress: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"
|
|
940
|
-
},
|
|
941
|
-
payload: "https://jiti.indexing.co/networks/aptos/303623631",
|
|
942
|
-
output: [
|
|
943
|
-
{
|
|
944
|
-
amount: 1000060n,
|
|
945
|
-
blockNumber: 303623631,
|
|
946
|
-
from: "0xa4e7455d27731ab857e9701b1e6ed72591132b909fe6e4fd99b66c1d6318d9e8",
|
|
947
|
-
timestamp: "2025-03-14T15:39:49.845Z",
|
|
948
|
-
to: "0x9317336bfc9ba6987d40492ddea8d41e11b7c2e473f3556a9c82309d326e79ce",
|
|
949
|
-
token: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b",
|
|
950
|
-
tokenType: "TOKEN",
|
|
951
|
-
transactionGasFee: 16n,
|
|
952
|
-
transactionHash: "0x24b8854bad1f6543b35069eacd6ec40a583ca7fa452b422b04d747d24b65279c"
|
|
953
|
-
}
|
|
954
|
-
]
|
|
955
|
-
},
|
|
956
|
-
// BASE
|
|
957
|
-
{
|
|
958
|
-
params: {
|
|
959
|
-
network: "BASE",
|
|
960
|
-
walletAddress: "0x4F80864cD68782144e3736626896990acAe15a11",
|
|
961
|
-
contractAddress: "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed"
|
|
962
|
-
},
|
|
963
|
-
payload: "https://jiti.indexing.co/networks/base/23507423",
|
|
642
|
+
payload: "https://jiti.indexing.co/networks/base/23507423",
|
|
964
643
|
output: [
|
|
965
644
|
{
|
|
966
645
|
amount: 1000000000000000000000n,
|
|
@@ -975,101 +654,52 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
975
654
|
transactionHash: "0x69c9b12ccbe2d4f2f1dfc7c4a8557fc099fc5df276424417815acbc79a06fd56"
|
|
976
655
|
}
|
|
977
656
|
]
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
output: [
|
|
1010
|
-
{
|
|
1011
|
-
amount: 1110000n,
|
|
1012
|
-
blockNumber: 11443286,
|
|
1013
|
-
from: "addr1qymdv285few5tyqvya86rl97r9e608njs37shfew6l2nn473aw2pcnrcvfwfgg2dnew99m4tjj0apsu7232w2euzwpysndh0h3",
|
|
1014
|
-
timestamp: "+057068-01-19T05:23:20.000Z",
|
|
1015
|
-
to: "addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund",
|
|
1016
|
-
token: null,
|
|
1017
|
-
tokenType: "NATIVE",
|
|
1018
|
-
transactionGasFee: 174257n,
|
|
1019
|
-
transactionHash: "261c42ba9124f55d8e169ebb692cd3759d796a54369acb316ee449b546e79309"
|
|
1020
|
-
}
|
|
1021
|
-
]
|
|
1022
|
-
},
|
|
1023
|
-
// COSMOS
|
|
1024
|
-
{
|
|
1025
|
-
params: {
|
|
1026
|
-
network: "COSMOS",
|
|
1027
|
-
walletAddress: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
1028
|
-
contractAddress: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
|
|
1029
|
-
},
|
|
1030
|
-
payload: "https://jiti.indexing.co/networks/cosmos/24419691",
|
|
1031
|
-
output: [
|
|
1032
|
-
{
|
|
1033
|
-
blockNumber: 24419691,
|
|
1034
|
-
from: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
|
|
1035
|
-
to: "noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv",
|
|
1036
|
-
amount: 500000n,
|
|
1037
|
-
token: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013",
|
|
1038
|
-
tokenType: "NATIVE",
|
|
1039
|
-
timestamp: "2025-02-14T21:48:22.809Z",
|
|
1040
|
-
transactionHash: "963D4D7BB59C1280F58A7ECA2F1934E2AA005109A989193C815C7B98EDCD7445",
|
|
1041
|
-
transactionGasFee: 4860n
|
|
1042
|
-
}
|
|
1043
|
-
]
|
|
1044
|
-
},
|
|
1045
|
-
// DOGECOIN
|
|
1046
|
-
{
|
|
1047
|
-
params: {
|
|
1048
|
-
network: "DOGECOIN",
|
|
1049
|
-
walletAddress: "DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP",
|
|
1050
|
-
contractAddress: ""
|
|
1051
|
-
},
|
|
1052
|
-
payload: "https://jiti.indexing.co/networks/dogecoin/1000075",
|
|
1053
|
-
output: [
|
|
1054
|
-
{
|
|
1055
|
-
amount: 1008521000000n,
|
|
1056
|
-
blockNumber: 1000075,
|
|
1057
|
-
from: "DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP",
|
|
1058
|
-
to: "DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP",
|
|
657
|
+
}
|
|
658
|
+
]
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
const $5a4d345db3c04a51$export$d7ac970e8e789607 = {
|
|
663
|
+
match: (block)=>[
|
|
664
|
+
"FILECOIN"
|
|
665
|
+
].includes(block._network),
|
|
666
|
+
transform (block) {
|
|
667
|
+
let transfers = [];
|
|
668
|
+
const typedBlock = block;
|
|
669
|
+
const blockNumber = typedBlock.Height;
|
|
670
|
+
const blockTimestamp = new Date(typedBlock.Blocks[0].Timestamp * 1000).toISOString();
|
|
671
|
+
const parentBaseFee = BigInt(typedBlock.Blocks[0].ParentBaseFee);
|
|
672
|
+
let receiptIndex = 0;
|
|
673
|
+
for (const msgGroup of typedBlock.messages){
|
|
674
|
+
const secpkMessages = msgGroup.blockMessages.SecpkMessages || [];
|
|
675
|
+
for (const msg of secpkMessages){
|
|
676
|
+
const receipt = typedBlock.receipts[receiptIndex++];
|
|
677
|
+
const gasUsed = receipt ? BigInt(receipt.GasUsed) : BigInt(0);
|
|
678
|
+
const gasFeeCap = BigInt(msg.Message.GasFeeCap);
|
|
679
|
+
const gasPremium = BigInt(msg.Message.GasPremium);
|
|
680
|
+
const baseFeeBurn = gasUsed * parentBaseFee;
|
|
681
|
+
const minerTip = gasUsed * (gasPremium < gasFeeCap - parentBaseFee ? gasPremium : gasFeeCap - parentBaseFee);
|
|
682
|
+
const transactionGasFee = baseFeeBurn + minerTip;
|
|
683
|
+
transfers.push({
|
|
684
|
+
amount: BigInt(msg.Message.Value),
|
|
685
|
+
blockNumber: blockNumber,
|
|
686
|
+
from: msg.Message.From,
|
|
687
|
+
to: msg.Message.To,
|
|
1059
688
|
token: null,
|
|
1060
689
|
tokenType: "NATIVE",
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
}
|
|
1067
|
-
|
|
690
|
+
timestamp: blockTimestamp,
|
|
691
|
+
transactionGasFee: transactionGasFee,
|
|
692
|
+
transactionHash: msg.CID["/"]
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
return transfers;
|
|
697
|
+
},
|
|
698
|
+
tests: [
|
|
1068
699
|
{
|
|
1069
700
|
params: {
|
|
1070
701
|
network: "FILECOIN",
|
|
1071
|
-
walletAddress: "f1e3aa3z6gkaqxxwmbbna5gf2frggswwjaeavx7bq"
|
|
1072
|
-
contractAddress: "f1bqdligg7ipuiizvmdn7ijobhbkwaieh6z6lah5y"
|
|
702
|
+
walletAddress: "f1e3aa3z6gkaqxxwmbbna5gf2frggswwjaeavx7bq"
|
|
1073
703
|
},
|
|
1074
704
|
payload: "https://jiti.indexing.co/networks/filecoin/4818438",
|
|
1075
705
|
output: [
|
|
@@ -1085,8 +715,47 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
1085
715
|
transactionHash: "bafy2bzacecxud3tayyq3caagjej5srufcx5fufjuqkz3ltgfty27wdsrmqeew"
|
|
1086
716
|
}
|
|
1087
717
|
]
|
|
1088
|
-
}
|
|
1089
|
-
|
|
718
|
+
}
|
|
719
|
+
]
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
const $2e46ec862e47c14f$export$400f08bfae9ee97f = {
|
|
724
|
+
match: (block)=>[
|
|
725
|
+
"RIPPLE"
|
|
726
|
+
].includes(block._network),
|
|
727
|
+
transform (block) {
|
|
728
|
+
let transfers = [];
|
|
729
|
+
if (!Array.isArray(block.transactions)) return [];
|
|
730
|
+
for (const rawTx of block.transactions){
|
|
731
|
+
const typedTx = rawTx;
|
|
732
|
+
if (typedTx.TransactionType !== "Payment") continue;
|
|
733
|
+
const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? "0";
|
|
734
|
+
let tokenSymbol = "XRP";
|
|
735
|
+
let tokenType = "NATIVE";
|
|
736
|
+
let parsedAmount;
|
|
737
|
+
if (typeof deliveredOrAmount === "object") {
|
|
738
|
+
tokenSymbol = deliveredOrAmount.currency?.toUpperCase() ?? "UNKNOWN";
|
|
739
|
+
tokenType = "TOKEN";
|
|
740
|
+
const floatVal = parseFloat(deliveredOrAmount.value);
|
|
741
|
+
const smallestUnit = Math.round(floatVal * 1000000);
|
|
742
|
+
parsedAmount = BigInt(smallestUnit);
|
|
743
|
+
} else parsedAmount = BigInt(String(deliveredOrAmount));
|
|
744
|
+
transfers.push({
|
|
745
|
+
amount: parsedAmount,
|
|
746
|
+
blockNumber: parseInt(block.ledger_index, 10),
|
|
747
|
+
from: typedTx.Account ?? "UNKNOWN",
|
|
748
|
+
timestamp: block.close_time_iso ? block.close_time_iso : null,
|
|
749
|
+
to: typedTx.Destination ?? "UNKNOWN",
|
|
750
|
+
token: tokenSymbol,
|
|
751
|
+
tokenType: tokenType,
|
|
752
|
+
transactionGasFee: BigInt(typedTx.Fee ?? "0"),
|
|
753
|
+
transactionHash: typedTx.hash ?? ""
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
return transfers;
|
|
757
|
+
},
|
|
758
|
+
tests: [
|
|
1090
759
|
{
|
|
1091
760
|
params: {
|
|
1092
761
|
network: "RIPPLE",
|
|
@@ -1107,52 +776,59 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
1107
776
|
transactionHash: "03564E6109261CDE73FCC5062C2A0A70F365CB1A0F9408C065B60EC3E94E4DBF"
|
|
1108
777
|
}
|
|
1109
778
|
]
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
779
|
+
}
|
|
780
|
+
]
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
const $3b9b8f5747dcca8e$export$722698bc663d0ac0 = {
|
|
785
|
+
match: (block)=>[
|
|
786
|
+
"SUI"
|
|
787
|
+
].includes(block._network),
|
|
788
|
+
transform (block) {
|
|
789
|
+
let transfers = [];
|
|
790
|
+
const blockNumber = parseInt(block.sequence, 10);
|
|
791
|
+
const blockTimestamp = new Date(parseInt(block.timestamp, 10)).toISOString();
|
|
792
|
+
const transactions = block.transactions || [];
|
|
793
|
+
for (const tx of transactions){
|
|
794
|
+
const transactionHash = tx.digest;
|
|
795
|
+
let transactionGasFee = BigInt(0);
|
|
796
|
+
if (tx.effects?.gasUsed) {
|
|
797
|
+
const gu = tx.effects.gasUsed;
|
|
798
|
+
transactionGasFee = BigInt(gu.computationCost) + BigInt(gu.storageCost) - BigInt(gu.storageRebate) + BigInt(gu.nonRefundableStorageFee);
|
|
799
|
+
if (transactionGasFee < 0n) transactionGasFee = 0n;
|
|
800
|
+
}
|
|
801
|
+
const balanceChanges = tx.balanceChanges || [];
|
|
802
|
+
for (const bc of balanceChanges){
|
|
803
|
+
let rawAmt = BigInt(bc.amount);
|
|
804
|
+
if (rawAmt === 0n) continue;
|
|
805
|
+
let fromAddr;
|
|
806
|
+
let toAddr;
|
|
807
|
+
const rawOwner = bc.owner?.AddressOwner || bc.owner?.ObjectOwner || bc.owner?.Shared?.initial_shared_version || "UNKNOWN_OWNER";
|
|
808
|
+
if (rawAmt < 0n) {
|
|
809
|
+
fromAddr = String(rawOwner);
|
|
810
|
+
toAddr = undefined;
|
|
811
|
+
rawAmt = -rawAmt;
|
|
812
|
+
} else {
|
|
813
|
+
fromAddr = undefined;
|
|
814
|
+
toAddr = String(rawOwner);
|
|
1130
815
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
walletAddress: "0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54",
|
|
1138
|
-
contractAddress: ""
|
|
1139
|
-
},
|
|
1140
|
-
payload: "https://jiti.indexing.co/networks/starknet/1149460",
|
|
1141
|
-
output: [
|
|
1142
|
-
{
|
|
1143
|
-
amount: 0x1c286f74458fc6n,
|
|
1144
|
-
blockNumber: 1149460,
|
|
1145
|
-
from: "0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54",
|
|
1146
|
-
timestamp: "2025-02-13T17:36:52.000Z",
|
|
1147
|
-
to: "0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8",
|
|
1148
|
-
token: null,
|
|
816
|
+
transfers.push({
|
|
817
|
+
blockNumber: blockNumber,
|
|
818
|
+
from: fromAddr,
|
|
819
|
+
to: toAddr,
|
|
820
|
+
amount: rawAmt,
|
|
821
|
+
token: bc.coinType,
|
|
1149
822
|
tokenType: "NATIVE",
|
|
1150
|
-
|
|
1151
|
-
transactionHash:
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
823
|
+
timestamp: blockTimestamp,
|
|
824
|
+
transactionHash: transactionHash,
|
|
825
|
+
transactionGasFee: transactionGasFee
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
return transfers;
|
|
830
|
+
},
|
|
831
|
+
tests: [
|
|
1156
832
|
{
|
|
1157
833
|
params: {
|
|
1158
834
|
network: "SUI",
|
|
@@ -1206,30 +882,123 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
1206
882
|
transactionGasFee: 5408192n
|
|
1207
883
|
}
|
|
1208
884
|
]
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
885
|
+
}
|
|
886
|
+
]
|
|
887
|
+
};
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
const $290fd8bc430da9f0$export$1f0fe79deb1b813b = {
|
|
891
|
+
match: (block)=>[
|
|
892
|
+
"SOLANA"
|
|
893
|
+
].includes(block._network),
|
|
894
|
+
transform (block) {
|
|
895
|
+
let transfers = [];
|
|
896
|
+
for (const tx of block.transactions){
|
|
897
|
+
const solanaTx = tx;
|
|
898
|
+
const txHash = solanaTx.transaction.signatures[0];
|
|
899
|
+
const timestamp = block.blockTime ? new Date(block.blockTime * 1000).toISOString() : null;
|
|
900
|
+
const allAccounts = solanaTx.transaction.message.accountKeys.concat(solanaTx.meta.loadedAddresses.writable).concat(solanaTx.meta.loadedAddresses.readonly);
|
|
901
|
+
let txFee = BigInt(solanaTx.meta.fee);
|
|
902
|
+
if (txFee < BigInt(10)) txFee = txFee * BigInt(Math.pow(10, 9));
|
|
903
|
+
const transfersByKey = {};
|
|
904
|
+
for (const post of solanaTx.meta.postTokenBalances){
|
|
905
|
+
let matched = false;
|
|
906
|
+
for (const pre of solanaTx.meta.preTokenBalances)if (post.mint === pre.mint && post.owner === pre.owner) {
|
|
907
|
+
let diff = BigInt(post.uiTokenAmount.amount) - BigInt(pre.uiTokenAmount.amount);
|
|
908
|
+
if (diff === BigInt(0)) {
|
|
909
|
+
matched = true;
|
|
910
|
+
continue;
|
|
911
|
+
}
|
|
912
|
+
const isNegDiff = diff < 0;
|
|
913
|
+
if (diff < 0) diff = -diff;
|
|
914
|
+
const key = `${post.mint}-${diff.toString()}`;
|
|
915
|
+
const txfer = {
|
|
916
|
+
amount: diff,
|
|
917
|
+
blockNumber: block.blockHeight,
|
|
918
|
+
from: pre.owner,
|
|
919
|
+
timestamp: timestamp,
|
|
920
|
+
to: post.owner,
|
|
921
|
+
transactionGasFee: txFee,
|
|
922
|
+
transactionHash: txHash,
|
|
923
|
+
token: post.mint,
|
|
924
|
+
tokenType: "TOKEN"
|
|
925
|
+
};
|
|
926
|
+
if (isNegDiff) delete txfer.to;
|
|
927
|
+
else delete txfer.from;
|
|
928
|
+
transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
|
|
929
|
+
matched = true;
|
|
1229
930
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
931
|
+
if (!matched) {
|
|
932
|
+
let diff = BigInt(post.uiTokenAmount.amount);
|
|
933
|
+
const isNegDiff = diff < 0;
|
|
934
|
+
if (diff < 0) diff = -diff;
|
|
935
|
+
const key = `${post.mint}-${diff.toString()}`;
|
|
936
|
+
const txfer = {
|
|
937
|
+
amount: diff,
|
|
938
|
+
blockNumber: block.blockHeight,
|
|
939
|
+
from: null,
|
|
940
|
+
timestamp: timestamp,
|
|
941
|
+
to: post.owner,
|
|
942
|
+
token: post.mint,
|
|
943
|
+
tokenType: "TOKEN",
|
|
944
|
+
transactionGasFee: txFee,
|
|
945
|
+
transactionHash: txHash
|
|
946
|
+
};
|
|
947
|
+
if (isNegDiff) delete txfer.to;
|
|
948
|
+
else delete txfer.from;
|
|
949
|
+
transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
for(let i = 1; i < solanaTx.meta.postBalances.length; i += 1){
|
|
953
|
+
const post = solanaTx.meta.postBalances[i];
|
|
954
|
+
const pre = solanaTx.meta.preBalances[i];
|
|
955
|
+
if (post !== undefined && pre !== undefined && post !== pre) {
|
|
956
|
+
let diff = BigInt(post) - BigInt(pre);
|
|
957
|
+
if (diff < 0) diff = -diff;
|
|
958
|
+
const key = `null-${diff.toString()}`;
|
|
959
|
+
const txfer = {
|
|
960
|
+
amount: diff,
|
|
961
|
+
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,
|
|
963
|
+
timestamp: timestamp,
|
|
964
|
+
to: typeof allAccounts[i] === "string" ? allAccounts[i] : allAccounts[i]?.pubkey?.toString(),
|
|
965
|
+
token: null,
|
|
966
|
+
tokenType: "NATIVE",
|
|
967
|
+
transactionGasFee: txFee,
|
|
968
|
+
transactionHash: txHash
|
|
969
|
+
};
|
|
970
|
+
if (post > pre) {
|
|
971
|
+
if (transfersByKey[key]) delete txfer.from;
|
|
972
|
+
} else delete txfer.to;
|
|
973
|
+
transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
const unmatchedFrom = {};
|
|
977
|
+
const unmatchedTo = {};
|
|
978
|
+
for(const key in transfersByKey){
|
|
979
|
+
const txfer = transfersByKey[key];
|
|
980
|
+
if (!txfer.from) {
|
|
981
|
+
if (!unmatchedFrom[txfer.token]) unmatchedFrom[txfer.token] = [];
|
|
982
|
+
unmatchedFrom[txfer.token].push(txfer);
|
|
983
|
+
delete transfersByKey[key];
|
|
984
|
+
} else if (!txfer.to) {
|
|
985
|
+
if (!unmatchedTo[txfer.token]) unmatchedTo[txfer.token] = [];
|
|
986
|
+
unmatchedTo[txfer.token].push(txfer);
|
|
987
|
+
delete transfersByKey[key];
|
|
988
|
+
}
|
|
989
|
+
}
|
|
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
|
+
});
|
|
996
|
+
}
|
|
997
|
+
transfers.push(...Object.values(transfersByKey));
|
|
998
|
+
}
|
|
999
|
+
return transfers;
|
|
1000
|
+
},
|
|
1001
|
+
tests: [
|
|
1233
1002
|
{
|
|
1234
1003
|
params: {
|
|
1235
1004
|
network: "SOLANA",
|
|
@@ -1303,15 +1072,478 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
1303
1072
|
tokenType: "TOKEN"
|
|
1304
1073
|
}
|
|
1305
1074
|
]
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
params: {
|
|
1078
|
+
network: "SOLANA",
|
|
1079
|
+
walletAddress: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz"
|
|
1080
|
+
},
|
|
1081
|
+
payload: "https://jiti.indexing.co/networks/solana/332450156",
|
|
1082
|
+
output: [
|
|
1083
|
+
{
|
|
1084
|
+
amount: 402062750n,
|
|
1085
|
+
blockNumber: 310691098,
|
|
1086
|
+
from: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
|
|
1087
|
+
timestamp: "2025-04-10T02:29:35.000Z",
|
|
1088
|
+
to: "5yY5BGRgwa5rxvYPpMV9EkDpwp6w1vNNXUNzUCtMoFfR",
|
|
1089
|
+
token: null,
|
|
1090
|
+
tokenType: "NATIVE",
|
|
1091
|
+
transactionGasFee: 80001n,
|
|
1092
|
+
transactionHash: "32T7ANVqz1sHBoKhfk3omrRqwDCJFYMi6TfuAwyqHPCZPCihdWTU9t9i5D6tGwuytWRwRqnEXksMPMWbFbfBzVUk"
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
amount: 97937250n,
|
|
1096
|
+
blockNumber: 310691098,
|
|
1097
|
+
from: "DgC9bBDvJYeVyTqcp8nW5F5USNvxBiZ9NMoTUVy5UVPz",
|
|
1098
|
+
timestamp: "2025-04-10T02:29:35.000Z",
|
|
1099
|
+
to: "9zF2ZWTjnk6UkyWRxNtqy9UHims9u7LSaHGyhA5PwDSx",
|
|
1100
|
+
token: null,
|
|
1101
|
+
tokenType: "NATIVE",
|
|
1102
|
+
transactionGasFee: 80001n,
|
|
1103
|
+
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
|
+
}
|
|
1116
|
+
]
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
params: {
|
|
1120
|
+
network: "SOLANA",
|
|
1121
|
+
walletAddress: "J1dHwpKBs8Jo4n7jWEJWwMGNH2DJQnApBFPnnYXg74v7",
|
|
1122
|
+
contractAddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
|
|
1123
|
+
},
|
|
1124
|
+
payload: "https://jiti.indexing.co/networks/solana/332822080",
|
|
1125
|
+
output: [
|
|
1126
|
+
{
|
|
1127
|
+
amount: 2500000n,
|
|
1128
|
+
blockNumber: 311062104,
|
|
1129
|
+
from: "J1dHwpKBs8Jo4n7jWEJWwMGNH2DJQnApBFPnnYXg74v7",
|
|
1130
|
+
timestamp: "2025-04-11T19:36:39.000Z",
|
|
1131
|
+
to: "3LoAYHuSd7Gh8d7RTFnhvYtiTiefdZ5ByamU42vkzd76",
|
|
1132
|
+
token: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
1133
|
+
tokenType: "TOKEN",
|
|
1134
|
+
transactionGasFee: 350362n,
|
|
1135
|
+
transactionHash: "xKTWvnhSRErcHCMozRMEue4MriNr1Any6LiaQzXrR7imZ1MpZxRqbyv9LLg4JQoDq4oJZpDqPmzxLCtMCkgj2hn"
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
amount: 1373625000n,
|
|
1139
|
+
blockNumber: 311062104,
|
|
1140
|
+
from: "J1dHwpKBs8Jo4n7jWEJWwMGNH2DJQnApBFPnnYXg74v7",
|
|
1141
|
+
timestamp: "2025-04-11T19:36:39.000Z",
|
|
1142
|
+
to: "5guD4Uz462GT4Y4gEuqyGsHZ59JGxFN4a3rF6KWguMcJ",
|
|
1143
|
+
token: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
1144
|
+
tokenType: "TOKEN",
|
|
1145
|
+
transactionGasFee: 350362n,
|
|
1146
|
+
transactionHash: "xKTWvnhSRErcHCMozRMEue4MriNr1Any6LiaQzXrR7imZ1MpZxRqbyv9LLg4JQoDq4oJZpDqPmzxLCtMCkgj2hn"
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
amount: 1123875000n,
|
|
1150
|
+
blockNumber: 311062104,
|
|
1151
|
+
from: "J1dHwpKBs8Jo4n7jWEJWwMGNH2DJQnApBFPnnYXg74v7",
|
|
1152
|
+
timestamp: "2025-04-11T19:36:39.000Z",
|
|
1153
|
+
to: "DH4xmaWDnTzKXehVaPSNy9tMKJxnYL5Mo5U3oTHFtNYJ",
|
|
1154
|
+
token: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
1155
|
+
tokenType: "TOKEN",
|
|
1156
|
+
transactionGasFee: 350362n,
|
|
1157
|
+
transactionHash: "xKTWvnhSRErcHCMozRMEue4MriNr1Any6LiaQzXrR7imZ1MpZxRqbyv9LLg4JQoDq4oJZpDqPmzxLCtMCkgj2hn"
|
|
1158
|
+
}
|
|
1159
|
+
]
|
|
1160
|
+
}
|
|
1161
|
+
]
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
const $fc745f3cb8eb3f52$export$36783fc9701281c6 = {
|
|
1166
|
+
match: (block)=>[
|
|
1167
|
+
"STARKNET"
|
|
1168
|
+
].includes(block._network),
|
|
1169
|
+
transform (block) {
|
|
1170
|
+
let transfers = [];
|
|
1171
|
+
if (!Array.isArray(block.transactions)) return [];
|
|
1172
|
+
for (const tx of block.transactions){
|
|
1173
|
+
const typedTx = tx;
|
|
1174
|
+
const timestamp = block.timestamp ? new Date(block.timestamp * 1000).toISOString() : null;
|
|
1175
|
+
let transactionGasFee = BigInt(0);
|
|
1176
|
+
if (typedTx?.receipt?.actual_fee?.amount) transactionGasFee = BigInt(typedTx.receipt.actual_fee.amount);
|
|
1177
|
+
const transactionHash = typedTx.transaction_hash;
|
|
1178
|
+
if (!typedTx.receipt?.events) continue;
|
|
1179
|
+
for (const event of typedTx.receipt.events){
|
|
1180
|
+
if (!event.keys.includes("0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9")) continue;
|
|
1181
|
+
if (event.data.length < 3) continue;
|
|
1182
|
+
const [from, to, amountHex] = event.data;
|
|
1183
|
+
const amount = BigInt(amountHex);
|
|
1184
|
+
transfers.push({
|
|
1185
|
+
amount: amount,
|
|
1186
|
+
blockNumber: block.block_number,
|
|
1187
|
+
from: from,
|
|
1188
|
+
timestamp: timestamp,
|
|
1189
|
+
to: to,
|
|
1190
|
+
token: null,
|
|
1191
|
+
tokenType: "NATIVE",
|
|
1192
|
+
transactionGasFee: transactionGasFee,
|
|
1193
|
+
transactionHash: transactionHash
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
return transfers;
|
|
1198
|
+
},
|
|
1199
|
+
tests: [
|
|
1200
|
+
{
|
|
1201
|
+
params: {
|
|
1202
|
+
network: "STARKNET",
|
|
1203
|
+
walletAddress: "0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54",
|
|
1204
|
+
contractAddress: ""
|
|
1205
|
+
},
|
|
1206
|
+
payload: "https://jiti.indexing.co/networks/starknet/1149460",
|
|
1207
|
+
output: [
|
|
1208
|
+
{
|
|
1209
|
+
amount: 0x1c286f74458fc6n,
|
|
1210
|
+
blockNumber: 1149460,
|
|
1211
|
+
from: "0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54",
|
|
1212
|
+
timestamp: "2025-02-13T17:36:52.000Z",
|
|
1213
|
+
to: "0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8",
|
|
1214
|
+
token: null,
|
|
1215
|
+
tokenType: "NATIVE",
|
|
1216
|
+
transactionGasFee: 7925758505095110n,
|
|
1217
|
+
transactionHash: "0x707203dba31f442ae9a5477e6a8906f3676effa0f1d3bb19cbbc14e1ddfe21"
|
|
1218
|
+
}
|
|
1219
|
+
]
|
|
1220
|
+
}
|
|
1221
|
+
]
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
const $3478cd776d185339$export$681f497010b17679 = {
|
|
1226
|
+
match: (block)=>[
|
|
1227
|
+
"STELLAR"
|
|
1228
|
+
].includes(block._network),
|
|
1229
|
+
transform (block) {
|
|
1230
|
+
let transfers = [];
|
|
1231
|
+
for (const tx of block.transactions){
|
|
1232
|
+
const typedTx = tx;
|
|
1233
|
+
for (const op of typedTx.operations)if (op.type === "payment") transfers.push({
|
|
1234
|
+
amount: BigInt(op.amount.replace(".", "")),
|
|
1235
|
+
blockNumber: block.sequence,
|
|
1236
|
+
from: op.from,
|
|
1237
|
+
timestamp: typedTx.created_at,
|
|
1238
|
+
to: op.to,
|
|
1239
|
+
token: op.asset_type === "native" ? null : op.asset_issuer,
|
|
1240
|
+
tokenType: op.asset_type === "native" ? "NATIVE" : "TOKEN",
|
|
1241
|
+
transactionGasFee: BigInt(typedTx.fee_charged),
|
|
1242
|
+
transactionHash: typedTx.hash
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
return transfers;
|
|
1246
|
+
},
|
|
1247
|
+
tests: [
|
|
1248
|
+
{
|
|
1249
|
+
params: {
|
|
1250
|
+
network: "STELLAR",
|
|
1251
|
+
walletAddress: "GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X",
|
|
1252
|
+
contractAddress: "GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA"
|
|
1253
|
+
},
|
|
1254
|
+
payload: "https://jiti.indexing.co/networks/stellar/51720546",
|
|
1255
|
+
output: [
|
|
1256
|
+
{
|
|
1257
|
+
amount: 150000n,
|
|
1258
|
+
blockNumber: 51720546,
|
|
1259
|
+
from: "GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X",
|
|
1260
|
+
timestamp: "2024-05-18T04:41:39Z",
|
|
1261
|
+
to: "GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA",
|
|
1262
|
+
token: "GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA",
|
|
1263
|
+
tokenType: "TOKEN",
|
|
1264
|
+
transactionGasFee: 100n,
|
|
1265
|
+
transactionHash: "4fb2441210cbe87f5003abdfa86f03bafa54f789ed041feccbda0bd054297c4d"
|
|
1266
|
+
}
|
|
1267
|
+
]
|
|
1268
|
+
}
|
|
1269
|
+
]
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
const $11a2c5b0fd56c033$export$bc6c7ab7e0727dd7 = {
|
|
1274
|
+
match: (block)=>[
|
|
1275
|
+
"ASTAR",
|
|
1276
|
+
"ENJIN",
|
|
1277
|
+
"KUSAMA",
|
|
1278
|
+
"POLKADOT",
|
|
1279
|
+
"BITTENSOR"
|
|
1280
|
+
].includes(block._network),
|
|
1281
|
+
transform (block) {
|
|
1282
|
+
let transfers = [];
|
|
1283
|
+
const typedBlock = block;
|
|
1284
|
+
const blockNumber = typedBlock.blockNumber;
|
|
1285
|
+
const timestampExtrinsic = typedBlock.extrinsics.find((ex)=>ex.method === "timestamp.set");
|
|
1286
|
+
const blockTimestamp = timestampExtrinsic ? new Date(Number(timestampExtrinsic.args[0].toString().replace(/,/g, ""))).toISOString() : new Date().toISOString();
|
|
1287
|
+
for (const extrinsic of typedBlock.extrinsics)if ([
|
|
1288
|
+
"balances.transfer",
|
|
1289
|
+
"balances.transferKeepAlive"
|
|
1290
|
+
].includes(extrinsic.method)) {
|
|
1291
|
+
const from = extrinsic.signer;
|
|
1292
|
+
const to = extrinsic.args[0]?.Id || "";
|
|
1293
|
+
const amount = BigInt(extrinsic.args[1].replace(/,/g, ""));
|
|
1294
|
+
transfers.push({
|
|
1295
|
+
amount: amount,
|
|
1296
|
+
blockNumber: blockNumber,
|
|
1297
|
+
from: from,
|
|
1298
|
+
to: to,
|
|
1299
|
+
token: null,
|
|
1300
|
+
tokenType: "NATIVE",
|
|
1301
|
+
timestamp: blockTimestamp,
|
|
1302
|
+
transactionGasFee: 0n,
|
|
1303
|
+
transactionHash: extrinsic.hash
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
return transfers;
|
|
1307
|
+
},
|
|
1308
|
+
tests: [
|
|
1309
|
+
{
|
|
1310
|
+
params: {
|
|
1311
|
+
network: "BITTENSOR",
|
|
1312
|
+
walletAddress: "5G6WmJ4mym9oSQzUF5tr7LvsNMvH5vWtutZM8vMvRv1Wwy6J",
|
|
1313
|
+
contractAddress: ""
|
|
1314
|
+
},
|
|
1315
|
+
payload: "https://jiti.indexing.co/networks/bittensor/2652896",
|
|
1316
|
+
output: [
|
|
1317
|
+
{
|
|
1318
|
+
amount: 2154999850n,
|
|
1319
|
+
blockNumber: 2652896,
|
|
1320
|
+
from: "5G6WmJ4mym9oSQzUF5tr7LvsNMvH5vWtutZM8vMvRv1Wwy6J",
|
|
1321
|
+
to: "5CFwmfLfL1Z6vXU6hgGksh6irDFpcVXaTTNRoqDGMyHrDKK1",
|
|
1322
|
+
token: null,
|
|
1323
|
+
tokenType: "NATIVE",
|
|
1324
|
+
timestamp: "2024-03-28T12:53:36.001Z",
|
|
1325
|
+
transactionGasFee: 0n,
|
|
1326
|
+
transactionHash: "0x9ea55a8f40b8d7704f27964155476ab9c744ec2ef2b1f431ad0e05a3a6f3c1ab"
|
|
1327
|
+
}
|
|
1328
|
+
]
|
|
1306
1329
|
}
|
|
1307
1330
|
]
|
|
1308
1331
|
};
|
|
1309
|
-
|
|
1332
|
+
|
|
1333
|
+
|
|
1334
|
+
const $cd430dd11c31e572$export$608f3f42810b9879 = {
|
|
1335
|
+
match: (block)=>[
|
|
1336
|
+
"TON"
|
|
1337
|
+
].includes(block._network),
|
|
1338
|
+
transform (block) {
|
|
1339
|
+
let transfers = [];
|
|
1340
|
+
const blockNumber = block.seqno;
|
|
1341
|
+
const blockTimestamp = new Date(block.shards?.[0]?.gen_utime * 1000).toISOString();
|
|
1342
|
+
for (const shard of block.shards || [])for (const tx of shard.transactions || []){
|
|
1343
|
+
const transactionLT = tx.transaction_id.lt;
|
|
1344
|
+
const transactionHash = tx.transaction_id.hash;
|
|
1345
|
+
const transactionFee = BigInt(tx.fee || "0");
|
|
1346
|
+
const inVal = BigInt(tx.in_msg?.value || "0");
|
|
1347
|
+
if (inVal > 0n) transfers.push({
|
|
1348
|
+
blockNumber: blockNumber,
|
|
1349
|
+
from: tx.in_msg?.source?.account_address,
|
|
1350
|
+
to: tx.address?.account_address,
|
|
1351
|
+
amount: inVal,
|
|
1352
|
+
token: "TON",
|
|
1353
|
+
tokenType: "NATIVE",
|
|
1354
|
+
timestamp: blockTimestamp,
|
|
1355
|
+
transactionHash: transactionHash,
|
|
1356
|
+
transactionGasFee: transactionFee
|
|
1357
|
+
});
|
|
1358
|
+
for (const outMsg of tx.out_msgs || []){
|
|
1359
|
+
const outVal = BigInt(outMsg.value || "0");
|
|
1360
|
+
if (outVal > 0n) transfers.push({
|
|
1361
|
+
blockNumber: blockNumber,
|
|
1362
|
+
from: outMsg.source?.account_address,
|
|
1363
|
+
to: outMsg.destination?.account_address,
|
|
1364
|
+
amount: outVal,
|
|
1365
|
+
token: "TON",
|
|
1366
|
+
tokenType: "NATIVE",
|
|
1367
|
+
timestamp: blockTimestamp,
|
|
1368
|
+
transactionHash: transactionHash,
|
|
1369
|
+
transactionGasFee: transactionFee
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
return transfers;
|
|
1374
|
+
},
|
|
1375
|
+
tests: [
|
|
1376
|
+
{
|
|
1377
|
+
params: {
|
|
1378
|
+
network: "TON",
|
|
1379
|
+
walletAddress: "EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40",
|
|
1380
|
+
contractAddress: ""
|
|
1381
|
+
},
|
|
1382
|
+
payload: "https://jiti.indexing.co/networks/ton/44919328",
|
|
1383
|
+
output: [
|
|
1384
|
+
{
|
|
1385
|
+
blockNumber: 44919328,
|
|
1386
|
+
from: "EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40",
|
|
1387
|
+
to: "EQCFTFAHOU3vFt2NiZhRD5dwuS0k7GS59vIg3WfCKwfaQGW2",
|
|
1388
|
+
amount: 10000000n,
|
|
1389
|
+
token: "TON",
|
|
1390
|
+
tokenType: "NATIVE",
|
|
1391
|
+
timestamp: "2025-02-13T23:10:18.000Z",
|
|
1392
|
+
transactionHash: "Vh5cWr2uvCsdhoouBQ+EiUcF54os9oqvh8A/62EroQc=",
|
|
1393
|
+
transactionGasFee: 2355233n
|
|
1394
|
+
}
|
|
1395
|
+
]
|
|
1396
|
+
}
|
|
1397
|
+
]
|
|
1398
|
+
};
|
|
1399
|
+
|
|
1400
|
+
|
|
1401
|
+
const $990c4f660694d8bc$export$4f5322cf4718bd30 = {
|
|
1402
|
+
match: (block)=>[
|
|
1403
|
+
"BITCOIN",
|
|
1404
|
+
"BITCOIN_TESTNET",
|
|
1405
|
+
"LITECOIN",
|
|
1406
|
+
"DOGECOIN"
|
|
1407
|
+
].includes(block._network),
|
|
1408
|
+
transform (block) {
|
|
1409
|
+
let transfers = [];
|
|
1410
|
+
for (const tx of block.tx){
|
|
1411
|
+
const timestamp = tx.time ? new Date(tx.time * 1000).toISOString() : null;
|
|
1412
|
+
const vin = tx.vin[0];
|
|
1413
|
+
const vout = tx.vout;
|
|
1414
|
+
const fromVout = Math.min(vin.vout || 1000, vout.length - 1);
|
|
1415
|
+
const fromAddress = vin.prevout?.scriptPubKey?.address || vout[fromVout]?.scriptPubKey?.address || vout[fromVout]?.scriptPubKey?.addresses?.[0];
|
|
1416
|
+
if (!fromAddress) continue;
|
|
1417
|
+
for (const v of vout)transfers.push({
|
|
1418
|
+
amount: BigInt(Math.round(v.value * Math.pow(10, 8))),
|
|
1419
|
+
blockNumber: block.height,
|
|
1420
|
+
from: fromAddress,
|
|
1421
|
+
timestamp: timestamp,
|
|
1422
|
+
to: v.scriptPubKey.address || v.scriptPubKey.addresses?.[0],
|
|
1423
|
+
transactionGasFee: BigInt(Math.round((tx.fee || 0) * Math.pow(10, 8))),
|
|
1424
|
+
transactionHash: tx.txid,
|
|
1425
|
+
token: null,
|
|
1426
|
+
tokenType: "NATIVE"
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
return transfers;
|
|
1430
|
+
},
|
|
1431
|
+
tests: [
|
|
1432
|
+
{
|
|
1433
|
+
params: {
|
|
1434
|
+
network: "DOGECOIN",
|
|
1435
|
+
walletAddress: "DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP",
|
|
1436
|
+
contractAddress: ""
|
|
1437
|
+
},
|
|
1438
|
+
payload: "https://jiti.indexing.co/networks/dogecoin/1000075",
|
|
1439
|
+
output: [
|
|
1440
|
+
{
|
|
1441
|
+
amount: 1008521000000n,
|
|
1442
|
+
blockNumber: 1000075,
|
|
1443
|
+
from: "DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP",
|
|
1444
|
+
to: "DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP",
|
|
1445
|
+
token: null,
|
|
1446
|
+
tokenType: "NATIVE",
|
|
1447
|
+
transactionGasFee: 0n,
|
|
1448
|
+
transactionHash: "9873fe46ab29f61cefdec498b691af68e0ad29a7599c94f42d2d4e9a5d461dbe",
|
|
1449
|
+
timestamp: "2015-12-13T19:59:52.000Z"
|
|
1450
|
+
}
|
|
1451
|
+
]
|
|
1452
|
+
}
|
|
1453
|
+
]
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
const $7dd402f6ad0dab6a$var$SUB_TEMPLATES = [
|
|
1458
|
+
(0, $25d5bdd23cba31eb$export$ace043a4f2efe476),
|
|
1459
|
+
(0, $60d24c82dc5feb2e$export$893111d8d332e195),
|
|
1460
|
+
(0, $5a4d345db3c04a51$export$d7ac970e8e789607),
|
|
1461
|
+
(0, $2e46ec862e47c14f$export$400f08bfae9ee97f),
|
|
1462
|
+
(0, $290fd8bc430da9f0$export$1f0fe79deb1b813b),
|
|
1463
|
+
(0, $fc745f3cb8eb3f52$export$36783fc9701281c6),
|
|
1464
|
+
(0, $3478cd776d185339$export$681f497010b17679),
|
|
1465
|
+
(0, $11a2c5b0fd56c033$export$bc6c7ab7e0727dd7),
|
|
1466
|
+
(0, $3b9b8f5747dcca8e$export$722698bc663d0ac0),
|
|
1467
|
+
(0, $cd430dd11c31e572$export$608f3f42810b9879),
|
|
1468
|
+
(0, $990c4f660694d8bc$export$4f5322cf4718bd30)
|
|
1469
|
+
];
|
|
1470
|
+
const $7dd402f6ad0dab6a$var$UNIVERSAL_SUB_TEMPLATES = [
|
|
1471
|
+
(0, $f9ab50a3e879ac1c$export$b5fd4920e8b7d913),
|
|
1472
|
+
(0, $8deaea1ef39b6485$export$5beebc5708fabf3c)
|
|
1473
|
+
];
|
|
1474
|
+
const $7dd402f6ad0dab6a$var$tokenTransfersTemplate = {
|
|
1475
|
+
key: "token_transfers",
|
|
1476
|
+
name: "Token Transfers",
|
|
1477
|
+
description: "Get all token transfers for a set of token types.",
|
|
1478
|
+
tags: [
|
|
1479
|
+
"EVM",
|
|
1480
|
+
"ERC20",
|
|
1481
|
+
"ERC721",
|
|
1482
|
+
"NFT",
|
|
1483
|
+
"TOKEN"
|
|
1484
|
+
],
|
|
1485
|
+
disabled: false,
|
|
1486
|
+
params: [
|
|
1487
|
+
{
|
|
1488
|
+
key: "network",
|
|
1489
|
+
name: "Network",
|
|
1490
|
+
type: "NETWORK",
|
|
1491
|
+
optional: false
|
|
1492
|
+
},
|
|
1493
|
+
{
|
|
1494
|
+
key: "contractAddress",
|
|
1495
|
+
name: "Contract Address",
|
|
1496
|
+
type: "ADDRESS",
|
|
1497
|
+
optional: true
|
|
1498
|
+
},
|
|
1499
|
+
{
|
|
1500
|
+
key: "walletAddress",
|
|
1501
|
+
name: "Wallet Address",
|
|
1502
|
+
type: "ADDRESS",
|
|
1503
|
+
optional: true
|
|
1504
|
+
},
|
|
1505
|
+
{
|
|
1506
|
+
key: "tokenTypes",
|
|
1507
|
+
name: "Token Types",
|
|
1508
|
+
type: "STRING",
|
|
1509
|
+
multiple: true,
|
|
1510
|
+
optional: true,
|
|
1511
|
+
values: [
|
|
1512
|
+
"NATIVE",
|
|
1513
|
+
"TOKEN",
|
|
1514
|
+
"NFT"
|
|
1515
|
+
]
|
|
1516
|
+
}
|
|
1517
|
+
],
|
|
1518
|
+
transform: (block, _ctx)=>{
|
|
1519
|
+
let transfers = [];
|
|
1520
|
+
for (const sub of $7dd402f6ad0dab6a$var$SUB_TEMPLATES.concat($7dd402f6ad0dab6a$var$UNIVERSAL_SUB_TEMPLATES))if (sub.match(block)) {
|
|
1521
|
+
transfers = sub.transform(block, _ctx);
|
|
1522
|
+
break;
|
|
1523
|
+
}
|
|
1524
|
+
const seenTransfers = new Set();
|
|
1525
|
+
transfers = transfers.filter((txfer)=>{
|
|
1526
|
+
if (txfer.amount <= BigInt(0)) return false;
|
|
1527
|
+
if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token) return false;
|
|
1528
|
+
if (_ctx.params.walletAddress && ![
|
|
1529
|
+
txfer.from,
|
|
1530
|
+
txfer.to
|
|
1531
|
+
].includes(_ctx.params.walletAddress)) return false;
|
|
1532
|
+
const key = `${txfer.transactionHash}-${txfer.from}-${txfer.to}-${txfer.amount}-${txfer.token}`;
|
|
1533
|
+
if (seenTransfers.has(key)) return false;
|
|
1534
|
+
seenTransfers.add(key);
|
|
1535
|
+
return true;
|
|
1536
|
+
});
|
|
1537
|
+
return transfers;
|
|
1538
|
+
},
|
|
1539
|
+
tests: $7dd402f6ad0dab6a$var$SUB_TEMPLATES.concat($7dd402f6ad0dab6a$var$UNIVERSAL_SUB_TEMPLATES).map((v)=>v.tests).flat()
|
|
1540
|
+
};
|
|
1541
|
+
var $7dd402f6ad0dab6a$export$2e2bcd8739ae039 = $7dd402f6ad0dab6a$var$tokenTransfersTemplate;
|
|
1310
1542
|
|
|
1311
1543
|
|
|
1312
1544
|
const $48f9879a44dd1195$export$a8fc3402335b0b04 = [
|
|
1313
1545
|
(0, $59fb8e0333a5d25f$export$2e2bcd8739ae039),
|
|
1314
|
-
(0, $
|
|
1546
|
+
(0, $7dd402f6ad0dab6a$export$2e2bcd8739ae039)
|
|
1315
1547
|
];
|
|
1316
1548
|
|
|
1317
1549
|
|