0.0.7 • Published 2 years ago
@darrenyeom/alchemy-api v0.0.7
Nest Alchemy API module
Description
Alchemy Web3 API module for Nest.
Installation
$ npm i -s @darrenyeom/alchemy-api @alch/alchemy-web3
Quickstart
app.module.ts
import { Module } from '@nestjs/common';
import { AlchemyApiModule } from '@darrenyeom/alchemy-api';
import { AppController } from './app.controller';
import { AppService } from './app.service';
@Module({
imports: [
AlchemyApiModule.forRoot({
alchemyUrl:
'wss://eth-mainnet.alchemyapi.io/v2/<API_KEY>',
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
app.service.ts
import { Injectable } from '@nestjs/common'; import { AlchemyApiService } from '@darrenyeom/alchemy-api';
@Injectable() export class AppService { constructor(private readonly alchemyApiService: AlchemyApiService) {}
async getBlockNumber() { return this.alchemyApiService.client.eth.getBlockNumber(); } }
## License
[MIT](LICENSE).