@drift-labs/sdk 0.2.0-master.1 → 0.2.0-master.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/lib/accounts/types.d.ts +1 -0
- package/lib/admin.d.ts +6 -3
- package/lib/admin.js +39 -7
- package/lib/clearingHouse.d.ts +13 -14
- package/lib/clearingHouse.js +166 -106
- package/lib/config.js +1 -1
- package/lib/constants/banks.js +8 -1
- package/lib/constants/numericConstants.d.ts +1 -0
- package/lib/constants/numericConstants.js +2 -1
- package/lib/factory/bigNum.d.ts +8 -2
- package/lib/factory/bigNum.js +14 -6
- package/lib/idl/clearing_house.json +277 -55
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -1
- package/lib/math/amm.d.ts +6 -1
- package/lib/math/amm.js +124 -41
- package/lib/math/auction.js +4 -1
- package/lib/math/orders.d.ts +2 -2
- package/lib/math/orders.js +18 -11
- package/lib/math/position.js +3 -1
- package/lib/math/repeg.js +1 -1
- package/lib/math/trade.d.ts +1 -1
- package/lib/math/trade.js +7 -10
- package/lib/orderParams.d.ts +14 -5
- package/lib/orderParams.js +8 -96
- package/lib/orders.d.ts +1 -2
- package/lib/orders.js +6 -85
- package/lib/slot/SlotSubscriber.d.ts +7 -0
- package/lib/slot/SlotSubscriber.js +3 -0
- package/lib/tx/utils.js +1 -1
- package/lib/types.d.ts +75 -1
- package/lib/types.js +42 -1
- package/package.json +3 -3
- package/src/accounts/bulkAccountLoader.js +197 -0
- package/src/accounts/bulkUserSubscription.js +33 -0
- package/src/accounts/fetch.js +29 -0
- package/src/accounts/pollingClearingHouseAccountSubscriber.js +311 -0
- package/src/accounts/pollingOracleSubscriber.js +93 -0
- package/src/accounts/pollingTokenAccountSubscriber.js +90 -0
- package/src/accounts/pollingUserAccountSubscriber.js +132 -0
- package/src/accounts/types.js +10 -0
- package/src/accounts/utils.js +7 -0
- package/src/accounts/webSocketAccountSubscriber.js +93 -0
- package/src/accounts/webSocketClearingHouseAccountSubscriber.js +233 -0
- package/src/accounts/webSocketUserAccountSubscriber.js +62 -0
- package/src/addresses/marketAddresses.js +26 -0
- package/src/addresses/pda.js +104 -0
- package/src/admin.ts +60 -8
- package/src/assert/assert.js +9 -0
- package/src/clearingHouse.ts +223 -183
- package/src/config.ts +1 -1
- package/src/constants/banks.ts +8 -1
- package/src/constants/numericConstants.ts +1 -0
- package/src/events/eventList.js +77 -0
- package/src/events/eventSubscriber.js +139 -0
- package/src/events/fetchLogs.js +50 -0
- package/src/events/pollingLogProvider.js +64 -0
- package/src/events/sort.js +44 -0
- package/src/events/txEventCache.js +71 -0
- package/src/events/types.js +20 -0
- package/src/events/webSocketLogProvider.js +41 -0
- package/src/examples/makeTradeExample.js +80 -0
- package/src/factory/bigNum.js +364 -0
- package/src/factory/bigNum.ts +26 -9
- package/src/factory/oracleClient.js +20 -0
- package/src/idl/clearing_house.json +277 -55
- package/src/index.js +69 -0
- package/src/index.ts +2 -1
- package/src/math/amm.js +369 -0
- package/src/math/amm.ts +207 -52
- package/src/math/auction.js +42 -0
- package/src/math/auction.ts +5 -1
- package/src/math/bankBalance.js +75 -0
- package/src/math/conversion.js +11 -0
- package/src/math/funding.js +248 -0
- package/src/math/market.js +57 -0
- package/src/math/oracles.js +26 -0
- package/src/math/orders.js +110 -0
- package/src/math/orders.ts +17 -13
- package/src/math/position.js +140 -0
- package/src/math/position.ts +5 -1
- package/src/math/repeg.js +128 -0
- package/src/math/repeg.ts +2 -1
- package/src/math/state.js +15 -0
- package/src/math/trade.js +253 -0
- package/src/math/trade.ts +23 -25
- package/src/math/utils.js +0 -1
- package/src/mockUSDCFaucet.js +171 -0
- package/src/oracles/oracleClientCache.js +19 -0
- package/src/oracles/pythClient.js +46 -0
- package/src/oracles/quoteAssetOracleClient.js +32 -0
- package/src/oracles/switchboardClient.js +69 -0
- package/src/oracles/types.js +2 -0
- package/src/orderParams.js +20 -0
- package/src/orderParams.ts +20 -141
- package/src/orders.js +134 -0
- package/src/orders.ts +7 -131
- package/src/slot/SlotSubscriber.js +39 -0
- package/src/slot/SlotSubscriber.ts +11 -1
- package/src/token/index.js +38 -0
- package/src/tx/retryTxSender.js +188 -0
- package/src/tx/types.js +2 -0
- package/src/tx/utils.js +17 -0
- package/src/tx/utils.ts +1 -1
- package/src/types.js +114 -0
- package/src/types.ts +69 -3
- package/src/userName.js +20 -0
- package/src/util/promiseTimeout.js +14 -0
- package/src/util/tps.js +27 -0
- package/src/wallet.js +35 -0
- package/src/util/computeUnits.js +0 -17
- package/src/util/computeUnits.js.map +0 -1
|
@@ -141,6 +141,10 @@
|
|
|
141
141
|
{
|
|
142
142
|
"name": "maintenanceLiabilityWeight",
|
|
143
143
|
"type": "u128"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"name": "imfFactor",
|
|
147
|
+
"type": "u128"
|
|
144
148
|
}
|
|
145
149
|
]
|
|
146
150
|
},
|
|
@@ -381,11 +385,6 @@
|
|
|
381
385
|
"name": "authority",
|
|
382
386
|
"isMut": false,
|
|
383
387
|
"isSigner": true
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
"name": "oracle",
|
|
387
|
-
"isMut": false,
|
|
388
|
-
"isSigner": false
|
|
389
388
|
}
|
|
390
389
|
],
|
|
391
390
|
"args": [
|
|
@@ -414,17 +413,14 @@
|
|
|
414
413
|
"name": "authority",
|
|
415
414
|
"isMut": false,
|
|
416
415
|
"isSigner": true
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
"name": "oracle",
|
|
420
|
-
"isMut": false,
|
|
421
|
-
"isSigner": false
|
|
422
416
|
}
|
|
423
417
|
],
|
|
424
418
|
"args": [
|
|
425
419
|
{
|
|
426
420
|
"name": "orderId",
|
|
427
|
-
"type":
|
|
421
|
+
"type": {
|
|
422
|
+
"option": "u64"
|
|
423
|
+
}
|
|
428
424
|
}
|
|
429
425
|
]
|
|
430
426
|
},
|
|
@@ -445,11 +441,6 @@
|
|
|
445
441
|
"name": "authority",
|
|
446
442
|
"isMut": false,
|
|
447
443
|
"isSigner": true
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
"name": "oracle",
|
|
451
|
-
"isMut": false,
|
|
452
|
-
"isSigner": false
|
|
453
444
|
}
|
|
454
445
|
],
|
|
455
446
|
"args": [
|
|
@@ -481,17 +472,14 @@
|
|
|
481
472
|
"name": "user",
|
|
482
473
|
"isMut": true,
|
|
483
474
|
"isSigner": false
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
"name": "oracle",
|
|
487
|
-
"isMut": false,
|
|
488
|
-
"isSigner": false
|
|
489
475
|
}
|
|
490
476
|
],
|
|
491
477
|
"args": [
|
|
492
478
|
{
|
|
493
479
|
"name": "orderId",
|
|
494
|
-
"type":
|
|
480
|
+
"type": {
|
|
481
|
+
"option": "u64"
|
|
482
|
+
}
|
|
495
483
|
},
|
|
496
484
|
{
|
|
497
485
|
"name": "makerOrderId",
|
|
@@ -518,11 +506,6 @@
|
|
|
518
506
|
"name": "authority",
|
|
519
507
|
"isMut": false,
|
|
520
508
|
"isSigner": true
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
"name": "oracle",
|
|
524
|
-
"isMut": false,
|
|
525
|
-
"isSigner": false
|
|
526
509
|
}
|
|
527
510
|
],
|
|
528
511
|
"args": [
|
|
@@ -555,18 +538,13 @@
|
|
|
555
538
|
},
|
|
556
539
|
{
|
|
557
540
|
"name": "taker",
|
|
558
|
-
"isMut":
|
|
541
|
+
"isMut": true,
|
|
559
542
|
"isSigner": false
|
|
560
543
|
},
|
|
561
544
|
{
|
|
562
545
|
"name": "authority",
|
|
563
546
|
"isMut": false,
|
|
564
547
|
"isSigner": true
|
|
565
|
-
},
|
|
566
|
-
{
|
|
567
|
-
"name": "oracle",
|
|
568
|
-
"isMut": false,
|
|
569
|
-
"isSigner": false
|
|
570
548
|
}
|
|
571
549
|
],
|
|
572
550
|
"args": [
|
|
@@ -582,6 +560,37 @@
|
|
|
582
560
|
}
|
|
583
561
|
]
|
|
584
562
|
},
|
|
563
|
+
{
|
|
564
|
+
"name": "triggerOrder",
|
|
565
|
+
"accounts": [
|
|
566
|
+
{
|
|
567
|
+
"name": "state",
|
|
568
|
+
"isMut": false,
|
|
569
|
+
"isSigner": false
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"name": "authority",
|
|
573
|
+
"isMut": false,
|
|
574
|
+
"isSigner": true
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
"name": "filler",
|
|
578
|
+
"isMut": true,
|
|
579
|
+
"isSigner": false
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
"name": "user",
|
|
583
|
+
"isMut": true,
|
|
584
|
+
"isSigner": false
|
|
585
|
+
}
|
|
586
|
+
],
|
|
587
|
+
"args": [
|
|
588
|
+
{
|
|
589
|
+
"name": "orderId",
|
|
590
|
+
"type": "u64"
|
|
591
|
+
}
|
|
592
|
+
]
|
|
593
|
+
},
|
|
585
594
|
{
|
|
586
595
|
"name": "updateAmms",
|
|
587
596
|
"accounts": [
|
|
@@ -711,7 +720,7 @@
|
|
|
711
720
|
]
|
|
712
721
|
},
|
|
713
722
|
{
|
|
714
|
-
"name": "
|
|
723
|
+
"name": "withdrawFromMarketToInsuranceVault",
|
|
715
724
|
"accounts": [
|
|
716
725
|
{
|
|
717
726
|
"name": "state",
|
|
@@ -725,7 +734,7 @@
|
|
|
725
734
|
},
|
|
726
735
|
{
|
|
727
736
|
"name": "bank",
|
|
728
|
-
"isMut":
|
|
737
|
+
"isMut": true,
|
|
729
738
|
"isSigner": false
|
|
730
739
|
},
|
|
731
740
|
{
|
|
@@ -830,6 +839,11 @@
|
|
|
830
839
|
"isMut": false,
|
|
831
840
|
"isSigner": false
|
|
832
841
|
},
|
|
842
|
+
{
|
|
843
|
+
"name": "bank",
|
|
844
|
+
"isMut": true,
|
|
845
|
+
"isSigner": false
|
|
846
|
+
},
|
|
833
847
|
{
|
|
834
848
|
"name": "bankVault",
|
|
835
849
|
"isMut": true,
|
|
@@ -993,11 +1007,6 @@
|
|
|
993
1007
|
"name": "user",
|
|
994
1008
|
"isMut": true,
|
|
995
1009
|
"isSigner": false
|
|
996
|
-
},
|
|
997
|
-
{
|
|
998
|
-
"name": "market",
|
|
999
|
-
"isMut": false,
|
|
1000
|
-
"isSigner": false
|
|
1001
1010
|
}
|
|
1002
1011
|
],
|
|
1003
1012
|
"args": []
|
|
@@ -1093,6 +1102,62 @@
|
|
|
1093
1102
|
}
|
|
1094
1103
|
]
|
|
1095
1104
|
},
|
|
1105
|
+
{
|
|
1106
|
+
"name": "updateMarketImfFactor",
|
|
1107
|
+
"accounts": [
|
|
1108
|
+
{
|
|
1109
|
+
"name": "admin",
|
|
1110
|
+
"isMut": false,
|
|
1111
|
+
"isSigner": true
|
|
1112
|
+
},
|
|
1113
|
+
{
|
|
1114
|
+
"name": "state",
|
|
1115
|
+
"isMut": false,
|
|
1116
|
+
"isSigner": false
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
"name": "market",
|
|
1120
|
+
"isMut": true,
|
|
1121
|
+
"isSigner": false
|
|
1122
|
+
}
|
|
1123
|
+
],
|
|
1124
|
+
"args": [
|
|
1125
|
+
{
|
|
1126
|
+
"name": "imfFactor",
|
|
1127
|
+
"type": "u128"
|
|
1128
|
+
}
|
|
1129
|
+
]
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
"name": "updateMarketUnsettledAssetWeight",
|
|
1133
|
+
"accounts": [
|
|
1134
|
+
{
|
|
1135
|
+
"name": "admin",
|
|
1136
|
+
"isMut": false,
|
|
1137
|
+
"isSigner": true
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
"name": "state",
|
|
1141
|
+
"isMut": false,
|
|
1142
|
+
"isSigner": false
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
"name": "market",
|
|
1146
|
+
"isMut": true,
|
|
1147
|
+
"isSigner": false
|
|
1148
|
+
}
|
|
1149
|
+
],
|
|
1150
|
+
"args": [
|
|
1151
|
+
{
|
|
1152
|
+
"name": "unsettledInitialAssetWeight",
|
|
1153
|
+
"type": "u8"
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
"name": "unsettledMaintenanceAssetWeight",
|
|
1157
|
+
"type": "u8"
|
|
1158
|
+
}
|
|
1159
|
+
]
|
|
1160
|
+
},
|
|
1096
1161
|
{
|
|
1097
1162
|
"name": "updateCurveUpdateIntensity",
|
|
1098
1163
|
"accounts": [
|
|
@@ -1389,6 +1454,32 @@
|
|
|
1389
1454
|
}
|
|
1390
1455
|
]
|
|
1391
1456
|
},
|
|
1457
|
+
{
|
|
1458
|
+
"name": "updateMarketMaxSpread",
|
|
1459
|
+
"accounts": [
|
|
1460
|
+
{
|
|
1461
|
+
"name": "admin",
|
|
1462
|
+
"isMut": false,
|
|
1463
|
+
"isSigner": true
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
"name": "state",
|
|
1467
|
+
"isMut": false,
|
|
1468
|
+
"isSigner": false
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
"name": "market",
|
|
1472
|
+
"isMut": true,
|
|
1473
|
+
"isSigner": false
|
|
1474
|
+
}
|
|
1475
|
+
],
|
|
1476
|
+
"args": [
|
|
1477
|
+
{
|
|
1478
|
+
"name": "maxSpread",
|
|
1479
|
+
"type": "u32"
|
|
1480
|
+
}
|
|
1481
|
+
]
|
|
1482
|
+
},
|
|
1392
1483
|
{
|
|
1393
1484
|
"name": "updateMarketBaseAssetAmountStepSize",
|
|
1394
1485
|
"accounts": [
|
|
@@ -1415,6 +1506,58 @@
|
|
|
1415
1506
|
}
|
|
1416
1507
|
]
|
|
1417
1508
|
},
|
|
1509
|
+
{
|
|
1510
|
+
"name": "updateMarketMaxSlippageRatio",
|
|
1511
|
+
"accounts": [
|
|
1512
|
+
{
|
|
1513
|
+
"name": "admin",
|
|
1514
|
+
"isMut": false,
|
|
1515
|
+
"isSigner": true
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
"name": "state",
|
|
1519
|
+
"isMut": false,
|
|
1520
|
+
"isSigner": false
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
"name": "market",
|
|
1524
|
+
"isMut": true,
|
|
1525
|
+
"isSigner": false
|
|
1526
|
+
}
|
|
1527
|
+
],
|
|
1528
|
+
"args": [
|
|
1529
|
+
{
|
|
1530
|
+
"name": "maxSlippageRatio",
|
|
1531
|
+
"type": "u16"
|
|
1532
|
+
}
|
|
1533
|
+
]
|
|
1534
|
+
},
|
|
1535
|
+
{
|
|
1536
|
+
"name": "updateMaxBaseAssetAmountRatio",
|
|
1537
|
+
"accounts": [
|
|
1538
|
+
{
|
|
1539
|
+
"name": "admin",
|
|
1540
|
+
"isMut": false,
|
|
1541
|
+
"isSigner": true
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
"name": "state",
|
|
1545
|
+
"isMut": false,
|
|
1546
|
+
"isSigner": false
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
"name": "market",
|
|
1550
|
+
"isMut": true,
|
|
1551
|
+
"isSigner": false
|
|
1552
|
+
}
|
|
1553
|
+
],
|
|
1554
|
+
"args": [
|
|
1555
|
+
{
|
|
1556
|
+
"name": "maxBaseAssetAmountRatio",
|
|
1557
|
+
"type": "u16"
|
|
1558
|
+
}
|
|
1559
|
+
]
|
|
1560
|
+
},
|
|
1418
1561
|
{
|
|
1419
1562
|
"name": "updateAdmin",
|
|
1420
1563
|
"accounts": [
|
|
@@ -1537,7 +1680,7 @@
|
|
|
1537
1680
|
]
|
|
1538
1681
|
},
|
|
1539
1682
|
{
|
|
1540
|
-
"name": "
|
|
1683
|
+
"name": "updateAuctionDuration",
|
|
1541
1684
|
"accounts": [
|
|
1542
1685
|
{
|
|
1543
1686
|
"name": "admin",
|
|
@@ -1552,7 +1695,11 @@
|
|
|
1552
1695
|
],
|
|
1553
1696
|
"args": [
|
|
1554
1697
|
{
|
|
1555
|
-
"name": "
|
|
1698
|
+
"name": "minAuctionDuration",
|
|
1699
|
+
"type": "u8"
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
"name": "maxAuctionDuration",
|
|
1556
1703
|
"type": "u8"
|
|
1557
1704
|
}
|
|
1558
1705
|
]
|
|
@@ -1649,6 +1796,10 @@
|
|
|
1649
1796
|
{
|
|
1650
1797
|
"name": "maintenanceLiabilityWeight",
|
|
1651
1798
|
"type": "u128"
|
|
1799
|
+
},
|
|
1800
|
+
{
|
|
1801
|
+
"name": "imfFactor",
|
|
1802
|
+
"type": "u128"
|
|
1652
1803
|
}
|
|
1653
1804
|
]
|
|
1654
1805
|
}
|
|
@@ -1726,6 +1877,22 @@
|
|
|
1726
1877
|
"name": "unsettledLoss",
|
|
1727
1878
|
"type": "u128"
|
|
1728
1879
|
},
|
|
1880
|
+
{
|
|
1881
|
+
"name": "imfFactor",
|
|
1882
|
+
"type": "u128"
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
"name": "unsettledInitialAssetWeight",
|
|
1886
|
+
"type": "u8"
|
|
1887
|
+
},
|
|
1888
|
+
{
|
|
1889
|
+
"name": "unsettledMaintenanceAssetWeight",
|
|
1890
|
+
"type": "u8"
|
|
1891
|
+
},
|
|
1892
|
+
{
|
|
1893
|
+
"name": "unsettledImfFactor",
|
|
1894
|
+
"type": "u128"
|
|
1895
|
+
},
|
|
1729
1896
|
{
|
|
1730
1897
|
"name": "padding0",
|
|
1731
1898
|
"type": "u32"
|
|
@@ -1859,7 +2026,11 @@
|
|
|
1859
2026
|
"type": "u128"
|
|
1860
2027
|
},
|
|
1861
2028
|
{
|
|
1862
|
-
"name": "
|
|
2029
|
+
"name": "minAuctionDuration",
|
|
2030
|
+
"type": "u8"
|
|
2031
|
+
},
|
|
2032
|
+
{
|
|
2033
|
+
"name": "maxAuctionDuration",
|
|
1863
2034
|
"type": "u8"
|
|
1864
2035
|
},
|
|
1865
2036
|
{
|
|
@@ -1964,10 +2135,6 @@
|
|
|
1964
2135
|
"name": "userOrderId",
|
|
1965
2136
|
"type": "u8"
|
|
1966
2137
|
},
|
|
1967
|
-
{
|
|
1968
|
-
"name": "quoteAssetAmount",
|
|
1969
|
-
"type": "u128"
|
|
1970
|
-
},
|
|
1971
2138
|
{
|
|
1972
2139
|
"name": "baseAssetAmount",
|
|
1973
2140
|
"type": "u128"
|
|
@@ -2016,6 +2183,10 @@
|
|
|
2016
2183
|
"name": "oraclePriceOffset",
|
|
2017
2184
|
"type": "i128"
|
|
2018
2185
|
},
|
|
2186
|
+
{
|
|
2187
|
+
"name": "auctionDuration",
|
|
2188
|
+
"type": "u8"
|
|
2189
|
+
},
|
|
2019
2190
|
{
|
|
2020
2191
|
"name": "padding0",
|
|
2021
2192
|
"type": "bool"
|
|
@@ -2178,6 +2349,14 @@
|
|
|
2178
2349
|
"name": "minimumQuoteAssetTradeSize",
|
|
2179
2350
|
"type": "u128"
|
|
2180
2351
|
},
|
|
2352
|
+
{
|
|
2353
|
+
"name": "maxBaseAssetAmountRatio",
|
|
2354
|
+
"type": "u16"
|
|
2355
|
+
},
|
|
2356
|
+
{
|
|
2357
|
+
"name": "maxSlippageRatio",
|
|
2358
|
+
"type": "u16"
|
|
2359
|
+
},
|
|
2181
2360
|
{
|
|
2182
2361
|
"name": "baseAssetAmountStepSize",
|
|
2183
2362
|
"type": "u128"
|
|
@@ -2194,6 +2373,10 @@
|
|
|
2194
2373
|
"name": "shortSpread",
|
|
2195
2374
|
"type": "u128"
|
|
2196
2375
|
},
|
|
2376
|
+
{
|
|
2377
|
+
"name": "maxSpread",
|
|
2378
|
+
"type": "u32"
|
|
2379
|
+
},
|
|
2197
2380
|
{
|
|
2198
2381
|
"name": "askBaseAssetReserve",
|
|
2199
2382
|
"type": "u128"
|
|
@@ -2252,7 +2435,7 @@
|
|
|
2252
2435
|
},
|
|
2253
2436
|
{
|
|
2254
2437
|
"name": "totalFeeMinusDistributions",
|
|
2255
|
-
"type": "
|
|
2438
|
+
"type": "i128"
|
|
2256
2439
|
},
|
|
2257
2440
|
{
|
|
2258
2441
|
"name": "totalFeeWithdrawn",
|
|
@@ -2658,10 +2841,6 @@
|
|
|
2658
2841
|
"defined": "PositionDirection"
|
|
2659
2842
|
}
|
|
2660
2843
|
},
|
|
2661
|
-
{
|
|
2662
|
-
"name": "quoteAssetAmount",
|
|
2663
|
-
"type": "u128"
|
|
2664
|
-
},
|
|
2665
2844
|
{
|
|
2666
2845
|
"name": "baseAssetAmount",
|
|
2667
2846
|
"type": "u128"
|
|
@@ -2712,6 +2891,10 @@
|
|
|
2712
2891
|
"defined": "OrderTriggerCondition"
|
|
2713
2892
|
}
|
|
2714
2893
|
},
|
|
2894
|
+
{
|
|
2895
|
+
"name": "triggered",
|
|
2896
|
+
"type": "bool"
|
|
2897
|
+
},
|
|
2715
2898
|
{
|
|
2716
2899
|
"name": "referrer",
|
|
2717
2900
|
"type": "publicKey"
|
|
@@ -2848,6 +3031,9 @@
|
|
|
2848
3031
|
{
|
|
2849
3032
|
"name": "Fill"
|
|
2850
3033
|
},
|
|
3034
|
+
{
|
|
3035
|
+
"name": "Trigger"
|
|
3036
|
+
},
|
|
2851
3037
|
{
|
|
2852
3038
|
"name": "Expire"
|
|
2853
3039
|
}
|
|
@@ -2867,6 +3053,12 @@
|
|
|
2867
3053
|
},
|
|
2868
3054
|
{
|
|
2869
3055
|
"name": "OraclePriceBreachedLimitPrice"
|
|
3056
|
+
},
|
|
3057
|
+
{
|
|
3058
|
+
"name": "MarketOrderFilledToLimitPrice"
|
|
3059
|
+
},
|
|
3060
|
+
{
|
|
3061
|
+
"name": "MarketOrderAuctionExpired"
|
|
2870
3062
|
}
|
|
2871
3063
|
]
|
|
2872
3064
|
}
|
|
@@ -3016,6 +3208,11 @@
|
|
|
3016
3208
|
"type": "u64",
|
|
3017
3209
|
"index": false
|
|
3018
3210
|
},
|
|
3211
|
+
{
|
|
3212
|
+
"name": "oraclePrice",
|
|
3213
|
+
"type": "i128",
|
|
3214
|
+
"index": false
|
|
3215
|
+
},
|
|
3019
3216
|
{
|
|
3020
3217
|
"name": "from",
|
|
3021
3218
|
"type": {
|
|
@@ -3217,7 +3414,7 @@
|
|
|
3217
3414
|
},
|
|
3218
3415
|
{
|
|
3219
3416
|
"name": "totalFeeMinusDistributions",
|
|
3220
|
-
"type": "
|
|
3417
|
+
"type": "i128",
|
|
3221
3418
|
"index": false
|
|
3222
3419
|
},
|
|
3223
3420
|
{
|
|
@@ -3349,6 +3546,16 @@
|
|
|
3349
3546
|
},
|
|
3350
3547
|
"index": false
|
|
3351
3548
|
},
|
|
3549
|
+
{
|
|
3550
|
+
"name": "makerUnsettledPnl",
|
|
3551
|
+
"type": "i128",
|
|
3552
|
+
"index": false
|
|
3553
|
+
},
|
|
3554
|
+
{
|
|
3555
|
+
"name": "takerUnsettledPnl",
|
|
3556
|
+
"type": "i128",
|
|
3557
|
+
"index": false
|
|
3558
|
+
},
|
|
3352
3559
|
{
|
|
3353
3560
|
"name": "action",
|
|
3354
3561
|
"type": {
|
|
@@ -3639,8 +3846,8 @@
|
|
|
3639
3846
|
},
|
|
3640
3847
|
{
|
|
3641
3848
|
"code": 6044,
|
|
3642
|
-
"name": "
|
|
3643
|
-
"msg": "
|
|
3849
|
+
"name": "FillOrderDidNotUpdateState",
|
|
3850
|
+
"msg": "FillOrderDidNotUpdateState"
|
|
3644
3851
|
},
|
|
3645
3852
|
{
|
|
3646
3853
|
"code": 6045,
|
|
@@ -3854,6 +4061,21 @@
|
|
|
3854
4061
|
},
|
|
3855
4062
|
{
|
|
3856
4063
|
"code": 6087,
|
|
4064
|
+
"name": "OrderMustBeTriggeredFirst",
|
|
4065
|
+
"msg": "OrderMustBeTriggeredFirst"
|
|
4066
|
+
},
|
|
4067
|
+
{
|
|
4068
|
+
"code": 6088,
|
|
4069
|
+
"name": "OrderNotTriggerable",
|
|
4070
|
+
"msg": "OrderNotTriggerable"
|
|
4071
|
+
},
|
|
4072
|
+
{
|
|
4073
|
+
"code": 6089,
|
|
4074
|
+
"name": "OrderDidNotSatisfyTriggerCondition",
|
|
4075
|
+
"msg": "OrderDidNotSatisfyTriggerCondition"
|
|
4076
|
+
},
|
|
4077
|
+
{
|
|
4078
|
+
"code": 6090,
|
|
3857
4079
|
"name": "DefaultError",
|
|
3858
4080
|
"msg": "DefaultError"
|
|
3859
4081
|
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.pyth = exports.PublicKey = exports.BN = void 0;
|
|
17
|
+
const anchor_1 = require("@project-serum/anchor");
|
|
18
|
+
Object.defineProperty(exports, "BN", { enumerable: true, get: function () { return anchor_1.BN; } });
|
|
19
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
20
|
+
Object.defineProperty(exports, "PublicKey", { enumerable: true, get: function () { return web3_js_1.PublicKey; } });
|
|
21
|
+
const client_1 = __importDefault(require("@pythnetwork/client"));
|
|
22
|
+
exports.pyth = client_1.default;
|
|
23
|
+
__exportStar(require("./mockUSDCFaucet"), exports);
|
|
24
|
+
__exportStar(require("./oracles/types"), exports);
|
|
25
|
+
__exportStar(require("./oracles/pythClient"), exports);
|
|
26
|
+
__exportStar(require("./oracles/switchboardClient"), exports);
|
|
27
|
+
__exportStar(require("./types"), exports);
|
|
28
|
+
__exportStar(require("./constants/markets"), exports);
|
|
29
|
+
__exportStar(require("./accounts/fetch"), exports);
|
|
30
|
+
__exportStar(require("./accounts/webSocketClearingHouseAccountSubscriber"), exports);
|
|
31
|
+
__exportStar(require("./accounts/bulkAccountLoader"), exports);
|
|
32
|
+
__exportStar(require("./accounts/bulkUserSubscription"), exports);
|
|
33
|
+
__exportStar(require("./accounts/pollingClearingHouseAccountSubscriber"), exports);
|
|
34
|
+
__exportStar(require("./accounts/pollingOracleSubscriber"), exports);
|
|
35
|
+
__exportStar(require("./accounts/pollingTokenAccountSubscriber"), exports);
|
|
36
|
+
__exportStar(require("./accounts/types"), exports);
|
|
37
|
+
__exportStar(require("./addresses/pda"), exports);
|
|
38
|
+
__exportStar(require("./admin"), exports);
|
|
39
|
+
__exportStar(require("./clearingHouseUser"), exports);
|
|
40
|
+
__exportStar(require("./clearingHouseUserConfig"), exports);
|
|
41
|
+
__exportStar(require("./clearingHouse"), exports);
|
|
42
|
+
__exportStar(require("./factory/oracleClient"), exports);
|
|
43
|
+
__exportStar(require("./factory/bigNum"), exports);
|
|
44
|
+
__exportStar(require("./events/types"), exports);
|
|
45
|
+
__exportStar(require("./events/eventSubscriber"), exports);
|
|
46
|
+
__exportStar(require("./math/auction"), exports);
|
|
47
|
+
__exportStar(require("./math/conversion"), exports);
|
|
48
|
+
__exportStar(require("./math/funding"), exports);
|
|
49
|
+
__exportStar(require("./math/market"), exports);
|
|
50
|
+
__exportStar(require("./math/position"), exports);
|
|
51
|
+
__exportStar(require("./math/oracles"), exports);
|
|
52
|
+
__exportStar(require("./math/amm"), exports);
|
|
53
|
+
__exportStar(require("./math/trade"), exports);
|
|
54
|
+
__exportStar(require("./math/orders"), exports);
|
|
55
|
+
__exportStar(require("./math/repeg"), exports);
|
|
56
|
+
__exportStar(require("./orders"), exports);
|
|
57
|
+
__exportStar(require("./orderParams"), exports);
|
|
58
|
+
__exportStar(require("./slot/SlotSubscriber"), exports);
|
|
59
|
+
__exportStar(require("./wallet"), exports);
|
|
60
|
+
__exportStar(require("./types"), exports);
|
|
61
|
+
__exportStar(require("./math/utils"), exports);
|
|
62
|
+
__exportStar(require("./config"), exports);
|
|
63
|
+
__exportStar(require("./constants/numericConstants"), exports);
|
|
64
|
+
__exportStar(require("./tx/retryTxSender"), exports);
|
|
65
|
+
__exportStar(require("./util/computeUnits"), exports);
|
|
66
|
+
__exportStar(require("./util/tps"), exports);
|
|
67
|
+
__exportStar(require("./math/bankBalance"), exports);
|
|
68
|
+
__exportStar(require("./constants/banks"), exports);
|
|
69
|
+
__exportStar(require("./clearingHouseConfig"), exports);
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BN } from '@project-serum/anchor';
|
|
2
2
|
import { PublicKey } from '@solana/web3.js';
|
|
3
|
+
import pyth from '@pythnetwork/client';
|
|
3
4
|
|
|
4
5
|
export * from './mockUSDCFaucet';
|
|
5
6
|
export * from './oracles/types';
|
|
@@ -49,4 +50,4 @@ export * from './math/bankBalance';
|
|
|
49
50
|
export * from './constants/banks';
|
|
50
51
|
export * from './clearingHouseConfig';
|
|
51
52
|
|
|
52
|
-
export { BN, PublicKey };
|
|
53
|
+
export { BN, PublicKey, pyth };
|