@drift-labs/sdk 2.35.1-beta.1 → 2.35.1-beta.3

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.35.1-beta.1
1
+ 2.35.1-beta.3
@@ -68,6 +68,36 @@ exports.MainnetSpotMarkets = [
68
68
  precisionExp: numericConstants_1.NINE,
69
69
  serumMarket: new web3_js_1.PublicKey('9Lyhks5bQQxb9EyyX55NtgKQzpM4WK7JCmeaWuQ5MoXD'),
70
70
  },
71
+ {
72
+ symbol: 'wBTC',
73
+ marketIndex: 3,
74
+ oracle: new web3_js_1.PublicKey('GVXRSBjFk6e6J3NbVPXohDJetcTjaeeuykUpbQF8UoMU'),
75
+ oracleSource: __1.OracleSource.PYTH,
76
+ mint: new web3_js_1.PublicKey('3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh'),
77
+ precision: new __1.BN(10).pow(numericConstants_1.EIGHT),
78
+ precisionExp: numericConstants_1.EIGHT,
79
+ serumMarket: new web3_js_1.PublicKey('3BAKsQd3RuhZKES2DGysMhjBdwjZYKYmxRqnSMtZ4KSN'),
80
+ },
81
+ {
82
+ symbol: 'wETH',
83
+ marketIndex: 4,
84
+ oracle: new web3_js_1.PublicKey('JBu1AL4obBcCMqKBBxhpWCNUt136ijcuMZLFvTP7iWdB'),
85
+ oracleSource: __1.OracleSource.PYTH,
86
+ mint: new web3_js_1.PublicKey('7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs'),
87
+ precision: new __1.BN(10).pow(numericConstants_1.EIGHT),
88
+ precisionExp: numericConstants_1.EIGHT,
89
+ serumMarket: new web3_js_1.PublicKey('BbJgE7HZMaDp5NTYvRh5jZSkQPVDTU8ubPFtpogUkEj4'),
90
+ },
91
+ {
92
+ symbol: 'USDT',
93
+ marketIndex: 5,
94
+ oracle: new web3_js_1.PublicKey('3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL'),
95
+ oracleSource: __1.OracleSource.PYTH_STABLE_COIN,
96
+ mint: new web3_js_1.PublicKey('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'),
97
+ precision: numericConstants_1.QUOTE_PRECISION,
98
+ precisionExp: numericConstants_1.QUOTE_PRECISION_EXP,
99
+ serumMarket: new web3_js_1.PublicKey('B2na8Awyd7cpC59iEU43FagJAPLigr3AP3s38KM982bu'),
100
+ },
71
101
  ];
72
102
  exports.SpotMarkets = {
73
103
  devnet: exports.DevnetSpotMarkets,
package/lib/user.js CHANGED
@@ -289,7 +289,7 @@ class User {
289
289
  let dustBaseAssetValue = numericConstants_1.ZERO;
290
290
  if (burnLpShares && position.remainderBaseAssetAmount != 0) {
291
291
  const oraclePriceData = this.driftClient.getOracleDataForPerpMarket(position.marketIndex);
292
- dustBaseAssetValue = _1.BN.abs(position.remainderBaseAssetAmount)
292
+ dustBaseAssetValue = new _1.BN(Math.abs(position.remainderBaseAssetAmount))
293
293
  .mul(oraclePriceData.price)
294
294
  .div(numericConstants_1.AMM_RESERVE_PRECISION)
295
295
  .add(numericConstants_1.ONE);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.35.1-beta.1",
3
+ "version": "2.35.1-beta.3",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -6,6 +6,7 @@ import {
6
6
  LAMPORTS_EXP,
7
7
  LAMPORTS_PRECISION,
8
8
  SIX,
9
+ EIGHT,
9
10
  NINE,
10
11
  } from './numericConstants';
11
12
 
@@ -93,6 +94,36 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
93
94
  precisionExp: NINE,
94
95
  serumMarket: new PublicKey('9Lyhks5bQQxb9EyyX55NtgKQzpM4WK7JCmeaWuQ5MoXD'),
95
96
  },
97
+ {
98
+ symbol: 'wBTC',
99
+ marketIndex: 3,
100
+ oracle: new PublicKey('GVXRSBjFk6e6J3NbVPXohDJetcTjaeeuykUpbQF8UoMU'),
101
+ oracleSource: OracleSource.PYTH,
102
+ mint: new PublicKey('3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh'),
103
+ precision: new BN(10).pow(EIGHT),
104
+ precisionExp: EIGHT,
105
+ serumMarket: new PublicKey('3BAKsQd3RuhZKES2DGysMhjBdwjZYKYmxRqnSMtZ4KSN'),
106
+ },
107
+ {
108
+ symbol: 'wETH',
109
+ marketIndex: 4,
110
+ oracle: new PublicKey('JBu1AL4obBcCMqKBBxhpWCNUt136ijcuMZLFvTP7iWdB'),
111
+ oracleSource: OracleSource.PYTH,
112
+ mint: new PublicKey('7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs'),
113
+ precision: new BN(10).pow(EIGHT),
114
+ precisionExp: EIGHT,
115
+ serumMarket: new PublicKey('BbJgE7HZMaDp5NTYvRh5jZSkQPVDTU8ubPFtpogUkEj4'),
116
+ },
117
+ {
118
+ symbol: 'USDT',
119
+ marketIndex: 5,
120
+ oracle: new PublicKey('3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL'),
121
+ oracleSource: OracleSource.PYTH_STABLE_COIN,
122
+ mint: new PublicKey('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'),
123
+ precision: QUOTE_PRECISION,
124
+ precisionExp: QUOTE_PRECISION_EXP,
125
+ serumMarket: new PublicKey('B2na8Awyd7cpC59iEU43FagJAPLigr3AP3s38KM982bu'),
126
+ },
96
127
  ];
97
128
 
98
129
  export const SpotMarkets: { [key in DriftEnv]: SpotMarketConfig[] } = {
package/src/user.ts CHANGED
@@ -477,7 +477,7 @@ export class User {
477
477
  const oraclePriceData = this.driftClient.getOracleDataForPerpMarket(
478
478
  position.marketIndex
479
479
  );
480
- dustBaseAssetValue = BN.abs(position.remainderBaseAssetAmount)
480
+ dustBaseAssetValue = new BN(Math.abs(position.remainderBaseAssetAmount))
481
481
  .mul(oraclePriceData.price)
482
482
  .div(AMM_RESERVE_PRECISION)
483
483
  .add(ONE);