mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-09 01:04:07 +00:00
Update GQL and getBlock API usage (#210)
* Update getLogs and getBlockWithTransactions usage to add block number arg * Update getFullTransaction usage to add block number arg
This commit is contained in:
@@ -273,7 +273,7 @@ export class Indexer {
|
||||
return [blockProgress, events];
|
||||
}
|
||||
|
||||
async fetchEvents (blockHash: string, parseEventNameAndArgs: (kind: string, logObj: any) => any): Promise<DeepPartial<EventInterface>[]> {
|
||||
async fetchEvents (blockHash: string, blockNumber: number, parseEventNameAndArgs: (kind: string, logObj: any) => any): Promise<DeepPartial<EventInterface>[]> {
|
||||
let logsPromise: Promise<any>;
|
||||
|
||||
if (this._serverConfig.filterLogs) {
|
||||
@@ -284,13 +284,14 @@ export class Indexer {
|
||||
|
||||
logsPromise = this._ethClient.getLogs({
|
||||
blockHash,
|
||||
blockNumber: blockNumber.toString(),
|
||||
addresses
|
||||
});
|
||||
} else {
|
||||
logsPromise = this._ethClient.getLogs({ blockHash });
|
||||
logsPromise = this._ethClient.getLogs({ blockHash, blockNumber: blockNumber.toString() });
|
||||
}
|
||||
|
||||
const transactionsPromise = this._ethClient.getBlockWithTransactions({ blockHash });
|
||||
const transactionsPromise = this._ethClient.getBlockWithTransactions({ blockHash, blockNumber });
|
||||
|
||||
const [
|
||||
{ logs },
|
||||
|
||||
@@ -220,10 +220,10 @@ export const getFullBlock = async (ethClient: EthClient, ethProvider: providers.
|
||||
};
|
||||
};
|
||||
|
||||
export const getFullTransaction = async (ethClient: EthClient, txHash: string): Promise<any> => {
|
||||
export const getFullTransaction = async (ethClient: EthClient, txHash: string, blockNumber: number): Promise<any> => {
|
||||
const {
|
||||
ethTransactionCidByTxHash: fullTx
|
||||
} = await ethClient.getFullTransaction(txHash);
|
||||
} = await ethClient.getFullTransaction(txHash, blockNumber);
|
||||
|
||||
assert(fullTx.blockByMhKey);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user