@subwallet/extension-base 1.3.73-0 → 1.3.74-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 (108) hide show
  1. package/background/KoniTypes.d.ts +42 -5
  2. package/background/KoniTypes.js +14 -1
  3. package/cjs/background/KoniTypes.js +16 -2
  4. package/cjs/core/logic-validation/transfer.js +35 -57
  5. package/cjs/koni/background/handlers/Extension.js +599 -144
  6. package/cjs/koni/background/handlers/State.js +5 -2
  7. package/cjs/koni/background/handlers/Tabs.js +3 -2
  8. package/cjs/packageInfo.js +1 -1
  9. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +0 -2
  10. package/cjs/services/chain-service/handler/SubstrateApi.js +6 -1
  11. package/cjs/services/chain-service/index.js +1 -0
  12. package/cjs/services/chain-service/utils/index.js +4 -0
  13. package/cjs/services/event-service/index.js +1 -0
  14. package/cjs/services/fee-service/utils/index.js +4 -4
  15. package/cjs/services/inapp-notification-service/consts.js +4 -2
  16. package/cjs/services/inapp-notification-service/index.js +51 -6
  17. package/cjs/services/inapp-notification-service/interfaces.js +2 -0
  18. package/cjs/services/inapp-notification-service/utils/common.js +4 -0
  19. package/cjs/services/keyring-service/context/account-context.js +44 -0
  20. package/cjs/services/keyring-service/context/handlers/Multisig.js +186 -0
  21. package/cjs/services/keyring-service/context/state.js +12 -0
  22. package/cjs/services/multisig-service/index.js +627 -0
  23. package/cjs/services/multisig-service/utils.js +242 -0
  24. package/cjs/services/request-service/handler/SubstrateRequestHandler.js +25 -0
  25. package/cjs/services/request-service/index.js +5 -1
  26. package/cjs/services/storage-service/DatabaseService.js +5 -2
  27. package/cjs/services/storage-service/db-stores/InappNotification.js +20 -2
  28. package/cjs/services/substrate-proxy-service/index.js +22 -7
  29. package/cjs/services/transaction-service/helpers/index.js +8 -0
  30. package/cjs/services/transaction-service/index.js +348 -147
  31. package/cjs/services/transaction-service/types.js +18 -1
  32. package/cjs/types/account/info/keyring.js +5 -0
  33. package/cjs/types/account/info/proxy.js +1 -0
  34. package/cjs/types/multisig/index.js +14 -0
  35. package/cjs/types/transaction/error.js +9 -2
  36. package/cjs/utils/account/transform.js +28 -4
  37. package/cjs/utils/logger/Logger.js +294 -0
  38. package/cjs/utils/logger/index.js +42 -0
  39. package/cjs/utils/logger/types.js +1 -0
  40. package/core/logic-validation/transfer.d.ts +2 -2
  41. package/core/logic-validation/transfer.js +10 -32
  42. package/koni/background/handlers/Extension.d.ts +7 -0
  43. package/koni/background/handlers/Extension.js +498 -43
  44. package/koni/background/handlers/State.d.ts +2 -0
  45. package/koni/background/handlers/State.js +5 -2
  46. package/koni/background/handlers/Tabs.js +3 -2
  47. package/package.json +42 -6
  48. package/packageInfo.js +1 -1
  49. package/services/balance-service/helpers/subscribe/substrate/index.js +0 -2
  50. package/services/chain-service/handler/SubstrateApi.js +7 -2
  51. package/services/chain-service/index.js +1 -0
  52. package/services/chain-service/types.d.ts +1 -1
  53. package/services/chain-service/utils/index.js +4 -0
  54. package/services/event-service/index.d.ts +1 -0
  55. package/services/event-service/index.js +1 -0
  56. package/services/event-service/types.d.ts +1 -0
  57. package/services/fee-service/utils/index.js +4 -4
  58. package/services/inapp-notification-service/consts.d.ts +3 -1
  59. package/services/inapp-notification-service/consts.js +5 -3
  60. package/services/inapp-notification-service/index.d.ts +3 -2
  61. package/services/inapp-notification-service/index.js +51 -6
  62. package/services/inapp-notification-service/interfaces.d.ts +18 -2
  63. package/services/inapp-notification-service/interfaces.js +2 -0
  64. package/services/inapp-notification-service/utils/common.d.ts +1 -0
  65. package/services/inapp-notification-service/utils/common.js +3 -0
  66. package/services/keyring-service/context/account-context.d.ts +9 -1
  67. package/services/keyring-service/context/account-context.js +44 -0
  68. package/services/keyring-service/context/handlers/Multisig.d.ts +18 -0
  69. package/services/keyring-service/context/handlers/Multisig.js +180 -0
  70. package/services/keyring-service/context/state.d.ts +2 -0
  71. package/services/keyring-service/context/state.js +12 -0
  72. package/services/multisig-service/index.d.ts +245 -0
  73. package/services/multisig-service/index.js +620 -0
  74. package/services/multisig-service/utils.d.ts +95 -0
  75. package/services/multisig-service/utils.js +227 -0
  76. package/services/request-service/handler/SubstrateRequestHandler.d.ts +1 -0
  77. package/services/request-service/handler/SubstrateRequestHandler.js +25 -0
  78. package/services/request-service/index.d.ts +2 -1
  79. package/services/request-service/index.js +5 -1
  80. package/services/storage-service/DatabaseService.d.ts +3 -2
  81. package/services/storage-service/DatabaseService.js +5 -2
  82. package/services/storage-service/db-stores/InappNotification.d.ts +3 -2
  83. package/services/storage-service/db-stores/InappNotification.js +20 -2
  84. package/services/substrate-proxy-service/index.d.ts +4 -1
  85. package/services/substrate-proxy-service/index.js +22 -8
  86. package/services/transaction-service/helpers/index.js +8 -0
  87. package/services/transaction-service/index.d.ts +31 -0
  88. package/services/transaction-service/index.js +270 -69
  89. package/services/transaction-service/types.d.ts +28 -3
  90. package/services/transaction-service/types.js +12 -1
  91. package/types/account/info/keyring.d.ts +14 -1
  92. package/types/account/info/keyring.js +6 -0
  93. package/types/account/info/proxy.d.ts +1 -0
  94. package/types/account/info/proxy.js +1 -0
  95. package/types/multisig/index.d.ts +76 -0
  96. package/types/multisig/index.js +8 -0
  97. package/types/notification/index.d.ts +8 -0
  98. package/types/substrateProxyAccount/index.d.ts +26 -1
  99. package/types/transaction/error.d.ts +6 -1
  100. package/types/transaction/error.js +7 -1
  101. package/types/transaction/request.d.ts +0 -1
  102. package/utils/account/transform.js +28 -4
  103. package/utils/logger/Logger.d.ts +31 -0
  104. package/utils/logger/Logger.js +267 -0
  105. package/utils/logger/index.d.ts +15 -0
  106. package/utils/logger/index.js +29 -0
  107. package/utils/logger/types.d.ts +23 -0
  108. package/utils/logger/types.js +1 -0
@@ -12,14 +12,16 @@ import { _ChainState, _EvmApi, _NetworkUpsertParams, _SubstrateApi, _ValidateCus
12
12
  import { TokenPayFeeInfo } from '@subwallet/extension-base/services/fee-service/interfaces';
13
13
  import { _NotificationInfo, NotificationSetup } from '@subwallet/extension-base/services/inapp-notification-service/interfaces';
14
14
  import { AppBannerData, AppConfirmationData, AppPopupData } from '@subwallet/extension-base/services/mkt-campaign-service/types';
15
+ import { PendingMultisigTx, PendingMultisigTxMap, RequestGetPendingTxs } from '@subwallet/extension-base/services/multisig-service';
15
16
  import { AuthUrls } from '@subwallet/extension-base/services/request-service/types';
16
17
  import { CrowdloanContributionsResponse } from '@subwallet/extension-base/services/subscan-service/types';
17
18
  import { BitcoinTransactionData, SWTransactionResponse, SWTransactionResult } from '@subwallet/extension-base/services/transaction-service/types';
18
19
  import { WalletConnectNotSupportRequest, WalletConnectSessionRequest } from '@subwallet/extension-base/services/wallet-connect-service/types';
19
- import { AccountChainType, AccountJson, AccountsWithCurrentAddress, AddressJson, BalanceJson, BalanceType, BaseRequestSign, BuyServiceInfo, BuyTokenInfo, CommonOptimalTransferPath, CurrentAccountInfo, EarningRewardHistoryItem, EarningRewardJson, EarningStatus, HandleYieldStepParams, InternalRequestSign, LeavePoolAdditionalData, NominationPoolInfo, OptimalYieldPath, OptimalYieldPathParams, RequestAccountBatchExportV2, RequestAccountCreateSuriV2, RequestAccountNameValidate, RequestAccountProxyEdit, RequestAccountProxyForget, RequestBatchJsonGetAccountInfo, RequestBatchRestoreV2, RequestBounceableValidate, RequestChangeAllowOneSign, RequestChangeTonWalletContractVersion, RequestCheckCrossChainTransfer, RequestCheckPublicAndSecretKey, RequestCheckTransfer, RequestCrossChainTransfer, RequestDeriveCreateMultiple, RequestDeriveCreateV3, RequestDeriveValidateV2, RequestEarlyValidateYield, RequestEarningImpact, RequestExportAccountProxyMnemonic, RequestGetAllTonWalletContractVersion, RequestGetAmountForPair, RequestGetDeriveAccounts, RequestGetDeriveSuggestion, RequestGetTokensCanPayFee, RequestGetYieldPoolTargets, RequestInputAccountSubscribe, RequestJsonGetAccountInfo, RequestJsonRestoreV2, RequestMetadataHash, RequestMnemonicCreateV2, RequestMnemonicValidateV2, RequestPrivateKeyValidateV2, RequestShortenMetadata, RequestStakeCancelWithdrawal, RequestStakeClaimReward, RequestSubmitProcessTransaction, RequestSubscribeProcessById, RequestTransfer, RequestUnlockDotCheckCanMint, RequestUnlockDotSubscribeMintedData, RequestYieldLeave, RequestYieldStepSubmit, RequestYieldWithdrawal, ResponseAccountBatchExportV2, ResponseAccountCreateSuriV2, ResponseAccountNameValidate, ResponseBatchJsonGetAccountInfo, ResponseCheckPublicAndSecretKey, ResponseDeriveValidateV2, ResponseEarlyValidateYield, ResponseExportAccountProxyMnemonic, ResponseGetAllTonWalletContractVersion, ResponseGetDeriveAccounts, ResponseGetDeriveSuggestion, ResponseGetYieldPoolTargets, ResponseInputAccountSubscribe, ResponseJsonGetAccountInfo, ResponseMetadataHash, ResponseMnemonicCreateV2, ResponseMnemonicValidateV2, ResponsePrivateKeyValidateV2, ResponseShortenMetadata, ResponseSubscribeProcessAlive, ResponseSubscribeProcessById, StorageDataInterface, SubmitChangeValidatorStaking, SubmitYieldJoinData, SubmitYieldStepData, SubnetYieldPositionInfo, SwapPair, SwapQuoteResponse, SwapRequest, SwapRequestResult, SwapRequestV2, SwapSubmitParams, SwapTxData, TokenSpendingApprovalParams, UnlockDotTransactionNft, UnstakingStatus, ValidateSwapProcessParams, ValidateYieldProcessParams, YieldPoolInfo, YieldPoolType, YieldPositionInfo } from '@subwallet/extension-base/types';
20
+ import { AccountChainType, AccountJson, AccountsWithCurrentAddress, AddressJson, BalanceJson, BalanceType, BaseRequestSign, BuyServiceInfo, BuyTokenInfo, CommonOptimalTransferPath, CurrentAccountInfo, EarningRewardHistoryItem, EarningRewardJson, EarningStatus, HandleSubstrateProxyWrappedTxResponse, HandleYieldStepParams, InternalRequestSign, LeavePoolAdditionalData, NominationPoolInfo, OptimalYieldPath, OptimalYieldPathParams, RequestAccountBatchExportV2, RequestAccountCreateSuriV2, RequestAccountNameValidate, RequestAccountProxyEdit, RequestAccountProxyForget, RequestBatchJsonGetAccountInfo, RequestBatchRestoreV2, RequestBounceableValidate, RequestChangeAllowOneSign, RequestChangeTonWalletContractVersion, RequestCheckCrossChainTransfer, RequestCheckPublicAndSecretKey, RequestCheckTransfer, RequestCrossChainTransfer, RequestDeriveCreateMultiple, RequestDeriveCreateV3, RequestDeriveValidateV2, RequestEarlyValidateYield, RequestEarningImpact, RequestExportAccountProxyMnemonic, RequestGetAllTonWalletContractVersion, RequestGetAmountForPair, RequestGetDeriveAccounts, RequestGetDeriveSuggestion, RequestGetTokensCanPayFee, RequestGetYieldPoolTargets, RequestInputAccountSubscribe, RequestJsonGetAccountInfo, RequestJsonRestoreV2, RequestMetadataHash, RequestMnemonicCreateV2, RequestMnemonicValidateV2, RequestPrivateKeyValidateV2, RequestShortenMetadata, RequestStakeCancelWithdrawal, RequestStakeClaimReward, RequestSubmitProcessTransaction, RequestSubscribeProcessById, RequestTransfer, RequestUnlockDotCheckCanMint, RequestUnlockDotSubscribeMintedData, RequestYieldLeave, RequestYieldStepSubmit, RequestYieldWithdrawal, ResponseAccountBatchExportV2, ResponseAccountCreateSuriV2, ResponseAccountNameValidate, ResponseBatchJsonGetAccountInfo, ResponseCheckPublicAndSecretKey, ResponseDeriveValidateV2, ResponseEarlyValidateYield, ResponseExportAccountProxyMnemonic, ResponseGetAllTonWalletContractVersion, ResponseGetDeriveAccounts, ResponseGetDeriveSuggestion, ResponseGetYieldPoolTargets, ResponseInputAccountSubscribe, ResponseJsonGetAccountInfo, ResponseMetadataHash, ResponseMnemonicCreateV2, ResponseMnemonicValidateV2, ResponsePrivateKeyValidateV2, ResponseShortenMetadata, ResponseSubscribeProcessAlive, ResponseSubscribeProcessById, StorageDataInterface, SubmitChangeValidatorStaking, SubmitYieldJoinData, SubmitYieldStepData, SubnetYieldPositionInfo, SwapPair, SwapQuoteResponse, SwapRequest, SwapRequestResult, SwapRequestV2, SwapSubmitParams, SwapTxData, TokenSpendingApprovalParams, UnlockDotTransactionNft, UnstakingStatus, ValidateSwapProcessParams, ValidateYieldProcessParams, YieldPoolInfo, YieldPoolType, YieldPositionInfo } from '@subwallet/extension-base/types';
20
21
  import { RequestSubmitSignPsbtTransfer, RequestSubmitTransfer, RequestSubmitTransferWithId, RequestSubscribeTransfer, ResponseSubscribeTransfer, ResponseSubscribeTransferConfirmation } from '@subwallet/extension-base/types/balance/transfer';
21
22
  import { RequestClaimBridge } from '@subwallet/extension-base/types/bridge';
22
- import { GetNotificationParams, RequestIsClaimedPolygonBridge, RequestSwitchStatusParams } from '@subwallet/extension-base/types/notification';
23
+ import { ApprovePendingTxRequest, CancelPendingTxRequest, ExecutePendingTxRequest, InitMultisigTxRequest, InitMultisigTxResponse, RequestGetSignableAccountInfos, ResponseGetSignableAccountInfos } from '@subwallet/extension-base/types/multisig';
24
+ import { GetNotificationParams, MarkAllReadParams, RequestIsClaimedPolygonBridge, RequestSwitchStatusParams } from '@subwallet/extension-base/types/notification';
23
25
  import { InjectedAccount, InjectedAccountWithMeta, MetadataDefBase } from '@subwallet/extension-inject/types';
24
26
  import { BitcoinAddressType, KeyringPair$Meta } from '@subwallet/keyring/types';
25
27
  import { KeyringOptions } from '@subwallet/ui-keyring/options/types';
@@ -35,7 +37,7 @@ import { SignerResult } from '@polkadot/types/types/extrinsic';
35
37
  import { HexString } from '@polkadot/util/types';
36
38
  import { EarningImpactResult } from '../services/earning-service/handlers/native-staking/dtao';
37
39
  import { GovVoteRequest, GovVotingInfo, RemoveVoteRequest, UnlockVoteRequest } from '../services/open-gov/interface';
38
- import { RequestAddSubstrateProxyAccount, RequestGetSubstrateProxyAccountGroup, RequestRemoveSubstrateProxyAccount, SubstrateProxyAccountGroup } from '../types/substrateProxyAccount';
40
+ import { HandleSubstrateProxyWrappedTxRequest, RequestAddSubstrateProxyAccount, RequestGetSubstrateProxyAccountGroup, RequestRemoveSubstrateProxyAccount, SubstrateProxyAccountGroup } from '../types/substrateProxyAccount';
39
41
  import { TransactionWarning } from './warnings/TransactionWarning';
40
42
  export declare enum RuntimeEnvironment {
41
43
  Web = "Web",
@@ -452,9 +454,14 @@ export declare enum ExtrinsicType {
452
454
  GOV_VOTE = "gov.vote",
453
455
  GOV_UNVOTE = "gov.unvote",
454
456
  GOV_UNLOCK_VOTE = "gov.unlock_vote",
457
+ MULTISIG_APPROVE_TX = "multisig.approve",
458
+ MULTISIG_CANCEL_TX = "multisig.cancel",
459
+ MULTISIG_EXECUTE_TX = "multisig.execute",
460
+ MULTISIG_INIT_TX = "multisig.init",
455
461
  EVM_EXECUTE = "evm.execute",
456
462
  ADD_SUBSTRATE_PROXY_ACCOUNT = "substrateProxyAccount.add",
457
463
  REMOVE_SUBSTRATE_PROXY_ACCOUNT = "substrateProxyAccount.remove",
464
+ SUBSTRATE_PROXY_INIT_TX = "substrateProxyAccount.initTx",
458
465
  UNKNOWN = "unknown"
459
466
  }
460
467
  export interface ExtrinsicDataTypeMap {
@@ -497,12 +504,16 @@ export interface ExtrinsicDataTypeMap {
497
504
  [ExtrinsicType.CLAIM_BRIDGE]: RequestClaimBridge;
498
505
  [ExtrinsicType.EVM_EXECUTE]: TransactionConfig;
499
506
  [ExtrinsicType.CROWDLOAN]: any;
500
- [ExtrinsicType.SWAP]: SwapTxData;
501
507
  [ExtrinsicType.GOV_VOTE]: GovVoteRequest;
502
508
  [ExtrinsicType.GOV_UNVOTE]: RemoveVoteRequest;
503
509
  [ExtrinsicType.GOV_UNLOCK_VOTE]: UnlockVoteRequest;
510
+ [ExtrinsicType.MULTISIG_APPROVE_TX]: ApprovePendingTxRequest;
511
+ [ExtrinsicType.MULTISIG_EXECUTE_TX]: ExecutePendingTxRequest;
512
+ [ExtrinsicType.MULTISIG_CANCEL_TX]: CancelPendingTxRequest;
513
+ [ExtrinsicType.MULTISIG_INIT_TX]: InitMultisigTxRequest & InitMultisigTxResponse;
504
514
  [ExtrinsicType.ADD_SUBSTRATE_PROXY_ACCOUNT]: RequestAddSubstrateProxyAccount;
505
515
  [ExtrinsicType.REMOVE_SUBSTRATE_PROXY_ACCOUNT]: RequestRemoveSubstrateProxyAccount;
516
+ [ExtrinsicType.SUBSTRATE_PROXY_INIT_TX]: HandleSubstrateProxyWrappedTxRequest & HandleSubstrateProxyWrappedTxResponse;
506
517
  [ExtrinsicType.SWAP]: SwapTxData;
507
518
  [ExtrinsicType.UNKNOWN]: any;
508
519
  }
@@ -688,6 +699,23 @@ export interface RequestAccountCreateHardwareV2 extends CreateHardwareAccountIte
688
699
  export interface RequestAccountCreateHardwareMultiple {
689
700
  accounts: CreateHardwareAccountItem[];
690
701
  }
702
+ export interface RequestAccountCreateMultisig {
703
+ signers: string[];
704
+ threshold: number;
705
+ name: string;
706
+ }
707
+ export declare enum AccountMultisigErrorCode {
708
+ INVALID_FILLED_ADDRESS = "invalidFilledAddress",
709
+ INVALID_FILLED_THRESHOLD = "invalidFilledThreshold",
710
+ DUPLICATE_FILLED_ADDRESS = "duplicateFilledAddress",
711
+ INVALID_ADDRESS = "invalidAddress",
712
+ INVALID_NAME = "invalidName",
713
+ KEYRING_ERROR = "keyringError"
714
+ }
715
+ export interface AccountMultisigError {
716
+ code: AccountMultisigErrorCode;
717
+ message: string;
718
+ }
691
719
  export interface RequestAccountCreateWithSecretKey {
692
720
  publicKey: string;
693
721
  secretKey: string;
@@ -1889,6 +1917,7 @@ export interface KoniRequestSignatures {
1889
1917
  'pri(accounts.create.hardwareV2)': [RequestAccountCreateHardwareV2, boolean];
1890
1918
  'pri(accounts.create.hardwareMultiple)': [RequestAccountCreateHardwareMultiple, boolean];
1891
1919
  'pri(accounts.create.withSecret)': [RequestAccountCreateWithSecretKey, ResponseAccountCreateWithSecretKey];
1920
+ 'pri(accounts.create.multisig)': [RequestAccountCreateMultisig, AccountMultisigError[]];
1892
1921
  'pri(accounts.inject.add)': [RequestAddInjectedAccounts, boolean];
1893
1922
  'pri(accounts.inject.remove)': [RequestRemoveInjectedAccounts, boolean];
1894
1923
  'pri(accounts.json.info)': [RequestJsonGetAccountInfo, ResponseJsonGetAccountInfo];
@@ -2084,7 +2113,7 @@ export interface KoniRequestSignatures {
2084
2113
  'pri(swapService.getLatestQuote)': [SwapRequest, SwapQuoteResponse];
2085
2114
  'pri(swapService.validateSwapProcess)': [ValidateSwapProcessParams, TransactionError[]];
2086
2115
  'pri(inappNotification.subscribeUnreadNotificationCountMap)': [null, Record<string, number>, Record<string, number>];
2087
- 'pri(inappNotification.markAllReadNotification)': [string, null];
2116
+ 'pri(inappNotification.markAllReadNotification)': [MarkAllReadParams, null];
2088
2117
  'pri(inappNotification.switchReadNotificationStatus)': [RequestSwitchStatusParams, null];
2089
2118
  'pri(inappNotification.fetch)': [GetNotificationParams, _NotificationInfo[]];
2090
2119
  'pri(inappNotification.get)': [string, _NotificationInfo];
@@ -2103,9 +2132,17 @@ export interface KoniRequestSignatures {
2103
2132
  'pri(openGov.unvote)': [RemoveVoteRequest, SWTransactionResponse];
2104
2133
  'pri(openGov.subscribeGovLockedInfo)': [null, GovVotingInfo[], GovVotingInfo[]];
2105
2134
  'pri(openGov.unlockVote)': [UnlockVoteRequest, SWTransactionResponse];
2135
+ 'pri(multisig.subscribePendingMultisigTxs)': [null, PendingMultisigTxMap, PendingMultisigTxMap];
2136
+ 'pri(multisig.getPendingMultisigTxs)': [RequestGetPendingTxs, PendingMultisigTx[]];
2137
+ 'pri(multisig.approvePendingTx)': [ApprovePendingTxRequest, SWTransactionResponse];
2138
+ 'pri(multisig.executePendingTx)': [ExecutePendingTxRequest, SWTransactionResponse];
2139
+ 'pri(multisig.cancelPendingTx)': [CancelPendingTxRequest, SWTransactionResponse];
2140
+ 'pri(multisig.getSignableAccountInfos)': [RequestGetSignableAccountInfos, ResponseGetSignableAccountInfos];
2141
+ 'pri(multisig.initMultisigTx)': [InitMultisigTxRequest, SWTransactionResponse];
2106
2142
  'pri(substrateProxyAccount.getGroupInfo)': [RequestGetSubstrateProxyAccountGroup, SubstrateProxyAccountGroup];
2107
2143
  'pri(substrateProxyAccount.add)': [RequestAddSubstrateProxyAccount, SWTransactionResponse];
2108
2144
  'pri(substrateProxyAccount.remove)': [RequestRemoveSubstrateProxyAccount, SWTransactionResponse];
2145
+ 'pri(substrateProxyAccount.handleProxyWrappedTx)': [HandleSubstrateProxyWrappedTxRequest, SWTransactionResponse];
2109
2146
  }
2110
2147
  export interface ApplicationMetadataType {
2111
2148
  version: string;
@@ -118,9 +118,14 @@ export let ExtrinsicType;
118
118
  ExtrinsicType["GOV_VOTE"] = "gov.vote";
119
119
  ExtrinsicType["GOV_UNVOTE"] = "gov.unvote";
120
120
  ExtrinsicType["GOV_UNLOCK_VOTE"] = "gov.unlock_vote";
121
+ ExtrinsicType["MULTISIG_APPROVE_TX"] = "multisig.approve";
122
+ ExtrinsicType["MULTISIG_CANCEL_TX"] = "multisig.cancel";
123
+ ExtrinsicType["MULTISIG_EXECUTE_TX"] = "multisig.execute";
124
+ ExtrinsicType["MULTISIG_INIT_TX"] = "multisig.init";
121
125
  ExtrinsicType["EVM_EXECUTE"] = "evm.execute";
122
126
  ExtrinsicType["ADD_SUBSTRATE_PROXY_ACCOUNT"] = "substrateProxyAccount.add";
123
127
  ExtrinsicType["REMOVE_SUBSTRATE_PROXY_ACCOUNT"] = "substrateProxyAccount.remove";
128
+ ExtrinsicType["SUBSTRATE_PROXY_INIT_TX"] = "substrateProxyAccount.initTx";
124
129
  ExtrinsicType["UNKNOWN"] = "unknown";
125
130
  })(ExtrinsicType || (ExtrinsicType = {}));
126
131
  export let ExtrinsicStatus;
@@ -168,7 +173,15 @@ export let AccountExternalErrorCode;
168
173
  AccountExternalErrorCode["UNKNOWN_ERROR"] = "unknownError";
169
174
  })(AccountExternalErrorCode || (AccountExternalErrorCode = {})); // Attach QR-signer account
170
175
  // Attach Ledger account
171
- // Restore account with public and secret key
176
+ export let AccountMultisigErrorCode;
177
+ (function (AccountMultisigErrorCode) {
178
+ AccountMultisigErrorCode["INVALID_FILLED_ADDRESS"] = "invalidFilledAddress";
179
+ AccountMultisigErrorCode["INVALID_FILLED_THRESHOLD"] = "invalidFilledThreshold";
180
+ AccountMultisigErrorCode["DUPLICATE_FILLED_ADDRESS"] = "duplicateFilledAddress";
181
+ AccountMultisigErrorCode["INVALID_ADDRESS"] = "invalidAddress";
182
+ AccountMultisigErrorCode["INVALID_NAME"] = "invalidName";
183
+ AccountMultisigErrorCode["KEYRING_ERROR"] = "keyringError";
184
+ })(AccountMultisigErrorCode || (AccountMultisigErrorCode = {})); // Restore account with public and secret key
172
185
  // Subscribe Address Book
173
186
  // Inject account
174
187
  /// Sign Transaction
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WalletUnlockType = exports.TransactionDirection = exports.ThemeNames = exports.StakingType = exports.RuntimeEnvironment = exports.RMRK_VER = exports.ProviderErrorType = exports.POLKADOT_LEDGER_SCHEME = exports.NotificationType = exports.NETWORK_STATUS = exports.MobileOS = exports.MantaPayEnableMessage = exports.ExtrinsicType = exports.ExtrinsicStatus = exports.ExternalRequestPromiseStatus = exports.EvmProviderErrorType = exports.CrowdloanParaState = exports.ContractType = exports.ChainType = exports.CardanoProviderErrorType = exports.CampaignDataType = exports.BitcoinProviderErrorType = exports.BalanceErrorType = exports.AssetHubNftType = exports.AccountExternalErrorCode = exports.APIItemState = void 0;
6
+ exports.WalletUnlockType = exports.TransactionDirection = exports.ThemeNames = exports.StakingType = exports.RuntimeEnvironment = exports.RMRK_VER = exports.ProviderErrorType = exports.POLKADOT_LEDGER_SCHEME = exports.NotificationType = exports.NETWORK_STATUS = exports.MobileOS = exports.MantaPayEnableMessage = exports.ExtrinsicType = exports.ExtrinsicStatus = exports.ExternalRequestPromiseStatus = exports.EvmProviderErrorType = exports.CrowdloanParaState = exports.ContractType = exports.ChainType = exports.CardanoProviderErrorType = exports.CampaignDataType = exports.BitcoinProviderErrorType = exports.BalanceErrorType = exports.AssetHubNftType = exports.AccountMultisigErrorCode = exports.AccountExternalErrorCode = exports.APIItemState = void 0;
7
7
  // Copyright 2019-2022 @polkadot/extension-koni authors & contributors
8
8
  // SPDX-License-Identifier: Apache-2.0
9
9
  let RuntimeEnvironment;
@@ -133,9 +133,14 @@ exports.ExtrinsicType = ExtrinsicType;
133
133
  ExtrinsicType["GOV_VOTE"] = "gov.vote";
134
134
  ExtrinsicType["GOV_UNVOTE"] = "gov.unvote";
135
135
  ExtrinsicType["GOV_UNLOCK_VOTE"] = "gov.unlock_vote";
136
+ ExtrinsicType["MULTISIG_APPROVE_TX"] = "multisig.approve";
137
+ ExtrinsicType["MULTISIG_CANCEL_TX"] = "multisig.cancel";
138
+ ExtrinsicType["MULTISIG_EXECUTE_TX"] = "multisig.execute";
139
+ ExtrinsicType["MULTISIG_INIT_TX"] = "multisig.init";
136
140
  ExtrinsicType["EVM_EXECUTE"] = "evm.execute";
137
141
  ExtrinsicType["ADD_SUBSTRATE_PROXY_ACCOUNT"] = "substrateProxyAccount.add";
138
142
  ExtrinsicType["REMOVE_SUBSTRATE_PROXY_ACCOUNT"] = "substrateProxyAccount.remove";
143
+ ExtrinsicType["SUBSTRATE_PROXY_INIT_TX"] = "substrateProxyAccount.initTx";
139
144
  ExtrinsicType["UNKNOWN"] = "unknown";
140
145
  })(ExtrinsicType || (exports.ExtrinsicType = ExtrinsicType = {}));
141
146
  let ExtrinsicStatus;
@@ -183,7 +188,16 @@ exports.AccountExternalErrorCode = AccountExternalErrorCode;
183
188
  AccountExternalErrorCode["UNKNOWN_ERROR"] = "unknownError";
184
189
  })(AccountExternalErrorCode || (exports.AccountExternalErrorCode = AccountExternalErrorCode = {})); // Attach QR-signer account
185
190
  // Attach Ledger account
186
- // Restore account with public and secret key
191
+ let AccountMultisigErrorCode;
192
+ exports.AccountMultisigErrorCode = AccountMultisigErrorCode;
193
+ (function (AccountMultisigErrorCode) {
194
+ AccountMultisigErrorCode["INVALID_FILLED_ADDRESS"] = "invalidFilledAddress";
195
+ AccountMultisigErrorCode["INVALID_FILLED_THRESHOLD"] = "invalidFilledThreshold";
196
+ AccountMultisigErrorCode["DUPLICATE_FILLED_ADDRESS"] = "duplicateFilledAddress";
197
+ AccountMultisigErrorCode["INVALID_ADDRESS"] = "invalidAddress";
198
+ AccountMultisigErrorCode["INVALID_NAME"] = "invalidName";
199
+ AccountMultisigErrorCode["KEYRING_ERROR"] = "keyringError";
200
+ })(AccountMultisigErrorCode || (exports.AccountMultisigErrorCode = AccountMultisigErrorCode = {})); // Restore account with public and secret key
187
201
  // Subscribe Address Book
188
202
  // Inject account
189
203
  /// Sign Transaction
@@ -26,7 +26,8 @@ var _constants2 = require("@subwallet/extension-base/services/chain-service/cons
26
26
  var _utils3 = require("@subwallet/extension-base/services/chain-service/utils");
27
27
  var _utils4 = require("@subwallet/extension-base/services/fee-service/utils");
28
28
  var _helpers = require("@subwallet/extension-base/services/transaction-service/helpers");
29
- var _types = require("@subwallet/extension-base/types");
29
+ var _types = require("@subwallet/extension-base/services/transaction-service/types");
30
+ var _types2 = require("@subwallet/extension-base/types");
30
31
  var _utils5 = require("@subwallet/extension-base/utils");
31
32
  var _keyring = require("@subwallet/keyring");
32
33
  var _uiKeyring = require("@subwallet/ui-keyring");
@@ -41,20 +42,20 @@ function validateTransferRequest(tokenInfo, from, to, value, transferAll) {
41
42
  const errors = [];
42
43
  if (!transferAll) {
43
44
  if (value === undefined) {
44
- errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.transferAmountRequired')));
45
+ errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.transferAmountRequired')));
45
46
  }
46
47
  }
47
48
  if (!tokenInfo) {
48
- errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.tokenNotFoundInRegistry')));
49
+ errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.tokenNotFoundInRegistry')));
49
50
  }
50
51
  if ((0, _utilCrypto.isEthereumAddress)(from) && (0, _utilCrypto.isEthereumAddress)(to) && (0, _utils3._isTokenEvmSmartContract)(tokenInfo) && (0, _utils3._getContractAddressOfToken)(tokenInfo).length === 0) {
51
- errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.erc20AddressNotFound')));
52
+ errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.erc20AddressNotFound')));
52
53
  }
53
54
  if ((0, _keyring.isTonAddress)(from) && (0, _keyring.isTonAddress)(to) && (0, _utils3._isTokenTonSmartContract)(tokenInfo) && (0, _utils3._getContractAddressOfToken)(tokenInfo).length === 0) {
54
- errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.tep74AddressNotFound')));
55
+ errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.tep74AddressNotFound')));
55
56
  }
56
57
  if ((0, _keyring.isCardanoAddress)(from) && (0, _keyring.isCardanoAddress)(to) && (0, _utils3._isCIP26Token)(tokenInfo) && (0, _utils.getCardanoAssetId)(tokenInfo).length === 0) {
57
- errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.policyIdNotFound')));
58
+ errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.policyIdNotFound')));
58
59
  }
59
60
  return errors;
60
61
  }
@@ -72,7 +73,7 @@ function additionalValidateTransferForRecipient(sendingTokenInfo, nativeTokenInf
72
73
  const minXCMStr = (0, _utils5.formatNumber)(sendingTokenMinAmountXCM.toString(), (0, _utils3._getAssetDecimals)(sendingTokenInfo), _utils5.balanceFormatter, {
73
74
  maxNumberFormat: (0, _utils3._getAssetDecimals)(sendingTokenInfo) || 6
74
75
  });
75
- const error = new _TransactionError.TransactionError(_types.TransferTxErrorType.NOT_ENOUGH_VALUE, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.transferMinimumToKeepAccountAlive', {
76
+ const error = new _TransactionError.TransactionError(_types2.TransferTxErrorType.NOT_ENOUGH_VALUE, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.transferMinimumToKeepAccountAlive', {
76
77
  replace: {
77
78
  amount: minXCMStr,
78
79
  symbol: sendingTokenInfo.symbol
@@ -82,14 +83,14 @@ function additionalValidateTransferForRecipient(sendingTokenInfo, nativeTokenInf
82
83
  }
83
84
  if (!(0, _utils3._isNativeToken)(sendingTokenInfo)) {
84
85
  if (!remainingSendingTokenOfSenderEnoughED) {
85
- const warning = new _TransactionWarning.TransactionWarning(_types.BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT);
86
+ const warning = new _TransactionWarning.TransactionWarning(_types2.BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT);
86
87
  warnings.push(warning);
87
88
  }
88
89
  if (!isReceiverAliveByNativeToken && !isSendingTokenSufficient) {
89
90
  const balanceKeepAlive = (0, _utils5.formatNumber)(nativeTokenMinAmount, (0, _utils3._getAssetDecimals)(nativeTokenInfo), _utils5.balanceFormatter, {
90
91
  maxNumberFormat: (0, _utils3._getAssetDecimals)(nativeTokenInfo) || 6
91
92
  });
92
- const error = new _TransactionError.TransactionError(_types.TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.recipientBalanceTooLow', {
93
+ const error = new _TransactionError.TransactionError(_types2.TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.recipientBalanceTooLow', {
93
94
  replace: {
94
95
  amount: balanceKeepAlive,
95
96
  nativeSymbol: nativeTokenInfo.symbol,
@@ -103,7 +104,7 @@ function additionalValidateTransferForRecipient(sendingTokenInfo, nativeTokenInf
103
104
  const atLeastStr = (0, _utils5.formatNumber)(atLeast.toString(), (0, _utils3._getAssetDecimals)(sendingTokenInfo), _utils5.balanceFormatter, {
104
105
  maxNumberFormat: (0, _utils3._getAssetDecimals)(sendingTokenInfo) || 6
105
106
  });
106
- const error = new _TransactionError.TransactionError(_types.TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.transferMinimumToAvoidFundLoss', {
107
+ const error = new _TransactionError.TransactionError(_types2.TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.transferMinimumToAvoidFundLoss', {
107
108
  replace: {
108
109
  amount: atLeastStr,
109
110
  symbol: sendingTokenInfo.symbol
@@ -117,7 +118,7 @@ function additionalValidateTransferForRecipient(sendingTokenInfo, nativeTokenInf
117
118
  const atLeastStr = (0, _utils5.formatNumber)(atLeast.toString(), (0, _utils3._getAssetDecimals)(sendingTokenInfo), _utils5.balanceFormatter, {
118
119
  maxNumberFormat: (0, _utils3._getAssetDecimals)(sendingTokenInfo) || 6
119
120
  });
120
- const error = new _TransactionError.TransactionError(_types.TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.transferMinimumToKeepAccountAlive', {
121
+ const error = new _TransactionError.TransactionError(_types2.TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.transferMinimumToKeepAccountAlive', {
121
122
  replace: {
122
123
  amount: atLeastStr,
123
124
  symbol: sendingTokenInfo.symbol
@@ -133,7 +134,7 @@ function validateXcmTransferRequest(destTokenInfo, sender, sendingValue) {
133
134
  const errors = [];
134
135
  const keypair = _uiKeyring.keyring.getPair(sender);
135
136
  if (!destTokenInfo) {
136
- errors.push(new _TransactionError.TransactionError(_types.TransferTxErrorType.INVALID_TOKEN, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.tokenNotFoundInRegistry')));
137
+ errors.push(new _TransactionError.TransactionError(_types2.TransferTxErrorType.INVALID_TOKEN, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.tokenNotFoundInRegistry')));
137
138
  }
138
139
  return [errors, keypair];
139
140
  }
@@ -142,7 +143,7 @@ function checkSupportForFeature(validationResponse, blockedFeaturesList, chainIn
142
143
  const chain = validationResponse.chain;
143
144
  const currentFeature = `${extrinsicType}___${chain}`;
144
145
  if (blockedFeaturesList.includes(currentFeature)) {
145
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.UNSUPPORTED, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureUnderMaintenanceOnNetwork', {
146
+ validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNSUPPORTED, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureUnderMaintenanceOnNetwork', {
146
147
  replace: {
147
148
  chainInfoName: chainInfo.name
148
149
  }
@@ -309,7 +310,7 @@ function checkSupportForAction(validationResponse, blockedActionsMap) {
309
310
  }
310
311
  const blockedActionsList = Object.values(blockedActionsMap).flat();
311
312
  if (blockedActionsList.includes(currentAction)) {
312
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.UNSUPPORTED, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureUnderMaintenance')));
313
+ validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNSUPPORTED, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureUnderMaintenance')));
313
314
  }
314
315
  }
315
316
 
@@ -320,13 +321,13 @@ function checkSupportForTransaction(validationResponse, transaction) {
320
321
  } = validationResponse;
321
322
  if (!transaction) {
322
323
  if (extrinsicType === _KoniTypes.ExtrinsicType.SEND_NFT) {
323
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.UNSUPPORTED, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForNft')));
324
+ validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNSUPPORTED, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForNft')));
324
325
  } else {
325
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.UNSUPPORTED));
326
+ validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNSUPPORTED));
326
327
  }
327
328
  }
328
329
  }
329
- async function estimateFeeForTransaction(validationResponse, transaction, chainInfo, evmApi, substrateApi, priceMap, feeInfo, nativeTokenInfo, nonNativeTokenPayFeeInfo, isTransferLocalTokenAndPayThatTokenAsFee, signerSubstrateProxyAddress) {
330
+ async function estimateFeeForTransaction(validationResponse, transaction, chainInfo, evmApi, substrateApi, priceMap, feeInfo, nativeTokenInfo, nonNativeTokenPayFeeInfo, isTransferLocalTokenAndPayThatTokenAsFee) {
330
331
  const estimateFee = {
331
332
  symbol: '',
332
333
  decimals: 0,
@@ -347,14 +348,8 @@ async function estimateFeeForTransaction(validationResponse, transaction, chainI
347
348
  if (transaction) {
348
349
  try {
349
350
  if ((0, _helpers.isSubstrateTransaction)(transaction)) {
350
- if (signerSubstrateProxyAddress && !(0, _utils5.isSameAddress)(signerSubstrateProxyAddress, address)) {
351
- await substrateApi.isReady;
352
- const estimateExtrinsic = substrateApi.api.tx.proxy.proxy(address, null, transaction);
353
- estimateFee.value = (await estimateExtrinsic.paymentInfo(signerSubstrateProxyAddress)).partialFee.toString();
354
- } else {
355
- var _validationResponse$x;
356
- estimateFee.value = (_validationResponse$x = validationResponse.xcmFeeDryRun) !== null && _validationResponse$x !== void 0 ? _validationResponse$x : (await transaction.paymentInfo(validationResponse.address)).partialFee.toString();
357
- }
351
+ var _validationResponse$x;
352
+ estimateFee.value = (_validationResponse$x = validationResponse.xcmFeeDryRun) !== null && _validationResponse$x !== void 0 ? _validationResponse$x : (await transaction.paymentInfo(validationResponse.address)).partialFee.toString();
358
353
  } else if ((0, _helpers.isTonTransaction)(transaction)) {
359
354
  estimateFee.value = transaction.estimateFee; // todo: might need to update logic estimate fee inside for future actions excluding normal transfer Ton and Jetton
360
355
  } else if ((0, _helpers.isCardanoTransaction)(transaction)) {
@@ -395,7 +390,7 @@ async function estimateFeeForTransaction(validationResponse, transaction, chainI
395
390
  } catch (e) {
396
391
  const error = e;
397
392
  if (error.message.includes('gas required exceeds allowance') && error.message.includes('insufficient funds')) {
398
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_BALANCE));
393
+ validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.NOT_ENOUGH_BALANCE));
399
394
  }
400
395
  }
401
396
  }
@@ -429,25 +424,25 @@ function checkSigningAccountForTransaction(validationResponse, chainInfoMap, sig
429
424
  } = validationResponse;
430
425
  const pair = _uiKeyring.keyring.getPair(signer);
431
426
  if (!pair) {
432
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INTERNAL_ERROR, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.unableToFindAccount')));
427
+ validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.INTERNAL_ERROR, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.unableToFindAccount')));
433
428
  } else {
434
429
  const accountJson = (0, _utils5.pairToAccount)(pair, chainInfoMap);
435
430
  if (!accountJson.transactionActions.includes(extrinsicType)) {
436
431
  // check if the account can sign the transaction type
437
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForAccount')));
432
+ validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForAccount')));
438
433
  } else if (accountJson.specialChain && accountJson.specialChain !== chain) {
439
434
  // check if the account can only be used on a specific chain (for ledger legacy)
440
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForAccount')));
435
+ validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForAccount')));
441
436
  } else {
442
- const compatibleMap = [_types.AccountSignMode.LEGACY_LEDGER, _types.AccountSignMode.GENERIC_LEDGER].includes(accountJson.signMode) ? _constants.LEDGER_SIGNING_COMPATIBLE_MAP : _constants.SIGNING_COMPATIBLE_MAP;
437
+ const compatibleMap = [_types2.AccountSignMode.LEGACY_LEDGER, _types2.AccountSignMode.GENERIC_LEDGER].includes(accountJson.signMode) ? _constants.LEDGER_SIGNING_COMPATIBLE_MAP : _constants.SIGNING_COMPATIBLE_MAP;
443
438
  if (!compatibleMap[chainType].includes(accountJson.chainType)) {
444
439
  // check if the account chain type is compatible with the transaction chain type
445
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForAccount')));
440
+ validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.INVALID_PARAMS, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.featureNotAvailableForAccount')));
446
441
  }
447
442
  }
448
443
  }
449
444
  }
450
- function checkBalanceWithTransactionFee(validationResponse, transactionInput, nativeTokenInfo, nativeTokenAvailable, substrateProxyAccountNativeTokenAvailable) {
445
+ function checkBalanceWithTransactionFee(validationResponse, transactionInput, nativeTokenInfo, nativeTokenAvailable) {
451
446
  if (!validationResponse.estimateFee) {
452
447
  // todo: estimateFee should be must-have, need to refactor interface
453
448
  return;
@@ -456,10 +451,10 @@ function checkBalanceWithTransactionFee(validationResponse, transactionInput, na
456
451
  edAsWarning,
457
452
  extrinsicType,
458
453
  isTransferAll,
459
- signerSubstrateProxyAddress,
460
454
  skipFeeValidation,
461
455
  tokenPayFeeSlug
462
456
  } = transactionInput;
457
+ const isWrappable = validationResponse.wrappingStatus === _types.SubstrateTransactionWrappingStatus.WRAPPABLE;
463
458
  if (skipFeeValidation || tokenPayFeeSlug && !(0, _utils3._isNativeTokenBySlug)(tokenPayFeeSlug)) {
464
459
  // todo: need improve: input should be balance of fee token and check this again
465
460
  return;
@@ -467,36 +462,19 @@ function checkBalanceWithTransactionFee(validationResponse, transactionInput, na
467
462
  const bnFee = new _bignumber.default(validationResponse.estimateFee.value);
468
463
  const bnNativeTokenAvailable = new _bignumber.default(nativeTokenAvailable.value);
469
464
  const bnNativeTokenTransferAmount = new _bignumber.default(validationResponse.transferNativeAmount || '0');
470
- if (!bnNativeTokenAvailable.gt(0) && !substrateProxyAccountNativeTokenAvailable) {
471
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_BALANCE));
465
+ if (!bnNativeTokenAvailable.gt(0) && !isWrappable) {
466
+ validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.NOT_ENOUGH_BALANCE));
472
467
  }
473
468
  const isChainNotSupportTransferAll = [..._constants2._TRANSFER_CHAIN_GROUP.acala, ..._constants2._TRANSFER_CHAIN_GROUP.genshiro, ..._constants2._TRANSFER_CHAIN_GROUP.bitcountry, ..._constants2._TRANSFER_CHAIN_GROUP.statemine].includes(nativeTokenInfo.originChain);
474
- if (!substrateProxyAccountNativeTokenAvailable) {
475
- if (bnNativeTokenTransferAmount.plus(bnFee).gt(bnNativeTokenAvailable) && (!isTransferAll || isChainNotSupportTransferAll)) {
476
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_BALANCE)); // todo: should be generalized and reused in all features
477
- }
478
- } else {
479
- const bnSubstrateProxyAccountNativeTokenAvailable = new _bignumber.default(substrateProxyAccountNativeTokenAvailable.value);
480
- if (bnNativeTokenTransferAmount.gt(bnNativeTokenAvailable) && (!isTransferAll || isChainNotSupportTransferAll) || bnFee.gt(bnSubstrateProxyAccountNativeTokenAvailable)) {
481
- if (signerSubstrateProxyAddress) {
482
- const account = (0, _utils5.getAccountJsonByAddress)(signerSubstrateProxyAddress);
483
- const accountName = account === null || account === void 0 ? void 0 : account.name;
484
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_BALANCE, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.proxyAccountNotEnoughBalance', {
485
- replace: {
486
- accountName: accountName || signerSubstrateProxyAddress
487
- }
488
- })));
489
- } else {
490
- validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_BALANCE));
491
- }
492
- }
469
+ if (bnNativeTokenTransferAmount.plus(isWrappable ? '0' : bnFee).gt(bnNativeTokenAvailable) && (!isTransferAll || isChainNotSupportTransferAll)) {
470
+ validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.NOT_ENOUGH_BALANCE)); // todo: should be generalized and reused in all features
493
471
  }
494
472
 
495
473
  // todo: only system.pallet has metadata, we should add for other pallets and mechanisms as well
496
474
  const isNeedCheckRemainingBalance = !isTransferAll && extrinsicType === _KoniTypes.ExtrinsicType.TRANSFER_BALANCE && nativeTokenAvailable.metadata && (0, _systemPallet._canAccountBeReaped)(nativeTokenAvailable.metadata);
497
475
  const isRemainingBalanceValid = bnNativeTokenAvailable.minus(bnNativeTokenTransferAmount).minus(bnFee).lt((0, _utils3._getTokenMinAmount)(nativeTokenInfo));
498
476
  if (isNeedCheckRemainingBalance && isRemainingBalanceValid) {
499
- edAsWarning ? validationResponse.warnings.push(new _TransactionWarning.TransactionWarning(_types.BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT)) : validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_EXISTENTIAL_DEPOSIT));
477
+ edAsWarning ? validationResponse.warnings.push(new _TransactionWarning.TransactionWarning(_types2.BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT)) : validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.NOT_ENOUGH_EXISTENTIAL_DEPOSIT));
500
478
  }
501
479
  }
502
480
  async function checkTonAddressBounceableAndAccountNotActive(tonApi, validationResponse) {
@@ -505,7 +483,7 @@ async function checkTonAddressBounceableAndAccountNotActive(tonApi, validationRe
505
483
  } = validationResponse.data;
506
484
  const isActive = await isAccountActive(tonApi, to);
507
485
  if (isTonAddressBounceable(to) && !isActive) {
508
- validationResponse.warnings.push(new _TransactionWarning.TransactionWarning(_types.BasicTxWarningCode.IS_BOUNCEABLE_ADDRESS));
486
+ validationResponse.warnings.push(new _TransactionWarning.TransactionWarning(_types2.BasicTxWarningCode.IS_BOUNCEABLE_ADDRESS));
509
487
  }
510
488
  }
511
489
  function isTonAddressBounceable(address) {
@@ -520,7 +498,7 @@ function validateXcmMinAmountToMythos(destChain, destToken, amount) {
520
498
  const errorMsg = 'Enter an amount higher than 2.5 MYTH to pay cross-chain fee and avoid your MYTH being lost after the transaction';
521
499
  if (destChain === 'mythos' && destToken === 'mythos-NATIVE-MYTH') {
522
500
  if ((0, _bignumber.default)(amount).lte(MYTHOS_DESTINATION_FEE)) {
523
- return new _TransactionError.TransactionError(_types.TransferTxErrorType.NOT_ENOUGH_VALUE, (0, _i18next.t)(errorMsg));
501
+ return new _TransactionError.TransactionError(_types2.TransferTxErrorType.NOT_ENOUGH_VALUE, (0, _i18next.t)(errorMsg));
524
502
  }
525
503
  }
526
504
  return undefined;