@drift-labs/sdk 2.86.0-beta.26 → 2.86.0-beta.28

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.86.0-beta.26
1
+ 2.86.0-beta.28
package/lib/types.d.ts CHANGED
@@ -55,8 +55,9 @@ export declare enum PerpOperation {
55
55
  export declare enum SpotOperation {
56
56
  UPDATE_CUMULATIVE_INTEREST = 1,
57
57
  FILL = 2,
58
- WITHDRAW = 4,
59
- LIQUIDATION = 8
58
+ DEPOSIT = 4,
59
+ WITHDRAW = 8,
60
+ LIQUIDATION = 16
60
61
  }
61
62
  export declare enum InsuranceFundOperation {
62
63
  INIT = 1,
package/lib/types.js CHANGED
@@ -40,8 +40,9 @@ var SpotOperation;
40
40
  (function (SpotOperation) {
41
41
  SpotOperation[SpotOperation["UPDATE_CUMULATIVE_INTEREST"] = 1] = "UPDATE_CUMULATIVE_INTEREST";
42
42
  SpotOperation[SpotOperation["FILL"] = 2] = "FILL";
43
- SpotOperation[SpotOperation["WITHDRAW"] = 4] = "WITHDRAW";
44
- SpotOperation[SpotOperation["LIQUIDATION"] = 8] = "LIQUIDATION";
43
+ SpotOperation[SpotOperation["DEPOSIT"] = 4] = "DEPOSIT";
44
+ SpotOperation[SpotOperation["WITHDRAW"] = 8] = "WITHDRAW";
45
+ SpotOperation[SpotOperation["LIQUIDATION"] = 16] = "LIQUIDATION";
45
46
  })(SpotOperation = exports.SpotOperation || (exports.SpotOperation = {}));
46
47
  var InsuranceFundOperation;
47
48
  (function (InsuranceFundOperation) {
package/lib/user.js CHANGED
@@ -597,7 +597,7 @@ class User {
597
597
  }
598
598
  if (userStats.ifStakedQuoteAssetAmount.gt(numericConstants_1.ZERO)) {
599
599
  const spotMarketAccount = this.driftClient.getSpotMarketAccount(numericConstants_1.QUOTE_SPOT_MARKET_INDEX);
600
- const fuelBonusNumeratorUserStats = now.sub(_1.BN.max(new _1.BN(userStats.lastFuelIfBonusUpdateTs), numericConstants_1.FUEL_START_TS));
600
+ const fuelBonusNumeratorUserStats = _1.BN.max(now.sub(_1.BN.max(new _1.BN(userStats.lastFuelIfBonusUpdateTs), numericConstants_1.FUEL_START_TS)), numericConstants_1.ZERO);
601
601
  result.insuranceFuel = result.insuranceFuel.add((0, fuel_1.calculateInsuranceFuelBonus)(spotMarketAccount, userStats.ifStakedQuoteAssetAmount, fuelBonusNumeratorUserStats));
602
602
  }
603
603
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.86.0-beta.26",
3
+ "version": "2.86.0-beta.28",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
package/src/types.ts CHANGED
@@ -44,8 +44,9 @@ export enum PerpOperation {
44
44
  export enum SpotOperation {
45
45
  UPDATE_CUMULATIVE_INTEREST = 1,
46
46
  FILL = 2,
47
- WITHDRAW = 4,
48
- LIQUIDATION = 8,
47
+ DEPOSIT = 4,
48
+ WITHDRAW = 8,
49
+ LIQUIDATION = 16,
49
50
  }
50
51
 
51
52
  export enum InsuranceFundOperation {
package/src/user.ts CHANGED
@@ -1030,8 +1030,11 @@ export class User {
1030
1030
  const spotMarketAccount: SpotMarketAccount =
1031
1031
  this.driftClient.getSpotMarketAccount(QUOTE_SPOT_MARKET_INDEX);
1032
1032
 
1033
- const fuelBonusNumeratorUserStats = now.sub(
1034
- BN.max(new BN(userStats.lastFuelIfBonusUpdateTs), FUEL_START_TS)
1033
+ const fuelBonusNumeratorUserStats = BN.max(
1034
+ now.sub(
1035
+ BN.max(new BN(userStats.lastFuelIfBonusUpdateTs), FUEL_START_TS)
1036
+ ),
1037
+ ZERO
1035
1038
  );
1036
1039
 
1037
1040
  result.insuranceFuel = result.insuranceFuel.add(