@subwallet/extension-base 1.3.9-0 → 1.3.11-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.
- package/background/errors/SwapError.js +5 -0
- package/cjs/background/errors/SwapError.js +5 -0
- package/cjs/core/logic-validation/swap.js +27 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +2 -2
- package/cjs/services/chain-service/health-check/utils/new-utils/asset-asset-validate.js +1 -1
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/swap-service/handler/asset-hub/utils.js +1 -0
- package/cjs/services/swap-service/handler/chainflip-handler.js +0 -1
- package/cjs/services/swap-service/handler/simpleswap-handler.js +444 -0
- package/cjs/services/swap-service/index.js +15 -3
- package/cjs/services/swap-service/utils.js +13 -2
- package/cjs/services/transaction-service/index.js +14 -10
- package/cjs/services/transaction-service/utils.js +9 -1
- package/cjs/types/swap/index.js +7 -3
- package/cjs/utils/number.js +11 -6
- package/core/logic-validation/swap.d.ts +2 -1
- package/core/logic-validation/swap.js +26 -0
- package/koni/api/staking/bonding/utils.d.ts +1 -0
- package/package.json +23 -18
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.js +2 -2
- package/services/chain-service/health-check/utils/new-utils/asset-asset-validate.js +1 -1
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/handlers/native-staking/relay-chain.d.ts +1 -0
- package/services/earning-service/handlers/special.d.ts +1 -0
- package/services/earning-service/utils/index.d.ts +1 -0
- package/services/swap-service/handler/asset-hub/utils.js +1 -0
- package/services/swap-service/handler/chainflip-handler.js +0 -1
- package/services/swap-service/handler/simpleswap-handler.d.ts +24 -0
- package/services/swap-service/handler/simpleswap-handler.js +434 -0
- package/services/swap-service/index.d.ts +2 -1
- package/services/swap-service/index.js +13 -2
- package/services/swap-service/utils.d.ts +2 -0
- package/services/swap-service/utils.js +10 -1
- package/services/transaction-service/index.js +15 -11
- package/services/transaction-service/utils.d.ts +2 -1
- package/services/transaction-service/utils.js +9 -2
- package/types/balance/index.d.ts +1 -0
- package/types/swap/index.d.ts +15 -3
- package/types/swap/index.js +5 -2
- package/types/yield/info/pallet.d.ts +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/number.d.ts +9 -1
- package/utils/number.js +10 -4
|
@@ -1063,7 +1063,7 @@ class TransactionService {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
return emitter;
|
|
1065
1065
|
}
|
|
1066
|
-
|
|
1066
|
+
signAndSendSubstrateTransaction(_ref10) {
|
|
1067
1067
|
let {
|
|
1068
1068
|
address,
|
|
1069
1069
|
chain,
|
|
@@ -1079,8 +1079,9 @@ class TransactionService {
|
|
|
1079
1079
|
extrinsicHash: id
|
|
1080
1080
|
};
|
|
1081
1081
|
const extrinsic = transaction;
|
|
1082
|
-
const registry = extrinsic.registry;
|
|
1083
|
-
const signedExtensions = registry.signedExtensions;
|
|
1082
|
+
// const registry = extrinsic.registry;
|
|
1083
|
+
// const signedExtensions = registry.signedExtensions;
|
|
1084
|
+
|
|
1084
1085
|
const signerOption = {
|
|
1085
1086
|
signer: {
|
|
1086
1087
|
signPayload: async payload => {
|
|
@@ -1097,13 +1098,16 @@ class TransactionService {
|
|
|
1097
1098
|
},
|
|
1098
1099
|
withSignedTransaction: true
|
|
1099
1100
|
};
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1101
|
+
|
|
1102
|
+
// if (_isRuntimeUpdated(signedExtensions)) {
|
|
1103
|
+
// const metadataHash = await this.state.chainService.calculateMetadataHash(chain);
|
|
1104
|
+
//
|
|
1105
|
+
// if (metadataHash) {
|
|
1106
|
+
// signerOption.mode = 1;
|
|
1107
|
+
// signerOption.metadataHash = metadataHash;
|
|
1108
|
+
// }
|
|
1109
|
+
// }
|
|
1110
|
+
|
|
1107
1111
|
extrinsic.signAsync(address, signerOption).then(async rs => {
|
|
1108
1112
|
// Emit signed event
|
|
1109
1113
|
emitter.emit('signed', eventData);
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getChainflipExplorerLink = getChainflipExplorerLink;
|
|
7
7
|
exports.getExplorerLink = getExplorerLink;
|
|
8
|
+
exports.getSimpleSwapExplorerLink = getSimpleSwapExplorerLink;
|
|
8
9
|
exports.parseTransactionData = parseTransactionData;
|
|
9
10
|
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
10
11
|
var _utils2 = require("@subwallet/extension-base/services/swap-service/utils");
|
|
@@ -54,7 +55,7 @@ function getBlockExplorerTxRoute(chainInfo) {
|
|
|
54
55
|
if (['aventus', 'deeper_network'].includes(chainInfo.slug)) {
|
|
55
56
|
return 'transaction';
|
|
56
57
|
}
|
|
57
|
-
if (['invarch'].includes(chainInfo.slug)) {
|
|
58
|
+
if (['invarch', 'tangle'].includes(chainInfo.slug)) {
|
|
58
59
|
return '#/extrinsics';
|
|
59
60
|
}
|
|
60
61
|
return 'extrinsic';
|
|
@@ -70,6 +71,9 @@ function getExplorerLink(chainInfo, value, type) {
|
|
|
70
71
|
return undefined;
|
|
71
72
|
}
|
|
72
73
|
const route = getBlockExplorerTxRoute(chainInfo);
|
|
74
|
+
if (chainInfo.slug === 'tangle') {
|
|
75
|
+
return `${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}extrinsic/${value}${route}/${value}`;
|
|
76
|
+
}
|
|
73
77
|
return `${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}${route}/${value}`;
|
|
74
78
|
}
|
|
75
79
|
return undefined;
|
|
@@ -77,4 +81,8 @@ function getExplorerLink(chainInfo, value, type) {
|
|
|
77
81
|
function getChainflipExplorerLink(data, chainInfo) {
|
|
78
82
|
const chainflipDomain = (0, _utils._isChainTestNet)(chainInfo) ? _utils2.CHAIN_FLIP_TESTNET_EXPLORER : _utils2.CHAIN_FLIP_MAINNET_EXPLORER;
|
|
79
83
|
return `${chainflipDomain}/channels/${data.depositChannelId}`;
|
|
84
|
+
}
|
|
85
|
+
function getSimpleSwapExplorerLink(data) {
|
|
86
|
+
const simpleswapDomain = _utils2.SIMPLE_SWAP_EXPLORER;
|
|
87
|
+
return `${simpleswapDomain}/exchange?id=${data.id}`;
|
|
80
88
|
}
|
package/cjs/types/swap/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports._SUPPORTED_SWAP_PROVIDERS = exports.SwapStepType = exports.SwapProviderId = exports.SwapFeeType = exports.SwapErrorType = exports.CHAINFLIP_SLIPPAGE = void 0;
|
|
6
|
+
exports._SUPPORTED_SWAP_PROVIDERS = exports.SwapStepType = exports.SwapProviderId = exports.SwapFeeType = exports.SwapErrorType = exports.SIMPLE_SWAP_SLIPPAGE = exports.CHAINFLIP_SLIPPAGE = void 0;
|
|
7
7
|
// Copyright 2019-2022 @subwallet/extension-base
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
// core
|
|
@@ -21,6 +21,7 @@ exports.SwapErrorType = SwapErrorType;
|
|
|
21
21
|
SwapErrorType["NOT_ENOUGH_LIQUIDITY"] = "NOT_ENOUGH_LIQUIDITY";
|
|
22
22
|
SwapErrorType["MAKE_POOL_NOT_ENOUGH_EXISTENTIAL_DEPOSIT"] = "MAKE_POOL_NOT_ENOUGH_EXISTENTIAL_DEPOSIT";
|
|
23
23
|
SwapErrorType["AMOUNT_CANNOT_BE_ZERO"] = "AMOUNT_CANNOT_BE_ZERO";
|
|
24
|
+
SwapErrorType["NOT_MEET_MIN_EXPECTED"] = "NOT_MEET_MIN_EXPECTED";
|
|
24
25
|
})(SwapErrorType || (exports.SwapErrorType = SwapErrorType = {}));
|
|
25
26
|
let SwapStepType;
|
|
26
27
|
exports.SwapStepType = SwapStepType;
|
|
@@ -37,8 +38,9 @@ exports.SwapProviderId = SwapProviderId;
|
|
|
37
38
|
SwapProviderId["POLKADOT_ASSET_HUB"] = "POLKADOT_ASSET_HUB";
|
|
38
39
|
SwapProviderId["KUSAMA_ASSET_HUB"] = "KUSAMA_ASSET_HUB";
|
|
39
40
|
SwapProviderId["ROCOCO_ASSET_HUB"] = "ROCOCO_ASSET_HUB";
|
|
41
|
+
SwapProviderId["SIMPLE_SWAP"] = "SIMPLE_SWAP";
|
|
40
42
|
})(SwapProviderId || (exports.SwapProviderId = SwapProviderId = {}));
|
|
41
|
-
const _SUPPORTED_SWAP_PROVIDERS = [SwapProviderId.CHAIN_FLIP_TESTNET, SwapProviderId.CHAIN_FLIP_MAINNET, SwapProviderId.HYDRADX_MAINNET, SwapProviderId.HYDRADX_TESTNET, SwapProviderId.POLKADOT_ASSET_HUB, SwapProviderId.KUSAMA_ASSET_HUB, SwapProviderId.ROCOCO_ASSET_HUB];
|
|
43
|
+
const _SUPPORTED_SWAP_PROVIDERS = [SwapProviderId.CHAIN_FLIP_TESTNET, SwapProviderId.CHAIN_FLIP_MAINNET, SwapProviderId.HYDRADX_MAINNET, SwapProviderId.HYDRADX_TESTNET, SwapProviderId.POLKADOT_ASSET_HUB, SwapProviderId.KUSAMA_ASSET_HUB, SwapProviderId.ROCOCO_ASSET_HUB, SwapProviderId.SIMPLE_SWAP];
|
|
42
44
|
exports._SUPPORTED_SWAP_PROVIDERS = _SUPPORTED_SWAP_PROVIDERS;
|
|
43
45
|
// process handling
|
|
44
46
|
let SwapFeeType;
|
|
@@ -49,4 +51,6 @@ exports.SwapFeeType = SwapFeeType;
|
|
|
49
51
|
SwapFeeType["WALLET_FEE"] = "WALLET_FEE";
|
|
50
52
|
})(SwapFeeType || (exports.SwapFeeType = SwapFeeType = {}));
|
|
51
53
|
const CHAINFLIP_SLIPPAGE = 0.02; // Example: 0.01 for 1%
|
|
52
|
-
exports.CHAINFLIP_SLIPPAGE = CHAINFLIP_SLIPPAGE;
|
|
54
|
+
exports.CHAINFLIP_SLIPPAGE = CHAINFLIP_SLIPPAGE;
|
|
55
|
+
const SIMPLE_SWAP_SLIPPAGE = 0.05;
|
|
56
|
+
exports.SIMPLE_SWAP_SLIPPAGE = SIMPLE_SWAP_SLIPPAGE;
|
package/cjs/utils/number.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.formatNumber = exports.balanceNoPrefixFormater = exports.balanceFormatter = exports.PREDEFINED_FORMATTER = exports.BN_ZERO = exports.BN_WEI = exports.BN_TEN = exports.BN_ONE = void 0;
|
|
8
8
|
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
9
9
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
10
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -195,12 +195,17 @@ exports.balanceNoPrefixFormater = balanceNoPrefixFormater;
|
|
|
195
195
|
const PREDEFINED_FORMATTER = {
|
|
196
196
|
balance: balanceFormatter
|
|
197
197
|
};
|
|
198
|
+
|
|
199
|
+
/** @function formatNumber
|
|
200
|
+
* Convert number to a formatted string by dividing by 10^decimal
|
|
201
|
+
* @param {string | number | BigNumber} input - Input number
|
|
202
|
+
* @param {number} decimal - Decimal number
|
|
203
|
+
* @param {NumberFormatter} [formatter] - Formatter function
|
|
204
|
+
* - Default: balanceFormatter: With number > 1, show decimal with 2 numbers,
|
|
205
|
+
* with number < 1, show decimal with 6 (default) number
|
|
206
|
+
* @param {Record<string, number>} [metadata] - Metadata for formatter
|
|
207
|
+
*/
|
|
198
208
|
exports.PREDEFINED_FORMATTER = PREDEFINED_FORMATTER;
|
|
199
|
-
const toBNString = (input, decimal) => {
|
|
200
|
-
const raw = new _bignumber.default(input);
|
|
201
|
-
return raw.multipliedBy(BN_TEN.pow(decimal)).toFixed();
|
|
202
|
-
};
|
|
203
|
-
exports.toBNString = toBNString;
|
|
204
209
|
const formatNumber = function (input, decimal) {
|
|
205
210
|
let formatter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : balanceFormatter;
|
|
206
211
|
let metadata = arguments.length > 3 ? arguments[3] : undefined;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
2
|
import { SwapError } from '@subwallet/extension-base/background/errors/SwapError';
|
|
3
3
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
4
|
-
import { AssetHubPreValidationMetadata, ChainflipPreValidationMetadata, HydradxPreValidationMetadata, SwapErrorType } from '@subwallet/extension-base/types/swap';
|
|
4
|
+
import { AssetHubPreValidationMetadata, ChainflipPreValidationMetadata, HydradxPreValidationMetadata, SimpleSwapValidationMetadata, SwapErrorType } from '@subwallet/extension-base/types/swap';
|
|
5
5
|
export declare function _validateBalanceToSwapOnAssetHub(fromToken: _ChainAsset, feeToken: _ChainAsset, feeTokenChainInfo: _ChainInfo, feeAmount: string, fromTokenBalance: string, feeTokenBalance: string, swapAmount: string, isXcmOk: boolean, minSwap?: string): TransactionError | undefined;
|
|
6
6
|
export declare function _validateBalanceToSwap(fromToken: _ChainAsset, feeToken: _ChainAsset, feeTokenChainInfo: _ChainInfo, feeAmount: string, fromTokenBalance: string, feeTokenBalance: string, swapAmount: string, isXcmOk: boolean, minSwap?: string): TransactionError | undefined;
|
|
7
7
|
export declare function _validateSwapRecipient(destChainInfo: _ChainInfo, recipient: string): TransactionError | undefined;
|
|
8
8
|
export declare function _getChainflipEarlyValidationError(error: SwapErrorType, metadata: ChainflipPreValidationMetadata): SwapError;
|
|
9
9
|
export declare function _getEarlyHydradxValidationError(error: SwapErrorType, metadata: HydradxPreValidationMetadata): SwapError;
|
|
10
10
|
export declare function _getEarlyAssetHubValidationError(error: SwapErrorType, metadata: AssetHubPreValidationMetadata): SwapError;
|
|
11
|
+
export declare function _getSimpleSwapEarlyValidationError(error: SwapErrorType, metadata: SimpleSwapValidationMetadata): SwapError;
|
|
@@ -137,4 +137,30 @@ export function _getEarlyAssetHubValidationError(error, metadata) {
|
|
|
137
137
|
default:
|
|
138
138
|
return new SwapError(error);
|
|
139
139
|
}
|
|
140
|
+
}
|
|
141
|
+
export function _getSimpleSwapEarlyValidationError(error, metadata) {
|
|
142
|
+
// todo: support more providers
|
|
143
|
+
switch (error) {
|
|
144
|
+
case SwapErrorType.NOT_MEET_MIN_SWAP:
|
|
145
|
+
{
|
|
146
|
+
const message = `Amount too low. Increase your amount above ${metadata.minSwap.value} ${metadata.minSwap.symbol} and try again`;
|
|
147
|
+
return new SwapError(error, message);
|
|
148
|
+
}
|
|
149
|
+
case SwapErrorType.SWAP_EXCEED_ALLOWANCE:
|
|
150
|
+
{
|
|
151
|
+
if (metadata.maxSwap) {
|
|
152
|
+
return new SwapError(error, `Amount too high. Lower your amount below ${metadata.maxSwap.value} ${metadata.maxSwap.symbol} and try again`);
|
|
153
|
+
} else {
|
|
154
|
+
return new SwapError(error, 'Amount too high. Lower your amount and try again');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
case SwapErrorType.ASSET_NOT_SUPPORTED:
|
|
158
|
+
return new SwapError(error, 'This swap pair is not supported');
|
|
159
|
+
case SwapErrorType.UNKNOWN:
|
|
160
|
+
return new SwapError(error, `Undefined error. Check your Internet and ${metadata.chain.slug} connection or contact support`);
|
|
161
|
+
case SwapErrorType.ERROR_FETCHING_QUOTE:
|
|
162
|
+
return new SwapError(error, 'No swap quote found. Adjust your amount or try again later.');
|
|
163
|
+
default:
|
|
164
|
+
return new SwapError(error);
|
|
165
|
+
}
|
|
140
166
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
1
2
|
import { _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
3
|
import { NominationInfo, NominatorMetadata, StakingType, UnstakingInfo } from '@subwallet/extension-base/background/KoniTypes';
|
|
3
4
|
import { _SubstrateInflationParams } from '@subwallet/extension-base/services/chain-service/constants';
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.3.
|
|
20
|
+
"version": "1.3.11-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -1774,6 +1774,11 @@
|
|
|
1774
1774
|
"require": "./cjs/services/swap-service/handler/hydradx-handler.js",
|
|
1775
1775
|
"default": "./services/swap-service/handler/hydradx-handler.js"
|
|
1776
1776
|
},
|
|
1777
|
+
"./services/swap-service/handler/simpleswap-handler": {
|
|
1778
|
+
"types": "./services/swap-service/handler/simpleswap-handler.d.ts",
|
|
1779
|
+
"require": "./cjs/services/swap-service/handler/simpleswap-handler.js",
|
|
1780
|
+
"default": "./services/swap-service/handler/simpleswap-handler.js"
|
|
1781
|
+
},
|
|
1777
1782
|
"./services/swap-service/utils": {
|
|
1778
1783
|
"types": "./services/swap-service/utils.d.ts",
|
|
1779
1784
|
"require": "./cjs/services/swap-service/utils.js",
|
|
@@ -2464,7 +2469,7 @@
|
|
|
2464
2469
|
"@ethereumjs/common": "^4.1.0",
|
|
2465
2470
|
"@ethereumjs/tx": "^5.1.0",
|
|
2466
2471
|
"@ethersproject/abi": "^5.7.0",
|
|
2467
|
-
"@galacticcouncil/sdk": "^
|
|
2472
|
+
"@galacticcouncil/sdk": "^5.1.0",
|
|
2468
2473
|
"@gear-js/api": "^0.38.1",
|
|
2469
2474
|
"@json-rpc-tools/utils": "^1.7.6",
|
|
2470
2475
|
"@metamask/eth-sig-util": "^7.0.3",
|
|
@@ -2472,30 +2477,30 @@
|
|
|
2472
2477
|
"@metaverse-network-sdk/type-definitions": "^0.0.1-13",
|
|
2473
2478
|
"@oak-foundation/types": "^0.0.23",
|
|
2474
2479
|
"@polkadot-api/merkleize-metadata": "^1.1.0",
|
|
2475
|
-
"@polkadot/api": "^
|
|
2476
|
-
"@polkadot/api-base": "^
|
|
2477
|
-
"@polkadot/api-contract": "^
|
|
2478
|
-
"@polkadot/api-derive": "^
|
|
2480
|
+
"@polkadot/api": "^15.0.1",
|
|
2481
|
+
"@polkadot/api-base": "^15.0.1",
|
|
2482
|
+
"@polkadot/api-contract": "^15.0.1",
|
|
2483
|
+
"@polkadot/api-derive": "^15.0.1",
|
|
2479
2484
|
"@polkadot/apps-config": "^0.137.1",
|
|
2480
2485
|
"@polkadot/hw-ledger": "^12.6.2",
|
|
2481
|
-
"@polkadot/networks": "^
|
|
2486
|
+
"@polkadot/networks": "^13.2.3",
|
|
2482
2487
|
"@polkadot/phishing": "^0.22.7",
|
|
2483
|
-
"@polkadot/rpc-provider": "^
|
|
2484
|
-
"@polkadot/types": "^
|
|
2485
|
-
"@polkadot/types-augment": "^
|
|
2486
|
-
"@polkadot/types-known": "^
|
|
2488
|
+
"@polkadot/rpc-provider": "^15.0.1",
|
|
2489
|
+
"@polkadot/types": "^15.0.1",
|
|
2490
|
+
"@polkadot/types-augment": "^15.0.1",
|
|
2491
|
+
"@polkadot/types-known": "^15.0.1",
|
|
2487
2492
|
"@polkadot/ui-settings": "^3.6.6",
|
|
2488
|
-
"@polkadot/util": "^
|
|
2489
|
-
"@polkadot/util-crypto": "^
|
|
2493
|
+
"@polkadot/util": "^13.2.3",
|
|
2494
|
+
"@polkadot/util-crypto": "^13.2.3",
|
|
2490
2495
|
"@polkadot/x-global": "^12.2.1",
|
|
2491
2496
|
"@reduxjs/toolkit": "^1.9.1",
|
|
2492
2497
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
2493
2498
|
"@substrate/connect": "^0.8.9",
|
|
2494
|
-
"@subwallet/chain-list": "0.2.
|
|
2495
|
-
"@subwallet/extension-base": "^1.3.
|
|
2496
|
-
"@subwallet/extension-chains": "^1.3.
|
|
2497
|
-
"@subwallet/extension-dapp": "^1.3.
|
|
2498
|
-
"@subwallet/extension-inject": "^1.3.
|
|
2499
|
+
"@subwallet/chain-list": "0.2.96",
|
|
2500
|
+
"@subwallet/extension-base": "^1.3.11-0",
|
|
2501
|
+
"@subwallet/extension-chains": "^1.3.11-0",
|
|
2502
|
+
"@subwallet/extension-dapp": "^1.3.11-0",
|
|
2503
|
+
"@subwallet/extension-inject": "^1.3.11-0",
|
|
2499
2504
|
"@subwallet/keyring": "^0.1.8-beta.0",
|
|
2500
2505
|
"@subwallet/ui-keyring": "^0.1.8-beta.0",
|
|
2501
2506
|
"@ton/core": "^0.56.3",
|
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@subwallet/extension-base',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '1.3.
|
|
10
|
+
version: '1.3.11-0'
|
|
11
11
|
};
|
|
@@ -245,12 +245,12 @@ export const _TRANSFER_CHAIN_GROUP = {
|
|
|
245
245
|
kintsugi: ['kintsugi', 'kintsugi_test', 'interlay', 'mangatax_para'],
|
|
246
246
|
genshiro: ['genshiro_testnet', 'genshiro', 'equilibrium_parachain'],
|
|
247
247
|
// crab: ['crab', 'pangolin'],
|
|
248
|
-
bitcountry: ['pioneer', 'bitcountry'
|
|
248
|
+
bitcountry: ['pioneer', 'bitcountry'],
|
|
249
249
|
statemine: ['statemint', 'statemine', 'darwinia2', 'astar', 'shiden', 'shibuya', 'parallel', 'liberland', 'liberlandTest', 'dentnet', 'dbcchain'],
|
|
250
250
|
riochain: ['riochain'],
|
|
251
251
|
sora_substrate: ['sora_substrate'],
|
|
252
252
|
avail: ['kate', 'goldberg_testnet'],
|
|
253
|
-
pendulum: ['pendulum', 'amplitude', 'amplitude_test', 'hydradx_main'],
|
|
253
|
+
pendulum: ['pendulum', 'amplitude', 'amplitude_test', 'hydradx_main', 'bifrost', 'bifrost_dot'],
|
|
254
254
|
centrifuge: ['centrifuge'],
|
|
255
255
|
disable_transfer: ['invarch', 'crab', 'pangolin']
|
|
256
256
|
};
|
|
@@ -66,7 +66,7 @@ export function validateNativeLocalTransferMetadata(chainAsset) {
|
|
|
66
66
|
throw new Error(`Asset ${chainAsset.slug} is lack of metadata`);
|
|
67
67
|
}
|
|
68
68
|
const moonbeamGroup = ['moonbeam, moonbase, moonriver'];
|
|
69
|
-
const onChainInfoLocalGroup = [_TRANSFER_CHAIN_GROUP.centrifuge, ..._TRANSFER_CHAIN_GROUP.bitcountry, ..._TRANSFER_CHAIN_GROUP.acala, ..._TRANSFER_CHAIN_GROUP.kintsugi, 'pendulum', 'amplitude'];
|
|
69
|
+
const onChainInfoLocalGroup = [_TRANSFER_CHAIN_GROUP.centrifuge, ..._TRANSFER_CHAIN_GROUP.bitcountry, ..._TRANSFER_CHAIN_GROUP.acala, ..._TRANSFER_CHAIN_GROUP.kintsugi, 'pendulum', 'amplitude', 'bifrost', 'bifrost_dot'];
|
|
70
70
|
const onChainInfoNativeGroup = [_TRANSFER_CHAIN_GROUP.centrifuge, ..._TRANSFER_CHAIN_GROUP.acala, ..._TRANSFER_CHAIN_GROUP.kintsugi];
|
|
71
71
|
const assetIdLocalGroup = [..._TRANSFER_CHAIN_GROUP.statemine, ..._TRANSFER_CHAIN_GROUP.genshiro, ...moonbeamGroup, 'hydradx'];
|
|
72
72
|
const assetIdNativeGroup = [..._TRANSFER_CHAIN_GROUP.sora_substrate, 'hydradx'];
|
|
@@ -5,7 +5,7 @@ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
|
5
5
|
const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
|
|
6
6
|
const fetchDomain = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev';
|
|
7
7
|
const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
|
|
8
|
-
const ChainListVersion = '0.2.
|
|
8
|
+
const ChainListVersion = '0.2.96'; // update this when build chainlist
|
|
9
9
|
|
|
10
10
|
// todo: move this interface to chainlist
|
|
11
11
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
1
2
|
import { _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
3
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
3
4
|
import { ExtrinsicType, NominationInfo, UnstakingInfo } from '@subwallet/extension-base/background/KoniTypes';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
1
2
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
2
3
|
import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
3
4
|
import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
1
2
|
import { _SubstrateApi } from '@subwallet/extension-base/services/chain-service/types';
|
|
2
3
|
import { LendingYieldPoolInfo, LiquidYieldPoolInfo, NativeYieldPoolInfo, NominationYieldPoolInfo, YieldAssetExpectedEarning, YieldCompoundingPeriod, YieldPoolInfo, YieldPoolType } from '@subwallet/extension-base/types';
|
|
3
4
|
import { BN } from '@polkadot/util';
|
|
@@ -7,6 +7,7 @@ import BigN from 'bignumber.js';
|
|
|
7
7
|
export const _getPoolInfo = async (api, asset1, asset2) => {
|
|
8
8
|
const assetLocation1 = _getXcmAssetMultilocation(asset1);
|
|
9
9
|
const assetLocation2 = _getXcmAssetMultilocation(asset2);
|
|
10
|
+
// @ts-ignore - Type auto detect incorrect
|
|
10
11
|
const rs = await api.call.assetConversionApi.getReserves(assetLocation1, assetLocation2);
|
|
11
12
|
if (!rs) {
|
|
12
13
|
return ['0', '0'];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SwapError } from '@subwallet/extension-base/background/errors/SwapError';
|
|
2
|
+
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
3
|
+
import { BaseStepDetail, CommonOptimalPath, CommonStepFeeInfo, OptimalSwapPathParams, SwapEarlyValidation, SwapProviderId, SwapQuote, SwapRequest, SwapSubmitParams, SwapSubmitStepData, ValidateSwapProcessParams } from '@subwallet/extension-base/types';
|
|
4
|
+
import { BalanceService } from '../../balance-service';
|
|
5
|
+
import { ChainService } from '../../chain-service';
|
|
6
|
+
import { SwapBaseInterface } from './base-handler';
|
|
7
|
+
export declare const simpleSwapApiKey: string;
|
|
8
|
+
export declare class SimpleSwapHandler implements SwapBaseInterface {
|
|
9
|
+
private swapBaseHandler;
|
|
10
|
+
providerSlug: SwapProviderId;
|
|
11
|
+
constructor(chainService: ChainService, balanceService: BalanceService);
|
|
12
|
+
validateSwapProcess(params: ValidateSwapProcessParams): Promise<TransactionError[]>;
|
|
13
|
+
get chainService(): ChainService;
|
|
14
|
+
get balanceService(): BalanceService;
|
|
15
|
+
get providerInfo(): import("@subwallet/extension-base/types").SwapProvider;
|
|
16
|
+
get name(): string;
|
|
17
|
+
get slug(): string;
|
|
18
|
+
getSwapQuote(request: SwapRequest): Promise<SwapQuote | SwapError>;
|
|
19
|
+
generateOptimalProcess(params: OptimalSwapPathParams): Promise<CommonOptimalPath>;
|
|
20
|
+
getSubmitStep(params: OptimalSwapPathParams): Promise<[BaseStepDetail, CommonStepFeeInfo] | undefined>;
|
|
21
|
+
validateSwapRequest(request: SwapRequest): Promise<SwapEarlyValidation>;
|
|
22
|
+
handleSwapProcess(params: SwapSubmitParams): Promise<SwapSubmitStepData>;
|
|
23
|
+
handleSubmitStep(params: SwapSubmitParams): Promise<SwapSubmitStepData>;
|
|
24
|
+
}
|