@drift-labs/sdk 0.2.0-master.40 → 0.2.0-master.42

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/src/dlob/DLOB.ts CHANGED
@@ -22,8 +22,9 @@ import {
22
22
  StateAccount,
23
23
  isMarketOrder,
24
24
  isLimitOrder,
25
- hasLimitPrice,
26
25
  getOptionalLimitPrice,
26
+ mustBeTriggered,
27
+ isTriggered,
27
28
  } from '..';
28
29
  import { PublicKey } from '@solana/web3.js';
29
30
  import { DLOBNode, DLOBNodeType, TriggerOrderNode } from '..';
@@ -253,8 +254,7 @@ export class DLOB {
253
254
 
254
255
  public getListForOrder(order: Order): NodeList<any> | undefined {
255
256
  const isInactiveTriggerOrder =
256
- isOneOfVariant(order.orderType, ['triggerMarket', 'triggerLimit']) &&
257
- !order.triggered;
257
+ mustBeTriggered(order) && !isTriggered(order);
258
258
 
259
259
  let type: DLOBNodeType;
260
260
  if (isInactiveTriggerOrder) {
@@ -651,10 +651,7 @@ export class DLOB {
651
651
  const user = this.userMap.get(
652
652
  bestGenerator.next.value.userAccount.toString()
653
653
  );
654
- if (
655
- user?.getUserAccount().isBeingLiquidated ||
656
- user?.getUserAccount().isBankrupt
657
- ) {
654
+ if (user?.isBeingLiquidated()) {
658
655
  bestGenerator.next = bestGenerator.generator.next();
659
656
  continue;
660
657
  }
@@ -740,10 +737,7 @@ export class DLOB {
740
737
  const user = this.userMap.get(
741
738
  bestGenerator.next.value.userAccount.toString()
742
739
  );
743
- if (
744
- user?.getUserAccount().isBeingLiquidated ||
745
- user?.getUserAccount().isBankrupt
746
- ) {
740
+ if (user?.isBeingLiquidated()) {
747
741
  bestGenerator.next = bestGenerator.generator.next();
748
742
  continue;
749
743
  }
@@ -804,8 +798,11 @@ export class DLOB {
804
798
  bidNode
805
799
  );
806
800
 
807
- // If order doesn't have limit price, cant be maker
808
- if (!hasLimitPrice(makerNode.order, slot)) {
801
+ // If maker is market order and auction is complete, cant be maker
802
+ if (
803
+ isMarketOrder(makerNode.order) &&
804
+ isAuctionComplete(makerNode.order, slot)
805
+ ) {
809
806
  return {
810
807
  crossingNodes: [],
811
808
  exhaustedSide: makerSide,
@@ -586,6 +586,24 @@ export class DriftClient {
586
586
  );
587
587
  }
588
588
 
589
+ public async getUserAccountsForAuthority(
590
+ authority: PublicKey
591
+ ): Promise<UserAccount[]> {
592
+ const programAccounts = await this.program.account.user.all([
593
+ {
594
+ memcmp: {
595
+ offset: 8,
596
+ /** data to match, as base-58 encoded string and limited to less than 129 bytes */
597
+ bytes: bs58.encode(authority.toBuffer()),
598
+ },
599
+ },
600
+ ]);
601
+
602
+ return programAccounts.map(
603
+ (programAccount) => programAccount.account as UserAccount
604
+ );
605
+ }
606
+
589
607
  public async deleteUser(subAccountId = 0): Promise<TransactionSignature> {
590
608
  const userAccountPublicKey = getUserAccountPublicKeySync(
591
609
  this.program.programId,
@@ -2933,7 +2951,8 @@ export class DriftClient {
2933
2951
  userAccount: UserAccount,
2934
2952
  assetMarketIndex: number,
2935
2953
  liabilityMarketIndex: number,
2936
- maxLiabilityTransfer: BN
2954
+ maxLiabilityTransfer: BN,
2955
+ limitPrice?: BN
2937
2956
  ): Promise<TransactionSignature> {
2938
2957
  const { txSig, slot } = await this.txSender.send(
2939
2958
  wrapInTx(
@@ -2942,7 +2961,8 @@ export class DriftClient {
2942
2961
  userAccount,
2943
2962
  assetMarketIndex,
2944
2963
  liabilityMarketIndex,
2945
- maxLiabilityTransfer
2964
+ maxLiabilityTransfer,
2965
+ limitPrice
2946
2966
  )
2947
2967
  ),
2948
2968
  [],
@@ -2958,7 +2978,8 @@ export class DriftClient {
2958
2978
  userAccount: UserAccount,
2959
2979
  assetMarketIndex: number,
2960
2980
  liabilityMarketIndex: number,
2961
- maxLiabilityTransfer: BN
2981
+ maxLiabilityTransfer: BN,
2982
+ limitPrice?: BN
2962
2983
  ): Promise<TransactionInstruction> {
2963
2984
  const userStatsPublicKey = getUserStatsAccountPublicKey(
2964
2985
  this.program.programId,
@@ -2978,6 +2999,7 @@ export class DriftClient {
2978
2999
  assetMarketIndex,
2979
3000
  liabilityMarketIndex,
2980
3001
  maxLiabilityTransfer,
3002
+ limitPrice || null,
2981
3003
  {
2982
3004
  accounts: {
2983
3005
  state: await this.getStatePublicKey(),
@@ -2997,7 +3019,8 @@ export class DriftClient {
2997
3019
  userAccount: UserAccount,
2998
3020
  perpMarketIndex: number,
2999
3021
  liabilityMarketIndex: number,
3000
- maxLiabilityTransfer: BN
3022
+ maxLiabilityTransfer: BN,
3023
+ limitPrice?: BN
3001
3024
  ): Promise<TransactionSignature> {
3002
3025
  const { txSig, slot } = await this.txSender.send(
3003
3026
  wrapInTx(
@@ -3006,7 +3029,8 @@ export class DriftClient {
3006
3029
  userAccount,
3007
3030
  perpMarketIndex,
3008
3031
  liabilityMarketIndex,
3009
- maxLiabilityTransfer
3032
+ maxLiabilityTransfer,
3033
+ limitPrice
3010
3034
  )
3011
3035
  ),
3012
3036
  [],
@@ -3022,7 +3046,8 @@ export class DriftClient {
3022
3046
  userAccount: UserAccount,
3023
3047
  perpMarketIndex: number,
3024
3048
  liabilityMarketIndex: number,
3025
- maxLiabilityTransfer: BN
3049
+ maxLiabilityTransfer: BN,
3050
+ limitPrice?: BN
3026
3051
  ): Promise<TransactionInstruction> {
3027
3052
  const userStatsPublicKey = getUserStatsAccountPublicKey(
3028
3053
  this.program.programId,
@@ -3042,6 +3067,7 @@ export class DriftClient {
3042
3067
  perpMarketIndex,
3043
3068
  liabilityMarketIndex,
3044
3069
  maxLiabilityTransfer,
3070
+ limitPrice || null,
3045
3071
  {
3046
3072
  accounts: {
3047
3073
  state: await this.getStatePublicKey(),
@@ -3061,7 +3087,8 @@ export class DriftClient {
3061
3087
  userAccount: UserAccount,
3062
3088
  perpMarketIndex: number,
3063
3089
  assetMarketIndex: number,
3064
- maxPnlTransfer: BN
3090
+ maxPnlTransfer: BN,
3091
+ limitPrice?: BN
3065
3092
  ): Promise<TransactionSignature> {
3066
3093
  const { txSig, slot } = await this.txSender.send(
3067
3094
  wrapInTx(
@@ -3070,7 +3097,8 @@ export class DriftClient {
3070
3097
  userAccount,
3071
3098
  perpMarketIndex,
3072
3099
  assetMarketIndex,
3073
- maxPnlTransfer
3100
+ maxPnlTransfer,
3101
+ limitPrice
3074
3102
  )
3075
3103
  ),
3076
3104
  [],
@@ -3086,7 +3114,8 @@ export class DriftClient {
3086
3114
  userAccount: UserAccount,
3087
3115
  perpMarketIndex: number,
3088
3116
  assetMarketIndex: number,
3089
- maxPnlTransfer: BN
3117
+ maxPnlTransfer: BN,
3118
+ limitPrice?: BN
3090
3119
  ): Promise<TransactionInstruction> {
3091
3120
  const userStatsPublicKey = getUserStatsAccountPublicKey(
3092
3121
  this.program.programId,
@@ -3106,6 +3135,7 @@ export class DriftClient {
3106
3135
  perpMarketIndex,
3107
3136
  assetMarketIndex,
3108
3137
  maxPnlTransfer,
3138
+ limitPrice || null,
3109
3139
  {
3110
3140
  accounts: {
3111
3141
  state: await this.getStatePublicKey(),
@@ -11,6 +11,8 @@ import {
11
11
  LPRecord,
12
12
  InsuranceFundRecord,
13
13
  SpotInterestRecord,
14
+ InsuranceFundStakeRecord,
15
+ CurveRecord,
14
16
  } from '../index';
15
17
 
16
18
  export type EventSubscriptionOptions = {
@@ -39,6 +41,8 @@ export const DefaultEventSubscriptionOptions: EventSubscriptionOptions = {
39
41
  'LPRecord',
40
42
  'InsuranceFundRecord',
41
43
  'SpotInterestRecord',
44
+ 'InsuranceFundStakeRecord',
45
+ 'CurveRecord',
42
46
  ],
43
47
  maxEventsPerType: 4096,
44
48
  orderBy: 'blockchain',
@@ -77,6 +81,8 @@ export type EventMap = {
77
81
  LPRecord: Event<LPRecord>;
78
82
  InsuranceFundRecord: Event<InsuranceFundRecord>;
79
83
  SpotInterestRecord: Event<SpotInterestRecord>;
84
+ InsuranceFundStakeRecord: Event<InsuranceFundStakeRecord>;
85
+ CurveRecord: Event<CurveRecord>;
80
86
  };
81
87
 
82
88
  export type EventType = keyof EventMap;
@@ -17,7 +17,7 @@
17
17
  },
18
18
  {
19
19
  "name": "state",
20
- "isMut": false,
20
+ "isMut": true,
21
21
  "isSigner": false
22
22
  },
23
23
  {
@@ -773,7 +773,7 @@
773
773
  },
774
774
  {
775
775
  "name": "state",
776
- "isMut": false,
776
+ "isMut": true,
777
777
  "isSigner": false
778
778
  },
779
779
  {
@@ -1107,6 +1107,12 @@
1107
1107
  {
1108
1108
  "name": "liquidatorMaxLiabilityTransfer",
1109
1109
  "type": "u128"
1110
+ },
1111
+ {
1112
+ "name": "limitPrice",
1113
+ "type": {
1114
+ "option": "u64"
1115
+ }
1110
1116
  }
1111
1117
  ]
1112
1118
  },
@@ -1156,6 +1162,12 @@
1156
1162
  {
1157
1163
  "name": "liquidatorMaxLiabilityTransfer",
1158
1164
  "type": "u128"
1165
+ },
1166
+ {
1167
+ "name": "limitPrice",
1168
+ "type": {
1169
+ "option": "u64"
1170
+ }
1159
1171
  }
1160
1172
  ]
1161
1173
  },
@@ -1205,6 +1217,12 @@
1205
1217
  {
1206
1218
  "name": "liquidatorMaxPnlTransfer",
1207
1219
  "type": "u128"
1220
+ },
1221
+ {
1222
+ "name": "limitPrice",
1223
+ "type": {
1224
+ "option": "u64"
1225
+ }
1208
1226
  }
1209
1227
  ]
1210
1228
  },
@@ -3712,7 +3730,7 @@
3712
3730
  "type": {
3713
3731
  "array": [
3714
3732
  "u8",
3715
- 6
3733
+ 14
3716
3734
  ]
3717
3735
  }
3718
3736
  }
@@ -3846,7 +3864,7 @@
3846
3864
  "type": {
3847
3865
  "array": [
3848
3866
  "u8",
3849
- 3
3867
+ 51
3850
3868
  ]
3851
3869
  }
3852
3870
  }
@@ -3933,6 +3951,14 @@
3933
3951
  "name": "cumulativeBorrowInterest",
3934
3952
  "type": "u128"
3935
3953
  },
3954
+ {
3955
+ "name": "totalSocialLoss",
3956
+ "type": "u128"
3957
+ },
3958
+ {
3959
+ "name": "totalQuoteSocialLoss",
3960
+ "type": "u128"
3961
+ },
3936
3962
  {
3937
3963
  "name": "withdrawGuardThreshold",
3938
3964
  "type": "u64"
@@ -4064,7 +4090,7 @@
4064
4090
  "type": {
4065
4091
  "array": [
4066
4092
  "u8",
4067
- 6
4093
+ 86
4068
4094
  ]
4069
4095
  }
4070
4096
  }
@@ -4195,6 +4221,10 @@
4195
4221
  "name": "numberOfAuthorities",
4196
4222
  "type": "u64"
4197
4223
  },
4224
+ {
4225
+ "name": "numberOfSubAccounts",
4226
+ "type": "u64"
4227
+ },
4198
4228
  {
4199
4229
  "name": "lpCooldownTime",
4200
4230
  "type": "u64"
@@ -4242,7 +4272,7 @@
4242
4272
  "type": {
4243
4273
  "array": [
4244
4274
  "u8",
4245
- 1
4275
+ 17
4246
4276
  ]
4247
4277
  }
4248
4278
  }
@@ -4316,6 +4346,10 @@
4316
4346
  "name": "totalWithdraws",
4317
4347
  "type": "u64"
4318
4348
  },
4349
+ {
4350
+ "name": "totalSocialLoss",
4351
+ "type": "u64"
4352
+ },
4319
4353
  {
4320
4354
  "name": "settledPerpPnl",
4321
4355
  "type": "i64"
@@ -4328,6 +4362,14 @@
4328
4362
  "name": "cumulativePerpFunding",
4329
4363
  "type": "i64"
4330
4364
  },
4365
+ {
4366
+ "name": "liquidationMarginFreed",
4367
+ "type": "u64"
4368
+ },
4369
+ {
4370
+ "name": "liquidationStartTs",
4371
+ "type": "i64"
4372
+ },
4331
4373
  {
4332
4374
  "name": "nextOrderId",
4333
4375
  "type": "u32"
@@ -4345,12 +4387,10 @@
4345
4387
  "type": "u16"
4346
4388
  },
4347
4389
  {
4348
- "name": "isBeingLiquidated",
4349
- "type": "bool"
4350
- },
4351
- {
4352
- "name": "isBankrupt",
4353
- "type": "bool"
4390
+ "name": "status",
4391
+ "type": {
4392
+ "defined": "UserStatus"
4393
+ }
4354
4394
  },
4355
4395
  {
4356
4396
  "name": "isMarginTradingEnabled",
@@ -4361,7 +4401,7 @@
4361
4401
  "type": {
4362
4402
  "array": [
4363
4403
  "u8",
4364
- 1
4404
+ 26
4365
4405
  ]
4366
4406
  }
4367
4407
  }
@@ -4424,7 +4464,7 @@
4424
4464
  "type": "u16"
4425
4465
  },
4426
4466
  {
4427
- "name": "maxSubAccountId",
4467
+ "name": "numberOfSubAccountsCreated",
4428
4468
  "type": "u16"
4429
4469
  },
4430
4470
  {
@@ -4436,7 +4476,7 @@
4436
4476
  "type": {
4437
4477
  "array": [
4438
4478
  "u8",
4439
- 3
4479
+ 51
4440
4480
  ]
4441
4481
  }
4442
4482
  }
@@ -4578,6 +4618,10 @@
4578
4618
  "name": "liquidatorOrderId",
4579
4619
  "type": "u32"
4580
4620
  },
4621
+ {
4622
+ "name": "liquidatorFee",
4623
+ "type": "u64"
4624
+ },
4581
4625
  {
4582
4626
  "name": "ifFee",
4583
4627
  "type": "u64"
@@ -5012,8 +5056,8 @@
5012
5056
  "type": "i128"
5013
5057
  },
5014
5058
  {
5015
- "name": "cumulativeSocialLoss",
5016
- "type": "i128"
5059
+ "name": "totalSocialLoss",
5060
+ "type": "u128"
5017
5061
  },
5018
5062
  {
5019
5063
  "name": "askBaseAssetReserve",
@@ -5111,6 +5155,10 @@
5111
5155
  "name": "markStd",
5112
5156
  "type": "u64"
5113
5157
  },
5158
+ {
5159
+ "name": "oracleStd",
5160
+ "type": "u64"
5161
+ },
5114
5162
  {
5115
5163
  "name": "lastMarkPriceTwapTs",
5116
5164
  "type": "i64"
@@ -5164,6 +5212,15 @@
5164
5212
  {
5165
5213
  "name": "lastOracleValid",
5166
5214
  "type": "bool"
5215
+ },
5216
+ {
5217
+ "name": "padding",
5218
+ "type": {
5219
+ "array": [
5220
+ "u8",
5221
+ 48
5222
+ ]
5223
+ }
5167
5224
  }
5168
5225
  ]
5169
5226
  }
@@ -5626,10 +5683,6 @@
5626
5683
  "defined": "OrderTriggerCondition"
5627
5684
  }
5628
5685
  },
5629
- {
5630
- "name": "triggered",
5631
- "type": "bool"
5632
- },
5633
5686
  {
5634
5687
  "name": "auctionDuration",
5635
5688
  "type": "u8"
@@ -5639,7 +5692,7 @@
5639
5692
  "type": {
5640
5693
  "array": [
5641
5694
  "u8",
5642
- 2
5695
+ 3
5643
5696
  ]
5644
5697
  }
5645
5698
  }
@@ -5817,16 +5870,30 @@
5817
5870
  ]
5818
5871
  }
5819
5872
  },
5873
+ {
5874
+ "name": "DepositExplanation",
5875
+ "type": {
5876
+ "kind": "enum",
5877
+ "variants": [
5878
+ {
5879
+ "name": "None"
5880
+ },
5881
+ {
5882
+ "name": "Transfer"
5883
+ }
5884
+ ]
5885
+ }
5886
+ },
5820
5887
  {
5821
5888
  "name": "DepositDirection",
5822
5889
  "type": {
5823
5890
  "kind": "enum",
5824
5891
  "variants": [
5825
5892
  {
5826
- "name": "DEPOSIT"
5893
+ "name": "Deposit"
5827
5894
  },
5828
5895
  {
5829
- "name": "WITHDRAW"
5896
+ "name": "Withdraw"
5830
5897
  }
5831
5898
  ]
5832
5899
  }
@@ -5875,7 +5942,7 @@
5875
5942
  "name": "OrderExpired"
5876
5943
  },
5877
5944
  {
5878
- "name": "CanceledForLiquidation"
5945
+ "name": "Liquidation"
5879
5946
  },
5880
5947
  {
5881
5948
  "name": "OrderFilledWithAMM"
@@ -5891,6 +5958,9 @@
5891
5958
  },
5892
5959
  {
5893
5960
  "name": "RiskingIncreasingOrder"
5961
+ },
5962
+ {
5963
+ "name": "OrderFillWithSerum"
5894
5964
  }
5895
5965
  ]
5896
5966
  }
@@ -5938,6 +6008,20 @@
5938
6008
  ]
5939
6009
  }
5940
6010
  },
6011
+ {
6012
+ "name": "SettlePnlExplanation",
6013
+ "type": {
6014
+ "kind": "enum",
6015
+ "variants": [
6016
+ {
6017
+ "name": "None"
6018
+ },
6019
+ {
6020
+ "name": "ExpiredPosition"
6021
+ }
6022
+ ]
6023
+ }
6024
+ },
5941
6025
  {
5942
6026
  "name": "StakeAction",
5943
6027
  "type": {
@@ -6160,6 +6244,23 @@
6160
6244
  ]
6161
6245
  }
6162
6246
  },
6247
+ {
6248
+ "name": "UserStatus",
6249
+ "type": {
6250
+ "kind": "enum",
6251
+ "variants": [
6252
+ {
6253
+ "name": "Active"
6254
+ },
6255
+ {
6256
+ "name": "BeingLiquidated"
6257
+ },
6258
+ {
6259
+ "name": "Bankrupt"
6260
+ }
6261
+ ]
6262
+ }
6263
+ },
6163
6264
  {
6164
6265
  "name": "AssetType",
6165
6266
  "type": {
@@ -6224,6 +6325,12 @@
6224
6325
  },
6225
6326
  {
6226
6327
  "name": "Below"
6328
+ },
6329
+ {
6330
+ "name": "TriggeredAbove"
6331
+ },
6332
+ {
6333
+ "name": "TriggeredBelow"
6227
6334
  }
6228
6335
  ]
6229
6336
  }
@@ -6359,6 +6466,13 @@
6359
6466
  "type": "u64",
6360
6467
  "index": false
6361
6468
  },
6469
+ {
6470
+ "name": "explanation",
6471
+ "type": {
6472
+ "defined": "DepositExplanation"
6473
+ },
6474
+ "index": false
6475
+ },
6362
6476
  {
6363
6477
  "name": "transferUser",
6364
6478
  "type": {
@@ -6946,6 +7060,11 @@
6946
7060
  "type": "i128",
6947
7061
  "index": false
6948
7062
  },
7063
+ {
7064
+ "name": "marginFreed",
7065
+ "type": "u64",
7066
+ "index": false
7067
+ },
6949
7068
  {
6950
7069
  "name": "liquidationId",
6951
7070
  "type": "u16",
@@ -7049,6 +7168,13 @@
7049
7168
  "name": "settlePrice",
7050
7169
  "type": "i64",
7051
7170
  "index": false
7171
+ },
7172
+ {
7173
+ "name": "explanation",
7174
+ "type": {
7175
+ "defined": "SettlePnlExplanation"
7176
+ },
7177
+ "index": false
7052
7178
  }
7053
7179
  ]
7054
7180
  },
@@ -7568,8 +7694,8 @@
7568
7694
  },
7569
7695
  {
7570
7696
  "code": 6078,
7571
- "name": "MarketNotFound",
7572
- "msg": "MarketNotFound"
7697
+ "name": "PerpMarketNotFound",
7698
+ "msg": "PerpMarketNotFound"
7573
7699
  },
7574
7700
  {
7575
7701
  "code": 6079,
@@ -7578,7 +7704,7 @@
7578
7704
  },
7579
7705
  {
7580
7706
  "code": 6080,
7581
- "name": "UnableToLoadMarketAccount",
7707
+ "name": "UnableToLoadPerpMarketAccount",
7582
7708
  "msg": "UnableToLoadMarketAccount"
7583
7709
  },
7584
7710
  {
@@ -8245,6 +8371,16 @@
8245
8371
  "code": 6213,
8246
8372
  "name": "MarketBeingInitialized",
8247
8373
  "msg": "Market Being Initialized"
8374
+ },
8375
+ {
8376
+ "code": 6214,
8377
+ "name": "InvalidUserSubAccountId",
8378
+ "msg": "Invalid Sub Account Id"
8379
+ },
8380
+ {
8381
+ "code": 6215,
8382
+ "name": "InvalidTriggerOrderCondition",
8383
+ "msg": "Invalid Trigger Order Condition"
8248
8384
  }
8249
8385
  ]
8250
8386
  }
@@ -69,7 +69,7 @@ export function isOracleTooDivergent(
69
69
  amm.historicalOracleData.lastOraclePriceTwapTs
70
70
  );
71
71
  const sinceStart = BN.max(ZERO, new BN(60 * 5).sub(sinceLastUpdate));
72
- const oracleTwap5min = amm.historicalOracleData.lastOraclePriceTwap5min
72
+ const oracleTwap5min = amm.historicalOracleData.lastOraclePriceTwap5Min
73
73
  .mul(sinceStart)
74
74
  .add(oraclePriceData.price)
75
75
  .mul(sinceLastUpdate)
@@ -196,10 +196,7 @@ export function calculateBaseAssetAmountForAmmToFulfill(
196
196
  oraclePriceData: OraclePriceData,
197
197
  slot: number
198
198
  ): BN {
199
- if (
200
- isOneOfVariant(order.orderType, ['triggerMarket', 'triggerLimit']) &&
201
- order.triggered === false
202
- ) {
199
+ if (mustBeTriggered(order) && !isTriggered(order)) {
203
200
  return ZERO;
204
201
  }
205
202
 
@@ -285,3 +282,11 @@ export function isMarketOrder(order: Order): boolean {
285
282
  export function isLimitOrder(order: Order): boolean {
286
283
  return isOneOfVariant(order.orderType, ['limit', 'triggerLimit']);
287
284
  }
285
+
286
+ export function mustBeTriggered(order: Order): boolean {
287
+ return isOneOfVariant(order.orderType, ['triggerMarket', 'triggerLimit']);
288
+ }
289
+
290
+ export function isTriggered(order: Order): boolean {
291
+ return isOneOfVariant(order.orderType, ['triggeredAbove', 'triggeredBelow']);
292
+ }