@pioneer-platform/helpers 4.0.13 → 4.1.0

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,22 +1,7 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.SwapKitError = void 0;
19
- var errorMessages = {
4
+ const errorMessages = {
20
5
  /**
21
6
  * Core
22
7
  */
@@ -75,16 +60,12 @@ var errorMessages = {
75
60
  */
76
61
  helpers_number_different_decimals: 99101,
77
62
  };
78
- var SwapKitError = /** @class */ (function (_super) {
79
- __extends(SwapKitError, _super);
80
- function SwapKitError(errorKey, sourceError) {
81
- var _this = this;
63
+ class SwapKitError extends Error {
64
+ constructor(errorKey, sourceError) {
82
65
  console.error(sourceError, { stack: sourceError === null || sourceError === void 0 ? void 0 : sourceError.stack, message: sourceError === null || sourceError === void 0 ? void 0 : sourceError.message });
83
66
  // @ts-ignore
84
- _this = _super.call(this, errorKey, { cause: { code: errorMessages[errorKey], message: errorKey } }) || this;
85
- Object.setPrototypeOf(_this, SwapKitError.prototype);
86
- return _this;
67
+ super(errorKey, { cause: { code: errorMessages[errorKey], message: errorKey } });
68
+ Object.setPrototypeOf(this, SwapKitError.prototype);
87
69
  }
88
- return SwapKitError;
89
- }(Error));
70
+ }
90
71
  exports.SwapKitError = SwapKitError;
@@ -1,37 +1,17 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.SwapKitNumber = void 0;
19
- var bigIntArithmetics_1 = require("./bigIntArithmetics");
20
- var DEFAULT_DECIMAL = 8;
21
- var SwapKitNumber = /** @class */ (function (_super) {
22
- __extends(SwapKitNumber, _super);
23
- function SwapKitNumber() {
24
- return _super !== null && _super.apply(this, arguments) || this;
25
- }
26
- SwapKitNumber.prototype.eq = function (value) {
4
+ const bigIntArithmetics_1 = require("./bigIntArithmetics");
5
+ const DEFAULT_DECIMAL = 8;
6
+ class SwapKitNumber extends bigIntArithmetics_1.BigIntArithmetics {
7
+ eq(value) {
27
8
  return this.eqValue(value);
28
- };
29
- SwapKitNumber.fromBigInt = function (value, decimal) {
9
+ }
10
+ static fromBigInt(value, decimal) {
30
11
  return new SwapKitNumber({
31
- decimal: decimal,
32
- value: (0, bigIntArithmetics_1.formatBigIntToSafeValue)({ value: value, bigIntDecimal: (0, bigIntArithmetics_1.toMultiplier)(decimal || DEFAULT_DECIMAL), decimal: decimal }),
12
+ decimal,
13
+ value: (0, bigIntArithmetics_1.formatBigIntToSafeValue)({ value, bigIntDecimal: (0, bigIntArithmetics_1.toMultiplier)(decimal || DEFAULT_DECIMAL), decimal }),
33
14
  });
34
- };
35
- return SwapKitNumber;
36
- }(bigIntArithmetics_1.BigIntArithmetics));
15
+ }
16
+ }
37
17
  exports.SwapKitNumber = SwapKitNumber;
package/package.json CHANGED
@@ -1,25 +1,28 @@
1
1
  {
2
2
  "name": "@pioneer-platform/helpers",
3
- "version": "4.0.13",
3
+ "version": "4.1.0",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
- "scripts": {
7
- "npm": "npm i",
8
- "test": "npm run build && node __tests__/test-module.js",
9
- "lint": "prettier --write '**/**/*.ts'",
10
- "start": "nodemon --watch 'src/**/*.ts' --exec ts-node __tests__node",
11
- "build": "tsc -p .",
12
- "prepublish": "npm run build",
13
- "refresh": "rm -rf ./node_modules ./package-lock.json && npm install"
14
- },
15
6
  "dependencies": {
7
+ "@coinmasters/core": "^12.0.8",
16
8
  "@coinmasters/tokens": "^3.7.28",
17
- "@coinmasters/types": "latest",
9
+ "@coinmasters/types": "^4.10.1",
18
10
  "@noble/hashes": "^1.4.0",
19
- "@pioneer-platform/loggerdog": "^8.3.1",
11
+ "@pioneer-platform/loggerdog": "^8.4.0",
20
12
  "@types/node": "^18.15.11",
13
+ "ethers": "5.7.2",
14
+ "ky": "^1.8.0",
21
15
  "ts-node": "^8.10.2",
22
- "typescript": "^5.0.2"
16
+ "typescript": "^5.0.4"
23
17
  },
24
- "gitHead": "e4a7114f00103ee48533c369dba4a02021ddcbe4"
25
- }
18
+ "gitHead": "aeae28273014ab69b42f22abec159c6693a56c40",
19
+ "scripts": {
20
+ "npm": "pnpm i",
21
+ "test": "pnpm run build && node __tests__/test-module.js",
22
+ "lint": "prettier --write '**/**/*.ts'",
23
+ "start": "nodemon --watch 'src/**/*.ts' --exec ts-node __tests__node",
24
+ "build": "tsc -p .",
25
+ "prepublish": "pnpm run build",
26
+ "refresh": "rm -rf ./node_modules ./package-lock.json && pnpm install"
27
+ }
28
+ }
@@ -85,7 +85,6 @@ export const isGasAsset = ({ chain, symbol }: { chain: Chain; symbol: string })
85
85
  case Chain.Ripple:
86
86
  case Chain.Litecoin:
87
87
  case Chain.Dogecoin:
88
- case Chain.Binance:
89
88
  case Chain.Ethereum:
90
89
  case Chain.Avalanche:
91
90
  return symbol === chain;
@@ -144,7 +143,6 @@ export const getCommonAssetInfo = (
144
143
  case Chain.Dash:
145
144
  case Chain.Litecoin:
146
145
  case Chain.Dogecoin:
147
- case Chain.Binance:
148
146
  case Chain.Polygon:
149
147
  case Chain.Bitcoin:
150
148
  case Chain.Ethereum:
@@ -172,10 +170,7 @@ export const getAssetType = ({ chain, symbol }: { chain: Chain; symbol: string }
172
170
  return symbol === 'ATOM' ? 'Native' : Chain.Cosmos;
173
171
  case Chain.Kujira:
174
172
  return symbol === Chain.Kujira ? 'Native' : Chain.Kujira;
175
- case Chain.Binance:
176
- return symbol === Chain.Binance ? 'Native' : 'BEP2';
177
173
  case Chain.BinanceSmartChain:
178
- return symbol === Chain.Binance ? 'Native' : 'BEP20';
179
174
  case Chain.Ethereum:
180
175
  return symbol === Chain.Ethereum ? 'Native' : 'ERC20';
181
176
  case Chain.Avalanche:
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es5",
3
+ "target": "es2015",
4
4
  "module": "commonjs",
5
5
  "lib": ["es6", "es2015", "dom"],
6
6
  "declaration": true,