mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-17 00:31:34 +03:00
Merge conflicts fix
package.json version was updated to 0.16.0-rc.12
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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<typeof orderUpdateSchema> | z.infer<typeof fullOrderSchema>
|
||||
}
|
||||
|
||||
type CfdAddressUpdateInitial = {
|
||||
kind: 'initial',
|
||||
balances: CFDBalance[],
|
||||
orders?: FullOrder[] // The field is not defined if the user has no orders
|
||||
orders?: z.infer<typeof fullOrderSchema>[] // 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<FullOrder[]>((prev, o) => {
|
||||
? json.o.reduce<z.infer<typeof fullOrderSchema>[]>((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<typeof orderUpdateSchema> | z.infer<typeof fullOrderSchema> | 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,
|
||||
|
||||
Reference in New Issue
Block a user