@subwallet/extension-base 1.3.54-1 → 1.3.55-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/background/errors/BalanceError.js +4 -4
  2. package/background/errors/BitcoinProviderError.js +7 -7
  3. package/background/errors/EvmProviderError.js +8 -8
  4. package/background/errors/ProviderError.js +6 -5
  5. package/background/errors/SwapError.js +14 -13
  6. package/background/errors/TransactionError.js +22 -22
  7. package/background/warnings/TransactionWarning.js +2 -2
  8. package/cjs/background/errors/BalanceError.js +4 -4
  9. package/cjs/background/errors/BitcoinProviderError.js +7 -7
  10. package/cjs/background/errors/EvmProviderError.js +8 -8
  11. package/cjs/background/errors/ProviderError.js +6 -5
  12. package/cjs/background/errors/SwapError.js +14 -13
  13. package/cjs/background/errors/TransactionError.js +22 -22
  14. package/cjs/background/warnings/TransactionWarning.js +2 -2
  15. package/cjs/core/logic-validation/index.js +15 -3
  16. package/cjs/core/logic-validation/request.js +37 -37
  17. package/cjs/core/logic-validation/transfer.js +21 -17
  18. package/cjs/koni/api/dotsama/parseTransaction.js +1 -1
  19. package/cjs/koni/api/staking/bonding/relayChain.js +1 -1
  20. package/cjs/koni/api/staking/bonding/utils.js +16 -16
  21. package/cjs/koni/api/staking/paraChain.js +1 -1
  22. package/cjs/koni/background/handlers/Extension.js +28 -26
  23. package/cjs/koni/background/handlers/State.js +19 -14
  24. package/cjs/koni/background/handlers/Tabs.js +23 -1
  25. package/cjs/packageInfo.js +1 -1
  26. package/cjs/services/balance-service/index.js +3 -3
  27. package/cjs/services/balance-service/transfer/smart-contract.js +1 -1
  28. package/cjs/services/balance-service/transfer/xcm/index.js +7 -1
  29. package/cjs/services/balance-service/transfer/xcm/utils.js +24 -18
  30. package/cjs/services/chain-service/constants.js +2 -2
  31. package/cjs/services/chain-service/handler/types.js +1 -0
  32. package/cjs/services/chain-service/utils/patch.js +1 -1
  33. package/cjs/services/earning-service/constants/chains.js +1 -2
  34. package/cjs/services/earning-service/handlers/base.js +2 -1
  35. package/cjs/services/earning-service/handlers/lending/base.js +3 -3
  36. package/cjs/services/earning-service/handlers/liquid-staking/base.js +3 -3
  37. package/cjs/services/earning-service/handlers/native-staking/amplitude.js +1 -1
  38. package/cjs/services/earning-service/handlers/native-staking/base-para.js +1 -1
  39. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +2 -2
  40. package/cjs/services/earning-service/handlers/native-staking/tao.js +26 -6
  41. package/cjs/services/earning-service/handlers/nomination-pool/index.js +2 -2
  42. package/cjs/services/earning-service/handlers/special.js +12 -9
  43. package/cjs/services/keyring-service/context/handlers/Derive.js +1 -1
  44. package/cjs/services/keyring-service/context/handlers/Json.js +11 -11
  45. package/cjs/services/keyring-service/context/handlers/Ledger.js +3 -3
  46. package/cjs/services/keyring-service/context/handlers/Mnemonic.js +10 -10
  47. package/cjs/services/keyring-service/context/handlers/Modify.js +3 -3
  48. package/cjs/services/keyring-service/context/handlers/Secret.js +7 -7
  49. package/cjs/services/migration-service/scripts/DeleteEarningData.js +1 -1
  50. package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +1 -6
  51. package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting.js +1 -6
  52. package/cjs/services/migration-service/scripts/index.js +3 -3
  53. package/cjs/services/request-service/handler/BitcoinRequestHandler.js +1 -1
  54. package/cjs/services/request-service/handler/CardanoRequestHandler.js +2 -2
  55. package/cjs/services/request-service/handler/EvmRequestHandler.js +5 -5
  56. package/cjs/services/request-service/handler/TonRequestHandler.js +2 -2
  57. package/cjs/services/setting-service/i18n/extend.js +1 -1
  58. package/cjs/services/swap-service/handler/base-handler.js +123 -11
  59. package/cjs/services/swap-service/index.js +1 -1
  60. package/cjs/services/transaction-service/index.js +12 -12
  61. package/cjs/services/transaction-service/utils.js +4 -1
  62. package/cjs/types/account/error/common.js +5 -4
  63. package/cjs/types/account/error/derive.js +8 -7
  64. package/cjs/utils/account/derive/info/solo.js +2 -2
  65. package/cjs/utils/eth/parseTransaction/index.js +1 -1
  66. package/cjs/utils/fee/transfer.js +8 -3
  67. package/cjs/utils/index.js +1 -1
  68. package/core/logic-validation/index.js +15 -3
  69. package/core/logic-validation/request.js +37 -37
  70. package/core/logic-validation/transfer.js +21 -17
  71. package/koni/api/dotsama/parseTransaction.js +1 -1
  72. package/koni/api/staking/bonding/relayChain.js +1 -1
  73. package/koni/api/staking/bonding/utils.js +16 -16
  74. package/koni/api/staking/paraChain.js +1 -1
  75. package/koni/background/handlers/Extension.js +28 -26
  76. package/koni/background/handlers/State.d.ts +1 -0
  77. package/koni/background/handlers/State.js +19 -14
  78. package/koni/background/handlers/Tabs.js +23 -1
  79. package/package.json +6 -6
  80. package/packageInfo.js +1 -1
  81. package/services/balance-service/index.js +3 -3
  82. package/services/balance-service/transfer/smart-contract.js +1 -1
  83. package/services/balance-service/transfer/xcm/index.js +7 -1
  84. package/services/balance-service/transfer/xcm/utils.d.ts +6 -0
  85. package/services/balance-service/transfer/xcm/utils.js +24 -18
  86. package/services/chain-service/constants.js +2 -2
  87. package/services/chain-service/handler/types.d.ts +2 -1
  88. package/services/chain-service/handler/types.js +1 -0
  89. package/services/chain-service/utils/patch.d.ts +1 -1
  90. package/services/chain-service/utils/patch.js +1 -1
  91. package/services/earning-service/constants/chains.d.ts +0 -1
  92. package/services/earning-service/constants/chains.js +1 -2
  93. package/services/earning-service/handlers/base.js +3 -2
  94. package/services/earning-service/handlers/lending/base.js +3 -3
  95. package/services/earning-service/handlers/liquid-staking/base.js +3 -3
  96. package/services/earning-service/handlers/native-staking/amplitude.js +1 -1
  97. package/services/earning-service/handlers/native-staking/base-para.js +1 -1
  98. package/services/earning-service/handlers/native-staking/relay-chain.js +2 -2
  99. package/services/earning-service/handlers/native-staking/tao.js +26 -6
  100. package/services/earning-service/handlers/nomination-pool/index.js +2 -2
  101. package/services/earning-service/handlers/special.js +12 -9
  102. package/services/keyring-service/context/handlers/Derive.js +1 -1
  103. package/services/keyring-service/context/handlers/Json.js +11 -11
  104. package/services/keyring-service/context/handlers/Ledger.js +3 -3
  105. package/services/keyring-service/context/handlers/Mnemonic.js +10 -10
  106. package/services/keyring-service/context/handlers/Modify.js +3 -3
  107. package/services/keyring-service/context/handlers/Secret.js +7 -7
  108. package/services/migration-service/scripts/DeleteEarningData.js +1 -1
  109. package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +1 -6
  110. package/services/migration-service/scripts/databases/MigrateAssetSetting.js +1 -6
  111. package/services/migration-service/scripts/index.js +3 -3
  112. package/services/request-service/handler/BitcoinRequestHandler.js +1 -1
  113. package/services/request-service/handler/CardanoRequestHandler.js +2 -2
  114. package/services/request-service/handler/EvmRequestHandler.js +5 -5
  115. package/services/request-service/handler/TonRequestHandler.js +2 -2
  116. package/services/setting-service/i18n/extend.js +1 -1
  117. package/services/swap-service/handler/base-handler.d.ts +2 -1
  118. package/services/swap-service/handler/base-handler.js +124 -12
  119. package/services/swap-service/index.js +1 -1
  120. package/services/transaction-service/index.js +12 -12
  121. package/services/transaction-service/utils.js +4 -1
  122. package/types/account/error/common.js +5 -4
  123. package/types/account/error/derive.js +8 -7
  124. package/types/balance/transfer.d.ts +1 -0
  125. package/utils/account/derive/info/solo.js +2 -2
  126. package/utils/eth/parseTransaction/index.js +1 -1
  127. package/utils/fee/transfer.d.ts +3 -1
  128. package/utils/fee/transfer.js +5 -1
  129. package/utils/index.js +1 -1
@@ -45,7 +45,7 @@ export default {
45
45
  '1.1.7': DeleteChain,
46
46
  '1.1.13-01': MigrateTokenDecimals,
47
47
  // '1.1.13-02-2': EnableEarningChains,
48
- '1.1.13-03': DeleteEarningData,
48
+ '1.3.55-03': DeleteEarningData,
49
49
  '1.1.17-01': MigratePioneerProvider,
50
50
  '1.1.17-03': EnableVaraChain,
51
51
  '1.1.24-01': MigrateProvidersV1M1P24,
@@ -54,8 +54,8 @@ export default {
54
54
  '1.1.33-01': MigrateLedgerAccountV2,
55
55
  '1.1.41-01': DeleteChainStaking,
56
56
  // '1.1.46-01': AutoEnableSomeTokens,
57
- '1.3.53-01': MigrateAssetSetting,
58
- '1.3.53-02': MigrateTransactionHistoryBySymbol,
57
+ '1.3.55-01': MigrateAssetSetting,
58
+ '1.3.55-02': MigrateTransactionHistoryBySymbol,
59
59
  '1.2.69-01': MigrateRemoveGenesisHash,
60
60
  '1.2.13-01': ReloadMetadata,
61
61
  '1.2.32-01': MigratePairData,
@@ -363,7 +363,7 @@ export default class BitcoinRequestHandler {
363
363
  } = this.confirmationsPromiseMap[id];
364
364
  const confirmation = confirmations[type][id];
365
365
  if (!resolver || !confirmation) {
366
- this.#logger.error(t('Unable to proceed. Please try again'), type, id);
366
+ this.#logger.error(t('bg.DAPP.services.service.request.BitcoinHandler.unableToProceed'), type, id);
367
367
  throw new Error('Unable to proceed. Please try again');
368
368
  }
369
369
  if (isApproved) {
@@ -87,8 +87,8 @@ export default class CardanoRequestHandler {
87
87
  } = this.confirmationsPromiseMap[id];
88
88
  const confirmation = confirmations[type][id];
89
89
  if (!resolver || !confirmation) {
90
- this.#logger.error(t('Unable to proceed. Please try again'), type, id);
91
- throw new Error(t('Unable to proceed. Please try again'));
90
+ this.#logger.error(t('bg.DAPP.services.service.request.CardanoHandler.unableToProceed'), type, id);
91
+ throw new Error(t('bg.DAPP.services.service.request.CardanoHandler.unableToProceed'));
92
92
  }
93
93
 
94
94
  // Fill signature for some special type
@@ -55,7 +55,7 @@ export default class EvmRequestHandler {
55
55
  // Check duplicate request
56
56
  const duplicated = Object.values(confirmationType).find(c => c.url === url && c.payloadJson === payloadJson);
57
57
  if (duplicated) {
58
- throw new EvmProviderError(EvmProviderErrorType.INVALID_PARAMS, t('Duplicate request'));
58
+ throw new EvmProviderError(EvmProviderErrorType.INVALID_PARAMS, t('bg.DAPP.services.service.request.EvmHandler.duplicateRequest'));
59
59
  }
60
60
  confirmationType[id] = {
61
61
  id,
@@ -98,7 +98,7 @@ export default class EvmRequestHandler {
98
98
  // Check duplicate request
99
99
  const exists = confirmationType[id];
100
100
  if (!exists) {
101
- throw new EvmProviderError(EvmProviderErrorType.INVALID_PARAMS, t('Request does not exist'));
101
+ throw new EvmProviderError(EvmProviderErrorType.INVALID_PARAMS, t('bg.DAPP.services.service.request.EvmHandler.requestDoesNotExist'));
102
102
  }
103
103
  const payloadJson = JSON.stringify(payload);
104
104
  confirmationType[id] = {
@@ -131,7 +131,7 @@ export default class EvmRequestHandler {
131
131
  case 'eth_signTypedData_v4':
132
132
  return await pair.evm.signMessage(payload, type);
133
133
  default:
134
- throw new EvmProviderError(EvmProviderErrorType.INVALID_PARAMS, t('Unsupported action'));
134
+ throw new EvmProviderError(EvmProviderErrorType.INVALID_PARAMS, t('bg.DAPP.services.service.request.EvmHandler.unsupportedAction'));
135
135
  }
136
136
  }
137
137
  configToTransaction(config) {
@@ -240,8 +240,8 @@ export default class EvmRequestHandler {
240
240
  } = this.confirmationsPromiseMap[id];
241
241
  const confirmation = confirmations[type][id];
242
242
  if (!resolver || !confirmation) {
243
- this.#logger.error(t('Unable to proceed. Please try again'), type, id);
244
- throw new Error(t('Unable to proceed. Please try again'));
243
+ this.#logger.error(t('bg.DAPP.services.service.request.EvmHandler.unableToProceed'), type, id);
244
+ throw new Error(t('bg.DAPP.services.service.request.EvmHandler.unableToProceed'));
245
245
  }
246
246
 
247
247
  // Fill signature for some special type
@@ -89,8 +89,8 @@ export default class TonRequestHandler {
89
89
  } = this.confirmationsPromiseMap[id];
90
90
  const confirmation = confirmations[type][id];
91
91
  if (!resolver || !confirmation) {
92
- this.#logger.error(t('Unable to proceed. Please try again'), type, id);
93
- throw new Error(t('Unable to proceed. Please try again'));
92
+ this.#logger.error(t('bg.DAPP.services.service.request.TonHandler.unableToProceed'), type, id);
93
+ throw new Error(t('bg.DAPP.services.service.request.TonHandler.unableToProceed'));
94
94
  }
95
95
 
96
96
  // Fill signature for some special type
@@ -4,5 +4,5 @@
4
4
  import { detectTranslate } from '@subwallet/extension-base/utils';
5
5
  export const ExternalTranslation = [
6
6
  // Case change password
7
- detectTranslate('Invalid master password')];
7
+ detectTranslate('bg.SETTING.services.service.setting.i18nExtend.invalidMasterPassword')];
8
8
  export const InternalTranslation = [];
@@ -15,7 +15,7 @@ export interface SwapBaseInterface {
15
15
  isReady?: boolean;
16
16
  init?: () => Promise<void>;
17
17
  }
18
- export interface SwapBaseHandlerInitParams {
18
+ interface SwapBaseHandlerInitParams {
19
19
  providerSlug: SwapProviderId;
20
20
  providerName: string;
21
21
  chainService: ChainService;
@@ -45,3 +45,4 @@ export declare class SwapBaseHandler {
45
45
  get slug(): string;
46
46
  get providerInfo(): SwapProvider;
47
47
  }
48
+ export {};
@@ -7,7 +7,7 @@ import { validateSpendingAndFeePayment } from '@subwallet/extension-base/core/lo
7
7
  import { _isAccountActive } from '@subwallet/extension-base/core/substrate/system-pallet';
8
8
  import { _isAcrossBridgeXcm, _isSnowBridgeXcm, _isXcmWithinSameConsensus } from '@subwallet/extension-base/core/substrate/xcm-parser';
9
9
  import { _isSufficientToken } from '@subwallet/extension-base/core/utils';
10
- import { createXcmExtrinsicV2 } from '@subwallet/extension-base/services/balance-service/transfer/xcm';
10
+ import { createXcmExtrinsicV2, dryRunXcmExtrinsicV2 } from '@subwallet/extension-base/services/balance-service/transfer/xcm';
11
11
  import { _isAcrossChainBridge, AcrossErrorMsg } from '@subwallet/extension-base/services/balance-service/transfer/xcm/acrossBridge';
12
12
  import { estimateXcmFee } from '@subwallet/extension-base/services/balance-service/transfer/xcm/utils';
13
13
  import { _getAssetDecimals, _getAssetOriginChain, _getAssetSymbol, _getChainNativeTokenSlug, _getTokenMinAmount, _isChainEvmCompatible, _isNativeToken, _isPureBitcoinChain } from '@subwallet/extension-base/services/chain-service/utils';
@@ -310,7 +310,23 @@ export class SwapBaseHandler {
310
310
  }
311
311
  return [];
312
312
  }
313
- async validateBridgeStep(receiver, fromToken, toToken, selectedFeeToken, toChainNativeToken, bnBridgeAmount, bnFromTokenBalance, bnBridgeFeeAmount, bnFeeTokenBalance, bnBridgeDeliveryFee) {
313
+ async validateBridgeStep(request) {
314
+ const {
315
+ bnBridgeAmount,
316
+ bnBridgeDeliveryFee,
317
+ bnBridgeFeeAmount,
318
+ bnFeeTokenBalance,
319
+ bnFromTokenBalance,
320
+ fromChain,
321
+ fromToken,
322
+ isFirstBridge,
323
+ receiver,
324
+ selectedFeeToken,
325
+ sender,
326
+ toChain,
327
+ toChainNativeToken,
328
+ toToken
329
+ } = request;
314
330
  const minBridgeAmountRequired = new BigN(_getTokenMinAmount(toToken)).multipliedBy(FEE_RATE_MULTIPLIER.high);
315
331
  const spendingAndFeePaymentValidation = validateSpendingAndFeePayment(fromToken, selectedFeeToken, bnBridgeAmount, bnFromTokenBalance, bnBridgeFeeAmount, bnFeeTokenBalance);
316
332
  if (spendingAndFeePaymentValidation.length > 0) {
@@ -320,7 +336,7 @@ export class SwapBaseHandler {
320
336
  const atLeastStr = formatNumber(minBridgeAmountRequired.plus(bnBridgeDeliveryFee), _getAssetDecimals(toToken), balanceFormatter, {
321
337
  maxNumberFormat: _getAssetDecimals(toToken) || 6
322
338
  });
323
- return [new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('You must transfer at least {{amount}} {{symbol}} to keep the destination account alive', {
339
+ return [new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('bg.SWAP.services.service.swap.baseHandler.transferMinimumToKeepDestAlive', {
324
340
  replace: {
325
341
  amount: atLeastStr,
326
342
  symbol: fromToken.symbol
@@ -342,7 +358,7 @@ export class SwapBaseHandler {
342
358
  // sending token cannot keep account alive, must check with native token
343
359
  const toChainNativeTokenBalance = await this.balanceService.getTotalBalance(receiver, toToken.originChain, toChainNativeToken.slug, ExtrinsicType.TRANSFER_BALANCE);
344
360
  if (!_isAccountActive(toChainNativeTokenBalance.metadata)) {
345
- return [new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('The recipient account has less than {{amount}} {{nativeSymbol}}, which can lead to your {{localSymbol}} being lost. Change recipient account and try again', {
361
+ return [new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('bg.SWAP.services.service.swap.baseHandler.recipientBalanceTooLow', {
346
362
  replace: {
347
363
  amount: toChainNativeTokenBalance.value,
348
364
  nativeSymbol: toChainNativeToken.symbol,
@@ -351,6 +367,27 @@ export class SwapBaseHandler {
351
367
  }))];
352
368
  }
353
369
  }
370
+
371
+ // dry-run xcm
372
+ const substrateApi = await this.chainService.getSubstrateApi(fromToken.originChain).isReady;
373
+ const feeInfo = await this.feeService.subscribeChainFee(getId(), fromToken.originChain, 'substrate');
374
+ const xcmRequest = {
375
+ originTokenInfo: fromToken,
376
+ destinationTokenInfo: toToken,
377
+ sendingValue: bnBridgeAmount.toString(),
378
+ recipient: receiver,
379
+ substrateApi: substrateApi,
380
+ sender: sender,
381
+ destinationChain: toChain,
382
+ originChain: fromChain,
383
+ feeInfo
384
+ };
385
+ const isDryRunSuccess = await dryRunXcmExtrinsicV2(xcmRequest);
386
+
387
+ // temp skip dry-run for later step todo: wait for dry-run-predict
388
+ if (isFirstBridge && !isDryRunSuccess) {
389
+ return [new TransactionError(BasicTxErrorType.UNABLE_TO_SEND, 'Unable to perform transaction. Select another token or destination chain and try again')];
390
+ }
354
391
  }
355
392
  return [];
356
393
  }
@@ -363,7 +400,7 @@ export class SwapBaseHandler {
363
400
  const atLeastStr = formatNumber(_getTokenMinAmount(receivingToken), _getAssetDecimals(receivingToken), balanceFormatter, {
364
401
  maxNumberFormat: _getAssetDecimals(receivingToken) || 6
365
402
  });
366
- return [new TransactionError(SwapErrorType.NOT_MEET_MIN_SWAP, t('You can\'t receive less than {{number}} {{symbol}}', {
403
+ return [new TransactionError(SwapErrorType.NOT_MEET_MIN_SWAP, t('bg.SWAP.services.service.swap.baseHandler.receiveMinimumAmount', {
367
404
  replace: {
368
405
  number: atLeastStr,
369
406
  symbol: _getAssetSymbol(receivingToken)
@@ -449,7 +486,22 @@ export class SwapBaseHandler {
449
486
  // Native token balance has already accounted for ED aka strict mode
450
487
  const bnBridgeFromTokenBalance = new BigN(bridgeFromTokenBalance.value);
451
488
  const bnBridgeFeeTokenBalance = new BigN(bridgeFeeTokenBalance.value);
452
- const bridgeStepValidation = await this.validateBridgeStep(bridgeReceiver, bridgeFromToken, bridgeToToken, bridgeSelectedFeeToken, bridgeToChainNativeToken, bnBridgeAmount, bnBridgeFromTokenBalance, bnBridgeFeeAmount, bnBridgeFeeTokenBalance, bnBridgeDeliveryFee);
489
+ const bridgeStepValidation = await this.validateBridgeStep({
490
+ fromChain,
491
+ toChain,
492
+ sender: bridgeSender,
493
+ receiver: bridgeReceiver,
494
+ fromToken: bridgeFromToken,
495
+ toToken: bridgeToToken,
496
+ selectedFeeToken: bridgeSelectedFeeToken,
497
+ toChainNativeToken: bridgeToChainNativeToken,
498
+ bnBridgeAmount,
499
+ bnFromTokenBalance: bnBridgeFromTokenBalance,
500
+ bnBridgeFeeAmount,
501
+ bnFeeTokenBalance: bnBridgeFeeTokenBalance,
502
+ bnBridgeDeliveryFee,
503
+ isFirstBridge: true
504
+ });
453
505
  if (bridgeStepValidation.length > 0) {
454
506
  return bridgeStepValidation;
455
507
  }
@@ -491,7 +543,12 @@ export class SwapBaseHandler {
491
543
  const atLeastString = formatNumber(_getTokenMinAmount(swapToken), _getAssetDecimals(swapToken), balanceFormatter, {
492
544
  maxNumberFormat: _getAssetDecimals(swapToken) || 6
493
545
  });
494
- return [new TransactionError(SwapErrorType.NOT_MEET_MIN_SWAP, t(`Swap amount too small. Increase to more than ${atLeastString} ${_getAssetSymbol(swapToken)} and try again`))];
546
+ return [new TransactionError(SwapErrorType.NOT_MEET_MIN_SWAP, t('bg.SWAP.services.service.swap.baseHandler.swapAmountTooSmall', {
547
+ replace: {
548
+ amount: atLeastString,
549
+ symbol: _getAssetSymbol(swapToken)
550
+ }
551
+ }))];
495
552
  }
496
553
  const swapFeeToken = this.chainService.getAssetBySlug(swapFee.selectedFeeToken || swapFee.defaultFeeToken);
497
554
  const swapToChain = this.chainService.getChainInfoByKey(swapMetadata.destinationTokenInfo.originChain);
@@ -534,7 +591,12 @@ export class SwapBaseHandler {
534
591
  const atLeastString = formatNumber(_getTokenMinAmount(swapToken), _getAssetDecimals(swapToken), balanceFormatter, {
535
592
  maxNumberFormat: _getAssetDecimals(swapToken) || 6
536
593
  });
537
- return [new TransactionError(SwapErrorType.NOT_MEET_MIN_SWAP, t(`Swap amount too small. Increase to more than ${atLeastString} ${_getAssetSymbol(swapToken)} and try again`))];
594
+ return [new TransactionError(SwapErrorType.NOT_MEET_MIN_SWAP, t('bg.SWAP.services.service.swap.baseHandler.swapAmountTooSmall', {
595
+ replace: {
596
+ amount: atLeastString,
597
+ symbol: _getAssetSymbol(swapToken)
598
+ }
599
+ }))];
538
600
  }
539
601
  const swapFeeToken = this.chainService.getAssetBySlug(swapFee.selectedFeeToken || swapFee.defaultFeeToken);
540
602
  const swapToChain = this.chainService.getChainInfoByKey(swapMetadata.destinationTokenInfo.originChain);
@@ -580,7 +642,22 @@ export class SwapBaseHandler {
580
642
  // Native token balance has already accounted for ED aka strict mode
581
643
  const bnBridgeFromTokenBalance = new BigN(bridgeFromTokenBalance.value).plus(bnSwapReceivingAmount);
582
644
  const bnBridgeFeeTokenBalance = new BigN(bridgeFeeTokenBalance.value);
583
- const bridgeStepValidation = await this.validateBridgeStep(bridgeReceiver, bridgeFromToken, bridgeToToken, bridgeSelectedFeeToken, bridgeToChainNativeToken, bnBridgeAmount, bnBridgeFromTokenBalance, bnBridgeFeeAmount, bnBridgeFeeTokenBalance, bnBridgeDeliveryFee);
645
+ const bridgeStepValidation = await this.validateBridgeStep({
646
+ fromChain,
647
+ toChain,
648
+ sender: bridgeSender,
649
+ receiver: bridgeReceiver,
650
+ fromToken: bridgeFromToken,
651
+ toToken: bridgeToToken,
652
+ selectedFeeToken: bridgeSelectedFeeToken,
653
+ toChainNativeToken: bridgeToChainNativeToken,
654
+ bnBridgeAmount,
655
+ bnFromTokenBalance: bnBridgeFromTokenBalance,
656
+ bnBridgeFeeAmount,
657
+ bnFeeTokenBalance: bnBridgeFeeTokenBalance,
658
+ bnBridgeDeliveryFee,
659
+ isFirstBridge: false
660
+ });
584
661
  if (bridgeStepValidation.length > 0) {
585
662
  return bridgeStepValidation;
586
663
  }
@@ -619,7 +696,22 @@ export class SwapBaseHandler {
619
696
  // Native token balance has already accounted for ED aka strict mode
620
697
  const bnBridgeFromTokenBalance = new BigN(bridgeFromTokenBalance.value);
621
698
  const bnBridgeFeeTokenBalance = new BigN(bridgeFeeTokenBalance.value);
622
- const bridgeStepValidation = await this.validateBridgeStep(bridgeReceiver, bridgeFromToken, bridgeToToken, bridgeSelectedFeeToken, bridgeToChainNativeToken, bnBridgeAmount, bnBridgeFromTokenBalance, bnBridgeFeeAmount, bnBridgeFeeTokenBalance, bnBridgeDeliveryFee);
699
+ const bridgeStepValidation = await this.validateBridgeStep({
700
+ fromChain,
701
+ toChain,
702
+ sender: bridgeSender,
703
+ receiver: bridgeReceiver,
704
+ fromToken: bridgeFromToken,
705
+ toToken: bridgeToToken,
706
+ selectedFeeToken: bridgeSelectedFeeToken,
707
+ toChainNativeToken: bridgeToChainNativeToken,
708
+ bnBridgeAmount,
709
+ bnFromTokenBalance: bnBridgeFromTokenBalance,
710
+ bnBridgeFeeAmount,
711
+ bnFeeTokenBalance: bnBridgeFeeTokenBalance,
712
+ bnBridgeDeliveryFee,
713
+ isFirstBridge: true
714
+ });
623
715
  if (bridgeStepValidation.length > 0) {
624
716
  return bridgeStepValidation;
625
717
  }
@@ -661,7 +753,12 @@ export class SwapBaseHandler {
661
753
  const atLeastString = formatNumber(_getTokenMinAmount(swapToken), _getAssetDecimals(swapToken), balanceFormatter, {
662
754
  maxNumberFormat: _getAssetDecimals(swapToken) || 6
663
755
  });
664
- return [new TransactionError(SwapErrorType.NOT_MEET_MIN_SWAP, t(`Swap amount too small. Increase to more than ${atLeastString} ${_getAssetSymbol(swapToken)} and try again`))];
756
+ return [new TransactionError(SwapErrorType.NOT_MEET_MIN_SWAP, t('bg.SWAP.services.service.swap.baseHandler.swapAmountTooSmall', {
757
+ replace: {
758
+ amount: atLeastString,
759
+ symbol: _getAssetSymbol(swapToken)
760
+ }
761
+ }))];
665
762
  }
666
763
  const swapFeeToken = this.chainService.getAssetBySlug(swapFee.selectedFeeToken || swapFee.defaultFeeToken);
667
764
  const swapToChain = this.chainService.getChainInfoByKey(swapMetadata.destinationTokenInfo.originChain);
@@ -707,7 +804,22 @@ export class SwapBaseHandler {
707
804
  // Native token balance has already accounted for ED aka strict mode
708
805
  const bnTransitFromTokenBalance = new BigN(transitFromTokenBalance.value).plus(bnSwapReceivingAmount);
709
806
  const bnTransitFeeTokenBalance = new BigN(transitFeeTokenBalance.value);
710
- const transitStepValidation = await this.validateBridgeStep(transitReceiver, transitFromToken, transitToToken, transitSelectedFeeToken, transitToChainNativeToken, bnTransitAmount, bnTransitFromTokenBalance, bnTransitFeeAmount, bnTransitFeeTokenBalance, bnTransitDeliveryFee);
807
+ const transitStepValidation = await this.validateBridgeStep({
808
+ fromChain: fromTransitChain,
809
+ toChain: toTransitChain,
810
+ sender: transitSender,
811
+ receiver: transitReceiver,
812
+ fromToken: transitFromToken,
813
+ toToken: transitToToken,
814
+ selectedFeeToken: transitSelectedFeeToken,
815
+ toChainNativeToken: transitToChainNativeToken,
816
+ bnBridgeAmount: bnTransitAmount,
817
+ bnFromTokenBalance: bnTransitFromTokenBalance,
818
+ bnBridgeFeeAmount: bnTransitFeeAmount,
819
+ bnFeeTokenBalance: bnTransitFeeTokenBalance,
820
+ bnBridgeDeliveryFee: bnTransitDeliveryFee,
821
+ isFirstBridge: false
822
+ });
711
823
  if (transitStepValidation.length > 0) {
712
824
  return transitStepValidation;
713
825
  }
@@ -478,7 +478,7 @@ export class SwapService {
478
478
  blockedActionsMap
479
479
  } = blockedActionsFeaturesMap;
480
480
  if (blockedActionsMap.swap.includes(currentAction)) {
481
- return [new TransactionError(BasicTxErrorType.UNSUPPORTED, t('Feature under maintenance. Try again later'))];
481
+ return [new TransactionError(BasicTxErrorType.UNSUPPORTED, t('bg.SWAP.services.service.swap.featureUnderMaintenance'))];
482
482
  }
483
483
  }
484
484
  if (handler) {
@@ -94,7 +94,7 @@ export default class TransactionService {
94
94
  // Check support for transaction
95
95
  checkSupportForTransaction(validationResponse, transaction);
96
96
  if (!chainInfo) {
97
- validationResponse.errors.push(new TransactionError(BasicTxErrorType.INTERNAL_ERROR, t('Cannot find network')));
97
+ validationResponse.errors.push(new TransactionError(BasicTxErrorType.INTERNAL_ERROR, t('bg.TRANSACTION_SERVICE.services.service.transaction.cannotFindNetwork')));
98
98
  }
99
99
  const substrateApi = this.state.chainService.getSubstrateApi(chainInfo.slug);
100
100
  const evmApi = this.state.chainService.getEvmApi(chainInfo.slug);
@@ -1217,8 +1217,8 @@ export default class TransactionService {
1217
1217
  const info = isHex(extrinsicHash) ? extrinsicHash : getBaseTransactionInfo(transaction, this.state.chainService.getChainInfoMap());
1218
1218
  this.state.notificationService.notify({
1219
1219
  type: NotificationType.SUCCESS,
1220
- title: t('Transaction completed'),
1221
- message: t('Transaction {{info}} completed', {
1220
+ title: t('bg.TRANSACTION_SERVICE.services.service.transaction.transactionCompleted'),
1221
+ message: t('bg.TRANSACTION_SERVICE.services.service.transaction.transactionInfoCompleted', {
1222
1222
  replace: {
1223
1223
  info
1224
1224
  }
@@ -1256,8 +1256,8 @@ export default class TransactionService {
1256
1256
  const info = isHex(transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash) ? transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash : getBaseTransactionInfo(transaction, this.state.chainService.getChainInfoMap());
1257
1257
  this.state.notificationService.notify({
1258
1258
  type: NotificationType.ERROR,
1259
- title: t('Transaction failed'),
1260
- message: t('Transaction {{info}} failed', {
1259
+ title: t('bg.TRANSACTION_SERVICE.services.service.transaction.transactionFailed'),
1260
+ message: t('bg.TRANSACTION_SERVICE.services.service.transaction.transactionInfoFailed', {
1261
1261
  replace: {
1262
1262
  info
1263
1263
  }
@@ -1294,8 +1294,8 @@ export default class TransactionService {
1294
1294
  const info = isHex(transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash) ? transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash : getBaseTransactionInfo(transaction, this.state.chainService.getChainInfoMap());
1295
1295
  this.state.notificationService.notify({
1296
1296
  type: NotificationType.ERROR,
1297
- title: t('Transaction timed out'),
1298
- message: t('Transaction {{info}} timed out', {
1297
+ title: t('bg.TRANSACTION_SERVICE.services.service.transaction.transactionTimedOut'),
1298
+ message: t('bg.TRANSACTION_SERVICE.services.service.transaction.transactionInfoTimedOut', {
1299
1299
  replace: {
1300
1300
  info
1301
1301
  }
@@ -1501,7 +1501,7 @@ export default class TransactionService {
1501
1501
  if (isApproved) {
1502
1502
  let signedTransaction;
1503
1503
  if (!payload) {
1504
- throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, t('Failed to sign'));
1504
+ throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, t('bg.TRANSACTION_SERVICE.services.service.transaction.failedToSign'));
1505
1505
  }
1506
1506
  const web3Api = this.state.chainService.getEvmApi(chain).api;
1507
1507
  if (!isExternal) {
@@ -1510,7 +1510,7 @@ export default class TransactionService {
1510
1510
  const signed = mergeTransactionAndSignature(txObject, payload);
1511
1511
  const recover = web3Api.eth.accounts.recoverTransaction(signed);
1512
1512
  if (recover.toLowerCase() !== account.address.toLowerCase()) {
1513
- throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, t('Wrong signature. Please sign with the account you use in dApp'));
1513
+ throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, t('bg.TRANSACTION_SERVICE.services.service.transaction.wrongSignatureSignWithDappAccount'));
1514
1514
  }
1515
1515
  signedTransaction = signed;
1516
1516
  }
@@ -1592,7 +1592,7 @@ export default class TransactionService {
1592
1592
  emitter.emit('send', eventData); // This event is needed after sending transaction with queue
1593
1593
 
1594
1594
  if (!signature) {
1595
- throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, t('Failed to sign'));
1595
+ throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, t('bg.TRANSACTION_SERVICE.services.service.transaction.failedToSign'));
1596
1596
  }
1597
1597
  eventData.extrinsicHash = signature;
1598
1598
  emitter.emit('extrinsicHash', eventData);
@@ -1646,7 +1646,7 @@ export default class TransactionService {
1646
1646
  emitter.emit('send', eventData);
1647
1647
  transaction.submitSwapOrder().then(isSendSuccess => {
1648
1648
  if (!isSendSuccess) {
1649
- throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, t('Failed to sign'));
1649
+ throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, t('bg.TRANSACTION_SERVICE.services.service.transaction.failedToSign'));
1650
1650
  }
1651
1651
  this.handleTransactionTimeout(emitter, eventData);
1652
1652
  transaction.cronCheckTxSuccess().then(order => {
@@ -2071,7 +2071,7 @@ export default class TransactionService {
2071
2071
  const timeout = setTimeout(() => {
2072
2072
  const transaction = this.getTransaction(eventData.id);
2073
2073
  if (transaction.status !== ExtrinsicStatus.SUCCESS && transaction.status !== ExtrinsicStatus.FAIL) {
2074
- eventData.errors.push(new TransactionError(BasicTxErrorType.TIMEOUT, t('Transaction timeout')));
2074
+ eventData.errors.push(new TransactionError(BasicTxErrorType.TIMEOUT, t('bg.TRANSACTION_SERVICE.services.service.transaction.transactionTimeout')));
2075
2075
  emitter.emit('timeout', eventData);
2076
2076
  clearTimeout(timeout);
2077
2077
  }
@@ -16,6 +16,9 @@ function getBlockExplorerAccountRoute(explorerLink) {
16
16
  if (explorerLink.includes('explorer.subspace.network')) {
17
17
  return 'accounts';
18
18
  }
19
+ if (explorerLink.includes('explorer.comstats.org')) {
20
+ return 'accounts';
21
+ }
19
22
  if (explorerLink.includes('edgscan.ink')) {
20
23
  return 'accounts';
21
24
  }
@@ -73,7 +76,7 @@ function getBlockExplorerTxRoute(chainInfo) {
73
76
  if (['gen6_public', 'joystream'].includes(chainInfo.slug)) {
74
77
  return '#/extrinsics';
75
78
  }
76
- if (['edgeware'].includes(chainInfo.slug)) {
79
+ if (['edgeware', 'commune'].includes(chainInfo.slug)) {
77
80
  return 'extrinsics';
78
81
  }
79
82
  if (['mosaicTest', 'polkadex'].includes(chainInfo.slug)) {
@@ -3,6 +3,7 @@
3
3
 
4
4
  import { SWError } from '@subwallet/extension-base/background/errors/SWError';
5
5
  import { detectTranslate } from '@subwallet/extension-base/utils';
6
+ import { t } from 'i18next';
6
7
  export let CommonAccountErrorType;
7
8
  (function (CommonAccountErrorType) {
8
9
  CommonAccountErrorType["ACCOUNT_NOT_FOUND"] = "ACCOUNT_NOT_FOUND";
@@ -11,15 +12,15 @@ export let CommonAccountErrorType;
11
12
  })(CommonAccountErrorType || (CommonAccountErrorType = {}));
12
13
  const DEFAULT_DATA = {
13
14
  [CommonAccountErrorType.ACCOUNT_NOT_FOUND]: {
14
- message: detectTranslate('Account not found'),
15
+ message: detectTranslate('bg.ACCOUNT.types.error.account.common.accountNotFound'),
15
16
  code: 1001
16
17
  },
17
18
  [CommonAccountErrorType.ACCOUNT_EXISTED]: {
18
- message: detectTranslate('Account already exists under the name "{{name}}"'),
19
+ message: detectTranslate('bg.ACCOUNT.types.error.account.common.accountAlreadyExistsWithName'),
19
20
  code: 1002
20
21
  },
21
22
  [CommonAccountErrorType.ACCOUNT_NAME_EXISTED]: {
22
- message: detectTranslate('Account name already in use'),
23
+ message: detectTranslate('bg.ACCOUNT.types.error.account.common.accountNameInUse'),
23
24
  code: 1003
24
25
  }
25
26
  };
@@ -27,7 +28,7 @@ export class SWCommonAccountError extends SWError {
27
28
  errorClass = 'Account';
28
29
  constructor(errorType, _message) {
29
30
  const defaultData = DEFAULT_DATA[errorType];
30
- const message = _message || defaultData.message;
31
+ const message = _message || t(defaultData.message) || '';
31
32
  super(errorType, message, defaultData.code);
32
33
  }
33
34
  }
@@ -3,6 +3,7 @@
3
3
 
4
4
  import { SWError } from '@subwallet/extension-base/background/errors/SWError';
5
5
  import { detectTranslate } from '@subwallet/extension-base/utils';
6
+ import { t } from 'i18next';
6
7
  export let DeriveErrorType;
7
8
  (function (DeriveErrorType) {
8
9
  DeriveErrorType["INVALID_DERIVATION_PATH"] = "INVALID_DERIVATION_PATH";
@@ -14,27 +15,27 @@ export let DeriveErrorType;
14
15
  })(DeriveErrorType || (DeriveErrorType = {}));
15
16
  const DEFAULT_DATA = {
16
17
  [DeriveErrorType.INVALID_DERIVATION_PATH]: {
17
- message: detectTranslate('Invalid derivation path'),
18
+ message: detectTranslate('bg.ACCOUNT.types.error.account.derive.invalidDerivationPath'),
18
19
  code: 1001
19
20
  },
20
21
  [DeriveErrorType.INVALID_DERIVATION_TYPE]: {
21
- message: detectTranslate('Derivation path not supported'),
22
+ message: detectTranslate('bg.ACCOUNT.types.error.account.derive.derivationPathNotSupported'),
22
23
  code: 1002
23
24
  },
24
25
  [DeriveErrorType.ROOT_ACCOUNT_NOT_FOUND]: {
25
- message: detectTranslate('Account not found'),
26
+ message: detectTranslate('bg.ACCOUNT.types.error.account.derive.accountNotFound'),
26
27
  code: 1003
27
28
  },
28
29
  [DeriveErrorType.INVALID_ACCOUNT_TYPE]: {
29
- message: detectTranslate('Invalid account type'),
30
+ message: detectTranslate('bg.ACCOUNT.types.error.account.derive.invalidAccountType'),
30
31
  code: 1004
31
32
  },
32
33
  [DeriveErrorType.MAX_DERIVATION_DEPTH]: {
33
- message: detectTranslate('Derivation path not supported'),
34
+ message: detectTranslate('bg.ACCOUNT.types.error.account.derive.derivationPathNotSupported'),
34
35
  code: 1005
35
36
  },
36
37
  [DeriveErrorType.MIN_DERIVATION_DEPTH]: {
37
- message: detectTranslate('Derivation path not supported'),
38
+ message: detectTranslate('bg.ACCOUNT.types.error.account.derive.derivationPathNotSupported'),
38
39
  code: 1006
39
40
  }
40
41
  };
@@ -42,7 +43,7 @@ export class SWDeriveError extends SWError {
42
43
  errorClass = 'Derive';
43
44
  constructor(errorType, _message) {
44
45
  const defaultData = DEFAULT_DATA[errorType];
45
- const message = _message || defaultData.message;
46
+ const message = _message || t(defaultData.message) || '';
46
47
  super(errorType, message, defaultData.code);
47
48
  }
48
49
  }
@@ -8,6 +8,7 @@ export interface RequestSubscribeTransfer extends TransactionFee {
8
8
  value: string;
9
9
  token: string;
10
10
  destChain: string;
11
+ transferAll?: boolean;
11
12
  }
12
13
  export interface ResponseSubscribeTransfer {
13
14
  id: string;
@@ -186,7 +186,7 @@ export const findSoloNextDerive = parentAddress => {
186
186
  try {
187
187
  parentPair = keyring.getPair(parentAddress);
188
188
  } catch (e) {}
189
- assert(parentPair, t('Unable to find account'));
189
+ assert(parentPair, t('bg.ACCOUNT.utils.account.deriveSoloInfo.unableToFindAccount'));
190
190
  const deriveInfo = getSoloDerivationInfo(parentPair.type, parentPair.meta);
191
191
  const needChangeRoot = deriveInfo.depth > 0;
192
192
  let rootPair;
@@ -197,7 +197,7 @@ export const findSoloNextDerive = parentAddress => {
197
197
  } else {
198
198
  rootPair = parentPair;
199
199
  }
200
- assert(rootPair, t('Unable to find parent account'));
200
+ assert(rootPair, t('bg.ACCOUNT.utils.account.deriveSoloInfo.unableToFindParentAccount'));
201
201
  const rootAddress = rootPair.address;
202
202
  const currentDepth = deriveInfo.depth;
203
203
  const currentIndex = (_deriveInfo$autoIndex = deriveInfo.autoIndexes) === null || _deriveInfo$autoIndex === void 0 ? void 0 : _deriveInfo$autoIndex[currentDepth - 1];
@@ -180,7 +180,7 @@ const getChainInfoByChainId = (networkMap, chainId) => {
180
180
  export const parseEvmRlp = async (data, networkMap, evmApiMap) => {
181
181
  const tx = createTransactionFromRLP(data);
182
182
  if (!tx) {
183
- throw new Error(t('Failed to decode data. Please use a valid QR code'));
183
+ throw new Error(t('bg.DAPP.utils.eth.parseTransaction.failedToDecodeQr'));
184
184
  }
185
185
  const result = {
186
186
  input: tx.data,
@@ -1,7 +1,7 @@
1
1
  import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
2
2
  import { AmountData } from '@subwallet/extension-base/background/KoniTypes';
3
3
  import { _BitcoinApi, _CardanoApi, _EvmApi, _SubstrateApi, _TonApi } from '@subwallet/extension-base/services/chain-service/types';
4
- import { FeeChainType, FeeInfo, TransactionFee } from '@subwallet/extension-base/types';
4
+ import { EvmEIP1559FeeDetail, FeeChainType, FeeDetail, FeeInfo, TransactionFee } from '@subwallet/extension-base/types';
5
5
  import { ResponseSubscribeTransfer } from '@subwallet/extension-base/types/balance/transfer';
6
6
  export interface CalculateMaxTransferable extends TransactionFee {
7
7
  address: string;
@@ -19,8 +19,10 @@ export interface CalculateMaxTransferable extends TransactionFee {
19
19
  isTransferLocalTokenAndPayThatTokenAsFee: boolean;
20
20
  isTransferNativeTokenAndPayLocalTokenAsFee: boolean;
21
21
  nativeToken: _ChainAsset;
22
+ transferAll?: boolean;
22
23
  }
23
24
  export declare const detectTransferTxType: (srcToken: _ChainAsset, srcChain: _ChainInfo, destChain: _ChainInfo) => FeeChainType;
24
25
  export declare const calculateMaxTransferable: (id: string, request: CalculateMaxTransferable, freeBalance: AmountData, fee: FeeInfo) => Promise<ResponseSubscribeTransfer>;
25
26
  export declare const calculateTransferMaxTransferable: (id: string, request: CalculateMaxTransferable, freeBalance: AmountData, fee: FeeInfo) => Promise<ResponseSubscribeTransfer>;
26
27
  export declare const calculateXcmMaxTransferable: (id: string, request: CalculateMaxTransferable, freeBalance: AmountData, fee: FeeInfo) => Promise<ResponseSubscribeTransfer>;
28
+ export declare const isEvmEIP1559FeeDetail: (fee: FeeDetail | undefined) => fee is EvmEIP1559FeeDetail;
@@ -88,6 +88,7 @@ export const calculateTransferMaxTransferable = async (id, request, freeBalance,
88
88
  substrateApi,
89
89
  to,
90
90
  tonApi,
91
+ transferAll,
91
92
  value
92
93
  } = request;
93
94
  const feeChainType = fee.type;
@@ -170,7 +171,7 @@ export const calculateTransferMaxTransferable = async (id, request, freeBalance,
170
171
  });
171
172
  } else {
172
173
  [transaction] = await createSubstrateExtrinsic({
173
- transferAll: false,
174
+ transferAll: !!transferAll,
174
175
  value,
175
176
  from: address,
176
177
  networkKey: srcChain.slug,
@@ -504,4 +505,7 @@ export const calculateXcmMaxTransferable = async (id, request, freeBalance, fee)
504
505
  id: id,
505
506
  error
506
507
  };
508
+ };
509
+ export const isEvmEIP1559FeeDetail = fee => {
510
+ return !!fee && fee.type === 'evm' && 'baseGasFee' in fee && typeof fee.baseGasFee === 'string' && 'options' in fee && !!fee.options && typeof fee.options === 'object' && fee.gasPrice === undefined;
507
511
  };
package/utils/index.js CHANGED
@@ -268,7 +268,7 @@ export async function waitTimeout(ms) {
268
268
  return new Promise(resolve => setTimeout(resolve, ms));
269
269
  }
270
270
  export const stripUrl = url => {
271
- assert(url && (url.startsWith('http:') || url.startsWith('https:') || url.startsWith('ipfs:') || url.startsWith('ipns:')), t('Invalid URL for provider'));
271
+ assert(url && (url.startsWith('http:') || url.startsWith('https:') || url.startsWith('ipfs:') || url.startsWith('ipns:')), t('bg.utils.invalidUrlForProvider'));
272
272
  const parts = url.split('/');
273
273
  return parts[2];
274
274
  };