@drift-labs/sdk 2.74.0-beta.8 → 2.74.0-beta.9

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.74.0-beta.8
1
+ 2.74.0-beta.9
@@ -83,4 +83,5 @@ export declare class AdminClient extends DriftClient {
83
83
  updateProtocolIfSharesTransferConfig(whitelistedSigners?: PublicKey[], maxTransferPerEpoch?: BN): Promise<TransactionSignature>;
84
84
  initializePrelaunchOracle(perpMarketIndex: number, price?: BN, maxPrice?: BN): Promise<TransactionSignature>;
85
85
  updatePrelaunchOracleParams(perpMarketIndex: number, price?: BN, maxPrice?: BN): Promise<TransactionSignature>;
86
+ deletePrelaunchOracle(perpMarketIndex: number): Promise<TransactionSignature>;
86
87
  }
@@ -1083,5 +1083,18 @@ class AdminClient extends driftClient_1.DriftClient {
1083
1083
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1084
1084
  return txSig;
1085
1085
  }
1086
+ async deletePrelaunchOracle(perpMarketIndex) {
1087
+ const deletePrelaunchOracleIx = await this.program.instruction.deletePrelaunchOracle(perpMarketIndex, {
1088
+ accounts: {
1089
+ admin: this.wallet.publicKey,
1090
+ state: await this.getStatePublicKey(),
1091
+ prelaunchOracle: await (0, pda_1.getPrelaunchOraclePublicKey)(this.program.programId, perpMarketIndex),
1092
+ perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1093
+ },
1094
+ });
1095
+ const tx = await this.buildTransaction(deletePrelaunchOracleIx);
1096
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1097
+ return txSig;
1098
+ }
1086
1099
  }
1087
1100
  exports.AdminClient = AdminClient;
@@ -9119,6 +9119,9 @@
9119
9119
  {
9120
9120
  "name": "Speculative"
9121
9121
  },
9122
+ {
9123
+ "name": "HighlySpeculative"
9124
+ },
9122
9125
  {
9123
9126
  "name": "Isolated"
9124
9127
  }
@@ -148,12 +148,6 @@ function getMaxPriceDivergenceForFundingRate(market, oracleTwap) {
148
148
  else if ((0, types_1.isVariant)(market.contractTier, 'c')) {
149
149
  return oracleTwap.divn(20);
150
150
  }
151
- else if ((0, types_1.isVariant)(market.contractTier, 'speculative')) {
152
- return oracleTwap.divn(10);
153
- }
154
- else if ((0, types_1.isVariant)(market.contractTier, 'isolated')) {
155
- return oracleTwap.divn(10);
156
- }
157
151
  else {
158
152
  return oracleTwap.divn(10);
159
153
  }
@@ -28,7 +28,7 @@ function getMaxConfidenceIntervalMultiplier(market) {
28
28
  else if ((0, types_1.isVariant)(market.contractTier, 'speculative')) {
29
29
  maxConfidenceIntervalMultiplier = new index_1.BN(10);
30
30
  }
31
- else if ((0, types_1.isVariant)(market.contractTier, 'isolated')) {
31
+ else {
32
32
  maxConfidenceIntervalMultiplier = new index_1.BN(50);
33
33
  }
34
34
  return maxConfidenceIntervalMultiplier;
package/lib/math/tiers.js CHANGED
@@ -15,7 +15,7 @@ function getPerpMarketTierNumber(perpMarket) {
15
15
  else if ((0, types_1.isVariant)(perpMarket.contractTier, 'speculative')) {
16
16
  return 3;
17
17
  }
18
- else if ((0, types_1.isVariant)(perpMarket.contractTier, 'isolated')) {
18
+ else if ((0, types_1.isVariant)(perpMarket.contractTier, 'highlySpeculative')) {
19
19
  return 4;
20
20
  }
21
21
  else {
@@ -17,6 +17,7 @@ class PrelaunchOracleClient {
17
17
  slot: prelaunchOracle.ammLastUpdateSlot,
18
18
  confidence: prelaunchOracle.confidence,
19
19
  hasSufficientNumberOfDataPoints: true,
20
+ maxPrice: prelaunchOracle.maxPrice,
20
21
  };
21
22
  }
22
23
  }
@@ -10,6 +10,7 @@ export type OraclePriceData = {
10
10
  hasSufficientNumberOfDataPoints: boolean;
11
11
  twap?: BN;
12
12
  twapConfidence?: BN;
13
+ maxPrice?: BN;
13
14
  };
14
15
  export type OracleInfo = {
15
16
  publicKey: PublicKey;
package/lib/types.d.ts CHANGED
@@ -80,6 +80,9 @@ export declare class ContractTier {
80
80
  static readonly SPECULATIVE: {
81
81
  speculative: {};
82
82
  };
83
+ static readonly HIGHLY_SPECULATIVE: {
84
+ highlySpeculative: {};
85
+ };
83
86
  static readonly ISOLATED: {
84
87
  isolated: {};
85
88
  };
package/lib/types.js CHANGED
@@ -60,6 +60,7 @@ ContractTier.A = { a: {} };
60
60
  ContractTier.B = { b: {} };
61
61
  ContractTier.C = { c: {} };
62
62
  ContractTier.SPECULATIVE = { speculative: {} };
63
+ ContractTier.HIGHLY_SPECULATIVE = { highlySpeculative: {} };
63
64
  ContractTier.ISOLATED = { isolated: {} };
64
65
  class AssetTier {
65
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.74.0-beta.8",
3
+ "version": "2.74.0-beta.9",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -2172,4 +2172,30 @@ export class AdminClient extends DriftClient {
2172
2172
 
2173
2173
  return txSig;
2174
2174
  }
2175
+
2176
+ public async deletePrelaunchOracle(
2177
+ perpMarketIndex: number
2178
+ ): Promise<TransactionSignature> {
2179
+ const deletePrelaunchOracleIx =
2180
+ await this.program.instruction.deletePrelaunchOracle(perpMarketIndex, {
2181
+ accounts: {
2182
+ admin: this.wallet.publicKey,
2183
+ state: await this.getStatePublicKey(),
2184
+ prelaunchOracle: await getPrelaunchOraclePublicKey(
2185
+ this.program.programId,
2186
+ perpMarketIndex
2187
+ ),
2188
+ perpMarket: await getPerpMarketPublicKey(
2189
+ this.program.programId,
2190
+ perpMarketIndex
2191
+ ),
2192
+ },
2193
+ });
2194
+
2195
+ const tx = await this.buildTransaction(deletePrelaunchOracleIx);
2196
+
2197
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
2198
+
2199
+ return txSig;
2200
+ }
2175
2201
  }
@@ -9119,6 +9119,9 @@
9119
9119
  {
9120
9120
  "name": "Speculative"
9121
9121
  },
9122
+ {
9123
+ "name": "HighlySpeculative"
9124
+ },
9122
9125
  {
9123
9126
  "name": "Isolated"
9124
9127
  }
@@ -252,10 +252,6 @@ function getMaxPriceDivergenceForFundingRate(
252
252
  return oracleTwap.divn(33);
253
253
  } else if (isVariant(market.contractTier, 'c')) {
254
254
  return oracleTwap.divn(20);
255
- } else if (isVariant(market.contractTier, 'speculative')) {
256
- return oracleTwap.divn(10);
257
- } else if (isVariant(market.contractTier, 'isolated')) {
258
- return oracleTwap.divn(10);
259
255
  } else {
260
256
  return oracleTwap.divn(10);
261
257
  }
@@ -39,7 +39,7 @@ export function getMaxConfidenceIntervalMultiplier(
39
39
  maxConfidenceIntervalMultiplier = new BN(2);
40
40
  } else if (isVariant(market.contractTier, 'speculative')) {
41
41
  maxConfidenceIntervalMultiplier = new BN(10);
42
- } else if (isVariant(market.contractTier, 'isolated')) {
42
+ } else {
43
43
  maxConfidenceIntervalMultiplier = new BN(50);
44
44
  }
45
45
  return maxConfidenceIntervalMultiplier;
package/src/math/tiers.ts CHANGED
@@ -9,7 +9,7 @@ export function getPerpMarketTierNumber(perpMarket: PerpMarketAccount): number {
9
9
  return 2;
10
10
  } else if (isVariant(perpMarket.contractTier, 'speculative')) {
11
11
  return 3;
12
- } else if (isVariant(perpMarket.contractTier, 'isolated')) {
12
+ } else if (isVariant(perpMarket.contractTier, 'highlySpeculative')) {
13
13
  return 4;
14
14
  } else {
15
15
  return 5;
@@ -31,6 +31,7 @@ export class PrelaunchOracleClient implements OracleClient {
31
31
  slot: prelaunchOracle.ammLastUpdateSlot,
32
32
  confidence: prelaunchOracle.confidence,
33
33
  hasSufficientNumberOfDataPoints: true,
34
+ maxPrice: prelaunchOracle.maxPrice,
34
35
  };
35
36
  }
36
37
  }
@@ -9,6 +9,7 @@ export type OraclePriceData = {
9
9
  hasSufficientNumberOfDataPoints: boolean;
10
10
  twap?: BN;
11
11
  twapConfidence?: BN;
12
+ maxPrice?: BN; // pre-launch markets only
12
13
  };
13
14
 
14
15
  export type OracleInfo = {
package/src/types.ts CHANGED
@@ -58,6 +58,7 @@ export class ContractTier {
58
58
  static readonly B = { b: {} };
59
59
  static readonly C = { c: {} };
60
60
  static readonly SPECULATIVE = { speculative: {} };
61
+ static readonly HIGHLY_SPECULATIVE = { highlySpeculative: {} };
61
62
  static readonly ISOLATED = { isolated: {} };
62
63
  }
63
64