@gainsnetwork/sdk 0.2.12-rc15 → 0.2.12-rc17

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.
@@ -256,6 +256,18 @@ export declare const pairs: {
256
256
  "UXLINK/USD": string;
257
257
  "AVAIL/USD": string;
258
258
  "BANANA/USD": string;
259
+ "RARE/USD": string;
260
+ "SYS/USD": string;
261
+ "NMR/USD": string;
262
+ "RSR/USD": string;
263
+ "SYN/USD": string;
264
+ "AUCTION/USD": string;
265
+ "ALICE/USD": string;
266
+ "SUN/USD": string;
267
+ "TRB/USD": string;
268
+ "DOGS/USD": string;
269
+ "SSV/USD": string;
270
+ "PONKE/USD": string;
259
271
  };
260
272
  export declare const getAssetClassFromGroupIndex: (groupIndex: number) => string | undefined;
261
273
  export declare const tickerChanges: {
package/lib/constants.js CHANGED
@@ -264,6 +264,18 @@ exports.pairs = {
264
264
  "UXLINK/USD": CRYPTO,
265
265
  "AVAIL/USD": CRYPTO,
266
266
  "BANANA/USD": CRYPTO,
267
+ "RARE/USD": CRYPTO,
268
+ "SYS/USD": CRYPTO,
269
+ "NMR/USD": CRYPTO,
270
+ "RSR/USD": CRYPTO,
271
+ "SYN/USD": CRYPTO,
272
+ "AUCTION/USD": CRYPTO,
273
+ "ALICE/USD": CRYPTO,
274
+ "SUN/USD": CRYPTO,
275
+ "TRB/USD": CRYPTO,
276
+ "DOGS/USD": CRYPTO,
277
+ "SSV/USD": CRYPTO,
278
+ "PONKE/USD": CRYPTO,
267
279
  };
268
280
  const getAssetClassFromGroupIndex = (groupIndex) => {
269
281
  switch (groupIndex) {
@@ -296,10 +308,10 @@ exports.stockSplits = {
296
308
  "TSLA_1/USD": { date: "8/25/2022", split: 3 },
297
309
  };
298
310
  exports.delistedPairIxs = new Set([
299
- 6, 31, 36, 42, 45, 48, 51, 54, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
300
- 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
301
- 89, 97, 99, 101, 106, 108, 52, 131, 147, 160, 179, 182, 183, 190, 229, 163,
302
- 155, 15, 170, 239, 254, 230,
311
+ 6, 31, 36, 45, 48, 51, 54, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
312
+ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
313
+ 97, 99, 101, 106, 108, 52, 131, 147, 160, 179, 182, 183, 190, 229, 163, 155,
314
+ 15, 170, 239, 254, 230,
303
315
  ]);
304
316
  exports.delistedGroupsIxs = new Set([6, 7]);
305
317
  exports.DEFAULT_PROTECTION_CLOSE_FACTOR = 1;
@@ -362,4 +362,16 @@ const PAIR_INDEX_TO_DESCRIPTION = {
362
362
  [types_1.PairIndex.UXLINKUSD]: "UXLINK to US Dollar",
363
363
  [types_1.PairIndex.AVAILUSD]: "Avail to US Dollar",
364
364
  [types_1.PairIndex.BANANAUSD]: "Banana Gun to US Dollar",
365
+ [types_1.PairIndex.RAREUSD]: "SuperRare to US Dollar",
366
+ [types_1.PairIndex.SYSUSD]: "Syscoin to US Dollar",
367
+ [types_1.PairIndex.NMRUSD]: "Numeraire to US Dollar",
368
+ [types_1.PairIndex.RSRUSD]: "Reserve Rights to US Dollar",
369
+ [types_1.PairIndex.SYNUSD]: "Synapse to US Dollar",
370
+ [types_1.PairIndex.AUCTIONUSD]: "Bounce to US Dollar",
371
+ [types_1.PairIndex.ALICEUSD]: "My Neighbor Alice to US Dollar",
372
+ [types_1.PairIndex.SUNUSD]: "Sun to US Dollar",
373
+ [types_1.PairIndex.TRBUSD]: "Tellor tributes to US Dollar",
374
+ [types_1.PairIndex.DOGSUSD]: "DOGS to US Dollar",
375
+ [types_1.PairIndex.SSVUSD]: "ssv.network to US Dollar",
376
+ [types_1.PairIndex.PONKEUSD]: "Ponke to US Dollar",
365
377
  };
@@ -8,4 +8,4 @@ export type GetLiquidationPriceContext = GetBorrowingFeeContext & {
8
8
  contractsVersion: ContractsVersion | undefined;
9
9
  };
10
10
  export declare const getLiquidationPrice: (trade: Trade, fee: Fee, initialAccFees: BorrowingFee.InitialAccFees, context: GetLiquidationPriceContext) => number;
11
- export declare const getLiqPnlThresholdP: (liquidationParams: LiquidationParams | undefined, leverage: number | undefined, contractsVersion: ContractsVersion | undefined) => number;
11
+ export declare const getLiqPnlThresholdP: (liquidationParams: LiquidationParams | undefined, leverage: number | undefined) => number;
@@ -8,12 +8,13 @@ const getLiquidationPrice = (trade, fee, initialAccFees, context) => {
8
8
  var _a;
9
9
  const closingFee = (0, fees_1.getClosingFee)(trade.collateralAmount, trade.leverage, trade.pairIndex, fee, context.collateralPriceUsd);
10
10
  const borrowingFee = (0, fees_1.getBorrowingFee)(trade.collateralAmount * trade.leverage, trade.pairIndex, trade.long, initialAccFees, context);
11
- const liqThresholdP = (0, exports.getLiqPnlThresholdP)(context.liquidationParams, trade.leverage, context.contractsVersion);
11
+ const liqThresholdP = (0, exports.getLiqPnlThresholdP)(context.liquidationParams, trade.leverage);
12
12
  let liqPriceDistance = (trade.openPrice *
13
13
  (trade.collateralAmount * liqThresholdP - (borrowingFee + closingFee))) /
14
14
  trade.collateralAmount /
15
15
  trade.leverage;
16
- if ((context === null || context === void 0 ? void 0 : context.contractsVersion) === types_1.ContractsVersion.V9_2 &&
16
+ if ((context === null || context === void 0 ? void 0 : context.contractsVersion) !== undefined &&
17
+ context.contractsVersion >= types_1.ContractsVersion.V9_2 &&
17
18
  ((_a = context === null || context === void 0 ? void 0 : context.liquidationParams) === null || _a === void 0 ? void 0 : _a.maxLiqSpreadP) !== undefined &&
18
19
  context.liquidationParams.maxLiqSpreadP > 0) {
19
20
  const closingSpreadP = (0, spread_1.getSpreadP)(context.pairSpreadP, true, context.liquidationParams);
@@ -24,10 +25,9 @@ const getLiquidationPrice = (trade, fee, initialAccFees, context) => {
24
25
  : Math.max(trade.openPrice + liqPriceDistance, 0);
25
26
  };
26
27
  exports.getLiquidationPrice = getLiquidationPrice;
27
- const getLiqPnlThresholdP = (liquidationParams, leverage, contractsVersion) => {
28
+ const getLiqPnlThresholdP = (liquidationParams, leverage) => {
28
29
  if (liquidationParams === undefined ||
29
30
  leverage === undefined ||
30
- contractsVersion === types_1.ContractsVersion.BEFORE_V9_2 ||
31
31
  liquidationParams.maxLiqSpreadP === 0 ||
32
32
  liquidationParams.startLiqThresholdP === 0 ||
33
33
  liquidationParams.endLiqThresholdP === 0 ||
package/lib/trade/pnl.js CHANGED
@@ -21,8 +21,7 @@ const getPnl = (price, trade, tradeInfo, initialAccFees, liquidationParams, useF
21
21
  let pnlPercentage = (pnlCollat / posCollat) * 100;
22
22
  // Can be liquidated
23
23
  if (pnlPercentage <=
24
- (0, liquidation_1.getLiqPnlThresholdP)(liquidationParams, leverage, context.contractsVersion) *
25
- -100) {
24
+ (0, liquidation_1.getLiqPnlThresholdP)(liquidationParams, leverage) * -100) {
26
25
  pnlPercentage = -100;
27
26
  }
28
27
  else {
@@ -462,5 +462,17 @@ export declare enum PairIndex {
462
462
  SLERFUSD = 253,
463
463
  UXLINKUSD = 254,
464
464
  AVAILUSD = 255,
465
- BANANAUSD = 256
465
+ BANANAUSD = 256,
466
+ RAREUSD = 257,
467
+ SYSUSD = 258,
468
+ NMRUSD = 259,
469
+ RSRUSD = 260,
470
+ SYNUSD = 261,
471
+ AUCTIONUSD = 262,
472
+ ALICEUSD = 263,
473
+ SUNUSD = 264,
474
+ TRBUSD = 265,
475
+ DOGSUSD = 266,
476
+ SSVUSD = 267,
477
+ PONKEUSD = 268
466
478
  }
@@ -286,4 +286,16 @@ var PairIndex;
286
286
  PairIndex[PairIndex["UXLINKUSD"] = 254] = "UXLINKUSD";
287
287
  PairIndex[PairIndex["AVAILUSD"] = 255] = "AVAILUSD";
288
288
  PairIndex[PairIndex["BANANAUSD"] = 256] = "BANANAUSD";
289
+ PairIndex[PairIndex["RAREUSD"] = 257] = "RAREUSD";
290
+ PairIndex[PairIndex["SYSUSD"] = 258] = "SYSUSD";
291
+ PairIndex[PairIndex["NMRUSD"] = 259] = "NMRUSD";
292
+ PairIndex[PairIndex["RSRUSD"] = 260] = "RSRUSD";
293
+ PairIndex[PairIndex["SYNUSD"] = 261] = "SYNUSD";
294
+ PairIndex[PairIndex["AUCTIONUSD"] = 262] = "AUCTIONUSD";
295
+ PairIndex[PairIndex["ALICEUSD"] = 263] = "ALICEUSD";
296
+ PairIndex[PairIndex["SUNUSD"] = 264] = "SUNUSD";
297
+ PairIndex[PairIndex["TRBUSD"] = 265] = "TRBUSD";
298
+ PairIndex[PairIndex["DOGSUSD"] = 266] = "DOGSUSD";
299
+ PairIndex[PairIndex["SSVUSD"] = 267] = "SSVUSD";
300
+ PairIndex[PairIndex["PONKEUSD"] = 268] = "PONKEUSD";
289
301
  })(PairIndex = exports.PairIndex || (exports.PairIndex = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gainsnetwork/sdk",
3
- "version": "0.2.12-rc15",
3
+ "version": "0.2.12-rc17",
4
4
  "description": "Gains Network SDK",
5
5
  "main": "./lib/index.js",
6
6
  "files": [