Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@lido-nestjs/consensus
Advanced tools
NestJS Consensus Layer API Module for Lido Finance projects. Part of [Lido NestJS Modules](https://github.com/lidofinance/lido-nestjs-modules/#readme)
NestJS Consensus Layer API Module for Lido Finance projects. Part of Lido NestJS Modules
yarn add @lido-nestjs/consensus
The types used in the API methods are based on Eth2Spec. To update them use the script:
./generate.sh
This module depends on FetchModule
from @lido-nestjs/fetch
, so you need to provide it as a global module or import it into ConsensusModule
.
// Import
import { Module } from '@nestjs/common';
import { ConsensusModule } from '@lido-nestjs/consensus';
import { FetchModule } from '@lido-nestjs/fetch';
import { MyService } from './my.service';
@Module({
imports: [ConsensusModule.forFeature({ imports: [FetchModule] })],
providers: [MyService],
exports: [MyService],
})
export class MyModule {}
// Usage
import { ConsensusService } from '@lido-nestjs/consensus';
export class MyService {
constructor(private consensusService: ConsensusService) {}
async myMethod() {
return await this.consensusService.getGenesis();
}
}
import { Module } from '@nestjs/common';
import { ConsensusModule } from '@lido-nestjs/consensus';
import { FetchModule } from '@lido-nestjs/fetch';
@Module({
imports: [FetchModule.forRoot(), ConsensusModule.forRoot()],
})
export class MyModule {}
import { Module } from '@nestjs/common';
import { ConsensusModule } from '@lido-nestjs/consensus';
import { FetchModule } from '@lido-nestjs/fetch';
import { ConfigModule, ConfigService } from './my.service';
@Module({
imports: [
ConfigModule.forRoot(),
FetchModule.forRoot(),
ConsensusModule.forRootAsync({
async useFactory(configService: ConfigService) {
return { pollingInterval: configService.pollingInterval };
},
inject: [ConfigService],
}),
],
})
export class MyModule {}
Methods support fetch options
:
// Usage
import { ConsensusService } from '@lido-nestjs/consensus';
export class MyService {
constructor(private consensusService: ConsensusService) {}
async myMethod() {
return await this.consensusService.getGenesis({
options: { headers: { 'x-header-foo': 'bar' } },
});
}
}
Subscribe to head blocks:
import { ConsensusService } from '@lido-nestjs/consensus';
export class MyService {
constructor(private consensusService: ConsensusService) {
this.consensusService.subscribe((error, data) => {
console.log(error, data);
});
}
}
Subscribe to finalized blocks:
import { ConsensusService } from '@lido-nestjs/consensus';
export class MyService {
constructor(private consensusService: ConsensusService) {
this.consensusService.subscribe(
(error, data) => {
console.log(error, data);
},
{ blockId: 'finalized' },
);
}
}
FAQs
NestJS Consensus Layer API Module for Lido Finance projects. Part of [Lido NestJS Modules](https://github.com/lidofinance/lido-nestjs-modules/#readme)
We found that @lido-nestjs/consensus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.