@drift-labs/sdk 2.59.0-beta.5 → 2.60.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/VERSION +1 -1
- package/lib/adminClient.d.ts +2 -0
- package/lib/adminClient.js +22 -0
- package/lib/idl/drift.json +99 -3
- package/lib/math/exchangeStatus.d.ts +2 -1
- package/lib/math/exchangeStatus.js +5 -1
- package/lib/types.d.ts +12 -0
- package/lib/types.js +15 -1
- package/package.json +1 -1
- package/src/adminClient.ts +44 -0
- package/src/idl/drift.json +99 -3
- package/src/math/exchangeStatus.ts +9 -0
- package/src/types.ts +14 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.60.0-beta.0
|
package/lib/adminClient.d.ts
CHANGED
|
@@ -63,7 +63,9 @@ export declare class AdminClient extends DriftClient {
|
|
|
63
63
|
updateSpotMarketBorrowRate(spotMarketIndex: number, optimalUtilization: number, optimalBorrowRate: number, optimalMaxRate: number): Promise<TransactionSignature>;
|
|
64
64
|
updateSpotMarketAssetTier(spotMarketIndex: number, assetTier: AssetTier): Promise<TransactionSignature>;
|
|
65
65
|
updateSpotMarketStatus(spotMarketIndex: number, marketStatus: MarketStatus): Promise<TransactionSignature>;
|
|
66
|
+
updateSpotMarketPausedOperations(spotMarketIndex: number, pausedOperations: number): Promise<TransactionSignature>;
|
|
66
67
|
updatePerpMarketStatus(perpMarketIndex: number, marketStatus: MarketStatus): Promise<TransactionSignature>;
|
|
68
|
+
updatePerpMarketPausedOperations(perpMarketIndex: number, pausedOperations: number): Promise<TransactionSignature>;
|
|
67
69
|
updatePerpMarketContractTier(perpMarketIndex: number, contractTier: ContractTier): Promise<TransactionSignature>;
|
|
68
70
|
updateExchangeStatus(exchangeStatus: ExchangeStatus): Promise<TransactionSignature>;
|
|
69
71
|
updatePerpAuctionDuration(minDuration: BN | number): Promise<TransactionSignature>;
|
package/lib/adminClient.js
CHANGED
|
@@ -716,6 +716,17 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
716
716
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
717
717
|
return txSig;
|
|
718
718
|
}
|
|
719
|
+
async updateSpotMarketPausedOperations(spotMarketIndex, pausedOperations) {
|
|
720
|
+
const tx = await this.program.transaction.updateSpotMarketPausedOperations(pausedOperations, {
|
|
721
|
+
accounts: {
|
|
722
|
+
admin: this.wallet.publicKey,
|
|
723
|
+
state: await this.getStatePublicKey(),
|
|
724
|
+
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
725
|
+
},
|
|
726
|
+
});
|
|
727
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
728
|
+
return txSig;
|
|
729
|
+
}
|
|
719
730
|
async updatePerpMarketStatus(perpMarketIndex, marketStatus) {
|
|
720
731
|
const tx = await this.program.transaction.updatePerpMarketStatus(marketStatus, {
|
|
721
732
|
accounts: {
|
|
@@ -727,6 +738,17 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
727
738
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
728
739
|
return txSig;
|
|
729
740
|
}
|
|
741
|
+
async updatePerpMarketPausedOperations(perpMarketIndex, pausedOperations) {
|
|
742
|
+
const tx = await this.program.transaction.updatePerpMarketPausedOperations(pausedOperations, {
|
|
743
|
+
accounts: {
|
|
744
|
+
admin: this.wallet.publicKey,
|
|
745
|
+
state: await this.getStatePublicKey(),
|
|
746
|
+
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
747
|
+
},
|
|
748
|
+
});
|
|
749
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
750
|
+
return txSig;
|
|
751
|
+
}
|
|
730
752
|
async updatePerpMarketContractTier(perpMarketIndex, contractTier) {
|
|
731
753
|
const tx = await this.program.transaction.updatePerpMarketContractTier(contractTier, {
|
|
732
754
|
accounts: {
|
package/lib/idl/drift.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.59.0",
|
|
3
3
|
"name": "drift",
|
|
4
4
|
"instructions": [
|
|
5
5
|
{
|
|
@@ -3524,6 +3524,32 @@
|
|
|
3524
3524
|
}
|
|
3525
3525
|
]
|
|
3526
3526
|
},
|
|
3527
|
+
{
|
|
3528
|
+
"name": "updateSpotMarketPausedOperations",
|
|
3529
|
+
"accounts": [
|
|
3530
|
+
{
|
|
3531
|
+
"name": "admin",
|
|
3532
|
+
"isMut": false,
|
|
3533
|
+
"isSigner": true
|
|
3534
|
+
},
|
|
3535
|
+
{
|
|
3536
|
+
"name": "state",
|
|
3537
|
+
"isMut": false,
|
|
3538
|
+
"isSigner": false
|
|
3539
|
+
},
|
|
3540
|
+
{
|
|
3541
|
+
"name": "spotMarket",
|
|
3542
|
+
"isMut": true,
|
|
3543
|
+
"isSigner": false
|
|
3544
|
+
}
|
|
3545
|
+
],
|
|
3546
|
+
"args": [
|
|
3547
|
+
{
|
|
3548
|
+
"name": "pausedOperations",
|
|
3549
|
+
"type": "u8"
|
|
3550
|
+
}
|
|
3551
|
+
]
|
|
3552
|
+
},
|
|
3527
3553
|
{
|
|
3528
3554
|
"name": "updateSpotMarketAssetTier",
|
|
3529
3555
|
"accounts": [
|
|
@@ -3858,6 +3884,32 @@
|
|
|
3858
3884
|
}
|
|
3859
3885
|
]
|
|
3860
3886
|
},
|
|
3887
|
+
{
|
|
3888
|
+
"name": "updatePerpMarketPausedOperations",
|
|
3889
|
+
"accounts": [
|
|
3890
|
+
{
|
|
3891
|
+
"name": "admin",
|
|
3892
|
+
"isMut": false,
|
|
3893
|
+
"isSigner": true
|
|
3894
|
+
},
|
|
3895
|
+
{
|
|
3896
|
+
"name": "state",
|
|
3897
|
+
"isMut": false,
|
|
3898
|
+
"isSigner": false
|
|
3899
|
+
},
|
|
3900
|
+
{
|
|
3901
|
+
"name": "perpMarket",
|
|
3902
|
+
"isMut": true,
|
|
3903
|
+
"isSigner": false
|
|
3904
|
+
}
|
|
3905
|
+
],
|
|
3906
|
+
"args": [
|
|
3907
|
+
{
|
|
3908
|
+
"name": "pausedOperations",
|
|
3909
|
+
"type": "u8"
|
|
3910
|
+
}
|
|
3911
|
+
]
|
|
3912
|
+
},
|
|
3861
3913
|
{
|
|
3862
3914
|
"name": "updatePerpMarketContractTier",
|
|
3863
3915
|
"accounts": [
|
|
@@ -5258,7 +5310,7 @@
|
|
|
5258
5310
|
}
|
|
5259
5311
|
},
|
|
5260
5312
|
{
|
|
5261
|
-
"name": "
|
|
5313
|
+
"name": "pausedOperations",
|
|
5262
5314
|
"type": "u8"
|
|
5263
5315
|
},
|
|
5264
5316
|
{
|
|
@@ -5671,12 +5723,16 @@
|
|
|
5671
5723
|
"defined": "AssetTier"
|
|
5672
5724
|
}
|
|
5673
5725
|
},
|
|
5726
|
+
{
|
|
5727
|
+
"name": "pausedOperations",
|
|
5728
|
+
"type": "u8"
|
|
5729
|
+
},
|
|
5674
5730
|
{
|
|
5675
5731
|
"name": "padding1",
|
|
5676
5732
|
"type": {
|
|
5677
5733
|
"array": [
|
|
5678
5734
|
"u8",
|
|
5679
|
-
|
|
5735
|
+
5
|
|
5680
5736
|
]
|
|
5681
5737
|
}
|
|
5682
5738
|
},
|
|
@@ -8642,6 +8698,46 @@
|
|
|
8642
8698
|
]
|
|
8643
8699
|
}
|
|
8644
8700
|
},
|
|
8701
|
+
{
|
|
8702
|
+
"name": "PerpOperation",
|
|
8703
|
+
"type": {
|
|
8704
|
+
"kind": "enum",
|
|
8705
|
+
"variants": [
|
|
8706
|
+
{
|
|
8707
|
+
"name": "UpdateFunding"
|
|
8708
|
+
},
|
|
8709
|
+
{
|
|
8710
|
+
"name": "AmmFill"
|
|
8711
|
+
},
|
|
8712
|
+
{
|
|
8713
|
+
"name": "Fill"
|
|
8714
|
+
},
|
|
8715
|
+
{
|
|
8716
|
+
"name": "SettlePnl"
|
|
8717
|
+
},
|
|
8718
|
+
{
|
|
8719
|
+
"name": "SettlePnlWithPosition"
|
|
8720
|
+
}
|
|
8721
|
+
]
|
|
8722
|
+
}
|
|
8723
|
+
},
|
|
8724
|
+
{
|
|
8725
|
+
"name": "SpotOperation",
|
|
8726
|
+
"type": {
|
|
8727
|
+
"kind": "enum",
|
|
8728
|
+
"variants": [
|
|
8729
|
+
{
|
|
8730
|
+
"name": "UpdateCumulativeInterest"
|
|
8731
|
+
},
|
|
8732
|
+
{
|
|
8733
|
+
"name": "Fill"
|
|
8734
|
+
},
|
|
8735
|
+
{
|
|
8736
|
+
"name": "Withdraw"
|
|
8737
|
+
}
|
|
8738
|
+
]
|
|
8739
|
+
}
|
|
8740
|
+
},
|
|
8645
8741
|
{
|
|
8646
8742
|
"name": "MarketStatus",
|
|
8647
8743
|
"type": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { PerpMarketAccount, SpotMarketAccount, StateAccount } from '../types';
|
|
1
|
+
import { PerpMarketAccount, PerpOperation, SpotMarketAccount, SpotOperation, StateAccount } from '../types';
|
|
2
2
|
export declare function exchangePaused(state: StateAccount): boolean;
|
|
3
3
|
export declare function fillPaused(state: StateAccount, market: PerpMarketAccount | SpotMarketAccount): boolean;
|
|
4
4
|
export declare function ammPaused(state: StateAccount, market: PerpMarketAccount | SpotMarketAccount): boolean;
|
|
5
|
+
export declare function isOperationPaused(pausedOperations: number, operation: PerpOperation | SpotOperation): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ammPaused = exports.fillPaused = exports.exchangePaused = void 0;
|
|
3
|
+
exports.isOperationPaused = exports.ammPaused = exports.fillPaused = exports.exchangePaused = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
function exchangePaused(state) {
|
|
6
6
|
return state.exchangeStatus !== types_1.ExchangeStatus.ACTIVE;
|
|
@@ -18,3 +18,7 @@ function ammPaused(state, market) {
|
|
|
18
18
|
(0, types_1.isOneOfVariant)(market.status, ['paused', 'ammPaused']));
|
|
19
19
|
}
|
|
20
20
|
exports.ammPaused = ammPaused;
|
|
21
|
+
function isOperationPaused(pausedOperations, operation) {
|
|
22
|
+
return (pausedOperations & operation) > 0;
|
|
23
|
+
}
|
|
24
|
+
exports.isOperationPaused = isOperationPaused;
|
package/lib/types.d.ts
CHANGED
|
@@ -41,6 +41,18 @@ export declare class MarketStatus {
|
|
|
41
41
|
delisted: {};
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
+
export declare enum PerpOperation {
|
|
45
|
+
UPDATE_FUNDING = 1,
|
|
46
|
+
AMM_FILL = 2,
|
|
47
|
+
FILL = 4,
|
|
48
|
+
SETTLE_PNL = 8,
|
|
49
|
+
SETTLE_PNL_WITH_POSITION = 16
|
|
50
|
+
}
|
|
51
|
+
export declare enum SpotOperation {
|
|
52
|
+
UPDATE_CUMULATIVE_INTEREST = 1,
|
|
53
|
+
FILL = 2,
|
|
54
|
+
WITHDRAW = 4
|
|
55
|
+
}
|
|
44
56
|
export declare enum UserStatus {
|
|
45
57
|
BEING_LIQUIDATED = 1,
|
|
46
58
|
BANKRUPT = 2,
|
package/lib/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SwapReduceOnly = exports.DefaultOrderParams = exports.ModifyOrderPolicy = exports.PostOnlyParams = exports.LiquidationType = exports.LPAction = exports.TradeSide = exports.getVariant = exports.isOneOfVariant = exports.isVariant = exports.StakeAction = exports.SpotFulfillmentConfigStatus = exports.SettlePnlExplanation = exports.DepositExplanation = exports.SpotFulfillmentStatus = exports.SpotFulfillmentType = exports.OrderTriggerCondition = exports.OrderActionExplanation = exports.OrderAction = exports.OrderStatus = exports.MarketType = exports.OrderType = exports.OracleSource = exports.DepositDirection = exports.PositionDirection = exports.SpotBalanceType = exports.SwapDirection = exports.AssetTier = exports.ContractTier = exports.ContractType = exports.UserStatus = exports.MarketStatus = exports.ExchangeStatus = void 0;
|
|
3
|
+
exports.SwapReduceOnly = exports.DefaultOrderParams = exports.ModifyOrderPolicy = exports.PostOnlyParams = exports.LiquidationType = exports.LPAction = exports.TradeSide = exports.getVariant = exports.isOneOfVariant = exports.isVariant = exports.StakeAction = exports.SpotFulfillmentConfigStatus = exports.SettlePnlExplanation = exports.DepositExplanation = exports.SpotFulfillmentStatus = exports.SpotFulfillmentType = exports.OrderTriggerCondition = exports.OrderActionExplanation = exports.OrderAction = exports.OrderStatus = exports.MarketType = exports.OrderType = exports.OracleSource = exports.DepositDirection = exports.PositionDirection = exports.SpotBalanceType = exports.SwapDirection = exports.AssetTier = exports.ContractTier = exports.ContractType = exports.UserStatus = exports.SpotOperation = exports.PerpOperation = exports.MarketStatus = exports.ExchangeStatus = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
// # Utility Types / Enums / Constants
|
|
6
6
|
var ExchangeStatus;
|
|
@@ -27,6 +27,20 @@ MarketStatus.WITHDRAW_PAUSED = { withdrawPaused: {} };
|
|
|
27
27
|
MarketStatus.REDUCE_ONLY = { reduceOnly: {} };
|
|
28
28
|
MarketStatus.SETTLEMENT = { settlement: {} };
|
|
29
29
|
MarketStatus.DELISTED = { delisted: {} };
|
|
30
|
+
var PerpOperation;
|
|
31
|
+
(function (PerpOperation) {
|
|
32
|
+
PerpOperation[PerpOperation["UPDATE_FUNDING"] = 1] = "UPDATE_FUNDING";
|
|
33
|
+
PerpOperation[PerpOperation["AMM_FILL"] = 2] = "AMM_FILL";
|
|
34
|
+
PerpOperation[PerpOperation["FILL"] = 4] = "FILL";
|
|
35
|
+
PerpOperation[PerpOperation["SETTLE_PNL"] = 8] = "SETTLE_PNL";
|
|
36
|
+
PerpOperation[PerpOperation["SETTLE_PNL_WITH_POSITION"] = 16] = "SETTLE_PNL_WITH_POSITION";
|
|
37
|
+
})(PerpOperation = exports.PerpOperation || (exports.PerpOperation = {}));
|
|
38
|
+
var SpotOperation;
|
|
39
|
+
(function (SpotOperation) {
|
|
40
|
+
SpotOperation[SpotOperation["UPDATE_CUMULATIVE_INTEREST"] = 1] = "UPDATE_CUMULATIVE_INTEREST";
|
|
41
|
+
SpotOperation[SpotOperation["FILL"] = 2] = "FILL";
|
|
42
|
+
SpotOperation[SpotOperation["WITHDRAW"] = 4] = "WITHDRAW";
|
|
43
|
+
})(SpotOperation = exports.SpotOperation || (exports.SpotOperation = {}));
|
|
30
44
|
var UserStatus;
|
|
31
45
|
(function (UserStatus) {
|
|
32
46
|
UserStatus[UserStatus["BEING_LIQUIDATED"] = 1] = "BEING_LIQUIDATED";
|
package/package.json
CHANGED
package/src/adminClient.ts
CHANGED
|
@@ -1361,6 +1361,28 @@ export class AdminClient extends DriftClient {
|
|
|
1361
1361
|
return txSig;
|
|
1362
1362
|
}
|
|
1363
1363
|
|
|
1364
|
+
public async updateSpotMarketPausedOperations(
|
|
1365
|
+
spotMarketIndex: number,
|
|
1366
|
+
pausedOperations: number
|
|
1367
|
+
): Promise<TransactionSignature> {
|
|
1368
|
+
const tx = await this.program.transaction.updateSpotMarketPausedOperations(
|
|
1369
|
+
pausedOperations,
|
|
1370
|
+
{
|
|
1371
|
+
accounts: {
|
|
1372
|
+
admin: this.wallet.publicKey,
|
|
1373
|
+
state: await this.getStatePublicKey(),
|
|
1374
|
+
spotMarket: await getSpotMarketPublicKey(
|
|
1375
|
+
this.program.programId,
|
|
1376
|
+
spotMarketIndex
|
|
1377
|
+
),
|
|
1378
|
+
},
|
|
1379
|
+
}
|
|
1380
|
+
);
|
|
1381
|
+
|
|
1382
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1383
|
+
return txSig;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1364
1386
|
public async updatePerpMarketStatus(
|
|
1365
1387
|
perpMarketIndex: number,
|
|
1366
1388
|
marketStatus: MarketStatus
|
|
@@ -1383,6 +1405,28 @@ export class AdminClient extends DriftClient {
|
|
|
1383
1405
|
return txSig;
|
|
1384
1406
|
}
|
|
1385
1407
|
|
|
1408
|
+
public async updatePerpMarketPausedOperations(
|
|
1409
|
+
perpMarketIndex: number,
|
|
1410
|
+
pausedOperations: number
|
|
1411
|
+
): Promise<TransactionSignature> {
|
|
1412
|
+
const tx = await this.program.transaction.updatePerpMarketPausedOperations(
|
|
1413
|
+
pausedOperations,
|
|
1414
|
+
{
|
|
1415
|
+
accounts: {
|
|
1416
|
+
admin: this.wallet.publicKey,
|
|
1417
|
+
state: await this.getStatePublicKey(),
|
|
1418
|
+
perpMarket: await getPerpMarketPublicKey(
|
|
1419
|
+
this.program.programId,
|
|
1420
|
+
perpMarketIndex
|
|
1421
|
+
),
|
|
1422
|
+
},
|
|
1423
|
+
}
|
|
1424
|
+
);
|
|
1425
|
+
|
|
1426
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1427
|
+
return txSig;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1386
1430
|
public async updatePerpMarketContractTier(
|
|
1387
1431
|
perpMarketIndex: number,
|
|
1388
1432
|
contractTier: ContractTier
|
package/src/idl/drift.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.59.0",
|
|
3
3
|
"name": "drift",
|
|
4
4
|
"instructions": [
|
|
5
5
|
{
|
|
@@ -3524,6 +3524,32 @@
|
|
|
3524
3524
|
}
|
|
3525
3525
|
]
|
|
3526
3526
|
},
|
|
3527
|
+
{
|
|
3528
|
+
"name": "updateSpotMarketPausedOperations",
|
|
3529
|
+
"accounts": [
|
|
3530
|
+
{
|
|
3531
|
+
"name": "admin",
|
|
3532
|
+
"isMut": false,
|
|
3533
|
+
"isSigner": true
|
|
3534
|
+
},
|
|
3535
|
+
{
|
|
3536
|
+
"name": "state",
|
|
3537
|
+
"isMut": false,
|
|
3538
|
+
"isSigner": false
|
|
3539
|
+
},
|
|
3540
|
+
{
|
|
3541
|
+
"name": "spotMarket",
|
|
3542
|
+
"isMut": true,
|
|
3543
|
+
"isSigner": false
|
|
3544
|
+
}
|
|
3545
|
+
],
|
|
3546
|
+
"args": [
|
|
3547
|
+
{
|
|
3548
|
+
"name": "pausedOperations",
|
|
3549
|
+
"type": "u8"
|
|
3550
|
+
}
|
|
3551
|
+
]
|
|
3552
|
+
},
|
|
3527
3553
|
{
|
|
3528
3554
|
"name": "updateSpotMarketAssetTier",
|
|
3529
3555
|
"accounts": [
|
|
@@ -3858,6 +3884,32 @@
|
|
|
3858
3884
|
}
|
|
3859
3885
|
]
|
|
3860
3886
|
},
|
|
3887
|
+
{
|
|
3888
|
+
"name": "updatePerpMarketPausedOperations",
|
|
3889
|
+
"accounts": [
|
|
3890
|
+
{
|
|
3891
|
+
"name": "admin",
|
|
3892
|
+
"isMut": false,
|
|
3893
|
+
"isSigner": true
|
|
3894
|
+
},
|
|
3895
|
+
{
|
|
3896
|
+
"name": "state",
|
|
3897
|
+
"isMut": false,
|
|
3898
|
+
"isSigner": false
|
|
3899
|
+
},
|
|
3900
|
+
{
|
|
3901
|
+
"name": "perpMarket",
|
|
3902
|
+
"isMut": true,
|
|
3903
|
+
"isSigner": false
|
|
3904
|
+
}
|
|
3905
|
+
],
|
|
3906
|
+
"args": [
|
|
3907
|
+
{
|
|
3908
|
+
"name": "pausedOperations",
|
|
3909
|
+
"type": "u8"
|
|
3910
|
+
}
|
|
3911
|
+
]
|
|
3912
|
+
},
|
|
3861
3913
|
{
|
|
3862
3914
|
"name": "updatePerpMarketContractTier",
|
|
3863
3915
|
"accounts": [
|
|
@@ -5258,7 +5310,7 @@
|
|
|
5258
5310
|
}
|
|
5259
5311
|
},
|
|
5260
5312
|
{
|
|
5261
|
-
"name": "
|
|
5313
|
+
"name": "pausedOperations",
|
|
5262
5314
|
"type": "u8"
|
|
5263
5315
|
},
|
|
5264
5316
|
{
|
|
@@ -5671,12 +5723,16 @@
|
|
|
5671
5723
|
"defined": "AssetTier"
|
|
5672
5724
|
}
|
|
5673
5725
|
},
|
|
5726
|
+
{
|
|
5727
|
+
"name": "pausedOperations",
|
|
5728
|
+
"type": "u8"
|
|
5729
|
+
},
|
|
5674
5730
|
{
|
|
5675
5731
|
"name": "padding1",
|
|
5676
5732
|
"type": {
|
|
5677
5733
|
"array": [
|
|
5678
5734
|
"u8",
|
|
5679
|
-
|
|
5735
|
+
5
|
|
5680
5736
|
]
|
|
5681
5737
|
}
|
|
5682
5738
|
},
|
|
@@ -8642,6 +8698,46 @@
|
|
|
8642
8698
|
]
|
|
8643
8699
|
}
|
|
8644
8700
|
},
|
|
8701
|
+
{
|
|
8702
|
+
"name": "PerpOperation",
|
|
8703
|
+
"type": {
|
|
8704
|
+
"kind": "enum",
|
|
8705
|
+
"variants": [
|
|
8706
|
+
{
|
|
8707
|
+
"name": "UpdateFunding"
|
|
8708
|
+
},
|
|
8709
|
+
{
|
|
8710
|
+
"name": "AmmFill"
|
|
8711
|
+
},
|
|
8712
|
+
{
|
|
8713
|
+
"name": "Fill"
|
|
8714
|
+
},
|
|
8715
|
+
{
|
|
8716
|
+
"name": "SettlePnl"
|
|
8717
|
+
},
|
|
8718
|
+
{
|
|
8719
|
+
"name": "SettlePnlWithPosition"
|
|
8720
|
+
}
|
|
8721
|
+
]
|
|
8722
|
+
}
|
|
8723
|
+
},
|
|
8724
|
+
{
|
|
8725
|
+
"name": "SpotOperation",
|
|
8726
|
+
"type": {
|
|
8727
|
+
"kind": "enum",
|
|
8728
|
+
"variants": [
|
|
8729
|
+
{
|
|
8730
|
+
"name": "UpdateCumulativeInterest"
|
|
8731
|
+
},
|
|
8732
|
+
{
|
|
8733
|
+
"name": "Fill"
|
|
8734
|
+
},
|
|
8735
|
+
{
|
|
8736
|
+
"name": "Withdraw"
|
|
8737
|
+
}
|
|
8738
|
+
]
|
|
8739
|
+
}
|
|
8740
|
+
},
|
|
8645
8741
|
{
|
|
8646
8742
|
"name": "MarketStatus",
|
|
8647
8743
|
"type": {
|
|
@@ -2,7 +2,9 @@ import {
|
|
|
2
2
|
ExchangeStatus,
|
|
3
3
|
isOneOfVariant,
|
|
4
4
|
PerpMarketAccount,
|
|
5
|
+
PerpOperation,
|
|
5
6
|
SpotMarketAccount,
|
|
7
|
+
SpotOperation,
|
|
6
8
|
StateAccount,
|
|
7
9
|
} from '../types';
|
|
8
10
|
|
|
@@ -31,3 +33,10 @@ export function ammPaused(
|
|
|
31
33
|
isOneOfVariant(market.status, ['paused', 'ammPaused'])
|
|
32
34
|
);
|
|
33
35
|
}
|
|
36
|
+
|
|
37
|
+
export function isOperationPaused(
|
|
38
|
+
pausedOperations: number,
|
|
39
|
+
operation: PerpOperation | SpotOperation
|
|
40
|
+
): boolean {
|
|
41
|
+
return (pausedOperations & operation) > 0;
|
|
42
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -27,6 +27,20 @@ export class MarketStatus {
|
|
|
27
27
|
static readonly DELISTED = { delisted: {} };
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
export enum PerpOperation {
|
|
31
|
+
UPDATE_FUNDING = 1,
|
|
32
|
+
AMM_FILL = 2,
|
|
33
|
+
FILL = 4,
|
|
34
|
+
SETTLE_PNL = 8,
|
|
35
|
+
SETTLE_PNL_WITH_POSITION = 16,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export enum SpotOperation {
|
|
39
|
+
UPDATE_CUMULATIVE_INTEREST = 1,
|
|
40
|
+
FILL = 2,
|
|
41
|
+
WITHDRAW = 4,
|
|
42
|
+
}
|
|
43
|
+
|
|
30
44
|
export enum UserStatus {
|
|
31
45
|
BEING_LIQUIDATED = 1,
|
|
32
46
|
BANKRUPT = 2,
|