@subwallet/extension-base 1.3.70-2 → 1.3.72-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/background/KoniTypes.d.ts +13 -2
- package/background/KoniTypes.js +68 -9
- package/cjs/background/KoniTypes.js +68 -9
- package/cjs/constants/blocked-actions.js +3 -0
- package/cjs/core/logic-validation/recipientAddress.js +1 -1
- package/cjs/core/logic-validation/swap.js +0 -3
- package/cjs/core/logic-validation/transfer.js +33 -10
- package/cjs/core/substrate/system-pallet.js +0 -2
- package/cjs/core/types.js +1 -0
- package/cjs/koni/api/nft/wasm_nft/index.js +0 -1
- package/cjs/koni/api/staking/bonding/astar.js +0 -2
- package/cjs/koni/api/staking/bonding/paraChain.js +0 -3
- package/cjs/koni/api/staking/bonding/relayChain.js +2 -4
- package/cjs/koni/api/staking/bonding/utils.js +0 -4
- package/cjs/koni/background/cron.js +0 -1
- package/cjs/koni/background/handlers/Extension.js +235 -166
- package/cjs/koni/background/handlers/State.js +56 -52
- package/cjs/koni/background/handlers/Tabs.js +39 -34
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/index.js +7 -0
- package/cjs/page/substrate/PostMessageProvider.js +3 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +48 -5
- package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
- package/cjs/services/balance-service/index.js +103 -7
- package/cjs/services/balance-service/transfer/bitcoin-transfer.js +0 -1
- package/cjs/services/balance-service/transfer/cardano-transfer.js +1 -2
- package/cjs/services/balance-service/transfer/smart-contract.js +0 -1
- package/cjs/services/balance-service/transfer/token.js +13 -37
- package/cjs/services/balance-service/transfer/ton-transfer.js +0 -1
- package/cjs/services/balance-service/transfer/xcm/index.js +3 -8
- package/cjs/services/balance-service/transfer/xcm/snowBridge.js +0 -1
- package/cjs/services/balance-service/transfer/xcm/utils.js +1 -1
- package/cjs/services/chain-service/constants.js +6 -5
- package/cjs/services/chain-service/handler/CardanoApi.js +3 -1
- package/cjs/services/chain-service/handler/SubstrateApi.js +0 -2
- package/cjs/services/chain-service/handler/light-client/index.js +1 -2
- package/cjs/services/chain-service/health-check/index.js +0 -1
- package/cjs/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
- package/cjs/services/chain-service/index.js +19 -26
- package/cjs/services/chain-service/utils/index.js +21 -25
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/handlers/base.js +32 -0
- package/cjs/services/earning-service/handlers/lending/base.js +0 -2
- package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -1
- package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -2
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
- package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -2
- package/cjs/services/earning-service/handlers/native-staking/dtao.js +43 -2
- package/cjs/services/earning-service/handlers/native-staking/energy.js +0 -1
- package/cjs/services/earning-service/handlers/native-staking/mythos.js +0 -2
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -2
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
- package/cjs/services/earning-service/handlers/special.js +7 -0
- package/cjs/services/history-service/subsquid-multi-chain-history.js +0 -1
- package/cjs/services/keyring-service/context/handlers/Derive.js +1 -1
- package/cjs/services/keyring-service/context/handlers/Migration.js +11 -9
- package/cjs/services/keyring-service/context/handlers/Mnemonic.js +18 -13
- package/cjs/services/keyring-service/context/state.js +21 -3
- package/cjs/services/keyring-service/utils.js +12 -2
- package/cjs/services/migration-service/index.js +1 -2
- package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +55 -0
- package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +41 -0
- package/cjs/services/migration-service/scripts/index.js +17 -13
- package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
- package/cjs/services/nft-service/index.js +5 -0
- package/cjs/services/open-gov/handler.js +0 -2
- package/cjs/services/open-gov/interface.js +4 -1
- package/cjs/services/request-service/handler/BitcoinRequestHandler.js +1 -2
- package/cjs/services/request-service/handler/CardanoRequestHandler.js +0 -1
- package/cjs/services/request-service/handler/EvmRequestHandler.js +0 -1
- package/cjs/services/request-service/handler/TonRequestHandler.js +0 -1
- package/cjs/services/request-service/helper/index.js +1 -2
- package/cjs/services/storage-service/DatabaseService.js +0 -2
- package/cjs/services/storage-service/databases/index.js +2 -0
- package/cjs/services/substrate-proxy-service/constant.js +26 -0
- package/cjs/services/substrate-proxy-service/index.js +170 -0
- package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -1
- package/cjs/services/swap-service/handler/asset-hub/router.js +0 -1
- package/cjs/services/swap-service/handler/chainflip-handler.js +1 -4
- package/cjs/services/swap-service/handler/hydradx-handler.js +0 -1
- package/cjs/services/swap-service/handler/kyber-handler.js +0 -1
- package/cjs/services/swap-service/handler/optimex-handler.js +1 -2
- package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -3
- package/cjs/services/swap-service/handler/uniswap-handler.js +0 -3
- package/cjs/services/transaction-service/event-parser/index.js +6 -6
- package/cjs/services/transaction-service/index.js +105 -37
- package/cjs/services/transaction-service/utils.js +8 -5
- package/cjs/services/wallet-connect-service/index.js +21 -18
- package/cjs/services/wallet-connect-service/types.js +1 -1
- package/cjs/types/account/info/keyring.js +9 -1
- package/cjs/types/balance/index.js +5 -1
- package/cjs/types/index.js +11 -0
- package/cjs/types/substrateProxyAccount/actions/index.js +1 -0
- package/cjs/types/substrateProxyAccount/index.js +16 -0
- package/cjs/types/swap/index.js +2 -1
- package/cjs/types/transaction/process.js +2 -0
- package/cjs/types/yield/actions/join/step.js +17 -1
- package/cjs/utils/account/common.js +0 -26
- package/cjs/utils/account/derive/info/solo.js +7 -4
- package/cjs/utils/account/derive/validate.js +1 -1
- package/cjs/utils/account/transform.js +10 -5
- package/cjs/utils/auth.js +1 -1
- package/cjs/utils/bitcoin/utxo-management.js +0 -1
- package/cjs/utils/environment.js +2 -1
- package/cjs/utils/fee/transfer.js +5 -4
- package/cjs/utils/index.js +1 -2
- package/constants/blocked-actions.js +3 -0
- package/core/logic-validation/recipientAddress.js +1 -1
- package/core/logic-validation/swap.js +0 -3
- package/core/logic-validation/transfer.d.ts +3 -3
- package/core/logic-validation/transfer.js +34 -11
- package/core/substrate/system-pallet.js +0 -2
- package/core/types.d.ts +2 -1
- package/core/types.js +1 -0
- package/koni/api/nft/wasm_nft/index.js +0 -1
- package/koni/api/staking/bonding/astar.js +0 -2
- package/koni/api/staking/bonding/paraChain.js +0 -3
- package/koni/api/staking/bonding/relayChain.js +2 -4
- package/koni/api/staking/bonding/utils.js +0 -4
- package/koni/background/cron.js +0 -1
- package/koni/background/handlers/Extension.d.ts +3 -0
- package/koni/background/handlers/Extension.js +89 -19
- package/koni/background/handlers/State.d.ts +2 -0
- package/koni/background/handlers/State.js +43 -38
- package/koni/background/handlers/Tabs.js +9 -3
- package/package.json +50 -21
- package/packageInfo.js +1 -1
- package/page/substrate/PostMessageProvider.js +3 -0
- package/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
- package/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
- package/services/balance-service/helpers/subscribe/substrate/index.js +47 -4
- package/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
- package/services/balance-service/index.d.ts +8 -0
- package/services/balance-service/index.js +105 -9
- package/services/balance-service/transfer/bitcoin-transfer.js +0 -1
- package/services/balance-service/transfer/smart-contract.js +0 -1
- package/services/balance-service/transfer/token.d.ts +0 -4
- package/services/balance-service/transfer/token.js +12 -35
- package/services/balance-service/transfer/ton-transfer.js +0 -1
- package/services/balance-service/transfer/xcm/index.js +3 -8
- package/services/balance-service/transfer/xcm/snowBridge.js +0 -1
- package/services/balance-service/transfer/xcm/utils.d.ts +0 -2
- package/services/balance-service/transfer/xcm/utils.js +1 -1
- package/services/chain-service/constants.d.ts +1 -1
- package/services/chain-service/constants.js +4 -4
- package/services/chain-service/handler/CardanoApi.js +3 -1
- package/services/chain-service/handler/SubstrateApi.js +0 -2
- package/services/chain-service/health-check/index.js +0 -1
- package/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
- package/services/chain-service/index.d.ts +0 -1
- package/services/chain-service/index.js +16 -23
- package/services/chain-service/utils/index.js +22 -26
- package/services/chain-service/utils/patch.d.ts +1 -1
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/handlers/base.js +32 -0
- package/services/earning-service/handlers/lending/base.js +0 -2
- package/services/earning-service/handlers/liquid-staking/acala.js +0 -1
- package/services/earning-service/handlers/liquid-staking/base.js +0 -2
- package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
- package/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
- package/services/earning-service/handlers/native-staking/astar.js +0 -2
- package/services/earning-service/handlers/native-staking/dtao.js +43 -0
- package/services/earning-service/handlers/native-staking/energy.js +0 -1
- package/services/earning-service/handlers/native-staking/mythos.js +0 -2
- package/services/earning-service/handlers/native-staking/para-chain.js +0 -2
- package/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
- package/services/earning-service/handlers/special.js +7 -0
- package/services/history-service/subsquid-multi-chain-history.js +0 -1
- package/services/keyring-service/context/handlers/Derive.js +2 -2
- package/services/keyring-service/context/handlers/Migration.js +3 -1
- package/services/keyring-service/context/handlers/Mnemonic.d.ts +1 -1
- package/services/keyring-service/context/handlers/Mnemonic.js +16 -10
- package/services/keyring-service/context/state.d.ts +3 -0
- package/services/keyring-service/context/state.js +21 -3
- package/services/keyring-service/utils.d.ts +1 -0
- package/services/keyring-service/utils.js +9 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.d.ts +4 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +46 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.d.ts +4 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +33 -0
- package/services/migration-service/scripts/index.js +8 -4
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
- package/services/nft-service/index.js +6 -0
- package/services/open-gov/handler.js +0 -2
- package/services/open-gov/interface.d.ts +4 -3
- package/services/open-gov/interface.js +4 -1
- package/services/request-service/handler/CardanoRequestHandler.js +0 -1
- package/services/request-service/handler/EvmRequestHandler.js +0 -1
- package/services/request-service/handler/TonRequestHandler.js +0 -1
- package/services/setting-service/constants.js +0 -1
- package/services/storage-service/DatabaseService.js +0 -2
- package/services/storage-service/databases/index.js +3 -0
- package/services/substrate-proxy-service/constant.d.ts +3 -0
- package/services/substrate-proxy-service/constant.js +19 -0
- package/services/substrate-proxy-service/index.d.ts +13 -0
- package/services/substrate-proxy-service/index.js +159 -0
- package/services/swap-service/handler/asset-hub/handler.js +0 -1
- package/services/swap-service/handler/asset-hub/router.js +0 -1
- package/services/swap-service/handler/chainflip-handler.js +0 -2
- package/services/swap-service/handler/hydradx-handler.js +0 -1
- package/services/swap-service/handler/kyber-handler.js +0 -1
- package/services/swap-service/handler/simpleswap-handler.js +0 -1
- package/services/swap-service/handler/uniswap-handler.js +0 -3
- package/services/transaction-service/event-parser/index.js +6 -6
- package/services/transaction-service/index.js +79 -11
- package/services/transaction-service/types.d.ts +2 -2
- package/services/transaction-service/utils.js +8 -5
- package/services/wallet-connect-service/index.js +21 -18
- package/services/wallet-connect-service/types.js +1 -1
- package/types/account/action/add/mnemonic.d.ts +3 -2
- package/types/account/info/keyring.js +9 -1
- package/types/balance/index.js +5 -1
- package/types/balance/transfer.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/substrateProxyAccount/actions/index.d.ts +17 -0
- package/types/substrateProxyAccount/actions/index.js +1 -0
- package/types/substrateProxyAccount/index.d.ts +23 -0
- package/types/substrateProxyAccount/index.js +8 -0
- package/types/swap/index.js +2 -1
- package/types/transaction/process.js +3 -1
- package/types/transaction/request.d.ts +1 -0
- package/types/yield/actions/join/step.js +17 -1
- package/types/yield/actions/join/submit.d.ts +1 -1
- package/utils/account/common.d.ts +0 -3
- package/utils/account/common.js +0 -24
- package/utils/account/derive/info/solo.js +8 -5
- package/utils/account/derive/validate.d.ts +2 -2
- package/utils/account/derive/validate.js +1 -1
- package/utils/account/transform.js +10 -5
- package/utils/auth.js +2 -2
- package/utils/bitcoin/utxo-management.js +0 -1
- package/utils/fee/transfer.js +4 -2
- package/utils/index.js +2 -5
|
@@ -291,6 +291,9 @@ export default class KoniExtension {
|
|
|
291
291
|
private migrateUnifiedAndFetchEligibleSoloAccounts;
|
|
292
292
|
private migrateSoloAccount;
|
|
293
293
|
private pingSession;
|
|
294
|
+
private getSubstrateProxyAccountGroup;
|
|
295
|
+
private handleAddSubstrateProxyAccount;
|
|
296
|
+
private handleRemoveSubstrateProxyAccount;
|
|
294
297
|
private handleVote;
|
|
295
298
|
private handleRemoveVote;
|
|
296
299
|
private handleUnlockVote;
|
|
@@ -52,7 +52,7 @@ import { _analyzeAddress, calculateMaxTransferable, combineAllAccountProxy, comb
|
|
|
52
52
|
import { parseContractInput, parseEvmRlp } from '@subwallet/extension-base/utils/eth/parseTransaction';
|
|
53
53
|
import { getId } from '@subwallet/extension-base/utils/getId';
|
|
54
54
|
import { getKeypairTypeByAddress, isAddress, isCardanoAddress, isSubstrateAddress, isTonAddress } from '@subwallet/keyring';
|
|
55
|
-
import { BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes,
|
|
55
|
+
import { AllSubstrateKeypairTypes, BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
|
|
56
56
|
import { getBitcoinAddressInfo } from '@subwallet/keyring/utils';
|
|
57
57
|
import { isBitcoinAddress } from '@subwallet/keyring/utils/address/validate';
|
|
58
58
|
import { keyring } from '@subwallet/ui-keyring';
|
|
@@ -591,7 +591,7 @@ export default class KoniExtension {
|
|
|
591
591
|
const type = getKeypairTypeByAddress(address);
|
|
592
592
|
const validTypes = {
|
|
593
593
|
evm: EthereumKeypairTypes,
|
|
594
|
-
substrate:
|
|
594
|
+
substrate: AllSubstrateKeypairTypes,
|
|
595
595
|
ton: TonKeypairTypes,
|
|
596
596
|
cardano: CardanoKeypairTypes,
|
|
597
597
|
bitcoin: BitcoinKeypairTypes
|
|
@@ -1255,6 +1255,7 @@ export default class KoniExtension {
|
|
|
1255
1255
|
feeCustom,
|
|
1256
1256
|
feeOption,
|
|
1257
1257
|
from,
|
|
1258
|
+
signerSubstrateProxyAddress,
|
|
1258
1259
|
to,
|
|
1259
1260
|
tokenPayFeeSlug,
|
|
1260
1261
|
tokenSlug,
|
|
@@ -1488,6 +1489,7 @@ export default class KoniExtension {
|
|
|
1488
1489
|
isTransferAll: isTransferNativeToken ? transferAll : false,
|
|
1489
1490
|
isTransferLocalTokenAndPayThatTokenAsFee,
|
|
1490
1491
|
edAsWarning: isTransferNativeToken,
|
|
1492
|
+
signerSubstrateProxyAddress,
|
|
1491
1493
|
additionalValidator: additionalValidator
|
|
1492
1494
|
});
|
|
1493
1495
|
}
|
|
@@ -1499,6 +1501,7 @@ export default class KoniExtension {
|
|
|
1499
1501
|
from,
|
|
1500
1502
|
isPassConfirmation,
|
|
1501
1503
|
originNetworkKey,
|
|
1504
|
+
signerSubstrateProxyAddress,
|
|
1502
1505
|
to,
|
|
1503
1506
|
tokenPayFeeSlug,
|
|
1504
1507
|
tokenSlug,
|
|
@@ -1694,7 +1697,8 @@ export default class KoniExtension {
|
|
|
1694
1697
|
xcmFeeDryRun,
|
|
1695
1698
|
errors,
|
|
1696
1699
|
additionalValidator: additionalValidator,
|
|
1697
|
-
eventsHandler: eventsHandler
|
|
1700
|
+
eventsHandler: eventsHandler,
|
|
1701
|
+
signerSubstrateProxyAddress
|
|
1698
1702
|
});
|
|
1699
1703
|
}
|
|
1700
1704
|
async makeBitcoinDappTransferConfirmation(inputData) {
|
|
@@ -2227,7 +2231,6 @@ export default class KoniExtension {
|
|
|
2227
2231
|
const fee = await this.#koniState.feeService.subscribeChainFee(id, chain, feeChainType, data => {
|
|
2228
2232
|
feeSubject.next(data); // Must be called after subscription
|
|
2229
2233
|
});
|
|
2230
|
-
|
|
2231
2234
|
const unsub = () => {
|
|
2232
2235
|
subscription.unsubscribe();
|
|
2233
2236
|
unsubBalance();
|
|
@@ -2335,7 +2338,8 @@ export default class KoniExtension {
|
|
|
2335
2338
|
feeOptions: feeOptions,
|
|
2336
2339
|
feeType,
|
|
2337
2340
|
error,
|
|
2338
|
-
id
|
|
2341
|
+
id,
|
|
2342
|
+
maxTransferableWithoutFee: freeBalance.value
|
|
2339
2343
|
};
|
|
2340
2344
|
};
|
|
2341
2345
|
const subscription = combineLatest({
|
|
@@ -2352,11 +2356,9 @@ export default class KoniExtension {
|
|
|
2352
2356
|
const [unsubBalance, freeBalance] = await this.#koniState.balanceService.subscribeBalance(address, chain, token, BalanceType.TRANSFERABLE, ExtrinsicType.TRANSFER_BALANCE, data => {
|
|
2353
2357
|
freeBalanceSubject.next(data); // Must be called after subscription
|
|
2354
2358
|
});
|
|
2355
|
-
|
|
2356
2359
|
const fee = await this.#koniState.feeService.subscribeChainFee(id, chain, feeType, data => {
|
|
2357
2360
|
feeSubject.next(data); // Must be called after subscription
|
|
2358
2361
|
});
|
|
2359
|
-
|
|
2360
2362
|
const unsub = () => {
|
|
2361
2363
|
subscription.unsubscribe();
|
|
2362
2364
|
unsubBalance();
|
|
@@ -2421,7 +2423,8 @@ export default class KoniExtension {
|
|
|
2421
2423
|
const {
|
|
2422
2424
|
params,
|
|
2423
2425
|
recipientAddress,
|
|
2424
|
-
senderAddress
|
|
2426
|
+
senderAddress,
|
|
2427
|
+
signerSubstrateProxyAddress
|
|
2425
2428
|
} = inputData;
|
|
2426
2429
|
const isSendingSelf = isRecipientSelf(senderAddress, recipientAddress);
|
|
2427
2430
|
|
|
@@ -2442,7 +2445,8 @@ export default class KoniExtension {
|
|
|
2442
2445
|
isSendingSelf
|
|
2443
2446
|
},
|
|
2444
2447
|
extrinsicType: ExtrinsicType.SEND_NFT,
|
|
2445
|
-
chainType: ChainType.SUBSTRATE
|
|
2448
|
+
chainType: ChainType.SUBSTRATE,
|
|
2449
|
+
signerSubstrateProxyAddress
|
|
2446
2450
|
});
|
|
2447
2451
|
return {
|
|
2448
2452
|
...rs,
|
|
@@ -3592,21 +3596,21 @@ export default class KoniExtension {
|
|
|
3592
3596
|
const unsubSyncProgress = await ((_this$koniState$chain7 = this.#koniState.chainService) === null || _this$koniState$chain7 === void 0 ? void 0 : (_this$koniState$chain8 = _this$koniState$chain7.mantaPay) === null || _this$koniState$chain8 === void 0 ? void 0 : _this$koniState$chain8.subscribeSyncProgress());
|
|
3593
3597
|
console.debug('Start initial sync for MantaPay');
|
|
3594
3598
|
this.#koniState.initialSyncMantaPay(address).then(() => {
|
|
3595
|
-
var _this$koniState$chain9, _this$koniState$
|
|
3599
|
+
var _this$koniState$chain9, _this$koniState$chain0;
|
|
3596
3600
|
console.debug('Finished initial sync for MantaPay');
|
|
3597
3601
|
this.#skipAutoLock = false;
|
|
3598
3602
|
unsubSyncProgress && unsubSyncProgress();
|
|
3599
3603
|
// make sure the sync state is set, just in case it gets unsubscribed
|
|
3600
|
-
(_this$koniState$chain9 = this.#koniState.chainService) === null || _this$koniState$chain9 === void 0 ? void 0 : (_this$koniState$
|
|
3604
|
+
(_this$koniState$chain9 = this.#koniState.chainService) === null || _this$koniState$chain9 === void 0 ? void 0 : (_this$koniState$chain0 = _this$koniState$chain9.mantaPay) === null || _this$koniState$chain0 === void 0 ? void 0 : _this$koniState$chain0.setSyncState({
|
|
3601
3605
|
progress: 100,
|
|
3602
3606
|
isSyncing: false
|
|
3603
3607
|
});
|
|
3604
3608
|
}).catch(e => {
|
|
3605
|
-
var _this$koniState$
|
|
3609
|
+
var _this$koniState$chain1, _this$koniState$chain10;
|
|
3606
3610
|
console.error('Error syncing MantaPay', e);
|
|
3607
3611
|
this.#skipAutoLock = false;
|
|
3608
3612
|
unsubSyncProgress && unsubSyncProgress();
|
|
3609
|
-
(_this$koniState$
|
|
3613
|
+
(_this$koniState$chain1 = this.#koniState.chainService) === null || _this$koniState$chain1 === void 0 ? void 0 : (_this$koniState$chain10 = _this$koniState$chain1.mantaPay) === null || _this$koniState$chain10 === void 0 ? void 0 : _this$koniState$chain10.setSyncState({
|
|
3610
3614
|
progress: 0,
|
|
3611
3615
|
isSyncing: false
|
|
3612
3616
|
});
|
|
@@ -3644,7 +3648,7 @@ export default class KoniExtension {
|
|
|
3644
3648
|
return this.#koniState.getMantaPayConfig('calamari');
|
|
3645
3649
|
}
|
|
3646
3650
|
subscribeMantaPaySyncState(id, port) {
|
|
3647
|
-
var _this$koniState$subsc, _this$koniState$
|
|
3651
|
+
var _this$koniState$subsc, _this$koniState$chain11, _this$koniState$chain12;
|
|
3648
3652
|
const cb = createSubscription(id, port);
|
|
3649
3653
|
const syncingStateSubscription = (_this$koniState$subsc = this.#koniState.subscribeMantaPaySyncState()) === null || _this$koniState$subsc === void 0 ? void 0 : _this$koniState$subsc.subscribe({
|
|
3650
3654
|
next: rs => {
|
|
@@ -3655,7 +3659,7 @@ export default class KoniExtension {
|
|
|
3655
3659
|
port.onDisconnect.addListener(() => {
|
|
3656
3660
|
this.cancelSubscription(id);
|
|
3657
3661
|
});
|
|
3658
|
-
return ((_this$koniState$
|
|
3662
|
+
return ((_this$koniState$chain11 = this.#koniState.chainService) === null || _this$koniState$chain11 === void 0 ? void 0 : (_this$koniState$chain12 = _this$koniState$chain11.mantaPay) === null || _this$koniState$chain12 === void 0 ? void 0 : _this$koniState$chain12.getSyncState()) || {
|
|
3659
3663
|
isSyncing: false,
|
|
3660
3664
|
progress: 0,
|
|
3661
3665
|
needManualSync: false
|
|
@@ -3745,7 +3749,8 @@ export default class KoniExtension {
|
|
|
3745
3749
|
isPassConfirmation,
|
|
3746
3750
|
onSend,
|
|
3747
3751
|
path,
|
|
3748
|
-
processId
|
|
3752
|
+
processId,
|
|
3753
|
+
signerSubstrateProxyAddress
|
|
3749
3754
|
} = inputData;
|
|
3750
3755
|
const {
|
|
3751
3756
|
address
|
|
@@ -3876,6 +3881,7 @@ export default class KoniExtension {
|
|
|
3876
3881
|
// change this depends on step
|
|
3877
3882
|
chainType,
|
|
3878
3883
|
resolveOnDone: !isLastStep,
|
|
3884
|
+
signerSubstrateProxyAddress,
|
|
3879
3885
|
transferNativeAmount,
|
|
3880
3886
|
balanceType: balanceTypeForPool,
|
|
3881
3887
|
skipFeeValidation: isMintingStep && isPoolSupportAlternativeFee,
|
|
@@ -3888,6 +3894,7 @@ export default class KoniExtension {
|
|
|
3888
3894
|
async handleYieldLeave(params) {
|
|
3889
3895
|
const {
|
|
3890
3896
|
address,
|
|
3897
|
+
signerSubstrateProxyAddress,
|
|
3891
3898
|
slug
|
|
3892
3899
|
} = params;
|
|
3893
3900
|
const leaveValidation = await this.#koniState.earningService.validateYieldLeave(params);
|
|
@@ -3903,6 +3910,7 @@ export default class KoniExtension {
|
|
|
3903
3910
|
data: params,
|
|
3904
3911
|
// TODO
|
|
3905
3912
|
extrinsicType,
|
|
3913
|
+
signerSubstrateProxyAddress,
|
|
3906
3914
|
chainType: (handler === null || handler === void 0 ? void 0 : handler.transactionChainType) || ChainType.SUBSTRATE
|
|
3907
3915
|
});
|
|
3908
3916
|
}
|
|
@@ -3979,6 +3987,7 @@ export default class KoniExtension {
|
|
|
3979
3987
|
async yieldSubmitWithdrawal(params) {
|
|
3980
3988
|
const {
|
|
3981
3989
|
address,
|
|
3990
|
+
signerSubstrateProxyAddress,
|
|
3982
3991
|
slug
|
|
3983
3992
|
} = params;
|
|
3984
3993
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -3992,6 +4001,7 @@ export default class KoniExtension {
|
|
|
3992
4001
|
transaction: extrinsic,
|
|
3993
4002
|
data: params,
|
|
3994
4003
|
extrinsicType: ExtrinsicType.STAKING_WITHDRAW,
|
|
4004
|
+
signerSubstrateProxyAddress,
|
|
3995
4005
|
chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || ChainType.SUBSTRATE
|
|
3996
4006
|
});
|
|
3997
4007
|
}
|
|
@@ -3999,6 +4009,7 @@ export default class KoniExtension {
|
|
|
3999
4009
|
const {
|
|
4000
4010
|
address,
|
|
4001
4011
|
selectedUnstaking,
|
|
4012
|
+
signerSubstrateProxyAddress,
|
|
4002
4013
|
slug
|
|
4003
4014
|
} = params;
|
|
4004
4015
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -4013,12 +4024,14 @@ export default class KoniExtension {
|
|
|
4013
4024
|
transaction: extrinsic,
|
|
4014
4025
|
data: params,
|
|
4015
4026
|
extrinsicType: ExtrinsicType.STAKING_CANCEL_UNSTAKE,
|
|
4027
|
+
signerSubstrateProxyAddress,
|
|
4016
4028
|
chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || ChainType.SUBSTRATE
|
|
4017
4029
|
});
|
|
4018
4030
|
}
|
|
4019
4031
|
async yieldSubmitClaimReward(params) {
|
|
4020
4032
|
const {
|
|
4021
4033
|
address,
|
|
4034
|
+
signerSubstrateProxyAddress,
|
|
4022
4035
|
slug
|
|
4023
4036
|
} = params;
|
|
4024
4037
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -4031,6 +4044,7 @@ export default class KoniExtension {
|
|
|
4031
4044
|
chain: poolHandler.chain,
|
|
4032
4045
|
transaction: extrinsic,
|
|
4033
4046
|
data: params,
|
|
4047
|
+
signerSubstrateProxyAddress,
|
|
4034
4048
|
extrinsicType: ExtrinsicType.STAKING_CLAIM_REWARD,
|
|
4035
4049
|
chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || ChainType.SUBSTRATE
|
|
4036
4050
|
});
|
|
@@ -4049,6 +4063,7 @@ export default class KoniExtension {
|
|
|
4049
4063
|
async handleYieldChangeValidator(params) {
|
|
4050
4064
|
const {
|
|
4051
4065
|
address,
|
|
4066
|
+
signerSubstrateProxyAddress,
|
|
4052
4067
|
slug
|
|
4053
4068
|
} = params;
|
|
4054
4069
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -4061,6 +4076,7 @@ export default class KoniExtension {
|
|
|
4061
4076
|
chain: poolHandler.chain,
|
|
4062
4077
|
transaction: extrinsic,
|
|
4063
4078
|
data: params,
|
|
4079
|
+
signerSubstrateProxyAddress,
|
|
4064
4080
|
extrinsicType: ExtrinsicType.CHANGE_EARNING_VALIDATOR,
|
|
4065
4081
|
chainType: ChainType.SUBSTRATE
|
|
4066
4082
|
});
|
|
@@ -4742,6 +4758,48 @@ export default class KoniExtension {
|
|
|
4742
4758
|
pingSession(request) {
|
|
4743
4759
|
return this.#koniState.keyringService.context.pingSession(request);
|
|
4744
4760
|
}
|
|
4761
|
+
getSubstrateProxyAccountGroup(request) {
|
|
4762
|
+
return this.#koniState.substrateProxyAccountService.getSubstrateProxyAccountGroup(request);
|
|
4763
|
+
}
|
|
4764
|
+
async handleAddSubstrateProxyAccount(params) {
|
|
4765
|
+
const {
|
|
4766
|
+
address,
|
|
4767
|
+
chain,
|
|
4768
|
+
signerSubstrateProxyAddress
|
|
4769
|
+
} = params;
|
|
4770
|
+
const validationErrors = await this.#koniState.substrateProxyAccountService.validateAddSubstrateProxyAccount(params, signerSubstrateProxyAddress);
|
|
4771
|
+
if (validationErrors.length > 0) {
|
|
4772
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(validationErrors);
|
|
4773
|
+
}
|
|
4774
|
+
const extrinsic = await this.#koniState.substrateProxyAccountService.addSubstrateProxyAccounts(params);
|
|
4775
|
+
return await this.#koniState.transactionService.handleTransaction({
|
|
4776
|
+
address,
|
|
4777
|
+
chain,
|
|
4778
|
+
transaction: extrinsic,
|
|
4779
|
+
data: params,
|
|
4780
|
+
extrinsicType: ExtrinsicType.ADD_SUBSTRATE_PROXY_ACCOUNT,
|
|
4781
|
+
chainType: ChainType.SUBSTRATE,
|
|
4782
|
+
signerSubstrateProxyAddress
|
|
4783
|
+
});
|
|
4784
|
+
}
|
|
4785
|
+
async handleRemoveSubstrateProxyAccount(params) {
|
|
4786
|
+
const {
|
|
4787
|
+
address,
|
|
4788
|
+
chain,
|
|
4789
|
+
signerSubstrateProxyAddress
|
|
4790
|
+
} = params;
|
|
4791
|
+
const extrinsic = await this.#koniState.substrateProxyAccountService.removeSubstrateProxyAccounts(params);
|
|
4792
|
+
return await this.#koniState.transactionService.handleTransaction({
|
|
4793
|
+
address,
|
|
4794
|
+
chain,
|
|
4795
|
+
transaction: extrinsic,
|
|
4796
|
+
data: params,
|
|
4797
|
+
extrinsicType: ExtrinsicType.REMOVE_SUBSTRATE_PROXY_ACCOUNT,
|
|
4798
|
+
chainType: ChainType.SUBSTRATE,
|
|
4799
|
+
signerSubstrateProxyAddress
|
|
4800
|
+
});
|
|
4801
|
+
}
|
|
4802
|
+
|
|
4745
4803
|
/* Migrate Unified Account */
|
|
4746
4804
|
|
|
4747
4805
|
/* Open Gov */
|
|
@@ -4754,7 +4812,8 @@ export default class KoniExtension {
|
|
|
4754
4812
|
transaction: extrinsic,
|
|
4755
4813
|
data: request,
|
|
4756
4814
|
extrinsicType: ExtrinsicType.GOV_VOTE,
|
|
4757
|
-
chainType: ChainType.SUBSTRATE
|
|
4815
|
+
chainType: ChainType.SUBSTRATE,
|
|
4816
|
+
signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
|
|
4758
4817
|
});
|
|
4759
4818
|
}
|
|
4760
4819
|
async handleRemoveVote(request) {
|
|
@@ -4765,7 +4824,8 @@ export default class KoniExtension {
|
|
|
4765
4824
|
transaction: extrinsic,
|
|
4766
4825
|
data: request,
|
|
4767
4826
|
extrinsicType: ExtrinsicType.GOV_UNVOTE,
|
|
4768
|
-
chainType: ChainType.SUBSTRATE
|
|
4827
|
+
chainType: ChainType.SUBSTRATE,
|
|
4828
|
+
signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
|
|
4769
4829
|
});
|
|
4770
4830
|
}
|
|
4771
4831
|
async handleUnlockVote(request) {
|
|
@@ -4776,7 +4836,8 @@ export default class KoniExtension {
|
|
|
4776
4836
|
transaction: extrinsic,
|
|
4777
4837
|
data: request,
|
|
4778
4838
|
extrinsicType: ExtrinsicType.GOV_UNLOCK_VOTE,
|
|
4779
|
-
chainType: ChainType.SUBSTRATE
|
|
4839
|
+
chainType: ChainType.SUBSTRATE,
|
|
4840
|
+
signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
|
|
4780
4841
|
});
|
|
4781
4842
|
}
|
|
4782
4843
|
async subscribeGovLockedInfo(id, port) {
|
|
@@ -5464,6 +5525,15 @@ export default class KoniExtension {
|
|
|
5464
5525
|
return this.handleUnlockVote(request);
|
|
5465
5526
|
case 'pri(openGov.subscribeGovLockedInfo)':
|
|
5466
5527
|
return this.subscribeGovLockedInfo(id, port);
|
|
5528
|
+
|
|
5529
|
+
// Proxy
|
|
5530
|
+
case 'pri(substrateProxyAccount.getGroupInfo)':
|
|
5531
|
+
return this.getSubstrateProxyAccountGroup(request);
|
|
5532
|
+
case 'pri(substrateProxyAccount.add)':
|
|
5533
|
+
return this.handleAddSubstrateProxyAccount(request);
|
|
5534
|
+
case 'pri(substrateProxyAccount.remove)':
|
|
5535
|
+
return this.handleRemoveSubstrateProxyAccount(request);
|
|
5536
|
+
|
|
5467
5537
|
// Default
|
|
5468
5538
|
default:
|
|
5469
5539
|
throw new Error(`Unable to handle message of type ${type}`);
|
|
@@ -28,6 +28,7 @@ import { AuthUrls, MetaRequest, SignRequest } from '@subwallet/extension-base/se
|
|
|
28
28
|
import SettingService from '@subwallet/extension-base/services/setting-service/SettingService';
|
|
29
29
|
import DatabaseService from '@subwallet/extension-base/services/storage-service/DatabaseService';
|
|
30
30
|
import { SubscanService } from '@subwallet/extension-base/services/subscan-service';
|
|
31
|
+
import SubstrateProxyAccountService from '@subwallet/extension-base/services/substrate-proxy-service';
|
|
31
32
|
import { SwapService } from '@subwallet/extension-base/services/swap-service';
|
|
32
33
|
import TransactionService from '@subwallet/extension-base/services/transaction-service';
|
|
33
34
|
import WalletConnectService from '@subwallet/extension-base/services/wallet-connect-service';
|
|
@@ -83,6 +84,7 @@ export default class KoniState {
|
|
|
83
84
|
readonly inappNotificationService: InappNotificationService;
|
|
84
85
|
readonly chainOnlineService: ChainOnlineService;
|
|
85
86
|
readonly openGovService: OpenGovService;
|
|
87
|
+
readonly substrateProxyAccountService: SubstrateProxyAccountService;
|
|
86
88
|
private generalStatus;
|
|
87
89
|
private waitSleeping;
|
|
88
90
|
private waitStarting;
|
|
@@ -38,6 +38,7 @@ import { convertAssetToValue, convertValueToAsset, extractKeyHashesFromCollatera
|
|
|
38
38
|
import SettingService from '@subwallet/extension-base/services/setting-service/SettingService';
|
|
39
39
|
import DatabaseService from '@subwallet/extension-base/services/storage-service/DatabaseService';
|
|
40
40
|
import { SubscanService } from '@subwallet/extension-base/services/subscan-service';
|
|
41
|
+
import SubstrateProxyAccountService from '@subwallet/extension-base/services/substrate-proxy-service';
|
|
41
42
|
import { SwapService } from '@subwallet/extension-base/services/swap-service';
|
|
42
43
|
import TransactionService from '@subwallet/extension-base/services/transaction-service';
|
|
43
44
|
import WalletConnectService from '@subwallet/extension-base/services/wallet-connect-service';
|
|
@@ -87,6 +88,9 @@ export default class KoniState {
|
|
|
87
88
|
data: {}
|
|
88
89
|
};
|
|
89
90
|
lazyMap = {};
|
|
91
|
+
|
|
92
|
+
// TODO: consider making chainService public (or getter) and call function directly
|
|
93
|
+
|
|
90
94
|
// Handle the general status of the extension
|
|
91
95
|
generalStatus = ServiceStatus.INITIALIZING;
|
|
92
96
|
waitSleeping = null;
|
|
@@ -121,6 +125,7 @@ export default class KoniState {
|
|
|
121
125
|
this.inappNotificationService = new InappNotificationService(this.dbService, this.keyringService, this.eventService, this.chainService);
|
|
122
126
|
this.chainOnlineService = new ChainOnlineService(this.chainService, this.settingService, this.eventService, this.dbService);
|
|
123
127
|
this.openGovService = new OpenGovService(this);
|
|
128
|
+
this.substrateProxyAccountService = new SubstrateProxyAccountService(this);
|
|
124
129
|
this.subscription = new KoniSubscription(this, this.dbService);
|
|
125
130
|
this.cron = new KoniCron(this, this.subscription, this.dbService);
|
|
126
131
|
this.logger = createLogger('State');
|
|
@@ -745,7 +750,7 @@ export default class KoniState {
|
|
|
745
750
|
}
|
|
746
751
|
async enableChainWithPriorityAssets(chainSlug, enableTokens = true) {
|
|
747
752
|
if (enableTokens) {
|
|
748
|
-
await this.
|
|
753
|
+
await this.balanceService.updatePriorityAssetsByChain(chainSlug, true);
|
|
749
754
|
}
|
|
750
755
|
return this.chainService.enableChain(chainSlug);
|
|
751
756
|
}
|
|
@@ -1845,7 +1850,7 @@ export default class KoniState {
|
|
|
1845
1850
|
});
|
|
1846
1851
|
}
|
|
1847
1852
|
async enableMantaPay(updateStore, address, password, seedPhrase) {
|
|
1848
|
-
var _this$chainService3, _this$chainService3$m, _this$chainService4, _this$chainService4$m, _this$chainService4$m2, _this$
|
|
1853
|
+
var _this$chainService3, _this$chainService3$m, _this$chainService4, _this$chainService4$m, _this$chainService4$m2, _this$chainService1, _this$chainService1$m, _this$chainService1$m2;
|
|
1849
1854
|
if (!address || isEthereumAddress(address)) {
|
|
1850
1855
|
return;
|
|
1851
1856
|
}
|
|
@@ -1865,7 +1870,7 @@ export default class KoniState {
|
|
|
1865
1870
|
data: encryptedData
|
|
1866
1871
|
}));
|
|
1867
1872
|
} else {
|
|
1868
|
-
var _this$chainService9, _this$chainService9$m, _this$
|
|
1873
|
+
var _this$chainService9, _this$chainService9$m, _this$chainService0, _this$chainService0$m, _this$chainService0$m2;
|
|
1869
1874
|
const authContext = await ((_this$chainService9 = this.chainService) === null || _this$chainService9 === void 0 ? void 0 : (_this$chainService9$m = _this$chainService9.mantaPay) === null || _this$chainService9$m === void 0 ? void 0 : _this$chainService9$m.getMantaAuthContext(address, _DEFAULT_MANTA_ZK_CHAIN));
|
|
1870
1875
|
|
|
1871
1876
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
|
@@ -1873,18 +1878,18 @@ export default class KoniState {
|
|
|
1873
1878
|
|
|
1874
1879
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access
|
|
1875
1880
|
const proofAuthKey = new Uint8Array(Object.values(decryptedData.proof_authorization_key));
|
|
1876
|
-
await ((_this$
|
|
1881
|
+
await ((_this$chainService0 = this.chainService) === null || _this$chainService0 === void 0 ? void 0 : (_this$chainService0$m = _this$chainService0.mantaPay) === null || _this$chainService0$m === void 0 ? void 0 : (_this$chainService0$m2 = _this$chainService0$m.privateWallet) === null || _this$chainService0$m2 === void 0 ? void 0 : _this$chainService0$m2.loadAuthorizationContext({
|
|
1877
1882
|
proof_authorization_key: proofAuthKey
|
|
1878
1883
|
}));
|
|
1879
1884
|
}
|
|
1880
|
-
const zkAddress = await ((_this$
|
|
1885
|
+
const zkAddress = await ((_this$chainService1 = this.chainService) === null || _this$chainService1 === void 0 ? void 0 : (_this$chainService1$m = _this$chainService1.mantaPay) === null || _this$chainService1$m === void 0 ? void 0 : (_this$chainService1$m2 = _this$chainService1$m.privateWallet) === null || _this$chainService1$m2 === void 0 ? void 0 : _this$chainService1$m2.getZkAddress());
|
|
1881
1886
|
if (updateStore) {
|
|
1882
|
-
var _this$
|
|
1883
|
-
await ((_this$
|
|
1887
|
+
var _this$chainService10, _this$chainService10$, _this$chainService11, _this$chainService11$, _this$chainService11$2, _this$chainService11$3;
|
|
1888
|
+
await ((_this$chainService10 = this.chainService) === null || _this$chainService10 === void 0 ? void 0 : (_this$chainService10$ = _this$chainService10.mantaPay) === null || _this$chainService10$ === void 0 ? void 0 : _this$chainService10$.saveMantaPayConfig({
|
|
1884
1889
|
address,
|
|
1885
1890
|
zkAddress: zkAddress,
|
|
1886
1891
|
enabled: true,
|
|
1887
|
-
chain: (_this$
|
|
1892
|
+
chain: (_this$chainService11 = this.chainService) === null || _this$chainService11 === void 0 ? void 0 : (_this$chainService11$ = _this$chainService11.mantaPay) === null || _this$chainService11$ === void 0 ? void 0 : (_this$chainService11$2 = _this$chainService11$.privateWallet) === null || _this$chainService11$2 === void 0 ? void 0 : (_this$chainService11$3 = _this$chainService11$2.network) === null || _this$chainService11$3 === void 0 ? void 0 : _this$chainService11$3.toLowerCase(),
|
|
1888
1893
|
isInitialSync: false
|
|
1889
1894
|
}));
|
|
1890
1895
|
}
|
|
@@ -1892,48 +1897,48 @@ export default class KoniState {
|
|
|
1892
1897
|
return zkAddress;
|
|
1893
1898
|
}
|
|
1894
1899
|
async disableMantaPay(address) {
|
|
1895
|
-
var _this$
|
|
1896
|
-
const config = await ((_this$
|
|
1900
|
+
var _this$chainService12, _this$chainService12$, _this$chainService13, _this$chainService13$, _this$chainService13$2, _this$chainService14, _this$chainService14$, _this$chainService14$2, _this$chainService15, _this$chainService15$, _this$chainService16, _this$chainService16$;
|
|
1901
|
+
const config = await ((_this$chainService12 = this.chainService) === null || _this$chainService12 === void 0 ? void 0 : (_this$chainService12$ = _this$chainService12.mantaPay) === null || _this$chainService12$ === void 0 ? void 0 : _this$chainService12$.getMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN));
|
|
1897
1902
|
if (!config) {
|
|
1898
1903
|
return false;
|
|
1899
1904
|
}
|
|
1900
|
-
await ((_this$
|
|
1901
|
-
await ((_this$
|
|
1905
|
+
await ((_this$chainService13 = this.chainService) === null || _this$chainService13 === void 0 ? void 0 : (_this$chainService13$ = _this$chainService13.mantaPay) === null || _this$chainService13$ === void 0 ? void 0 : (_this$chainService13$2 = _this$chainService13$.privateWallet) === null || _this$chainService13$2 === void 0 ? void 0 : _this$chainService13$2.dropAuthorizationContext());
|
|
1906
|
+
await ((_this$chainService14 = this.chainService) === null || _this$chainService14 === void 0 ? void 0 : (_this$chainService14$ = _this$chainService14.mantaPay) === null || _this$chainService14$ === void 0 ? void 0 : (_this$chainService14$2 = _this$chainService14$.privateWallet) === null || _this$chainService14$2 === void 0 ? void 0 : _this$chainService14$2.dropUserSeedPhrase());
|
|
1902
1907
|
// await this.chainService?.mantaPay?.privateWallet?.resetState();
|
|
1903
|
-
await ((_this$
|
|
1904
|
-
await ((_this$
|
|
1908
|
+
await ((_this$chainService15 = this.chainService) === null || _this$chainService15 === void 0 ? void 0 : (_this$chainService15$ = _this$chainService15.mantaPay) === null || _this$chainService15$ === void 0 ? void 0 : _this$chainService15$.deleteMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN));
|
|
1909
|
+
await ((_this$chainService16 = this.chainService) === null || _this$chainService16 === void 0 ? void 0 : (_this$chainService16$ = _this$chainService16.mantaPay) === null || _this$chainService16$ === void 0 ? void 0 : _this$chainService16$.deleteMantaAuthContext(address, _DEFAULT_MANTA_ZK_CHAIN));
|
|
1905
1910
|
this.chainService.setMantaZkAssetSettings(false);
|
|
1906
1911
|
this.isMantaPayEnabled = false;
|
|
1907
1912
|
return true;
|
|
1908
1913
|
}
|
|
1909
1914
|
async initialSyncMantaPay(address) {
|
|
1910
|
-
var _this$
|
|
1915
|
+
var _this$chainService17, _this$chainService17$, _this$chainService18, _this$chainService18$, _this$chainService18$2, _this$chainService18$3, _this$chainService19, _this$chainService19$, _this$chainService19$2, _this$chainService20, _this$chainService20$;
|
|
1911
1916
|
if (!address || isEthereumAddress(address)) {
|
|
1912
1917
|
return;
|
|
1913
1918
|
}
|
|
1914
|
-
(_this$
|
|
1915
|
-
await ((_this$
|
|
1916
|
-
const syncResult = await ((_this$
|
|
1917
|
-
await ((_this$
|
|
1919
|
+
(_this$chainService17 = this.chainService) === null || _this$chainService17 === void 0 ? void 0 : (_this$chainService17$ = _this$chainService17.mantaPay) === null || _this$chainService17$ === void 0 ? void 0 : _this$chainService17$.setCurrentAddress(address);
|
|
1920
|
+
await ((_this$chainService18 = this.chainService) === null || _this$chainService18 === void 0 ? void 0 : (_this$chainService18$ = _this$chainService18.mantaPay) === null || _this$chainService18$ === void 0 ? void 0 : (_this$chainService18$2 = _this$chainService18$.privateWallet) === null || _this$chainService18$2 === void 0 ? void 0 : (_this$chainService18$3 = _this$chainService18$2.baseWallet) === null || _this$chainService18$3 === void 0 ? void 0 : _this$chainService18$3.isApiReady());
|
|
1921
|
+
const syncResult = await ((_this$chainService19 = this.chainService) === null || _this$chainService19 === void 0 ? void 0 : (_this$chainService19$ = _this$chainService19.mantaPay) === null || _this$chainService19$ === void 0 ? void 0 : (_this$chainService19$2 = _this$chainService19$.privateWallet) === null || _this$chainService19$2 === void 0 ? void 0 : _this$chainService19$2.initialWalletSync());
|
|
1922
|
+
await ((_this$chainService20 = this.chainService) === null || _this$chainService20 === void 0 ? void 0 : (_this$chainService20$ = _this$chainService20.mantaPay) === null || _this$chainService20$ === void 0 ? void 0 : _this$chainService20$.updateMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN, {
|
|
1918
1923
|
isInitialSync: true
|
|
1919
1924
|
}));
|
|
1920
1925
|
this.eventService.emit('mantaPay.initSync', undefined);
|
|
1921
1926
|
return syncResult;
|
|
1922
1927
|
}
|
|
1923
1928
|
getMantaZkBalance() {
|
|
1924
|
-
var _this$
|
|
1925
|
-
if (!this.chainService || !((_this$
|
|
1929
|
+
var _this$chainService21, _this$chainService22, _this$chainService22$, _this$chainService22$2, _this$chainService23, _this$chainService23$, _this$chainService24, _this$chainService24$, _this$chainService24$2;
|
|
1930
|
+
if (!this.chainService || !((_this$chainService21 = this.chainService) !== null && _this$chainService21 !== void 0 && _this$chainService21.mantaPay)) {
|
|
1926
1931
|
return;
|
|
1927
1932
|
}
|
|
1928
|
-
if (!((_this$
|
|
1933
|
+
if (!((_this$chainService22 = this.chainService) !== null && _this$chainService22 !== void 0 && (_this$chainService22$ = _this$chainService22.mantaPay) !== null && _this$chainService22$ !== void 0 && (_this$chainService22$2 = _this$chainService22$.privateWallet) !== null && _this$chainService22$2 !== void 0 && _this$chainService22$2.initialSyncIsFinished)) {
|
|
1929
1934
|
return;
|
|
1930
1935
|
}
|
|
1931
|
-
const chain = (_this$
|
|
1936
|
+
const chain = (_this$chainService23 = this.chainService) === null || _this$chainService23 === void 0 ? void 0 : (_this$chainService23$ = _this$chainService23.mantaPay.privateWallet) === null || _this$chainService23$ === void 0 ? void 0 : _this$chainService23$.network;
|
|
1932
1937
|
if (!chain) {
|
|
1933
1938
|
return;
|
|
1934
1939
|
}
|
|
1935
1940
|
const assetMap = this.chainService.getMantaZkAssets(chain === null || chain === void 0 ? void 0 : chain.toLowerCase());
|
|
1936
|
-
(_this$
|
|
1941
|
+
(_this$chainService24 = this.chainService) === null || _this$chainService24 === void 0 ? void 0 : (_this$chainService24$ = _this$chainService24.mantaPay) === null || _this$chainService24$ === void 0 ? void 0 : (_this$chainService24$2 = _this$chainService24$.privateWallet) === null || _this$chainService24$2 === void 0 ? void 0 : _this$chainService24$2.getMultiZkBalance(Object.values(assetMap).map(tokenInfo => new BN(_getTokenOnChainAssetId(tokenInfo)))).then(zkBalances => {
|
|
1937
1942
|
const assetList = Object.values(assetMap);
|
|
1938
1943
|
for (let i = 0; i < assetList.length; i++) {
|
|
1939
1944
|
var _zkBalances$i;
|
|
@@ -1950,9 +1955,9 @@ export default class KoniState {
|
|
|
1950
1955
|
}).catch(console.warn);
|
|
1951
1956
|
}
|
|
1952
1957
|
subscribeMantaPayBalance() {
|
|
1953
|
-
var _this$
|
|
1958
|
+
var _this$chainService25, _this$chainService25$;
|
|
1954
1959
|
let interval;
|
|
1955
|
-
(_this$
|
|
1960
|
+
(_this$chainService25 = this.chainService) === null || _this$chainService25 === void 0 ? void 0 : (_this$chainService25$ = _this$chainService25.mantaPay) === null || _this$chainService25$ === void 0 ? void 0 : _this$chainService25$.getMantaPayConfig(this.keyringService.context.currentAccount.proxyId, _DEFAULT_MANTA_ZK_CHAIN).then(config => {
|
|
1956
1961
|
if (config && config.enabled && config.isInitialSync) {
|
|
1957
1962
|
this.getMantaZkBalance();
|
|
1958
1963
|
interval = setInterval(this.getMantaZkBalance, MANTA_PAY_BALANCE_INTERVAL);
|
|
@@ -1963,23 +1968,23 @@ export default class KoniState {
|
|
|
1963
1968
|
};
|
|
1964
1969
|
}
|
|
1965
1970
|
async syncMantaPay() {
|
|
1966
|
-
var _this$
|
|
1967
|
-
const config = await ((_this$
|
|
1971
|
+
var _this$chainService26, _this$chainService26$, _this$chainService27, _this$chainService27$, _this$chainService27$2;
|
|
1972
|
+
const config = await ((_this$chainService26 = this.chainService) === null || _this$chainService26 === void 0 ? void 0 : (_this$chainService26$ = _this$chainService26.mantaPay) === null || _this$chainService26$ === void 0 ? void 0 : _this$chainService26$.getMantaPayFirstConfig(_DEFAULT_MANTA_ZK_CHAIN));
|
|
1968
1973
|
if (!config.isInitialSync) {
|
|
1969
1974
|
return;
|
|
1970
1975
|
}
|
|
1971
|
-
if ((_this$
|
|
1972
|
-
var _this$
|
|
1973
|
-
await ((_this$
|
|
1976
|
+
if ((_this$chainService27 = this.chainService) !== null && _this$chainService27 !== void 0 && (_this$chainService27$ = _this$chainService27.mantaPay) !== null && _this$chainService27$ !== void 0 && (_this$chainService27$2 = _this$chainService27$.privateWallet) !== null && _this$chainService27$2 !== void 0 && _this$chainService27$2.initialSyncIsFinished) {
|
|
1977
|
+
var _this$chainService28, _this$chainService28$, _this$chainService28$2;
|
|
1978
|
+
await ((_this$chainService28 = this.chainService) === null || _this$chainService28 === void 0 ? void 0 : (_this$chainService28$ = _this$chainService28.mantaPay) === null || _this$chainService28$ === void 0 ? void 0 : (_this$chainService28$2 = _this$chainService28$.privateWallet) === null || _this$chainService28$2 === void 0 ? void 0 : _this$chainService28$2.walletSync());
|
|
1974
1979
|
} else {
|
|
1975
|
-
var _this$
|
|
1976
|
-
await ((_this$
|
|
1980
|
+
var _this$chainService29, _this$chainService29$, _this$chainService29$2;
|
|
1981
|
+
await ((_this$chainService29 = this.chainService) === null || _this$chainService29 === void 0 ? void 0 : (_this$chainService29$ = _this$chainService29.mantaPay) === null || _this$chainService29$ === void 0 ? void 0 : (_this$chainService29$2 = _this$chainService29$.privateWallet) === null || _this$chainService29$2 === void 0 ? void 0 : _this$chainService29$2.initialWalletSync());
|
|
1977
1982
|
}
|
|
1978
1983
|
}
|
|
1979
1984
|
async getMantaPayZkBalance(address, tokenInfo) {
|
|
1980
|
-
var _this$
|
|
1985
|
+
var _this$chainService30, _this$chainService30$, _this$chainService30$2;
|
|
1981
1986
|
const bnAssetId = new BN(_getTokenOnChainAssetId(tokenInfo));
|
|
1982
|
-
const balance = await ((_this$
|
|
1987
|
+
const balance = await ((_this$chainService30 = this.chainService) === null || _this$chainService30 === void 0 ? void 0 : (_this$chainService30$ = _this$chainService30.mantaPay) === null || _this$chainService30$ === void 0 ? void 0 : (_this$chainService30$2 = _this$chainService30$.privateWallet) === null || _this$chainService30$2 === void 0 ? void 0 : _this$chainService30$2.getZkBalance(bnAssetId));
|
|
1983
1988
|
return {
|
|
1984
1989
|
decimals: tokenInfo.decimals || 0,
|
|
1985
1990
|
symbol: tokenInfo.symbol,
|
|
@@ -1987,11 +1992,11 @@ export default class KoniState {
|
|
|
1987
1992
|
};
|
|
1988
1993
|
}
|
|
1989
1994
|
subscribeMantaPaySyncState() {
|
|
1990
|
-
var _this$
|
|
1991
|
-
if (!((_this$
|
|
1995
|
+
var _this$chainService31, _this$chainService32, _this$chainService32$;
|
|
1996
|
+
if (!((_this$chainService31 = this.chainService) !== null && _this$chainService31 !== void 0 && _this$chainService31.mantaPay)) {
|
|
1992
1997
|
return new Subject();
|
|
1993
1998
|
}
|
|
1994
|
-
return (_this$
|
|
1999
|
+
return (_this$chainService32 = this.chainService) === null || _this$chainService32 === void 0 ? void 0 : (_this$chainService32$ = _this$chainService32.mantaPay) === null || _this$chainService32$ === void 0 ? void 0 : _this$chainService32$.subscribeSyncState();
|
|
1995
2000
|
}
|
|
1996
2001
|
|
|
1997
2002
|
/* Metadata */
|
|
@@ -19,7 +19,7 @@ import { _generateCustomProviderKey } from '@subwallet/extension-base/services/c
|
|
|
19
19
|
import { hasSufficientCardanoValue } from '@subwallet/extension-base/services/request-service/helper';
|
|
20
20
|
import { DEFAULT_CHAIN_PATROL_ENABLE } from '@subwallet/extension-base/services/setting-service/constants';
|
|
21
21
|
import { convertCardanoAddressToHex, getEVMChainInfo, reformatAddress, stripUrl } from '@subwallet/extension-base/utils';
|
|
22
|
-
import { BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes,
|
|
22
|
+
import { AllSubstrateKeypairTypes, BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
|
|
23
23
|
import { getBitcoinAddressInfo } from '@subwallet/keyring/utils';
|
|
24
24
|
import { keyring } from '@subwallet/ui-keyring';
|
|
25
25
|
import Web3 from 'web3';
|
|
@@ -38,7 +38,7 @@ function transformAccountsV2(accounts, anyType = false, authInfo, accountAuthTyp
|
|
|
38
38
|
}
|
|
39
39
|
const validTypes = {
|
|
40
40
|
evm: EthereumKeypairTypes,
|
|
41
|
-
substrate:
|
|
41
|
+
substrate: AllSubstrateKeypairTypes,
|
|
42
42
|
ton: TonKeypairTypes,
|
|
43
43
|
cardano: CardanoKeypairTypes,
|
|
44
44
|
bitcoin: BitcoinKeypairTypes
|
|
@@ -66,7 +66,7 @@ function transformAccountsV2(accounts, anyType = false, authInfo, accountAuthTyp
|
|
|
66
66
|
return true;
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
|
|
69
|
+
const injectedAccounts = Object.values(accounts).filter(({
|
|
70
70
|
json: {
|
|
71
71
|
meta: {
|
|
72
72
|
isHidden
|
|
@@ -91,6 +91,12 @@ function transformAccountsV2(accounts, anyType = false, authInfo, accountAuthTyp
|
|
|
91
91
|
name,
|
|
92
92
|
type
|
|
93
93
|
}));
|
|
94
|
+
return injectedAccounts.map(acc => {
|
|
95
|
+
if (acc.type === 'ed25519-tw') {
|
|
96
|
+
acc.type = 'ed25519';
|
|
97
|
+
}
|
|
98
|
+
return acc;
|
|
99
|
+
});
|
|
94
100
|
}
|
|
95
101
|
// check if a URL is blocked
|
|
96
102
|
export const chainPatrolCheckUrl = async url => {
|