@drift-labs/sdk 2.80.0-beta.0 → 2.81.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 CHANGED
@@ -1 +1 @@
1
- 2.80.0-beta.0
1
+ 2.81.0-beta.0
@@ -44,6 +44,8 @@ export declare class AdminClient extends DriftClient {
44
44
  updatePerpMarketCurveUpdateIntensity(perpMarketIndex: number, curveUpdateIntensity: number): Promise<TransactionSignature>;
45
45
  getUpdatePerpMarketCurveUpdateIntensityIx(perpMarketIndex: number, curveUpdateIntensity: number): Promise<TransactionInstruction>;
46
46
  updatePerpMarketTargetBaseAssetAmountPerLp(perpMarketIndex: number, targetBaseAssetAmountPerLP: number): Promise<TransactionSignature>;
47
+ updatePerpMarketAmmSummaryStats(perpMarketIndex: number, updateAmmSummaryStats?: boolean, quoteAssetAmountWithUnsettledLp?: BN, netUnsettledFundingPnl?: BN): Promise<TransactionSignature>;
48
+ getUpdatePerpMarketAmmSummaryStatsIx(perpMarketIndex: number, updateAmmSummaryStats?: boolean, quoteAssetAmountWithUnsettledLp?: BN, netUnsettledFundingPnl?: BN): Promise<TransactionInstruction>;
47
49
  getUpdatePerpMarketTargetBaseAssetAmountPerLpIx(perpMarketIndex: number, targetBaseAssetAmountPerLP: number): Promise<TransactionInstruction>;
48
50
  updatePerpMarketMarginRatio(perpMarketIndex: number, marginRatioInitial: number, marginRatioMaintenance: number): Promise<TransactionSignature>;
49
51
  getUpdatePerpMarketMarginRatioIx(perpMarketIndex: number, marginRatioInitial: number, marginRatioMaintenance: number): Promise<TransactionInstruction>;
@@ -109,6 +111,8 @@ export declare class AdminClient extends DriftClient {
109
111
  getUpdateSpotMarketOracleIx(spotMarketIndex: number, oracle: PublicKey, oracleSource: OracleSource): Promise<TransactionInstruction>;
110
112
  updateSpotMarketOrdersEnabled(spotMarketIndex: number, ordersEnabled: boolean): Promise<TransactionSignature>;
111
113
  getUpdateSpotMarketOrdersEnabledIx(spotMarketIndex: number, ordersEnabled: boolean): Promise<TransactionInstruction>;
114
+ updateSpotMarketIfPausedOperations(spotMarketIndex: number, pausedOperations: number): Promise<TransactionSignature>;
115
+ getUpdateSpotMarketIfPausedOperationsIx(spotMarketIndex: number, pausedOperations: number): Promise<TransactionInstruction>;
112
116
  updateSerumFulfillmentConfigStatus(serumFulfillmentConfig: PublicKey, status: SpotFulfillmentConfigStatus): Promise<TransactionSignature>;
113
117
  getUpdateSerumFulfillmentConfigStatusIx(serumFulfillmentConfig: PublicKey, status: SpotFulfillmentConfigStatus): Promise<TransactionInstruction>;
114
118
  updatePhoenixFulfillmentConfigStatus(phoenixFulfillmentConfig: PublicKey, status: SpotFulfillmentConfigStatus): Promise<TransactionSignature>;
@@ -445,6 +445,29 @@ class AdminClient extends driftClient_1.DriftClient {
445
445
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
446
446
  return txSig;
447
447
  }
448
+ async updatePerpMarketAmmSummaryStats(perpMarketIndex, updateAmmSummaryStats, quoteAssetAmountWithUnsettledLp, netUnsettledFundingPnl) {
449
+ const updatePerpMarketMarginRatioIx = await this.getUpdatePerpMarketAmmSummaryStatsIx(perpMarketIndex, updateAmmSummaryStats, quoteAssetAmountWithUnsettledLp, netUnsettledFundingPnl);
450
+ const tx = await this.buildTransaction(updatePerpMarketMarginRatioIx);
451
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
452
+ return txSig;
453
+ }
454
+ async getUpdatePerpMarketAmmSummaryStatsIx(perpMarketIndex, updateAmmSummaryStats, quoteAssetAmountWithUnsettledLp, netUnsettledFundingPnl) {
455
+ return await this.program.instruction.updatePerpMarketAmmSummaryStats({
456
+ updateAmmSummaryStats: updateAmmSummaryStats !== null && updateAmmSummaryStats !== void 0 ? updateAmmSummaryStats : null,
457
+ quoteAssetAmountWithUnsettledLp: quoteAssetAmountWithUnsettledLp !== null && quoteAssetAmountWithUnsettledLp !== void 0 ? quoteAssetAmountWithUnsettledLp : null,
458
+ netUnsettledFundingPnl: netUnsettledFundingPnl !== null && netUnsettledFundingPnl !== void 0 ? netUnsettledFundingPnl : null,
459
+ }, {
460
+ accounts: {
461
+ admin: this.isSubscribed
462
+ ? this.getStateAccount().admin
463
+ : this.wallet.publicKey,
464
+ state: await this.getStatePublicKey(),
465
+ perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
466
+ spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, numericConstants_1.QUOTE_SPOT_MARKET_INDEX),
467
+ oracle: this.getPerpMarketAccount(perpMarketIndex).amm.oracle,
468
+ },
469
+ });
470
+ }
448
471
  async getUpdatePerpMarketTargetBaseAssetAmountPerLpIx(perpMarketIndex, targetBaseAssetAmountPerLP) {
449
472
  return await this.program.instruction.updatePerpMarketTargetBaseAssetAmountPerLp(targetBaseAssetAmountPerLP, {
450
473
  accounts: {
@@ -1004,6 +1027,23 @@ class AdminClient extends driftClient_1.DriftClient {
1004
1027
  },
1005
1028
  });
1006
1029
  }
1030
+ async updateSpotMarketIfPausedOperations(spotMarketIndex, pausedOperations) {
1031
+ const updateSpotMarketIfStakingDisabledIx = await this.getUpdateSpotMarketIfPausedOperationsIx(spotMarketIndex, pausedOperations);
1032
+ const tx = await this.buildTransaction(updateSpotMarketIfStakingDisabledIx);
1033
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1034
+ return txSig;
1035
+ }
1036
+ async getUpdateSpotMarketIfPausedOperationsIx(spotMarketIndex, pausedOperations) {
1037
+ return await this.program.instruction.updateSpotMarketIfPausedOperations(pausedOperations, {
1038
+ accounts: {
1039
+ admin: this.isSubscribed
1040
+ ? this.getStateAccount().admin
1041
+ : this.wallet.publicKey,
1042
+ state: await this.getStatePublicKey(),
1043
+ spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
1044
+ },
1045
+ });
1046
+ }
1007
1047
  async updateSerumFulfillmentConfigStatus(serumFulfillmentConfig, status) {
1008
1048
  const updateSerumFulfillmentConfigStatusIx = await this.getUpdateSerumFulfillmentConfigStatusIx(serumFulfillmentConfig, status);
1009
1049
  const tx = await this.buildTransaction(updateSerumFulfillmentConfigStatusIx);
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.79.0",
2
+ "version": "2.80.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
@@ -3182,6 +3182,44 @@
3182
3182
  }
3183
3183
  ]
3184
3184
  },
3185
+ {
3186
+ "name": "updatePerpMarketAmmSummaryStats",
3187
+ "accounts": [
3188
+ {
3189
+ "name": "admin",
3190
+ "isMut": false,
3191
+ "isSigner": true
3192
+ },
3193
+ {
3194
+ "name": "state",
3195
+ "isMut": false,
3196
+ "isSigner": false
3197
+ },
3198
+ {
3199
+ "name": "perpMarket",
3200
+ "isMut": true,
3201
+ "isSigner": false
3202
+ },
3203
+ {
3204
+ "name": "spotMarket",
3205
+ "isMut": false,
3206
+ "isSigner": false
3207
+ },
3208
+ {
3209
+ "name": "oracle",
3210
+ "isMut": false,
3211
+ "isSigner": false
3212
+ }
3213
+ ],
3214
+ "args": [
3215
+ {
3216
+ "name": "params",
3217
+ "type": {
3218
+ "defined": "UpdatePerpMarketSummaryStatsParams"
3219
+ }
3220
+ }
3221
+ ]
3222
+ },
3185
3223
  {
3186
3224
  "name": "updatePerpMarketExpiry",
3187
3225
  "accounts": [
@@ -4031,6 +4069,32 @@
4031
4069
  }
4032
4070
  ]
4033
4071
  },
4072
+ {
4073
+ "name": "updateSpotMarketIfPausedOperations",
4074
+ "accounts": [
4075
+ {
4076
+ "name": "admin",
4077
+ "isMut": false,
4078
+ "isSigner": true
4079
+ },
4080
+ {
4081
+ "name": "state",
4082
+ "isMut": false,
4083
+ "isSigner": false
4084
+ },
4085
+ {
4086
+ "name": "spotMarket",
4087
+ "isMut": true,
4088
+ "isSigner": false
4089
+ }
4090
+ ],
4091
+ "args": [
4092
+ {
4093
+ "name": "pausedOperations",
4094
+ "type": "u8"
4095
+ }
4096
+ ]
4097
+ },
4034
4098
  {
4035
4099
  "name": "updateSpotMarketName",
4036
4100
  "accounts": [
@@ -6087,7 +6151,7 @@
6087
6151
  "type": "u8"
6088
6152
  },
6089
6153
  {
6090
- "name": "padding2",
6154
+ "name": "ifPausedOperations",
6091
6155
  "type": "u8"
6092
6156
  },
6093
6157
  {
@@ -6659,6 +6723,32 @@
6659
6723
  }
6660
6724
  ],
6661
6725
  "types": [
6726
+ {
6727
+ "name": "UpdatePerpMarketSummaryStatsParams",
6728
+ "type": {
6729
+ "kind": "struct",
6730
+ "fields": [
6731
+ {
6732
+ "name": "quoteAssetAmountWithUnsettledLp",
6733
+ "type": {
6734
+ "option": "i64"
6735
+ }
6736
+ },
6737
+ {
6738
+ "name": "netUnsettledFundingPnl",
6739
+ "type": {
6740
+ "option": "i64"
6741
+ }
6742
+ },
6743
+ {
6744
+ "name": "updateAmmSummaryStats",
6745
+ "type": {
6746
+ "option": "bool"
6747
+ }
6748
+ }
6749
+ ]
6750
+ }
6751
+ },
6662
6752
  {
6663
6753
  "name": "LiquidatePerpRecord",
6664
6754
  "type": {
@@ -9209,6 +9299,26 @@
9209
9299
  ]
9210
9300
  }
9211
9301
  },
9302
+ {
9303
+ "name": "InsuranceFundOperation",
9304
+ "type": {
9305
+ "kind": "enum",
9306
+ "variants": [
9307
+ {
9308
+ "name": "Init"
9309
+ },
9310
+ {
9311
+ "name": "Add"
9312
+ },
9313
+ {
9314
+ "name": "RequestRemove"
9315
+ },
9316
+ {
9317
+ "name": "Remove"
9318
+ }
9319
+ ]
9320
+ }
9321
+ },
9212
9322
  {
9213
9323
  "name": "MarketStatus",
9214
9324
  "type": {
@@ -11784,6 +11894,11 @@
11784
11894
  "code": 6257,
11785
11895
  "name": "CantReclaimRent",
11786
11896
  "msg": "CantReclaimRent"
11897
+ },
11898
+ {
11899
+ "code": 6258,
11900
+ "name": "InsuranceFundOperationPaused",
11901
+ "msg": "InsuranceFundOperationPaused"
11787
11902
  }
11788
11903
  ]
11789
11904
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.80.0-beta.0",
3
+ "version": "2.81.0-beta.0",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -34,6 +34,7 @@ import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
34
34
  import { DriftClient } from './driftClient';
35
35
  import {
36
36
  PEG_PRECISION,
37
+ QUOTE_SPOT_MARKET_INDEX,
37
38
  ZERO,
38
39
  ONE,
39
40
  BASE_PRECISION,
@@ -1020,6 +1021,60 @@ export class AdminClient extends DriftClient {
1020
1021
  return txSig;
1021
1022
  }
1022
1023
 
1024
+ public async updatePerpMarketAmmSummaryStats(
1025
+ perpMarketIndex: number,
1026
+ updateAmmSummaryStats?: boolean,
1027
+ quoteAssetAmountWithUnsettledLp?: BN,
1028
+ netUnsettledFundingPnl?: BN
1029
+ ): Promise<TransactionSignature> {
1030
+ const updatePerpMarketMarginRatioIx =
1031
+ await this.getUpdatePerpMarketAmmSummaryStatsIx(
1032
+ perpMarketIndex,
1033
+ updateAmmSummaryStats,
1034
+ quoteAssetAmountWithUnsettledLp,
1035
+ netUnsettledFundingPnl
1036
+ );
1037
+
1038
+ const tx = await this.buildTransaction(updatePerpMarketMarginRatioIx);
1039
+
1040
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1041
+
1042
+ return txSig;
1043
+ }
1044
+
1045
+ public async getUpdatePerpMarketAmmSummaryStatsIx(
1046
+ perpMarketIndex: number,
1047
+ updateAmmSummaryStats?: boolean,
1048
+ quoteAssetAmountWithUnsettledLp?: BN,
1049
+ netUnsettledFundingPnl?: BN
1050
+ ): Promise<TransactionInstruction> {
1051
+ return await this.program.instruction.updatePerpMarketAmmSummaryStats(
1052
+ {
1053
+ updateAmmSummaryStats: updateAmmSummaryStats ?? null,
1054
+ quoteAssetAmountWithUnsettledLp:
1055
+ quoteAssetAmountWithUnsettledLp ?? null,
1056
+ netUnsettledFundingPnl: netUnsettledFundingPnl ?? null,
1057
+ },
1058
+ {
1059
+ accounts: {
1060
+ admin: this.isSubscribed
1061
+ ? this.getStateAccount().admin
1062
+ : this.wallet.publicKey,
1063
+ state: await this.getStatePublicKey(),
1064
+ perpMarket: await getPerpMarketPublicKey(
1065
+ this.program.programId,
1066
+ perpMarketIndex
1067
+ ),
1068
+ spotMarket: await getSpotMarketPublicKey(
1069
+ this.program.programId,
1070
+ QUOTE_SPOT_MARKET_INDEX
1071
+ ),
1072
+ oracle: this.getPerpMarketAccount(perpMarketIndex).amm.oracle,
1073
+ },
1074
+ }
1075
+ );
1076
+ }
1077
+
1023
1078
  public async getUpdatePerpMarketTargetBaseAssetAmountPerLpIx(
1024
1079
  perpMarketIndex: number,
1025
1080
  targetBaseAssetAmountPerLP: number
@@ -2186,6 +2241,44 @@ export class AdminClient extends DriftClient {
2186
2241
  );
2187
2242
  }
2188
2243
 
2244
+ public async updateSpotMarketIfPausedOperations(
2245
+ spotMarketIndex: number,
2246
+ pausedOperations: number
2247
+ ): Promise<TransactionSignature> {
2248
+ const updateSpotMarketIfStakingDisabledIx =
2249
+ await this.getUpdateSpotMarketIfPausedOperationsIx(
2250
+ spotMarketIndex,
2251
+ pausedOperations
2252
+ );
2253
+
2254
+ const tx = await this.buildTransaction(updateSpotMarketIfStakingDisabledIx);
2255
+
2256
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
2257
+
2258
+ return txSig;
2259
+ }
2260
+
2261
+ public async getUpdateSpotMarketIfPausedOperationsIx(
2262
+ spotMarketIndex: number,
2263
+ pausedOperations: number
2264
+ ): Promise<TransactionInstruction> {
2265
+ return await this.program.instruction.updateSpotMarketIfPausedOperations(
2266
+ pausedOperations,
2267
+ {
2268
+ accounts: {
2269
+ admin: this.isSubscribed
2270
+ ? this.getStateAccount().admin
2271
+ : this.wallet.publicKey,
2272
+ state: await this.getStatePublicKey(),
2273
+ spotMarket: await getSpotMarketPublicKey(
2274
+ this.program.programId,
2275
+ spotMarketIndex
2276
+ ),
2277
+ },
2278
+ }
2279
+ );
2280
+ }
2281
+
2189
2282
  public async updateSerumFulfillmentConfigStatus(
2190
2283
  serumFulfillmentConfig: PublicKey,
2191
2284
  status: SpotFulfillmentConfigStatus
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.79.0",
2
+ "version": "2.80.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
@@ -3182,6 +3182,44 @@
3182
3182
  }
3183
3183
  ]
3184
3184
  },
3185
+ {
3186
+ "name": "updatePerpMarketAmmSummaryStats",
3187
+ "accounts": [
3188
+ {
3189
+ "name": "admin",
3190
+ "isMut": false,
3191
+ "isSigner": true
3192
+ },
3193
+ {
3194
+ "name": "state",
3195
+ "isMut": false,
3196
+ "isSigner": false
3197
+ },
3198
+ {
3199
+ "name": "perpMarket",
3200
+ "isMut": true,
3201
+ "isSigner": false
3202
+ },
3203
+ {
3204
+ "name": "spotMarket",
3205
+ "isMut": false,
3206
+ "isSigner": false
3207
+ },
3208
+ {
3209
+ "name": "oracle",
3210
+ "isMut": false,
3211
+ "isSigner": false
3212
+ }
3213
+ ],
3214
+ "args": [
3215
+ {
3216
+ "name": "params",
3217
+ "type": {
3218
+ "defined": "UpdatePerpMarketSummaryStatsParams"
3219
+ }
3220
+ }
3221
+ ]
3222
+ },
3185
3223
  {
3186
3224
  "name": "updatePerpMarketExpiry",
3187
3225
  "accounts": [
@@ -4031,6 +4069,32 @@
4031
4069
  }
4032
4070
  ]
4033
4071
  },
4072
+ {
4073
+ "name": "updateSpotMarketIfPausedOperations",
4074
+ "accounts": [
4075
+ {
4076
+ "name": "admin",
4077
+ "isMut": false,
4078
+ "isSigner": true
4079
+ },
4080
+ {
4081
+ "name": "state",
4082
+ "isMut": false,
4083
+ "isSigner": false
4084
+ },
4085
+ {
4086
+ "name": "spotMarket",
4087
+ "isMut": true,
4088
+ "isSigner": false
4089
+ }
4090
+ ],
4091
+ "args": [
4092
+ {
4093
+ "name": "pausedOperations",
4094
+ "type": "u8"
4095
+ }
4096
+ ]
4097
+ },
4034
4098
  {
4035
4099
  "name": "updateSpotMarketName",
4036
4100
  "accounts": [
@@ -6087,7 +6151,7 @@
6087
6151
  "type": "u8"
6088
6152
  },
6089
6153
  {
6090
- "name": "padding2",
6154
+ "name": "ifPausedOperations",
6091
6155
  "type": "u8"
6092
6156
  },
6093
6157
  {
@@ -6659,6 +6723,32 @@
6659
6723
  }
6660
6724
  ],
6661
6725
  "types": [
6726
+ {
6727
+ "name": "UpdatePerpMarketSummaryStatsParams",
6728
+ "type": {
6729
+ "kind": "struct",
6730
+ "fields": [
6731
+ {
6732
+ "name": "quoteAssetAmountWithUnsettledLp",
6733
+ "type": {
6734
+ "option": "i64"
6735
+ }
6736
+ },
6737
+ {
6738
+ "name": "netUnsettledFundingPnl",
6739
+ "type": {
6740
+ "option": "i64"
6741
+ }
6742
+ },
6743
+ {
6744
+ "name": "updateAmmSummaryStats",
6745
+ "type": {
6746
+ "option": "bool"
6747
+ }
6748
+ }
6749
+ ]
6750
+ }
6751
+ },
6662
6752
  {
6663
6753
  "name": "LiquidatePerpRecord",
6664
6754
  "type": {
@@ -9209,6 +9299,26 @@
9209
9299
  ]
9210
9300
  }
9211
9301
  },
9302
+ {
9303
+ "name": "InsuranceFundOperation",
9304
+ "type": {
9305
+ "kind": "enum",
9306
+ "variants": [
9307
+ {
9308
+ "name": "Init"
9309
+ },
9310
+ {
9311
+ "name": "Add"
9312
+ },
9313
+ {
9314
+ "name": "RequestRemove"
9315
+ },
9316
+ {
9317
+ "name": "Remove"
9318
+ }
9319
+ ]
9320
+ }
9321
+ },
9212
9322
  {
9213
9323
  "name": "MarketStatus",
9214
9324
  "type": {
@@ -11784,6 +11894,11 @@
11784
11894
  "code": 6257,
11785
11895
  "name": "CantReclaimRent",
11786
11896
  "msg": "CantReclaimRent"
11897
+ },
11898
+ {
11899
+ "code": 6258,
11900
+ "name": "InsuranceFundOperationPaused",
11901
+ "msg": "InsuranceFundOperationPaused"
11787
11902
  }
11788
11903
  ]
11789
11904
  }