@pear-protocol/core-sdk 1.0.0 → 1.2.0
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/core/index.d.ts +384 -13
- package/dist/core/index.js +30 -0
- package/package.json +2 -2
package/dist/core/index.d.ts
CHANGED
|
@@ -317,6 +317,36 @@ declare class Core {
|
|
|
317
317
|
error?: string | undefined;
|
|
318
318
|
filledPrice?: string | undefined;
|
|
319
319
|
}[] | undefined;
|
|
320
|
+
} | {
|
|
321
|
+
id: string;
|
|
322
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
323
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
324
|
+
createdAt: string;
|
|
325
|
+
updatedAt: string;
|
|
326
|
+
intent: "REVERSE";
|
|
327
|
+
orderType: "MARKET";
|
|
328
|
+
position: {
|
|
329
|
+
id: string;
|
|
330
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
331
|
+
};
|
|
332
|
+
error?: string | undefined;
|
|
333
|
+
orders?: {
|
|
334
|
+
id: string;
|
|
335
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
336
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
337
|
+
createdAt: string;
|
|
338
|
+
updatedAt: string;
|
|
339
|
+
type: "MARKET";
|
|
340
|
+
symbol: string;
|
|
341
|
+
side: "BUY" | "SELL";
|
|
342
|
+
reduceOnly: boolean;
|
|
343
|
+
leverage: number;
|
|
344
|
+
quantity: string;
|
|
345
|
+
price: string;
|
|
346
|
+
filledQuantity: string;
|
|
347
|
+
error?: string | undefined;
|
|
348
|
+
filledPrice?: string | undefined;
|
|
349
|
+
}[] | undefined;
|
|
320
350
|
})[];
|
|
321
351
|
}>;
|
|
322
352
|
};
|
|
@@ -477,6 +507,43 @@ declare class Core {
|
|
|
477
507
|
}[];
|
|
478
508
|
}>;
|
|
479
509
|
};
|
|
510
|
+
notifications: {
|
|
511
|
+
list: (query?: HttpTypes.NotificationListParamsInput, headers?: ClientHeaders) => Promise<{
|
|
512
|
+
notifications: {
|
|
513
|
+
id: string;
|
|
514
|
+
category: "TAKE_PROFIT_HIT" | "STOP_LOSS_HIT" | "TRIGGER_ORDER_HIT";
|
|
515
|
+
parameters: {
|
|
516
|
+
type: "take_profit";
|
|
517
|
+
triggerId: string;
|
|
518
|
+
positionId: string;
|
|
519
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
520
|
+
} | {
|
|
521
|
+
type: "stop_loss";
|
|
522
|
+
triggerId: string;
|
|
523
|
+
positionId: string;
|
|
524
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
525
|
+
} | {
|
|
526
|
+
type: "trigger_order";
|
|
527
|
+
triggerId: string;
|
|
528
|
+
positionId: string;
|
|
529
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
530
|
+
} | {
|
|
531
|
+
type: "default_trigger";
|
|
532
|
+
triggerId: string;
|
|
533
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
534
|
+
};
|
|
535
|
+
isRead: boolean;
|
|
536
|
+
createdAt: string;
|
|
537
|
+
updatedAt: string;
|
|
538
|
+
}[];
|
|
539
|
+
}>;
|
|
540
|
+
markRead: (body: HttpTypes.MarkNotificationsReadPayloadInput, headers?: ClientHeaders) => Promise<{
|
|
541
|
+
updated: number;
|
|
542
|
+
}>;
|
|
543
|
+
markUnread: (body: HttpTypes.MarkNotificationUnreadPayloadInput, headers?: ClientHeaders) => Promise<{
|
|
544
|
+
updated: number;
|
|
545
|
+
}>;
|
|
546
|
+
};
|
|
480
547
|
oracle: {
|
|
481
548
|
btcdom: (headers?: ClientHeaders) => Promise<{
|
|
482
549
|
id: string;
|
|
@@ -727,7 +794,7 @@ declare class Core {
|
|
|
727
794
|
remainingNotional: string;
|
|
728
795
|
lastSliceAt?: string | undefined;
|
|
729
796
|
cancelledAt?: string | undefined;
|
|
730
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
797
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
731
798
|
fills?: {
|
|
732
799
|
id: string;
|
|
733
800
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -772,7 +839,7 @@ declare class Core {
|
|
|
772
839
|
initialExposure: Record<string, `-${string}` | `+${string}`>;
|
|
773
840
|
lastSliceAt?: string | undefined;
|
|
774
841
|
cancelledAt?: string | undefined;
|
|
775
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
842
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
776
843
|
fills?: {
|
|
777
844
|
id: string;
|
|
778
845
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -822,7 +889,7 @@ declare class Core {
|
|
|
822
889
|
remainingNotional: string;
|
|
823
890
|
lastSliceAt?: string | undefined;
|
|
824
891
|
cancelledAt?: string | undefined;
|
|
825
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
892
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
826
893
|
fills?: {
|
|
827
894
|
id: string;
|
|
828
895
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -867,7 +934,7 @@ declare class Core {
|
|
|
867
934
|
initialExposure: Record<string, `-${string}` | `+${string}`>;
|
|
868
935
|
lastSliceAt?: string | undefined;
|
|
869
936
|
cancelledAt?: string | undefined;
|
|
870
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
937
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
871
938
|
fills?: {
|
|
872
939
|
id: string;
|
|
873
940
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -1025,6 +1092,36 @@ declare class Core {
|
|
|
1025
1092
|
error?: string | undefined;
|
|
1026
1093
|
filledPrice?: string | undefined;
|
|
1027
1094
|
}[] | undefined;
|
|
1095
|
+
} | {
|
|
1096
|
+
id: string;
|
|
1097
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1098
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1099
|
+
createdAt: string;
|
|
1100
|
+
updatedAt: string;
|
|
1101
|
+
intent: "REVERSE";
|
|
1102
|
+
orderType: "MARKET";
|
|
1103
|
+
position: {
|
|
1104
|
+
id: string;
|
|
1105
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1106
|
+
};
|
|
1107
|
+
error?: string | undefined;
|
|
1108
|
+
orders?: {
|
|
1109
|
+
id: string;
|
|
1110
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1111
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1112
|
+
createdAt: string;
|
|
1113
|
+
updatedAt: string;
|
|
1114
|
+
type: "MARKET";
|
|
1115
|
+
symbol: string;
|
|
1116
|
+
side: "BUY" | "SELL";
|
|
1117
|
+
reduceOnly: boolean;
|
|
1118
|
+
leverage: number;
|
|
1119
|
+
quantity: string;
|
|
1120
|
+
price: string;
|
|
1121
|
+
filledQuantity: string;
|
|
1122
|
+
error?: string | undefined;
|
|
1123
|
+
filledPrice?: string | undefined;
|
|
1124
|
+
}[] | undefined;
|
|
1028
1125
|
};
|
|
1029
1126
|
}>;
|
|
1030
1127
|
adjust: (positionId: string, body: HttpTypes.CreateTradeAdjust, headers?: ClientHeaders) => Promise<{
|
|
@@ -1140,6 +1237,36 @@ declare class Core {
|
|
|
1140
1237
|
error?: string | undefined;
|
|
1141
1238
|
filledPrice?: string | undefined;
|
|
1142
1239
|
}[] | undefined;
|
|
1240
|
+
} | {
|
|
1241
|
+
id: string;
|
|
1242
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1243
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1244
|
+
createdAt: string;
|
|
1245
|
+
updatedAt: string;
|
|
1246
|
+
intent: "REVERSE";
|
|
1247
|
+
orderType: "MARKET";
|
|
1248
|
+
position: {
|
|
1249
|
+
id: string;
|
|
1250
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1251
|
+
};
|
|
1252
|
+
error?: string | undefined;
|
|
1253
|
+
orders?: {
|
|
1254
|
+
id: string;
|
|
1255
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1256
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1257
|
+
createdAt: string;
|
|
1258
|
+
updatedAt: string;
|
|
1259
|
+
type: "MARKET";
|
|
1260
|
+
symbol: string;
|
|
1261
|
+
side: "BUY" | "SELL";
|
|
1262
|
+
reduceOnly: boolean;
|
|
1263
|
+
leverage: number;
|
|
1264
|
+
quantity: string;
|
|
1265
|
+
price: string;
|
|
1266
|
+
filledQuantity: string;
|
|
1267
|
+
error?: string | undefined;
|
|
1268
|
+
filledPrice?: string | undefined;
|
|
1269
|
+
}[] | undefined;
|
|
1143
1270
|
};
|
|
1144
1271
|
}>;
|
|
1145
1272
|
close: (positionId: string, body: HttpTypes.CreateTradeClose, headers?: ClientHeaders) => Promise<{
|
|
@@ -1255,6 +1382,181 @@ declare class Core {
|
|
|
1255
1382
|
error?: string | undefined;
|
|
1256
1383
|
filledPrice?: string | undefined;
|
|
1257
1384
|
}[] | undefined;
|
|
1385
|
+
} | {
|
|
1386
|
+
id: string;
|
|
1387
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1388
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1389
|
+
createdAt: string;
|
|
1390
|
+
updatedAt: string;
|
|
1391
|
+
intent: "REVERSE";
|
|
1392
|
+
orderType: "MARKET";
|
|
1393
|
+
position: {
|
|
1394
|
+
id: string;
|
|
1395
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1396
|
+
};
|
|
1397
|
+
error?: string | undefined;
|
|
1398
|
+
orders?: {
|
|
1399
|
+
id: string;
|
|
1400
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1401
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1402
|
+
createdAt: string;
|
|
1403
|
+
updatedAt: string;
|
|
1404
|
+
type: "MARKET";
|
|
1405
|
+
symbol: string;
|
|
1406
|
+
side: "BUY" | "SELL";
|
|
1407
|
+
reduceOnly: boolean;
|
|
1408
|
+
leverage: number;
|
|
1409
|
+
quantity: string;
|
|
1410
|
+
price: string;
|
|
1411
|
+
filledQuantity: string;
|
|
1412
|
+
error?: string | undefined;
|
|
1413
|
+
filledPrice?: string | undefined;
|
|
1414
|
+
}[] | undefined;
|
|
1415
|
+
};
|
|
1416
|
+
}>;
|
|
1417
|
+
reverse: (positionId: string, body: HttpTypes.CreateTradeReverse, headers?: ClientHeaders) => Promise<{
|
|
1418
|
+
execution: {
|
|
1419
|
+
id: string;
|
|
1420
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1421
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1422
|
+
createdAt: string;
|
|
1423
|
+
updatedAt: string;
|
|
1424
|
+
intent: "OPEN";
|
|
1425
|
+
orderType: "MARKET";
|
|
1426
|
+
legs: [{
|
|
1427
|
+
symbol: string;
|
|
1428
|
+
side: "BUY" | "SELL";
|
|
1429
|
+
mode: "QUANTITY" | "USD";
|
|
1430
|
+
amount: string;
|
|
1431
|
+
reduceOnly: boolean;
|
|
1432
|
+
}, ...{
|
|
1433
|
+
symbol: string;
|
|
1434
|
+
side: "BUY" | "SELL";
|
|
1435
|
+
mode: "QUANTITY" | "USD";
|
|
1436
|
+
amount: string;
|
|
1437
|
+
reduceOnly: boolean;
|
|
1438
|
+
}[]];
|
|
1439
|
+
error?: string | undefined;
|
|
1440
|
+
orders?: {
|
|
1441
|
+
id: string;
|
|
1442
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1443
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1444
|
+
createdAt: string;
|
|
1445
|
+
updatedAt: string;
|
|
1446
|
+
type: "MARKET";
|
|
1447
|
+
symbol: string;
|
|
1448
|
+
side: "BUY" | "SELL";
|
|
1449
|
+
reduceOnly: boolean;
|
|
1450
|
+
leverage: number;
|
|
1451
|
+
quantity: string;
|
|
1452
|
+
price: string;
|
|
1453
|
+
filledQuantity: string;
|
|
1454
|
+
error?: string | undefined;
|
|
1455
|
+
filledPrice?: string | undefined;
|
|
1456
|
+
}[] | undefined;
|
|
1457
|
+
} | {
|
|
1458
|
+
id: string;
|
|
1459
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1460
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1461
|
+
createdAt: string;
|
|
1462
|
+
updatedAt: string;
|
|
1463
|
+
intent: "ADJUST";
|
|
1464
|
+
orderType: "MARKET";
|
|
1465
|
+
position: {
|
|
1466
|
+
id: string;
|
|
1467
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1468
|
+
};
|
|
1469
|
+
legs: [{
|
|
1470
|
+
symbol: string;
|
|
1471
|
+
side: "BUY" | "SELL";
|
|
1472
|
+
mode: "QUANTITY" | "USD";
|
|
1473
|
+
amount: string;
|
|
1474
|
+
reduceOnly: boolean;
|
|
1475
|
+
}, ...{
|
|
1476
|
+
symbol: string;
|
|
1477
|
+
side: "BUY" | "SELL";
|
|
1478
|
+
mode: "QUANTITY" | "USD";
|
|
1479
|
+
amount: string;
|
|
1480
|
+
reduceOnly: boolean;
|
|
1481
|
+
}[]];
|
|
1482
|
+
error?: string | undefined;
|
|
1483
|
+
orders?: {
|
|
1484
|
+
id: string;
|
|
1485
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1486
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1487
|
+
createdAt: string;
|
|
1488
|
+
updatedAt: string;
|
|
1489
|
+
type: "MARKET";
|
|
1490
|
+
symbol: string;
|
|
1491
|
+
side: "BUY" | "SELL";
|
|
1492
|
+
reduceOnly: boolean;
|
|
1493
|
+
leverage: number;
|
|
1494
|
+
quantity: string;
|
|
1495
|
+
price: string;
|
|
1496
|
+
filledQuantity: string;
|
|
1497
|
+
error?: string | undefined;
|
|
1498
|
+
filledPrice?: string | undefined;
|
|
1499
|
+
}[] | undefined;
|
|
1500
|
+
} | {
|
|
1501
|
+
id: string;
|
|
1502
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1503
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1504
|
+
createdAt: string;
|
|
1505
|
+
updatedAt: string;
|
|
1506
|
+
intent: "CLOSE";
|
|
1507
|
+
orderType: "MARKET";
|
|
1508
|
+
position: {
|
|
1509
|
+
id: string;
|
|
1510
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1511
|
+
};
|
|
1512
|
+
error?: string | undefined;
|
|
1513
|
+
orders?: {
|
|
1514
|
+
id: string;
|
|
1515
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1516
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1517
|
+
createdAt: string;
|
|
1518
|
+
updatedAt: string;
|
|
1519
|
+
type: "MARKET";
|
|
1520
|
+
symbol: string;
|
|
1521
|
+
side: "BUY" | "SELL";
|
|
1522
|
+
reduceOnly: boolean;
|
|
1523
|
+
leverage: number;
|
|
1524
|
+
quantity: string;
|
|
1525
|
+
price: string;
|
|
1526
|
+
filledQuantity: string;
|
|
1527
|
+
error?: string | undefined;
|
|
1528
|
+
filledPrice?: string | undefined;
|
|
1529
|
+
}[] | undefined;
|
|
1530
|
+
} | {
|
|
1531
|
+
id: string;
|
|
1532
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1533
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1534
|
+
createdAt: string;
|
|
1535
|
+
updatedAt: string;
|
|
1536
|
+
intent: "REVERSE";
|
|
1537
|
+
orderType: "MARKET";
|
|
1538
|
+
position: {
|
|
1539
|
+
id: string;
|
|
1540
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1541
|
+
};
|
|
1542
|
+
error?: string | undefined;
|
|
1543
|
+
orders?: {
|
|
1544
|
+
id: string;
|
|
1545
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1546
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1547
|
+
createdAt: string;
|
|
1548
|
+
updatedAt: string;
|
|
1549
|
+
type: "MARKET";
|
|
1550
|
+
symbol: string;
|
|
1551
|
+
side: "BUY" | "SELL";
|
|
1552
|
+
reduceOnly: boolean;
|
|
1553
|
+
leverage: number;
|
|
1554
|
+
quantity: string;
|
|
1555
|
+
price: string;
|
|
1556
|
+
filledQuantity: string;
|
|
1557
|
+
error?: string | undefined;
|
|
1558
|
+
filledPrice?: string | undefined;
|
|
1559
|
+
}[] | undefined;
|
|
1258
1560
|
};
|
|
1259
1561
|
}>;
|
|
1260
1562
|
closeAll: (body: HttpTypes.CreateTradeCloseAll, headers?: ClientHeaders) => Promise<{
|
|
@@ -1370,6 +1672,36 @@ declare class Core {
|
|
|
1370
1672
|
error?: string | undefined;
|
|
1371
1673
|
filledPrice?: string | undefined;
|
|
1372
1674
|
}[] | undefined;
|
|
1675
|
+
} | {
|
|
1676
|
+
id: string;
|
|
1677
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1678
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1679
|
+
createdAt: string;
|
|
1680
|
+
updatedAt: string;
|
|
1681
|
+
intent: "REVERSE";
|
|
1682
|
+
orderType: "MARKET";
|
|
1683
|
+
position: {
|
|
1684
|
+
id: string;
|
|
1685
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1686
|
+
};
|
|
1687
|
+
error?: string | undefined;
|
|
1688
|
+
orders?: {
|
|
1689
|
+
id: string;
|
|
1690
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1691
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1692
|
+
createdAt: string;
|
|
1693
|
+
updatedAt: string;
|
|
1694
|
+
type: "MARKET";
|
|
1695
|
+
symbol: string;
|
|
1696
|
+
side: "BUY" | "SELL";
|
|
1697
|
+
reduceOnly: boolean;
|
|
1698
|
+
leverage: number;
|
|
1699
|
+
quantity: string;
|
|
1700
|
+
price: string;
|
|
1701
|
+
filledQuantity: string;
|
|
1702
|
+
error?: string | undefined;
|
|
1703
|
+
filledPrice?: string | undefined;
|
|
1704
|
+
}[] | undefined;
|
|
1373
1705
|
})[];
|
|
1374
1706
|
}>;
|
|
1375
1707
|
setLeverage: (body: HttpTypes.SetLeverage, headers?: ClientHeaders) => Promise<Record<string, never>>;
|
|
@@ -1454,10 +1786,14 @@ declare class Core {
|
|
|
1454
1786
|
mode: "QUANTITY" | "USD";
|
|
1455
1787
|
amount: string;
|
|
1456
1788
|
}[]];
|
|
1789
|
+
attachedTriggers: {
|
|
1790
|
+
kind: "STATIC" | "TRAILING";
|
|
1791
|
+
bracketType: "STOP_LOSS" | "TAKE_PROFIT";
|
|
1792
|
+
}[];
|
|
1457
1793
|
};
|
|
1458
1794
|
triggeredAt?: string | undefined;
|
|
1459
1795
|
cancelledAt?: string | undefined;
|
|
1460
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
1796
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
1461
1797
|
fills?: {
|
|
1462
1798
|
id: string;
|
|
1463
1799
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -1587,7 +1923,7 @@ declare class Core {
|
|
|
1587
1923
|
};
|
|
1588
1924
|
triggeredAt?: string | undefined;
|
|
1589
1925
|
cancelledAt?: string | undefined;
|
|
1590
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
1926
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
1591
1927
|
fills?: {
|
|
1592
1928
|
id: string;
|
|
1593
1929
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -1750,7 +2086,7 @@ declare class Core {
|
|
|
1750
2086
|
};
|
|
1751
2087
|
triggeredAt?: string | undefined;
|
|
1752
2088
|
cancelledAt?: string | undefined;
|
|
1753
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2089
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
1754
2090
|
fills?: {
|
|
1755
2091
|
id: string;
|
|
1756
2092
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -1861,10 +2197,14 @@ declare class Core {
|
|
|
1861
2197
|
mode: "QUANTITY" | "USD";
|
|
1862
2198
|
amount: string;
|
|
1863
2199
|
}[]];
|
|
2200
|
+
attachedTriggers: {
|
|
2201
|
+
kind: "STATIC" | "TRAILING";
|
|
2202
|
+
bracketType: "STOP_LOSS" | "TAKE_PROFIT";
|
|
2203
|
+
}[];
|
|
1864
2204
|
};
|
|
1865
2205
|
triggeredAt?: string | undefined;
|
|
1866
2206
|
cancelledAt?: string | undefined;
|
|
1867
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2207
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
1868
2208
|
fills?: {
|
|
1869
2209
|
id: string;
|
|
1870
2210
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -1994,7 +2334,7 @@ declare class Core {
|
|
|
1994
2334
|
};
|
|
1995
2335
|
triggeredAt?: string | undefined;
|
|
1996
2336
|
cancelledAt?: string | undefined;
|
|
1997
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2337
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
1998
2338
|
fills?: {
|
|
1999
2339
|
id: string;
|
|
2000
2340
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -2157,7 +2497,7 @@ declare class Core {
|
|
|
2157
2497
|
};
|
|
2158
2498
|
triggeredAt?: string | undefined;
|
|
2159
2499
|
cancelledAt?: string | undefined;
|
|
2160
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2500
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
2161
2501
|
fills?: {
|
|
2162
2502
|
id: string;
|
|
2163
2503
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -2268,10 +2608,14 @@ declare class Core {
|
|
|
2268
2608
|
mode: "QUANTITY" | "USD";
|
|
2269
2609
|
amount: string;
|
|
2270
2610
|
}[]];
|
|
2611
|
+
attachedTriggers: {
|
|
2612
|
+
kind: "STATIC" | "TRAILING";
|
|
2613
|
+
bracketType: "STOP_LOSS" | "TAKE_PROFIT";
|
|
2614
|
+
}[];
|
|
2271
2615
|
};
|
|
2272
2616
|
triggeredAt?: string | undefined;
|
|
2273
2617
|
cancelledAt?: string | undefined;
|
|
2274
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2618
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
2275
2619
|
fills?: {
|
|
2276
2620
|
id: string;
|
|
2277
2621
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -2401,7 +2745,7 @@ declare class Core {
|
|
|
2401
2745
|
};
|
|
2402
2746
|
triggeredAt?: string | undefined;
|
|
2403
2747
|
cancelledAt?: string | undefined;
|
|
2404
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2748
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
2405
2749
|
fills?: {
|
|
2406
2750
|
id: string;
|
|
2407
2751
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -2564,7 +2908,7 @@ declare class Core {
|
|
|
2564
2908
|
};
|
|
2565
2909
|
triggeredAt?: string | undefined;
|
|
2566
2910
|
cancelledAt?: string | undefined;
|
|
2567
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2911
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
2568
2912
|
fills?: {
|
|
2569
2913
|
id: string;
|
|
2570
2914
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -2736,6 +3080,19 @@ declare class Core {
|
|
|
2736
3080
|
status: "FINAL";
|
|
2737
3081
|
createdAt: string;
|
|
2738
3082
|
updatedAt: string;
|
|
3083
|
+
executionContext?: {
|
|
3084
|
+
intent: "OPEN" | "CLOSE" | "ADJUST" | "REVERSE";
|
|
3085
|
+
orderType: "MARKET";
|
|
3086
|
+
executionStatus: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
3087
|
+
legs: {
|
|
3088
|
+
symbol: string;
|
|
3089
|
+
side: "BUY" | "SELL";
|
|
3090
|
+
reduceOnly: boolean;
|
|
3091
|
+
}[];
|
|
3092
|
+
positionId?: string | undefined;
|
|
3093
|
+
scheduleId?: string | undefined;
|
|
3094
|
+
triggerId?: string | undefined;
|
|
3095
|
+
} | undefined;
|
|
2739
3096
|
notionalQuote?: string | undefined;
|
|
2740
3097
|
notionalUsd?: string | undefined;
|
|
2741
3098
|
weightedSlippageBps?: string | undefined;
|
|
@@ -2814,6 +3171,19 @@ declare class Core {
|
|
|
2814
3171
|
status: "FINAL";
|
|
2815
3172
|
createdAt: string;
|
|
2816
3173
|
updatedAt: string;
|
|
3174
|
+
executionContext?: {
|
|
3175
|
+
intent: "OPEN" | "CLOSE" | "ADJUST" | "REVERSE";
|
|
3176
|
+
orderType: "MARKET";
|
|
3177
|
+
executionStatus: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
3178
|
+
legs: {
|
|
3179
|
+
symbol: string;
|
|
3180
|
+
side: "BUY" | "SELL";
|
|
3181
|
+
reduceOnly: boolean;
|
|
3182
|
+
}[];
|
|
3183
|
+
positionId?: string | undefined;
|
|
3184
|
+
scheduleId?: string | undefined;
|
|
3185
|
+
triggerId?: string | undefined;
|
|
3186
|
+
} | undefined;
|
|
2817
3187
|
notionalQuote?: string | undefined;
|
|
2818
3188
|
notionalUsd?: string | undefined;
|
|
2819
3189
|
weightedSlippageBps?: string | undefined;
|
|
@@ -2827,6 +3197,7 @@ declare class Core {
|
|
|
2827
3197
|
fillCount: number;
|
|
2828
3198
|
notionalQuote?: string | undefined;
|
|
2829
3199
|
notionalUsd?: string | undefined;
|
|
3200
|
+
weightedSlippageBps?: string | undefined;
|
|
2830
3201
|
totalSlippageUsd?: string | undefined;
|
|
2831
3202
|
totalTradeFee?: string | undefined;
|
|
2832
3203
|
totalPearFee?: string | undefined;
|
package/dist/core/index.js
CHANGED
|
@@ -145,6 +145,29 @@ class Core {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
+
notifications = {
|
|
149
|
+
list: async (query, headers) => {
|
|
150
|
+
return await this.client.fetch(`/notifications`, {
|
|
151
|
+
method: "GET",
|
|
152
|
+
headers,
|
|
153
|
+
query
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
markRead: async (body, headers) => {
|
|
157
|
+
return await this.client.fetch(`/notifications/read`, {
|
|
158
|
+
method: "POST",
|
|
159
|
+
headers,
|
|
160
|
+
body
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
markUnread: async (body, headers) => {
|
|
164
|
+
return await this.client.fetch(`/notifications/unread`, {
|
|
165
|
+
method: "POST",
|
|
166
|
+
headers,
|
|
167
|
+
body
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
};
|
|
148
171
|
oracle = {
|
|
149
172
|
btcdom: async (headers) => {
|
|
150
173
|
return await this.client.fetch(`/oracle/btcdom`, {
|
|
@@ -282,6 +305,13 @@ class Core {
|
|
|
282
305
|
body: this.withClientId(body)
|
|
283
306
|
});
|
|
284
307
|
},
|
|
308
|
+
reverse: async (positionId, body, headers) => {
|
|
309
|
+
return await this.client.fetch(`/trade/${positionId}/reverse`, {
|
|
310
|
+
method: "POST",
|
|
311
|
+
headers,
|
|
312
|
+
body
|
|
313
|
+
});
|
|
314
|
+
},
|
|
285
315
|
closeAll: async (body, headers) => {
|
|
286
316
|
return await this.client.fetch(`/trade/close-all`, {
|
|
287
317
|
method: "POST",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pear-protocol/core-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Pear Protocol Core SDK",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"typecheck": "tsc --noEmit"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@pear-protocol/types": "^1.
|
|
28
|
+
"@pear-protocol/types": "^1.3.0",
|
|
29
29
|
"@pear-protocol/utils": "^0.0.23",
|
|
30
30
|
"qs": "^6.14.0"
|
|
31
31
|
},
|