@subwallet/extension-base 1.3.21-0 → 1.3.23-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 +75 -2
- package/background/KoniTypes.js +2 -0
- package/cjs/background/KoniTypes.js +2 -0
- package/cjs/constants/environment.js +4 -2
- package/cjs/constants/signing.js +6 -2
- package/cjs/core/logic-validation/recipientAddress.js +9 -1
- package/cjs/core/logic-validation/transfer.js +35 -29
- package/cjs/core/types.js +1 -0
- package/cjs/core/utils.js +12 -1
- package/cjs/defaults.js +1 -1
- package/cjs/koni/api/dotsama/crowdloan.js +1 -1
- package/cjs/koni/api/nft/index.js +9 -16
- package/cjs/koni/api/staking/index.js +3 -4
- package/cjs/koni/background/handlers/Extension.js +234 -96
- package/cjs/koni/background/handlers/State.js +15 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/cardano/consts.js +11 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/index.js +63 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/types.js +1 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +74 -0
- package/cjs/services/balance-service/helpers/subscribe/index.js +21 -7
- package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +2 -2
- package/cjs/services/balance-service/index.js +4 -2
- package/cjs/services/balance-service/transfer/cardano-transfer.js +122 -0
- package/cjs/services/balance-service/transfer/token.js +4 -4
- package/cjs/services/chain-service/constants.js +8 -3
- package/cjs/services/chain-service/handler/CardanoApi.js +176 -0
- package/cjs/services/chain-service/handler/CardanoChainHandler.js +83 -0
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +3 -2
- package/cjs/services/chain-service/handler/TonApi.js +2 -5
- package/cjs/services/chain-service/index.js +38 -7
- package/cjs/services/chain-service/utils/index.js +40 -11
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/constants/chains.js +2 -1
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost-manta.js +1 -1
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +1 -1
- package/cjs/services/earning-service/handlers/native-staking/mythos.js +337 -0
- package/cjs/services/earning-service/service.js +10 -12
- package/cjs/services/earning-service/utils/index.js +2 -0
- package/cjs/services/fee-service/service.js +19 -8
- package/cjs/services/history-service/index.js +4 -6
- package/cjs/services/inapp-notification-service/index.js +12 -4
- package/cjs/services/keyring-service/context/account-context.js +17 -2
- package/cjs/services/keyring-service/context/handlers/Derive.js +10 -7
- package/cjs/services/keyring-service/context/handlers/Migration.js +268 -0
- package/cjs/services/keyring-service/context/handlers/Mnemonic.js +2 -2
- package/cjs/services/keyring-service/context/handlers/Secret.js +1 -1
- package/cjs/services/keyring-service/utils.js +18 -0
- package/cjs/services/migration-service/scripts/databases/ClearMetadataDatabase.js +3 -23
- package/cjs/services/migration-service/scripts/databases/ClearMetadataForChains.js +40 -0
- package/cjs/services/migration-service/scripts/databases/ClearMetadataForMythos.js +15 -0
- package/cjs/services/migration-service/scripts/index.js +6 -2
- package/cjs/services/request-service/handler/CardanoRequestHandler.js +172 -0
- package/cjs/services/request-service/handler/EvmRequestHandler.js +1 -1
- package/cjs/services/request-service/index.js +20 -2
- package/cjs/services/setting-service/constants.js +10 -1
- package/cjs/services/storage-service/DatabaseService.js +6 -0
- package/cjs/services/storage-service/db-stores/InappNotification.js +6 -0
- package/cjs/services/storage-service/db-stores/Metadata.js +3 -0
- package/cjs/services/storage-service/db-stores/Migration.js +6 -1
- package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -59
- package/cjs/services/swap-service/handler/chainflip-handler.js +33 -281
- package/cjs/services/swap-service/handler/hydradx-handler.js +23 -190
- package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -222
- package/cjs/services/swap-service/handler/uniswap-handler.js +331 -0
- package/cjs/services/swap-service/index.js +31 -22
- package/cjs/services/swap-service/utils.js +21 -38
- package/cjs/services/transaction-service/helpers/index.js +6 -1
- package/cjs/services/transaction-service/index.js +278 -21
- package/cjs/services/transaction-service/utils.js +5 -1
- package/cjs/types/account/info/keyring.js +12 -1
- package/cjs/types/fee/cardano.js +1 -0
- package/cjs/types/swap/index.js +7 -2
- package/cjs/utils/account/analyze.js +2 -1
- package/cjs/utils/account/common.js +29 -20
- package/cjs/utils/account/derive/info/solo.js +9 -4
- package/cjs/utils/account/derive/validate.js +36 -2
- package/cjs/utils/account/transform.js +38 -13
- package/cjs/utils/fee/transfer.js +40 -7
- package/cjs/utils/index.js +2 -2
- package/cjs/utils/staticData/index.js +7 -2
- package/constants/environment.d.ts +1 -0
- package/constants/environment.js +2 -1
- package/constants/signing.js +6 -2
- package/core/logic-validation/recipientAddress.js +11 -3
- package/core/logic-validation/transfer.js +9 -3
- package/core/substrate/xcm-parser.d.ts +1 -1
- package/core/types.d.ts +1 -0
- package/core/types.js +1 -0
- package/core/utils.d.ts +1 -0
- package/core/utils.js +13 -3
- package/defaults.d.ts +1 -1
- package/defaults.js +1 -1
- package/koni/api/dotsama/crowdloan.js +3 -3
- package/koni/api/nft/index.js +10 -16
- package/koni/api/nft/story_odyssey_nft/index.d.ts +1 -1
- package/koni/api/staking/index.js +4 -5
- package/koni/background/handlers/Extension.d.ts +9 -0
- package/koni/background/handlers/Extension.js +144 -8
- package/koni/background/handlers/State.d.ts +5 -1
- package/koni/background/handlers/State.js +16 -1
- package/package.json +102 -25
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/cardano/consts.d.ts +1 -0
- package/services/balance-service/helpers/subscribe/cardano/consts.js +4 -0
- package/services/balance-service/helpers/subscribe/cardano/index.d.ts +2 -0
- package/services/balance-service/helpers/subscribe/cardano/index.js +57 -0
- package/services/balance-service/helpers/subscribe/cardano/types.d.ts +34 -0
- package/services/balance-service/helpers/subscribe/cardano/types.js +1 -0
- package/services/balance-service/helpers/subscribe/cardano/utils.d.ts +15 -0
- package/services/balance-service/helpers/subscribe/cardano/utils.js +62 -0
- package/services/balance-service/helpers/subscribe/index.d.ts +2 -2
- package/services/balance-service/helpers/subscribe/index.js +23 -9
- package/services/balance-service/helpers/subscribe/ton/utils.d.ts +1 -1
- package/services/balance-service/helpers/subscribe/ton/utils.js +1 -1
- package/services/balance-service/index.js +4 -2
- package/services/balance-service/transfer/cardano-transfer.d.ts +24 -0
- package/services/balance-service/transfer/cardano-transfer.js +114 -0
- package/services/balance-service/transfer/token.d.ts +1 -1
- package/services/balance-service/transfer/token.js +2 -2
- package/services/chain-service/constants.js +8 -3
- package/services/chain-service/handler/CardanoApi.d.ts +38 -0
- package/services/chain-service/handler/CardanoApi.js +167 -0
- package/services/chain-service/handler/CardanoChainHandler.d.ts +17 -0
- package/services/chain-service/handler/CardanoChainHandler.js +75 -0
- package/services/chain-service/handler/SubstrateChainHandler.js +3 -2
- package/services/chain-service/handler/TonApi.js +3 -6
- package/services/chain-service/handler/types.d.ts +1 -0
- package/services/chain-service/index.d.ts +4 -1
- package/services/chain-service/index.js +38 -7
- package/services/chain-service/types.d.ts +9 -1
- package/services/chain-service/utils/index.d.ts +4 -0
- package/services/chain-service/utils/index.js +32 -11
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/constants/chains.d.ts +1 -0
- package/services/earning-service/constants/chains.js +2 -1
- package/services/earning-service/handlers/liquid-staking/bifrost-manta.js +1 -1
- package/services/earning-service/handlers/liquid-staking/bifrost.js +1 -1
- package/services/earning-service/handlers/native-staking/mythos.d.ts +35 -0
- package/services/earning-service/handlers/native-staking/mythos.js +329 -0
- package/services/earning-service/service.js +12 -14
- package/services/earning-service/utils/index.js +2 -0
- package/services/fee-service/service.js +19 -8
- package/services/history-service/index.js +6 -8
- package/services/inapp-notification-service/index.d.ts +3 -4
- package/services/inapp-notification-service/index.js +14 -6
- package/services/keyring-service/context/account-context.d.ts +6 -2
- package/services/keyring-service/context/account-context.js +17 -2
- package/services/keyring-service/context/handlers/Derive.d.ts +1 -1
- package/services/keyring-service/context/handlers/Derive.js +10 -8
- package/services/keyring-service/context/handlers/Migration.d.ts +17 -0
- package/services/keyring-service/context/handlers/Migration.js +258 -0
- package/services/keyring-service/context/handlers/Mnemonic.js +2 -2
- package/services/keyring-service/context/handlers/Secret.js +2 -2
- package/services/keyring-service/utils.d.ts +2 -0
- package/services/keyring-service/utils.js +11 -0
- package/services/migration-service/scripts/databases/ClearMetadataDatabase.d.ts +3 -3
- package/services/migration-service/scripts/databases/ClearMetadataDatabase.js +3 -23
- package/services/migration-service/scripts/databases/ClearMetadataForChains.d.ts +5 -0
- package/services/migration-service/scripts/databases/ClearMetadataForChains.js +32 -0
- package/services/migration-service/scripts/databases/ClearMetadataForMythos.d.ts +4 -0
- package/services/migration-service/scripts/databases/ClearMetadataForMythos.js +7 -0
- package/services/migration-service/scripts/index.d.ts +1 -0
- package/services/migration-service/scripts/index.js +4 -1
- package/services/request-service/handler/CardanoRequestHandler.d.ts +16 -0
- package/services/request-service/handler/CardanoRequestHandler.js +163 -0
- package/services/request-service/handler/EvmRequestHandler.js +1 -1
- package/services/request-service/index.d.ts +6 -3
- package/services/request-service/index.js +19 -5
- package/services/setting-service/constants.d.ts +3 -0
- package/services/setting-service/constants.js +6 -0
- package/services/storage-service/DatabaseService.d.ts +2 -0
- package/services/storage-service/DatabaseService.js +6 -0
- package/services/storage-service/db-stores/InappNotification.d.ts +1 -0
- package/services/storage-service/db-stores/InappNotification.js +6 -0
- package/services/storage-service/db-stores/Metadata.d.ts +1 -0
- package/services/storage-service/db-stores/Metadata.js +3 -0
- package/services/storage-service/db-stores/Migration.d.ts +1 -0
- package/services/storage-service/db-stores/Migration.js +6 -1
- package/services/swap-service/handler/asset-hub/handler.d.ts +1 -4
- package/services/swap-service/handler/asset-hub/handler.js +2 -61
- package/services/swap-service/handler/base-handler.d.ts +1 -4
- package/services/swap-service/handler/chainflip-handler.d.ts +2 -9
- package/services/swap-service/handler/chainflip-handler.js +31 -280
- package/services/swap-service/handler/hydradx-handler.d.ts +1 -6
- package/services/swap-service/handler/hydradx-handler.js +13 -180
- package/services/swap-service/handler/simpleswap-handler.d.ts +1 -4
- package/services/swap-service/handler/simpleswap-handler.js +5 -226
- package/services/swap-service/handler/uniswap-handler.d.ts +41 -0
- package/services/swap-service/handler/uniswap-handler.js +323 -0
- package/services/swap-service/index.js +30 -22
- package/services/swap-service/utils.d.ts +1 -5
- package/services/swap-service/utils.js +7 -21
- package/services/transaction-service/helpers/index.d.ts +2 -0
- package/services/transaction-service/helpers/index.js +4 -0
- package/services/transaction-service/index.d.ts +8 -2
- package/services/transaction-service/index.js +263 -10
- package/services/transaction-service/types.d.ts +7 -0
- package/services/transaction-service/utils.js +7 -2
- package/types/account/info/keyring.d.ts +4 -1
- package/types/account/info/keyring.js +9 -0
- package/types/account/info/proxy.d.ts +2 -0
- package/types/balance/index.d.ts +4 -1
- package/types/fee/base.d.ts +1 -1
- package/types/fee/cardano.d.ts +18 -0
- package/types/fee/cardano.js +1 -0
- package/types/fee/subscription.d.ts +4 -3
- package/types/swap/index.d.ts +11 -3
- package/types/swap/index.js +7 -2
- package/utils/account/analyze.js +2 -1
- package/utils/account/common.d.ts +11 -6
- package/utils/account/common.js +28 -19
- package/utils/account/derive/info/solo.js +10 -5
- package/utils/account/derive/validate.d.ts +1 -0
- package/utils/account/derive/validate.js +34 -1
- package/utils/account/transform.d.ts +2 -1
- package/utils/account/transform.js +37 -13
- package/utils/fee/transfer.d.ts +2 -1
- package/utils/fee/transfer.js +44 -11
- package/utils/index.js +4 -4
- package/utils/staticData/index.d.ts +4 -1
- package/utils/staticData/index.js +5 -1
- package/utils/staticData/oldChainPrefix.json +1 -0
|
@@ -35,6 +35,6 @@ export declare class OdysseyNftApi extends BaseNftApi {
|
|
|
35
35
|
private processNftItem;
|
|
36
36
|
handleNfts(params: HandleNftParams): Promise<void>;
|
|
37
37
|
fetchNftsWithDetail(address: string): Promise<OdysseyToken[] | null>;
|
|
38
|
-
fetchNfts(params: HandleNftParams): Promise<
|
|
38
|
+
fetchNfts(params: HandleNftParams): Promise<1 | 0>;
|
|
39
39
|
}
|
|
40
40
|
export {};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { ChainType } from '@subwallet/extension-base/background/KoniTypes';
|
|
4
5
|
import { getAmplitudeStakingOnChain, getAstarStakingOnChain, getParaStakingOnChain } from '@subwallet/extension-base/koni/api/staking/paraChain';
|
|
5
6
|
import { getNominationPoolReward, getRelayPoolingOnChain, getRelayStakingOnChain } from '@subwallet/extension-base/koni/api/staking/relayChain';
|
|
6
7
|
import { getAllSubsquidStaking } from '@subwallet/extension-base/koni/api/staking/subsquidStaking';
|
|
7
8
|
import { _PURE_EVM_CHAINS } from '@subwallet/extension-base/services/chain-service/constants';
|
|
8
9
|
import { _isChainEvmCompatible, _isChainSupportSubstrateStaking, _isSubstrateRelayChain } from '@subwallet/extension-base/services/chain-service/utils';
|
|
9
10
|
import { _STAKING_CHAIN_GROUP } from '@subwallet/extension-base/services/earning-service/constants';
|
|
10
|
-
import {
|
|
11
|
+
import { getAddressesByChainType } from '@subwallet/extension-base/utils';
|
|
11
12
|
export function stakingOnChainApi(addresses, substrateApiMap, chainInfoMap, stakingCallback, nominatorStateCallback) {
|
|
12
13
|
const filteredApiMap = [];
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
substrate: substrateAddresses
|
|
16
|
-
} = categoryAddresses(addresses);
|
|
14
|
+
const evmAddresses = getAddressesByChainType(addresses, [ChainType.EVM]);
|
|
15
|
+
const substrateAddresses = getAddressesByChainType(addresses, [ChainType.SUBSTRATE]);
|
|
17
16
|
Object.entries(chainInfoMap).forEach(([networkKey, chainInfo]) => {
|
|
18
17
|
if (_PURE_EVM_CHAINS.indexOf(networkKey) < 0 && _isChainSupportSubstrateStaking(chainInfo)) {
|
|
19
18
|
filteredApiMap.push({
|
|
@@ -77,6 +77,9 @@ export default class KoniExtension {
|
|
|
77
77
|
private subscribeSettings;
|
|
78
78
|
private setEnableChainPatrol;
|
|
79
79
|
private saveNotificationSetup;
|
|
80
|
+
private saveMigrationAcknowledgedStatus;
|
|
81
|
+
private saveUnifiedAccountMigrationInProgress;
|
|
82
|
+
private pingUnifiedAccountMigrationDone;
|
|
80
83
|
private setShowZeroBalance;
|
|
81
84
|
private setLanguage;
|
|
82
85
|
private setShowBalance;
|
|
@@ -149,8 +152,10 @@ export default class KoniExtension {
|
|
|
149
152
|
private resolveQrTransfer;
|
|
150
153
|
private subscribeConfirmations;
|
|
151
154
|
private subscribeConfirmationsTon;
|
|
155
|
+
private subscribeConfirmationsCardano;
|
|
152
156
|
private completeConfirmation;
|
|
153
157
|
private completeConfirmationTon;
|
|
158
|
+
private completeConfirmationCardano;
|
|
154
159
|
private getNetworkJsonByChainId;
|
|
155
160
|
private parseSubstrateTransaction;
|
|
156
161
|
private parseEVMRLP;
|
|
@@ -250,6 +255,7 @@ export default class KoniExtension {
|
|
|
250
255
|
private subscribeBuyTokens;
|
|
251
256
|
private subscribeBuyServices;
|
|
252
257
|
private subscribeSwapPairs;
|
|
258
|
+
private generateOptimalProcess;
|
|
253
259
|
private handleSwapRequest;
|
|
254
260
|
private getLatestSwapQuote;
|
|
255
261
|
private validateSwapProcess;
|
|
@@ -268,5 +274,8 @@ export default class KoniExtension {
|
|
|
268
274
|
private createPassConfirmationParams;
|
|
269
275
|
private subscribeProcessById;
|
|
270
276
|
private subscribeProcessAlive;
|
|
277
|
+
private migrateUnifiedAndFetchEligibleSoloAccounts;
|
|
278
|
+
private migrateSoloAccount;
|
|
279
|
+
private pingSession;
|
|
271
280
|
handle<TMessageType extends MessageTypes>(id: string, type: TMessageType, request: RequestTypes[TMessageType], port: chrome.runtime.Port): Promise<ResponseType<TMessageType>>;
|
|
272
281
|
}
|
|
@@ -22,9 +22,11 @@ import { getBondingExtrinsic, getCancelWithdrawalExtrinsic, getClaimRewardExtrin
|
|
|
22
22
|
import { getTuringCancelCompoundingExtrinsic, getTuringCompoundExtrinsic } from '@subwallet/extension-base/koni/api/staking/bonding/paraChain';
|
|
23
23
|
import { getPoolingBondingExtrinsic, getPoolingUnbondingExtrinsic, validatePoolBondingCondition, validateRelayUnbondingCondition } from '@subwallet/extension-base/koni/api/staking/bonding/relayChain';
|
|
24
24
|
import { YIELD_EXTRINSIC_TYPES } from '@subwallet/extension-base/koni/api/yield/helper/utils';
|
|
25
|
+
import { DEFAULT_CARDANO_TTL_OFFSET } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/cardano/consts';
|
|
25
26
|
import { isBounceableAddress } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/ton/utils';
|
|
27
|
+
import { createCardanoTransaction } from '@subwallet/extension-base/services/balance-service/transfer/cardano-transfer';
|
|
26
28
|
import { getERC20TransactionObject, getERC721Transaction, getEVMTransactionObject, getPSP34TransferExtrinsic } from '@subwallet/extension-base/services/balance-service/transfer/smart-contract';
|
|
27
|
-
import {
|
|
29
|
+
import { createSubstrateExtrinsic } from '@subwallet/extension-base/services/balance-service/transfer/token';
|
|
28
30
|
import { createTonTransaction } from '@subwallet/extension-base/services/balance-service/transfer/ton-transfer';
|
|
29
31
|
import { createAvailBridgeExtrinsicFromAvail, createAvailBridgeTxFromEth, createPolygonBridgeExtrinsic, createSnowBridgeExtrinsic, createXcmExtrinsic } from '@subwallet/extension-base/services/balance-service/transfer/xcm';
|
|
30
32
|
import { getClaimTxOnAvail, getClaimTxOnEthereum, isAvailChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge';
|
|
@@ -32,7 +34,7 @@ import { _isPolygonChainBridge, getClaimPolygonBridge, isClaimedPolygonBridge }
|
|
|
32
34
|
import { _isPosChainBridge, getClaimPosBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge';
|
|
33
35
|
import { _DEFAULT_MANTA_ZK_CHAIN, _MANTA_ZK_CHAIN_GROUP, _ZK_ASSET_PREFIX, SUFFICIENT_CHAIN } from '@subwallet/extension-base/services/chain-service/constants';
|
|
34
36
|
import { _ChainConnectionStatus } from '@subwallet/extension-base/services/chain-service/types';
|
|
35
|
-
import { _getAssetDecimals, _getAssetSymbol, _getChainNativeTokenBasicInfo, _getContractAddressOfToken, _getEvmChainId, _getTokenOnChainAssetId, _getXcmAssetMultilocation, _isAssetSmartContractNft, _isBridgedToken, _isChainEvmCompatible, _isChainSubstrateCompatible, _isCustomAsset, _isLocalToken, _isMantaZkAsset, _isNativeToken, _isPureEvmChain, _isTokenEvmSmartContract, _isTokenTransferredByEvm, _isTokenTransferredByTon } from '@subwallet/extension-base/services/chain-service/utils';
|
|
37
|
+
import { _getAssetDecimals, _getAssetSymbol, _getChainNativeTokenBasicInfo, _getContractAddressOfToken, _getEvmChainId, _getTokenOnChainAssetId, _getXcmAssetMultilocation, _isAssetSmartContractNft, _isBridgedToken, _isChainEvmCompatible, _isChainSubstrateCompatible, _isCustomAsset, _isLocalToken, _isMantaZkAsset, _isNativeToken, _isPureEvmChain, _isTokenEvmSmartContract, _isTokenTransferredByCardano, _isTokenTransferredByEvm, _isTokenTransferredByTon } from '@subwallet/extension-base/services/chain-service/utils';
|
|
36
38
|
import { calculateToAmountByReservePool } from '@subwallet/extension-base/services/fee-service/utils';
|
|
37
39
|
import { EXTENSION_REQUEST_URL } from '@subwallet/extension-base/services/request-service/constants';
|
|
38
40
|
import { DEFAULT_AUTO_LOCK_TIME } from '@subwallet/extension-base/services/setting-service/constants';
|
|
@@ -40,11 +42,11 @@ import { checkLiquidityForPool, estimateTokensForPool, getReserveForPool } from
|
|
|
40
42
|
import { isProposalExpired, isSupportWalletConnectChain, isSupportWalletConnectNamespace } from '@subwallet/extension-base/services/wallet-connect-service/helpers';
|
|
41
43
|
import { SWStorage } from '@subwallet/extension-base/storage';
|
|
42
44
|
import { AccountsStore } from '@subwallet/extension-base/stores';
|
|
43
|
-
import { AccountSignMode, BasicTxErrorType, BasicTxWarningCode, CommonStepType, EarningProcessType, ProcessType, StakingTxErrorType, StepStatus, SwapFeeType, SwapStepType, YieldPoolType, YieldStepType } from '@subwallet/extension-base/types';
|
|
45
|
+
import { AccountSignMode, BasicTxErrorType, BasicTxWarningCode, CommonStepType, EarningProcessType, ProcessType, StakingTxErrorType, StepStatus, SwapFeeType, SwapProviderId, SwapStepType, YieldPoolType, YieldStepType } from '@subwallet/extension-base/types';
|
|
44
46
|
import { _analyzeAddress, calculateMaxTransferable, combineAllAccountProxy, createTransactionFromRLP, detectTransferTxType, getAccountSignMode, isSameAddress, MODULE_SUPPORT, reformatAddress, signatureToHex, transformAccounts, transformAddresses, uniqueStringArray } from '@subwallet/extension-base/utils';
|
|
45
47
|
import { parseContractInput, parseEvmRlp } from '@subwallet/extension-base/utils/eth/parseTransaction';
|
|
46
48
|
import { getId } from '@subwallet/extension-base/utils/getId';
|
|
47
|
-
import { getKeypairTypeByAddress, isAddress, isSubstrateAddress, isTonAddress } from '@subwallet/keyring';
|
|
49
|
+
import { getKeypairTypeByAddress, isAddress, isCardanoAddress, isSubstrateAddress, isTonAddress } from '@subwallet/keyring';
|
|
48
50
|
import { EthereumKeypairTypes, SubstrateKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
|
|
49
51
|
import { keyring } from '@subwallet/ui-keyring';
|
|
50
52
|
import { getSdkError } from '@walletconnect/utils';
|
|
@@ -781,6 +783,22 @@ export default class KoniExtension {
|
|
|
781
783
|
this.#koniState.updateSetting('notificationSetup', request);
|
|
782
784
|
return true;
|
|
783
785
|
}
|
|
786
|
+
saveMigrationAcknowledgedStatus({
|
|
787
|
+
isAcknowledgedUnifiedAccountMigration
|
|
788
|
+
}) {
|
|
789
|
+
this.#koniState.updateSetting('isAcknowledgedUnifiedAccountMigration', isAcknowledgedUnifiedAccountMigration);
|
|
790
|
+
return true;
|
|
791
|
+
}
|
|
792
|
+
saveUnifiedAccountMigrationInProgress({
|
|
793
|
+
isUnifiedAccountMigrationInProgress
|
|
794
|
+
}) {
|
|
795
|
+
this.#koniState.updateSetting('isUnifiedAccountMigrationInProgress', isUnifiedAccountMigrationInProgress);
|
|
796
|
+
return true;
|
|
797
|
+
}
|
|
798
|
+
pingUnifiedAccountMigrationDone() {
|
|
799
|
+
this.#koniState.updateSetting('isUnifiedAccountMigrationInProgress', false);
|
|
800
|
+
return true;
|
|
801
|
+
}
|
|
784
802
|
setShowZeroBalance({
|
|
785
803
|
show
|
|
786
804
|
}) {
|
|
@@ -1193,9 +1211,23 @@ export default class KoniExtension {
|
|
|
1193
1211
|
// currently not used
|
|
1194
1212
|
tonApi
|
|
1195
1213
|
});
|
|
1214
|
+
} else if (isCardanoAddress(from) && isCardanoAddress(to) && _isTokenTransferredByCardano(transferTokenInfo)) {
|
|
1215
|
+
chainType = ChainType.CARDANO;
|
|
1216
|
+
const cardanoApi = this.#koniState.getCardanoApi(chain);
|
|
1217
|
+
[transaction, transferAmount.value] = await createCardanoTransaction({
|
|
1218
|
+
tokenInfo: transferTokenInfo,
|
|
1219
|
+
from,
|
|
1220
|
+
to,
|
|
1221
|
+
networkKey: chain,
|
|
1222
|
+
value: value || '0',
|
|
1223
|
+
cardanoTtlOffset: DEFAULT_CARDANO_TTL_OFFSET,
|
|
1224
|
+
transferAll: !!transferAll,
|
|
1225
|
+
cardanoApi,
|
|
1226
|
+
nativeTokenInfo
|
|
1227
|
+
});
|
|
1196
1228
|
} else {
|
|
1197
1229
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
1198
|
-
[transaction, transferAmount.value] = await
|
|
1230
|
+
[transaction, transferAmount.value] = await createSubstrateExtrinsic({
|
|
1199
1231
|
transferAll: !!transferAll,
|
|
1200
1232
|
value: value || '0',
|
|
1201
1233
|
from: from,
|
|
@@ -1695,6 +1727,7 @@ export default class KoniExtension {
|
|
|
1695
1727
|
}
|
|
1696
1728
|
const _request = {
|
|
1697
1729
|
address: address,
|
|
1730
|
+
cardanoApi: this.#koniState.chainService.getCardanoApi(chain),
|
|
1698
1731
|
destChain,
|
|
1699
1732
|
destToken,
|
|
1700
1733
|
evmApi: this.#koniState.chainService.getEvmApi(chain),
|
|
@@ -1892,12 +1925,24 @@ export default class KoniExtension {
|
|
|
1892
1925
|
});
|
|
1893
1926
|
return this.#koniState.getConfirmationsQueueSubjectTon().getValue();
|
|
1894
1927
|
}
|
|
1928
|
+
subscribeConfirmationsCardano(id, port) {
|
|
1929
|
+
const cb = createSubscription(id, port);
|
|
1930
|
+
const subscription = this.#koniState.getConfirmationsQueueSubjectCardano().subscribe(cb);
|
|
1931
|
+
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
1932
|
+
port.onDisconnect.addListener(() => {
|
|
1933
|
+
this.cancelSubscription(id);
|
|
1934
|
+
});
|
|
1935
|
+
return this.#koniState.getConfirmationsQueueSubjectCardano().getValue();
|
|
1936
|
+
}
|
|
1895
1937
|
async completeConfirmation(request) {
|
|
1896
1938
|
return await this.#koniState.completeConfirmation(request);
|
|
1897
1939
|
}
|
|
1898
1940
|
async completeConfirmationTon(request) {
|
|
1899
1941
|
return await this.#koniState.completeConfirmationTon(request);
|
|
1900
1942
|
}
|
|
1943
|
+
async completeConfirmationCardano(request) {
|
|
1944
|
+
return await this.#koniState.completeConfirmationCardano(request);
|
|
1945
|
+
}
|
|
1901
1946
|
|
|
1902
1947
|
/// Sign Qr
|
|
1903
1948
|
|
|
@@ -3109,6 +3154,17 @@ export default class KoniExtension {
|
|
|
3109
3154
|
}
|
|
3110
3155
|
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(yieldValidation);
|
|
3111
3156
|
}
|
|
3157
|
+
let submitData;
|
|
3158
|
+
try {
|
|
3159
|
+
submitData = await this.#koniState.earningService.handleYieldJoin(inputData);
|
|
3160
|
+
} catch (e) {
|
|
3161
|
+
if (step) {
|
|
3162
|
+
this.#koniState.transactionService.updateProcessStepStatus(step, {
|
|
3163
|
+
status: StepStatus.FAILED
|
|
3164
|
+
});
|
|
3165
|
+
}
|
|
3166
|
+
throw e;
|
|
3167
|
+
}
|
|
3112
3168
|
|
|
3113
3169
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3114
3170
|
const {
|
|
@@ -3118,7 +3174,7 @@ export default class KoniExtension {
|
|
|
3118
3174
|
transferNativeAmount,
|
|
3119
3175
|
txChain,
|
|
3120
3176
|
txData
|
|
3121
|
-
} =
|
|
3177
|
+
} = submitData;
|
|
3122
3178
|
const isPoolSupportAlternativeFee = this.#koniState.earningService.isPoolSupportAlternativeFee(inputData.data.slug);
|
|
3123
3179
|
const poolHandler = this.#koniState.earningService.getPoolHandler(data.slug);
|
|
3124
3180
|
const isMintingStep = YIELD_EXTRINSIC_TYPES.includes(extrinsicType);
|
|
@@ -3527,6 +3583,9 @@ export default class KoniExtension {
|
|
|
3527
3583
|
ready = true;
|
|
3528
3584
|
return this.#koniState.swapService.getSwapPairs();
|
|
3529
3585
|
}
|
|
3586
|
+
async generateOptimalProcess(request) {
|
|
3587
|
+
return this.#koniState.swapService.generateOptimalProcess(request);
|
|
3588
|
+
}
|
|
3530
3589
|
async handleSwapRequest(request) {
|
|
3531
3590
|
return this.#koniState.swapService.handleSwapRequest(request);
|
|
3532
3591
|
}
|
|
@@ -3578,16 +3637,29 @@ export default class KoniExtension {
|
|
|
3578
3637
|
}
|
|
3579
3638
|
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(swapValidations);
|
|
3580
3639
|
}
|
|
3640
|
+
let submitData;
|
|
3641
|
+
try {
|
|
3642
|
+
submitData = await this.#koniState.swapService.handleSwapProcess(inputData);
|
|
3643
|
+
} catch (e) {
|
|
3644
|
+
if (step) {
|
|
3645
|
+
this.#koniState.transactionService.updateProcessStepStatus(step, {
|
|
3646
|
+
status: StepStatus.FAILED
|
|
3647
|
+
});
|
|
3648
|
+
}
|
|
3649
|
+
throw e;
|
|
3650
|
+
}
|
|
3581
3651
|
|
|
3582
3652
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3583
3653
|
const {
|
|
3584
3654
|
chainType,
|
|
3585
3655
|
extrinsic,
|
|
3586
3656
|
extrinsicType,
|
|
3657
|
+
isPermit,
|
|
3587
3658
|
transferNativeAmount,
|
|
3588
3659
|
txChain,
|
|
3589
3660
|
txData
|
|
3590
|
-
} =
|
|
3661
|
+
} = submitData;
|
|
3662
|
+
|
|
3591
3663
|
// const chosenFeeToken = process.steps.findIndex((step) => step.type === SwapStepType.SET_FEE_TOKEN) > -1;
|
|
3592
3664
|
// const allowSkipValidation = [ExtrinsicType.SET_FEE_TOKEN, ExtrinsicType.SWAP].includes(extrinsicType);
|
|
3593
3665
|
|
|
@@ -3670,6 +3742,24 @@ export default class KoniExtension {
|
|
|
3670
3742
|
await this.#koniState.transactionService.updateProcessInfo(processId, combineInfo, step);
|
|
3671
3743
|
}
|
|
3672
3744
|
}
|
|
3745
|
+
if (isPermit) {
|
|
3746
|
+
return await this.#koniState.transactionService.handlePermitTransaction({
|
|
3747
|
+
address,
|
|
3748
|
+
chain: txChain,
|
|
3749
|
+
transaction: extrinsic,
|
|
3750
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3751
|
+
data: txData,
|
|
3752
|
+
extrinsicType,
|
|
3753
|
+
// change this depends on step
|
|
3754
|
+
chainType,
|
|
3755
|
+
resolveOnDone: !isLastStep,
|
|
3756
|
+
transferNativeAmount,
|
|
3757
|
+
...this.createPassConfirmationParams(isPassConfirmation),
|
|
3758
|
+
errorOnTimeOut,
|
|
3759
|
+
eventsHandler,
|
|
3760
|
+
step
|
|
3761
|
+
});
|
|
3762
|
+
}
|
|
3673
3763
|
return await this.#koniState.transactionService.handleTransaction({
|
|
3674
3764
|
address,
|
|
3675
3765
|
chain: txChain,
|
|
@@ -3887,7 +3977,8 @@ export default class KoniExtension {
|
|
|
3887
3977
|
const onSend = callback
|
|
3888
3978
|
// eslint-disable-next-line node/no-callback-literal
|
|
3889
3979
|
? rs => callback(rs) : undefined;
|
|
3890
|
-
|
|
3980
|
+
const specialCaseForUniswap = data.quote.provider.id === SwapProviderId.UNISWAP && !!data.process.steps.find(step => step.type === SwapStepType.PERMIT);
|
|
3981
|
+
if (stepNums > 2 && isLastStep && !specialCaseForUniswap) {
|
|
3891
3982
|
const quote = data.quote;
|
|
3892
3983
|
const latestSwapQuote = await this.getLatestSwapQuote({
|
|
3893
3984
|
address: data.address,
|
|
@@ -4013,6 +4104,32 @@ export default class KoniExtension {
|
|
|
4013
4104
|
|
|
4014
4105
|
/* Multi process */
|
|
4015
4106
|
|
|
4107
|
+
/* Migrate Unified Account */
|
|
4108
|
+
async migrateUnifiedAndFetchEligibleSoloAccounts(request) {
|
|
4109
|
+
const setMigratingMode = () => {
|
|
4110
|
+
this.saveUnifiedAccountMigrationInProgress({
|
|
4111
|
+
isUnifiedAccountMigrationInProgress: true
|
|
4112
|
+
});
|
|
4113
|
+
};
|
|
4114
|
+
return await this.#koniState.keyringService.context.migrateUnifiedAndFetchEligibleSoloAccounts(request, setMigratingMode);
|
|
4115
|
+
}
|
|
4116
|
+
migrateSoloAccount(request) {
|
|
4117
|
+
const proxyIds = request.soloAccounts.map(account => account.proxyId);
|
|
4118
|
+
const response = this.#koniState.keyringService.context.migrateSoloAccount(request);
|
|
4119
|
+
const newProxyId = response.migratedUnifiedAccountId; // get from response to ensure account migration is done.
|
|
4120
|
+
const newName = request.accountName;
|
|
4121
|
+
try {
|
|
4122
|
+
this.#koniState.inappNotificationService.migrateNotificationProxyId(proxyIds, newProxyId, newName);
|
|
4123
|
+
} catch (error) {
|
|
4124
|
+
console.error('Error on migrating notification for unified account migration', error);
|
|
4125
|
+
}
|
|
4126
|
+
return response;
|
|
4127
|
+
}
|
|
4128
|
+
pingSession(request) {
|
|
4129
|
+
return this.#koniState.keyringService.context.pingSession(request);
|
|
4130
|
+
}
|
|
4131
|
+
/* Migrate Unified Account */
|
|
4132
|
+
|
|
4016
4133
|
// --------------------------------------------------------------
|
|
4017
4134
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
4018
4135
|
async handle(id, type, request, port) {
|
|
@@ -4098,6 +4215,12 @@ export default class KoniExtension {
|
|
|
4098
4215
|
return this.setEnableChainPatrol(request);
|
|
4099
4216
|
case 'pri(settings.saveNotificationSetup)':
|
|
4100
4217
|
return this.saveNotificationSetup(request);
|
|
4218
|
+
case 'pri(settings.saveMigrationAcknowledgedStatus)':
|
|
4219
|
+
return this.saveMigrationAcknowledgedStatus(request);
|
|
4220
|
+
case 'pri(settings.saveUnifiedAccountMigrationInProgress)':
|
|
4221
|
+
return this.saveUnifiedAccountMigrationInProgress(request);
|
|
4222
|
+
case 'pri(settings.pingUnifiedAccountMigrationDone)':
|
|
4223
|
+
return this.pingUnifiedAccountMigrationDone();
|
|
4101
4224
|
case 'pri(settings.saveShowZeroBalance)':
|
|
4102
4225
|
return this.setShowZeroBalance(request);
|
|
4103
4226
|
case 'pri(settings.saveLanguage)':
|
|
@@ -4375,10 +4498,14 @@ export default class KoniExtension {
|
|
|
4375
4498
|
return this.subscribeConfirmations(id, port);
|
|
4376
4499
|
case 'pri(confirmationsTon.subscribe)':
|
|
4377
4500
|
return this.subscribeConfirmationsTon(id, port);
|
|
4501
|
+
case 'pri(confirmationsCardano.subscribe)':
|
|
4502
|
+
return this.subscribeConfirmationsCardano(id, port);
|
|
4378
4503
|
case 'pri(confirmations.complete)':
|
|
4379
4504
|
return await this.completeConfirmation(request);
|
|
4380
4505
|
case 'pri(confirmationsTon.complete)':
|
|
4381
4506
|
return await this.completeConfirmationTon(request);
|
|
4507
|
+
case 'pri(confirmationsCardano.complete)':
|
|
4508
|
+
return await this.completeConfirmationCardano(request);
|
|
4382
4509
|
|
|
4383
4510
|
/// Stake
|
|
4384
4511
|
case 'pri(bonding.getBondingOptions)':
|
|
@@ -4569,6 +4696,8 @@ export default class KoniExtension {
|
|
|
4569
4696
|
/* Swap service */
|
|
4570
4697
|
case 'pri(swapService.subscribePairs)':
|
|
4571
4698
|
return this.subscribeSwapPairs(id, port);
|
|
4699
|
+
case 'pri(swapService.generateOptimalProcess)':
|
|
4700
|
+
return this.generateOptimalProcess(request);
|
|
4572
4701
|
case 'pri(swapService.handleSwapRequest)':
|
|
4573
4702
|
return this.handleSwapRequest(request);
|
|
4574
4703
|
case 'pri(swapService.getLatestQuote)':
|
|
@@ -4623,6 +4752,13 @@ export default class KoniExtension {
|
|
|
4623
4752
|
return this.subscribeProcessAlive(id, port);
|
|
4624
4753
|
/* Multi process */
|
|
4625
4754
|
|
|
4755
|
+
/* Migrate Unified Account */
|
|
4756
|
+
case 'pri(migrate.migrateUnifiedAndFetchEligibleSoloAccounts)':
|
|
4757
|
+
return await this.migrateUnifiedAndFetchEligibleSoloAccounts(request);
|
|
4758
|
+
case 'pri(migrate.migrateSoloAccount)':
|
|
4759
|
+
return this.migrateSoloAccount(request);
|
|
4760
|
+
case 'pri(migrate.pingSession)':
|
|
4761
|
+
return this.pingSession(request);
|
|
4626
4762
|
// Default
|
|
4627
4763
|
default:
|
|
4628
4764
|
throw new Error(`Unable to handle message of type ${type}`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="chrome" />
|
|
2
2
|
import { _AssetRef, _AssetType, _ChainAsset, _ChainInfo, _MultiChainAsset } from '@subwallet/chain-list/types';
|
|
3
|
-
import { AddTokenRequestExternal, AmountData, ApiMap, AuthRequestV2, ChainStakingMetadata, ConfirmationsQueue, ConfirmationsQueueTon, CrowdloanItem, CrowdloanJson, EvmSendTransactionParams, ExternalRequestPromise, MantaPayConfig, MantaPaySyncState, NftCollection, NftItem, NftJson, NominatorMetadata, RequestAccountExportPrivateKey, RequestConfirmationComplete, RequestConfirmationCompleteTon, RequestCrowdloanContributions, RequestSettingsType, ResponseAccountExportPrivateKey, ServiceInfo, SingleModeJson, StakingItem, StakingJson, StakingRewardItem, StakingRewardJson, StakingType, UiSettings } from '@subwallet/extension-base/background/KoniTypes';
|
|
3
|
+
import { AddTokenRequestExternal, AmountData, ApiMap, AuthRequestV2, ChainStakingMetadata, ConfirmationsQueue, ConfirmationsQueueCardano, ConfirmationsQueueTon, CrowdloanItem, CrowdloanJson, EvmSendTransactionParams, ExternalRequestPromise, MantaPayConfig, MantaPaySyncState, NftCollection, NftItem, NftJson, NominatorMetadata, RequestAccountExportPrivateKey, RequestConfirmationComplete, RequestConfirmationCompleteCardano, RequestConfirmationCompleteTon, RequestCrowdloanContributions, RequestSettingsType, ResponseAccountExportPrivateKey, ServiceInfo, SingleModeJson, StakingItem, StakingJson, StakingRewardItem, StakingRewardJson, StakingType, UiSettings } from '@subwallet/extension-base/background/KoniTypes';
|
|
4
4
|
import { RequestAuthorizeTab, RequestRpcSend, RequestRpcSubscribe, RequestRpcUnsubscribe, RequestSign, ResponseRpcListProviders, ResponseSigning } from '@subwallet/extension-base/background/types';
|
|
5
5
|
import { EnvConfig } from '@subwallet/extension-base/constants';
|
|
6
6
|
import { BalanceService } from '@subwallet/extension-base/services/balance-service';
|
|
@@ -192,6 +192,8 @@ export default class KoniState {
|
|
|
192
192
|
getEvmApi(networkKey: string): import("../../../services/chain-service/handler/EvmApi").EvmApi;
|
|
193
193
|
getTonApiMap(): Record<string, import("../../../services/chain-service/handler/TonApi").TonApi>;
|
|
194
194
|
getTonApi(networkKey: string): import("../../../services/chain-service/handler/TonApi").TonApi;
|
|
195
|
+
getCardanoApiMap(): Record<string, import("../../../services/chain-service/handler/CardanoApi").CardanoApi>;
|
|
196
|
+
getCardanoApi(networkKey: string): import("../../../services/chain-service/handler/CardanoApi").CardanoApi;
|
|
195
197
|
getApiMap(): ApiMap;
|
|
196
198
|
refreshSubstrateApi(key: string): boolean;
|
|
197
199
|
refreshWeb3Api(key: string): void;
|
|
@@ -215,8 +217,10 @@ export default class KoniState {
|
|
|
215
217
|
evmSendTransaction(id: string, url: string, transactionParams: EvmSendTransactionParams, networkKeyInit?: string, topic?: string): Promise<string | undefined>;
|
|
216
218
|
getConfirmationsQueueSubject(): BehaviorSubject<ConfirmationsQueue>;
|
|
217
219
|
getConfirmationsQueueSubjectTon(): BehaviorSubject<ConfirmationsQueueTon>;
|
|
220
|
+
getConfirmationsQueueSubjectCardano(): BehaviorSubject<ConfirmationsQueueCardano>;
|
|
218
221
|
completeConfirmation(request: RequestConfirmationComplete): Promise<boolean>;
|
|
219
222
|
completeConfirmationTon(request: RequestConfirmationCompleteTon): Promise<boolean>;
|
|
223
|
+
completeConfirmationCardano(request: RequestConfirmationCompleteCardano): Promise<boolean>;
|
|
220
224
|
private onMV3Update;
|
|
221
225
|
private storePreviousVersionData;
|
|
222
226
|
migrateMV3LocalStorage(data: string): Promise<boolean>;
|
|
@@ -5,7 +5,7 @@ import { EvmProviderError } from '@subwallet/extension-base/background/errors/Ev
|
|
|
5
5
|
import { withErrorLog } from '@subwallet/extension-base/background/handlers/helpers';
|
|
6
6
|
import { isSubscriptionRunning, unsubscribe } from '@subwallet/extension-base/background/handlers/subscriptions';
|
|
7
7
|
import { APIItemState, ChainType, EvmProviderErrorType, ExternalRequestPromiseStatus, ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
8
|
-
import { MANTA_PAY_BALANCE_INTERVAL, REMIND_EXPORT_ACCOUNT } from '@subwallet/extension-base/constants';
|
|
8
|
+
import { BACKEND_API_URL, MANTA_PAY_BALANCE_INTERVAL, REMIND_EXPORT_ACCOUNT } from '@subwallet/extension-base/constants';
|
|
9
9
|
import { convertErrorFormat, generateValidationProcess, validationAuthMiddleware, validationAuthWCMiddleware, validationConnectMiddleware, validationEvmDataTransactionMiddleware, validationEvmSignMessageMiddleware } from '@subwallet/extension-base/core/logic-validation';
|
|
10
10
|
import { BalanceService } from '@subwallet/extension-base/services/balance-service';
|
|
11
11
|
import { ServiceStatus } from '@subwallet/extension-base/services/base/types';
|
|
@@ -39,6 +39,7 @@ import { SWStorage } from '@subwallet/extension-base/storage';
|
|
|
39
39
|
import { BasicTxErrorType } from '@subwallet/extension-base/types';
|
|
40
40
|
import { isManifestV3, stripUrl, targetIsWeb } from '@subwallet/extension-base/utils';
|
|
41
41
|
import { createPromiseHandler } from '@subwallet/extension-base/utils/promise';
|
|
42
|
+
import subwalletApiSdk from '@subwallet/subwallet-api-sdk';
|
|
42
43
|
import { keyring } from '@subwallet/ui-keyring';
|
|
43
44
|
import BN from 'bn.js';
|
|
44
45
|
import { t } from 'i18next';
|
|
@@ -83,6 +84,8 @@ export default class KoniState {
|
|
|
83
84
|
waitSleeping = null;
|
|
84
85
|
waitStarting = null;
|
|
85
86
|
constructor(providers = {}) {
|
|
87
|
+
// Init subwallet api sdk
|
|
88
|
+
subwalletApiSdk.init(BACKEND_API_URL);
|
|
86
89
|
this.providers = providers;
|
|
87
90
|
this.eventService = new EventService();
|
|
88
91
|
this.dbService = new DatabaseService(this.eventService);
|
|
@@ -718,6 +721,12 @@ export default class KoniState {
|
|
|
718
721
|
getTonApi(networkKey) {
|
|
719
722
|
return this.chainService.getTonApi(networkKey);
|
|
720
723
|
}
|
|
724
|
+
getCardanoApiMap() {
|
|
725
|
+
return this.chainService.getCardanoApiMap();
|
|
726
|
+
}
|
|
727
|
+
getCardanoApi(networkKey) {
|
|
728
|
+
return this.chainService.getCardanoApi(networkKey);
|
|
729
|
+
}
|
|
721
730
|
getApiMap() {
|
|
722
731
|
return {
|
|
723
732
|
substrate: this.chainService.getSubstrateApiMap(),
|
|
@@ -998,12 +1007,18 @@ export default class KoniState {
|
|
|
998
1007
|
getConfirmationsQueueSubjectTon() {
|
|
999
1008
|
return this.requestService.confirmationsQueueSubjectTon;
|
|
1000
1009
|
}
|
|
1010
|
+
getConfirmationsQueueSubjectCardano() {
|
|
1011
|
+
return this.requestService.confirmationsQueueSubjectCardano;
|
|
1012
|
+
}
|
|
1001
1013
|
async completeConfirmation(request) {
|
|
1002
1014
|
return await this.requestService.completeConfirmation(request);
|
|
1003
1015
|
}
|
|
1004
1016
|
async completeConfirmationTon(request) {
|
|
1005
1017
|
return await this.requestService.completeConfirmationTon(request);
|
|
1006
1018
|
}
|
|
1019
|
+
async completeConfirmationCardano(request) {
|
|
1020
|
+
return await this.requestService.completeConfirmationCardano(request);
|
|
1021
|
+
}
|
|
1007
1022
|
async onMV3Update() {
|
|
1008
1023
|
const migrationStatus = await SWStorage.instance.getItem('mv3_migration');
|
|
1009
1024
|
if (!migrationStatus || migrationStatus !== 'done') {
|