mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-07-27 10:42:06 +00:00
Store event topics in separate columns in db
This commit is contained in:
parent
d413d724c7
commit
b69116b2bf
@ -37,6 +37,40 @@ columns:
|
||||
columnOptions:
|
||||
- option: length
|
||||
value: 42
|
||||
- name: topic0
|
||||
pgType: varchar
|
||||
tsType: string
|
||||
columnType: Column
|
||||
columnOptions:
|
||||
- option: length
|
||||
value: 66
|
||||
- name: topic1
|
||||
pgType: varchar
|
||||
tsType: string | null
|
||||
columnType: Column
|
||||
columnOptions:
|
||||
- option: length
|
||||
value: 66
|
||||
- option: nullable
|
||||
value: true
|
||||
- name: topic2
|
||||
pgType: varchar
|
||||
tsType: string | null
|
||||
columnType: Column
|
||||
columnOptions:
|
||||
- option: length
|
||||
value: 66
|
||||
- option: nullable
|
||||
value: true
|
||||
- name: topic3
|
||||
pgType: varchar
|
||||
tsType: string | null
|
||||
columnType: Column
|
||||
columnOptions:
|
||||
- option: length
|
||||
value: 66
|
||||
- option: nullable
|
||||
value: true
|
||||
- name: eventName
|
||||
pgType: varchar
|
||||
tsType: string
|
||||
|
@ -672,6 +672,8 @@ export class Indexer {
|
||||
const tx = transactionMap[txHash];
|
||||
const extraInfo: { [key: string]: any } = { topics, data, tx, logIndex };
|
||||
|
||||
const [topic0, topic1, topic2, topic3] = topics as string[];
|
||||
|
||||
const contract = ethers.utils.getAddress(address);
|
||||
const watchedContracts = this.isContractAddressWatched(contract);
|
||||
|
||||
@ -693,6 +695,10 @@ export class Indexer {
|
||||
index: this._upstreamConfig.ethServer.isFEVM ? li : logIndex,
|
||||
txHash,
|
||||
contract,
|
||||
topic0,
|
||||
topic1,
|
||||
topic2,
|
||||
topic3,
|
||||
eventName,
|
||||
eventInfo: JSONbigNative.stringify(eventInfo),
|
||||
extraInfo: JSONbigNative.stringify(extraInfo),
|
||||
|
@ -61,6 +61,10 @@ export interface EventInterface {
|
||||
txHash: string;
|
||||
index: number;
|
||||
contract: string;
|
||||
topic0: string;
|
||||
topic1: string | null;
|
||||
topic2: string | null;
|
||||
topic3: string | null;
|
||||
eventName: string;
|
||||
eventInfo: string;
|
||||
extraInfo: string;
|
||||
|
Loading…
Reference in New Issue
Block a user