diff --git a/libs/pricing/src/index.ts b/libs/pricing/src/index.ts index 6034301..f7850bb 100644 --- a/libs/pricing/src/index.ts +++ b/libs/pricing/src/index.ts @@ -1,2 +1,3 @@ export * from "./pricing.module"; export * from "./services/coingecko.service"; +export * from "./interfaces"; diff --git a/libs/pricing/src/interfaces/index.ts b/libs/pricing/src/interfaces/index.ts new file mode 100644 index 0000000..2a231ae --- /dev/null +++ b/libs/pricing/src/interfaces/index.ts @@ -0,0 +1 @@ +export * from "./pricing.interface"; diff --git a/libs/pricing/src/interfaces/pricing.interface.ts b/libs/pricing/src/interfaces/pricing.interface.ts new file mode 100644 index 0000000..34055d2 --- /dev/null +++ b/libs/pricing/src/interfaces/pricing.interface.ts @@ -0,0 +1,19 @@ +/** + * Represents a pricing service that provides token prices. + */ +/** + * Represents a pricing service that retrieves token prices. + */ +export interface IPricingService { + /** + * Retrieves the prices of the specified tokens. + * @param tokenIds - An array of token IDs. + * @param [config] - Optional configuration object. + * @param config.currency - The currency in which the prices should be returned. + * @returns A promise that resolves to a record containing the token IDs as keys and their corresponding prices as values. + */ + getTokenPrices( + tokenIds: TokenId[], + config?: { currency: string }, + ): Promise>; +} diff --git a/libs/pricing/src/services/coingecko.service.ts b/libs/pricing/src/services/coingecko.service.ts index e93a9f9..ee9838d 100644 --- a/libs/pricing/src/services/coingecko.service.ts +++ b/libs/pricing/src/services/coingecko.service.ts @@ -1,7 +1,15 @@ import { Injectable } from "@nestjs/common"; +import { IPricingService } from "@packages/pricing/interfaces"; @Injectable() -export class CoingeckoService { +export class CoingeckoService implements IPricingService { private readonly API_BASE_URL = "https://api.coingecko.com/api/v3/"; constructor(private readonly apiKey: string) {} + + async getTokenPrices( + _tokenIds: string[], + _config: { currency: string } = { currency: "usd" }, + ): Promise> { + throw new Error("Method not implemented."); + } }