ponder 0.8.30 → 0.8.31
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/bin/ponder.js +62 -50
- package/dist/bin/ponder.js.map +1 -1
- package/package.json +1 -1
- package/src/indexing/service.ts +71 -60
- package/src/types/utils.ts +8 -0
- package/src/utils/print.ts +3 -1
package/dist/bin/ponder.js
CHANGED
|
@@ -3889,6 +3889,8 @@ import pg from "pg";
|
|
|
3889
3889
|
|
|
3890
3890
|
// src/utils/print.ts
|
|
3891
3891
|
function prettyPrint(args) {
|
|
3892
|
+
if (args === void 0)
|
|
3893
|
+
return "(undefined)";
|
|
3892
3894
|
const entries = Object.entries(args).map(([key, value]) => {
|
|
3893
3895
|
if (value === void 0)
|
|
3894
3896
|
return null;
|
|
@@ -6263,11 +6265,7 @@ var executeSetup = async (indexingService, { event }) => {
|
|
|
6263
6265
|
return { status: "killed" };
|
|
6264
6266
|
const error = _error instanceof Error ? _error : new Error(String(_error));
|
|
6265
6267
|
addStackTrace(error, common.options);
|
|
6266
|
-
|
|
6267
|
-
error.meta.push(toErrorMeta(event));
|
|
6268
|
-
} else {
|
|
6269
|
-
error.meta = [toErrorMeta(event)];
|
|
6270
|
-
}
|
|
6268
|
+
addErrorMeta(error, toErrorMeta(event));
|
|
6271
6269
|
const decodedCheckpoint = decodeCheckpoint(event.checkpoint);
|
|
6272
6270
|
common.logger.error({
|
|
6273
6271
|
service: "indexing",
|
|
@@ -6310,11 +6308,7 @@ var executeEvent = async (indexingService, { event }) => {
|
|
|
6310
6308
|
return { status: "killed" };
|
|
6311
6309
|
const error = _error instanceof Error ? _error : new Error(String(_error));
|
|
6312
6310
|
addStackTrace(error, common.options);
|
|
6313
|
-
|
|
6314
|
-
error.meta.push(toErrorMeta(event));
|
|
6315
|
-
} else {
|
|
6316
|
-
error.meta = [toErrorMeta(event)];
|
|
6317
|
-
}
|
|
6311
|
+
addErrorMeta(error, toErrorMeta(event));
|
|
6318
6312
|
const decodedCheckpoint = decodeCheckpoint(event.checkpoint);
|
|
6319
6313
|
common.logger.error({
|
|
6320
6314
|
service: "indexing",
|
|
@@ -6326,75 +6320,93 @@ var executeEvent = async (indexingService, { event }) => {
|
|
|
6326
6320
|
}
|
|
6327
6321
|
return { status: "success" };
|
|
6328
6322
|
};
|
|
6329
|
-
var blockText = (block) => `Block:
|
|
6330
|
-
${prettyPrint({
|
|
6331
|
-
hash: block.hash,
|
|
6332
|
-
number: block.number,
|
|
6333
|
-
timestamp: block.timestamp
|
|
6334
|
-
})}`;
|
|
6335
|
-
var transactionText = (transaction) => `Transaction:
|
|
6336
|
-
${prettyPrint({
|
|
6337
|
-
hash: transaction.hash,
|
|
6338
|
-
from: transaction.from,
|
|
6339
|
-
to: transaction.to
|
|
6340
|
-
})}`;
|
|
6341
|
-
var logText = (log) => `Log:
|
|
6342
|
-
${prettyPrint({
|
|
6343
|
-
index: log.logIndex,
|
|
6344
|
-
address: log.address
|
|
6345
|
-
})}`;
|
|
6346
|
-
var traceText = (trace) => `Trace:
|
|
6347
|
-
${prettyPrint({
|
|
6348
|
-
traceIndex: trace.traceIndex,
|
|
6349
|
-
from: trace.from,
|
|
6350
|
-
to: trace.to
|
|
6351
|
-
})}`;
|
|
6352
6323
|
var toErrorMeta = (event) => {
|
|
6353
|
-
switch (event
|
|
6324
|
+
switch (event?.type) {
|
|
6354
6325
|
case "setup": {
|
|
6355
6326
|
return `Block:
|
|
6356
6327
|
${prettyPrint({
|
|
6357
|
-
number: event
|
|
6328
|
+
number: event?.block
|
|
6358
6329
|
})}`;
|
|
6359
6330
|
}
|
|
6360
6331
|
case "log": {
|
|
6361
6332
|
return [
|
|
6362
6333
|
`Event arguments:
|
|
6363
|
-
${prettyPrint(event
|
|
6364
|
-
logText(event
|
|
6365
|
-
transactionText(event
|
|
6366
|
-
blockText(event
|
|
6334
|
+
${prettyPrint(event?.event?.args)}`,
|
|
6335
|
+
logText(event?.event?.log),
|
|
6336
|
+
transactionText(event?.event?.transaction),
|
|
6337
|
+
blockText(event?.event?.block)
|
|
6367
6338
|
].join("\n");
|
|
6368
6339
|
}
|
|
6369
6340
|
case "trace": {
|
|
6370
6341
|
return [
|
|
6371
6342
|
`Call trace arguments:
|
|
6372
|
-
${prettyPrint(event
|
|
6373
|
-
traceText(event
|
|
6374
|
-
transactionText(event
|
|
6375
|
-
blockText(event
|
|
6343
|
+
${prettyPrint(event?.event?.args)}`,
|
|
6344
|
+
traceText(event?.event?.trace),
|
|
6345
|
+
transactionText(event?.event?.transaction),
|
|
6346
|
+
blockText(event?.event?.block)
|
|
6376
6347
|
].join("\n");
|
|
6377
6348
|
}
|
|
6378
6349
|
case "transfer": {
|
|
6379
6350
|
return [
|
|
6380
6351
|
`Transfer arguments:
|
|
6381
|
-
${prettyPrint(event
|
|
6382
|
-
traceText(event
|
|
6383
|
-
transactionText(event
|
|
6384
|
-
blockText(event
|
|
6352
|
+
${prettyPrint(event?.event?.transfer)}`,
|
|
6353
|
+
traceText(event?.event?.trace),
|
|
6354
|
+
transactionText(event?.event?.transaction),
|
|
6355
|
+
blockText(event?.event?.block)
|
|
6385
6356
|
].join("\n");
|
|
6386
6357
|
}
|
|
6387
6358
|
case "block": {
|
|
6388
|
-
return blockText(event
|
|
6359
|
+
return blockText(event?.event?.block);
|
|
6389
6360
|
}
|
|
6390
6361
|
case "transaction": {
|
|
6391
6362
|
return [
|
|
6392
|
-
transactionText(event
|
|
6393
|
-
blockText(event
|
|
6363
|
+
transactionText(event?.event?.transaction),
|
|
6364
|
+
blockText(event?.event?.block)
|
|
6394
6365
|
].join("\n");
|
|
6395
6366
|
}
|
|
6367
|
+
default: {
|
|
6368
|
+
return void 0;
|
|
6369
|
+
}
|
|
6396
6370
|
}
|
|
6397
6371
|
};
|
|
6372
|
+
var addErrorMeta = (error, meta) => {
|
|
6373
|
+
if (typeof error !== "object" || error === null)
|
|
6374
|
+
return;
|
|
6375
|
+
if (meta === void 0)
|
|
6376
|
+
return;
|
|
6377
|
+
try {
|
|
6378
|
+
const errorObj = error;
|
|
6379
|
+
if (Array.isArray(errorObj.meta)) {
|
|
6380
|
+
errorObj.meta = [...errorObj.meta, meta];
|
|
6381
|
+
} else {
|
|
6382
|
+
errorObj.meta = [meta];
|
|
6383
|
+
}
|
|
6384
|
+
} catch {
|
|
6385
|
+
}
|
|
6386
|
+
};
|
|
6387
|
+
var blockText = (block) => `Block:
|
|
6388
|
+
${prettyPrint({
|
|
6389
|
+
hash: block?.hash,
|
|
6390
|
+
number: block?.number,
|
|
6391
|
+
timestamp: block?.timestamp
|
|
6392
|
+
})}`;
|
|
6393
|
+
var transactionText = (transaction) => `Transaction:
|
|
6394
|
+
${prettyPrint({
|
|
6395
|
+
hash: transaction?.hash,
|
|
6396
|
+
from: transaction?.from,
|
|
6397
|
+
to: transaction?.to
|
|
6398
|
+
})}`;
|
|
6399
|
+
var logText = (log) => `Log:
|
|
6400
|
+
${prettyPrint({
|
|
6401
|
+
index: log?.logIndex,
|
|
6402
|
+
address: log?.address
|
|
6403
|
+
})}`;
|
|
6404
|
+
var traceText = (trace) => `Trace:
|
|
6405
|
+
${prettyPrint({
|
|
6406
|
+
traceIndex: trace?.traceIndex,
|
|
6407
|
+
from: trace?.from,
|
|
6408
|
+
to: trace?.to
|
|
6409
|
+
})}`;
|
|
6398
6410
|
|
|
6399
6411
|
// src/indexing/index.ts
|
|
6400
6412
|
var methods = {
|