@drift-labs/sdk 2.42.0-beta.13 → 2.42.0-beta.15
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 +1 -1
- package/lib/constants/perpMarkets.js +42 -2
- package/lib/user.js +2 -2
- package/package.json +1 -1
- package/src/constants/perpMarkets.ts +42 -2
- package/src/user.ts +2 -2
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.42.0-beta.
|
|
1
|
+
2.42.0-beta.15
|
|
@@ -151,7 +151,27 @@ exports.DevnetPerpMarkets = [
|
|
|
151
151
|
baseAssetSymbol: 'HNT',
|
|
152
152
|
marketIndex: 14,
|
|
153
153
|
oracle: new web3_js_1.PublicKey('6Eg8YdfFJQF2HHonzPUBSCCmyUEhrStg9VBLK957sBe6'),
|
|
154
|
-
launchTs:
|
|
154
|
+
launchTs: 1692294955000,
|
|
155
|
+
oracleSource: __1.OracleSource.PYTH,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
fullName: 'INJ',
|
|
159
|
+
category: ['L1', 'Exchange'],
|
|
160
|
+
symbol: 'INJ-PERP',
|
|
161
|
+
baseAssetSymbol: 'INJ',
|
|
162
|
+
marketIndex: 15,
|
|
163
|
+
oracle: new web3_js_1.PublicKey('44uRsNnT35kjkscSu59MxRr9CfkLZWf6gny8bWqUbVxE'),
|
|
164
|
+
launchTs: 1698074659000,
|
|
165
|
+
oracleSource: __1.OracleSource.PYTH,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
fullName: 'LINK',
|
|
169
|
+
category: ['Oracle'],
|
|
170
|
+
symbol: 'LINK-PERP',
|
|
171
|
+
baseAssetSymbol: 'LINK',
|
|
172
|
+
marketIndex: 16,
|
|
173
|
+
oracle: new web3_js_1.PublicKey('9sGidS4qUXS2WvHZFhzw4df1jNd5TvUGZXZVsSjXo7UF'),
|
|
174
|
+
launchTs: 1698074659000,
|
|
155
175
|
oracleSource: __1.OracleSource.PYTH,
|
|
156
176
|
},
|
|
157
177
|
];
|
|
@@ -303,7 +323,27 @@ exports.MainnetPerpMarkets = [
|
|
|
303
323
|
baseAssetSymbol: 'HNT',
|
|
304
324
|
marketIndex: 14,
|
|
305
325
|
oracle: new web3_js_1.PublicKey('7moA1i5vQUpfDwSpK6Pw9s56ahB7WFGidtbL2ujWrVvm'),
|
|
306
|
-
launchTs:
|
|
326
|
+
launchTs: 1692294955000,
|
|
327
|
+
oracleSource: __1.OracleSource.PYTH,
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
fullName: 'INJ',
|
|
331
|
+
category: ['L1', 'Exchange'],
|
|
332
|
+
symbol: 'INJ-PERP',
|
|
333
|
+
baseAssetSymbol: 'INJ',
|
|
334
|
+
marketIndex: 15,
|
|
335
|
+
oracle: new web3_js_1.PublicKey('9EdtbaivHQYA4Nh3XzGR6DwRaoorqXYnmpfsnFhvwuVj'),
|
|
336
|
+
launchTs: 1698074659000,
|
|
337
|
+
oracleSource: __1.OracleSource.PYTH,
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
fullName: 'LINK',
|
|
341
|
+
category: ['Oracle'],
|
|
342
|
+
symbol: 'LINK-PERP',
|
|
343
|
+
baseAssetSymbol: 'LINK',
|
|
344
|
+
marketIndex: 16,
|
|
345
|
+
oracle: new web3_js_1.PublicKey('ALdkqQDMfHNg77oCNskfX751kHys4KE7SFuZzuKaN536'),
|
|
346
|
+
launchTs: 1698074659000,
|
|
307
347
|
oracleSource: __1.OracleSource.PYTH,
|
|
308
348
|
},
|
|
309
349
|
];
|
package/lib/user.js
CHANGED
|
@@ -1335,7 +1335,7 @@ class User {
|
|
|
1335
1335
|
const outContributionInitial = this.calculateSpotPositionFreeCollateralContribution(outSpotPosition, outStrictOraclePrice);
|
|
1336
1336
|
const { totalAssetValue: outTotalAssetValueInitial, totalLiabilityValue: outTotalLiabilityValueInitial, } = this.calculateSpotPositionLeverageContribution(outSpotPosition, outStrictOraclePrice);
|
|
1337
1337
|
const initialContribution = inContributionInitial.add(outContributionInitial);
|
|
1338
|
-
const { perpLiabilityValue, perpPnl, spotAssetValue, spotLiabilityValue } = this.getLeverageComponents(
|
|
1338
|
+
const { perpLiabilityValue, perpPnl, spotAssetValue, spotLiabilityValue } = this.getLeverageComponents();
|
|
1339
1339
|
if (!calculateSwap) {
|
|
1340
1340
|
calculateSwap = (inSwap) => {
|
|
1341
1341
|
return inSwap
|
|
@@ -1490,7 +1490,7 @@ class User {
|
|
|
1490
1490
|
this.getEmptySpotPosition(outMarketIndex);
|
|
1491
1491
|
const { totalAssetValue: inTotalAssetValueInitial, totalLiabilityValue: inTotalLiabilityValueInitial, } = this.calculateSpotPositionLeverageContribution(inSpotPosition, inStrictOraclePrice);
|
|
1492
1492
|
const { totalAssetValue: outTotalAssetValueInitial, totalLiabilityValue: outTotalLiabilityValueInitial, } = this.calculateSpotPositionLeverageContribution(outSpotPosition, outStrictOraclePrice);
|
|
1493
|
-
const { perpLiabilityValue, perpPnl, spotAssetValue, spotLiabilityValue } = this.getLeverageComponents(
|
|
1493
|
+
const { perpLiabilityValue, perpPnl, spotAssetValue, spotLiabilityValue } = this.getLeverageComponents();
|
|
1494
1494
|
const inPositionAfter = this.cloneAndUpdateSpotPosition(inSpotPosition, inAmount.abs().neg(), inMarket);
|
|
1495
1495
|
const outPositionAfter = this.cloneAndUpdateSpotPosition(outSpotPosition, outAmount.abs(), outMarket);
|
|
1496
1496
|
const { totalAssetValue: inTotalAssetValueAfter, totalLiabilityValue: inTotalLiabilityValueAfter, } = this.calculateSpotPositionLeverageContribution(inPositionAfter, inStrictOraclePrice);
|
package/package.json
CHANGED
|
@@ -161,7 +161,27 @@ export const DevnetPerpMarkets: PerpMarketConfig[] = [
|
|
|
161
161
|
baseAssetSymbol: 'HNT',
|
|
162
162
|
marketIndex: 14,
|
|
163
163
|
oracle: new PublicKey('6Eg8YdfFJQF2HHonzPUBSCCmyUEhrStg9VBLK957sBe6'),
|
|
164
|
-
launchTs:
|
|
164
|
+
launchTs: 1692294955000,
|
|
165
|
+
oracleSource: OracleSource.PYTH,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
fullName: 'INJ',
|
|
169
|
+
category: ['L1', 'Exchange'],
|
|
170
|
+
symbol: 'INJ-PERP',
|
|
171
|
+
baseAssetSymbol: 'INJ',
|
|
172
|
+
marketIndex: 15,
|
|
173
|
+
oracle: new PublicKey('44uRsNnT35kjkscSu59MxRr9CfkLZWf6gny8bWqUbVxE'),
|
|
174
|
+
launchTs: 1698074659000,
|
|
175
|
+
oracleSource: OracleSource.PYTH,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
fullName: 'LINK',
|
|
179
|
+
category: ['Oracle'],
|
|
180
|
+
symbol: 'LINK-PERP',
|
|
181
|
+
baseAssetSymbol: 'LINK',
|
|
182
|
+
marketIndex: 16,
|
|
183
|
+
oracle: new PublicKey('9sGidS4qUXS2WvHZFhzw4df1jNd5TvUGZXZVsSjXo7UF'),
|
|
184
|
+
launchTs: 1698074659000,
|
|
165
185
|
oracleSource: OracleSource.PYTH,
|
|
166
186
|
},
|
|
167
187
|
];
|
|
@@ -314,7 +334,27 @@ export const MainnetPerpMarkets: PerpMarketConfig[] = [
|
|
|
314
334
|
baseAssetSymbol: 'HNT',
|
|
315
335
|
marketIndex: 14,
|
|
316
336
|
oracle: new PublicKey('7moA1i5vQUpfDwSpK6Pw9s56ahB7WFGidtbL2ujWrVvm'),
|
|
317
|
-
launchTs:
|
|
337
|
+
launchTs: 1692294955000,
|
|
338
|
+
oracleSource: OracleSource.PYTH,
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
fullName: 'INJ',
|
|
342
|
+
category: ['L1', 'Exchange'],
|
|
343
|
+
symbol: 'INJ-PERP',
|
|
344
|
+
baseAssetSymbol: 'INJ',
|
|
345
|
+
marketIndex: 15,
|
|
346
|
+
oracle: new PublicKey('9EdtbaivHQYA4Nh3XzGR6DwRaoorqXYnmpfsnFhvwuVj'),
|
|
347
|
+
launchTs: 1698074659000,
|
|
348
|
+
oracleSource: OracleSource.PYTH,
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
fullName: 'LINK',
|
|
352
|
+
category: ['Oracle'],
|
|
353
|
+
symbol: 'LINK-PERP',
|
|
354
|
+
baseAssetSymbol: 'LINK',
|
|
355
|
+
marketIndex: 16,
|
|
356
|
+
oracle: new PublicKey('ALdkqQDMfHNg77oCNskfX751kHys4KE7SFuZzuKaN536'),
|
|
357
|
+
launchTs: 1698074659000,
|
|
318
358
|
oracleSource: OracleSource.PYTH,
|
|
319
359
|
},
|
|
320
360
|
];
|
package/src/user.ts
CHANGED
|
@@ -2412,7 +2412,7 @@ export class User {
|
|
|
2412
2412
|
);
|
|
2413
2413
|
|
|
2414
2414
|
const { perpLiabilityValue, perpPnl, spotAssetValue, spotLiabilityValue } =
|
|
2415
|
-
this.getLeverageComponents(
|
|
2415
|
+
this.getLeverageComponents();
|
|
2416
2416
|
|
|
2417
2417
|
if (!calculateSwap) {
|
|
2418
2418
|
calculateSwap = (inSwap: BN) => {
|
|
@@ -2708,7 +2708,7 @@ export class User {
|
|
|
2708
2708
|
);
|
|
2709
2709
|
|
|
2710
2710
|
const { perpLiabilityValue, perpPnl, spotAssetValue, spotLiabilityValue } =
|
|
2711
|
-
this.getLeverageComponents(
|
|
2711
|
+
this.getLeverageComponents();
|
|
2712
2712
|
|
|
2713
2713
|
const inPositionAfter = this.cloneAndUpdateSpotPosition(
|
|
2714
2714
|
inSpotPosition,
|