From 80caf3cc6a77383b81238ea79728c57eac1cd48b Mon Sep 17 00:00:00 2001 From: Andrius Dagys Date: Fri, 29 Mar 2024 12:08:49 +0200 Subject: [PATCH] Rename: feed type -> feed category --- apps/example_provider/src/config/coston.json | 66 +++++++++---------- apps/example_provider/src/config/local.json | 6 +- .../src/data-feeds/ccxt-provider-service.ts | 6 +- .../src/dto/provider-requests.dto.ts | 2 +- .../src/docs/feed-provider-API.md | 2 +- .../src/feed-value-provider-api/api-spec.json | 6 +- .../generated/provider-api.ts | 4 +- .../src/ftso-data-provider.service.ts | 4 +- libs/ftso-core/src/voting-types.ts | 2 +- .../example_provider.controller.test.ts | 4 +- 10 files changed, 51 insertions(+), 51 deletions(-) diff --git a/apps/example_provider/src/config/coston.json b/apps/example_provider/src/config/coston.json index a5b3adf1..32febcb9 100644 --- a/apps/example_provider/src/config/coston.json +++ b/apps/example_provider/src/config/coston.json @@ -1,6 +1,6 @@ [ { - "feed": { "type": 1, "name": "FLR/USD" }, + "feed": { "category": 1, "name": "FLR/USD" }, "sources": [ { "exchange": "coinbasepro", @@ -25,7 +25,7 @@ ] }, { - "feed": { "type": 1, "name": "SGB/USD" }, + "feed": { "category": 1, "name": "SGB/USD" }, "sources": [ { "exchange": "gate", @@ -38,7 +38,7 @@ ] }, { - "feed": { "type": 1, "name": "XRP/USD" }, + "feed": { "category": 1, "name": "XRP/USD" }, "sources": [ { "exchange": "bitget", @@ -75,7 +75,7 @@ ] }, { - "feed": { "type": 1, "name": "LTC/USD" }, + "feed": { "category": 1, "name": "LTC/USD" }, "sources": [ { "exchange": "binance", @@ -112,7 +112,7 @@ ] }, { - "feed": { "type": 1, "name": "XLM/USD" }, + "feed": { "category": 1, "name": "XLM/USD" }, "sources": [ { "exchange": "binance", @@ -153,7 +153,7 @@ ] }, { - "feed": { "type": 1, "name": "DOGE/USD" }, + "feed": { "category": 1, "name": "DOGE/USD" }, "sources": [ { "exchange": "binance", @@ -195,7 +195,7 @@ ] }, { - "feed": { "type": 1, "name": "ADA/USD" }, + "feed": { "category": 1, "name": "ADA/USD" }, "sources": [ { "exchange": "binance", @@ -237,7 +237,7 @@ ] }, { - "feed": { "type": 1, "name": "ALGO/USD" }, + "feed": { "category": 1, "name": "ALGO/USD" }, "sources": [ { "exchange": "binance", @@ -271,7 +271,7 @@ ] }, { - "feed": { "type": 1, "name": "BTC/USD" }, + "feed": { "category": 1, "name": "BTC/USD" }, "sources": [ { "exchange": "binance", @@ -312,7 +312,7 @@ ] }, { - "feed": { "type": 1, "name": "ETH/USD" }, + "feed": { "category": 1, "name": "ETH/USD" }, "sources": [ { "exchange": "binance", @@ -353,7 +353,7 @@ ] }, { - "feed": { "type": 1, "name": "FIL/USD" }, + "feed": { "category": 1, "name": "FIL/USD" }, "sources": [ { "exchange": "binance", @@ -390,7 +390,7 @@ ] }, { - "feed": { "type": 1, "name": "ARB/USD" }, + "feed": { "category": 1, "name": "ARB/USD" }, "sources": [ { "exchange": "binance", @@ -427,7 +427,7 @@ ] }, { - "feed": { "type": 1, "name": "AVAX/USD" }, + "feed": { "category": 1, "name": "AVAX/USD" }, "sources": [ { "exchange": "binance", @@ -468,7 +468,7 @@ ] }, { - "feed": { "type": 1, "name": "BNB/USD" }, + "feed": { "category": 1, "name": "BNB/USD" }, "sources": [ { "exchange": "binance", @@ -493,7 +493,7 @@ ] }, { - "feed": { "type": 1, "name": "MATIC/USD" }, + "feed": { "category": 1, "name": "MATIC/USD" }, "sources": [ { "exchange": "binance", @@ -530,7 +530,7 @@ ] }, { - "feed": { "type": 1, "name": "SOL/USD" }, + "feed": { "category": 1, "name": "SOL/USD" }, "sources": [ { "exchange": "binance", @@ -571,7 +571,7 @@ ] }, { - "feed": { "type": 1, "name": "USDC/USD" }, + "feed": { "category": 1, "name": "USDC/USD" }, "sources": [ { "exchange": "binance", @@ -596,7 +596,7 @@ ] }, { - "feed": { "type": 1, "name": "USDT/USD" }, + "feed": { "category": 1, "name": "USDT/USD" }, "sources": [ { "exchange": "coinbasepro", @@ -605,7 +605,7 @@ ] }, { - "feed": { "type": 1, "name": "XDC/USD" }, + "feed": { "category": 1, "name": "XDC/USD" }, "sources": [ { "exchange": "bitget", @@ -622,7 +622,7 @@ ] }, { - "feed": { "type": 1, "name": "TRX/USD" }, + "feed": { "category": 1, "name": "TRX/USD" }, "sources": [ { "exchange": "binance", @@ -647,7 +647,7 @@ ] }, { - "feed": { "type": 1, "name": "DOT/USD" }, + "feed": { "category": 1, "name": "DOT/USD" }, "sources": [ { "exchange": "binance", @@ -688,7 +688,7 @@ ] }, { - "feed": { "type": 1, "name": "LINK/USD" }, + "feed": { "category": 1, "name": "LINK/USD" }, "sources": [ { "exchange": "binance", @@ -729,7 +729,7 @@ ] }, { - "feed": { "type": 1, "name": "TON/USD" }, + "feed": { "category": 1, "name": "TON/USD" }, "sources": [ { "exchange": "gate", @@ -746,7 +746,7 @@ ] }, { - "feed": { "type": 1, "name": "ICP/USD" }, + "feed": { "category": 1, "name": "ICP/USD" }, "sources": [ { "exchange": "binance", @@ -787,7 +787,7 @@ ] }, { - "feed": { "type": 1, "name": "SHIB/USD" }, + "feed": { "category": 1, "name": "SHIB/USD" }, "sources": [ { "exchange": "binance", @@ -828,7 +828,7 @@ ] }, { - "feed": { "type": 1, "name": "DAI/USD" }, + "feed": { "category": 1, "name": "DAI/USD" }, "sources": [ { "exchange": "bitget", @@ -857,7 +857,7 @@ ] }, { - "feed": { "type": 1, "name": "BCH/USD" }, + "feed": { "category": 1, "name": "BCH/USD" }, "sources": [ { "exchange": "binance", @@ -894,7 +894,7 @@ ] }, { - "feed": { "type": 1, "name": "ATOM/USD" }, + "feed": { "category": 1, "name": "ATOM/USD" }, "sources": [ { "exchange": "binance", @@ -935,7 +935,7 @@ ] }, { - "feed": { "type": 1, "name": "UNI/USD" }, + "feed": { "category": 1, "name": "UNI/USD" }, "sources": [ { "exchange": "binance", @@ -972,7 +972,7 @@ ] }, { - "feed": { "type": 1, "name": "LEO/USD" }, + "feed": { "category": 1, "name": "LEO/USD" }, "sources": [ { "exchange": "gate", @@ -985,7 +985,7 @@ ] }, { - "feed": { "type": 1, "name": "ETC/USD" }, + "feed": { "category": 1, "name": "ETC/USD" }, "sources": [ { "exchange": "binance", @@ -1022,7 +1022,7 @@ ] }, { - "feed": { "type": 1, "name": "INJ/USD" }, + "feed": { "category": 1, "name": "INJ/USD" }, "sources": [ { "exchange": "binance", @@ -1059,7 +1059,7 @@ ] }, { - "feed": { "type": 2, "name": "EUR/USD" }, + "feed": { "category": 2, "name": "EUR/USD" }, "sources": [ { "exchange": "binance", diff --git a/apps/example_provider/src/config/local.json b/apps/example_provider/src/config/local.json index d733237d..2ef4e967 100644 --- a/apps/example_provider/src/config/local.json +++ b/apps/example_provider/src/config/local.json @@ -1,6 +1,6 @@ [ { - "feed": { "type": 1, "name": "BTC/USD" }, + "feed": { "category": 1, "name": "BTC/USD" }, "sources": [ { "exchange": "binance", @@ -17,7 +17,7 @@ ] }, { - "feed": { "type": 1, "name": "ETH/USD" }, + "feed": { "category": 1, "name": "ETH/USD" }, "sources": [ { "exchange": "binance", @@ -35,7 +35,7 @@ }, { - "feed": { "type": 1, "name": "USDT/USD" }, + "feed": { "category": 1, "name": "USDT/USD" }, "sources": [ { "exchange": "coinbasepro", diff --git a/apps/example_provider/src/data-feeds/ccxt-provider-service.ts b/apps/example_provider/src/data-feeds/ccxt-provider-service.ts index 07b3d225..a4d3953d 100644 --- a/apps/example_provider/src/data-feeds/ccxt-provider-service.ts +++ b/apps/example_provider/src/data-feeds/ccxt-provider-service.ts @@ -5,7 +5,7 @@ import { networks } from "../../../../libs/ftso-core/src/configs/networks"; import { retry } from "../../../../libs/ftso-core/src/utils/retry"; import { FeedId, FeedValueData } from "../dto/provider-requests.dto"; import { BaseDataFeed } from "./base-feed"; -import { FeedType } from "../../../../libs/ftso-core/src/voting-types"; +import { FeedCategory } from "../../../../libs/ftso-core/src/voting-types"; export const CCXT_FALLBACK_VALUE = 0.01; const CONFIG_PREFIX = "apps/example_provider/src/config/"; @@ -25,7 +25,7 @@ interface PriceInfo { exchange: string; } -const usdtToUsdFeedId: FeedId = { type: FeedType.Crypto.valueOf(), name: "USDT/USD" }; +const usdtToUsdFeedId: FeedId = { category: FeedCategory.Crypto.valueOf(), name: "USDT/USD" }; export class CcxtFeed implements BaseDataFeed { private readonly logger = new Logger(CcxtFeed.name); @@ -212,5 +212,5 @@ export class CcxtFeed implements BaseDataFeed { } function feedsEqual(a: FeedId, b: FeedId): boolean { - return a.type === b.type && a.name === b.name; + return a.category === b.category && a.name === b.name; } diff --git a/apps/example_provider/src/dto/provider-requests.dto.ts b/apps/example_provider/src/dto/provider-requests.dto.ts index ba3b1140..326f68ff 100644 --- a/apps/example_provider/src/dto/provider-requests.dto.ts +++ b/apps/example_provider/src/dto/provider-requests.dto.ts @@ -1,5 +1,5 @@ export class FeedId { - type: number; + category: number; name: string; } diff --git a/apps/ftso-data-provider/src/docs/feed-provider-API.md b/apps/ftso-data-provider/src/docs/feed-provider-API.md index ce371e32..532dc4e9 100644 --- a/apps/ftso-data-provider/src/docs/feed-provider-API.md +++ b/apps/ftso-data-provider/src/docs/feed-provider-API.md @@ -17,7 +17,7 @@ Where `FeedId` is defined as: ```json { - type: number, + category: number, name: string } ``` diff --git a/apps/ftso-data-provider/src/feed-value-provider-api/api-spec.json b/apps/ftso-data-provider/src/feed-value-provider-api/api-spec.json index bd1c594b..df1c2255 100644 --- a/apps/ftso-data-provider/src/feed-value-provider-api/api-spec.json +++ b/apps/ftso-data-provider/src/feed-value-provider-api/api-spec.json @@ -23,7 +23,7 @@ "operationId": "getFeedValue", "parameters": [ { "name": "votingRoundId", "required": true, "in": "path", "schema": { "type": "number" } }, - { "required": true, "name": "type", "in": "query", "schema": { "type": "number" } }, + { "required": true, "name": "category", "in": "query", "schema": { "type": "number" } }, { "required": true, "name": "name", "in": "query", "schema": { "type": "string" } } ], "responses": { @@ -48,8 +48,8 @@ "schemas": { "FeedId": { "type": "object", - "properties": { "type": { "type": "number" }, "name": { "type": "string" } }, - "required": ["type", "name"] + "properties": { "category": { "type": "number" }, "name": { "type": "string" } }, + "required": ["category", "name"] }, "FeedValuesRequest": { "type": "object", diff --git a/apps/ftso-data-provider/src/feed-value-provider-api/generated/provider-api.ts b/apps/ftso-data-provider/src/feed-value-provider-api/generated/provider-api.ts index d8847a0c..629b42e3 100644 --- a/apps/ftso-data-provider/src/feed-value-provider-api/generated/provider-api.ts +++ b/apps/ftso-data-provider/src/feed-value-provider-api/generated/provider-api.ts @@ -10,7 +10,7 @@ */ export interface FeedId { - type: number; + category: number; name: string; } @@ -204,7 +204,7 @@ export class Api extends HttpClient { let exampleProviderController: ExampleProviderController; @@ -91,7 +91,7 @@ describe.skip("ExampleProviderController CCXT", () => { "EUR", ]; const feedIds: FeedId[] = feeds.map(feed => { - return { type: 1, name: `${feed}/USD` }; + return { category: 1, name: `${feed}/USD` }; }); await sleepFor(40_000);