@drift-labs/sdk 2.97.0-beta.30 → 2.97.0-beta.32
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.97.0-beta.
|
|
1
|
+
2.97.0-beta.32
|
|
@@ -19,8 +19,8 @@ exports.DevnetSpotMarkets = [
|
|
|
19
19
|
{
|
|
20
20
|
symbol: 'SOL',
|
|
21
21
|
marketIndex: 1,
|
|
22
|
-
oracle: new web3_js_1.PublicKey('
|
|
23
|
-
oracleSource: __1.OracleSource.
|
|
22
|
+
oracle: new web3_js_1.PublicKey('BAtFj4kQttZRVep3UZS2aZRDixkGYgWsbqTBVDbnSsPF'),
|
|
23
|
+
oracleSource: __1.OracleSource.PYTH_PULL,
|
|
24
24
|
mint: new web3_js_1.PublicKey(exports.WRAPPED_SOL_MINT),
|
|
25
25
|
precision: numericConstants_1.LAMPORTS_PRECISION,
|
|
26
26
|
precisionExp: numericConstants_1.LAMPORTS_EXP,
|
|
@@ -31,8 +31,8 @@ exports.DevnetSpotMarkets = [
|
|
|
31
31
|
{
|
|
32
32
|
symbol: 'BTC',
|
|
33
33
|
marketIndex: 2,
|
|
34
|
-
oracle: new web3_js_1.PublicKey('
|
|
35
|
-
oracleSource: __1.OracleSource.
|
|
34
|
+
oracle: new web3_js_1.PublicKey('486kr3pmFPfTsS4aZgcsQ7kS4i9rjMsYYZup6HQNSTT4'),
|
|
35
|
+
oracleSource: __1.OracleSource.PYTH_PULL,
|
|
36
36
|
mint: new web3_js_1.PublicKey('3BZPwbcqB5kKScF3TEXxwNfx5ipV13kbRVDvfVp5c6fv'),
|
|
37
37
|
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
38
38
|
precisionExp: numericConstants_1.SIX,
|
package/lib/browser/user.js
CHANGED
|
@@ -543,7 +543,7 @@ class User {
|
|
|
543
543
|
*/
|
|
544
544
|
getUnrealizedFundingPNL(marketIndex) {
|
|
545
545
|
return this.getUserAccount()
|
|
546
|
-
.perpPositions.filter((pos) => marketIndex ? pos.marketIndex === marketIndex : true)
|
|
546
|
+
.perpPositions.filter((pos) => marketIndex !== undefined ? pos.marketIndex === marketIndex : true)
|
|
547
547
|
.reduce((pnl, perpPosition) => {
|
|
548
548
|
const market = this.driftClient.getPerpMarketAccount(perpPosition.marketIndex);
|
|
549
549
|
return pnl.add((0, _1.calculatePositionFundingPNL)(market, perpPosition));
|
|
@@ -19,8 +19,8 @@ exports.DevnetSpotMarkets = [
|
|
|
19
19
|
{
|
|
20
20
|
symbol: 'SOL',
|
|
21
21
|
marketIndex: 1,
|
|
22
|
-
oracle: new web3_js_1.PublicKey('
|
|
23
|
-
oracleSource: __1.OracleSource.
|
|
22
|
+
oracle: new web3_js_1.PublicKey('BAtFj4kQttZRVep3UZS2aZRDixkGYgWsbqTBVDbnSsPF'),
|
|
23
|
+
oracleSource: __1.OracleSource.PYTH_PULL,
|
|
24
24
|
mint: new web3_js_1.PublicKey(exports.WRAPPED_SOL_MINT),
|
|
25
25
|
precision: numericConstants_1.LAMPORTS_PRECISION,
|
|
26
26
|
precisionExp: numericConstants_1.LAMPORTS_EXP,
|
|
@@ -31,8 +31,8 @@ exports.DevnetSpotMarkets = [
|
|
|
31
31
|
{
|
|
32
32
|
symbol: 'BTC',
|
|
33
33
|
marketIndex: 2,
|
|
34
|
-
oracle: new web3_js_1.PublicKey('
|
|
35
|
-
oracleSource: __1.OracleSource.
|
|
34
|
+
oracle: new web3_js_1.PublicKey('486kr3pmFPfTsS4aZgcsQ7kS4i9rjMsYYZup6HQNSTT4'),
|
|
35
|
+
oracleSource: __1.OracleSource.PYTH_PULL,
|
|
36
36
|
mint: new web3_js_1.PublicKey('3BZPwbcqB5kKScF3TEXxwNfx5ipV13kbRVDvfVp5c6fv'),
|
|
37
37
|
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
38
38
|
precisionExp: numericConstants_1.SIX,
|
package/lib/node/user.js
CHANGED
|
@@ -543,7 +543,7 @@ class User {
|
|
|
543
543
|
*/
|
|
544
544
|
getUnrealizedFundingPNL(marketIndex) {
|
|
545
545
|
return this.getUserAccount()
|
|
546
|
-
.perpPositions.filter((pos) => marketIndex ? pos.marketIndex === marketIndex : true)
|
|
546
|
+
.perpPositions.filter((pos) => marketIndex !== undefined ? pos.marketIndex === marketIndex : true)
|
|
547
547
|
.reduce((pnl, perpPosition) => {
|
|
548
548
|
const market = this.driftClient.getPerpMarketAccount(perpPosition.marketIndex);
|
|
549
549
|
return pnl.add((0, _1.calculatePositionFundingPNL)(market, perpPosition));
|
package/package.json
CHANGED
|
@@ -44,8 +44,8 @@ export const DevnetSpotMarkets: SpotMarketConfig[] = [
|
|
|
44
44
|
{
|
|
45
45
|
symbol: 'SOL',
|
|
46
46
|
marketIndex: 1,
|
|
47
|
-
oracle: new PublicKey('
|
|
48
|
-
oracleSource: OracleSource.
|
|
47
|
+
oracle: new PublicKey('BAtFj4kQttZRVep3UZS2aZRDixkGYgWsbqTBVDbnSsPF'),
|
|
48
|
+
oracleSource: OracleSource.PYTH_PULL,
|
|
49
49
|
mint: new PublicKey(WRAPPED_SOL_MINT),
|
|
50
50
|
precision: LAMPORTS_PRECISION,
|
|
51
51
|
precisionExp: LAMPORTS_EXP,
|
|
@@ -59,8 +59,8 @@ export const DevnetSpotMarkets: SpotMarketConfig[] = [
|
|
|
59
59
|
{
|
|
60
60
|
symbol: 'BTC',
|
|
61
61
|
marketIndex: 2,
|
|
62
|
-
oracle: new PublicKey('
|
|
63
|
-
oracleSource: OracleSource.
|
|
62
|
+
oracle: new PublicKey('486kr3pmFPfTsS4aZgcsQ7kS4i9rjMsYYZup6HQNSTT4'),
|
|
63
|
+
oracleSource: OracleSource.PYTH_PULL,
|
|
64
64
|
mint: new PublicKey('3BZPwbcqB5kKScF3TEXxwNfx5ipV13kbRVDvfVp5c6fv'),
|
|
65
65
|
precision: new BN(10).pow(SIX),
|
|
66
66
|
precisionExp: SIX,
|
package/src/user.ts
CHANGED
|
@@ -895,7 +895,7 @@ export class User {
|
|
|
895
895
|
public getUnrealizedFundingPNL(marketIndex?: number): BN {
|
|
896
896
|
return this.getUserAccount()
|
|
897
897
|
.perpPositions.filter((pos) =>
|
|
898
|
-
marketIndex ? pos.marketIndex === marketIndex : true
|
|
898
|
+
marketIndex !== undefined ? pos.marketIndex === marketIndex : true
|
|
899
899
|
)
|
|
900
900
|
.reduce((pnl, perpPosition) => {
|
|
901
901
|
const market = this.driftClient.getPerpMarketAccount(
|