@subwallet/extension-base 1.3.54-1 → 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.
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
@@ -156,7 +156,7 @@ export async function validationAuthMiddleware(koni, url, payload) {
156
156
  return handleAuthError(payload, 'Account not in allowed list', 'dApp', errors);
157
157
  }
158
158
  if (payload.pair.meta.noPublicKey) {
159
- return handleAuthError(payload, t('This account is not supported for this action'), 'dApp', errors);
159
+ return handleAuthError(payload, t('bg.TRANSACTION.core.validation.request.accountNotSupportedForAction'), 'dApp', errors);
160
160
  }
161
161
  payload.authInfo = authInfo;
162
162
  }
@@ -743,14 +743,14 @@ export async function validationBitcoinSignMessageMiddleware(koni, url, payload_
743
743
  errors.push(error);
744
744
  };
745
745
  if (address === '' || !message) {
746
- handleError(t('not found address or payload to sign'));
746
+ handleError(t('bg.TRANSACTION.core.validation.request.notFoundAddressOrPayload'));
747
747
  }
748
748
  if (!isBitcoinAddress(address)) {
749
- handleError(t('Invalid bitcoin address'));
749
+ handleError(t('bg.TRANSACTION.core.validation.request.invalidBitcoinAddress'));
750
750
  }
751
751
  const pair = pair_ || keyring.getPair(address);
752
752
  if (!pair) {
753
- handleError(t('Unable to find account'));
753
+ handleError(t('bg.TRANSACTION.core.validation.request.unableToFindAccount'));
754
754
  }
755
755
  const hashPayload = '';
756
756
  let canSign = false;
@@ -800,23 +800,23 @@ export async function validationBitcoinSignPsbtMiddleware(koni, url, payload_) {
800
800
  errors.push(error);
801
801
  };
802
802
  if (!(psbtParams.network === 'mainnet' || psbtParams.network === 'testnet')) {
803
- handleError(t('Network to try this request is must be mainnet or testnet'));
803
+ handleError(t('bg.TRANSACTION.core.validation.request.networkMustBeMainnetOrTestnet'));
804
804
  }
805
805
  if (!networkKey) {
806
- handleError(t('Network unavailable. Please switch network or manually add network to wallet'));
806
+ handleError(t('bg.TRANSACTION.core.validation.request.networkUnavailableSwitchOrAdd'));
807
807
  }
808
808
  if (!psbt || !address) {
809
- handleError(t('Not found payload to sign'));
809
+ handleError(t('bg.TRANSACTION.core.validation.request.notFoundPayloadToSign'));
810
810
  }
811
811
  if (!isHex(`0x${psbt}`)) {
812
- handleError(t('Psbt to be signed must be hex-encoded'));
812
+ handleError(t('bg.TRANSACTION.core.validation.request.psbtMustBeHexEncoded'));
813
813
  }
814
814
  if (!isBitcoinAddress(address)) {
815
- handleError(t('Not found address'));
815
+ handleError(t('bg.TRANSACTION.core.validation.request.notFoundAddress'));
816
816
  }
817
817
  const addressInfo = getBitcoinAddressInfo(address);
818
818
  if (psbtParams.network !== addressInfo.network) {
819
- handleError(t('The account or the network is not matched'));
819
+ handleError(t('bg.TRANSACTION.core.validation.request.accountOrNetworkNotMatched'));
820
820
  }
821
821
  const payload = {
822
822
  broadcast: !!broadcast,
@@ -873,13 +873,13 @@ export async function validationBitcoinSendTransactionMiddleware(koni, url, payl
873
873
  return val;
874
874
  };
875
875
  if (transactionParams.network !== senderAccountInfo.network) {
876
- handleError(t('The account or the network is not matched'));
876
+ handleError(t('bg.TRANSACTION.core.validation.request.accountOrNetworkNotMatched'));
877
877
  }
878
878
  if (!((_transactionParams$re = transactionParams.recipients) !== null && _transactionParams$re !== void 0 && _transactionParams$re.length)) {
879
- handleError(t('please provide the recipient and the amount'));
879
+ handleError(t('bg.TRANSACTION.core.validation.request.provideRecipientAndAmount'));
880
880
  }
881
881
  if (((_transactionParams$re2 = transactionParams.recipients) === null || _transactionParams$re2 === void 0 ? void 0 : _transactionParams$re2.length) > 1) {
882
- handleError(t("we don't support multiple recipients yet. Please provide only one for now."));
882
+ handleError(t('bg.TRANSACTION.core.validation.request.multipleRecipientsNotSupported'));
883
883
  }
884
884
  if (transactionParams.recipients.filter(({
885
885
  address,
@@ -889,17 +889,17 @@ export async function validationBitcoinSendTransactionMiddleware(koni, url, payl
889
889
  }
890
890
  const recipientAccountInfo = getBitcoinAddressInfo(transactionParams.recipients[0].address);
891
891
  if (recipientAccountInfo.network !== transactionParams.network) {
892
- handleError(t('invalid recipient address'));
892
+ handleError(t('bg.TRANSACTION.core.validation.request.invalidRecipientAddress'));
893
893
  }
894
894
  if (transactionParams.recipients.length !== 1) {
895
- handleError(t('receiving address must be a single account'));
895
+ handleError(t('bg.TRANSACTION.core.validation.request.receivingAddressMustBeSingleAccount'));
896
896
  }
897
897
  if (address === transactionParams.recipients[0].address) {
898
- handleError(t('must be different from sending address'));
898
+ handleError(t('bg.TRANSACTION.core.validation.request.mustBeDifferentFromSendingAddress'));
899
899
  }
900
900
  const pair = pair_ || keyring.getPair(address);
901
901
  if (!pair) {
902
- handleError(t('unable to find account'));
902
+ handleError(t('bg.TRANSACTION.core.validation.request.unableToFindAccountError'));
903
903
  }
904
904
  const tokenInfo = koni.getNativeTokenInfo(networkKey);
905
905
  let freeBalance = {
@@ -912,15 +912,15 @@ export async function validationBitcoinSendTransactionMiddleware(koni, url, payl
912
912
  freeBalance = await koni.balanceService.getTransferableBalance(address, networkKey, tokenInfo.slug);
913
913
  } catch (e) {
914
914
  const message = e.message;
915
- if (message.toLowerCase().includes(t('please enable network'))) {
915
+ if (message.toLowerCase().includes(t('bg.TRANSACTION.core.validation.request.pleaseEnableNetwork'))) {
916
916
  const chainInfo = koni.chainService.getChainInfoByKey(networkKey);
917
917
  payload_.errorPosition = 'ui';
918
918
  payload_.confirmationType = 'bitcoinSendTransactionRequestAfterConfirmation';
919
- const [message, name] = [t('Enable {{chain}} network on the extension and try again', {
919
+ const [message, name] = [t('bg.TRANSACTION.core.validation.request.enableChainOnExtension', {
920
920
  replace: {
921
921
  chain: chainInfo.name
922
922
  }
923
- }), t('Network not enabled')];
923
+ }), t('bg.TRANSACTION.core.validation.request.networkNotEnabled')];
924
924
  const error = new BitcoinProviderError(BitcoinProviderErrorType.INVALID_PARAMS, message, undefined, name);
925
925
  console.error(error);
926
926
  errors.push(error);
@@ -937,7 +937,7 @@ export async function validationBitcoinSendTransactionMiddleware(koni, url, payl
937
937
  };
938
938
  });
939
939
  if (new BigN(freeBalance.value).lte(totalValue)) {
940
- handleError(t('insufficient balance'));
940
+ handleError(t('bg.TRANSACTION.core.validation.request.insufficientBalanceError'));
941
941
  }
942
942
  const sendTransactionRequest = {
943
943
  networkKey,
@@ -962,10 +962,10 @@ export function convertErrorMessage(message_, name) {
962
962
 
963
963
  // Network error
964
964
  if (message.includes('connection error') || message.includes('connection not open') || message.includes('connection timeout') || message.includes('can not active chain') || message.includes('invalid json rpc') || message.includes('internet connection')) {
965
- return [t('Re-enable the network or change RPC on the extension and try again'), t('Unstable network connection')];
965
+ return [t('bg.TRANSACTION.core.validation.request.reEnableOrChangeRpc'), t('bg.TRANSACTION.core.validation.request.unstableNetworkConnection')];
966
966
  }
967
967
  if (message.includes('network is currently not supported')) {
968
- return [t('This network is not yet supported on SubWallet. (Import the network)[https://docs.subwallet.app/main/extension-user-guide/customize-your-networks#import-networks] on SubWallet and try again'), t('Network not supported')];
968
+ return [t('bg.TRANSACTION.core.validation.request.networkNotSupportedImport'), t('bg.TRANSACTION.core.validation.request.networkNotSupported')];
969
969
  }
970
970
 
971
971
  // Authentication
@@ -979,48 +979,48 @@ export function convertErrorMessage(message_, name) {
979
979
  // Transaction
980
980
 
981
981
  if (message.includes('recipient address not found')) {
982
- return [t('Enter recipient address and try again'), t('Recipient address not found')];
982
+ return [t('bg.TRANSACTION.core.validation.request.enterRecipientAddress'), t('bg.TRANSACTION.core.validation.request.recipientAddressNotFound')];
983
983
  }
984
984
  if (message.includes('is not a number') || message.includes('invalid number value') || message.includes('invalid bignumberish')) {
985
- return [t('Amount must be an integer. Enter an integer and try again'), t('Invalid amount')];
985
+ return [t('bg.TRANSACTION.core.validation.request.amountMustBeInteger'), t('bg.TRANSACTION.core.validation.request.invalidAmount')];
986
986
  }
987
987
  if (message.includes('calculate estimate gas fee') || message.includes('invalidcode')) {
988
- return [t('Unable to calculate estimated gas for this transaction. Try again or contact support at agent@subwallet.app'), t('Gas calculation error')];
988
+ return [t('bg.TRANSACTION.core.validation.request.gasCalculationError'), t('bg.TRANSACTION.core.validation.request.gasCalculationErrorTitle')];
989
989
  }
990
990
  if (message.includes('invalid recipient address')) {
991
- return [t('Make sure the recipient address is valid and in the same type as the sender address, then try again'), t('Invalid recipient address')];
991
+ return [t('bg.TRANSACTION.core.validation.request.recipientAddressTypeMismatch'), t('bg.TRANSACTION.core.validation.request.invalidRecipientAddressError')];
992
992
  }
993
993
  if (message.includes('must be different from sending address')) {
994
- return [t('The recipient address must be different from the sender address'), t('Invalid recipient address')];
994
+ return [t('bg.TRANSACTION.core.validation.request.recipientMustBeDifferentFromSender'), t('bg.TRANSACTION.core.validation.request.invalidRecipientAddressError')];
995
995
  }
996
996
  if (message.includes('the sender address must be the ethereum address type')) {
997
- return [t('The sender address must be the ethereum address type'), t('Invalid address type')];
997
+ return [t('bg.TRANSACTION.core.validation.request.senderMustBeEthereumAddress'), t('bg.TRANSACTION.core.validation.request.invalidAddressType')];
998
998
  }
999
999
  if (message.includes('the sender address must be the ethereum address type')) {
1000
- return [t('The sender address must be the bitcoin address type'), t('Invalid address type')];
1000
+ return [t('bg.TRANSACTION.core.validation.request.senderMustBeBitcoinAddress'), t('bg.TRANSACTION.core.validation.request.invalidAddressType')];
1001
1001
  }
1002
1002
  if (message.includes('account or the network is not matched')) {
1003
- return [t('The account does not match the selected network'), t('Invalid address type')];
1003
+ return [t('bg.TRANSACTION.core.validation.request.accountDoesNotMatchNetwork'), t('bg.TRANSACTION.core.validation.request.invalidAddressType')];
1004
1004
  }
1005
1005
  if (message.includes('receiving address must be a single account')) {
1006
- return [t('The receiving address must be a single account'), t('Invalid recipient address')];
1006
+ return [t('bg.TRANSACTION.core.validation.request.receivingAddressMustBeSingle'), t('bg.TRANSACTION.core.validation.request.invalidRecipientAddressError')];
1007
1007
  }
1008
1008
  if (message.includes('insufficient balance') || message.includes('insufficient funds')) {
1009
- return [t('Insufficient balance on the sender address. Top up your balance and try again'), t('Unable to sign transaction')];
1009
+ return [t('bg.TRANSACTION.core.validation.request.insufficientSenderBalance'), t('bg.TRANSACTION.core.validation.request.unableToSignTransaction')];
1010
1010
  }
1011
1011
  if (message.includes('substrate') && message.includes('receive this token')) {
1012
- return [t('The recipient account is a Ledger Polkadot (EVM) account, which is not supported for this transaction. Change recipient account and try again'), t('Invalid account type')];
1012
+ return [t('bg.TRANSACTION.core.validation.request.recipientLedgerEvmNotSupported'), t('bg.TRANSACTION.core.validation.request.invalidAccountType')];
1013
1013
  }
1014
1014
 
1015
1015
  // Sign Message
1016
1016
  if (message.includes('not found address or payload to sign')) {
1017
- return [t('An error occurred when signing this request. Try again or contact support at agent@subwallet.app'), t('Unable to sign')];
1017
+ return [t('bg.TRANSACTION.core.validation.request.errorSigningRequest'), t('bg.TRANSACTION.core.validation.request.unableToSign')];
1018
1018
  }
1019
1019
  if (message.includes('unsupported method') || message.includes('unsupported action')) {
1020
- return [t('This sign method is not supported by SubWallet. Try again or contact support at agent@subwallet.app'), t('Method not supported')];
1020
+ return [t('bg.TRANSACTION.core.validation.request.signMethodNotSupported'), t('bg.TRANSACTION.core.validation.request.methodNotSupported')];
1021
1021
  }
1022
1022
  if (message.includes('eip712 typed data') || message.includes('invalid message')) {
1023
- return [t('An error occurred when attempting to sign this request. Contact support at email: agent@subwallet.app'), t('Unable to sign')];
1023
+ return [t('bg.TRANSACTION.core.validation.request.errorAttemptingToSign'), t('bg.TRANSACTION.core.validation.request.unableToSign')];
1024
1024
  }
1025
1025
  return [message, name || 'Error'];
1026
1026
  }
@@ -25,20 +25,20 @@ export function validateTransferRequest(tokenInfo, from, to, value, transferAll)
25
25
  const errors = [];
26
26
  if (!transferAll) {
27
27
  if (value === undefined) {
28
- errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('Transfer amount is required')));
28
+ errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('bg.TRANSACTION.core.validation.transfer.transferAmountRequired')));
29
29
  }
30
30
  }
31
31
  if (!tokenInfo) {
32
- errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('Not found token from registry')));
32
+ errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('bg.TRANSACTION.core.validation.transfer.tokenNotFoundInRegistry')));
33
33
  }
34
34
  if (isEthereumAddress(from) && isEthereumAddress(to) && _isTokenEvmSmartContract(tokenInfo) && _getContractAddressOfToken(tokenInfo).length === 0) {
35
- errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('Not found ERC20 address for this token')));
35
+ errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('bg.TRANSACTION.core.validation.transfer.erc20AddressNotFound')));
36
36
  }
37
37
  if (isTonAddress(from) && isTonAddress(to) && _isTokenTonSmartContract(tokenInfo) && _getContractAddressOfToken(tokenInfo).length === 0) {
38
- errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('Not found TEP74 address for this token')));
38
+ errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('bg.TRANSACTION.core.validation.transfer.tep74AddressNotFound')));
39
39
  }
40
40
  if (isCardanoAddress(from) && isCardanoAddress(to) && _isCIP26Token(tokenInfo) && getCardanoAssetId(tokenInfo).length === 0) {
41
- errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('Not found policy id of this token')));
41
+ errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('bg.TRANSACTION.core.validation.transfer.policyIdNotFound')));
42
42
  }
43
43
  return errors;
44
44
  }
@@ -56,7 +56,7 @@ export function additionalValidateTransferForRecipient(sendingTokenInfo, nativeT
56
56
  const minXCMStr = formatNumber(sendingTokenMinAmountXCM.toString(), _getAssetDecimals(sendingTokenInfo), balanceFormatter, {
57
57
  maxNumberFormat: _getAssetDecimals(sendingTokenInfo) || 6
58
58
  });
59
- const error = new TransactionError(TransferTxErrorType.NOT_ENOUGH_VALUE, t('You must transfer at least {{amount}} {{symbol}} to keep the recipient account alive. Increase amount and try again', {
59
+ const error = new TransactionError(TransferTxErrorType.NOT_ENOUGH_VALUE, t('bg.TRANSACTION.core.validation.transfer.transferMinimumToKeepAccountAlive', {
60
60
  replace: {
61
61
  amount: minXCMStr,
62
62
  symbol: sendingTokenInfo.symbol
@@ -73,7 +73,7 @@ export function additionalValidateTransferForRecipient(sendingTokenInfo, nativeT
73
73
  const balanceKeepAlive = formatNumber(nativeTokenMinAmount, _getAssetDecimals(nativeTokenInfo), balanceFormatter, {
74
74
  maxNumberFormat: _getAssetDecimals(nativeTokenInfo) || 6
75
75
  });
76
- const error = 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', {
76
+ const error = new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('bg.TRANSACTION.core.validation.transfer.recipientBalanceTooLow', {
77
77
  replace: {
78
78
  amount: balanceKeepAlive,
79
79
  nativeSymbol: nativeTokenInfo.symbol,
@@ -87,7 +87,7 @@ export function additionalValidateTransferForRecipient(sendingTokenInfo, nativeT
87
87
  const atLeastStr = formatNumber(atLeast.toString(), _getAssetDecimals(sendingTokenInfo), balanceFormatter, {
88
88
  maxNumberFormat: _getAssetDecimals(sendingTokenInfo) || 6
89
89
  });
90
- const error = new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('You must transfer at least {{amount}} {{symbol}} to avoid losing funds on the recipient account. Increase amount and try again', {
90
+ const error = new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('bg.TRANSACTION.core.validation.transfer.transferMinimumToAvoidFundLoss', {
91
91
  replace: {
92
92
  amount: atLeastStr,
93
93
  symbol: sendingTokenInfo.symbol
@@ -101,7 +101,7 @@ export function additionalValidateTransferForRecipient(sendingTokenInfo, nativeT
101
101
  const atLeastStr = formatNumber(atLeast.toString(), _getAssetDecimals(sendingTokenInfo), balanceFormatter, {
102
102
  maxNumberFormat: _getAssetDecimals(sendingTokenInfo) || 6
103
103
  });
104
- const error = new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('You must transfer at least {{amount}} {{symbol}} to keep the recipient account alive. Increase amount and try again', {
104
+ const error = new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('bg.TRANSACTION.core.validation.transfer.transferMinimumToKeepAccountAlive', {
105
105
  replace: {
106
106
  amount: atLeastStr,
107
107
  symbol: sendingTokenInfo.symbol
@@ -117,7 +117,7 @@ export function validateXcmTransferRequest(destTokenInfo, sender, sendingValue)
117
117
  const errors = [];
118
118
  const keypair = keyring.getPair(sender);
119
119
  if (!destTokenInfo) {
120
- errors.push(new TransactionError(TransferTxErrorType.INVALID_TOKEN, t('Not found token from registry')));
120
+ errors.push(new TransactionError(TransferTxErrorType.INVALID_TOKEN, t('bg.TRANSACTION.core.validation.transfer.tokenNotFoundInRegistry')));
121
121
  }
122
122
  return [errors, keypair];
123
123
  }
@@ -126,7 +126,11 @@ export function checkSupportForFeature(validationResponse, blockedFeaturesList,
126
126
  const chain = validationResponse.chain;
127
127
  const currentFeature = `${extrinsicType}___${chain}`;
128
128
  if (blockedFeaturesList.includes(currentFeature)) {
129
- validationResponse.errors.push(new TransactionError(BasicTxErrorType.UNSUPPORTED, t(`Feature under maintenance on ${chainInfo.name} network. Try again later`)));
129
+ validationResponse.errors.push(new TransactionError(BasicTxErrorType.UNSUPPORTED, t('bg.TRANSACTION.core.validation.transfer.featureUnderMaintenanceOnNetwork', {
130
+ replace: {
131
+ chainInfoName: chainInfo.name
132
+ }
133
+ })));
130
134
  }
131
135
  }
132
136
  export function checkSupportForAction(validationResponse, blockedActionsMap) {
@@ -289,7 +293,7 @@ export function checkSupportForAction(validationResponse, blockedActionsMap) {
289
293
  }
290
294
  const blockedActionsList = Object.values(blockedActionsMap).flat();
291
295
  if (blockedActionsList.includes(currentAction)) {
292
- validationResponse.errors.push(new TransactionError(BasicTxErrorType.UNSUPPORTED, t('Feature under maintenance. Try again later')));
296
+ validationResponse.errors.push(new TransactionError(BasicTxErrorType.UNSUPPORTED, t('bg.TRANSACTION.core.validation.transfer.featureUnderMaintenance')));
293
297
  }
294
298
  }
295
299
 
@@ -300,7 +304,7 @@ export function checkSupportForTransaction(validationResponse, transaction) {
300
304
  } = validationResponse;
301
305
  if (!transaction) {
302
306
  if (extrinsicType === ExtrinsicType.SEND_NFT) {
303
- validationResponse.errors.push(new TransactionError(BasicTxErrorType.UNSUPPORTED, t('This feature is not yet available for this NFT')));
307
+ validationResponse.errors.push(new TransactionError(BasicTxErrorType.UNSUPPORTED, t('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForNft')));
304
308
  } else {
305
309
  validationResponse.errors.push(new TransactionError(BasicTxErrorType.UNSUPPORTED));
306
310
  }
@@ -404,20 +408,20 @@ export function checkSigningAccountForTransaction(validationResponse, chainInfoM
404
408
  } = validationResponse;
405
409
  const pair = keyring.getPair(address);
406
410
  if (!pair) {
407
- validationResponse.errors.push(new TransactionError(BasicTxErrorType.INTERNAL_ERROR, t('Unable to find account')));
411
+ validationResponse.errors.push(new TransactionError(BasicTxErrorType.INTERNAL_ERROR, t('bg.TRANSACTION.core.validation.transfer.unableToFindAccount')));
408
412
  } else {
409
413
  const accountJson = pairToAccount(pair, chainInfoMap);
410
414
  if (!accountJson.transactionActions.includes(extrinsicType)) {
411
415
  // check if the account can sign the transaction type
412
- validationResponse.errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('This feature is not available with this account')));
416
+ validationResponse.errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForAccount')));
413
417
  } else if (accountJson.specialChain && accountJson.specialChain !== chain) {
414
418
  // check if the account can only be used on a specific chain (for ledger legacy)
415
- validationResponse.errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('This feature is not available with this account')));
419
+ validationResponse.errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForAccount')));
416
420
  } else {
417
421
  const compatibleMap = [AccountSignMode.LEGACY_LEDGER, AccountSignMode.GENERIC_LEDGER].includes(accountJson.signMode) ? LEDGER_SIGNING_COMPATIBLE_MAP : SIGNING_COMPATIBLE_MAP;
418
422
  if (!compatibleMap[chainType].includes(accountJson.chainType)) {
419
423
  // check if the account chain type is compatible with the transaction chain type
420
- validationResponse.errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('This feature is not available with this account')));
424
+ validationResponse.errors.push(new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForAccount')));
421
425
  }
422
426
  }
423
427
  }
@@ -81,7 +81,7 @@ export const parseSubstrateTransaction = (data, apiPromise) => {
81
81
  } catch (e) {
82
82
  return {
83
83
  ...baseInfo,
84
- message: t('Unable to decode the information'),
84
+ message: t('bg.DAPP.koni.api.dotsama.parseTransaction.unableToDecodeInformation'),
85
85
  method: _method
86
86
  };
87
87
  }
@@ -24,7 +24,7 @@ export function validateRelayUnbondingCondition(amount, chainStakingMetadata, no
24
24
  errors.push(new TransactionError(StakingTxErrorType.INVALID_ACTIVE_STAKE));
25
25
  }
26
26
  if (nominatorMetadata.unstakings.length > chainStakingMetadata.maxWithdrawalRequestPerValidator) {
27
- errors.push(new TransactionError(StakingTxErrorType.EXCEED_MAX_UNSTAKING, t('You cannot unstake more than {{number}} times', {
27
+ errors.push(new TransactionError(StakingTxErrorType.EXCEED_MAX_UNSTAKING, t('bg.EARNING.koni.api.staking.bonding.relayChain.maxUnstakeTimes', {
28
28
  replace: {
29
29
  number: chainStakingMetadata.maxWithdrawalRequestPerValidator
30
30
  }
@@ -452,7 +452,7 @@ export async function getRelayMaxNominations(substrateApi) {
452
452
  export const getMinStakeErrorMessage = (chainInfo, bnMinStake) => {
453
453
  const tokenInfo = _getChainNativeTokenBasicInfo(chainInfo);
454
454
  const number = formatNumber(bnMinStake.toString(), tokenInfo.decimals || 0, balanceFormatter);
455
- return t('Insufficient stake. You need to stake at least {{number}} {{tokenSymbol}} to earn rewards', {
455
+ return t('bg.EARNING.koni.api.staking.bonding.utils.insufficientStakeToEarn', {
456
456
  replace: {
457
457
  tokenSymbol: tokenInfo.symbol,
458
458
  number
@@ -460,30 +460,30 @@ export const getMinStakeErrorMessage = (chainInfo, bnMinStake) => {
460
460
  });
461
461
  };
462
462
  export const getMaxValidatorErrorMessage = (chainInfo, max) => {
463
- let message = detectTranslate('You cannot select more than {{number}} validators for this network');
463
+ let message = detectTranslate('bg.EARNING.koni.api.staking.bonding.utils.maxValidatorsSelection');
464
464
  const label = getValidatorLabel(chainInfo.slug);
465
465
  if (max > 1) {
466
466
  switch (label) {
467
467
  case 'dApp':
468
- message = detectTranslate('You cannot select more than {{number}} dApps for this network');
468
+ message = detectTranslate('bg.EARNING.koni.api.staking.bonding.utils.maxDappsSelection');
469
469
  break;
470
470
  case 'Collator':
471
- message = detectTranslate('You cannot select more than {{number}} collators for this network');
471
+ message = detectTranslate('bg.EARNING.koni.api.staking.bonding.utils.maxCollatorsSelection');
472
472
  break;
473
473
  case 'Validator':
474
- message = detectTranslate('You cannot select more than {{number}} validators for this network');
474
+ message = detectTranslate('bg.EARNING.koni.api.staking.bonding.utils.maxValidatorsSelection');
475
475
  break;
476
476
  }
477
477
  } else {
478
478
  switch (label) {
479
479
  case 'dApp':
480
- message = detectTranslate('You cannot select more than {{number}} dApp for this network');
480
+ message = detectTranslate('bg.EARNING.koni.api.staking.bonding.utils.maxOneDappSelection');
481
481
  break;
482
482
  case 'Collator':
483
- message = detectTranslate('You cannot select more than {{number}} collator for this network');
483
+ message = detectTranslate('bg.EARNING.koni.api.staking.bonding.utils.maxOneCollatorSelection');
484
484
  break;
485
485
  case 'Validator':
486
- message = detectTranslate('You cannot select more than {{number}} validator for this network');
486
+ message = detectTranslate('bg.EARNING.koni.api.staking.bonding.utils.maxOneValidatorSelection');
487
487
  break;
488
488
  }
489
489
  }
@@ -498,29 +498,29 @@ export const getExistUnstakeErrorMessage = (chain, type, isStakeMore) => {
498
498
  if (!isStakeMore) {
499
499
  switch (label) {
500
500
  case 'dApp':
501
- return t('You can unstake from a dApp once');
501
+ return t('bg.EARNING.koni.api.staking.bonding.utils.unstakeFromDappOnce');
502
502
  case 'Collator':
503
- return t('You can unstake from a collator once');
503
+ return t('bg.EARNING.koni.api.staking.bonding.utils.unstakeFromCollatorOnce');
504
504
  case 'Validator':
505
505
  {
506
506
  if (type === StakingType.POOLED) {
507
- return t('You can unstake from a pool once');
507
+ return t('bg.EARNING.koni.api.staking.bonding.utils.unstakeFromPoolOnce');
508
508
  }
509
- return t('You can unstake from a validator once');
509
+ return t('bg.EARNING.koni.api.staking.bonding.utils.unstakeFromValidatorOnce');
510
510
  }
511
511
  }
512
512
  } else {
513
513
  switch (label) {
514
514
  case 'dApp':
515
- return t('You cannot stake more for a dApp you are unstaking from');
515
+ return t('bg.EARNING.koni.api.staking.bonding.utils.cannotStakeMoreOnUnstakingDapp');
516
516
  case 'Collator':
517
- return t('You cannot stake more for a collator you are unstaking from');
517
+ return t('bg.EARNING.koni.api.staking.bonding.utils.cannotStakeMoreOnUnstakingCollator');
518
518
  case 'Validator':
519
519
  {
520
520
  if (type === StakingType.POOLED) {
521
- return t('You cannot stake more for a pool you are unstaking from');
521
+ return t('bg.EARNING.koni.api.staking.bonding.utils.cannotStakeMoreOnUnstakingPool');
522
522
  }
523
- return t('You cannot stake more for a validator you are unstaking from');
523
+ return t('bg.EARNING.koni.api.staking.bonding.utils.cannotStakeMoreOnUnstakingValidator');
524
524
  }
525
525
  }
526
526
  }
@@ -184,7 +184,7 @@ export async function getAmplitudeUnclaimedStakingReward(substrateApiMap, addres
184
184
  });
185
185
  const unclaimedRewardList = [];
186
186
  await Promise.all(chains.map(async chain => {
187
- if (_STAKING_CHAIN_GROUP.amplitude.includes(chain) && !_STAKING_CHAIN_GROUP.kilt.includes(chain) && !_STAKING_CHAIN_GROUP.krest_network.includes(chain)) {
187
+ if (_STAKING_CHAIN_GROUP.amplitude.includes(chain) && !_STAKING_CHAIN_GROUP.krest_network.includes(chain)) {
188
188
  const networkInfo = networks[chain];
189
189
  const apiProps = await substrateApiMap[chain].isReady;
190
190
  await Promise.all(useAddresses.map(async address => {