mirror of
https://github.com/cerc-io/watcher-ts
synced 2024-10-04 06:54:39 +00:00
nikugogoi
83775608ec
* Implement store get api without blockHash and blockNumber * Pass database instance to GraphWatcher * Implement store set without block data * Store blockHash and blockNumber in database entity table * Implement getting entity in subgraph from store.get * Add block data present in postgraphile * Pass db and context to instantiate method in tests * GQL API in graph-test-watcher to test store.set * Remove contract address from subgraph file * Fix block in dummy event data * Pass just blockHash to get an entity from the database * Review changes and add TODOs Co-authored-by: prathamesh <prathamesh.musale0@gmail.com>
41 lines
850 B
TypeScript
41 lines
850 B
TypeScript
//
|
|
// Copyright 2021 Vulcanize, Inc.
|
|
//
|
|
|
|
import { EventData } from '../../src/utils';
|
|
import { Database } from '../../src/database';
|
|
|
|
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
export const ZERO_HASH = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
|
|
export const getDummyEventData = (): EventData => {
|
|
const block = {
|
|
blockHash: ZERO_HASH,
|
|
blockNumber: '0',
|
|
timestamp: '0',
|
|
parentHash: ZERO_HASH,
|
|
stateRoot: ZERO_HASH,
|
|
td: ZERO_HASH,
|
|
txRoot: ZERO_HASH,
|
|
receiptRoot: ZERO_HASH
|
|
};
|
|
|
|
const tx = {
|
|
hash: ZERO_HASH,
|
|
index: 0,
|
|
from: ZERO_ADDRESS,
|
|
to: ZERO_ADDRESS
|
|
};
|
|
|
|
return {
|
|
block,
|
|
tx,
|
|
eventParams: [],
|
|
eventIndex: 0
|
|
};
|
|
};
|
|
|
|
export const getTestDatabase = (): Database => {
|
|
return new Database({ type: 'postgres' }, '');
|
|
};
|