diff --git a/README.md b/README.md index ecd454f..677f4d9 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ const assets = await orion.getAssets(); // Optional: tradableOnly: boolean (defa ### Get pairs ```ts -const pairs = await orion.getPairs("spot"); // 'spot' | 'futures' +const pairs = await orion.getPairs("spot"); // 'spot' // Response example: // { diff --git a/package-lock.json b/package-lock.json index ba854fe..6436478 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.33-rc1", + "version": "0.19.33-rc2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@orionprotocol/sdk", - "version": "0.19.33-rc1", + "version": "0.19.33-rc2", "license": "ISC", "dependencies": { "@babel/runtime": "^7.21.0", diff --git a/package.json b/package.json index dd0b981..d7e6ff7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.33-rc1", + "version": "0.19.33-rc2", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/services/Aggregator/index.ts b/src/services/Aggregator/index.ts index 5b8127e..aa78814 100644 --- a/src/services/Aggregator/index.ts +++ b/src/services/Aggregator/index.ts @@ -9,10 +9,10 @@ import placeAtomicSwapSchema from './schemas/placeAtomicSwapSchema.js'; import { AggregatorWS } from './ws/index.js'; import { atomicSwapHistorySchema } from './schemas/atomicSwapHistorySchema.js'; import type { BasicAuthCredentials, Exchange, SignedCancelOrderRequest, SignedOrder } from '../../types.js'; -import { pairConfigSchema } from './schemas/index.js'; import { - aggregatedOrderbookSchema, exchangeOrderbookSchema, poolReservesSchema, -} from './schemas/aggregatedOrderbookSchema.js'; + pairConfigSchema, aggregatedOrderbookSchema, + exchangeOrderbookSchema, poolReservesSchema, +} from './schemas/index.js'; import type networkCodes from '../../constants/networkCodes.js'; import toUpperCase from '../../utils/toUpperCase.js'; import httpToWS from '../../utils/httpToWS.js'; @@ -93,7 +93,7 @@ class Aggregator { ); } - getPairsList = (market: 'spot' | 'futures') => { + getPairsList = (market: 'spot') => { const url = new URL(`${this.apiUrl}/api/v1/pairs/list`); url.searchParams.append('market', toUpperCase(market)); @@ -141,7 +141,7 @@ class Aggregator { ); }; - getPairConfigs = (market: 'spot' | 'futures') => { + getPairConfigs = (market: 'spot') => { const url = new URL(`${this.apiUrl}/api/v1/pairs/exchangeInfo`); url.searchParams.append('market', toUpperCase(market)); diff --git a/src/services/Aggregator/ws/MessageType.ts b/src/services/Aggregator/ws/MessageType.ts index ba3ac39..fe4bc7f 100644 --- a/src/services/Aggregator/ws/MessageType.ts +++ b/src/services/Aggregator/ws/MessageType.ts @@ -7,7 +7,6 @@ const MessageType = { ASSET_PAIRS_CONFIG_UPDATE: 'apcu', ASSET_PAIR_CONFIG_UPDATE: 'apiu', ADDRESS_UPDATE: 'au', - FUTURES_TRADE_INFO_UPDATE: 'fti', BROKER_TRADABLE_ATOMIC_SWAP_ASSETS_BALANCE_UPDATE: 'btasabu', UNSUBSCRIPTION_DONE: 'ud', } as const; diff --git a/src/services/Aggregator/ws/SubscriptionType.ts b/src/services/Aggregator/ws/SubscriptionType.ts index e462f29..66b0c0c 100644 --- a/src/services/Aggregator/ws/SubscriptionType.ts +++ b/src/services/Aggregator/ws/SubscriptionType.ts @@ -5,7 +5,6 @@ const SubscriptionType = { ADDRESS_UPDATES_SUBSCRIBE: 'aus', BROKER_TRADABLE_ATOMIC_SWAP_ASSETS_BALANCE_UPDATES_SUBSCRIBE: 'btasabus', SWAP_SUBSCRIBE: 'ss', - FUTURES_TRADE_INFO_SUBSCRIBE: 'fts', } as const; export default SubscriptionType; diff --git a/src/services/Aggregator/ws/index.ts b/src/services/Aggregator/ws/index.ts index 0840d7b..06ca450 100644 --- a/src/services/Aggregator/ws/index.ts +++ b/src/services/Aggregator/ws/index.ts @@ -11,12 +11,11 @@ import { import UnsubscriptionType from './UnsubscriptionType.js'; import type { SwapInfoBase, AssetPairUpdate, OrderbookItem, - Balance, Exchange, FuturesTradeInfo, SwapInfo, Json, BasicAuthCredentials, + Balance, Exchange, SwapInfo, Json, BasicAuthCredentials, } from '../../../types.js'; import unsubscriptionDoneSchema from './schemas/unsubscriptionDoneSchema.js'; import assetPairConfigSchema from './schemas/assetPairConfigSchema.js'; import type { fullOrderSchema, orderUpdateSchema } from './schemas/addressUpdateSchema.js'; -import futuresTradeInfoSchema from './schemas/futuresTradeInfoSchema.js'; import { objectKeys } from '../../../utils/objectKeys.js'; // import assertError from '../../../utils/assertError.js'; // import errorSchema from './schemas/errorSchema'; @@ -34,7 +33,6 @@ const messageSchema = z.union([ brokerMessageSchema, orderBookSchema, swapInfoSchema, - futuresTradeInfoSchema, errorSchema, unsubscriptionDoneSchema, ]); @@ -49,13 +47,6 @@ type SwapInfoSubscriptionPayload = { is?: boolean // instant settlement } -type FuturesTradeInfoPayload = { - s: string // wallet address - i: string // pair - a: number // amount - p?: number // price -} - type BrokerTradableAtomicSwapBalanceSubscription = { callback: (balances: Partial>) => void } @@ -90,12 +81,6 @@ type SwapInfoSubscription = { callback: (swapInfo: SwapInfo) => void } -type FuturesTradeInfoSubscription = { - payload: FuturesTradeInfoPayload - callback: (futuresTradeInfo: FuturesTradeInfo) => void - errorCb?: (message: string) => void -} - type AddressUpdateUpdate = { kind: 'update' balances: Partial< @@ -131,7 +116,6 @@ type Subscription = { [SubscriptionType.ASSET_PAIR_CONFIG_UPDATES_SUBSCRIBE]: PairConfigSubscription [SubscriptionType.BROKER_TRADABLE_ATOMIC_SWAP_ASSETS_BALANCE_UPDATES_SUBSCRIBE]: BrokerTradableAtomicSwapBalanceSubscription [SubscriptionType.SWAP_SUBSCRIBE]: SwapInfoSubscription - [SubscriptionType.FUTURES_TRADE_INFO_SUBSCRIBE]: FuturesTradeInfoSubscription } const exclusiveSubscriptions = [ @@ -171,8 +155,6 @@ type Subscriptions = Partial<{ [K in keyof Subscription]: Partial> }>; -const FUTURES_SUFFIX = 'USDF'; - class AggregatorWS { private ws?: WebSocket | undefined; @@ -368,8 +350,7 @@ class AggregatorWS { const isOrderBooksSubscription = (subId: string) => { const isSpotPairName = subId.includes('-') && subId.split('-').length === 2; - const isFuturesPairName = subId.endsWith(FUTURES_SUFFIX); - return isSpotPairName || isFuturesPairName; + return isSpotPairName; } if (newestSubId.includes('0x')) { // is wallet address (ADDRESS_UPDATE) @@ -385,7 +366,6 @@ class AggregatorWS { // is swap info subscription (contains hyphen) delete this.subscriptions[SubscriptionType.SWAP_SUBSCRIBE]?.[newestSubId]; delete this.subscriptions[SubscriptionType.ASSET_PAIR_CONFIG_UPDATES_SUBSCRIBE]?.[newestSubId]; - delete this.subscriptions[SubscriptionType.FUTURES_TRADE_INFO_SUBSCRIBE]?.[newestSubId]; // !!! swap info subscription is uuid that contains hyphen } else if (isOrderBooksSubscription(newestSubId)) { // is pair name(AGGREGATED_ORDER_BOOK_UPDATE) const aobSubscriptions = this.subscriptions[SubscriptionType.AGGREGATED_ORDER_BOOK_UPDATES_SUBSCRIBE]; @@ -564,18 +544,6 @@ class AggregatorWS { } } break; - case MessageType.FUTURES_TRADE_INFO_UPDATE: - this.subscriptions[SubscriptionType.FUTURES_TRADE_INFO_SUBSCRIBE]?.[json.id]?.callback({ - futuresTradeRequestId: json.id, - sender: json.S, - instrument: json.i, - buyPrice: json.bp, - sellPrice: json.sp, - buyPower: json.bpw, - sellPower: json.spw, - minAmount: json.ma, - }); - break; case MessageType.INITIALIZATION: this.onInit?.(); break; diff --git a/src/services/Aggregator/ws/schemas/futuresTradeInfoSchema.ts b/src/services/Aggregator/ws/schemas/futuresTradeInfoSchema.ts deleted file mode 100644 index 5aed068..0000000 --- a/src/services/Aggregator/ws/schemas/futuresTradeInfoSchema.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { z } from 'zod'; -import MessageType from '../MessageType.js'; - -const futuresTradeInfoSchema = z.object({ - T: z.literal(MessageType.FUTURES_TRADE_INFO_UPDATE), - id: z.string(), // trade info request UUID, set by client side - S: z.string(), // sender - i: z.string(), // instrument - bp: z.number().optional(), // buy price - sp: z.number().optional(), // sell price - bpw: z.number(), // buy power - spw: z.number(), // sell power - ma: z.number(), // min amount -}); - -export default futuresTradeInfoSchema; diff --git a/src/types.ts b/src/types.ts index f3786f6..7f07ddd 100644 --- a/src/types.ts +++ b/src/types.ts @@ -203,17 +203,6 @@ export type SwapInfoByAmountOut = SwapInfoBase & { export type SwapInfo = SwapInfoByAmountIn | SwapInfoByAmountOut; -export type FuturesTradeInfo = { - futuresTradeRequestId: string - sender: string - instrument: string - buyPrice: number | undefined - sellPrice: number | undefined - buyPower: number - sellPower: number - minAmount: number -} - export enum HistoryTransactionStatus { PENDING = 'Pending', DONE = 'Done', @@ -255,7 +244,7 @@ export type VerboseUnitConfig = { // https://price-feed:3003/ } } - basicAuth?: BasicAuthCredentials, + basicAuth?: BasicAuthCredentials } export type KnownEnv = typeof knownEnvs[number];