diff --git a/package.json b/package.json index 0eb2a83..7df7bad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.16.0-rc.11", + "version": "0.16.0-rc.12", "description": "Orion Protocol SDK", "main": "./lib/esm/index.js", "module": "./lib/esm/index.js", diff --git a/src/services/OrionAggregator/ws/index.ts b/src/services/OrionAggregator/ws/index.ts index 8277b02..016430f 100644 --- a/src/services/OrionAggregator/ws/index.ts +++ b/src/services/OrionAggregator/ws/index.ts @@ -16,7 +16,7 @@ import { import unsubscriptionDoneSchema from './schemas/unsubscriptionDoneSchema'; import assetPairConfigSchema from './schemas/assetPairConfigSchema'; import { fullOrderSchema, orderUpdateSchema } from './schemas/addressUpdateSchema'; -import cfdAddressUpdateSchema from "./schemas/cfdAddressUpdateSchema"; +import cfdAddressUpdateSchema from './schemas/cfdAddressUpdateSchema'; // import errorSchema from './schemas/errorSchema'; const UNSUBSCRIBE = 'u'; @@ -90,13 +90,13 @@ type AddressUpdateInitial = { type CfdAddressUpdateUpdate = { kind: 'update', balances: CFDBalance[], - order?: OrderUpdate | FullOrder + order?: z.infer | z.infer } type CfdAddressUpdateInitial = { kind: 'initial', balances: CFDBalance[], - orders?: FullOrder[] // The field is not defined if the user has no orders + orders?: z.infer[] // The field is not defined if the user has no orders } type AddressUpdateSubscription = { @@ -455,11 +455,11 @@ class OrionAggregatorWS { } break; case MessageType.CFD_ADDRESS_UPDATE: { - const balances = json.b ?? [] + const balances = json.b ?? []; switch (json.k) { // message kind case 'i': { // initial const fullOrders = json.o - ? json.o.reduce((prev, o) => { + ? json.o.reduce[]>((prev, o) => { prev.push(o); return prev; @@ -468,7 +468,7 @@ class OrionAggregatorWS { this.subscriptions[ SubscriptionType.CFD_ADDRESS_UPDATES_SUBSCRIBE - ]?.[json.id]?.callback({ + ]?.[json.id]?.callback({ kind: 'initial', orders: fullOrders, balances, @@ -476,7 +476,7 @@ class OrionAggregatorWS { } break; case 'u': { // update - let orderUpdate: OrderUpdate | FullOrder | undefined; + let orderUpdate: z.infer | z.infer | undefined; if (json.o) { const firstOrder = json.o[0]; orderUpdate = firstOrder; @@ -484,7 +484,7 @@ class OrionAggregatorWS { this.subscriptions[ SubscriptionType.CFD_ADDRESS_UPDATES_SUBSCRIBE - ]?.[json.id]?.callback({ + ]?.[json.id]?.callback({ kind: 'update', order: orderUpdate, balances,