Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
nestjs-web3js
Advanced tools
The nestjs-web3js is a NestJS module that provides a connection to Ethereum's blockchain. It uses the web3.js library, which is a collection of libraries that allow you to interact with a local or remote Ethereum node using HTTP, IPC, or WebSocket.
The Web3jsModule is a NestJS module that provides a connection to Ethereum's blockchain. It uses the web3.js library, which is a collection of libraries that allow you to interact with a local or remote Ethereum node using HTTP, IPC, or WebSocket.
Web3jsService
that can be injected to interact with Ethereum.To install this module, run:
npm install nestjs-web3js
Then, import Web3jsModule
into your AppModule
:
@Module({
imports: [
Web3jsModule.forRoot({
infuraUrl: '<Your-infura-url>',
}),
],
})
export class AppModule {}
or
@Module({
imports: [
Web3jsModule.forRootAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => ({
infuraUrl: configService.get<string>('INFURA_URL'),
}),
inject: [ConfigService],
}),
],
providers: [AppService],
})
export class AppModule {}
Once Web3jsModule
is imported, you can inject Web3jsService
into your services, controllers, or providers:
@Injectable()
export class AppService {
constructor(@Web3js private readonly web3: Web3) {}
async getBalance() {
const balance = await this.web3.eth.getBalance('Your account address');
return balance;
}
}
The forRoot
method accepts an options object with the following properties:
infuraUrl
(string): The URL to your Infura Ethereum node. This property must be a valid URL.The CreateWeb3jsServiceDto
class is used as a type for the argument passed to the forRoot
method. The schema for this class is as follows:
const CreateWeb3jsServiceSchema = z
.object({
infuraUrl: z.string().url().min(3),
})
.required();
This schema is validated using the nestjs-zod library.
This module depends on the following packages:
For issues, feature requests, and contributions, please open an issue in the repository.
This project is licensed under the MIT License.
See also the list of contributors who participated in this project.
FAQs
The nestjs-web3js is a NestJS module that provides a connection to Ethereum's blockchain. It uses the web3.js library, which is a collection of libraries that allow you to interact with a local or remote Ethereum node using HTTP, IPC, or WebSocket.
The npm package nestjs-web3js receives a total of 11 weekly downloads. As such, nestjs-web3js popularity was classified as not popular.
We found that nestjs-web3js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.