@subwallet/extension-base 1.3.54-0 → 1.3.55-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/BalanceError.js +4 -4
- package/background/errors/BitcoinProviderError.js +7 -7
- package/background/errors/EvmProviderError.js +8 -8
- package/background/errors/ProviderError.js +6 -5
- package/background/errors/SwapError.js +14 -13
- package/background/errors/TransactionError.js +22 -22
- package/background/warnings/TransactionWarning.js +2 -2
- package/cjs/background/errors/BalanceError.js +4 -4
- package/cjs/background/errors/BitcoinProviderError.js +7 -7
- package/cjs/background/errors/EvmProviderError.js +8 -8
- package/cjs/background/errors/ProviderError.js +6 -5
- package/cjs/background/errors/SwapError.js +14 -13
- package/cjs/background/errors/TransactionError.js +22 -22
- package/cjs/background/warnings/TransactionWarning.js +2 -2
- package/cjs/core/logic-validation/index.js +15 -3
- package/cjs/core/logic-validation/request.js +37 -37
- package/cjs/core/logic-validation/transfer.js +21 -17
- package/cjs/koni/api/dotsama/parseTransaction.js +1 -1
- package/cjs/koni/api/staking/bonding/relayChain.js +1 -1
- package/cjs/koni/api/staking/bonding/utils.js +16 -16
- package/cjs/koni/api/staking/paraChain.js +1 -1
- package/cjs/koni/background/handlers/Extension.js +28 -26
- package/cjs/koni/background/handlers/State.js +19 -14
- package/cjs/koni/background/handlers/Tabs.js +23 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/index.js +3 -3
- package/cjs/services/balance-service/transfer/smart-contract.js +1 -1
- package/cjs/services/balance-service/transfer/xcm/index.js +7 -1
- package/cjs/services/balance-service/transfer/xcm/utils.js +24 -18
- package/cjs/services/chain-service/constants.js +2 -2
- package/cjs/services/chain-service/handler/types.js +1 -0
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/constants/chains.js +1 -2
- package/cjs/services/earning-service/handlers/base.js +2 -1
- package/cjs/services/earning-service/handlers/lending/base.js +3 -3
- package/cjs/services/earning-service/handlers/liquid-staking/base.js +3 -3
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +1 -1
- package/cjs/services/earning-service/handlers/native-staking/base-para.js +1 -1
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +2 -2
- package/cjs/services/earning-service/handlers/native-staking/tao.js +26 -6
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +2 -2
- package/cjs/services/earning-service/handlers/special.js +12 -9
- package/cjs/services/keyring-service/context/handlers/Derive.js +1 -1
- package/cjs/services/keyring-service/context/handlers/Json.js +11 -11
- package/cjs/services/keyring-service/context/handlers/Ledger.js +3 -3
- package/cjs/services/keyring-service/context/handlers/Mnemonic.js +10 -10
- package/cjs/services/keyring-service/context/handlers/Modify.js +3 -3
- package/cjs/services/keyring-service/context/handlers/Secret.js +7 -7
- package/cjs/services/migration-service/scripts/DeleteEarningData.js +1 -1
- package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +1 -6
- package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting.js +1 -6
- package/cjs/services/migration-service/scripts/index.js +3 -3
- package/cjs/services/request-service/handler/BitcoinRequestHandler.js +1 -1
- package/cjs/services/request-service/handler/CardanoRequestHandler.js +2 -2
- package/cjs/services/request-service/handler/EvmRequestHandler.js +5 -5
- package/cjs/services/request-service/handler/TonRequestHandler.js +2 -2
- package/cjs/services/setting-service/i18n/extend.js +1 -1
- package/cjs/services/swap-service/handler/base-handler.js +123 -11
- package/cjs/services/swap-service/index.js +1 -1
- package/cjs/services/transaction-service/index.js +12 -12
- package/cjs/services/transaction-service/utils.js +4 -1
- package/cjs/types/account/error/common.js +5 -4
- package/cjs/types/account/error/derive.js +8 -7
- package/cjs/utils/account/derive/info/solo.js +2 -2
- package/cjs/utils/eth/parseTransaction/index.js +1 -1
- package/cjs/utils/fee/transfer.js +8 -3
- package/cjs/utils/index.js +1 -1
- package/core/logic-validation/index.js +15 -3
- package/core/logic-validation/request.js +37 -37
- package/core/logic-validation/transfer.js +21 -17
- package/koni/api/dotsama/parseTransaction.js +1 -1
- package/koni/api/staking/bonding/relayChain.js +1 -1
- package/koni/api/staking/bonding/utils.js +16 -16
- package/koni/api/staking/paraChain.js +1 -1
- package/koni/background/handlers/Extension.js +28 -26
- package/koni/background/handlers/State.d.ts +1 -0
- package/koni/background/handlers/State.js +19 -14
- package/koni/background/handlers/Tabs.js +23 -1
- package/package.json +6 -6
- package/packageInfo.js +1 -1
- package/services/balance-service/index.js +3 -3
- package/services/balance-service/transfer/smart-contract.js +1 -1
- package/services/balance-service/transfer/xcm/index.js +7 -1
- package/services/balance-service/transfer/xcm/utils.d.ts +6 -0
- package/services/balance-service/transfer/xcm/utils.js +24 -18
- package/services/chain-service/constants.js +2 -2
- package/services/chain-service/handler/types.d.ts +2 -1
- package/services/chain-service/handler/types.js +1 -0
- package/services/chain-service/utils/patch.d.ts +1 -1
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/constants/chains.d.ts +0 -1
- package/services/earning-service/constants/chains.js +1 -2
- package/services/earning-service/handlers/base.js +3 -2
- package/services/earning-service/handlers/lending/base.js +3 -3
- package/services/earning-service/handlers/liquid-staking/base.js +3 -3
- package/services/earning-service/handlers/native-staking/amplitude.js +1 -1
- package/services/earning-service/handlers/native-staking/base-para.js +1 -1
- package/services/earning-service/handlers/native-staking/relay-chain.js +2 -2
- package/services/earning-service/handlers/native-staking/tao.js +26 -6
- package/services/earning-service/handlers/nomination-pool/index.js +2 -2
- package/services/earning-service/handlers/special.js +12 -9
- package/services/keyring-service/context/handlers/Derive.js +1 -1
- package/services/keyring-service/context/handlers/Json.js +11 -11
- package/services/keyring-service/context/handlers/Ledger.js +3 -3
- package/services/keyring-service/context/handlers/Mnemonic.js +10 -10
- package/services/keyring-service/context/handlers/Modify.js +3 -3
- package/services/keyring-service/context/handlers/Secret.js +7 -7
- package/services/migration-service/scripts/DeleteEarningData.js +1 -1
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +1 -6
- package/services/migration-service/scripts/databases/MigrateAssetSetting.js +1 -6
- package/services/migration-service/scripts/index.js +3 -3
- package/services/request-service/handler/BitcoinRequestHandler.js +1 -1
- package/services/request-service/handler/CardanoRequestHandler.js +2 -2
- package/services/request-service/handler/EvmRequestHandler.js +5 -5
- package/services/request-service/handler/TonRequestHandler.js +2 -2
- package/services/setting-service/i18n/extend.js +1 -1
- package/services/swap-service/handler/base-handler.d.ts +2 -1
- package/services/swap-service/handler/base-handler.js +124 -12
- package/services/swap-service/index.js +1 -1
- package/services/transaction-service/index.js +12 -12
- package/services/transaction-service/utils.js +4 -1
- package/types/account/error/common.js +5 -4
- package/types/account/error/derive.js +8 -7
- package/types/balance/transfer.d.ts +1 -0
- package/utils/account/derive/info/solo.js +2 -2
- package/utils/eth/parseTransaction/index.js +1 -1
- package/utils/fee/transfer.d.ts +3 -1
- package/utils/fee/transfer.js +5 -1
- package/utils/index.js +1 -1
|
@@ -44,11 +44,11 @@ class BaseLendingPoolHandler extends _special.default {
|
|
|
44
44
|
const maxUnstakeRequest = poolInfo.statistic.maxWithdrawalRequestPerFarmer;
|
|
45
45
|
const derivativeTokenInfo = this.state.getAssetBySlug(this.derivativeAssets[0]);
|
|
46
46
|
if (bnAmount.lte(_utils.BN_ZERO)) {
|
|
47
|
-
return [new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('
|
|
47
|
+
return [new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.EARNING.services.service.earning.lending.amountMustBeGreaterThanZero'))];
|
|
48
48
|
}
|
|
49
49
|
if (bnAmount.lt(minUnstake)) {
|
|
50
50
|
const minUnstakeStr = (0, _utils.formatNumber)(minUnstake.toString(), derivativeTokenInfo.decimals || 0);
|
|
51
|
-
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.NOT_ENOUGH_MIN_UNSTAKE, (0, _i18next.t)('
|
|
51
|
+
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.NOT_ENOUGH_MIN_UNSTAKE, (0, _i18next.t)('bg.EARNING.services.service.earning.lending.unstakeMinimumAmount', {
|
|
52
52
|
replace: {
|
|
53
53
|
amount: minUnstakeStr,
|
|
54
54
|
token: derivativeTokenInfo.symbol
|
|
@@ -61,7 +61,7 @@ class BaseLendingPoolHandler extends _special.default {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
if (poolPosition.unstakings.length > maxUnstakeRequest) {
|
|
64
|
-
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.EXCEED_MAX_UNSTAKING, (0, _i18next.t)('
|
|
64
|
+
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.EXCEED_MAX_UNSTAKING, (0, _i18next.t)('bg.EARNING.services.service.earning.lending.maxUnstakeTimes', {
|
|
65
65
|
replace: {
|
|
66
66
|
number: maxUnstakeRequest
|
|
67
67
|
}
|
|
@@ -61,11 +61,11 @@ class BaseLiquidStakingPoolHandler extends _special.default {
|
|
|
61
61
|
const maxUnstakeRequest = poolInfo.statistic.maxWithdrawalRequestPerFarmer;
|
|
62
62
|
const derivativeTokenInfo = this.state.getAssetBySlug(this.derivativeAssets[0]);
|
|
63
63
|
if (bnAmount.lte(_util.BN_ZERO)) {
|
|
64
|
-
return [new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('
|
|
64
|
+
return [new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.EARNING.services.service.earning.liquidStaking.amountMustBeGreaterThanZero'))];
|
|
65
65
|
}
|
|
66
66
|
if (bnAmount.lt(minUnstake)) {
|
|
67
67
|
const minUnstakeStr = (0, _utils2.formatNumber)(minUnstake.toString(), derivativeTokenInfo.decimals || 0);
|
|
68
|
-
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.NOT_ENOUGH_MIN_UNSTAKE, (0, _i18next.t)('
|
|
68
|
+
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.NOT_ENOUGH_MIN_UNSTAKE, (0, _i18next.t)('bg.EARNING.services.service.earning.liquidStaking.unstakeMinimumAmount', {
|
|
69
69
|
replace: {
|
|
70
70
|
amount: minUnstakeStr,
|
|
71
71
|
token: derivativeTokenInfo.symbol
|
|
@@ -78,7 +78,7 @@ class BaseLiquidStakingPoolHandler extends _special.default {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (poolPosition.unstakings.length > maxUnstakeRequest) {
|
|
81
|
-
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.EXCEED_MAX_UNSTAKING, (0, _i18next.t)('
|
|
81
|
+
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.EXCEED_MAX_UNSTAKING, (0, _i18next.t)('bg.EARNING.services.service.earning.liquidStaking.maxUnstakeTimes', {
|
|
82
82
|
replace: {
|
|
83
83
|
number: maxUnstakeRequest
|
|
84
84
|
}
|
|
@@ -279,7 +279,7 @@ class AmplitudeNativeStakingPoolHandler extends _basePara.default {
|
|
|
279
279
|
let cancel = false;
|
|
280
280
|
const substrateApi = this.substrateApi;
|
|
281
281
|
await substrateApi.isReady;
|
|
282
|
-
if (!_constants2._STAKING_CHAIN_GROUP.
|
|
282
|
+
if (!_constants2._STAKING_CHAIN_GROUP.krest_network.includes(this.chain)) {
|
|
283
283
|
await Promise.all(useAddresses.map(async address => {
|
|
284
284
|
const _unclaimedReward = await substrateApi.api.query.parachainStaking.rewards(address);
|
|
285
285
|
if (cancel) {
|
|
@@ -114,7 +114,7 @@ class BaseParaNativeStakingPoolHandler extends _base.default {
|
|
|
114
114
|
}
|
|
115
115
|
const bnAmount = new _util.BN(amount);
|
|
116
116
|
if (bnAmount.lte(_util.BN_ZERO)) {
|
|
117
|
-
errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('
|
|
117
|
+
errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.EARNING.services.service.earning.nativeStakingPara.amountMustBeGreaterThanZero')));
|
|
118
118
|
}
|
|
119
119
|
let targetNomination;
|
|
120
120
|
for (const nomination of poolPosition.nominations) {
|
|
@@ -635,7 +635,7 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
635
635
|
}
|
|
636
636
|
const bnAmount = new _util.BN(amount);
|
|
637
637
|
if (bnAmount.lte(_util.BN_ZERO)) {
|
|
638
|
-
errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('
|
|
638
|
+
errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.EARNING.services.service.earning.nativeStakingRelay.amountMustBeGreaterThanZero')));
|
|
639
639
|
}
|
|
640
640
|
const bnActiveStake = new _util.BN(poolPosition.activeStake);
|
|
641
641
|
const bnRemainingStake = bnActiveStake.sub(new _util.BN(amount));
|
|
@@ -645,7 +645,7 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
645
645
|
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.INVALID_ACTIVE_STAKE));
|
|
646
646
|
}
|
|
647
647
|
if (poolPosition.unstakings.length > maxUnstake) {
|
|
648
|
-
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.EXCEED_MAX_UNSTAKING, (0, _i18next.t)('
|
|
648
|
+
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.EXCEED_MAX_UNSTAKING, (0, _i18next.t)('bg.EARNING.services.service.earning.nativeStakingRelay.maxUnstakeTimes', {
|
|
649
649
|
replace: {
|
|
650
650
|
number: maxUnstake
|
|
651
651
|
}
|
|
@@ -538,7 +538,12 @@ class TaoNativeStakingPoolHandler extends _basePara.default {
|
|
|
538
538
|
} = data;
|
|
539
539
|
const bnMinStake = await this.getMinBond(subnetData === null || subnetData === void 0 ? void 0 : subnetData.netuid);
|
|
540
540
|
if (new _bignumber.default(amount).lt(bnMinStake)) {
|
|
541
|
-
return [new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)(
|
|
541
|
+
return [new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.EARNING.services.service.earning.nativeStaking.tao.insufficientStakeToEarn', {
|
|
542
|
+
replace: {
|
|
543
|
+
bnMinStake: (0, _utils3.formatNumber)(bnMinStake, (0, _utils2._getAssetDecimals)(this.nativeToken)),
|
|
544
|
+
symbol: (0, _utils2._getAssetSymbol)(this.nativeToken)
|
|
545
|
+
}
|
|
546
|
+
}))];
|
|
542
547
|
}
|
|
543
548
|
return baseErrors;
|
|
544
549
|
}
|
|
@@ -576,7 +581,12 @@ class TaoNativeStakingPoolHandler extends _basePara.default {
|
|
|
576
581
|
const minUnstake = minDelegatorStake.dividedBy(alphaToTaoPrice);
|
|
577
582
|
if (new _bignumber.default(amount).lt(minUnstake)) {
|
|
578
583
|
var _poolInfo$metadata$su2;
|
|
579
|
-
return [new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)(
|
|
584
|
+
return [new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.EARNING.services.service.earning.nativeStaking.tao.unstakeAmountTooLow', {
|
|
585
|
+
replace: {
|
|
586
|
+
bnMinUnstake: (0, _utils3.formatNumber)(minUnstake, (0, _utils2._getAssetDecimals)(this.nativeToken)),
|
|
587
|
+
symbol: ((_poolInfo$metadata$su2 = poolInfo.metadata.subnetData) === null || _poolInfo$metadata$su2 === void 0 ? void 0 : _poolInfo$metadata$su2.subnetSymbol) || (0, _utils2._getAssetSymbol)(this.nativeToken)
|
|
588
|
+
}
|
|
589
|
+
}))];
|
|
580
590
|
}
|
|
581
591
|
return baseErrors;
|
|
582
592
|
}
|
|
@@ -601,10 +611,10 @@ class TaoNativeStakingPoolHandler extends _basePara.default {
|
|
|
601
611
|
const selectedValidatorInfo = targetValidators[0];
|
|
602
612
|
const destValidator = selectedValidatorInfo.address;
|
|
603
613
|
if (new _bignumber.default(amount).lte(0)) {
|
|
604
|
-
return Promise.reject(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('
|
|
614
|
+
return Promise.reject(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.EARNING.services.service.earning.nativeStaking.tao.amountMustBeGreaterThanZero')));
|
|
605
615
|
}
|
|
606
616
|
if (originValidator === destValidator) {
|
|
607
|
-
return Promise.reject(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS,
|
|
617
|
+
return Promise.reject(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.EARNING.services.service.earning.nativeStaking.tao.fromValidatorSameAsTo')));
|
|
608
618
|
}
|
|
609
619
|
const alphaToTaoPrice = new _bignumber.default(await getAlphaToTaoRate(this.substrateApi, netuid));
|
|
610
620
|
const bnMinStake = await this.getMinBond(netuid);
|
|
@@ -612,12 +622,22 @@ class TaoNativeStakingPoolHandler extends _basePara.default {
|
|
|
612
622
|
const formattedMinUnstake = minUnstake.dividedBy(1000000).integerValue(_bignumber.default.ROUND_CEIL).dividedBy(1000);
|
|
613
623
|
const bnMinMoveStake = formattedMinUnstake.multipliedBy(10 ** (0, _utils2._getAssetDecimals)(this.nativeToken));
|
|
614
624
|
if (new _bignumber.default(amount).lt(bnMinMoveStake)) {
|
|
615
|
-
return Promise.reject(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)(
|
|
625
|
+
return Promise.reject(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.EARNING.services.service.earning.nativeStaking.tao.moveStakeAmountTooLow', {
|
|
626
|
+
replace: {
|
|
627
|
+
bnMinMoveStake: formattedMinUnstake.toString(),
|
|
628
|
+
symbol: (metadata === null || metadata === void 0 ? void 0 : metadata.subnetSymbol) || ''
|
|
629
|
+
}
|
|
630
|
+
})));
|
|
616
631
|
}
|
|
617
632
|
|
|
618
633
|
// Avoid remaining amount too low -> can't do anything with that amount
|
|
619
634
|
if (!(maxAmount === amount) && new _bignumber.default(maxAmount).minus(new _bignumber.default(amount)).lt(bnMinMoveStake)) {
|
|
620
|
-
return Promise.reject(new _TransactionError.TransactionError(_types.StakingTxErrorType.REMAINING_AMOUNT_TOO_LOW, (0, _i18next.t)(
|
|
635
|
+
return Promise.reject(new _TransactionError.TransactionError(_types.StakingTxErrorType.REMAINING_AMOUNT_TOO_LOW, (0, _i18next.t)('bg.EARNING.services.service.earning.nativeStaking.tao.remainingStakeBelowMinimumWarning', {
|
|
636
|
+
replace: {
|
|
637
|
+
maxAmount: (0, _utils3.formatNumber)(maxAmount, (0, _utils2._getAssetDecimals)(this.nativeToken)),
|
|
638
|
+
subnetSymbol: (metadata === null || metadata === void 0 ? void 0 : metadata.subnetSymbol) || (0, _utils2._getAssetSymbol)(this.nativeToken)
|
|
639
|
+
}
|
|
640
|
+
})));
|
|
621
641
|
}
|
|
622
642
|
const extrinsic = chainApi.api.tx.subtensorModule.moveStake(originValidator, destValidator, netuid, netuid, amount);
|
|
623
643
|
return extrinsic;
|
|
@@ -523,7 +523,7 @@ class NominationPoolHandler extends _base.default {
|
|
|
523
523
|
}
|
|
524
524
|
const bnAmount = new _util.BN(amount);
|
|
525
525
|
if (bnAmount.lte(_util.BN_ZERO)) {
|
|
526
|
-
errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('
|
|
526
|
+
errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.EARNING.services.service.earning.nominationPool.amountMustBeGreaterThanZero')));
|
|
527
527
|
}
|
|
528
528
|
const bnActiveStake = new _util.BN(poolPosition.activeStake);
|
|
529
529
|
const bnRemainingStake = bnActiveStake.sub(new _util.BN(amount));
|
|
@@ -533,7 +533,7 @@ class NominationPoolHandler extends _base.default {
|
|
|
533
533
|
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.INVALID_ACTIVE_STAKE));
|
|
534
534
|
}
|
|
535
535
|
if (poolPosition.unstakings.length > maxUnstake) {
|
|
536
|
-
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.EXCEED_MAX_UNSTAKING, (0, _i18next.t)('
|
|
536
|
+
errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.EXCEED_MAX_UNSTAKING, (0, _i18next.t)('bg.EARNING.services.service.earning.nominationPool.maxUnstakeTimes', {
|
|
537
537
|
replace: {
|
|
538
538
|
number: maxUnstake
|
|
539
539
|
}
|
|
@@ -99,7 +99,11 @@ class BaseSpecialStakingPoolHandler extends _base.default {
|
|
|
99
99
|
const altName = altChain.name;
|
|
100
100
|
const parsedMinJoinPool = (0, _utils4.formatNumber)(missingAmount.toString(), inputAssetInfo.decimals || 0);
|
|
101
101
|
const formatparsedMinJoinPool = isTheSame ? parsedMinJoinPool : Number(parsedMinJoinPool) + 0.01;
|
|
102
|
-
|
|
102
|
+
|
|
103
|
+
// If balance can not cover ED, add ED to the missing amount
|
|
104
|
+
const needExtraED = bnInputAssetBalance.eq(_util.BN_ZERO) && bnAltInputAssetBalance.eq(_util.BN_ZERO);
|
|
105
|
+
const totalMissingAlt = needExtraED ? missingAmount.add(existentialDeposit) : missingAmount;
|
|
106
|
+
const parsedMinAltJoinPool = (0, _utils4.formatNumber)(totalMissingAlt.toString(), inputAssetInfo.decimals || 0);
|
|
103
107
|
const formatParsedMinAltJoinPool = isTheSame ? parsedMinAltJoinPool : Number(parsedMinAltJoinPool) + 0.01;
|
|
104
108
|
return {
|
|
105
109
|
passed: false,
|
|
@@ -300,23 +304,22 @@ class BaseSpecialStakingPoolHandler extends _base.default {
|
|
|
300
304
|
const inputTokenInfo = this.state.getAssetBySlug(this.inputAsset);
|
|
301
305
|
const altInputTokenBalance = await this.state.balanceService.getTransferableBalance(params.address, altInputTokenInfo.originChain, altInputTokenSlug);
|
|
302
306
|
const missingAmount = bnAmount.sub(bnInputTokenBalance); // TODO: what if input token is not LOCAL ??
|
|
303
|
-
const
|
|
304
|
-
const xcmAmount = missingAmount.add(xcmFee);
|
|
307
|
+
const xcmFeeValidate = new _util.BN(path.totalFee[1].amount || '0').mul(new _util.BN(_constants.XCM_FEE_RATIO));
|
|
305
308
|
const bnAltInputTokenBalance = new _util.BN(altInputTokenBalance.value || '0');
|
|
306
|
-
if (!bnAltInputTokenBalance.sub(
|
|
309
|
+
if (!bnAltInputTokenBalance.sub(missingAmount).sub(xcmFeeValidate).gt(_util.BN_ZERO)) {
|
|
307
310
|
processValidation.failedStep = path.steps[1];
|
|
308
311
|
processValidation.ok = false;
|
|
309
312
|
processValidation.status = _types.YieldValidationStatus.NOT_ENOUGH_BALANCE;
|
|
310
|
-
const bnMaxXCM = new _util.BN(altInputTokenBalance.value).sub(
|
|
313
|
+
const bnMaxXCM = new _util.BN(altInputTokenBalance.value).sub(xcmFeeValidate);
|
|
311
314
|
const inputTokenDecimal = (0, _utils3._getAssetDecimals)(inputTokenInfo);
|
|
312
|
-
const maxBn = bnInputTokenBalance.add(
|
|
315
|
+
const maxBn = bnInputTokenBalance.add(bnAltInputTokenBalance.sub(xcmFeeValidate));
|
|
313
316
|
const maxValue = (0, _utils4.formatNumber)(maxBn.toString(), inputTokenInfo.decimals || 0);
|
|
314
317
|
const maxXCMValue = (0, _utils4.formatNumber)(bnMaxXCM.toString(), inputTokenDecimal);
|
|
315
318
|
const symbol = (0, _utils3._getAssetSymbol)(altInputTokenInfo);
|
|
316
319
|
const inputNetworkName = this.chainInfo.name;
|
|
317
320
|
const altNetworkName = (0, _utils3._getAssetName)(altInputTokenInfo);
|
|
318
321
|
const currentValue = (0, _utils4.formatNumber)(bnInputTokenBalance.toString(), inputTokenDecimal);
|
|
319
|
-
processValidation.message = (0, _i18next.t)('
|
|
322
|
+
processValidation.message = (0, _i18next.t)('bg.EARNING.services.service.earning.specialHandler.maximumInputExceeded', {
|
|
320
323
|
replace: {
|
|
321
324
|
symbol,
|
|
322
325
|
maxValue,
|
|
@@ -373,13 +376,13 @@ class BaseSpecialStakingPoolHandler extends _base.default {
|
|
|
373
376
|
processValidation.status = _types.YieldValidationStatus.NOT_ENOUGH_BALANCE;
|
|
374
377
|
const maxString = (0, _utils4.formatNumber)(bnInputTokenBalance.toString(), inputTokenInfo.decimals || 0);
|
|
375
378
|
if (maxString !== '0') {
|
|
376
|
-
processValidation.message = (0, _i18next.t)('
|
|
379
|
+
processValidation.message = (0, _i18next.t)('bg.EARNING.services.service.earning.specialHandler.amountMaxError', {
|
|
377
380
|
replace: {
|
|
378
381
|
number: maxString
|
|
379
382
|
}
|
|
380
383
|
});
|
|
381
384
|
} else {
|
|
382
|
-
processValidation.message = (0, _i18next.t)('
|
|
385
|
+
processValidation.message = (0, _i18next.t)('bg.EARNING.services.service.earning.specialHandler.balanceGreaterThanZeroRequired');
|
|
383
386
|
}
|
|
384
387
|
return [new _TransactionError.TransactionError(_types.YieldValidationStatus.NOT_ENOUGH_BALANCE, processValidation.message, processValidation)];
|
|
385
388
|
}
|
|
@@ -356,7 +356,7 @@ class AccountDeriveHandler extends _Base.AccountBaseHandler {
|
|
|
356
356
|
const addresses = pairs.map(pair => pair.address);
|
|
357
357
|
const exists = this.state.checkAddressExists(addresses);
|
|
358
358
|
if (!isMigration) {
|
|
359
|
-
(0, _util.assert)(!exists, (0, _i18next.t)('
|
|
359
|
+
(0, _util.assert)(!exists, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Derive.accountExistsWithName', {
|
|
360
360
|
replace: {
|
|
361
361
|
name: (exists === null || exists === void 0 ? void 0 : exists.name) || (exists === null || exists === void 0 ? void 0 : exists.address) || ''
|
|
362
362
|
}
|
|
@@ -91,7 +91,7 @@ class AccountJsonHandler extends _Base.AccountBaseHandler {
|
|
|
91
91
|
throw new Error(e.message);
|
|
92
92
|
}
|
|
93
93
|
} else {
|
|
94
|
-
throw new Error((0, _i18next.t)('
|
|
94
|
+
throw new Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Json.incorrectPassword'));
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
jsonRestoreV2(_ref2, onDone) {
|
|
@@ -112,7 +112,7 @@ class AccountJsonHandler extends _Base.AccountBaseHandler {
|
|
|
112
112
|
try {
|
|
113
113
|
const _pair = _uiKeyring.keyring.createFromJson(file);
|
|
114
114
|
const exists = this.state.checkAddressExists([_pair.address]);
|
|
115
|
-
(0, _util.assert)(!exists, (0, _i18next.t)('
|
|
115
|
+
(0, _util.assert)(!exists, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Json.accountAlreadyExistsWithName', {
|
|
116
116
|
replace: {
|
|
117
117
|
name: (exists === null || exists === void 0 ? void 0 : exists.name) || (exists === null || exists === void 0 ? void 0 : exists.address) || _pair.address
|
|
118
118
|
}
|
|
@@ -138,7 +138,7 @@ class AccountJsonHandler extends _Base.AccountBaseHandler {
|
|
|
138
138
|
reject(error);
|
|
139
139
|
}
|
|
140
140
|
} else {
|
|
141
|
-
reject(new Error((0, _i18next.t)('
|
|
141
|
+
reject(new Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Json.incorrectPassword')));
|
|
142
142
|
}
|
|
143
143
|
return promise;
|
|
144
144
|
}
|
|
@@ -171,7 +171,7 @@ class AccountJsonHandler extends _Base.AccountBaseHandler {
|
|
|
171
171
|
return rs;
|
|
172
172
|
}, []);
|
|
173
173
|
if (!(pairs !== null && pairs !== void 0 && pairs.length)) {
|
|
174
|
-
throw new Error((0, _i18next.t)('
|
|
174
|
+
throw new Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Json.noValidAccountsToImport'));
|
|
175
175
|
}
|
|
176
176
|
const accountProxyMap = (0, _utils.combineAccountsWithKeyPair)(pairs, modifyPairs, accountProxies);
|
|
177
177
|
const result = Object.values(accountProxyMap).map(proxy => {
|
|
@@ -195,7 +195,7 @@ class AccountJsonHandler extends _Base.AccountBaseHandler {
|
|
|
195
195
|
throw new Error(e.message);
|
|
196
196
|
}
|
|
197
197
|
} else {
|
|
198
|
-
throw new Error((0, _i18next.t)('
|
|
198
|
+
throw new Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Json.incorrectPassword'));
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
batchRestoreV2(_ref4) {
|
|
@@ -231,7 +231,7 @@ class AccountJsonHandler extends _Base.AccountBaseHandler {
|
|
|
231
231
|
return rs;
|
|
232
232
|
}, []);
|
|
233
233
|
if (!(pairs !== null && pairs !== void 0 && pairs.length)) {
|
|
234
|
-
throw new Error((0, _i18next.t)('
|
|
234
|
+
throw new Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Json.noValidAccountsToImport'));
|
|
235
235
|
}
|
|
236
236
|
const accountProxyMap = (0, _utils.combineAccountsWithKeyPair)(pairs, modifyPairs, accountProxies);
|
|
237
237
|
const rawProxyIds = _proxyIds && _proxyIds.length ? _proxyIds : Object.keys(accountProxyMap);
|
|
@@ -261,13 +261,13 @@ class AccountJsonHandler extends _Base.AccountBaseHandler {
|
|
|
261
261
|
const proxyIds = Object.values(filteredAccountProxies).flatMap(proxy => proxy.id);
|
|
262
262
|
if (!addresses.length) {
|
|
263
263
|
if (_exists) {
|
|
264
|
-
throw new Error((0, _i18next.t)('
|
|
264
|
+
throw new Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Json.accountAlreadyExistsWithName', {
|
|
265
265
|
replace: {
|
|
266
266
|
name: _exists.name || _exists.address || ''
|
|
267
267
|
}
|
|
268
268
|
}));
|
|
269
269
|
} else {
|
|
270
|
-
throw new Error((0, _i18next.t)('
|
|
270
|
+
throw new Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Json.noAccountsFoundToImport'));
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
const _accountProxies = this.state.value.accountProxy;
|
|
@@ -327,7 +327,7 @@ class AccountJsonHandler extends _Base.AccountBaseHandler {
|
|
|
327
327
|
throw new Error(error.message);
|
|
328
328
|
}
|
|
329
329
|
} else {
|
|
330
|
-
reject(new Error((0, _i18next.t)('
|
|
330
|
+
reject(new Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Json.incorrectPassword')));
|
|
331
331
|
}
|
|
332
332
|
return promise;
|
|
333
333
|
}
|
|
@@ -338,7 +338,7 @@ class AccountJsonHandler extends _Base.AccountBaseHandler {
|
|
|
338
338
|
} = request;
|
|
339
339
|
try {
|
|
340
340
|
if (proxyIds && !proxyIds.length) {
|
|
341
|
-
throw new Error((0, _i18next.t)('
|
|
341
|
+
throw new Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Json.noAccountsFoundToExport'));
|
|
342
342
|
}
|
|
343
343
|
const _accountProxy = this.state.value.accountProxy;
|
|
344
344
|
const _modifyPair = this.state.value.modifyPair;
|
|
@@ -364,7 +364,7 @@ class AccountJsonHandler extends _Base.AccountBaseHandler {
|
|
|
364
364
|
} catch (e) {
|
|
365
365
|
const error = e;
|
|
366
366
|
if (error.message === 'Invalid master password') {
|
|
367
|
-
throw new Error((0, _i18next.t)('
|
|
367
|
+
throw new Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Json.incorrectPassword'));
|
|
368
368
|
} else {
|
|
369
369
|
throw error;
|
|
370
370
|
}
|
|
@@ -35,7 +35,7 @@ class AccountLedgerHandler extends _Base.AccountBaseHandler {
|
|
|
35
35
|
originGenesisHash
|
|
36
36
|
} = request;
|
|
37
37
|
const exists = this.state.checkAddressExists([address]);
|
|
38
|
-
(0, _util.assert)(!exists, (0, _i18next.t)('
|
|
38
|
+
(0, _util.assert)(!exists, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Ledger.accountAlreadyExistsWithName', {
|
|
39
39
|
replace: {
|
|
40
40
|
name: (exists === null || exists === void 0 ? void 0 : exists.name) || (exists === null || exists === void 0 ? void 0 : exists.address) || address
|
|
41
41
|
}
|
|
@@ -80,10 +80,10 @@ class AccountLedgerHandler extends _Base.AccountBaseHandler {
|
|
|
80
80
|
} = _ref;
|
|
81
81
|
const addresses = [];
|
|
82
82
|
if (!accounts.length) {
|
|
83
|
-
throw new Error((0, _i18next.t)('
|
|
83
|
+
throw new Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Ledger.cantFindAccountTryAgain'));
|
|
84
84
|
}
|
|
85
85
|
const exists = this.state.checkAddressExists(accounts.map(account => account.address));
|
|
86
|
-
(0, _util.assert)(!exists, (0, _i18next.t)('
|
|
86
|
+
(0, _util.assert)(!exists, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Ledger.accountAlreadyExistsWithName', {
|
|
87
87
|
replace: {
|
|
88
88
|
name: (exists === null || exists === void 0 ? void 0 : exists.name) || (exists === null || exists === void 0 ? void 0 : exists.address) || ''
|
|
89
89
|
}
|
|
@@ -60,20 +60,20 @@ class AccountMnemonicHandler extends _Base.AccountBaseHandler {
|
|
|
60
60
|
let mnemonicTypes = 'general';
|
|
61
61
|
let pairTypes = [];
|
|
62
62
|
if ((0, _util.isHex)(phrase)) {
|
|
63
|
-
(0, _util.assert)((0, _util.isHex)(phrase, 256), (0, _i18next.t)('
|
|
63
|
+
(0, _util.assert)((0, _util.isHex)(phrase, 256), (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.invalidSeedPhraseTryAgain'));
|
|
64
64
|
} else {
|
|
65
65
|
// sadly isHex detects as string, so we need a cast here
|
|
66
|
-
(0, _util.assert)(SEED_LENGTHS.includes(phrase.split(' ').length), (0, _i18next.t)('
|
|
66
|
+
(0, _util.assert)(SEED_LENGTHS.includes(phrase.split(' ').length), (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.seedPhraseWordCount', {
|
|
67
67
|
replace: {
|
|
68
68
|
x: SEED_LENGTHS.join(', ')
|
|
69
69
|
}
|
|
70
70
|
}));
|
|
71
71
|
try {
|
|
72
|
-
(0, _util.assert)((0, _utilCrypto.mnemonicValidate)(phrase), (0, _i18next.t)('
|
|
72
|
+
(0, _util.assert)((0, _utilCrypto.mnemonicValidate)(phrase), (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.invalidSeedPhraseTryAgain'));
|
|
73
73
|
mnemonicTypes = 'general';
|
|
74
74
|
pairTypes = ['sr25519', ..._types2.EthereumKeypairTypes, 'ton', ..._types2.CardanoKeypairTypes, ..._types2.BitcoinKeypairTypes];
|
|
75
75
|
} catch (e) {
|
|
76
|
-
(0, _util.assert)((0, _utils2.tonMnemonicValidate)(phrase), (0, _i18next.t)('
|
|
76
|
+
(0, _util.assert)((0, _utils2.tonMnemonicValidate)(phrase), (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.invalidSeedPhraseTryAgain'));
|
|
77
77
|
mnemonicTypes = 'ton';
|
|
78
78
|
pairTypes = ['ton-native'];
|
|
79
79
|
}
|
|
@@ -88,7 +88,7 @@ class AccountMnemonicHandler extends _Base.AccountBaseHandler {
|
|
|
88
88
|
rs.addressMap[type] = _uiKeyring.keyring.createFromUri((0, _utils.getSuri)(mnemonic, type), {}, type).address;
|
|
89
89
|
});
|
|
90
90
|
const exists = this.state.checkAddressExists(Object.values(rs.addressMap));
|
|
91
|
-
(0, _util.assert)(!exists, (0, _i18next.t)('
|
|
91
|
+
(0, _util.assert)(!exists, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.accountAlreadyExistsWithName', {
|
|
92
92
|
replace: {
|
|
93
93
|
name: (exists === null || exists === void 0 ? void 0 : exists.name) || (exists === null || exists === void 0 ? void 0 : exists.address) || ''
|
|
94
94
|
}
|
|
@@ -111,14 +111,14 @@ class AccountMnemonicHandler extends _Base.AccountBaseHandler {
|
|
|
111
111
|
const types = type ? [type] : ['sr25519', ..._types2.EthereumKeypairTypes, 'ton', ..._types2.CardanoKeypairTypes, ..._types2.BitcoinKeypairTypes];
|
|
112
112
|
if (!hasMasterPassword) {
|
|
113
113
|
if (!password) {
|
|
114
|
-
throw Error((0, _i18next.t)('
|
|
114
|
+
throw Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.eachAccountPasswordNeeded'));
|
|
115
115
|
} else {
|
|
116
116
|
_uiKeyring.keyring.changeMasterPassword(password);
|
|
117
117
|
this.parentService.updateKeyringState();
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
if (!types || !types.length) {
|
|
121
|
-
throw Error((0, _i18next.t)('
|
|
121
|
+
throw Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.chooseAtLeastOneAccountType'));
|
|
122
122
|
}
|
|
123
123
|
const nameExists = this.state.checkNameExists(name);
|
|
124
124
|
if (nameExists) {
|
|
@@ -139,7 +139,7 @@ class AccountMnemonicHandler extends _Base.AccountBaseHandler {
|
|
|
139
139
|
addressDict[type] = address;
|
|
140
140
|
});
|
|
141
141
|
const exists = this.state.checkAddressExists(Object.values(addressDict));
|
|
142
|
-
(0, _util.assert)(!exists, (0, _i18next.t)('
|
|
142
|
+
(0, _util.assert)(!exists, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.accountAlreadyExistsWithName', {
|
|
143
143
|
replace: {
|
|
144
144
|
name: (exists === null || exists === void 0 ? void 0 : exists.name) || (exists === null || exists === void 0 ? void 0 : exists.address) || ''
|
|
145
145
|
}
|
|
@@ -191,7 +191,7 @@ class AccountMnemonicHandler extends _Base.AccountBaseHandler {
|
|
|
191
191
|
const isUnified = this.state.isUnifiedAccount(proxyId);
|
|
192
192
|
if (!isUnified) {
|
|
193
193
|
const pair = _uiKeyring.keyring.getPair(proxyId);
|
|
194
|
-
(0, _util.assert)(pair, (0, _i18next.t)('
|
|
194
|
+
(0, _util.assert)(pair, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.unableToFindAccount'));
|
|
195
195
|
const result = pair.exportMnemonic(password);
|
|
196
196
|
return {
|
|
197
197
|
result
|
|
@@ -206,7 +206,7 @@ class AccountMnemonicHandler extends _Base.AccountBaseHandler {
|
|
|
206
206
|
break;
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
(0, _util.assert)(pair, (0, _i18next.t)('
|
|
209
|
+
(0, _util.assert)(pair, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.unableToFindAccount'));
|
|
210
210
|
const result = pair.exportMnemonic(password) || '';
|
|
211
211
|
return {
|
|
212
212
|
result
|
|
@@ -94,7 +94,7 @@ class AccountModifyHandler extends _Base.AccountBaseHandler {
|
|
|
94
94
|
}
|
|
95
95
|
if (!accountProxies[proxyId]) {
|
|
96
96
|
const pair = _uiKeyring.keyring.getPair(proxyId);
|
|
97
|
-
(0, _util.assert)(pair, (0, _i18next.t)('
|
|
97
|
+
(0, _util.assert)(pair, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Modify.unableToFindAccount'));
|
|
98
98
|
_uiKeyring.keyring.saveAccountMeta(pair, {
|
|
99
99
|
...pair.meta,
|
|
100
100
|
name
|
|
@@ -106,7 +106,7 @@ class AccountModifyHandler extends _Base.AccountBaseHandler {
|
|
|
106
106
|
this.state.upsertAccountProxyByKey(accountProxy);
|
|
107
107
|
for (const address of addresses) {
|
|
108
108
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
109
|
-
(0, _util.assert)(pair, (0, _i18next.t)('
|
|
109
|
+
(0, _util.assert)(pair, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Modify.unableToFindAccount'));
|
|
110
110
|
_uiKeyring.keyring.saveAccountMeta(pair, {
|
|
111
111
|
...pair.meta,
|
|
112
112
|
name
|
|
@@ -245,7 +245,7 @@ class AccountModifyHandler extends _Base.AccountBaseHandler {
|
|
|
245
245
|
const pairs = _uiKeyring.keyring.getPairs();
|
|
246
246
|
const childPairs = pairs.filter(pair => pair.meta.parentAddress === oldAddress);
|
|
247
247
|
for (const childPair of childPairs) {
|
|
248
|
-
(0, _util.assert)(pair, (0, _i18next.t)('
|
|
248
|
+
(0, _util.assert)(pair, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Modify.unableToFindAccount'));
|
|
249
249
|
_uiKeyring.keyring.saveAccountMeta(childPair, {
|
|
250
250
|
...childPair.meta,
|
|
251
251
|
parentAddress: newAddress
|
|
@@ -40,14 +40,14 @@ class AccountSecretHandler extends _Base.AccountBaseHandler {
|
|
|
40
40
|
if (exists.type === type) {
|
|
41
41
|
return [{
|
|
42
42
|
code: _KoniTypes.AccountExternalErrorCode.INVALID_ADDRESS,
|
|
43
|
-
message: (0, _i18next.t)('
|
|
43
|
+
message: (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Secret.accountExists')
|
|
44
44
|
}];
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
} catch (e) {}
|
|
48
48
|
const nameExists = this.state.checkNameExists(name);
|
|
49
49
|
if (nameExists) {
|
|
50
|
-
throw Error((0, _i18next.t)('
|
|
50
|
+
throw Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Secret.accountNameAlreadyExists'));
|
|
51
51
|
}
|
|
52
52
|
const meta = {
|
|
53
53
|
name,
|
|
@@ -124,10 +124,10 @@ class AccountSecretHandler extends _Base.AccountBaseHandler {
|
|
|
124
124
|
rs.keyTypes = types;
|
|
125
125
|
} else {
|
|
126
126
|
rs.autoAddPrefix = false;
|
|
127
|
-
(0, _util.assert)(false, (0, _i18next.t)('
|
|
127
|
+
(0, _util.assert)(false, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Secret.invalidPrivateKey'));
|
|
128
128
|
}
|
|
129
129
|
const exists = this.state.checkAddressExists(Object.values(rs.addressMap));
|
|
130
|
-
(0, _util.assert)(!exists, (0, _i18next.t)('
|
|
130
|
+
(0, _util.assert)(!exists, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Secret.accountAlreadyExistsWithName', {
|
|
131
131
|
replace: {
|
|
132
132
|
name: (exists === null || exists === void 0 ? void 0 : exists.name) || (exists === null || exists === void 0 ? void 0 : exists.address) || ''
|
|
133
133
|
}
|
|
@@ -189,13 +189,13 @@ class AccountSecretHandler extends _Base.AccountBaseHandler {
|
|
|
189
189
|
success: false,
|
|
190
190
|
errors: [{
|
|
191
191
|
code: _KoniTypes.AccountExternalErrorCode.KEYRING_ERROR,
|
|
192
|
-
message: (0, _i18next.t)('
|
|
192
|
+
message: (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Secret.cannotCreateAccount')
|
|
193
193
|
}]
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
196
|
const _address = keyringPair.address;
|
|
197
197
|
const exists = this.state.checkAddressExists([_address]);
|
|
198
|
-
(0, _util.assert)(!exists, (0, _i18next.t)('
|
|
198
|
+
(0, _util.assert)(!exists, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Secret.accountAlreadyExistsWithName', {
|
|
199
199
|
replace: {
|
|
200
200
|
name: (exists === null || exists === void 0 ? void 0 : exists.name) || (exists === null || exists === void 0 ? void 0 : exists.address) || ''
|
|
201
201
|
}
|
|
@@ -284,7 +284,7 @@ class AccountSecretHandler extends _Base.AccountBaseHandler {
|
|
|
284
284
|
if (response.isValid) {
|
|
285
285
|
const exists = this.state.checkAddressExists([response.address]);
|
|
286
286
|
if (exists) {
|
|
287
|
-
response.errorMessage = (0, _i18next.t)('
|
|
287
|
+
response.errorMessage = (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Secret.accountAlreadyExistsWithName', {
|
|
288
288
|
replace: {
|
|
289
289
|
name: (exists === null || exists === void 0 ? void 0 : exists.name) || (exists === null || exists === void 0 ? void 0 : exists.address) || ''
|
|
290
290
|
}
|
|
@@ -12,7 +12,7 @@ var _Base = _interopRequireDefault(require("@subwallet/extension-base/services/m
|
|
|
12
12
|
class DeleteEarningData extends _Base.default {
|
|
13
13
|
async run() {
|
|
14
14
|
try {
|
|
15
|
-
await this.state.dbService.deleteYieldPoolInfo(['
|
|
15
|
+
await this.state.dbService.deleteYieldPoolInfo(['KILT___native_staking___kilt', 'PILT___native_staking___kilt_peregrine']);
|
|
16
16
|
} catch (e) {
|
|
17
17
|
console.error(e);
|
|
18
18
|
}
|
|
@@ -14,12 +14,7 @@ class MigrateTransactionHistoryBySymbol extends _Base.default {
|
|
|
14
14
|
const state = this.state;
|
|
15
15
|
try {
|
|
16
16
|
const changeSlugsMap = {
|
|
17
|
-
'
|
|
18
|
-
'energy_web_x_rococo-NATIVE-VT': 'energy_web_x_rococo-NATIVE-EWT',
|
|
19
|
-
'chainflip_dot-NATIVE-DOT': 'chainflip_dot-NATIVE-Unit',
|
|
20
|
-
'autonomys_taurus-NATIVE-AI3': 'autonomys_taurus-NATIVE-tAI3',
|
|
21
|
-
'fraxtal-NATIVE-frxETH': 'fraxtal-ERC20-frxETH-0xFC00000000000000000000000000000000000006',
|
|
22
|
-
'arbitrum_one-ERC20-USDT-0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9': 'arbitrum_one-ERC20-USD₮0-0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9'
|
|
17
|
+
'polygon-ERC20-USDT-0xc2132D05D31c914a87C6611C10748AEb04B58e8F': 'polygon-ERC20-USD₮0-0xc2132D05D31c914a87C6611C10748AEb04B58e8F'
|
|
23
18
|
};
|
|
24
19
|
const allTxs = [];
|
|
25
20
|
await Promise.all(Object.entries(changeSlugsMap).map(async (_ref, i) => {
|
|
@@ -13,12 +13,7 @@ class MigrateAssetSetting extends _Base.default {
|
|
|
13
13
|
async run() {
|
|
14
14
|
try {
|
|
15
15
|
const changeSlugsMap = {
|
|
16
|
-
'
|
|
17
|
-
'energy_web_x_rococo-NATIVE-VT': 'energy_web_x_rococo-NATIVE-EWT',
|
|
18
|
-
'chainflip_dot-NATIVE-DOT': 'chainflip_dot-NATIVE-Unit',
|
|
19
|
-
'autonomys_taurus-NATIVE-AI3': 'autonomys_taurus-NATIVE-tAI3',
|
|
20
|
-
'fraxtal-NATIVE-frxETH': 'fraxtal-ERC20-frxETH-0xFC00000000000000000000000000000000000006',
|
|
21
|
-
'arbitrum_one-ERC20-USDT-0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9': 'arbitrum_one-ERC20-USD₮0-0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9'
|
|
16
|
+
'polygon-ERC20-USDT-0xc2132D05D31c914a87C6611C10748AEb04B58e8F': 'polygon-ERC20-USD₮0-0xc2132D05D31c914a87C6611C10748AEb04B58e8F'
|
|
22
17
|
};
|
|
23
18
|
const assetSetting = await this.state.chainService.getAssetSettings();
|
|
24
19
|
const migratedAssetSetting = {};
|
|
@@ -54,7 +54,7 @@ var _default = {
|
|
|
54
54
|
'1.1.7': _DeleteChain.default,
|
|
55
55
|
'1.1.13-01': _MigrateTokenDecimals.default,
|
|
56
56
|
// '1.1.13-02-2': EnableEarningChains,
|
|
57
|
-
'1.
|
|
57
|
+
'1.3.55-03': _DeleteEarningData.default,
|
|
58
58
|
'1.1.17-01': _MigratePioneerProvider.default,
|
|
59
59
|
'1.1.17-03': _EnableVaraChain.default,
|
|
60
60
|
'1.1.24-01': _MigrateProvidersV1M1P.default,
|
|
@@ -63,8 +63,8 @@ var _default = {
|
|
|
63
63
|
'1.1.33-01': _MigrateLedgerAccountV.default,
|
|
64
64
|
'1.1.41-01': _DeleteChainStaking.default,
|
|
65
65
|
// '1.1.46-01': AutoEnableSomeTokens,
|
|
66
|
-
'1.3.
|
|
67
|
-
'1.3.
|
|
66
|
+
'1.3.55-01': _MigrateAssetSetting.default,
|
|
67
|
+
'1.3.55-02': _MigrateTransactionHistoryBySymbol.default,
|
|
68
68
|
'1.2.69-01': _MigrateRemoveGenesisHash.default,
|
|
69
69
|
'1.2.13-01': _ReloadMetadata.default,
|
|
70
70
|
'1.2.32-01': _MigratePairData.default,
|
|
@@ -375,7 +375,7 @@ class BitcoinRequestHandler {
|
|
|
375
375
|
} = this.confirmationsPromiseMap[id];
|
|
376
376
|
const confirmation = confirmations[type][id];
|
|
377
377
|
if (!resolver || !confirmation) {
|
|
378
|
-
this.#logger.error((0, _i18next.t)('
|
|
378
|
+
this.#logger.error((0, _i18next.t)('bg.DAPP.services.service.request.BitcoinHandler.unableToProceed'), type, id);
|
|
379
379
|
throw new Error('Unable to proceed. Please try again');
|
|
380
380
|
}
|
|
381
381
|
if (isApproved) {
|
|
@@ -95,8 +95,8 @@ class CardanoRequestHandler {
|
|
|
95
95
|
} = this.confirmationsPromiseMap[id];
|
|
96
96
|
const confirmation = confirmations[type][id];
|
|
97
97
|
if (!resolver || !confirmation) {
|
|
98
|
-
this.#logger.error((0, _i18next.t)('
|
|
99
|
-
throw new Error((0, _i18next.t)('
|
|
98
|
+
this.#logger.error((0, _i18next.t)('bg.DAPP.services.service.request.CardanoHandler.unableToProceed'), type, id);
|
|
99
|
+
throw new Error((0, _i18next.t)('bg.DAPP.services.service.request.CardanoHandler.unableToProceed'));
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// Fill signature for some special type
|