@pioneer-platform/helpers 4.1.1 → 4.3.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.
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateIdentifier = void 0;
4
+ const types_1 = require("@coinmasters/types");
5
+ const supportedChains = Object.values(types_1.Chain);
6
+ const validateIdentifier = (identifier = '') => {
7
+ const uppercasedIdentifier = identifier.toUpperCase();
8
+ const [chain] = uppercasedIdentifier.split('.');
9
+ if (supportedChains.includes(chain))
10
+ return true;
11
+ const [synthChain] = uppercasedIdentifier.split('/');
12
+ if (supportedChains.includes(synthChain))
13
+ return true;
14
+ throw new Error(`Invalid identifier: ${identifier}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`);
15
+ };
16
+ exports.validateIdentifier = validateIdentifier;
package/lib/index.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Helpers
3
+ */
4
+ export * from './helpers/asset';
5
+ export * from './helpers/liquidity';
6
+ export * from './helpers/memo';
7
+ export * from './helpers/others';
8
+ export * from './helpers/request';
9
+ /**
10
+ * Modules
11
+ */
12
+ export * from './modules/assetValue';
13
+ export * from './modules/bigIntArithmetics';
14
+ export * from './modules/swapKitError';
15
+ export * from './modules/swapKitNumber';
package/lib/index.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Helpers
19
+ */
20
+ __exportStar(require("./helpers/asset"), exports);
21
+ __exportStar(require("./helpers/liquidity"), exports);
22
+ __exportStar(require("./helpers/memo"), exports);
23
+ __exportStar(require("./helpers/others"), exports);
24
+ __exportStar(require("./helpers/request"), exports);
25
+ /**
26
+ * Modules
27
+ */
28
+ __exportStar(require("./modules/assetValue"), exports);
29
+ __exportStar(require("./modules/bigIntArithmetics"), exports);
30
+ __exportStar(require("./modules/swapKitError"), exports);
31
+ __exportStar(require("./modules/swapKitNumber"), exports);