@pioneer-platform/helpers 3.0.1 → 4.0.1

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.
Files changed (48) hide show
  1. package/lib/helpers/asset.d.ts +36 -0
  2. package/lib/helpers/asset.js +270 -0
  3. package/lib/helpers/liquidity.d.ts +58 -0
  4. package/lib/helpers/liquidity.js +112 -0
  5. package/lib/helpers/memo.d.ts +46 -0
  6. package/lib/helpers/memo.js +46 -0
  7. package/lib/helpers/others.d.ts +3 -0
  8. package/lib/helpers/others.js +24 -0
  9. package/lib/helpers/request.d.ts +5 -0
  10. package/lib/helpers/request.js +117 -0
  11. package/lib/helpers/validators.d.ts +1 -0
  12. package/lib/helpers/validators.js +17 -0
  13. package/lib/index.d.ts +15 -0
  14. package/lib/index.js +31 -0
  15. package/lib/modules/__tests__/assetValue.test.d.ts +1 -0
  16. package/lib/modules/__tests__/assetValue.test.js +399 -0
  17. package/lib/modules/__tests__/swapKitNumber.test.d.ts +1 -0
  18. package/lib/modules/__tests__/swapKitNumber.test.js +425 -0
  19. package/lib/modules/assetValue.d.ts +55 -0
  20. package/lib/modules/assetValue.js +391 -0
  21. package/lib/modules/bigIntArithmetics.d.ts +58 -0
  22. package/lib/modules/bigIntArithmetics.js +344 -0
  23. package/lib/modules/swapKitError.d.ts +64 -0
  24. package/lib/modules/swapKitError.js +90 -0
  25. package/lib/modules/swapKitNumber.d.ts +6 -0
  26. package/lib/modules/swapKitNumber.js +36 -0
  27. package/package.json +21 -37
  28. package/src/helpers/asset.ts +232 -0
  29. package/src/helpers/liquidity.ts +174 -0
  30. package/src/helpers/memo.ts +90 -0
  31. package/src/helpers/others.ts +20 -0
  32. package/src/helpers/request.ts +38 -0
  33. package/src/helpers/validators.ts +17 -0
  34. package/src/index.ts +16 -6
  35. package/src/modules/assetValue.ts +359 -0
  36. package/src/modules/bigIntArithmetics.ts +416 -0
  37. package/src/{exceptions/SwapKitError.ts → modules/swapKitError.ts} +15 -4
  38. package/src/modules/swapKitNumber.ts +16 -0
  39. package/tsconfig.json +13 -0
  40. package/LICENSE +0 -21
  41. package/src/__tests__/asset.test.ts +0 -33
  42. package/src/__tests__/derivationPath.test.ts +0 -16
  43. package/src/amount.ts +0 -29
  44. package/src/asset.ts +0 -13
  45. package/src/derivationPath.ts +0 -5
  46. package/src/exceptions/index.ts +0 -1
  47. package/src/fees.ts +0 -13
  48. package/src/request.ts +0 -34
@@ -0,0 +1,391 @@
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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
41
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
42
+ return new (P || (P = Promise))(function (resolve, reject) {
43
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
44
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
45
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
46
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
47
+ });
48
+ };
49
+ var __generator = (this && this.__generator) || function (thisArg, body) {
50
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
51
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
52
+ function verb(n) { return function (v) { return step([n, v]); }; }
53
+ function step(op) {
54
+ if (f) throw new TypeError("Generator is already executing.");
55
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
56
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
57
+ if (y = 0, t) op = [op[0] & 2, t.value];
58
+ switch (op[0]) {
59
+ case 0: case 1: t = op; break;
60
+ case 4: _.label++; return { value: op[1], done: false };
61
+ case 5: _.label++; y = op[1]; op = [0]; continue;
62
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
63
+ default:
64
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
65
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
66
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
67
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
68
+ if (t[2]) _.ops.pop();
69
+ _.trys.pop(); continue;
70
+ }
71
+ op = body.call(thisArg, _);
72
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
73
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
74
+ }
75
+ };
76
+ var __rest = (this && this.__rest) || function (s, e) {
77
+ var t = {};
78
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
79
+ t[p] = s[p];
80
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
81
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
82
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
83
+ t[p[i]] = s[p[i]];
84
+ }
85
+ return t;
86
+ };
87
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
88
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
89
+ if (ar || !(i in from)) {
90
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
91
+ ar[i] = from[i];
92
+ }
93
+ }
94
+ return to.concat(ar || Array.prototype.slice.call(from));
95
+ };
96
+ Object.defineProperty(exports, "__esModule", { value: true });
97
+ exports.getMinAmountByChain = exports.AssetValue = void 0;
98
+ var types_1 = require("@coinmasters/types");
99
+ var asset_1 = require("../helpers/asset");
100
+ var validators_1 = require("../helpers/validators");
101
+ var bigIntArithmetics_1 = require("./bigIntArithmetics");
102
+ function safeValue(value, decimal) {
103
+ try {
104
+ if (typeof value === 'bigint') {
105
+ return (0, bigIntArithmetics_1.formatBigIntToSafeValue)({ value: value, bigIntDecimal: decimal, decimal: decimal });
106
+ }
107
+ return value;
108
+ }
109
+ catch (error) {
110
+ console.error('Error in safeValue:', error);
111
+ return 0;
112
+ }
113
+ }
114
+ var staticTokensMap;
115
+ var getStaticToken = function (identifier) {
116
+ if (!staticTokensMap) {
117
+ throw new Error('Static assets not loaded, call await AssetValue.loadStaticAssets() first');
118
+ }
119
+ //console.log('getStaticToken: staticTokensMap: ', staticTokensMap);
120
+ //console.log('getStaticToken: identifier: ', identifier.toUpperCase());
121
+ var tokenInfo = staticTokensMap.get(identifier.toUpperCase());
122
+ return tokenInfo || { decimal: types_1.BaseDecimal.THOR, identifier: '' };
123
+ };
124
+ var createAssetValue = function (assetString, value) {
125
+ if (value === void 0) { value = 0; }
126
+ return __awaiter(void 0, void 0, void 0, function () {
127
+ var decimal, parsedValue;
128
+ return __generator(this, function (_a) {
129
+ switch (_a.label) {
130
+ case 0:
131
+ (0, validators_1.validateIdentifier)(assetString);
132
+ return [4 /*yield*/, (0, asset_1.getDecimal)(getAssetInfo(assetString))];
133
+ case 1:
134
+ decimal = _a.sent();
135
+ parsedValue = safeValue(value, decimal);
136
+ return [2 /*return*/, new AssetValue({ decimal: decimal, value: parsedValue, identifier: assetString })];
137
+ }
138
+ });
139
+ });
140
+ };
141
+ var AssetValue = /** @class */ (function (_super) {
142
+ __extends(AssetValue, _super);
143
+ // @ts-ignore
144
+ function AssetValue(params) {
145
+ var _this = this;
146
+ var identifier = 'identifier' in params ? params.identifier : "".concat(params.chain, ".").concat(params.symbol);
147
+ console.log('identifier: ', identifier);
148
+ var value;
149
+ if (params.value instanceof bigIntArithmetics_1.BigIntArithmetics) {
150
+ value = params.value;
151
+ }
152
+ else {
153
+ value = { decimal: params.decimal, value: params.value };
154
+ }
155
+ console.log('value: ', value);
156
+ _this = _super.call(this, value) || this;
157
+ _this.isGasAsset = false;
158
+ _this.isSynthetic = false;
159
+ // super(
160
+ // params.value instanceof BigIntArithmetics
161
+ // ? params.value
162
+ // : { decimal: params.decimal, value: params.value },
163
+ // );
164
+ var assetInfo = getAssetInfo(identifier);
165
+ console.log('assetInfo: ', assetInfo);
166
+ _this.type = (0, asset_1.getAssetType)(assetInfo);
167
+ _this.chain = assetInfo.chain;
168
+ _this.ticker = assetInfo.ticker;
169
+ _this.symbol = assetInfo.symbol;
170
+ _this.address = assetInfo.address;
171
+ _this.isSynthetic = assetInfo.isSynthetic;
172
+ // @ts-ignore
173
+ _this.isGasAsset = assetInfo.isGasAsset;
174
+ _this.tax = params.tax;
175
+ return _this;
176
+ }
177
+ AssetValue.prototype.toString = function (short) {
178
+ if (short === void 0) { short = false; }
179
+ var shortFormat = this.isSynthetic ? this.symbol : this.ticker;
180
+ return short
181
+ ? // ETH/THOR-0xa5f2211b9b8170f694421f2046281775e8468044 | USDT
182
+ shortFormat
183
+ : // THOR.ETH/ETH | ETH.USDT-0x1234567890
184
+ "".concat(this.chain, ".").concat(this.symbol);
185
+ };
186
+ AssetValue.prototype.toUrl = function () {
187
+ return this.isSynthetic ? "".concat(this.chain, ".").concat(this.symbol.replace('/', '.')) : this.toString();
188
+ };
189
+ AssetValue.prototype.eq = function (_a) {
190
+ var chain = _a.chain, symbol = _a.symbol;
191
+ return this.chain === chain && this.symbol === symbol;
192
+ };
193
+ AssetValue.fromString = function (assetString, value) {
194
+ if (value === void 0) { value = 0; }
195
+ return __awaiter(this, void 0, void 0, function () {
196
+ return __generator(this, function (_a) {
197
+ return [2 /*return*/, createAssetValue(assetString, value)];
198
+ });
199
+ });
200
+ };
201
+ // static fromStringSync(assetString: string, value: NumberPrimitives = 0) {
202
+ // const { isSynthetic, symbol, chain, isGasAsset, ticker, address } = getAssetInfo(assetString);
203
+ // console.log('getAssetInfo: ', { isSynthetic, symbol, chain, isGasAsset, ticker, address });
204
+ // const { tax, decimal, identifier: tokenIdentifier } = getStaticToken(assetString as unknown as TokenNames);
205
+ // console.log('getStaticToken: ', { tax, decimal, tokenIdentifier });
206
+ //
207
+ // // Convert value to a BigInt if necessary
208
+ // let safeValue = (val: NumberPrimitives, decimal: number): BigInt => {
209
+ // if (typeof val === 'bigint') {
210
+ // return val;
211
+ // } else if (typeof val === 'number') {
212
+ // return BigInt(val * Math.pow(10, decimal));
213
+ // } else {
214
+ // return BigInt(0);
215
+ // }
216
+ // };
217
+ //
218
+ // const parsedValue = safeValue(value, decimal);
219
+ // console.log('parsedValue: ', parsedValue);
220
+ //
221
+ // let asset: AssetValue | undefined;
222
+ //
223
+ // if (tokenIdentifier) {
224
+ // console.log('tokenIdentifier is truthy'); // Indicates tokenIdentifier has a value considered true in a boolean context
225
+ // asset = new AssetValue({
226
+ // tax,
227
+ // decimal,
228
+ // identifier: tokenIdentifier,
229
+ // value: parsedValue,
230
+ // });
231
+ // } else if (isSynthetic) {
232
+ // console.log('isSynthetic is true'); // Indicates the asset is synthetic
233
+ // asset = new AssetValue({
234
+ // tax,
235
+ // decimal: 8, // Synthetic assets use a fixed decimal value
236
+ // identifier: assetString,
237
+ // value: parsedValue,
238
+ // });
239
+ // } else {
240
+ // asset = undefined;
241
+ // }
242
+ //
243
+ // return asset;
244
+ // }
245
+ AssetValue.fromStringSync = function (assetString, value) {
246
+ if (value === void 0) { value = 0; }
247
+ var _a = getAssetInfo(assetString), isSynthetic = _a.isSynthetic, symbol = _a.symbol, chain = _a.chain, isGasAsset = _a.isGasAsset, ticker = _a.ticker, address = _a.address;
248
+ console.log('getAssetInfo: ', { isSynthetic: isSynthetic, symbol: symbol, chain: chain, isGasAsset: isGasAsset, ticker: ticker, address: address });
249
+ var _b = getStaticToken(assetString), tax = _b.tax, decimal = _b.decimal, tokenIdentifier = _b.identifier;
250
+ console.log('getStaticToken: ', { tax: tax, decimal: decimal, tokenIdentifier: tokenIdentifier });
251
+ console.log('value: ', value);
252
+ console.log('decimal: ', decimal);
253
+ var parsedValue = safeValue(value, decimal);
254
+ console.log('parsedValue: ', parsedValue);
255
+ var asset;
256
+ if (tokenIdentifier) {
257
+ console.log('tokenIdentifier is truthy'); // Indicates tokenIdentifier has a value considered true in a boolean context
258
+ asset = new AssetValue({
259
+ tax: tax,
260
+ decimal: decimal,
261
+ identifier: tokenIdentifier,
262
+ value: parsedValue,
263
+ });
264
+ }
265
+ else if (isSynthetic) {
266
+ console.log('isSynthetic is true'); // Indicates the asset is synthetic
267
+ asset = new AssetValue({
268
+ tax: tax,
269
+ decimal: 8, // Synthetic assets use a fixed decimal value
270
+ identifier: assetString,
271
+ value: parsedValue,
272
+ });
273
+ }
274
+ else {
275
+ //console.log('No valid condition met'); // Neither condition is true, asset is left undefined
276
+ asset = undefined;
277
+ }
278
+ return asset;
279
+ };
280
+ AssetValue.fromIdentifier = function (assetString, value) {
281
+ if (value === void 0) { value = 0; }
282
+ return __awaiter(this, void 0, void 0, function () {
283
+ return __generator(this, function (_a) {
284
+ return [2 /*return*/, createAssetValue(assetString, value)];
285
+ });
286
+ });
287
+ };
288
+ AssetValue.fromIdentifierSync = function (identifier, value) {
289
+ if (value === void 0) { value = 0; }
290
+ var _a = getStaticToken(identifier), decimal = _a.decimal, tokenIdentifier = _a.identifier;
291
+ var parsedValue = safeValue(value, decimal);
292
+ return new AssetValue({ decimal: decimal, identifier: tokenIdentifier, value: parsedValue });
293
+ };
294
+ AssetValue.fromChainOrSignature = function (assetString, value) {
295
+ if (value === void 0) { value = 0; }
296
+ var _a = (0, asset_1.getCommonAssetInfo)(assetString), decimal = _a.decimal, identifier = _a.identifier;
297
+ if (!decimal || !identifier)
298
+ throw Error('unknown coin! ' + assetString);
299
+ var parsedValue = safeValue(value, decimal);
300
+ return new AssetValue({ value: parsedValue, decimal: decimal, identifier: identifier });
301
+ };
302
+ AssetValue.loadStaticAssets = function () {
303
+ return __awaiter(this, void 0, void 0, function () {
304
+ var _this = this;
305
+ return __generator(this, function (_a) {
306
+ return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
307
+ var _a, _ThorchainList, NativeList, tokensPackage, tokensMap, error_1;
308
+ return __generator(this, function (_b) {
309
+ switch (_b.label) {
310
+ case 0:
311
+ _b.trys.push([0, 2, , 3]);
312
+ return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('@coinmasters/tokens')); })];
313
+ case 1:
314
+ _a = _b.sent(), _ThorchainList = _a.ThorchainList, NativeList = _a.NativeList, tokensPackage = __rest(_a, ["ThorchainList", "NativeList"]);
315
+ tokensMap = __spreadArray([NativeList], Object.values(tokensPackage), true).reduce(
316
+ //@ts-ignore
317
+ function (acc, _a) {
318
+ var tokens = _a.tokens;
319
+ // @ts-ignore
320
+ tokens.forEach(function (_a) {
321
+ var identifier = _a.identifier, chain = _a.chain, rest = __rest(_a, ["identifier", "chain"]);
322
+ //@ts-ignore
323
+ var decimal = 'decimals' in rest ? rest.decimals : types_1.BaseDecimal[chain];
324
+ acc.set(identifier, { identifier: identifier, decimal: decimal });
325
+ });
326
+ return acc;
327
+ }, new Map());
328
+ staticTokensMap = tokensMap;
329
+ resolve({ ok: true });
330
+ return [3 /*break*/, 3];
331
+ case 2:
332
+ error_1 = _b.sent();
333
+ console.error(error_1);
334
+ reject({
335
+ ok: false,
336
+ error: error_1,
337
+ message: "Couldn't load static assets. Ensure you have installed @coinmasters/tokens package",
338
+ });
339
+ return [3 /*break*/, 3];
340
+ case 3: return [2 /*return*/];
341
+ }
342
+ });
343
+ }); })];
344
+ });
345
+ });
346
+ };
347
+ return AssetValue;
348
+ }(bigIntArithmetics_1.BigIntArithmetics));
349
+ exports.AssetValue = AssetValue;
350
+ var getMinAmountByChain = function (chain) {
351
+ var asset = AssetValue.fromChainOrSignature(chain);
352
+ switch (chain) {
353
+ case types_1.Chain.Bitcoin:
354
+ case types_1.Chain.Litecoin:
355
+ case types_1.Chain.Dash:
356
+ case types_1.Chain.Zcash:
357
+ case types_1.Chain.BitcoinCash:
358
+ return asset.set(0.00010001);
359
+ case types_1.Chain.Dogecoin:
360
+ return asset.set(1.00000001);
361
+ case types_1.Chain.Base:
362
+ case types_1.Chain.Arbitrum:
363
+ case types_1.Chain.Avalanche:
364
+ case types_1.Chain.Ethereum:
365
+ return asset.set(0.00000001);
366
+ case types_1.Chain.THORChain:
367
+ //@ts-ignore
368
+ case types_1.Chain.Mayachain:
369
+ return asset.set(0.0000000001);
370
+ default:
371
+ return asset.set(0.00000001);
372
+ }
373
+ };
374
+ exports.getMinAmountByChain = getMinAmountByChain;
375
+ var getAssetInfo = function (identifier) {
376
+ var _a;
377
+ var isSynthetic = identifier.slice(0, 14).includes('/');
378
+ var _b = identifier.split('.').pop().split('/'), synthChain = _b[0], synthSymbol = _b[1];
379
+ var adjustedIdentifier = identifier.includes('.') && !isSynthetic ? identifier : "".concat(types_1.Chain.THORChain, ".").concat(synthSymbol);
380
+ var _c = adjustedIdentifier.split('.'), chain = _c[0], symbol = _c[1];
381
+ var _d = (isSynthetic ? synthSymbol : symbol).split('-'), ticker = _d[0], address = _d[1];
382
+ return {
383
+ address: address === null || address === void 0 ? void 0 : address.toLowerCase(),
384
+ chain: chain,
385
+ isGasAsset: (0, asset_1.isGasAsset)({ chain: chain, symbol: symbol }),
386
+ isSynthetic: isSynthetic,
387
+ symbol: (isSynthetic ? "".concat(synthChain, "/") : '') +
388
+ (address ? "".concat(ticker, "-").concat((_a = address === null || address === void 0 ? void 0 : address.toLowerCase()) !== null && _a !== void 0 ? _a : '') : symbol),
389
+ ticker: ticker,
390
+ };
391
+ };
@@ -0,0 +1,58 @@
1
+ import type { SwapKitNumber } from './swapKitNumber';
2
+ type NumberPrimitivesType = {
3
+ bigint: bigint;
4
+ number: number;
5
+ string: string;
6
+ };
7
+ export type NumberPrimitives = bigint | number | string;
8
+ type InitialisationValueType = NumberPrimitives | BigIntArithmetics | SwapKitNumber;
9
+ type SKBigIntParams = InitialisationValueType | {
10
+ decimal?: number;
11
+ value: number | string;
12
+ };
13
+ type AllowedNumberTypes = 'bigint' | 'number' | 'string';
14
+ export declare function formatBigIntToSafeValue({ value, bigIntDecimal, decimal, }: {
15
+ value: bigint;
16
+ bigIntDecimal?: number;
17
+ decimal?: number;
18
+ }): string;
19
+ export declare class BigIntArithmetics {
20
+ private decimalMultiplier;
21
+ private bigIntValue;
22
+ private decimal?;
23
+ static fromBigInt(value: bigint, decimal?: number): BigIntArithmetics;
24
+ static shiftDecimals({ value, from, to, }: {
25
+ value: InstanceType<typeof SwapKitNumber>;
26
+ from: number;
27
+ to: number;
28
+ }): BigIntArithmetics;
29
+ constructor(params: SKBigIntParams);
30
+ set(value: SKBigIntParams): this;
31
+ add(...args: InitialisationValueType[]): this;
32
+ sub(...args: InitialisationValueType[]): this;
33
+ mul(...args: InitialisationValueType[]): this;
34
+ div(...args: InitialisationValueType[]): this;
35
+ gt(value: InitialisationValueType): boolean;
36
+ gte(value: InitialisationValueType): boolean;
37
+ lt(value: InitialisationValueType): boolean;
38
+ lte(value: InitialisationValueType): boolean;
39
+ eqValue(value: InitialisationValueType): boolean;
40
+ getValue<T extends AllowedNumberTypes>(type: T): NumberPrimitivesType[T];
41
+ getBaseValue<T extends AllowedNumberTypes>(type: T): NumberPrimitivesType[T];
42
+ getBigIntValue(value: InitialisationValueType, decimal?: number): bigint;
43
+ toSignificant(significantDigits?: number): string;
44
+ toFixed(fixedDigits?: number): string;
45
+ toAbbreviation(digits?: number): string;
46
+ toCurrency(currency?: string, { currencyPosition, decimal, decimalSeparator, thousandSeparator, }?: {
47
+ currencyPosition?: string | undefined;
48
+ decimal?: number | undefined;
49
+ decimalSeparator?: string | undefined;
50
+ thousandSeparator?: string | undefined;
51
+ }): string;
52
+ private arithmetics;
53
+ private comparison;
54
+ private setValue;
55
+ private retrievePrecisionDecimal;
56
+ private toBigInt;
57
+ }
58
+ export {};