@cryptorubic/core 0.6.4 → 0.6.5

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/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
- "name": "@cryptorubic/core",
3
- "version": "0.6.4",
4
- "dependencies": {
5
- "tslib": "^2.3.0",
6
- "bignumber.js": "9.1.2",
7
- "jest-mock-promise": "^2.0.2"
8
- },
9
- "type": "commonjs",
10
- "main": "./src/index.js",
11
- "typings": "./src/index.d.ts",
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "author": {
16
- "name": "Sleta Dmitrii"
17
- },
18
- "types": "./src/index.d.ts"
2
+ "name": "@cryptorubic/core",
3
+ "version": "0.6.5",
4
+ "dependencies": {
5
+ "tslib": "^2.3.0",
6
+ "bignumber.js": "9.1.2",
7
+ "jest-mock-promise": "^2.0.2"
8
+ },
9
+ "type": "commonjs",
10
+ "main": "./src/index.js",
11
+ "typings": "./src/index.d.ts",
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "author": {
16
+ "name": "Sleta Dmitrii"
17
+ },
18
+ "types": "./src/index.d.ts"
19
19
  }
@@ -1,4 +1,8 @@
1
1
  export interface UniqueProviderInfoInterface {
2
2
  changenowId?: string;
3
+ changellyId?: string;
4
+ simpleSwapId?: string;
5
+ retroBridgeId?: string;
6
+ squidrouterRequestId?: string;
3
7
  rangoRequestId?: string;
4
8
  }
@@ -76,12 +76,7 @@ class PriceTokenAmount extends price_token_1.PriceToken {
76
76
  };
77
77
  }
78
78
  calculatePriceImpactPercent(toToken) {
79
- if (!this.price ||
80
- !toToken.price ||
81
- !this.tokenAmount ||
82
- !toToken.tokenAmount ||
83
- this.price.lt(0) ||
84
- toToken.price.lt(0)) {
79
+ if (!this.price || !toToken.price || !this.tokenAmount || !toToken.tokenAmount || this.price.lt(0) || toToken.price.lt(0)) {
85
80
  return null;
86
81
  }
87
82
  const fromTokenCost = this.tokenAmount.multipliedBy(this.price);
@@ -44,16 +44,13 @@ class Token {
44
44
  this.decimals = tokenStruct.decimals;
45
45
  }
46
46
  isEqualTo(token) {
47
- return (token.blockchain === this.blockchain &&
48
- token.address.toLowerCase() === this.address.toLowerCase());
47
+ return token.blockchain === this.blockchain && token.address.toLowerCase() === this.address.toLowerCase();
49
48
  }
50
49
  isEqualToTokens(tokens) {
51
50
  return tokens.some((token) => this.isEqualTo(token));
52
51
  }
53
52
  static toWei(amount, decimals = 18, roundingMode) {
54
- return new bignumber_js_1.default(amount || 0)
55
- .times(new bignumber_js_1.default(10).pow(decimals))
56
- .toFixed(0, roundingMode);
53
+ return new bignumber_js_1.default(amount || 0).times(new bignumber_js_1.default(10).pow(decimals)).toFixed(0, roundingMode);
57
54
  }
58
55
  /**
59
56
  * Converts amount from Wei to Ether units.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Cache = Cache;
4
4
  exports.PConditionalCache = PConditionalCache;
5
5
  function generateKey(...args) {
6
- return args.reduce((acc, arg) => Object(arg) === arg ? acc + JSON.stringify(arg) : acc + String(arg), '');
6
+ return args.reduce((acc, arg) => (Object(arg) === arg ? acc + JSON.stringify(arg) : acc + String(arg)), '');
7
7
  }
8
8
  function saveResult(storage, key, result, maxAge) {
9
9
  const validUntilTimestamp = maxAge ? Date.now() + maxAge : Infinity;