-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
194 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./pricing.module"; | ||
export * from "./services/coingecko.service"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Module } from "@nestjs/common"; | ||
|
||
import { CoingeckoService } from "./services"; | ||
|
||
@Module({ | ||
providers: [CoingeckoService], | ||
exports: [CoingeckoService], | ||
}) | ||
export class PricingModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Test, TestingModule } from "@nestjs/testing"; | ||
|
||
import { CoingeckoService } from "./coingecko.service"; | ||
|
||
describe("CoingeckoService", () => { | ||
let service: CoingeckoService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [ | ||
{ | ||
provide: CoingeckoService, | ||
useFactory: () => { | ||
const apiKey = "COINGECKO_API_KEY"; | ||
return new CoingeckoService(apiKey); | ||
}, | ||
}, | ||
], | ||
}).compile(); | ||
|
||
service = module.get<CoingeckoService>(CoingeckoService); | ||
}); | ||
|
||
it("should be defined", () => { | ||
expect(service).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Injectable } from "@nestjs/common"; | ||
|
||
@Injectable() | ||
export class CoingeckoService { | ||
private readonly API_BASE_URL = "https://api.coingecko.com/api/v3/"; | ||
constructor(private readonly apiKey: string) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./coingecko.service"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"outDir": "../../dist/libs/pricing" | ||
}, | ||
"include": ["src/**/*"], | ||
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,103 @@ | ||
{ | ||
"name": "zkchainHub", | ||
"version": "0.0.1", | ||
"description": "", | ||
"author": "", | ||
"private": true, | ||
"license": "UNLICENSED", | ||
"scripts": { | ||
"build": "nest build", | ||
"format": "prettier --write \"{apps,libs}/**/*.ts\"", | ||
"start": "nest start", | ||
"start:dev": "nest start --watch", | ||
"start:debug": "nest start --debug --watch", | ||
"start:prod": "node dist/apps/api/main", | ||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:cov": "jest --coverage", | ||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", | ||
"test:e2e": "jest --config ./apps/api/test/jest-e2e.json", | ||
"prepare": "husky", | ||
"preinstall": "npx only-allow pnpm" | ||
}, | ||
"dependencies": { | ||
"@nestjs/common": "10.0.0", | ||
"@nestjs/core": "10.0.0", | ||
"@nestjs/platform-express": "10.0.0", | ||
"@nestjs/swagger": "7.4.0", | ||
"abitype": "1.0.5", | ||
"reflect-metadata": "0.1.13", | ||
"rxjs": "7.8.1", | ||
"viem": "2.17.5" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/config-conventional": "19.2.2", | ||
"@golevelup/ts-jest": "0.5.0", | ||
"@ianvs/prettier-plugin-sort-imports": "4.3.0", | ||
"@nestjs/cli": "10.0.0", | ||
"@nestjs/schematics": "10.0.0", | ||
"@nestjs/testing": "10.0.0", | ||
"@total-typescript/tsconfig": "1.0.4", | ||
"@types/express": "4.17.17", | ||
"@types/jest": "29.5.2", | ||
"@types/node": "20.3.1", | ||
"@types/supertest": "6.0.0", | ||
"@typescript-eslint/eslint-plugin": "7.0.0", | ||
"@typescript-eslint/parser": "7.0.0", | ||
"commitlint": "19.3.0", | ||
"eslint": "8.42.0", | ||
"eslint-config-prettier": "9.0.0", | ||
"eslint-plugin-prettier": "5.0.0", | ||
"husky": "9.0.11", | ||
"jest": "29.5.0", | ||
"lint-staged": "15.2.7", | ||
"prettier": "3.0.0", | ||
"source-map-support": "0.5.21", | ||
"supertest": "7.0.0", | ||
"ts-jest": "29.1.0", | ||
"ts-loader": "9.4.3", | ||
"ts-node": "10.9.1", | ||
"tsconfig-paths": "4.2.0", | ||
"typescript": "5.1.3" | ||
}, | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
"ts" | ||
], | ||
"rootDir": ".", | ||
"testRegex": ".*\\.spec\\.ts$", | ||
"transform": { | ||
".+\\.(t|j)s$": "ts-jest" | ||
"name": "zkchainHub", | ||
"version": "0.0.1", | ||
"description": "", | ||
"author": "", | ||
"private": true, | ||
"license": "UNLICENSED", | ||
"scripts": { | ||
"build": "nest build", | ||
"format": "prettier --write \"{apps,libs}/**/*.ts\"", | ||
"start": "nest start", | ||
"start:dev": "nest start --watch", | ||
"start:debug": "nest start --debug --watch", | ||
"start:prod": "node dist/apps/api/main", | ||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:cov": "jest --coverage", | ||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", | ||
"test:e2e": "jest --config ./apps/api/test/jest-e2e.json", | ||
"prepare": "husky", | ||
"preinstall": "npx only-allow pnpm" | ||
}, | ||
"collectCoverageFrom": [ | ||
"**/*.(t|j)s" | ||
], | ||
"coverageDirectory": "./coverage", | ||
"coveragePathIgnorePatterns": [ | ||
"/node_modules/", | ||
".e2e-spec.ts", | ||
".module.ts", | ||
"main.ts" | ||
], | ||
"testEnvironment": "node", | ||
"roots": [ | ||
"<rootDir>/apps/", | ||
"<rootDir>/libs/" | ||
], | ||
"moduleNameMapper": { | ||
"^@packages/providers(|/.*)$": "<rootDir>/libs/providers/src/$1", | ||
"^@shared/dtos(|/.*)$": "<rootDir>/libs/dtos/src/$1" | ||
"dependencies": { | ||
"@nestjs/common": "10.0.0", | ||
"@nestjs/core": "10.0.0", | ||
"@nestjs/platform-express": "10.0.0", | ||
"@nestjs/swagger": "7.4.0", | ||
"abitype": "1.0.5", | ||
"reflect-metadata": "0.1.13", | ||
"rxjs": "7.8.1", | ||
"viem": "2.17.5" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/config-conventional": "19.2.2", | ||
"@golevelup/ts-jest": "0.5.0", | ||
"@ianvs/prettier-plugin-sort-imports": "4.3.0", | ||
"@nestjs/cli": "10.0.0", | ||
"@nestjs/schematics": "10.0.0", | ||
"@nestjs/testing": "10.0.0", | ||
"@total-typescript/tsconfig": "1.0.4", | ||
"@types/express": "4.17.17", | ||
"@types/jest": "29.5.2", | ||
"@types/node": "20.3.1", | ||
"@types/supertest": "6.0.0", | ||
"@typescript-eslint/eslint-plugin": "7.0.0", | ||
"@typescript-eslint/parser": "7.0.0", | ||
"commitlint": "19.3.0", | ||
"eslint": "8.42.0", | ||
"eslint-config-prettier": "9.0.0", | ||
"eslint-plugin-prettier": "5.0.0", | ||
"husky": "9.0.11", | ||
"jest": "29.5.0", | ||
"lint-staged": "15.2.7", | ||
"prettier": "3.0.0", | ||
"source-map-support": "0.5.21", | ||
"supertest": "7.0.0", | ||
"ts-jest": "29.1.0", | ||
"ts-loader": "9.4.3", | ||
"ts-node": "10.9.1", | ||
"tsconfig-paths": "4.2.0", | ||
"typescript": "5.1.3" | ||
}, | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
"ts" | ||
], | ||
"rootDir": ".", | ||
"testRegex": ".*\\.spec\\.ts$", | ||
"transform": { | ||
".+\\.(t|j)s$": "ts-jest" | ||
}, | ||
"collectCoverageFrom": [ | ||
"**/*.(t|j)s" | ||
], | ||
"coverageDirectory": "./coverage", | ||
"coveragePathIgnorePatterns": [ | ||
"/node_modules/", | ||
".e2e-spec.ts", | ||
".module.ts", | ||
"main.ts" | ||
], | ||
"testEnvironment": "node", | ||
"roots": [ | ||
"<rootDir>/apps/", | ||
"<rootDir>/libs/" | ||
], | ||
"moduleNameMapper": { | ||
"^@packages/providers(|/.*)$": "<rootDir>/libs/providers/src/$1", | ||
"^@shared/dtos(|/.*)$": "<rootDir>/libs/dtos/src/$1", | ||
"^@packages/pricing(|/.*)$": "<rootDir>/libs/pricing/src/$1" | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha1.8c155dc114e1689d18937974f6571e0ceee66f1d", | ||
"lint-staged": { | ||
"(apps|libs)/**/*.(ts|js)": [ | ||
"pnpm lint", | ||
"pnpm format" | ||
] | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha1.8c155dc114e1689d18937974f6571e0ceee66f1d", | ||
"lint-staged": { | ||
"(apps|libs)/**/*.(ts|js)": [ | ||
"pnpm lint", | ||
"pnpm format" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,31 @@ | ||
{ | ||
"extends": "@total-typescript/tsconfig/tsc/no-dom/app", | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"declaration": true, | ||
"removeComments": true, | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"allowSyntheticDefaultImports": true, | ||
"target": "ES2021", | ||
"sourceMap": true, | ||
"outDir": "./dist", | ||
"baseUrl": "./", | ||
"incremental": true, | ||
"skipLibCheck": true, | ||
"strictNullChecks": true, | ||
"noImplicitAny": true, | ||
"strictBindCallApply": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"paths": { | ||
"@packages/providers": [ | ||
"libs/providers/src" | ||
], | ||
"@packages/providers/*": [ | ||
"libs/providers/src/*" | ||
], | ||
"@shared/dtos": [ | ||
"libs/dtos/src" | ||
], | ||
"@shared/dtos/*": [ | ||
"libs/dtos/src/*" | ||
] | ||
}, | ||
"verbatimModuleSyntax": false | ||
} | ||
} | ||
"extends": "@total-typescript/tsconfig/tsc/no-dom/app", | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"declaration": true, | ||
"removeComments": true, | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"allowSyntheticDefaultImports": true, | ||
"target": "ES2021", | ||
"sourceMap": true, | ||
"outDir": "./dist", | ||
"baseUrl": "./", | ||
"incremental": true, | ||
"skipLibCheck": true, | ||
"strictNullChecks": true, | ||
"noImplicitAny": true, | ||
"strictBindCallApply": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"paths": { | ||
"@packages/providers": ["libs/providers/src"], | ||
"@packages/providers/*": ["libs/providers/src/*"], | ||
"@shared/dtos": ["libs/dtos/src"], | ||
"@shared/dtos/*": ["libs/dtos/src/*"], | ||
"@packages/pricing": ["libs/pricing/src"], | ||
"@packages/pricing/*": ["libs/pricing/src/*"] | ||
}, | ||
"verbatimModuleSyntax": false | ||
} | ||
} |