@gainsnetwork/sdk 0.2.33-rc1 → 0.2.33-rc3

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.
@@ -1,16 +1,14 @@
1
- import { LiquidationParams, OiWindows, OiWindowsSettings, PairDepth } from "./types";
1
+ import { LiquidationParams, OiWindows, OiWindowsSettings, PairDepth, PairFactor } from "./types";
2
2
  import { ContractsVersion } from "../contracts/types";
3
3
  export type SpreadContext = {
4
4
  isOpen?: boolean;
5
5
  isPnlPositive?: boolean;
6
- protectionCloseFactor?: number;
7
- protectionCloseFactorBlocks?: number;
8
- cumulativeFactor?: number;
9
6
  createdBlock?: number;
10
7
  liquidationParams?: LiquidationParams | undefined;
11
8
  currentBlock?: number | undefined;
12
9
  contractsVersion?: ContractsVersion | undefined;
13
- };
10
+ protectionCloseFactorWhitelist?: boolean;
11
+ } & Partial<PairFactor>;
14
12
  export declare const getProtectionCloseFactor: (spreadCtx: SpreadContext | undefined) => number;
15
13
  export declare const getCumulativeFactor: (spreadCtx: SpreadContext | undefined) => number;
16
14
  export declare const getLegacyFactor: (spreadCtx: SpreadContext | undefined) => number;
@@ -12,7 +12,8 @@ const getProtectionCloseFactor = (spreadCtx) => {
12
12
  spreadCtx.protectionCloseFactor === undefined ||
13
13
  spreadCtx.protectionCloseFactorBlocks === undefined ||
14
14
  spreadCtx.createdBlock === undefined ||
15
- spreadCtx.currentBlock === undefined)
15
+ spreadCtx.currentBlock === undefined ||
16
+ spreadCtx.protectionCloseFactorWhitelist === true)
16
17
  return constants_1.DEFAULT_PROTECTION_CLOSE_FACTOR;
17
18
  if (spreadCtx.isPnlPositive &&
18
19
  !spreadCtx.isOpen &&
@@ -25,7 +26,9 @@ const getProtectionCloseFactor = (spreadCtx) => {
25
26
  };
26
27
  exports.getProtectionCloseFactor = getProtectionCloseFactor;
27
28
  const getCumulativeFactor = (spreadCtx) => {
28
- if (spreadCtx === undefined || spreadCtx.cumulativeFactor === undefined || spreadCtx.cumulativeFactor === 0) {
29
+ if (spreadCtx === undefined ||
30
+ spreadCtx.cumulativeFactor === undefined ||
31
+ spreadCtx.cumulativeFactor === 0) {
29
32
  return constants_1.DEFAULT_CUMULATIVE_FACTOR;
30
33
  }
31
34
  return spreadCtx.cumulativeFactor;
@@ -35,6 +38,7 @@ const getLegacyFactor = (spreadCtx) => {
35
38
  return (spreadCtx === null || spreadCtx === void 0 ? void 0 : spreadCtx.contractsVersion) === types_1.ContractsVersion.BEFORE_V9_2 ? 1 : 2;
36
39
  };
37
40
  exports.getLegacyFactor = getLegacyFactor;
41
+ // @todo
38
42
  const getSpreadWithPriceImpactP = (pairSpreadP, buy, collateral, leverage, pairDepth, oiWindowsSettings, oiWindows, spreadCtx) => {
39
43
  if (pairSpreadP === undefined) {
40
44
  return 0;
@@ -60,6 +64,7 @@ const getSpreadWithPriceImpactP = (pairSpreadP, buy, collateral, leverage, pairD
60
64
  if (!onePercentDepth || activeOi === undefined || collateral === undefined) {
61
65
  return pairSpreadP / 2;
62
66
  }
67
+ // @todo implement exemptOnOpen && exemptAfterProtectionCloseFactor
63
68
  return ((0, exports.getSpreadP)(pairSpreadP) +
64
69
  ((activeOi * (0, exports.getCumulativeFactor)(spreadCtx) + (collateral * leverage) / 2) /
65
70
  onePercentDepth /
@@ -176,11 +176,14 @@ export type TraderFeeTiers = {
176
176
  outboundPoints: number;
177
177
  lastDayUpdatedPoints: number;
178
178
  expiredPoints: number[];
179
+ unclaimedPoints: number;
179
180
  };
180
181
  export type PairFactor = {
181
182
  cumulativeFactor: number;
182
183
  protectionCloseFactor: number;
183
184
  protectionCloseFactorBlocks: number;
185
+ exemptOnOpen: boolean;
186
+ exemptAfterProtectionCloseFactor: boolean;
184
187
  };
185
188
  export declare enum PendingOrderType {
186
189
  MARKET_OPEN = 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gainsnetwork/sdk",
3
- "version": "0.2.33-rc1",
3
+ "version": "0.2.33-rc3",
4
4
  "description": "Gains Network SDK",
5
5
  "main": "./lib/index.js",
6
6
  "files": [