@drift-labs/sdk 2.23.0 → 2.25.0-beta.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/README.md +1 -1
- package/lib/accounts/fetch.d.ts +1 -1
- package/lib/accounts/pollingDriftClientAccountSubscriber.d.ts +1 -1
- package/lib/accounts/pollingOracleAccountSubscriber.d.ts +1 -1
- package/lib/accounts/pollingTokenAccountSubscriber.d.ts +1 -1
- package/lib/accounts/pollingUserAccountSubscriber.d.ts +1 -1
- package/lib/accounts/pollingUserStatsAccountSubscriber.d.ts +1 -1
- package/lib/accounts/webSocketAccountSubscriber.d.ts +1 -1
- package/lib/accounts/webSocketDriftClientAccountSubscriber.d.ts +1 -1
- package/lib/accounts/webSocketUserAccountSubscriber.d.ts +1 -1
- package/lib/accounts/webSocketUserStatsAccountSubsriber.d.ts +1 -1
- package/lib/addresses/pda.d.ts +1 -2
- package/lib/addresses/pda.js +1 -1
- package/lib/adminClient.d.ts +3 -3
- package/lib/adminClient.js +16 -4
- package/lib/constants/numericConstants.d.ts +59 -61
- package/lib/constants/perpMarkets.js +21 -1
- package/lib/constants/spotMarkets.d.ts +0 -1
- package/lib/dlob/DLOB.d.ts +0 -1
- package/lib/dlob/DLOBNode.d.ts +0 -1
- package/lib/dlob/DLOBOrders.d.ts +1 -1
- package/lib/dlob/DLOBOrders.js +1 -1
- package/lib/dlob/NodeList.d.ts +0 -1
- package/lib/driftClient.d.ts +58 -24
- package/lib/driftClient.js +152 -136
- package/lib/events/eventSubscriber.d.ts +1 -1
- package/lib/events/eventSubscriber.js +3 -2
- package/lib/events/fetchLogs.d.ts +1 -1
- package/lib/events/fetchLogs.js +3 -2
- package/lib/examples/loadDlob.js +1 -1
- package/lib/examples/makeTradeExample.js +1 -1
- package/lib/factory/bigNum.d.ts +8 -9
- package/lib/factory/bigNum.js +1 -1
- package/lib/factory/oracleClient.js +1 -1
- package/lib/idl/drift.json +216 -14
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/math/amm.d.ts +2 -3
- package/lib/math/amm.js +1 -1
- package/lib/math/auction.d.ts +0 -1
- package/lib/math/conversion.d.ts +1 -2
- package/lib/math/funding.d.ts +1 -2
- package/lib/math/funding.js +1 -1
- package/lib/math/insurance.d.ts +1 -1
- package/lib/math/insurance.js +17 -1
- package/lib/math/margin.d.ts +1 -2
- package/lib/math/margin.js +1 -1
- package/lib/math/market.d.ts +1 -2
- package/lib/math/market.js +1 -1
- package/lib/math/oracles.d.ts +0 -1
- package/lib/math/oracles.js +2 -3
- package/lib/math/orders.d.ts +1 -2
- package/lib/math/orders.js +1 -1
- package/lib/math/position.d.ts +0 -1
- package/lib/math/repeg.d.ts +1 -2
- package/lib/math/repeg.js +1 -1
- package/lib/math/spotBalance.d.ts +1 -2
- package/lib/math/spotBalance.js +1 -1
- package/lib/math/spotMarket.d.ts +1 -2
- package/lib/math/spotMarket.js +1 -1
- package/lib/math/spotPosition.d.ts +1 -2
- package/lib/math/trade.d.ts +1 -2
- package/lib/math/trade.js +1 -1
- package/lib/math/utils.d.ts +0 -1
- package/lib/oracles/pythClient.d.ts +2 -3
- package/lib/oracles/pythClient.js +1 -1
- package/lib/oracles/quoteAssetOracleClient.js +1 -1
- package/lib/oracles/types.d.ts +1 -2
- package/lib/orderParams.d.ts +1 -2
- package/lib/serum/serumSubscriber.d.ts +1 -2
- package/lib/serum/serumSubscriber.js +1 -1
- package/lib/tokenFaucet.d.ts +2 -3
- package/lib/tokenFaucet.js +2 -2
- package/lib/tx/retryTxSender.d.ts +1 -1
- package/lib/tx/types.d.ts +1 -1
- package/lib/types.d.ts +9 -3
- package/lib/types.js +2 -1
- package/lib/user.d.ts +0 -1
- package/package.json +2 -2
- package/src/accounts/fetch.ts +1 -1
- package/src/accounts/pollingDriftClientAccountSubscriber.ts +1 -1
- package/src/accounts/pollingOracleAccountSubscriber.ts +1 -1
- package/src/accounts/pollingTokenAccountSubscriber.ts +1 -1
- package/src/accounts/pollingUserAccountSubscriber.ts +1 -1
- package/src/accounts/pollingUserStatsAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketDriftClientAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketUserAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +1 -1
- package/src/addresses/pda.ts +2 -2
- package/src/adminClient.ts +30 -2
- package/src/constants/perpMarkets.ts +21 -1
- package/src/dlob/DLOBOrders.ts +2 -2
- package/src/driftClient.ts +266 -163
- package/src/events/eventSubscriber.ts +7 -3
- package/src/events/fetchLogs.ts +7 -3
- package/src/examples/loadDlob.ts +1 -1
- package/src/examples/makeTradeExample.ts +1 -1
- package/src/factory/bigNum.ts +1 -1
- package/src/factory/oracleClient.ts +1 -1
- package/src/idl/drift.json +216 -14
- package/src/index.ts +1 -1
- package/src/math/amm.ts +1 -1
- package/src/math/funding.ts +1 -1
- package/src/math/insurance.ts +29 -0
- package/src/math/margin.ts +1 -1
- package/src/math/market.ts +1 -1
- package/src/math/oracles.ts +2 -3
- package/src/math/orders.ts +1 -1
- package/src/math/repeg.ts +1 -1
- package/src/math/spotBalance.ts +1 -1
- package/src/math/spotMarket.ts +1 -1
- package/src/math/spotPosition.ts +1 -1
- package/src/math/trade.ts +1 -1
- package/src/oracles/pythClient.ts +1 -1
- package/src/oracles/quoteAssetOracleClient.ts +1 -1
- package/src/oracles/types.ts +1 -1
- package/src/orderParams.ts +1 -1
- package/src/serum/serumSubscriber.ts +1 -1
- package/src/tokenFaucet.ts +2 -2
- package/src/tx/retryTxSender.ts +1 -1
- package/src/tx/types.ts +1 -1
- package/src/types.ts +8 -1
- package/src/userMap/userStatsMap.ts +1 -1
package/src/idl/drift.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.25.0-beta.0",
|
|
3
3
|
"name": "drift",
|
|
4
4
|
"instructions": [
|
|
5
5
|
{
|
|
@@ -428,6 +428,72 @@
|
|
|
428
428
|
}
|
|
429
429
|
]
|
|
430
430
|
},
|
|
431
|
+
{
|
|
432
|
+
"name": "modifyOrder",
|
|
433
|
+
"accounts": [
|
|
434
|
+
{
|
|
435
|
+
"name": "state",
|
|
436
|
+
"isMut": false,
|
|
437
|
+
"isSigner": false
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"name": "user",
|
|
441
|
+
"isMut": true,
|
|
442
|
+
"isSigner": false
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"name": "authority",
|
|
446
|
+
"isMut": false,
|
|
447
|
+
"isSigner": true
|
|
448
|
+
}
|
|
449
|
+
],
|
|
450
|
+
"args": [
|
|
451
|
+
{
|
|
452
|
+
"name": "orderId",
|
|
453
|
+
"type": {
|
|
454
|
+
"option": "u32"
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"name": "modifyOrderParams",
|
|
459
|
+
"type": {
|
|
460
|
+
"defined": "ModifyOrderParams"
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
]
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"name": "modifyOrderByUserId",
|
|
467
|
+
"accounts": [
|
|
468
|
+
{
|
|
469
|
+
"name": "state",
|
|
470
|
+
"isMut": false,
|
|
471
|
+
"isSigner": false
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"name": "user",
|
|
475
|
+
"isMut": true,
|
|
476
|
+
"isSigner": false
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
"name": "authority",
|
|
480
|
+
"isMut": false,
|
|
481
|
+
"isSigner": true
|
|
482
|
+
}
|
|
483
|
+
],
|
|
484
|
+
"args": [
|
|
485
|
+
{
|
|
486
|
+
"name": "userOrderId",
|
|
487
|
+
"type": "u8"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"name": "modifyOrderParams",
|
|
491
|
+
"type": {
|
|
492
|
+
"defined": "ModifyOrderParams"
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
]
|
|
496
|
+
},
|
|
431
497
|
{
|
|
432
498
|
"name": "placeAndTakePerpOrder",
|
|
433
499
|
"accounts": [
|
|
@@ -2283,6 +2349,10 @@
|
|
|
2283
2349
|
}
|
|
2284
2350
|
],
|
|
2285
2351
|
"args": [
|
|
2352
|
+
{
|
|
2353
|
+
"name": "marketIndex",
|
|
2354
|
+
"type": "u16"
|
|
2355
|
+
},
|
|
2286
2356
|
{
|
|
2287
2357
|
"name": "ammBaseAssetReserve",
|
|
2288
2358
|
"type": "u128"
|
|
@@ -2332,6 +2402,32 @@
|
|
|
2332
2402
|
}
|
|
2333
2403
|
]
|
|
2334
2404
|
},
|
|
2405
|
+
{
|
|
2406
|
+
"name": "deleteInitializedPerpMarket",
|
|
2407
|
+
"accounts": [
|
|
2408
|
+
{
|
|
2409
|
+
"name": "admin",
|
|
2410
|
+
"isMut": true,
|
|
2411
|
+
"isSigner": true
|
|
2412
|
+
},
|
|
2413
|
+
{
|
|
2414
|
+
"name": "state",
|
|
2415
|
+
"isMut": true,
|
|
2416
|
+
"isSigner": false
|
|
2417
|
+
},
|
|
2418
|
+
{
|
|
2419
|
+
"name": "perpMarket",
|
|
2420
|
+
"isMut": true,
|
|
2421
|
+
"isSigner": false
|
|
2422
|
+
}
|
|
2423
|
+
],
|
|
2424
|
+
"args": [
|
|
2425
|
+
{
|
|
2426
|
+
"name": "marketIndex",
|
|
2427
|
+
"type": "u16"
|
|
2428
|
+
}
|
|
2429
|
+
]
|
|
2430
|
+
},
|
|
2335
2431
|
{
|
|
2336
2432
|
"name": "moveAmmPrice",
|
|
2337
2433
|
"accounts": [
|
|
@@ -4852,6 +4948,98 @@
|
|
|
4852
4948
|
]
|
|
4853
4949
|
}
|
|
4854
4950
|
},
|
|
4951
|
+
{
|
|
4952
|
+
"name": "ModifyOrderParams",
|
|
4953
|
+
"type": {
|
|
4954
|
+
"kind": "struct",
|
|
4955
|
+
"fields": [
|
|
4956
|
+
{
|
|
4957
|
+
"name": "direction",
|
|
4958
|
+
"type": {
|
|
4959
|
+
"option": {
|
|
4960
|
+
"defined": "PositionDirection"
|
|
4961
|
+
}
|
|
4962
|
+
}
|
|
4963
|
+
},
|
|
4964
|
+
{
|
|
4965
|
+
"name": "baseAssetAmount",
|
|
4966
|
+
"type": {
|
|
4967
|
+
"option": "u64"
|
|
4968
|
+
}
|
|
4969
|
+
},
|
|
4970
|
+
{
|
|
4971
|
+
"name": "price",
|
|
4972
|
+
"type": {
|
|
4973
|
+
"option": "u64"
|
|
4974
|
+
}
|
|
4975
|
+
},
|
|
4976
|
+
{
|
|
4977
|
+
"name": "reduceOnly",
|
|
4978
|
+
"type": {
|
|
4979
|
+
"option": "bool"
|
|
4980
|
+
}
|
|
4981
|
+
},
|
|
4982
|
+
{
|
|
4983
|
+
"name": "postOnly",
|
|
4984
|
+
"type": {
|
|
4985
|
+
"option": {
|
|
4986
|
+
"defined": "PostOnlyParam"
|
|
4987
|
+
}
|
|
4988
|
+
}
|
|
4989
|
+
},
|
|
4990
|
+
{
|
|
4991
|
+
"name": "immediateOrCancel",
|
|
4992
|
+
"type": {
|
|
4993
|
+
"option": "bool"
|
|
4994
|
+
}
|
|
4995
|
+
},
|
|
4996
|
+
{
|
|
4997
|
+
"name": "maxTs",
|
|
4998
|
+
"type": {
|
|
4999
|
+
"option": "i64"
|
|
5000
|
+
}
|
|
5001
|
+
},
|
|
5002
|
+
{
|
|
5003
|
+
"name": "triggerPrice",
|
|
5004
|
+
"type": {
|
|
5005
|
+
"option": "u64"
|
|
5006
|
+
}
|
|
5007
|
+
},
|
|
5008
|
+
{
|
|
5009
|
+
"name": "triggerCondition",
|
|
5010
|
+
"type": {
|
|
5011
|
+
"option": {
|
|
5012
|
+
"defined": "OrderTriggerCondition"
|
|
5013
|
+
}
|
|
5014
|
+
}
|
|
5015
|
+
},
|
|
5016
|
+
{
|
|
5017
|
+
"name": "oraclePriceOffset",
|
|
5018
|
+
"type": {
|
|
5019
|
+
"option": "i32"
|
|
5020
|
+
}
|
|
5021
|
+
},
|
|
5022
|
+
{
|
|
5023
|
+
"name": "auctionDuration",
|
|
5024
|
+
"type": {
|
|
5025
|
+
"option": "u8"
|
|
5026
|
+
}
|
|
5027
|
+
},
|
|
5028
|
+
{
|
|
5029
|
+
"name": "auctionStartPrice",
|
|
5030
|
+
"type": {
|
|
5031
|
+
"option": "i64"
|
|
5032
|
+
}
|
|
5033
|
+
},
|
|
5034
|
+
{
|
|
5035
|
+
"name": "auctionEndPrice",
|
|
5036
|
+
"type": {
|
|
5037
|
+
"option": "i64"
|
|
5038
|
+
}
|
|
5039
|
+
}
|
|
5040
|
+
]
|
|
5041
|
+
}
|
|
5042
|
+
},
|
|
4855
5043
|
{
|
|
4856
5044
|
"name": "LiquidatePerpRecord",
|
|
4857
5045
|
"type": {
|
|
@@ -5127,7 +5315,7 @@
|
|
|
5127
5315
|
"fields": [
|
|
5128
5316
|
{
|
|
5129
5317
|
"name": "revenueWithdrawSinceLastSettle",
|
|
5130
|
-
"type": "
|
|
5318
|
+
"type": "i64"
|
|
5131
5319
|
},
|
|
5132
5320
|
{
|
|
5133
5321
|
"name": "maxRevenueWithdrawPerPeriod",
|
|
@@ -5981,31 +6169,35 @@
|
|
|
5981
6169
|
}
|
|
5982
6170
|
},
|
|
5983
6171
|
{
|
|
5984
|
-
"name": "
|
|
6172
|
+
"name": "ModifyOrderId",
|
|
5985
6173
|
"type": {
|
|
5986
6174
|
"kind": "enum",
|
|
5987
6175
|
"variants": [
|
|
5988
6176
|
{
|
|
5989
|
-
"name": "
|
|
6177
|
+
"name": "UserOrderId",
|
|
6178
|
+
"fields": [
|
|
6179
|
+
"u8"
|
|
6180
|
+
]
|
|
5990
6181
|
},
|
|
5991
6182
|
{
|
|
5992
|
-
"name": "
|
|
6183
|
+
"name": "OrderId",
|
|
6184
|
+
"fields": [
|
|
6185
|
+
"u32"
|
|
6186
|
+
]
|
|
5993
6187
|
}
|
|
5994
6188
|
]
|
|
5995
6189
|
}
|
|
5996
6190
|
},
|
|
5997
6191
|
{
|
|
5998
|
-
"name": "
|
|
6192
|
+
"name": "PositionDirection",
|
|
5999
6193
|
"type": {
|
|
6000
6194
|
"kind": "enum",
|
|
6001
6195
|
"variants": [
|
|
6002
6196
|
{
|
|
6003
|
-
"name": "
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
}
|
|
6008
|
-
]
|
|
6197
|
+
"name": "Long"
|
|
6198
|
+
},
|
|
6199
|
+
{
|
|
6200
|
+
"name": "Short"
|
|
6009
6201
|
}
|
|
6010
6202
|
]
|
|
6011
6203
|
}
|
|
@@ -6019,7 +6211,7 @@
|
|
|
6019
6211
|
"name": "SerumV3"
|
|
6020
6212
|
},
|
|
6021
6213
|
{
|
|
6022
|
-
"name": "
|
|
6214
|
+
"name": "Match"
|
|
6023
6215
|
}
|
|
6024
6216
|
]
|
|
6025
6217
|
}
|
|
@@ -6380,7 +6572,7 @@
|
|
|
6380
6572
|
"kind": "enum",
|
|
6381
6573
|
"variants": [
|
|
6382
6574
|
{
|
|
6383
|
-
"name": "
|
|
6575
|
+
"name": "ExternalMarket"
|
|
6384
6576
|
},
|
|
6385
6577
|
{
|
|
6386
6578
|
"name": "Match"
|
|
@@ -8826,6 +9018,16 @@
|
|
|
8826
9018
|
"code": 6239,
|
|
8827
9019
|
"name": "RevertFill",
|
|
8828
9020
|
"msg": "RevertFill"
|
|
9021
|
+
},
|
|
9022
|
+
{
|
|
9023
|
+
"code": 6240,
|
|
9024
|
+
"name": "InvalidMarketAccountforDeletion",
|
|
9025
|
+
"msg": "Invalid MarketAccount for Deletion"
|
|
9026
|
+
},
|
|
9027
|
+
{
|
|
9028
|
+
"code": 6241,
|
|
9029
|
+
"name": "InvalidSpotFulfillmentParams",
|
|
9030
|
+
"msg": "Invalid Spot Fulfillment Params"
|
|
8829
9031
|
}
|
|
8830
9032
|
]
|
|
8831
9033
|
}
|
package/src/index.ts
CHANGED
package/src/math/amm.ts
CHANGED
package/src/math/funding.ts
CHANGED
package/src/math/insurance.ts
CHANGED
|
@@ -33,3 +33,32 @@ export function unstakeSharesToAmount(
|
|
|
33
33
|
|
|
34
34
|
return amount;
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
export function unstakeSharesToAmountWithOpenRequest(
|
|
38
|
+
nShares: BN,
|
|
39
|
+
withdrawRequestShares: BN,
|
|
40
|
+
withdrawRequestAmount: BN,
|
|
41
|
+
totalIfShares: BN,
|
|
42
|
+
insuranceFundVaultBalance: BN
|
|
43
|
+
): BN {
|
|
44
|
+
let stakedAmount: BN;
|
|
45
|
+
if (totalIfShares.gt(ZERO)) {
|
|
46
|
+
stakedAmount = BN.max(
|
|
47
|
+
ZERO,
|
|
48
|
+
nShares
|
|
49
|
+
.sub(withdrawRequestShares)
|
|
50
|
+
.mul(insuranceFundVaultBalance)
|
|
51
|
+
.div(totalIfShares)
|
|
52
|
+
);
|
|
53
|
+
} else {
|
|
54
|
+
stakedAmount = ZERO;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const withdrawAmount = BN.min(
|
|
58
|
+
withdrawRequestAmount,
|
|
59
|
+
withdrawRequestShares.mul(insuranceFundVaultBalance).div(totalIfShares)
|
|
60
|
+
);
|
|
61
|
+
const amount = withdrawAmount.add(stakedAmount);
|
|
62
|
+
|
|
63
|
+
return amount;
|
|
64
|
+
}
|
package/src/math/margin.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
BID_ASK_SPREAD_PRECISION,
|
|
7
7
|
AMM_RESERVE_PRECISION,
|
|
8
8
|
} from '../constants/numericConstants';
|
|
9
|
-
import { BN } from '@
|
|
9
|
+
import { BN } from '@coral-xyz/anchor';
|
|
10
10
|
import { OraclePriceData } from '../oracles/types';
|
|
11
11
|
import { PerpMarketAccount, PerpPosition } from '..';
|
|
12
12
|
import { isVariant } from '../types';
|
package/src/math/market.ts
CHANGED
package/src/math/oracles.ts
CHANGED
|
@@ -41,11 +41,10 @@ export function isOracleValid(
|
|
|
41
41
|
.div(BN.max(ONE, oraclePriceData.price))
|
|
42
42
|
.gt(oracleGuardRails.validity.tooVolatileRatio);
|
|
43
43
|
|
|
44
|
-
const isConfidenceTooLarge =
|
|
45
|
-
.add(BN.max(ONE, oraclePriceData.confidence))
|
|
44
|
+
const isConfidenceTooLarge = BN.max(ONE, oraclePriceData.confidence)
|
|
46
45
|
.mul(BID_ASK_SPREAD_PRECISION)
|
|
47
46
|
.div(oraclePriceData.price)
|
|
48
|
-
.gt(
|
|
47
|
+
.gt(oracleGuardRails.validity.confidenceIntervalMaxSize);
|
|
49
48
|
|
|
50
49
|
const oracleIsStale = oraclePriceData.slot
|
|
51
50
|
.sub(new BN(slot))
|
package/src/math/orders.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
PositionDirection,
|
|
9
9
|
} from '../types';
|
|
10
10
|
import { ZERO, TWO } from '../constants/numericConstants';
|
|
11
|
-
import { BN } from '@
|
|
11
|
+
import { BN } from '@coral-xyz/anchor';
|
|
12
12
|
import { OraclePriceData } from '../oracles/types';
|
|
13
13
|
import { getAuctionPrice, isAuctionComplete } from './auction';
|
|
14
14
|
import {
|
package/src/math/repeg.ts
CHANGED
package/src/math/spotBalance.ts
CHANGED
package/src/math/spotMarket.ts
CHANGED
package/src/math/spotPosition.ts
CHANGED
package/src/math/trade.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parsePriceData } from '@pythnetwork/client';
|
|
2
2
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
3
3
|
import { OracleClient, OraclePriceData } from './types';
|
|
4
|
-
import { BN } from '@
|
|
4
|
+
import { BN } from '@coral-xyz/anchor';
|
|
5
5
|
import {
|
|
6
6
|
ONE,
|
|
7
7
|
PRICE_PRECISION,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { OracleClient, OraclePriceData } from './types';
|
|
3
|
-
import { BN } from '@
|
|
3
|
+
import { BN } from '@coral-xyz/anchor';
|
|
4
4
|
import { PRICE_PRECISION } from '../constants/numericConstants';
|
|
5
5
|
|
|
6
6
|
export const QUOTE_ORACLE_PRICE_DATA: OraclePriceData = {
|
package/src/oracles/types.ts
CHANGED
package/src/orderParams.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OptionalOrderParams, OrderTriggerCondition, OrderType } from './types';
|
|
2
|
-
import { BN } from '@
|
|
2
|
+
import { BN } from '@coral-xyz/anchor';
|
|
3
3
|
|
|
4
4
|
export function getLimitOrderParams(
|
|
5
5
|
params: Omit<OptionalOrderParams, 'orderType' | 'marketType'> & { price: BN }
|
|
@@ -2,7 +2,7 @@ import { Connection, PublicKey } from '@solana/web3.js';
|
|
|
2
2
|
import { BulkAccountLoader } from '../accounts/bulkAccountLoader';
|
|
3
3
|
import { Market, Orderbook } from '@project-serum/serum';
|
|
4
4
|
import { SerumMarketSubscriberConfig } from './types';
|
|
5
|
-
import { BN } from '@
|
|
5
|
+
import { BN } from '@coral-xyz/anchor';
|
|
6
6
|
import { PRICE_PRECISION } from '../constants/numericConstants';
|
|
7
7
|
|
|
8
8
|
export class SerumSubscriber {
|
package/src/tokenFaucet.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as anchor from '@
|
|
2
|
-
import { AnchorProvider, Idl, Program } from '@
|
|
1
|
+
import * as anchor from '@coral-xyz/anchor';
|
|
2
|
+
import { AnchorProvider, Idl, Program } from '@coral-xyz/anchor';
|
|
3
3
|
import {
|
|
4
4
|
AccountInfo,
|
|
5
5
|
ASSOCIATED_TOKEN_PROGRAM_ID,
|
package/src/tx/retryTxSender.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
TransactionInstruction,
|
|
15
15
|
AddressLookupTableAccount,
|
|
16
16
|
} from '@solana/web3.js';
|
|
17
|
-
import { AnchorProvider } from '@
|
|
17
|
+
import { AnchorProvider } from '@coral-xyz/anchor';
|
|
18
18
|
import assert from 'assert';
|
|
19
19
|
import bs58 from 'bs58';
|
|
20
20
|
|
package/src/tx/types.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -161,7 +161,8 @@ export class OrderTriggerCondition {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
export class SpotFulfillmentType {
|
|
164
|
-
static readonly
|
|
164
|
+
static readonly EXTERNAL = { external: {} };
|
|
165
|
+
static readonly MATCH = { match: {} };
|
|
165
166
|
}
|
|
166
167
|
|
|
167
168
|
export class SpotFulfillmentStatus {
|
|
@@ -880,6 +881,10 @@ export type OptionalOrderParams = {
|
|
|
880
881
|
[Property in keyof OrderParams]?: OrderParams[Property];
|
|
881
882
|
} & NecessaryOrderParams;
|
|
882
883
|
|
|
884
|
+
export type ModifyOrderParams = {
|
|
885
|
+
[Property in keyof OrderParams]?: OrderParams[Property] | null;
|
|
886
|
+
};
|
|
887
|
+
|
|
883
888
|
export const DefaultOrderParams: OrderParams = {
|
|
884
889
|
orderType: OrderType.MARKET,
|
|
885
890
|
marketType: MarketType.PERP,
|
|
@@ -974,6 +979,8 @@ export type OracleGuardRails = {
|
|
|
974
979
|
export type MarginCategory = 'Initial' | 'Maintenance';
|
|
975
980
|
|
|
976
981
|
export type InsuranceFundStake = {
|
|
982
|
+
costBasis: BN;
|
|
983
|
+
|
|
977
984
|
marketIndex: number;
|
|
978
985
|
authority: PublicKey;
|
|
979
986
|
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
LPRecord,
|
|
17
17
|
InsuranceFundStakeRecord,
|
|
18
18
|
} from '..';
|
|
19
|
-
import { ProgramAccount } from '@
|
|
19
|
+
import { ProgramAccount } from '@coral-xyz/anchor';
|
|
20
20
|
import { AccountInfo, PublicKey } from '@solana/web3.js';
|
|
21
21
|
|
|
22
22
|
import { UserMap } from './userMap';
|