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