mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-05 15:34:07 +00:00
Support fragments in GQL queries for subgraph watchers (#510)
* Avoid updating latest block metrics on RPC errors * Handle fragments in subgraph GQL queries * Upgrade package versions * Move private method in util graph database --------- Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cerc-io/cli",
|
||||
"version": "0.2.88",
|
||||
"version": "0.2.89",
|
||||
"main": "dist/index.js",
|
||||
"license": "AGPL-3.0",
|
||||
"scripts": {
|
||||
@@ -15,13 +15,13 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.7.1",
|
||||
"@cerc-io/cache": "^0.2.88",
|
||||
"@cerc-io/ipld-eth-client": "^0.2.88",
|
||||
"@cerc-io/cache": "^0.2.89",
|
||||
"@cerc-io/ipld-eth-client": "^0.2.89",
|
||||
"@cerc-io/libp2p": "^0.42.2-laconic-0.1.4",
|
||||
"@cerc-io/nitro-node": "^0.1.15",
|
||||
"@cerc-io/peer": "^0.2.88",
|
||||
"@cerc-io/rpc-eth-client": "^0.2.88",
|
||||
"@cerc-io/util": "^0.2.88",
|
||||
"@cerc-io/peer": "^0.2.89",
|
||||
"@cerc-io/rpc-eth-client": "^0.2.89",
|
||||
"@cerc-io/util": "^0.2.89",
|
||||
"@ethersproject/providers": "^5.4.4",
|
||||
"@graphql-tools/utils": "^9.1.1",
|
||||
"@ipld/dag-cbor": "^8.0.0",
|
||||
|
||||
@@ -8,8 +8,6 @@ import debug from 'debug';
|
||||
import { ethers } from 'ethers';
|
||||
import JsonRpcProvider = ethers.providers.JsonRpcProvider;
|
||||
|
||||
import { fetchLatestBlockNumber } from '@cerc-io/util';
|
||||
|
||||
const log = debug('laconic:chain-head-exporter');
|
||||
|
||||
// Env overrides:
|
||||
@@ -57,16 +55,20 @@ async function main (): Promise<void> {
|
||||
registers: [metricsRegister],
|
||||
labelNames: ['chain'] as const,
|
||||
async collect () {
|
||||
const [
|
||||
latestEthBlockNumber,
|
||||
latestFilBlockNumber
|
||||
] = await Promise.all([
|
||||
fetchLatestBlockNumber(ethProvider),
|
||||
fetchLatestBlockNumber(filProvider)
|
||||
]);
|
||||
try {
|
||||
const [
|
||||
latestEthBlockNumber,
|
||||
latestFilBlockNumber
|
||||
] = await Promise.all([
|
||||
ethProvider.getBlockNumber(),
|
||||
filProvider.getBlockNumber()
|
||||
]);
|
||||
|
||||
this.set({ chain: 'ethereum' }, latestEthBlockNumber);
|
||||
this.set({ chain: 'filecoin' }, latestFilBlockNumber);
|
||||
this.set({ chain: 'ethereum' }, latestEthBlockNumber);
|
||||
this.set({ chain: 'filecoin' }, latestFilBlockNumber);
|
||||
} catch (err) {
|
||||
log('Error fetching latest block number', err);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user