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:
|
columnOptions:
|
||||||
- option: length
|
- option: length
|
||||||
value: 42
|
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
|
- name: eventName
|
||||||
pgType: varchar
|
pgType: varchar
|
||||||
tsType: string
|
tsType: string
|
||||||
|
@ -672,6 +672,8 @@ export class Indexer {
|
|||||||
const tx = transactionMap[txHash];
|
const tx = transactionMap[txHash];
|
||||||
const extraInfo: { [key: string]: any } = { topics, data, tx, logIndex };
|
const extraInfo: { [key: string]: any } = { topics, data, tx, logIndex };
|
||||||
|
|
||||||
|
const [topic0, topic1, topic2, topic3] = topics as string[];
|
||||||
|
|
||||||
const contract = ethers.utils.getAddress(address);
|
const contract = ethers.utils.getAddress(address);
|
||||||
const watchedContracts = this.isContractAddressWatched(contract);
|
const watchedContracts = this.isContractAddressWatched(contract);
|
||||||
|
|
||||||
@ -693,6 +695,10 @@ export class Indexer {
|
|||||||
index: this._upstreamConfig.ethServer.isFEVM ? li : logIndex,
|
index: this._upstreamConfig.ethServer.isFEVM ? li : logIndex,
|
||||||
txHash,
|
txHash,
|
||||||
contract,
|
contract,
|
||||||
|
topic0,
|
||||||
|
topic1,
|
||||||
|
topic2,
|
||||||
|
topic3,
|
||||||
eventName,
|
eventName,
|
||||||
eventInfo: JSONbigNative.stringify(eventInfo),
|
eventInfo: JSONbigNative.stringify(eventInfo),
|
||||||
extraInfo: JSONbigNative.stringify(extraInfo),
|
extraInfo: JSONbigNative.stringify(extraInfo),
|
||||||
|
@ -61,6 +61,10 @@ export interface EventInterface {
|
|||||||
txHash: string;
|
txHash: string;
|
||||||
index: number;
|
index: number;
|
||||||
contract: string;
|
contract: string;
|
||||||
|
topic0: string;
|
||||||
|
topic1: string | null;
|
||||||
|
topic2: string | null;
|
||||||
|
topic3: string | null;
|
||||||
eventName: string;
|
eventName: string;
|
||||||
eventInfo: string;
|
eventInfo: string;
|
||||||
extraInfo: string;
|
extraInfo: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user