@pioneer-platform/helpers 4.2.0 → 4.4.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,598 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BigIntArithmetics = exports.toMultiplier = void 0;
4
+ exports.formatBigIntToSafeValue = formatBigIntToSafeValue;
5
+ const types_1 = require("@coinmasters/types");
6
+ const TAG = " | BigIntArithmetics | ";
7
+ const DEFAULT_DECIMAL = 8;
8
+ const bigintPow = (base, exponent) => {
9
+ let tag = TAG + " | bigintPow | ";
10
+ try {
11
+ let result = BigInt(1);
12
+ while (exponent > 0) {
13
+ if (exponent % 2 === 1) {
14
+ result *= base;
15
+ }
16
+ base *= base;
17
+ exponent = Math.floor(exponent / 2);
18
+ }
19
+ return result;
20
+ }
21
+ catch (error) {
22
+ console.error(tag + 'Error in bigintPow:', error);
23
+ return BigInt(1);
24
+ }
25
+ };
26
+ const toMultiplier = (decimal) => {
27
+ let tag = TAG + " | toMultiplier | ";
28
+ //console.log(tag + 'input decimal:', decimal);
29
+ try {
30
+ if (decimal < 0) {
31
+ throw new Error("Decimal must be non-negative");
32
+ }
33
+ let result = BigInt(1);
34
+ for (let i = 0; i < decimal; i++) {
35
+ result *= BigInt(10);
36
+ }
37
+ //console.log(tag + 'result:', result);
38
+ return result;
39
+ }
40
+ catch (error) {
41
+ console.error(tag + 'Error in toMultiplier:', error);
42
+ return BigInt(10);
43
+ }
44
+ };
45
+ exports.toMultiplier = toMultiplier;
46
+ const decimalFromMultiplier = (multiplier) => {
47
+ let tag = TAG + " | decimalFromMultiplier | ";
48
+ try {
49
+ return Math.log10(Number(multiplier));
50
+ }
51
+ catch (error) {
52
+ console.error(tag + 'Error in decimalFromMultiplier:', error);
53
+ return 0;
54
+ }
55
+ };
56
+ function formatBigIntToSafeValue({ value, bigIntDecimal, decimal, }) {
57
+ const tag = TAG + " | BigIntArithmetics | ";
58
+ try {
59
+ //console.log(tag,'value:',value,'bigIntDecimal:',bigIntDecimal,'decimal:',decimal);
60
+ if (!decimal)
61
+ decimal = DEFAULT_DECIMAL;
62
+ if (!bigIntDecimal)
63
+ bigIntDecimal = (0, exports.toMultiplier)(decimal);
64
+ // Check if the value is negative and throw an error if true
65
+ if (value < BigInt(0)) {
66
+ throw new Error(TAG + 'Negative value is not allowed');
67
+ }
68
+ // Convert bigint to string and then to number
69
+ let valueString = value.toString();
70
+ //console.log(tag,'valueString:',valueString);
71
+ //console.log(tag,'valueString:',valueString.length);
72
+ //console.log(tag,'decimal:',decimal);
73
+ // Ensure the valueString has enough length for the decimal places
74
+ if (valueString.length <= decimal) {
75
+ valueString = '0'.repeat(decimal - valueString.length + 1) + valueString;
76
+ }
77
+ // Determine the integer and decimal parts
78
+ const integerPart = valueString.slice(0, valueString.length - decimal) || '0';
79
+ const decimalPart = valueString.slice(valueString.length - decimal).padEnd(decimal, '0');
80
+ // Construct the final formatted value
81
+ const formattedValue = `${integerPart}.${decimalPart}`;
82
+ //console.log(tag,"formattedValue:", formattedValue);
83
+ return formattedValue;
84
+ }
85
+ catch (error) {
86
+ console.error(TAG + 'Error in formatBigIntToSafeValue:', error);
87
+ return '';
88
+ }
89
+ }
90
+ class BigIntArithmetics {
91
+ static fromBigInt(value, decimal) {
92
+ let tag = TAG + " | fromBigInt | ";
93
+ try {
94
+ //console.log(tag,"Decimal: ", decimal);
95
+ return new BigIntArithmetics({
96
+ decimal,
97
+ value: formatBigIntToSafeValue({ value, bigIntDecimal: (0, exports.toMultiplier)(decimal || DEFAULT_DECIMAL), decimal }),
98
+ });
99
+ }
100
+ catch (error) {
101
+ console.error(tag + 'Error in fromBigInt:', error);
102
+ return new BigIntArithmetics(0);
103
+ }
104
+ }
105
+ // static shiftDecimals({
106
+ // value,
107
+ // from,
108
+ // to,
109
+ // }: {
110
+ // value: InstanceType<typeof SwapKitNumber>;
111
+ // from: number;
112
+ // to: number;
113
+ // }): BigIntArithmetics {
114
+ // let tag = TAG + " | shiftDecimals | ";
115
+ // try {
116
+ // return this.fromBigInt(
117
+ // (value.getBaseValue('bigint') * toMultiplier(to)) / toMultiplier(from),
118
+ // to,
119
+ // );
120
+ // } catch (error) {
121
+ // console.error(tag + 'Error in shiftDecimals:', error);
122
+ // return new BigIntArithmetics(0);
123
+ // }
124
+ // }
125
+ /*
126
+ AssetValue
127
+ {
128
+ decimalMultiplier: 1000000000000000000n,
129
+ bigIntValue: 62128120000000000n,
130
+ decimal: 18,
131
+ isGasAsset: true,
132
+ isSynthetic: false,
133
+ type: 'Native',
134
+ chain: 'BASE',
135
+ ticker: 'ETH',
136
+ symbol: 'ETH',
137
+ address: undefined,
138
+ tax: undefined,
139
+ caip: 'eip155:8453/slip44:60'
140
+ }
141
+ */
142
+ constructor(params) {
143
+ let tag = TAG + " | constructor | ";
144
+ try {
145
+ ////console.log(tag + 'Constructor Params:', params);
146
+ const value = getStringValue(params);
147
+ ////console.log(tag + 'String Value:', value);
148
+ const isComplex = typeof params === 'object' && params !== null;
149
+ this.decimal = isComplex ? params.decimal : undefined;
150
+ ////console.log(tag , 'Decimal:', this.decimal);
151
+ ////console.log(tag , 'isComplex:', isComplex);
152
+ if (isComplex) {
153
+ this.decimalMultiplier = (0, exports.toMultiplier)(this.decimal || DEFAULT_DECIMAL);
154
+ }
155
+ else {
156
+ const maxDecimals = Math.max(getFloatDecimals(toSafeValue(value)), this.decimal || 0);
157
+ this.decimalMultiplier = (0, exports.toMultiplier)(maxDecimals);
158
+ }
159
+ ////console.log(tag + 'Decimal Multiplier:', this.decimalMultiplier);
160
+ this.setValue(value);
161
+ //@ts-ignore
162
+ ////console.log(tag + 'BigInt Value:', this.bigIntValue);
163
+ }
164
+ catch (error) {
165
+ console.error(tag + 'Error in constructor:', error);
166
+ this.decimalMultiplier = BigInt(1);
167
+ this.bigIntValue = BigInt(0);
168
+ }
169
+ }
170
+ // constructor(params: SKBigIntParams) {
171
+ // let tag = TAG + " | constructor | ";
172
+ // try {
173
+ // //console.log(tag + 'Constructor Params:', params);
174
+ // const value = getStringValue(params);
175
+ // //console.log(tag + 'String Value:', value);
176
+ // const isComplex = typeof params === 'object' && params !== null;
177
+ // this.decimal = isComplex ? (params as { decimal?: number }).decimal : undefined;
178
+ // //console.log(tag , 'Decimal:', this.decimal);
179
+ // //console.log(tag , 'isComplex:', isComplex);
180
+ // if (isComplex) {
181
+ // this.decimalMultiplier = this.decimal;
182
+ // } else {
183
+ // const maxDecimals = Math.max(getFloatDecimals(toSafeValue(value)), this.decimal || 0);
184
+ // this.decimalMultiplier = toMultiplier(maxDecimals);
185
+ // }
186
+ // //console.log(tag + 'Decimal Multiplier:', this.decimalMultiplier);
187
+ //
188
+ // this.setValue(value);
189
+ // //@ts-ignore
190
+ // //console.log(tag + 'BigInt Value:', this.bigIntValue);
191
+ // } catch (error) {
192
+ // console.error(tag + 'Error in constructor:', error);
193
+ // this.decimalMultiplier = BigInt(1);
194
+ // this.bigIntValue = BigInt(0);
195
+ // }
196
+ // }
197
+ set(value) {
198
+ let tag = TAG + " | set | ";
199
+ try {
200
+ // @ts-ignore
201
+ return new BigIntArithmetics({ decimal: this.decimal, value });
202
+ }
203
+ catch (error) {
204
+ console.error(tag + 'Error in set:', error);
205
+ return this;
206
+ }
207
+ }
208
+ add(...args) {
209
+ let tag = TAG + " | add | ";
210
+ try {
211
+ return this.arithmetics('add', ...args);
212
+ }
213
+ catch (error) {
214
+ console.error(tag + 'Error in add:', error);
215
+ return this;
216
+ }
217
+ }
218
+ sub(...args) {
219
+ let tag = TAG + " | sub | ";
220
+ try {
221
+ return this.arithmetics('sub', ...args);
222
+ }
223
+ catch (error) {
224
+ console.error(tag + 'Error in sub:', error);
225
+ return this;
226
+ }
227
+ }
228
+ mul(...args) {
229
+ let tag = TAG + " | mul | ";
230
+ try {
231
+ return this.arithmetics('mul', ...args);
232
+ }
233
+ catch (error) {
234
+ console.error(tag + 'Error in mul:', error);
235
+ return this;
236
+ }
237
+ }
238
+ div(...args) {
239
+ let tag = TAG + " | div | ";
240
+ try {
241
+ return this.arithmetics('div', ...args);
242
+ }
243
+ catch (error) {
244
+ console.error(tag + 'Error in div:', error);
245
+ return this;
246
+ }
247
+ }
248
+ gt(value) {
249
+ let tag = TAG + " | gt | ";
250
+ try {
251
+ return this.comparison('gt', value);
252
+ }
253
+ catch (error) {
254
+ console.error(tag + 'Error in gt:', error);
255
+ return false;
256
+ }
257
+ }
258
+ gte(value) {
259
+ let tag = TAG + " | gte | ";
260
+ try {
261
+ return this.comparison('gte', value);
262
+ }
263
+ catch (error) {
264
+ console.error(tag + 'Error in gte:', error);
265
+ return false;
266
+ }
267
+ }
268
+ lt(value) {
269
+ let tag = TAG + " | lt | ";
270
+ try {
271
+ return this.comparison('lt', value);
272
+ }
273
+ catch (error) {
274
+ console.error(tag + 'Error in lt:', error);
275
+ return false;
276
+ }
277
+ }
278
+ lte(value) {
279
+ let tag = TAG + " | lte | ";
280
+ try {
281
+ return this.comparison('lte', value);
282
+ }
283
+ catch (error) {
284
+ console.error(tag + 'Error in lte:', error);
285
+ return false;
286
+ }
287
+ }
288
+ eqValue(value) {
289
+ let tag = TAG + " | eqValue | ";
290
+ try {
291
+ return this.comparison('eqValue', value);
292
+ }
293
+ catch (error) {
294
+ console.error(tag + 'Error in eqValue:', error);
295
+ return false;
296
+ }
297
+ }
298
+ //@ts-ignore
299
+ getValue(type) {
300
+ let tag = TAG + " | getValue | ";
301
+ try {
302
+ //console.log(tag,'getValue type:', type);
303
+ //console.log(tag,'decimalMultiplier: ', this.decimalMultiplier);
304
+ const value = formatBigIntToSafeValue({
305
+ value: this.bigIntValue,
306
+ bigIntDecimal: (0, exports.toMultiplier)(this.decimal || DEFAULT_DECIMAL),
307
+ decimal: this.decimal || DEFAULT_DECIMAL,
308
+ });
309
+ //console.log(tag,'value:', value);
310
+ switch (type) {
311
+ case 'number':
312
+ return Number(value);
313
+ case 'string':
314
+ return value;
315
+ case 'bigint':
316
+ return ((this.bigIntValue * bigintPow(BigInt(10), this.decimal || 8)) /
317
+ this.decimalMultiplier);
318
+ }
319
+ }
320
+ catch (error) {
321
+ console.error(tag + 'Error in getValue:', error);
322
+ return null;
323
+ }
324
+ }
325
+ // @ts-ignore
326
+ getBaseValue(type) {
327
+ let tag = TAG + " | getBaseValue | ";
328
+ try {
329
+ const divisor = this.decimalMultiplier / (0, exports.toMultiplier)(this.decimal || types_1.BaseDecimal.THOR);
330
+ const baseValue = this.bigIntValue / divisor;
331
+ switch (type) {
332
+ case 'number':
333
+ return Number(baseValue);
334
+ case 'string':
335
+ return baseValue.toString();
336
+ case 'bigint':
337
+ return baseValue;
338
+ }
339
+ }
340
+ catch (error) {
341
+ console.error(tag + 'Error in getBaseValue:', error);
342
+ return null;
343
+ }
344
+ }
345
+ getBigIntValue(value, decimal) {
346
+ let tag = TAG + " | getBigIntValue | ";
347
+ try {
348
+ if (!decimal && typeof value === 'object' && value !== null) {
349
+ return value.bigIntValue;
350
+ }
351
+ const stringValue = getStringValue(value);
352
+ const safeValue = toSafeValue(stringValue);
353
+ if (safeValue === '0' || safeValue === 'undefined')
354
+ return BigInt(0);
355
+ return this.toBigInt(safeValue, decimal);
356
+ }
357
+ catch (error) {
358
+ console.error(tag + 'Error in getBigIntValue:', error);
359
+ return BigInt(0);
360
+ }
361
+ }
362
+ toSignificant(significantDigits = 6) {
363
+ let tag = TAG + " | toSignificant | ";
364
+ try {
365
+ const [int, dec] = this.getValue('string').split('.');
366
+ const integer = int || '';
367
+ const decimal = dec || '';
368
+ const valueLength = parseInt(integer) ? integer.length + decimal.length : decimal.length;
369
+ if (valueLength <= significantDigits) {
370
+ return this.getValue('string');
371
+ }
372
+ if (integer.length >= significantDigits) {
373
+ return integer.slice(0, significantDigits).padEnd(integer.length, '0');
374
+ }
375
+ if (parseInt(integer)) {
376
+ return `${integer}.${decimal.slice(0, significantDigits - integer.length)}`.padEnd(significantDigits - integer.length, '0');
377
+ }
378
+ const trimmedDecimal = parseInt(decimal);
379
+ const slicedDecimal = `${trimmedDecimal}`.slice(0, significantDigits);
380
+ return `0.${slicedDecimal.padStart(decimal.length - `${trimmedDecimal}`.length + slicedDecimal.length, '0')}`;
381
+ }
382
+ catch (error) {
383
+ console.error(tag + 'Error in toSignificant:', error);
384
+ return '';
385
+ }
386
+ }
387
+ toFixed(fixedDigits = 6) {
388
+ let tag = TAG + " | toFixed | ";
389
+ try {
390
+ const [int, dec] = this.getValue('string').split('.');
391
+ const integer = int || '';
392
+ const decimal = dec || '';
393
+ if (parseInt(integer)) {
394
+ return `${integer}.${decimal.slice(0, fixedDigits)}`.padEnd(fixedDigits, '0');
395
+ }
396
+ const trimmedDecimal = parseInt(decimal);
397
+ const slicedDecimal = `${trimmedDecimal}`.slice(0, fixedDigits);
398
+ return `0.${slicedDecimal.padStart(decimal.length - `${trimmedDecimal}`.length + slicedDecimal.length, '0')}`;
399
+ }
400
+ catch (error) {
401
+ console.error(tag + 'Error in toFixed:', error);
402
+ return '';
403
+ }
404
+ }
405
+ toAbbreviation(digits = 2) {
406
+ let tag = TAG + " | toAbbreviation | ";
407
+ try {
408
+ const value = this.getValue('number');
409
+ const abbreviations = ['', 'K', 'M', 'B', 'T', 'Q', 'Qi', 'S'];
410
+ const tier = Math.floor(Math.log10(Math.abs(value)) / 3);
411
+ const suffix = abbreviations[tier];
412
+ if (!suffix)
413
+ return this.getValue('string');
414
+ const scale = Math.pow(10, (tier * 3));
415
+ const scaled = value / scale;
416
+ return `${scaled.toFixed(digits)}${suffix}`;
417
+ }
418
+ catch (error) {
419
+ console.error(tag + 'Error in toAbbreviation:', error);
420
+ return '';
421
+ }
422
+ }
423
+ toCurrency(currency = '$', { currencyPosition = 'start', decimal = 2, decimalSeparator = '.', thousandSeparator = ',', } = {}) {
424
+ let tag = TAG + " | toCurrency | ";
425
+ try {
426
+ const value = this.getValue('number');
427
+ const [int, dec = ''] = value.toFixed(6).split('.');
428
+ const integer = int.replace(/\B(?=(\d{3})+(?!\d))/g, thousandSeparator);
429
+ const parsedValue = !int && !dec
430
+ ? '0.00'
431
+ : int === '0'
432
+ ? `${parseFloat(`0.${dec}`)}`.replace('.', decimalSeparator)
433
+ : `${integer}${parseInt(dec) ? `${decimalSeparator}${dec.slice(0, decimal)}` : ''}`;
434
+ return `${currencyPosition === 'start' ? currency : ''}${parsedValue}${currencyPosition === 'end' ? currency : ''}`;
435
+ }
436
+ catch (error) {
437
+ console.error(tag + 'Error in toCurrency:', error);
438
+ return '';
439
+ }
440
+ }
441
+ arithmetics(method, ...args) {
442
+ let tag = TAG + " | arithmetics | ";
443
+ try {
444
+ const precisionDecimal = this.retrievePrecisionDecimal(this, ...args);
445
+ const decimal = Math.max(precisionDecimal, decimalFromMultiplier(this.decimalMultiplier));
446
+ const precisionDecimalMultiplier = (0, exports.toMultiplier)(decimal);
447
+ const result = args.reduce((acc, arg) => {
448
+ const value = this.getBigIntValue(arg, decimal);
449
+ switch (method) {
450
+ case 'add':
451
+ return acc + value;
452
+ case 'sub':
453
+ return acc - value;
454
+ case 'mul':
455
+ return (acc * value) / precisionDecimalMultiplier;
456
+ case 'div': {
457
+ if (value === BigInt(0))
458
+ throw new RangeError('Division by zero');
459
+ return (acc * precisionDecimalMultiplier) / value;
460
+ }
461
+ default:
462
+ return acc;
463
+ }
464
+ }, (this.bigIntValue * precisionDecimalMultiplier) / this.decimalMultiplier);
465
+ const formattedValue = formatBigIntToSafeValue({
466
+ bigIntDecimal: (0, exports.toMultiplier)(decimal),
467
+ decimal,
468
+ value: result,
469
+ });
470
+ return new BigIntArithmetics({
471
+ decimalMultiplier: (0, exports.toMultiplier)(decimal),
472
+ decimal: this.decimal,
473
+ value: formattedValue,
474
+ });
475
+ }
476
+ catch (error) {
477
+ console.error(tag + 'Error in arithmetics:', error);
478
+ return this;
479
+ }
480
+ }
481
+ comparison(method, ...args) {
482
+ let tag = TAG + " | comparison | ";
483
+ try {
484
+ const decimal = this.retrievePrecisionDecimal(this, ...args);
485
+ const value = this.getBigIntValue(args[0], decimal);
486
+ const compareToValue = this.getBigIntValue(this, decimal);
487
+ switch (method) {
488
+ case 'gt':
489
+ return compareToValue > value;
490
+ case 'gte':
491
+ return compareToValue >= value;
492
+ case 'lt':
493
+ return compareToValue < value;
494
+ case 'lte':
495
+ return compareToValue <= value;
496
+ case 'eqValue':
497
+ return compareToValue === value;
498
+ }
499
+ }
500
+ catch (error) {
501
+ console.error(tag + 'Error in comparison:', error);
502
+ return false;
503
+ }
504
+ }
505
+ setValue(value) {
506
+ let tag = TAG + " | setValue | ";
507
+ try {
508
+ //console.log(tag, 'value:', value);
509
+ //console.log(tag, ' this.decimal:', this.decimal);
510
+ const safeValue = formatBigIntToSafeValue({ value: value, decimal: this.decimal });
511
+ //console.log(tag, 'safeValue:', safeValue);
512
+ this.bigIntValue = this.toBigInt(safeValue);
513
+ }
514
+ catch (error) {
515
+ console.error(tag + 'Error in setValue:', error);
516
+ }
517
+ }
518
+ retrievePrecisionDecimal(...args) {
519
+ let tag = TAG + " | retrievePrecisionDecimal | ";
520
+ try {
521
+ const decimals = args
522
+ .map((arg) => {
523
+ const isObject = typeof arg === 'object' && arg !== null;
524
+ const value = isObject
525
+ ? arg.decimal || decimalFromMultiplier(arg.decimalMultiplier)
526
+ : getFloatDecimals(toSafeValue(arg));
527
+ return value;
528
+ })
529
+ .filter(Boolean);
530
+ return Math.max(...decimals, DEFAULT_DECIMAL);
531
+ }
532
+ catch (error) {
533
+ console.error(tag + 'Error in retrievePrecisionDecimal:', error);
534
+ return DEFAULT_DECIMAL;
535
+ }
536
+ }
537
+ toBigInt(value, decimal) {
538
+ let tag = TAG + " | toBigInt | ";
539
+ try {
540
+ const multiplier = decimal ? (0, exports.toMultiplier)(decimal) : this.decimalMultiplier;
541
+ const padDecimal = decimalFromMultiplier(multiplier);
542
+ const [integerPart = '', decimalPart = ''] = value.split('.');
543
+ return BigInt(`${integerPart}${decimalPart.padEnd(padDecimal, '0')}`);
544
+ }
545
+ catch (error) {
546
+ console.error(tag + 'Error in toBigInt:', error);
547
+ return BigInt(0);
548
+ }
549
+ }
550
+ }
551
+ exports.BigIntArithmetics = BigIntArithmetics;
552
+ const numberFormatter = Intl.NumberFormat('fullwide', {
553
+ useGrouping: false,
554
+ maximumFractionDigits: 20,
555
+ });
556
+ function toSafeValue(value) {
557
+ let tag = TAG + " | toSafeValue | ";
558
+ try {
559
+ const parsedValue = typeof value === 'number' ? numberFormatter.format(value) : getStringValue(value);
560
+ const splitValue = `${parsedValue}`.replace(/,/g, '.').split('.');
561
+ return splitValue.length > 1
562
+ ? `${splitValue.slice(0, -1).join('')}.${splitValue.at(-1)}`
563
+ : splitValue[0];
564
+ }
565
+ catch (error) {
566
+ console.error(tag + 'Error in toSafeValue:', error);
567
+ return '0';
568
+ }
569
+ }
570
+ function getFloatDecimals(value) {
571
+ let tag = TAG + " | getFloatDecimals | ";
572
+ try {
573
+ let decimals = 0;
574
+ const parts = value.split('.');
575
+ if (parts.length > 1 && parts[1].length > 0) {
576
+ decimals = parts[1].length;
577
+ }
578
+ return Math.max(decimals, DEFAULT_DECIMAL);
579
+ }
580
+ catch (error) {
581
+ console.error(tag + 'Error in getFloatDecimals:', error);
582
+ return DEFAULT_DECIMAL;
583
+ }
584
+ }
585
+ function getStringValue(param) {
586
+ let tag = TAG + " | getStringValue | ";
587
+ try {
588
+ return typeof param === 'object' && param !== null
589
+ ? 'getValue' in param
590
+ ? param.getValue('string')
591
+ : param.value
592
+ : param;
593
+ }
594
+ catch (error) {
595
+ console.error(tag + 'Error in getStringValue:', error);
596
+ return '';
597
+ }
598
+ }
@@ -0,0 +1,64 @@
1
+ declare const errorMessages: {
2
+ /**
3
+ * Core
4
+ */
5
+ readonly core_wallet_connection_not_found: 10001;
6
+ readonly core_estimated_max_spendable_chain_not_supported: 10002;
7
+ readonly core_extend_error: 10003;
8
+ readonly core_inbound_data_not_found: 10004;
9
+ readonly core_approve_asset_address_or_from_not_found: 10005;
10
+ readonly core_chain_halted: 10099;
11
+ /**
12
+ * Core - Wallet Connection
13
+ */
14
+ readonly core_wallet_xdefi_not_installed: 10101;
15
+ readonly core_wallet_evmwallet_not_installed: 10102;
16
+ readonly core_wallet_walletconnect_not_installed: 10103;
17
+ readonly core_wallet_keystore_not_installed: 10104;
18
+ readonly core_wallet_ledger_not_installed: 10105;
19
+ readonly core_wallet_trezor_not_installed: 10106;
20
+ readonly core_wallet_keplr_not_installed: 10107;
21
+ readonly core_wallet_okx_not_installed: 10108;
22
+ readonly core_wallet_keepkey_not_installed: 10109;
23
+ /**
24
+ * Core - Swap
25
+ */
26
+ readonly core_swap_invalid_params: 10200;
27
+ readonly core_swap_route_not_complete: 10201;
28
+ readonly core_swap_asset_not_recognized: 10202;
29
+ readonly core_swap_contract_not_found: 10203;
30
+ readonly core_swap_route_transaction_not_found: 10204;
31
+ readonly core_swap_contract_not_supported: 10205;
32
+ readonly core_swap_quote_mode_not_supported: 10207;
33
+ /**
34
+ * Core - Transaction
35
+ */
36
+ readonly core_transaction_deposit_error: 10301;
37
+ readonly core_transaction_create_liquidity_rune_error: 10302;
38
+ readonly core_transaction_create_liquidity_asset_error: 10303;
39
+ readonly core_transaction_create_liquidity_invalid_params: 10304;
40
+ readonly core_transaction_add_liquidity_invalid_params: 10305;
41
+ readonly core_transaction_add_liquidity_no_rune_address: 10306;
42
+ readonly core_transaction_add_liquidity_rune_error: 10307;
43
+ readonly core_transaction_add_liquidity_asset_error: 10308;
44
+ readonly core_transaction_withdraw_error: 10309;
45
+ readonly core_transaction_deposit_to_pool_error: 10310;
46
+ readonly core_transaction_deposit_insufficient_funds_error: 10311;
47
+ readonly core_transaction_deposit_gas_error: 10312;
48
+ readonly core_transaction_invalid_sender_address: 10313;
49
+ readonly core_transaction_deposit_server_error: 10314;
50
+ readonly core_swap_transaction_error: 10400;
51
+ /**
52
+ * Wallets
53
+ */
54
+ readonly wallet_ledger_connection_error: 20001;
55
+ /**
56
+ * Helpers
57
+ */
58
+ readonly helpers_number_different_decimals: 99101;
59
+ };
60
+ export type Keys = keyof typeof errorMessages;
61
+ export declare class SwapKitError extends Error {
62
+ constructor(errorKey: Keys, sourceError?: any);
63
+ }
64
+ export {};