Skip to content

Commit

Permalink
Release v0.1.0 (#10)
Browse files Browse the repository at this point in the history
* v0.1.0

* update CHANGELOG.md

* update devDependencies
  • Loading branch information
0xslipk authored Apr 14, 2021
1 parent f071246 commit 3902892
Show file tree
Hide file tree
Showing 11 changed files with 196 additions and 38 deletions.
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--
PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.
ISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.
-->

## I'm submitting a...
<!--
Please search GitHub for a similar issue or PR before submitting.
Check one of the following options with "x" -->
<pre><code>
[ ] Regression <!--(a behavior that used to work and stopped working in a new release)-->
[ ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
</code></pre>

## Current behavior
<!-- Describe how the issue manifests. -->


## Expected behavior
<!-- Describe what the desired behavior would be. -->


## Minimal reproduction of the problem with instructions
<!-- Please share a repo, a gist, or step-by-step instructions. -->

## What is the motivation / use case for changing the behavior?
<!-- Describe the motivation or the concrete use case. -->

## Environment

<pre><code>
Nest version: X.Y.Z
Nest Ethers version: X.Y.Z
<!-- Check whether this is still an issue in the most recent Nest version -->

For Tooling issues:
- Node version: XX <!-- run `node --version` -->
- Platform: <!-- Mac, Linux, Windows -->
- Server: <!-- Express, Fastify -->

Others:
<!-- Anything else relevant? Operating system version, IDE, package manager, ... -->
</code></pre>
43 changes: 43 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## PR Checklist
Please check if your PR fulfills the following requirements:

- [ ] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)


## PR Type
What kind of change does this PR introduce?

<!-- Please check the one that applies to this PR using "x". -->
```
[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:
```

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

Issue Number: N/A


## What is the new behavior?
<!-- Please describe how the issue was solved. -->


## Does this PR introduce a breaking change?
```
[ ] Yes
[ ] No
```

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->


## Other information
<!-- Anything else relevant? Operating system version, IDE, package manager, ... -->
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changelog

## 0.1.0
Published by **[jarcodallo](https://github.com/jarcodallo)** on **TODO**
- TODO
Published by **[jarcodallo](https://github.com/jarcodallo)** on **2021/04/14**
- [#1](https://github.com/jarcodallo/nestjs-ethers/pull/10) Release v0.1.0 - Ethereum Module implementation for NestJS based on [Ethers.js](https://github.com/ethers-io/ethers.js/)
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ interface EthersModuleOptions {
Use `EthersModule.forRoot` method with [Options interface](#configuration-params):

```ts
import { EthersModule } from 'nestjs-ethers';
import { EthersModule, RINKEBY_NETWORK } from 'nestjs-ethers';

@Module({
imports: [
EthersModule.forRoot({
network: 'rinkeby',
network: RINKEBY_NETWORK,
providerName: 'MyModule',
alchemy: '845ce4ed0120d68eb5740c9160f08f98',
etherscan: 'e8cce313c1cfbd085f68be509451f1bab8',
Expand Down Expand Up @@ -145,7 +145,7 @@ With `EthersModule.forRootAsync` you can, for example, import your `ConfigModule
Here's an example:

```ts
import { EthersModule } from 'nestjs-ethers';
import { EthersModule, RINKEBY_NETWORK } from 'nestjs-ethers';

@Injectable()
class ConfigService {
Expand All @@ -169,7 +169,7 @@ class ConfigModule {}
useFactory: async (config: ConfigService) => {
await somePromise();
return {
network: 'rinkeby',
network: RINKEBY_NETWORK,
infura: config.infura,
useDefaultProvider: false,
};
Expand All @@ -184,7 +184,7 @@ class TestModule {}
Or you can just pass `ConfigService` to `providers`, if you don't have any `ConfigModule`:

```ts
import { EthersModule } from 'nestjs-ethers';
import { EthersModule, RINKEBY_NETWORK } from 'nestjs-ethers';

@Injectable()
class ConfigService {
Expand All @@ -201,7 +201,7 @@ class ConfigService {
inject: [ConfigService],
useFactory: (config: ConfigService) => {
return {
network: 'rinkeby',
network: RINKEBY_NETWORK,
pocket: config.pocket,
useDefaultProvider: false,
};
Expand All @@ -216,7 +216,7 @@ class TestModule {}
You can also pass multiple `ethersjs` configs, if you want to use the `FallbackProvider` to send multiple requests simultaneously:

```ts
import { EthersModule } from 'nestjs-ethers';
import { EthersModule, RINKEBY_NETWORK } from 'nestjs-ethers';

@Injectable()
class ConfigService {
Expand Down Expand Up @@ -244,7 +244,7 @@ class ConfigModule {}
useFactory: async (config: ConfigService) => {
await somePromise();
return {
network: 'rinkeby',
network: RINKEBY_NETWORK,
infura: config.infura,
pocket: config.pocket,
useDefaultProvider: false,
Expand Down
6 changes: 3 additions & 3 deletions __tests__/ethers.decorators.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
InjectEthersProvider,
EthersBaseProvider,
Network,
ETHERS_MAINNET_NAME,
MAINNET_NETWORK,
} from '../src';
import { platforms } from './utils/platforms';
import { extraWait } from './utils/extraWait';
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('InjectEthersProvider', () => {
expect(res.body.network).toBeDefined();
expect(res.body.network).toHaveProperty(
'name',
ETHERS_MAINNET_NAME,
MAINNET_NETWORK.name,
);
expect(res.body.network).toHaveProperty('chainId', 1);
expect(res.body.network).toHaveProperty('ensAddress');
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('InjectEthersProvider', () => {
expect(res.body.network).toBeDefined();
expect(res.body.network).toHaveProperty(
'name',
ETHERS_MAINNET_NAME,
MAINNET_NETWORK.name,
);
expect(res.body.network).toHaveProperty('chainId', 1);
expect(res.body.network).toHaveProperty('ensAddress');
Expand Down
15 changes: 8 additions & 7 deletions __tests__/ethers.module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
EthersModule,
InjectEthersProvider,
EthersBaseProvider,
ETHERS_MAINNET_NAME,
MAINNET_NETWORK,
RINKEBY_NETWORK,
Network,
} from '../src';
import { platforms } from './utils/platforms';
Expand Down Expand Up @@ -89,7 +90,7 @@ describe('Ethers Module Initialization', () => {
expect(res.body.network).toBeDefined();
expect(res.body.network).toHaveProperty(
'name',
ETHERS_MAINNET_NAME,
MAINNET_NETWORK.name,
);
expect(res.body.network).toHaveProperty('chainId', 1);
expect(res.body.network).toHaveProperty('ensAddress');
Expand Down Expand Up @@ -119,7 +120,7 @@ describe('Ethers Module Initialization', () => {
@Module({
imports: [
EthersModule.forRoot({
network: 'rinkeby',
network: RINKEBY_NETWORK,
alchemy: RINKEBY_ALCHEMY_API_KEY,
useDefaultProvider: false,
}),
Expand Down Expand Up @@ -170,7 +171,7 @@ describe('Ethers Module Initialization', () => {
@Module({
imports: [
EthersModule.forRoot({
network: 'rinkeby',
network: RINKEBY_NETWORK,
pocket: {
applicationId: RINKEBY_POKT_API_KEY,
applicationSecretKey: RINKEBY_POKT_SECRET_KEY,
Expand Down Expand Up @@ -242,7 +243,7 @@ describe('Ethers Module Initialization', () => {
inject: [ConfigService],
useFactory: (config: ConfigService) => {
return {
network: 'rinkeby',
network: RINKEBY_NETWORK,
etherscan: config.etherscan,
useDefaultProvider: false,
};
Expand Down Expand Up @@ -308,7 +309,7 @@ describe('Ethers Module Initialization', () => {
inject: [ConfigService],
useFactory: (config: ConfigService) => {
return {
network: 'rinkeby',
network: RINKEBY_NETWORK,
infura: config.infura,
useDefaultProvider: false,
};
Expand Down Expand Up @@ -468,7 +469,7 @@ describe('Ethers Module Initialization', () => {
inject: [ConfigService],
useFactory: (config: ConfigService) => {
return {
network: 'rinkeby',
network: RINKEBY_NETWORK,
etherscan: config.etherscan,
infura: config.infura,
useDefaultProvider: false,
Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nestjs-ethers",
"version": "0.1.0-rc.5",
"version": "0.1.0",
"description": "The ethers.js library for NestJS",
"author": "Jose Ramirez <[email protected]>",
"license": "Apache",
Expand All @@ -20,7 +20,8 @@
"test:watch": "jest --watch",
"test:cov": "jest --verbose --coverage",
"test:e2e": "jest --config ./test/jest-e2e.json",
"report": "cat ./coverage/lcov.info | coveralls"
"report": "cat ./coverage/lcov.info | coveralls",
"prepublishOnly": "npm run lint:ci && npm run test"
},
"keywords": [
"ethers",
Expand Down Expand Up @@ -57,7 +58,7 @@
"@typescript-eslint/parser": "^4.19.0",
"coveralls": "^3.1.0",
"eslint": "^7.24.0",
"eslint-config-prettier": "^8.1.0",
"eslint-config-prettier": "^8.2.0",
"eslint-plugin-prettier": "^3.3.1",
"jest": "^26.6.3",
"prettier": "^2.2.1",
Expand Down
52 changes: 51 additions & 1 deletion src/ethers.constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,54 @@
import { Network } from '@ethersproject/providers';

export const DECORATED_PREFIX = 'EthersJS';
export const ETHERS_PROVIDER_NAME = 'EthersProviderName';
export const ETHERS_MODULE_OPTIONS = 'EthersModuleOptions';
export const ETHERS_MAINNET_NAME = 'homestead';
export const HOMESTEAD_NETWORK: Network = {
chainId: 1,
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
name: 'homestead',
};
export const MAINNET_NETWORK: Network = HOMESTEAD_NETWORK;
export const ROPSTEN_NETWORK: Network = {
chainId: 3,
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
name: 'ropsten',
};
export const CLASSIC_MORDOR_NETWORK: Network = {
chainId: 63,
name: 'classicMordor',
};
export const UNSPECIFIED_NETWORK: Network = {
chainId: 0,
name: 'unspecified',
};
export const MORDEN_NETWORK: Network = {
chainId: 2,
name: 'morden',
};
export const RINKEBY_NETWORK: Network = {
chainId: 4,
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
name: 'rinkeby',
};
export const KOVAN_NETWORK: Network = {
chainId: 42,
name: 'kovan',
};
export const GOERLI_NETWORK: Network = {
chainId: 5,
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
name: 'goerli',
};
export const CLASSIC_NETWORK: Network = {
chainId: 61,
name: 'classic',
};
export const CLASSIC_MORDEN_NETWORK: Network = {
chainId: 62,
name: 'classicMorden',
};
export const CLASSIC_KOTTI_NETWORK: Network = {
chainId: 6,
name: 'classicKotti',
};
Loading

0 comments on commit 3902892

Please sign in to comment.