@indexing/jiti 0.0.4 → 0.0.5
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 +294 -204
- package/dist/main.js.map +1 -1
- package/dist/module.js +295 -201
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +11 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var $8zHUo$viem = require("viem");
|
|
2
|
-
var $8zHUo$isomorphicfetch = require("isomorphic-fetch");
|
|
3
2
|
|
|
4
3
|
|
|
5
4
|
function $parcel$export(e, n, v, s) {
|
|
@@ -23,163 +22,45 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
23
22
|
return dest;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
return a && a.__esModule ? a.default : a;
|
|
28
|
-
}
|
|
29
|
-
|
|
25
|
+
$parcel$export(module.exports, "templates", () => $882b6d93070905b3$export$a8fc3402335b0b04);
|
|
30
26
|
$parcel$export(module.exports, "getAllTemplates", () => $882b6d93070905b3$export$cceb5167b935aafb);
|
|
31
27
|
$parcel$export(module.exports, "getTemplateByKey", () => $882b6d93070905b3$export$a07bfd14bbc36e4b);
|
|
32
|
-
$parcel$export(module.exports, "presets", () => $14cf6f53e99b3d5b$exports);
|
|
33
28
|
$parcel$export(module.exports, "utils", () => $d7167569386d0d4c$exports);
|
|
34
29
|
$parcel$export(module.exports, "types", () => $faefaad95e5fcca0$exports);
|
|
35
|
-
const $
|
|
36
|
-
key: "
|
|
37
|
-
name: "
|
|
30
|
+
const $59fb8e0333a5d25f$var$rawTemplate = {
|
|
31
|
+
key: "raw",
|
|
32
|
+
name: "Raw Block Data",
|
|
38
33
|
description: "Get all blocks with all available fields",
|
|
39
34
|
tags: [
|
|
40
35
|
"EVM",
|
|
41
|
-
"
|
|
36
|
+
"RAW"
|
|
42
37
|
],
|
|
43
|
-
disabled:
|
|
38
|
+
disabled: true,
|
|
44
39
|
params: [],
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"ERC20",
|
|
63
|
-
"ERC721"
|
|
64
|
-
],
|
|
65
|
-
disabled: false,
|
|
66
|
-
params: [],
|
|
67
|
-
function: ()=>{
|
|
68
|
-
return `
|
|
69
|
-
function tokenTransfers(block, _ctx) {
|
|
70
|
-
return block;
|
|
71
|
-
}`;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var $6144a02851f23907$export$2e2bcd8739ae039 = $6144a02851f23907$var$tokenTransfers;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const $48f9879a44dd1195$export$a8fc3402335b0b04 = [
|
|
78
|
-
(0, $49a91814dabec06a$export$2e2bcd8739ae039),
|
|
79
|
-
(0, $6144a02851f23907$export$2e2bcd8739ae039)
|
|
80
|
-
];
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var $14cf6f53e99b3d5b$exports = {};
|
|
84
|
-
var $9c8abe84804d9e5d$exports = {};
|
|
85
|
-
|
|
86
|
-
$parcel$export($9c8abe84804d9e5d$exports, "erc20Transfers", () => $9c8abe84804d9e5d$export$b830a1966711a4f4);
|
|
87
|
-
var $da55be3e40667945$exports = {};
|
|
88
|
-
|
|
89
|
-
$parcel$export($da55be3e40667945$exports, "evmDecodeLog", () => $da55be3e40667945$export$18467e329ea485c9);
|
|
90
|
-
$parcel$export($da55be3e40667945$exports, "evmDecodeLogWithMetadata", () => $da55be3e40667945$export$cf548b70626e2eb9);
|
|
91
|
-
|
|
92
|
-
var $f7a3fb164436c9c3$exports = {};
|
|
93
|
-
|
|
94
|
-
$parcel$export($f7a3fb164436c9c3$exports, "evmMethodSignatureToHex", () => $f7a3fb164436c9c3$export$49d5c9473f8f70f2);
|
|
95
|
-
|
|
96
|
-
function $f7a3fb164436c9c3$export$49d5c9473f8f70f2(sig) {
|
|
97
|
-
const [method, rest] = sig.split("(");
|
|
98
|
-
const params = rest.split(")")[0].split(",").map((p)=>p.trim());
|
|
99
|
-
const topic0 = (0, $8zHUo$viem.keccak256)(`${method.split(" ").pop()}(${params.map((p)=>p.split(" ")[0]).join(",")})`);
|
|
100
|
-
return topic0;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
function $da55be3e40667945$export$18467e329ea485c9(log, signatures) {
|
|
105
|
-
if (Array.isArray(signatures)) {
|
|
106
|
-
for (const sig of signatures){
|
|
107
|
-
const decoded = $da55be3e40667945$export$18467e329ea485c9(log, sig);
|
|
108
|
-
if (decoded) return decoded;
|
|
109
|
-
}
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
if (typeof signatures !== "string" && Array.isArray(signatures.addresses) && signatures.addresses.length) {
|
|
113
|
-
const addresses = signatures.addresses.map((a)=>a?.toLowerCase());
|
|
114
|
-
if (!addresses.includes(log.address.toLowerCase())) return null;
|
|
115
|
-
}
|
|
116
|
-
let sig = (typeof signatures === "string" ? signatures : signatures.signature).trim();
|
|
117
|
-
if (!sig.startsWith("event ")) sig = "event " + sig;
|
|
118
|
-
const topic0 = typeof signatures !== "string" && signatures.topic0 ? signatures.topic0 : (0, $f7a3fb164436c9c3$export$49d5c9473f8f70f2)(sig);
|
|
119
|
-
if ((sig.match(/ indexed /g)?.length || 0) === log.topics.length - 1) {
|
|
120
|
-
if (log.topics[0] === topic0) try {
|
|
121
|
-
const result = (0, $8zHUo$viem.decodeEventLog)({
|
|
122
|
-
abi: (0, $8zHUo$viem.parseAbi)([
|
|
123
|
-
sig
|
|
124
|
-
]),
|
|
125
|
-
data: log.data,
|
|
126
|
-
topics: log.topics
|
|
127
|
-
});
|
|
128
|
-
return result.args;
|
|
129
|
-
} catch (e) {
|
|
130
|
-
// ignore this
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
function $da55be3e40667945$export$cf548b70626e2eb9(log, signatures) {
|
|
136
|
-
for (const sig of [
|
|
137
|
-
signatures
|
|
138
|
-
].flat()){
|
|
139
|
-
const decoded = $da55be3e40667945$export$18467e329ea485c9(log, sig);
|
|
140
|
-
if (decoded) return {
|
|
141
|
-
decoded: decoded,
|
|
142
|
-
metadata: {
|
|
143
|
-
name: (typeof sig === "string" ? sig : sig.signature).split("(")[0]
|
|
40
|
+
transform: (payload)=>payload,
|
|
41
|
+
tests: [
|
|
42
|
+
{
|
|
43
|
+
params: {},
|
|
44
|
+
payload: {
|
|
45
|
+
a: "b",
|
|
46
|
+
c: 1,
|
|
47
|
+
d: {
|
|
48
|
+
e: true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
output: {
|
|
52
|
+
a: "b",
|
|
53
|
+
c: 1,
|
|
54
|
+
d: {
|
|
55
|
+
e: true
|
|
56
|
+
}
|
|
144
57
|
}
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
function $9c8abe84804d9e5d$export$b830a1966711a4f4(block) {
|
|
152
|
-
const txfers = [];
|
|
153
|
-
for (const tx of block.transactions){
|
|
154
|
-
if (!tx.receipt) continue;
|
|
155
|
-
for (const log of tx.receipt.logs){
|
|
156
|
-
const txfer = (0, $da55be3e40667945$export$18467e329ea485c9)(log, "Transfer(address indexed from, address indexed to, uint256 value)");
|
|
157
|
-
if (txfer) txfers.push({
|
|
158
|
-
blockNumber: block.number,
|
|
159
|
-
timestamp: new Date(block.timestamp * 1000).toISOString(),
|
|
160
|
-
transactionHash: tx.hash,
|
|
161
|
-
...txfer
|
|
162
|
-
});
|
|
163
58
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
var $2bc08226e0d6a193$exports = {};
|
|
170
|
-
|
|
171
|
-
$parcel$export($2bc08226e0d6a193$exports, "tokenPrice", () => $2bc08226e0d6a193$export$e8386b633cdbc2d7);
|
|
172
|
-
|
|
173
|
-
function $2bc08226e0d6a193$export$e8386b633cdbc2d7(tokenAddress, opts) {
|
|
174
|
-
let url = `https://jiti.indexing.co/presets/token-price/${opts?.network || "ethereum"}?tokenAddress=${tokenAddress}`;
|
|
175
|
-
if (opts?.timestamp) url += "&priceTimestamp=" + new Date(opts.timestamp).toISOString();
|
|
176
|
-
return (0, ($parcel$interopDefault($8zHUo$isomorphicfetch)))(url).then((r)=>r.json()).then((r)=>r.data);
|
|
177
|
-
}
|
|
178
|
-
|
|
59
|
+
]
|
|
60
|
+
};
|
|
61
|
+
var $59fb8e0333a5d25f$export$2e2bcd8739ae039 = $59fb8e0333a5d25f$var$rawTemplate;
|
|
179
62
|
|
|
180
|
-
var $32af5abe02e3405e$exports = {};
|
|
181
63
|
|
|
182
|
-
$parcel$export($32af5abe02e3405e$exports, "tokenTransfers", () => $32af5abe02e3405e$export$b62520a34e11070c);
|
|
183
64
|
var $d7167569386d0d4c$exports = {};
|
|
184
65
|
var $596a656635c74d50$exports = {};
|
|
185
66
|
|
|
@@ -242,6 +123,7 @@ const $e5566e47593dc3e2$var$CHAIN_ID = {
|
|
|
242
123
|
STACK: 78225,
|
|
243
124
|
SYNDICATE_FRAME_CHAIN: 5101,
|
|
244
125
|
TRON: 728126428,
|
|
126
|
+
ZER0: 543210,
|
|
245
127
|
ZK_LINK: 810180,
|
|
246
128
|
ZORA: 7777777,
|
|
247
129
|
ZORA_SEPOLIA: 999999999
|
|
@@ -251,6 +133,69 @@ function $e5566e47593dc3e2$export$f93b8abed77a4120(chain) {
|
|
|
251
133
|
}
|
|
252
134
|
|
|
253
135
|
|
|
136
|
+
var $da55be3e40667945$exports = {};
|
|
137
|
+
|
|
138
|
+
$parcel$export($da55be3e40667945$exports, "evmDecodeLog", () => $da55be3e40667945$export$18467e329ea485c9);
|
|
139
|
+
$parcel$export($da55be3e40667945$exports, "evmDecodeLogWithMetadata", () => $da55be3e40667945$export$cf548b70626e2eb9);
|
|
140
|
+
|
|
141
|
+
var $f7a3fb164436c9c3$exports = {};
|
|
142
|
+
|
|
143
|
+
$parcel$export($f7a3fb164436c9c3$exports, "evmMethodSignatureToHex", () => $f7a3fb164436c9c3$export$49d5c9473f8f70f2);
|
|
144
|
+
|
|
145
|
+
function $f7a3fb164436c9c3$export$49d5c9473f8f70f2(sig) {
|
|
146
|
+
const [method, rest] = sig.split("(");
|
|
147
|
+
const params = rest.split(")")[0].split(",").map((p)=>p.trim());
|
|
148
|
+
const topic0 = (0, $8zHUo$viem.keccak256)(`${method.split(" ").pop()}(${params.map((p)=>p.split(" ")[0]).join(",")})`);
|
|
149
|
+
return topic0;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
function $da55be3e40667945$export$18467e329ea485c9(log, signatures) {
|
|
154
|
+
if (Array.isArray(signatures)) {
|
|
155
|
+
for (const sig of signatures){
|
|
156
|
+
const decoded = $da55be3e40667945$export$18467e329ea485c9(log, sig);
|
|
157
|
+
if (decoded) return decoded;
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
if (typeof signatures !== "string" && Array.isArray(signatures.addresses) && signatures.addresses.length) {
|
|
162
|
+
const addresses = signatures.addresses.map((a)=>a?.toLowerCase());
|
|
163
|
+
if (!addresses.includes(log.address.toLowerCase())) return null;
|
|
164
|
+
}
|
|
165
|
+
let sig = (typeof signatures === "string" ? signatures : signatures.signature).trim();
|
|
166
|
+
if (!sig.startsWith("event ")) sig = "event " + sig;
|
|
167
|
+
const topic0 = typeof signatures !== "string" && signatures.topic0 ? signatures.topic0 : (0, $f7a3fb164436c9c3$export$49d5c9473f8f70f2)(sig);
|
|
168
|
+
if ((sig.match(/ indexed /g)?.length || 0) === log.topics.length - 1) {
|
|
169
|
+
if (log.topics[0] === topic0) try {
|
|
170
|
+
const result = (0, $8zHUo$viem.decodeEventLog)({
|
|
171
|
+
abi: (0, $8zHUo$viem.parseAbi)([
|
|
172
|
+
sig
|
|
173
|
+
]),
|
|
174
|
+
data: log.data,
|
|
175
|
+
topics: log.topics
|
|
176
|
+
});
|
|
177
|
+
return result.args;
|
|
178
|
+
} catch (e) {
|
|
179
|
+
// ignore this
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
function $da55be3e40667945$export$cf548b70626e2eb9(log, signatures) {
|
|
185
|
+
for (const sig of [
|
|
186
|
+
signatures
|
|
187
|
+
].flat()){
|
|
188
|
+
const decoded = $da55be3e40667945$export$18467e329ea485c9(log, sig);
|
|
189
|
+
if (decoded) return {
|
|
190
|
+
decoded: decoded,
|
|
191
|
+
metadata: {
|
|
192
|
+
name: (typeof sig === "string" ? sig : sig.signature).split("(")[0]
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
|
|
254
199
|
|
|
255
200
|
|
|
256
201
|
var $414c83047563e72e$exports = {};
|
|
@@ -327,78 +272,223 @@ $parcel$exportWildcard($d7167569386d0d4c$exports, $f7a3fb164436c9c3$exports);
|
|
|
327
272
|
$parcel$exportWildcard($d7167569386d0d4c$exports, $414c83047563e72e$exports);
|
|
328
273
|
|
|
329
274
|
|
|
330
|
-
const $
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
275
|
+
const $6144a02851f23907$var$NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
276
|
+
const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
277
|
+
key: "token_transfers",
|
|
278
|
+
name: "Token Transfers",
|
|
279
|
+
description: "Get all token transfers for a set of token types.",
|
|
280
|
+
tags: [
|
|
281
|
+
"EVM",
|
|
282
|
+
"ERC20",
|
|
283
|
+
"ERC721",
|
|
284
|
+
"NFT",
|
|
285
|
+
"TOKEN"
|
|
286
|
+
],
|
|
287
|
+
disabled: false,
|
|
288
|
+
params: [
|
|
289
|
+
{
|
|
290
|
+
key: "network",
|
|
291
|
+
name: "Network",
|
|
292
|
+
type: "NETWORK",
|
|
293
|
+
optional: false
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
key: "tokenAddress",
|
|
297
|
+
name: "Token Address",
|
|
298
|
+
type: "ADDRESS",
|
|
299
|
+
optional: true
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
key: "walletAddress",
|
|
303
|
+
name: "Wallet Address",
|
|
304
|
+
type: "ADDRESS",
|
|
305
|
+
optional: true
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
key: "tokenTypes",
|
|
309
|
+
name: "Token Types",
|
|
310
|
+
type: "STRING",
|
|
311
|
+
multiple: true,
|
|
312
|
+
optional: true
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
transform: (block, _ctx)=>{
|
|
316
|
+
const TOKEN_TYPES = _ctx.params.tokenTypes || [];
|
|
317
|
+
let transfers = [];
|
|
318
|
+
switch(block._network){
|
|
319
|
+
// @TODO: expand to non-EVM
|
|
320
|
+
// assume EVM as default for now
|
|
321
|
+
default:
|
|
322
|
+
for (const tx of block.transactions){
|
|
323
|
+
if (!tx.receipt) continue;
|
|
324
|
+
const timestamp = new Date(block.timestamp * 1000).toISOString();
|
|
325
|
+
const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);
|
|
326
|
+
// track direct ETH transfers
|
|
327
|
+
if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("NATIVE")) {
|
|
328
|
+
// pull from traces, if available
|
|
329
|
+
if (Array.isArray(tx.traces)) for (const trace of tx.traces.filter((t)=>t.action)){
|
|
330
|
+
const action = trace.action;
|
|
331
|
+
if (!action?.value) continue;
|
|
332
|
+
transfers.push({
|
|
333
|
+
amount: BigInt(action.value),
|
|
334
|
+
blockNumber: tx.blockNumber,
|
|
335
|
+
from: action.from?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
336
|
+
index: trace.traceAddress?.join("-"),
|
|
337
|
+
timestamp: timestamp,
|
|
338
|
+
to: action.to?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
339
|
+
tokenType: "NATIVE",
|
|
340
|
+
transactionGasFee: transactionGasFee,
|
|
341
|
+
transactionHash: tx.hash
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
else if (tx.value?.length >= 3 || /\d+/.test(tx.value)) transfers.push({
|
|
345
|
+
amount: BigInt(tx.value),
|
|
346
|
+
blockNumber: tx.blockNumber,
|
|
347
|
+
from: tx.from?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
348
|
+
timestamp: timestamp,
|
|
349
|
+
to: tx.to?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
350
|
+
tokenType: "NATIVE",
|
|
351
|
+
transactionGasFee: transactionGasFee,
|
|
352
|
+
transactionHash: tx.hash
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
// track ERC20 transfers
|
|
356
|
+
if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("TOKEN")) for (const log of tx.receipt.logs){
|
|
357
|
+
const txfer = (0, $da55be3e40667945$export$cf548b70626e2eb9)(log, [
|
|
358
|
+
"Transfer(address indexed from, address indexed to, uint256 value)"
|
|
359
|
+
]);
|
|
360
|
+
if (txfer) transfers.push({
|
|
361
|
+
amount: txfer.decoded.value,
|
|
362
|
+
blockNumber: tx.blockNumber,
|
|
363
|
+
from: txfer.decoded.from?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
364
|
+
index: log.logIndex,
|
|
365
|
+
timestamp: timestamp,
|
|
366
|
+
to: txfer.decoded.to?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
367
|
+
token: log.address.toLowerCase(),
|
|
368
|
+
tokenType: "TOKEN",
|
|
369
|
+
transactionGasFee: transactionGasFee,
|
|
370
|
+
transactionHash: tx.hash
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
// @TODO: add NFT transfers
|
|
374
|
+
if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("NFT")) for (const log of tx.receipt.logs){
|
|
375
|
+
const txfer = (0, $da55be3e40667945$export$cf548b70626e2eb9)(log, [
|
|
376
|
+
"Transfer(address indexed from, address indexed to, uint256 indexed value)",
|
|
377
|
+
"TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)",
|
|
378
|
+
"TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)"
|
|
379
|
+
]);
|
|
380
|
+
if (!txfer) continue;
|
|
381
|
+
switch(txfer.metadata.name){
|
|
382
|
+
case "Transfer":
|
|
383
|
+
transfers.push({
|
|
384
|
+
amount: 1,
|
|
385
|
+
blockNumber: tx.blockNumber,
|
|
386
|
+
from: txfer.decoded.from?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
387
|
+
index: log.logIndex,
|
|
388
|
+
timestamp: timestamp,
|
|
389
|
+
to: txfer.decoded.to?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
390
|
+
token: log.address.toLowerCase(),
|
|
391
|
+
tokenId: txfer.decoded.value.toString(),
|
|
392
|
+
tokenType: "NFT",
|
|
393
|
+
transactionGasFee: transactionGasFee,
|
|
394
|
+
transactionHash: tx.hash
|
|
395
|
+
});
|
|
396
|
+
break;
|
|
397
|
+
case "TransferSingle":
|
|
398
|
+
transfers.push({
|
|
399
|
+
amount: txfer.decoded.value,
|
|
400
|
+
blockNumber: tx.blockNumber,
|
|
401
|
+
from: txfer.decoded.from?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
402
|
+
index: log.logIndex,
|
|
403
|
+
timestamp: timestamp,
|
|
404
|
+
to: txfer.decoded.to?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
405
|
+
token: log.address.toLowerCase(),
|
|
406
|
+
tokenId: txfer.decoded.id.toString(),
|
|
407
|
+
tokenType: "NFT",
|
|
408
|
+
transactionGasFee: transactionGasFee,
|
|
409
|
+
transactionHash: tx.hash
|
|
410
|
+
});
|
|
411
|
+
break;
|
|
412
|
+
case "TransferBatch":
|
|
413
|
+
for(let i = 0; i < txfer.decoded.ids.length; i += 1)transfers.push({
|
|
414
|
+
amount: txfer.decoded.values[i],
|
|
415
|
+
blockNumber: tx.blockNumber,
|
|
416
|
+
from: txfer.decoded.from?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
417
|
+
index: log.logIndex,
|
|
418
|
+
timestamp: timestamp,
|
|
419
|
+
to: txfer.decoded.to?.toLowerCase() || $6144a02851f23907$var$NULL_ADDRESS,
|
|
420
|
+
token: log.address.toLowerCase(),
|
|
421
|
+
tokenId: txfer.decoded.ids[i].toString(),
|
|
422
|
+
tokenType: "NFT",
|
|
423
|
+
transactionGasFee: transactionGasFee,
|
|
424
|
+
transactionHash: tx.hash
|
|
425
|
+
});
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
367
429
|
}
|
|
368
|
-
if (
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
430
|
+
if (typeof _ctx.params.contractAddress === "string") _ctx.params.contractAddress = _ctx.params.contractAddress.toLowerCase();
|
|
431
|
+
if (typeof _ctx.params.walletAddress === "string") _ctx.params.walletAddress = _ctx.params.walletAddress.toLowerCase();
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
transfers = transfers.filter((txfer)=>{
|
|
435
|
+
if (txfer.amount <= BigInt(0)) return false;
|
|
436
|
+
if (_ctx.params.tokenAddress && _ctx.params.tokenAddress !== txfer.token) return false;
|
|
437
|
+
if (_ctx.params.walletAddress && ![
|
|
438
|
+
txfer.from,
|
|
439
|
+
txfer.to
|
|
440
|
+
].includes(_ctx.params.walletAddress)) return false;
|
|
441
|
+
return true;
|
|
442
|
+
});
|
|
443
|
+
return transfers;
|
|
444
|
+
},
|
|
445
|
+
tests: [
|
|
446
|
+
{
|
|
447
|
+
params: {
|
|
448
|
+
network: "BASE",
|
|
449
|
+
walletAddress: "0x4F80864cD68782144e3736626896990acAe15a11",
|
|
450
|
+
contractAddress: "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed"
|
|
451
|
+
},
|
|
452
|
+
payload: "https://jiti.indexing.co/networks/base/23507423",
|
|
453
|
+
output: [
|
|
454
|
+
{
|
|
455
|
+
amount: 1000000000000000000000n,
|
|
456
|
+
blockNumber: 23507423,
|
|
457
|
+
from: "0x053002b4b332b422733c9469ddf9990bb6235e3d",
|
|
458
|
+
index: 536,
|
|
459
|
+
timestamp: "2024-12-10T04:16:33.000Z",
|
|
460
|
+
to: "0x4f80864cd68782144e3736626896990acae15a11",
|
|
461
|
+
token: "0x4ed4e862860bed51a9570b96d89af5e1b0efefed",
|
|
462
|
+
tokenType: "TOKEN",
|
|
463
|
+
transactionGasFee: 1192354854229n,
|
|
464
|
+
transactionHash: "0x69c9b12ccbe2d4f2f1dfc7c4a8557fc099fc5df276424417815acbc79a06fd56"
|
|
381
465
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}
|
|
466
|
+
]
|
|
467
|
+
}
|
|
468
|
+
]
|
|
469
|
+
};
|
|
470
|
+
var $6144a02851f23907$export$2e2bcd8739ae039 = $6144a02851f23907$var$tokenTransfersTemplate;
|
|
386
471
|
|
|
387
472
|
|
|
388
|
-
$
|
|
389
|
-
|
|
390
|
-
|
|
473
|
+
const $48f9879a44dd1195$export$a8fc3402335b0b04 = [
|
|
474
|
+
(0, $59fb8e0333a5d25f$export$2e2bcd8739ae039),
|
|
475
|
+
(0, $6144a02851f23907$export$2e2bcd8739ae039)
|
|
476
|
+
];
|
|
391
477
|
|
|
392
478
|
|
|
393
479
|
|
|
394
480
|
var $faefaad95e5fcca0$exports = {};
|
|
395
481
|
|
|
396
482
|
|
|
483
|
+
const $882b6d93070905b3$export$a8fc3402335b0b04 = (0, $48f9879a44dd1195$export$a8fc3402335b0b04).reduce((a, b)=>({
|
|
484
|
+
...a,
|
|
485
|
+
[b.key]: Object.assign({}, b)
|
|
486
|
+
}), {});
|
|
397
487
|
function $882b6d93070905b3$export$cceb5167b935aafb() {
|
|
398
|
-
return 0, $48f9879a44dd1195$export$a8fc3402335b0b04;
|
|
488
|
+
return (0, $48f9879a44dd1195$export$a8fc3402335b0b04).slice();
|
|
399
489
|
}
|
|
400
490
|
function $882b6d93070905b3$export$a07bfd14bbc36e4b(key) {
|
|
401
|
-
return (0, $48f9879a44dd1195$export$a8fc3402335b0b04).find((template)=>template.key === key);
|
|
491
|
+
return (0, $48f9879a44dd1195$export$a8fc3402335b0b04).slice().find((template)=>template.key === key);
|
|
402
492
|
}
|
|
403
493
|
|
|
404
494
|
|