@drift-labs/sdk 2.74.0-beta.8 → 2.75.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.
@@ -3029,7 +3029,9 @@ export class DriftClient {
3029
3029
  await this.program.instruction.settleExpiredMarketPoolsToRevenuePool({
3030
3030
  accounts: {
3031
3031
  state: await this.getStatePublicKey(),
3032
- admin: this.wallet.publicKey,
3032
+ admin: this.isSubscribed
3033
+ ? this.getStateAccount().admin
3034
+ : this.wallet.publicKey,
3033
3035
  spotMarket: spotMarketPublicKey,
3034
3036
  perpMarket: perpMarketPublicKey,
3035
3037
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.73.0",
2
+ "version": "2.74.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
@@ -2651,10 +2651,40 @@
2651
2651
  "name": "liquidatorFee",
2652
2652
  "type": "u32"
2653
2653
  },
2654
+ {
2655
+ "name": "ifLiquidationFee",
2656
+ "type": "u32"
2657
+ },
2654
2658
  {
2655
2659
  "name": "activeStatus",
2656
2660
  "type": "bool"
2657
2661
  },
2662
+ {
2663
+ "name": "assetTier",
2664
+ "type": {
2665
+ "defined": "AssetTier"
2666
+ }
2667
+ },
2668
+ {
2669
+ "name": "scaleInitialAssetWeightStart",
2670
+ "type": "u64"
2671
+ },
2672
+ {
2673
+ "name": "withdrawGuardThreshold",
2674
+ "type": "u64"
2675
+ },
2676
+ {
2677
+ "name": "orderTickSize",
2678
+ "type": "u64"
2679
+ },
2680
+ {
2681
+ "name": "orderStepSize",
2682
+ "type": "u64"
2683
+ },
2684
+ {
2685
+ "name": "ifTotalFactor",
2686
+ "type": "u32"
2687
+ },
2658
2688
  {
2659
2689
  "name": "name",
2660
2690
  "type": {
@@ -2931,6 +2961,12 @@
2931
2961
  "defined": "OracleSource"
2932
2962
  }
2933
2963
  },
2964
+ {
2965
+ "name": "contractTier",
2966
+ "type": {
2967
+ "defined": "ContractTier"
2968
+ }
2969
+ },
2934
2970
  {
2935
2971
  "name": "marginRatioInitial",
2936
2972
  "type": "u32"
@@ -2943,10 +2979,62 @@
2943
2979
  "name": "liquidatorFee",
2944
2980
  "type": "u32"
2945
2981
  },
2982
+ {
2983
+ "name": "ifLiquidationFee",
2984
+ "type": "u32"
2985
+ },
2986
+ {
2987
+ "name": "imfFactor",
2988
+ "type": "u32"
2989
+ },
2946
2990
  {
2947
2991
  "name": "activeStatus",
2948
2992
  "type": "bool"
2949
2993
  },
2994
+ {
2995
+ "name": "baseSpread",
2996
+ "type": "u32"
2997
+ },
2998
+ {
2999
+ "name": "maxSpread",
3000
+ "type": "u32"
3001
+ },
3002
+ {
3003
+ "name": "maxOpenInterest",
3004
+ "type": "u128"
3005
+ },
3006
+ {
3007
+ "name": "maxRevenueWithdrawPerPeriod",
3008
+ "type": "u64"
3009
+ },
3010
+ {
3011
+ "name": "quoteMaxInsurance",
3012
+ "type": "u64"
3013
+ },
3014
+ {
3015
+ "name": "orderStepSize",
3016
+ "type": "u64"
3017
+ },
3018
+ {
3019
+ "name": "orderTickSize",
3020
+ "type": "u64"
3021
+ },
3022
+ {
3023
+ "name": "minOrderSize",
3024
+ "type": "u64"
3025
+ },
3026
+ {
3027
+ "name": "concentrationCoefScale",
3028
+ "type": "u128"
3029
+ },
3030
+ {
3031
+ "name": "curveUpdateIntensity",
3032
+ "type": "u8"
3033
+ },
3034
+ {
3035
+ "name": "ammJitIntensity",
3036
+ "type": "u8"
3037
+ },
2950
3038
  {
2951
3039
  "name": "name",
2952
3040
  "type": {
@@ -9119,6 +9207,9 @@
9119
9207
  {
9120
9208
  "name": "Speculative"
9121
9209
  },
9210
+ {
9211
+ "name": "HighlySpeculative"
9212
+ },
9122
9213
  {
9123
9214
  "name": "Isolated"
9124
9215
  }
@@ -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