Store event data in a separate column in db

This commit is contained in:
Prathamesh Musale 2024-09-18 11:40:22 +05:30
parent b69116b2bf
commit d0d6f68a21
3 changed files with 13 additions and 7 deletions

View File

@ -37,6 +37,13 @@ columns:
columnOptions: columnOptions:
- option: length - option: length
value: 42 value: 42
- name: eventName
pgType: varchar
tsType: string
columnType: Column
columnOptions:
- option: length
value: 256
- name: topic0 - name: topic0
pgType: varchar pgType: varchar
tsType: string tsType: string
@ -71,13 +78,10 @@ columns:
value: 66 value: 66
- option: nullable - option: nullable
value: true value: true
- name: eventName - name: data
pgType: varchar pgType: varchar
tsType: string tsType: string
columnType: Column columnType: Column
columnOptions:
- option: length
value: 256
- name: eventInfo - name: eventInfo
pgType: text pgType: text
tsType: string tsType: string

View File

@ -670,7 +670,7 @@ export class Indexer {
let eventName = UNKNOWN_EVENT_NAME; let eventName = UNKNOWN_EVENT_NAME;
let eventInfo = {}; let eventInfo = {};
const tx = transactionMap[txHash]; const tx = transactionMap[txHash];
const extraInfo: { [key: string]: any } = { topics, data, tx, logIndex }; const extraInfo: { [key: string]: any } = { tx, logIndex };
const [topic0, topic1, topic2, topic3] = topics as string[]; const [topic0, topic1, topic2, topic3] = topics as string[];
@ -695,11 +695,12 @@ export class Indexer {
index: this._upstreamConfig.ethServer.isFEVM ? li : logIndex, index: this._upstreamConfig.ethServer.isFEVM ? li : logIndex,
txHash, txHash,
contract, contract,
eventName,
topic0, topic0,
topic1, topic1,
topic2, topic2,
topic3, topic3,
eventName, data,
eventInfo: JSONbigNative.stringify(eventInfo), eventInfo: JSONbigNative.stringify(eventInfo),
extraInfo: JSONbigNative.stringify(extraInfo), extraInfo: JSONbigNative.stringify(extraInfo),
proof: JSONbigNative.stringify({ proof: JSONbigNative.stringify({

View File

@ -61,11 +61,12 @@ export interface EventInterface {
txHash: string; txHash: string;
index: number; index: number;
contract: string; contract: string;
eventName: string;
topic0: string; topic0: string;
topic1: string | null; topic1: string | null;
topic2: string | null; topic2: string | null;
topic3: string | null; topic3: string | null;
eventName: string; data: string;
eventInfo: string; eventInfo: string;
extraInfo: string; extraInfo: string;
proof: string; proof: string;