The @zkchainhub/metrics
package exposes services with different aggregated metrics from the ZKsync ecosystem and ZK chains.
- Ensure you have
node >= 20.0.0
andpnpm >= 9.5.0
installed.
$ pnpm install
To build the monorepo packages, run:
$ pnpm build
# unit tests
$ pnpm run test
# test coverage
$ pnpm run test:cov
You can import the package in your TypeScript or JavaScript files as follows:
import { L1MetricsService } from "@zkchainhub/metrics";
This packages requires that user injects instances of:
- EvmProvider
- IPricingProvider
- IMetadataProvider
// ... define needed dependencies
const l1MetricsService = new L1MetricsService(
bridgeHubAddress,
sharedBridgeAddress,
stateTransitionManagerAddresses,
evmProvider,
pricingProvider,
metadataProvider,
logger,
);
await l1MetricsService.l1Tvl();
Available methods
l1Tvl()
getBatchesInfo(chainId: ChainId)
tvl(chainId: ChainId)
chainType(chainId: ChainId)
ethGasInfo()
getChainIds()
getBaseTokens(chainIds: ChainId[])
feeParams(chainId: ChainId)
For more details on services, refer to their implementations.