@deriverse/kit 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +34 -14
- package/dist/logs_models.d.ts +3 -1
- package/dist/logs_models.js +5 -2
- package/dist/types.d.ts +2 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -181,7 +181,7 @@ function getMultipleSpotOrders(data, firstEntry, clientId) {
|
|
|
181
181
|
while (entry != nullOrder) {
|
|
182
182
|
const offset = entry * 64 + structure_models_1.SpotTradeAccountHeaderModel.LENGTH;
|
|
183
183
|
const order = structure_models_1.OrderModel.fromBuffer(data, offset);
|
|
184
|
-
if (order.
|
|
184
|
+
if (order.origClientId != clientId) {
|
|
185
185
|
break;
|
|
186
186
|
}
|
|
187
187
|
orders.push(order);
|
|
@@ -195,7 +195,7 @@ function getMultiplePerpOrders(data, firstEntry, clientId) {
|
|
|
195
195
|
while (entry != nullOrder) {
|
|
196
196
|
const offset = entry * 64 + structure_models_1.PerpTradeAccountHeaderModel.LENGTH;
|
|
197
197
|
const order = structure_models_1.OrderModel.fromBuffer(data, offset);
|
|
198
|
-
if (order.
|
|
198
|
+
if (order.origClientId != clientId) {
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
orders.push(order);
|
|
@@ -1422,8 +1422,7 @@ class Engine {
|
|
|
1422
1422
|
asks[i].sum /= crncyTokenDec;
|
|
1423
1423
|
}
|
|
1424
1424
|
return {
|
|
1425
|
-
|
|
1426
|
-
askContextSlot: Number(infos.context.slot),
|
|
1425
|
+
contextSlot: Number(infos.context.slot),
|
|
1427
1426
|
bids: bids,
|
|
1428
1427
|
asks: asks
|
|
1429
1428
|
};
|
|
@@ -1450,7 +1449,7 @@ class Engine {
|
|
|
1450
1449
|
}
|
|
1451
1450
|
}).send();
|
|
1452
1451
|
const order = structure_models_1.OrderModel.fromBuffer(info.value.data);
|
|
1453
|
-
if (order.
|
|
1452
|
+
if (order.origClientId == this.originalClientId) {
|
|
1454
1453
|
bids = [order];
|
|
1455
1454
|
}
|
|
1456
1455
|
bidContextSlot = Number(info.context.slot);
|
|
@@ -1473,7 +1472,7 @@ class Engine {
|
|
|
1473
1472
|
}
|
|
1474
1473
|
}).send();
|
|
1475
1474
|
const order = structure_models_1.OrderModel.fromBuffer(info.value.data);
|
|
1476
|
-
if (order.
|
|
1475
|
+
if (order.origClientId == this.originalClientId) {
|
|
1477
1476
|
asks = [order];
|
|
1478
1477
|
}
|
|
1479
1478
|
askContextSlot = Number(info.context.slot);
|
|
@@ -1486,9 +1485,20 @@ class Engine {
|
|
|
1486
1485
|
asks[i].qty /= assetTokenDec;
|
|
1487
1486
|
asks[i].sum /= crncyTokenDec;
|
|
1488
1487
|
}
|
|
1488
|
+
let contextSlot = 0;
|
|
1489
|
+
if (bidContextSlot > 0 || askContextSlot > 0) {
|
|
1490
|
+
if (bidContextSlot == 0) {
|
|
1491
|
+
contextSlot = askContextSlot;
|
|
1492
|
+
}
|
|
1493
|
+
else if (askContextSlot == 0) {
|
|
1494
|
+
contextSlot = bidContextSlot;
|
|
1495
|
+
}
|
|
1496
|
+
else {
|
|
1497
|
+
contextSlot = Math.min(bidContextSlot, askContextSlot);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1489
1500
|
return {
|
|
1490
|
-
|
|
1491
|
-
askContextSlot: askContextSlot,
|
|
1501
|
+
contextSlot: contextSlot,
|
|
1492
1502
|
bids: bids,
|
|
1493
1503
|
asks: asks
|
|
1494
1504
|
};
|
|
@@ -1527,8 +1537,7 @@ class Engine {
|
|
|
1527
1537
|
asks[i].sum /= crncyTokenDec;
|
|
1528
1538
|
}
|
|
1529
1539
|
return {
|
|
1530
|
-
|
|
1531
|
-
askContextSlot: Number(infos.context.slot),
|
|
1540
|
+
contextSlot: Number(infos.context.slot),
|
|
1532
1541
|
bids: bids,
|
|
1533
1542
|
asks: asks
|
|
1534
1543
|
};
|
|
@@ -1552,7 +1561,7 @@ class Engine {
|
|
|
1552
1561
|
}
|
|
1553
1562
|
}).send();
|
|
1554
1563
|
const order = structure_models_1.OrderModel.fromBuffer(info.value.data);
|
|
1555
|
-
if (order.
|
|
1564
|
+
if (order.origClientId == this.originalClientId) {
|
|
1556
1565
|
bids = [order];
|
|
1557
1566
|
}
|
|
1558
1567
|
bidContextSlot = Number(info.context.slot);
|
|
@@ -1572,7 +1581,7 @@ class Engine {
|
|
|
1572
1581
|
}
|
|
1573
1582
|
}).send();
|
|
1574
1583
|
const order = structure_models_1.OrderModel.fromBuffer(info.value.data);
|
|
1575
|
-
if (order.
|
|
1584
|
+
if (order.origClientId == this.originalClientId) {
|
|
1576
1585
|
asks = [order];
|
|
1577
1586
|
}
|
|
1578
1587
|
askContextSlot = Number(info.context.slot);
|
|
@@ -1585,9 +1594,20 @@ class Engine {
|
|
|
1585
1594
|
asks[i].qty /= assetTokenDec;
|
|
1586
1595
|
asks[i].sum /= crncyTokenDec;
|
|
1587
1596
|
}
|
|
1597
|
+
let contextSlot = 0;
|
|
1598
|
+
if (bidContextSlot > 0 || askContextSlot > 0) {
|
|
1599
|
+
if (bidContextSlot == 0) {
|
|
1600
|
+
contextSlot = askContextSlot;
|
|
1601
|
+
}
|
|
1602
|
+
else if (askContextSlot == 0) {
|
|
1603
|
+
contextSlot = bidContextSlot;
|
|
1604
|
+
}
|
|
1605
|
+
else {
|
|
1606
|
+
contextSlot = Math.min(bidContextSlot, askContextSlot);
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1588
1609
|
return {
|
|
1589
|
-
|
|
1590
|
-
askContextSlot: askContextSlot,
|
|
1610
|
+
contextSlot: contextSlot,
|
|
1591
1611
|
bids: bids,
|
|
1592
1612
|
asks: asks
|
|
1593
1613
|
};
|
package/dist/logs_models.d.ts
CHANGED
|
@@ -346,9 +346,11 @@ export declare class PerpFundingReportModel {
|
|
|
346
346
|
static readonly LENGTH: number;
|
|
347
347
|
static readonly OFFSET_TAG = 0;
|
|
348
348
|
static readonly OFFSET_CLIENT_ID = 4;
|
|
349
|
-
static readonly
|
|
349
|
+
static readonly OFFSET_TIME = 8;
|
|
350
|
+
static readonly OFFSET_FUNDING = 16;
|
|
350
351
|
tag: number;
|
|
351
352
|
clientId: number;
|
|
353
|
+
time: number;
|
|
352
354
|
funding: number;
|
|
353
355
|
static fromBuffer(buffer: Buffer, offset?: number): PerpFundingReportModel;
|
|
354
356
|
}
|
package/dist/logs_models.js
CHANGED
|
@@ -487,15 +487,18 @@ class PerpFundingReportModel {
|
|
|
487
487
|
autoBuffer.readU8();
|
|
488
488
|
autoBuffer.readU16();
|
|
489
489
|
result.clientId = autoBuffer.readU32();
|
|
490
|
+
result.time = autoBuffer.readU32();
|
|
491
|
+
autoBuffer.readU32();
|
|
490
492
|
result.funding = autoBuffer.readI64();
|
|
491
493
|
return result;
|
|
492
494
|
}
|
|
493
495
|
}
|
|
494
496
|
exports.PerpFundingReportModel = PerpFundingReportModel;
|
|
495
|
-
PerpFundingReportModel.LENGTH = 2 * 1 + 1 * 2 +
|
|
497
|
+
PerpFundingReportModel.LENGTH = 2 * 1 + 1 * 2 + 3 * 4 + 1 * 8; // 24 bytes
|
|
496
498
|
PerpFundingReportModel.OFFSET_TAG = 0;
|
|
497
499
|
PerpFundingReportModel.OFFSET_CLIENT_ID = 4;
|
|
498
|
-
PerpFundingReportModel.
|
|
500
|
+
PerpFundingReportModel.OFFSET_TIME = 8;
|
|
501
|
+
PerpFundingReportModel.OFFSET_FUNDING = 16;
|
|
499
502
|
class PerpSocLossReportModel {
|
|
500
503
|
static fromBuffer(buffer, offset) {
|
|
501
504
|
const result = new PerpSocLossReportModel();
|
package/dist/types.d.ts
CHANGED
|
@@ -310,8 +310,7 @@ export interface GetClientPerpOrdersArgs {
|
|
|
310
310
|
* @property {OrderModel[]} asks List of client ask spot orders
|
|
311
311
|
*/
|
|
312
312
|
export interface GetClientSpotOrdersResponse {
|
|
313
|
-
|
|
314
|
-
askContextSlot: number;
|
|
313
|
+
contextSlot: number;
|
|
315
314
|
bids: OrderModel[];
|
|
316
315
|
asks: OrderModel[];
|
|
317
316
|
}
|
|
@@ -322,8 +321,7 @@ export interface GetClientSpotOrdersResponse {
|
|
|
322
321
|
* @property {OrderModel[]} asks List of client ask perp orders
|
|
323
322
|
*/
|
|
324
323
|
export interface GetClientPerpOrdersResponse {
|
|
325
|
-
|
|
326
|
-
askContextSlot: number;
|
|
324
|
+
contextSlot: number;
|
|
327
325
|
bids: Array<OrderModel>;
|
|
328
326
|
asks: Array<OrderModel>;
|
|
329
327
|
}
|