@pioneer-platform/helpers 4.0.13 → 4.1.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.
- package/CHANGELOG.md +20 -0
- package/package.json +13 -10
- package/src/helpers/asset.ts +0 -5
- package/tsconfig.json +1 -1
- package/LICENSE +0 -674
- package/lib/helpers/asset.d.ts +0 -36
- package/lib/helpers/asset.js +0 -270
- package/lib/helpers/liquidity.d.ts +0 -58
- package/lib/helpers/liquidity.js +0 -112
- package/lib/helpers/memo.d.ts +0 -46
- package/lib/helpers/memo.js +0 -46
- package/lib/helpers/others.d.ts +0 -3
- package/lib/helpers/others.js +0 -24
- package/lib/helpers/request.d.ts +0 -5
- package/lib/helpers/request.js +0 -117
- package/lib/helpers/validators.d.ts +0 -1
- package/lib/helpers/validators.js +0 -17
- package/lib/index.d.ts +0 -15
- package/lib/index.js +0 -31
- package/lib/modules/__tests__/assetValue.test.d.ts +0 -1
- package/lib/modules/__tests__/assetValue.test.js +0 -399
- package/lib/modules/__tests__/swapKitNumber.test.d.ts +0 -1
- package/lib/modules/__tests__/swapKitNumber.test.js +0 -425
- package/lib/modules/assetValue.d.ts +0 -58
- package/lib/modules/assetValue.js +0 -442
- package/lib/modules/bigIntArithmetics.d.ts +0 -54
- package/lib/modules/bigIntArithmetics.js +0 -643
- package/lib/modules/swapKitError.d.ts +0 -64
- package/lib/modules/swapKitError.js +0 -90
- package/lib/modules/swapKitNumber.d.ts +0 -6
- package/lib/modules/swapKitNumber.js +0 -37
@@ -1,64 +0,0 @@
|
|
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 {};
|
@@ -1,90 +0,0 @@
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
exports.SwapKitError = void 0;
|
19
|
-
var errorMessages = {
|
20
|
-
/**
|
21
|
-
* Core
|
22
|
-
*/
|
23
|
-
core_wallet_connection_not_found: 10001,
|
24
|
-
core_estimated_max_spendable_chain_not_supported: 10002,
|
25
|
-
core_extend_error: 10003,
|
26
|
-
core_inbound_data_not_found: 10004,
|
27
|
-
core_approve_asset_address_or_from_not_found: 10005,
|
28
|
-
core_chain_halted: 10099,
|
29
|
-
/**
|
30
|
-
* Core - Wallet Connection
|
31
|
-
*/
|
32
|
-
core_wallet_xdefi_not_installed: 10101,
|
33
|
-
core_wallet_evmwallet_not_installed: 10102,
|
34
|
-
core_wallet_walletconnect_not_installed: 10103,
|
35
|
-
core_wallet_keystore_not_installed: 10104,
|
36
|
-
core_wallet_ledger_not_installed: 10105,
|
37
|
-
core_wallet_trezor_not_installed: 10106,
|
38
|
-
core_wallet_keplr_not_installed: 10107,
|
39
|
-
core_wallet_okx_not_installed: 10108,
|
40
|
-
core_wallet_keepkey_not_installed: 10109,
|
41
|
-
/**
|
42
|
-
* Core - Swap
|
43
|
-
*/
|
44
|
-
core_swap_invalid_params: 10200,
|
45
|
-
core_swap_route_not_complete: 10201,
|
46
|
-
core_swap_asset_not_recognized: 10202,
|
47
|
-
core_swap_contract_not_found: 10203,
|
48
|
-
core_swap_route_transaction_not_found: 10204,
|
49
|
-
core_swap_contract_not_supported: 10205,
|
50
|
-
core_swap_quote_mode_not_supported: 10207,
|
51
|
-
/**
|
52
|
-
* Core - Transaction
|
53
|
-
*/
|
54
|
-
core_transaction_deposit_error: 10301,
|
55
|
-
core_transaction_create_liquidity_rune_error: 10302,
|
56
|
-
core_transaction_create_liquidity_asset_error: 10303,
|
57
|
-
core_transaction_create_liquidity_invalid_params: 10304,
|
58
|
-
core_transaction_add_liquidity_invalid_params: 10305,
|
59
|
-
core_transaction_add_liquidity_no_rune_address: 10306,
|
60
|
-
core_transaction_add_liquidity_rune_error: 10307,
|
61
|
-
core_transaction_add_liquidity_asset_error: 10308,
|
62
|
-
core_transaction_withdraw_error: 10309,
|
63
|
-
core_transaction_deposit_to_pool_error: 10310,
|
64
|
-
core_transaction_deposit_insufficient_funds_error: 10311,
|
65
|
-
core_transaction_deposit_gas_error: 10312,
|
66
|
-
core_transaction_invalid_sender_address: 10313,
|
67
|
-
core_transaction_deposit_server_error: 10314,
|
68
|
-
core_swap_transaction_error: 10400,
|
69
|
-
/**
|
70
|
-
* Wallets
|
71
|
-
*/
|
72
|
-
wallet_ledger_connection_error: 20001,
|
73
|
-
/**
|
74
|
-
* Helpers
|
75
|
-
*/
|
76
|
-
helpers_number_different_decimals: 99101,
|
77
|
-
};
|
78
|
-
var SwapKitError = /** @class */ (function (_super) {
|
79
|
-
__extends(SwapKitError, _super);
|
80
|
-
function SwapKitError(errorKey, sourceError) {
|
81
|
-
var _this = this;
|
82
|
-
console.error(sourceError, { stack: sourceError === null || sourceError === void 0 ? void 0 : sourceError.stack, message: sourceError === null || sourceError === void 0 ? void 0 : sourceError.message });
|
83
|
-
// @ts-ignore
|
84
|
-
_this = _super.call(this, errorKey, { cause: { code: errorMessages[errorKey], message: errorKey } }) || this;
|
85
|
-
Object.setPrototypeOf(_this, SwapKitError.prototype);
|
86
|
-
return _this;
|
87
|
-
}
|
88
|
-
return SwapKitError;
|
89
|
-
}(Error));
|
90
|
-
exports.SwapKitError = SwapKitError;
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import { BigIntArithmetics } from './bigIntArithmetics';
|
2
|
-
export type SwapKitValueType = BigIntArithmetics | string | number;
|
3
|
-
export declare class SwapKitNumber extends BigIntArithmetics {
|
4
|
-
eq(value: SwapKitValueType): boolean;
|
5
|
-
static fromBigInt(value: bigint, decimal?: number): SwapKitNumber;
|
6
|
-
}
|
@@ -1,37 +0,0 @@
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
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) {
|
27
|
-
return this.eqValue(value);
|
28
|
-
};
|
29
|
-
SwapKitNumber.fromBigInt = function (value, decimal) {
|
30
|
-
return new SwapKitNumber({
|
31
|
-
decimal: decimal,
|
32
|
-
value: (0, bigIntArithmetics_1.formatBigIntToSafeValue)({ value: value, bigIntDecimal: (0, bigIntArithmetics_1.toMultiplier)(decimal || DEFAULT_DECIMAL), decimal: decimal }),
|
33
|
-
});
|
34
|
-
};
|
35
|
-
return SwapKitNumber;
|
36
|
-
}(bigIntArithmetics_1.BigIntArithmetics));
|
37
|
-
exports.SwapKitNumber = SwapKitNumber;
|