Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/owl1n/nestjs-web3
Module that makes it possible to work with Ethereum JavaScript API with NestJS
https://github.com/owl1n/nestjs-web3
blockchain ethereum nest-web3 nestjs web3js
Last synced: 9 days ago
JSON representation
Module that makes it possible to work with Ethereum JavaScript API with NestJS
- Host: GitHub
- URL: https://github.com/owl1n/nestjs-web3
- Owner: owl1n
- License: mit
- Created: 2022-05-11T20:24:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-08T07:32:00.000Z (over 2 years ago)
- Last Synced: 2024-08-08T23:45:30.197Z (3 months ago)
- Topics: blockchain, ethereum, nest-web3, nestjs, web3js
- Language: TypeScript
- Homepage:
- Size: 71.3 KB
- Stars: 25
- Watchers: 3
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Web3 module for NestJS that allow to work with blockhains
This is first release of this module. Readme under construction but here are a couple of tips
## Installation
#### Yarn
`yarn add nest-web3`#### NPM
`yarn add nest-web3`## Getting started with module
Register Web3Module module in yours `app.module.ts` (or other main module of yours project)
```typescript
import { Module } from '@nestjs/common';
import { Web3Module } from 'nest-web3';@Module({
imports: [
Web3Module.forRoot({
name: 'eth',
url: 'http://localhost:3450',
}),
]
})
export class AppModule {}```
Or with Async
```typescript
import { Module } from '@nestjs/common';
import { Web3Module } from 'nest-web3';@Module({
imports: [
Web3Module.forRootAsync({
useFactory: (configService: ConfigService) => configService.get('web3'),
inject:[ConfigService]
}),
]
})
export class AppModule {}
```### Configuration
For now module accept two parameters:
```typescript
export interface Web3ModuleOptions {
name?: string;
url: string;
}
```### Using in project
```typescript
import { Injectable } from '@nestjs/common';
import { Web3Service } from "nest-web3";@Injectable()
export class SomeClass {
constructor(
private readonly web3Service: Web3Service
) {}
async method(): Promise {
const client = this.web3Service.getClient('eth'); // we are give name of client in config file
return await client.eth.getChainId();
}
}
```Available methods and API of Web3 available here https://web3js.readthedocs.io/