@subwallet/extension-base 1.1.28-beta.1 → 1.1.30-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 +70 -93
- package/background/KoniTypes.js +14 -16
- package/background/errors/TransactionError.js +4 -9
- package/cjs/background/KoniTypes.js +17 -17
- package/cjs/background/errors/TransactionError.js +4 -9
- package/cjs/constants/index.js +3 -9
- package/cjs/koni/api/nft/config.js +23 -33
- package/cjs/koni/api/nft/index.js +0 -14
- package/cjs/koni/api/nft/nft.js +22 -1
- package/cjs/koni/api/staking/bonding/amplitude.js +15 -17
- package/cjs/koni/api/staking/bonding/astar.js +10 -11
- package/cjs/koni/api/staking/bonding/index.js +1 -4
- package/cjs/koni/api/staking/bonding/paraChain.js +23 -25
- package/cjs/koni/api/staking/bonding/relayChain.js +45 -48
- package/cjs/koni/api/staking/bonding/utils.js +86 -104
- package/cjs/koni/api/staking/index.js +5 -6
- package/cjs/koni/api/staking/paraChain.js +5 -6
- package/cjs/koni/api/staking/relayChain.js +2 -3
- package/cjs/koni/background/cron.js +0 -2
- package/cjs/koni/background/handlers/Extension.js +88 -326
- package/cjs/koni/background/handlers/State.js +3 -51
- package/cjs/koni/background/handlers/index.js +2 -4
- package/cjs/koni/background/subscription.js +18 -88
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/campaign-service/index.js +6 -9
- package/cjs/services/chain-service/constants.js +16 -2
- package/cjs/services/chain-service/utils.js +1 -7
- package/cjs/services/event-service/index.js +0 -4
- package/cjs/services/keyring-service/index.js +2 -14
- package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
- package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
- package/cjs/services/migration-service/scripts/index.js +0 -4
- package/cjs/services/notification-service/NotificationService.js +1 -1
- package/cjs/services/storage-service/DatabaseService.js +0 -47
- package/cjs/services/storage-service/databases/index.js +0 -4
- package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
- package/cjs/services/transaction-service/event-parser/index.js +0 -58
- package/cjs/services/transaction-service/helpers/index.js +1 -3
- package/cjs/services/transaction-service/index.js +74 -180
- package/cjs/services/transaction-service/utils.js +0 -1
- package/cjs/types/index.js +0 -44
- package/cjs/utils/fetchStaticData.js +1 -2
- package/cjs/utils/index.js +1 -89
- package/constants/index.d.ts +0 -2
- package/constants/index.js +0 -2
- package/koni/api/nft/config.js +23 -33
- package/koni/api/nft/index.js +1 -15
- package/koni/api/nft/nft.js +23 -2
- package/koni/api/staking/bonding/amplitude.js +9 -11
- package/koni/api/staking/bonding/astar.js +8 -9
- package/koni/api/staking/bonding/index.d.ts +1 -1
- package/koni/api/staking/bonding/index.js +1 -5
- package/koni/api/staking/bonding/paraChain.js +10 -12
- package/koni/api/staking/bonding/relayChain.d.ts +2 -2
- package/koni/api/staking/bonding/relayChain.js +30 -33
- package/koni/api/staking/bonding/utils.d.ts +38 -15
- package/koni/api/staking/bonding/utils.js +69 -85
- package/koni/api/staking/index.js +1 -2
- package/koni/api/staking/paraChain.js +6 -7
- package/koni/api/staking/relayChain.js +3 -4
- package/koni/background/cron.js +0 -2
- package/koni/background/handlers/Extension.d.ts +1 -14
- package/koni/background/handlers/Extension.js +50 -286
- package/koni/background/handlers/State.d.ts +2 -18
- package/koni/background/handlers/State.js +3 -50
- package/koni/background/handlers/index.js +2 -4
- package/koni/background/subscription.d.ts +1 -5
- package/koni/background/subscription.js +20 -90
- package/package.json +8 -311
- package/packageInfo.js +1 -1
- package/services/campaign-service/index.js +6 -9
- package/services/chain-service/constants.d.ts +11 -0
- package/services/chain-service/constants.js +14 -1
- package/services/chain-service/utils.d.ts +0 -1
- package/services/chain-service/utils.js +1 -5
- package/services/event-service/index.d.ts +0 -1
- package/services/event-service/index.js +0 -4
- package/services/event-service/types.d.ts +0 -8
- package/services/keyring-service/index.d.ts +1 -2
- package/services/keyring-service/index.js +2 -14
- package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
- package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
- package/services/migration-service/scripts/index.js +0 -4
- package/services/notification-service/NotificationService.js +1 -1
- package/services/storage-service/DatabaseService.d.ts +1 -17
- package/services/storage-service/DatabaseService.js +0 -47
- package/services/storage-service/databases/index.d.ts +1 -3
- package/services/storage-service/databases/index.js +0 -4
- package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
- package/services/subscan-service/index.d.ts +2 -2
- package/services/transaction-service/event-parser/index.d.ts +1 -3
- package/services/transaction-service/event-parser/index.js +1 -57
- package/services/transaction-service/helpers/index.js +1 -3
- package/services/transaction-service/index.d.ts +15 -4
- package/services/transaction-service/index.js +72 -178
- package/services/transaction-service/types.d.ts +0 -2
- package/services/transaction-service/utils.js +0 -1
- package/types/index.d.ts +0 -5
- package/types/index.js +1 -5
- package/utils/fetchStaticData.js +1 -2
- package/utils/index.d.ts +0 -5
- package/utils/index.js +1 -53
- package/cjs/koni/api/dotsama/balance.js +0 -464
- package/cjs/koni/api/nft/ordinal_nft/constants.js +0 -21
- package/cjs/koni/api/nft/ordinal_nft/index.js +0 -121
- package/cjs/koni/api/nft/ordinal_nft/utils.js +0 -41
- package/cjs/koni/api/yield/helper/utils.js +0 -46
- package/cjs/services/earning-service/constants/chains.js +0 -29
- package/cjs/services/earning-service/constants/index.js +0 -27
- package/cjs/services/earning-service/constants/step.js +0 -18
- package/cjs/services/earning-service/handlers/base.js +0 -202
- package/cjs/services/earning-service/handlers/index.js +0 -60
- package/cjs/services/earning-service/handlers/lending/base.js +0 -20
- package/cjs/services/earning-service/handlers/lending/index.js +0 -13
- package/cjs/services/earning-service/handlers/lending/interlay.js +0 -168
- package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -196
- package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -39
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -257
- package/cjs/services/earning-service/handlers/liquid-staking/index.js +0 -34
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -180
- package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -373
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +0 -359
- package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -426
- package/cjs/services/earning-service/handlers/native-staking/base-para.js +0 -137
- package/cjs/services/earning-service/handlers/native-staking/base.js +0 -109
- package/cjs/services/earning-service/handlers/native-staking/index.js +0 -34
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -361
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +0 -512
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +0 -501
- package/cjs/services/earning-service/handlers/special.js +0 -387
- package/cjs/services/earning-service/service.js +0 -327
- package/cjs/services/earning-service/utils/index.js +0 -111
- package/cjs/services/migration-service/scripts/DeleteEarningData.js +0 -21
- package/cjs/services/migration-service/scripts/EnableEarningChains.js +0 -21
- package/cjs/services/migration-service/scripts/MigrateEthProvider.js +0 -17
- package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +0 -17
- package/cjs/services/migration-service/scripts/MigrateProvider.js +0 -29
- package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -149
- package/cjs/services/mint-campaign-service/campaigns/index.js +0 -13
- package/cjs/services/mint-campaign-service/constants.js +0 -11
- package/cjs/services/mint-campaign-service/index.js +0 -18
- package/cjs/services/storage-service/db-stores/YieldPoolStore.js +0 -36
- package/cjs/services/storage-service/db-stores/YieldPositionStore.js +0 -65
- package/cjs/services/storage-service/index.js +0 -241
- package/cjs/types/campaigns/index.js +0 -16
- package/cjs/types/campaigns/unlock-dot.js +0 -1
- package/cjs/types/ordinal.js +0 -1
- package/cjs/types/transaction.js +0 -1
- package/cjs/types/yield/actions/index.js +0 -27
- package/cjs/types/yield/actions/join/index.js +0 -38
- package/cjs/types/yield/actions/join/step.js +0 -37
- package/cjs/types/yield/actions/join/submit.js +0 -1
- package/cjs/types/yield/actions/join/validate.js +0 -16
- package/cjs/types/yield/actions/others.js +0 -1
- package/cjs/types/yield/index.js +0 -27
- package/cjs/types/yield/info/account/index.js +0 -49
- package/cjs/types/yield/info/account/info.js +0 -1
- package/cjs/types/yield/info/account/reward.js +0 -1
- package/cjs/types/yield/info/account/target.js +0 -32
- package/cjs/types/yield/info/account/unstake.js +0 -27
- package/cjs/types/yield/info/base.js +0 -34
- package/cjs/types/yield/info/chain/index.js +0 -27
- package/cjs/types/yield/info/chain/info.js +0 -1
- package/cjs/types/yield/info/chain/target.js +0 -1
- package/cjs/types/yield/info/index.js +0 -49
- package/cjs/types/yield/info/pallet.js +0 -15
- package/cjs/types.js +0 -1
- package/cjs/utils/address.js +0 -34
- package/cjs/utils/keyring.js +0 -57
- package/cjs/utils/object.js +0 -12
- package/koni/api/nft/ordinal_nft/constants.d.ts +0 -9
- package/koni/api/nft/ordinal_nft/constants.js +0 -12
- package/koni/api/nft/ordinal_nft/index.d.ts +0 -8
- package/koni/api/nft/ordinal_nft/index.js +0 -114
- package/koni/api/nft/ordinal_nft/utils.d.ts +0 -2
- package/koni/api/nft/ordinal_nft/utils.js +0 -33
- package/koni/api/yield/helper/utils.d.ts +0 -10
- package/koni/api/yield/helper/utils.js +0 -32
- package/services/earning-service/constants/abis/compound_finance_v2_abi.json +0 -1235
- package/services/earning-service/constants/abis/st_liquid_token_abi.json +0 -1355
- package/services/earning-service/constants/chains.d.ts +0 -14
- package/services/earning-service/constants/chains.js +0 -21
- package/services/earning-service/constants/index.d.ts +0 -2
- package/services/earning-service/constants/index.js +0 -5
- package/services/earning-service/constants/step.d.ts +0 -3
- package/services/earning-service/constants/step.js +0 -10
- package/services/earning-service/handlers/base.d.ts +0 -105
- package/services/earning-service/handlers/base.js +0 -195
- package/services/earning-service/handlers/index.d.ts +0 -5
- package/services/earning-service/handlers/index.js +0 -8
- package/services/earning-service/handlers/lending/base.d.ts +0 -6
- package/services/earning-service/handlers/lending/base.js +0 -12
- package/services/earning-service/handlers/lending/index.d.ts +0 -1
- package/services/earning-service/handlers/lending/index.js +0 -4
- package/services/earning-service/handlers/lending/interlay.d.ts +0 -22
- package/services/earning-service/handlers/lending/interlay.js +0 -160
- package/services/earning-service/handlers/liquid-staking/acala.d.ts +0 -27
- package/services/earning-service/handlers/liquid-staking/acala.js +0 -188
- package/services/earning-service/handlers/liquid-staking/base.d.ts +0 -8
- package/services/earning-service/handlers/liquid-staking/base.js +0 -31
- package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +0 -44
- package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -246
- package/services/earning-service/handlers/liquid-staking/index.d.ts +0 -4
- package/services/earning-service/handlers/liquid-staking/index.js +0 -7
- package/services/earning-service/handlers/liquid-staking/parallel.d.ts +0 -27
- package/services/earning-service/handlers/liquid-staking/parallel.js +0 -172
- package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +0 -36
- package/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -363
- package/services/earning-service/handlers/native-staking/amplitude.d.ts +0 -22
- package/services/earning-service/handlers/native-staking/amplitude.js +0 -350
- package/services/earning-service/handlers/native-staking/astar.d.ts +0 -18
- package/services/earning-service/handlers/native-staking/astar.js +0 -416
- package/services/earning-service/handlers/native-staking/base-para.d.ts +0 -11
- package/services/earning-service/handlers/native-staking/base-para.js +0 -129
- package/services/earning-service/handlers/native-staking/base.d.ts +0 -19
- package/services/earning-service/handlers/native-staking/base.js +0 -101
- package/services/earning-service/handlers/native-staking/index.d.ts +0 -4
- package/services/earning-service/handlers/native-staking/index.js +0 -7
- package/services/earning-service/handlers/native-staking/para-chain.d.ts +0 -15
- package/services/earning-service/handlers/native-staking/para-chain.js +0 -353
- package/services/earning-service/handlers/native-staking/relay-chain.d.ts +0 -21
- package/services/earning-service/handlers/native-staking/relay-chain.js +0 -503
- package/services/earning-service/handlers/nomination-pool/index.d.ts +0 -33
- package/services/earning-service/handlers/nomination-pool/index.js +0 -492
- package/services/earning-service/handlers/special.d.ts +0 -56
- package/services/earning-service/handlers/special.js +0 -379
- package/services/earning-service/service.d.ts +0 -36
- package/services/earning-service/service.js +0 -320
- package/services/earning-service/utils/index.d.ts +0 -14
- package/services/earning-service/utils/index.js +0 -100
- package/services/migration-service/scripts/DeleteEarningData.d.ts +0 -4
- package/services/migration-service/scripts/DeleteEarningData.js +0 -13
- package/services/migration-service/scripts/EnableEarningChains.d.ts +0 -4
- package/services/migration-service/scripts/EnableEarningChains.js +0 -13
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +0 -13
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -139
- package/services/mint-campaign-service/campaigns/index.d.ts +0 -1
- package/services/mint-campaign-service/campaigns/index.js +0 -4
- package/services/mint-campaign-service/constants.d.ts +0 -1
- package/services/mint-campaign-service/constants.js +0 -4
- package/services/mint-campaign-service/index.d.ts +0 -7
- package/services/mint-campaign-service/index.js +0 -11
- package/services/storage-service/db-stores/YieldPoolStore.d.ts +0 -10
- package/services/storage-service/db-stores/YieldPoolStore.js +0 -28
- package/services/storage-service/db-stores/YieldPositionStore.d.ts +0 -9
- package/services/storage-service/db-stores/YieldPositionStore.js +0 -57
- package/types/campaigns/index.d.ts +0 -1
- package/types/campaigns/index.js +0 -4
- package/types/campaigns/unlock-dot.d.ts +0 -71
- package/types/campaigns/unlock-dot.js +0 -1
- package/types/ordinal.d.ts +0 -69
- package/types/ordinal.js +0 -1
- package/types/transaction.d.ts +0 -3
- package/types/transaction.js +0 -1
- package/types/yield/actions/index.d.ts +0 -2
- package/types/yield/actions/index.js +0 -5
- package/types/yield/actions/join/index.d.ts +0 -3
- package/types/yield/actions/join/index.js +0 -6
- package/types/yield/actions/join/step.d.ts +0 -75
- package/types/yield/actions/join/step.js +0 -34
- package/types/yield/actions/join/submit.d.ts +0 -53
- package/types/yield/actions/join/submit.js +0 -1
- package/types/yield/actions/join/validate.d.ts +0 -18
- package/types/yield/actions/join/validate.js +0 -10
- package/types/yield/actions/others.d.ts +0 -60
- package/types/yield/actions/others.js +0 -1
- package/types/yield/index.d.ts +0 -2
- package/types/yield/index.js +0 -5
- package/types/yield/info/account/index.d.ts +0 -4
- package/types/yield/info/account/index.js +0 -7
- package/types/yield/info/account/info.d.ts +0 -112
- package/types/yield/info/account/info.js +0 -1
- package/types/yield/info/account/reward.d.ts +0 -41
- package/types/yield/info/account/reward.js +0 -1
- package/types/yield/info/account/target.d.ts +0 -43
- package/types/yield/info/account/target.js +0 -27
- package/types/yield/info/account/unstake.d.ts +0 -31
- package/types/yield/info/account/unstake.js +0 -22
- package/types/yield/info/base.d.ts +0 -28
- package/types/yield/info/base.js +0 -28
- package/types/yield/info/chain/index.d.ts +0 -2
- package/types/yield/info/chain/index.js +0 -5
- package/types/yield/info/chain/info.d.ts +0 -190
- package/types/yield/info/chain/info.js +0 -1
- package/types/yield/info/chain/target.d.ts +0 -33
- package/types/yield/info/chain/target.js +0 -1
- package/types/yield/info/index.d.ts +0 -4
- package/types/yield/info/index.js +0 -7
- package/types/yield/info/pallet.d.ts +0 -143
- package/types/yield/info/pallet.js +0 -9
- package/utils/object.d.ts +0 -1
- package/utils/object.js +0 -6
|
@@ -5,21 +5,18 @@ import { CampaignDataType } from '@subwallet/extension-base/background/KoniTypes
|
|
|
5
5
|
import { TARGET_ENV } from '@subwallet/extension-base/utils';
|
|
6
6
|
import { fetchStaticData } from '@subwallet/extension-base/utils/fetchStaticData';
|
|
7
7
|
import { runCampaign } from "./helpers.js";
|
|
8
|
-
const targetEnvs = ['extension', 'mobile'];
|
|
9
8
|
export default class CampaignService {
|
|
10
9
|
#state;
|
|
11
10
|
constructor(state) {
|
|
12
11
|
this.#state = state;
|
|
13
12
|
}
|
|
14
13
|
init() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
}
|
|
14
|
+
this.fetchCampaign().catch(e => {
|
|
15
|
+
console.error('Error on fetch campaigns', e);
|
|
16
|
+
});
|
|
17
|
+
this.runCampaign().catch(e => {
|
|
18
|
+
console.error('Error on run campaigns', e);
|
|
19
|
+
});
|
|
23
20
|
}
|
|
24
21
|
async fetchCampaign() {
|
|
25
22
|
const respData = await fetchStaticData('marketing-campaigns');
|
|
@@ -33,6 +33,17 @@ export declare const _NFT_CHAIN_GROUP: {
|
|
|
33
33
|
bitcountry: string[];
|
|
34
34
|
vara: string[];
|
|
35
35
|
};
|
|
36
|
+
export declare const _STAKING_CHAIN_GROUP: {
|
|
37
|
+
relay: string[];
|
|
38
|
+
para: string[];
|
|
39
|
+
astar: string[];
|
|
40
|
+
amplitude: string[];
|
|
41
|
+
kilt: string[];
|
|
42
|
+
nominationPool: string[];
|
|
43
|
+
bifrost: string[];
|
|
44
|
+
aleph: string[];
|
|
45
|
+
ternoa: string[];
|
|
46
|
+
};
|
|
36
47
|
export declare const _STAKING_ERA_LENGTH_MAP: Record<string, number>;
|
|
37
48
|
export declare const _EXPECTED_BLOCK_TIME: Record<string, number>;
|
|
38
49
|
export declare const _PARACHAIN_INFLATION_DISTRIBUTION: Record<string, Record<string, number>>;
|
|
@@ -52,6 +52,19 @@ export const _NFT_CHAIN_GROUP = {
|
|
|
52
52
|
|
|
53
53
|
// Staking--------------------------------------------------------------------------------------------------------------
|
|
54
54
|
|
|
55
|
+
export const _STAKING_CHAIN_GROUP = {
|
|
56
|
+
relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'ternoa_alphanet', 'alephTest', 'polkadexTest', 'westend', 'kate', 'edgeware', 'creditcoin', 'vara_network', 'goldberg_testnet'],
|
|
57
|
+
para: ['moonbeam', 'moonriver', 'moonbase', 'turing', 'turingStaging', 'bifrost', 'bifrost_testnet', 'calamari_test', 'calamari'],
|
|
58
|
+
astar: ['astar', 'shiden', 'shibuya'],
|
|
59
|
+
amplitude: ['amplitude', 'amplitude_test', 'kilt', 'kilt_peregrine', 'pendulum'],
|
|
60
|
+
// amplitude and kilt only share some common logic
|
|
61
|
+
kilt: ['kilt', 'kilt_peregrine'],
|
|
62
|
+
nominationPool: ['polkadot', 'kusama', 'westend', 'alephTest', 'aleph', 'kate', 'vara_network', 'goldberg_testnet'],
|
|
63
|
+
bifrost: ['bifrost', 'bifrost_testnet'],
|
|
64
|
+
aleph: ['aleph', 'alephTest'],
|
|
65
|
+
// A0 has distinct tokenomics
|
|
66
|
+
ternoa: ['ternoa', 'ternoa_alphanet']
|
|
67
|
+
};
|
|
55
68
|
export const _STAKING_ERA_LENGTH_MAP = {
|
|
56
69
|
// in hours
|
|
57
70
|
alephTest: 24,
|
|
@@ -229,7 +242,7 @@ export const _XCM_TYPE = {
|
|
|
229
242
|
PR: `${_SubstrateChainType.PARACHAIN}-${_SubstrateChainType.RELAYCHAIN}` // UMP
|
|
230
243
|
};
|
|
231
244
|
|
|
232
|
-
export const _DEFAULT_ACTIVE_CHAINS = [..._DEFAULT_CHAINS, 'vara_network'
|
|
245
|
+
export const _DEFAULT_ACTIVE_CHAINS = [..._DEFAULT_CHAINS, 'vara_network'];
|
|
233
246
|
export const EVM_PASS_CONNECT_STATUS = {
|
|
234
247
|
arbitrum_one: ['*']
|
|
235
248
|
};
|
|
@@ -30,7 +30,6 @@ export declare function _getChainSubstrateAddressPrefix(chainInfo: _ChainInfo):
|
|
|
30
30
|
export declare function _isChainSupportNativeNft(chainInfo: _ChainInfo): boolean;
|
|
31
31
|
export declare function _isChainSupportEvmNft(chainInfo: _ChainInfo): boolean;
|
|
32
32
|
export declare function _isChainSupportWasmNft(chainInfo: _ChainInfo): boolean;
|
|
33
|
-
export declare const _isSupportOrdinal: (chain: string) => boolean;
|
|
34
33
|
export declare function _getNftTypesSupportedByChain(chainInfo: _ChainInfo): _AssetType[];
|
|
35
34
|
export declare function _getTokenTypesSupportedByChain(chainInfo: _ChainInfo): _AssetType[];
|
|
36
35
|
export declare function _getChainNativeTokenBasicInfo(chainInfo: _ChainInfo): BasicTokenInfo;
|
|
@@ -92,7 +92,7 @@ export function _getTokenMinAmount(tokenInfo) {
|
|
|
92
92
|
return tokenInfo.minAmount || '0';
|
|
93
93
|
}
|
|
94
94
|
export function _isChainEvmCompatible(chainInfo) {
|
|
95
|
-
return
|
|
95
|
+
return chainInfo.evmInfo !== undefined && chainInfo.evmInfo !== null;
|
|
96
96
|
}
|
|
97
97
|
export function _isNativeToken(tokenInfo) {
|
|
98
98
|
return tokenInfo.assetType === _AssetType.NATIVE;
|
|
@@ -147,10 +147,6 @@ export function _isChainSupportWasmNft(chainInfo) {
|
|
|
147
147
|
var _chainInfo$substrateI8, _chainInfo$substrateI9;
|
|
148
148
|
return ((_chainInfo$substrateI8 = chainInfo.substrateInfo) === null || _chainInfo$substrateI8 === void 0 ? void 0 : (_chainInfo$substrateI9 = _chainInfo$substrateI8.supportSmartContract) === null || _chainInfo$substrateI9 === void 0 ? void 0 : _chainInfo$substrateI9.includes(_AssetType.PSP34)) || false;
|
|
149
149
|
}
|
|
150
|
-
export const _isSupportOrdinal = chain => {
|
|
151
|
-
const chains = ['polkadot', 'astar', 'bifrost_dot', 'moonbeam'];
|
|
152
|
-
return chains.includes(chain);
|
|
153
|
-
};
|
|
154
150
|
export function _getNftTypesSupportedByChain(chainInfo) {
|
|
155
151
|
const result = [];
|
|
156
152
|
if (chainInfo.substrateInfo && chainInfo.substrateInfo.supportSmartContract) {
|
|
@@ -8,7 +8,6 @@ export declare class EventService extends EventEmitter<EventRegistry> {
|
|
|
8
8
|
readonly waitDatabaseReady: Promise<boolean>;
|
|
9
9
|
readonly waitKeyringReady: Promise<boolean>;
|
|
10
10
|
readonly waitAccountReady: Promise<boolean>;
|
|
11
|
-
readonly waitInjectReady: Promise<boolean>;
|
|
12
11
|
readonly waitChainReady: Promise<boolean>;
|
|
13
12
|
readonly waitAssetReady: Promise<boolean>;
|
|
14
13
|
readonly waitMigrateReady: Promise<boolean>;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
// Stateless service handle runtime event on background
|
|
5
5
|
|
|
6
|
-
import { TARGET_ENV } from '@subwallet/extension-base/utils';
|
|
7
6
|
import EventEmitter from 'eventemitter3';
|
|
8
7
|
const DEFAULT_LAZY_TIME = 300;
|
|
9
8
|
const LONG_LAZY_TIME = 900;
|
|
@@ -18,8 +17,6 @@ export class EventService extends EventEmitter {
|
|
|
18
17
|
this.waitDatabaseReady = this.generateWaitPromise('database.ready');
|
|
19
18
|
this.waitKeyringReady = this.generateWaitPromise('keyring.ready');
|
|
20
19
|
this.waitAccountReady = this.generateWaitPromise('account.ready');
|
|
21
|
-
// TODO: Need to merge logic on web-runner file
|
|
22
|
-
this.waitInjectReady = TARGET_ENV === 'webapp' ? this.generateWaitPromise('inject.ready') : Promise.resolve(true);
|
|
23
20
|
this.waitChainReady = this.generateWaitPromise('chain.ready');
|
|
24
21
|
this.waitAssetReady = this.generateWaitPromise('asset.ready');
|
|
25
22
|
this.waitMigrateReady = this.generateWaitPromise('migration.done');
|
|
@@ -30,7 +27,6 @@ export class EventService extends EventEmitter {
|
|
|
30
27
|
generateWaitPromise(eventType) {
|
|
31
28
|
return new Promise(resolve => {
|
|
32
29
|
this.once(eventType, isReady => {
|
|
33
|
-
console.log('===LOG generateWaitPromise eventType', eventType);
|
|
34
30
|
resolve(isReady);
|
|
35
31
|
});
|
|
36
32
|
});
|
|
@@ -5,20 +5,12 @@ export interface EventRegistry {
|
|
|
5
5
|
'general.wakeup': [boolean];
|
|
6
6
|
'crypto.ready': [boolean];
|
|
7
7
|
'database.ready': [boolean];
|
|
8
|
-
/** Password state ready */
|
|
9
8
|
'keyring.ready': [boolean];
|
|
10
|
-
/** Update current account */
|
|
11
9
|
'account.updateCurrent': [CurrentAccountInfo];
|
|
12
|
-
/** Account list loaded */
|
|
13
10
|
'account.ready': [boolean];
|
|
14
|
-
/** Add a new account */
|
|
15
11
|
'account.add': [string];
|
|
16
|
-
/** Update account */
|
|
17
12
|
'account.update': [string];
|
|
18
|
-
/** Remove a account */
|
|
19
13
|
'account.remove': [string];
|
|
20
|
-
/** Inject account done */
|
|
21
|
-
'inject.ready': [boolean];
|
|
22
14
|
'chain.ready': [boolean];
|
|
23
15
|
'chain.add': [string];
|
|
24
16
|
'chain.updateState': [string];
|
|
@@ -10,7 +10,6 @@ export declare class KeyringService {
|
|
|
10
10
|
readonly addressesSubject: BehaviorSubject<SubjectInfo>;
|
|
11
11
|
readonly accountSubject: BehaviorSubject<SubjectInfo>;
|
|
12
12
|
private beforeAccount;
|
|
13
|
-
private injected;
|
|
14
13
|
readonly keyringStateSubject: BehaviorSubject<KeyringState>;
|
|
15
14
|
constructor(eventService: EventService);
|
|
16
15
|
private subscribeAccounts;
|
|
@@ -22,6 +21,6 @@ export declare class KeyringService {
|
|
|
22
21
|
setCurrentAccount(currentAccountData: CurrentAccountInfo): void;
|
|
23
22
|
lock(): void;
|
|
24
23
|
addInjectAccounts(accounts: InjectedAccountWithMeta[]): void;
|
|
25
|
-
removeInjectAccounts(
|
|
24
|
+
removeInjectAccounts(addresses: string[]): void;
|
|
26
25
|
resetWallet(resetAll: boolean): Promise<void>;
|
|
27
26
|
}
|
|
@@ -22,7 +22,6 @@ export class KeyringService {
|
|
|
22
22
|
});
|
|
23
23
|
constructor(eventService) {
|
|
24
24
|
this.eventService = eventService;
|
|
25
|
-
this.injected = false;
|
|
26
25
|
this.eventService.waitCryptoReady.then(() => {
|
|
27
26
|
this.currentAccountStore.get('CurrentAccountInfo', rs => {
|
|
28
27
|
rs && this.currentAccountSubject.next(rs);
|
|
@@ -134,19 +133,8 @@ export class KeyringService {
|
|
|
134
133
|
currentGenesisHash: null
|
|
135
134
|
});
|
|
136
135
|
}
|
|
137
|
-
if (!this.injected) {
|
|
138
|
-
this.eventService.emit('inject.ready', true);
|
|
139
|
-
this.injected = true;
|
|
140
|
-
}
|
|
141
136
|
}
|
|
142
|
-
removeInjectAccounts(
|
|
143
|
-
const addresses = _addresses.map(address => {
|
|
144
|
-
try {
|
|
145
|
-
return keyring.getPair(address).address;
|
|
146
|
-
} catch (error) {
|
|
147
|
-
return address;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
137
|
+
removeInjectAccounts(addresses) {
|
|
150
138
|
const currentAddress = this.currentAccountSubject.value.address;
|
|
151
139
|
const afterAccounts = Object.keys(this.accounts).filter(address => addresses.indexOf(address) < 0);
|
|
152
140
|
if (afterAccounts.length === 1) {
|
|
@@ -171,7 +159,7 @@ export class KeyringService {
|
|
|
171
159
|
await new Promise(resolve => {
|
|
172
160
|
setTimeout(() => {
|
|
173
161
|
resolve();
|
|
174
|
-
},
|
|
162
|
+
}, 500);
|
|
175
163
|
});
|
|
176
164
|
this.updateKeyringState();
|
|
177
165
|
this.currentAccountSubject.next({
|
|
@@ -11,7 +11,7 @@ export default class MigrateLedgerAccount extends BaseMigrationJob {
|
|
|
11
11
|
const store = new AccountsStore();
|
|
12
12
|
const update = (key, value) => {
|
|
13
13
|
var _value$meta;
|
|
14
|
-
if (key.startsWith('account:') && value
|
|
14
|
+
if (key.startsWith('account:') && value.meta && isString((_value$meta = value.meta) === null || _value$meta === void 0 ? void 0 : _value$meta.originGenesisHash)) {
|
|
15
15
|
const newValue = {
|
|
16
16
|
...value
|
|
17
17
|
};
|
|
@@ -12,7 +12,7 @@ export default class MigrateTransactionHistory extends BaseMigrationJob {
|
|
|
12
12
|
const chainInfoMap = state.getChainInfoMap();
|
|
13
13
|
const assetList = Object.values(state.getAssetRegistry());
|
|
14
14
|
try {
|
|
15
|
-
const db = new Dexie('
|
|
15
|
+
const db = new Dexie('SubWalletDB');
|
|
16
16
|
const dexieDB = await db.open();
|
|
17
17
|
const transactionTable = dexieDB.table('transactions');
|
|
18
18
|
const oldTransactionData = await transactionTable.toArray();
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import DeleteEarningData from '@subwallet/extension-base/services/migration-service/scripts/DeleteEarningData';
|
|
5
|
-
import EnableEarningChains from '@subwallet/extension-base/services/migration-service/scripts/EnableEarningChains';
|
|
6
4
|
import MigrateEthProvider from "./providers/MigrateEthProvider.js";
|
|
7
5
|
import MigratePioneerProvider from "./providers/MigratePioneerProvider.js";
|
|
8
6
|
import MigrateProvidersV1M1P24 from "./providers/MigrateProvidersV1M1P24.js";
|
|
@@ -35,8 +33,6 @@ export default {
|
|
|
35
33
|
'1.1.6-01': MigrateWalletReference,
|
|
36
34
|
'1.1.7': DeleteChain,
|
|
37
35
|
'1.1.13-01': MigrateTokenDecimals,
|
|
38
|
-
'1.1.13-02': EnableEarningChains,
|
|
39
|
-
'1.1.13-03': DeleteEarningData,
|
|
40
36
|
'1.1.17-01': MigratePioneerProvider,
|
|
41
37
|
'1.1.17-03': EnableVaraChain,
|
|
42
38
|
'1.1.24-01': MigrateProvidersV1M1P24,
|
|
@@ -8,9 +8,7 @@ import ChainStakingMetadataStore from '@subwallet/extension-base/services/storag
|
|
|
8
8
|
import MantaPayStore from '@subwallet/extension-base/services/storage-service/db-stores/MantaPay';
|
|
9
9
|
import NominatorMetadataStore from '@subwallet/extension-base/services/storage-service/db-stores/NominatorMetadata';
|
|
10
10
|
import { HistoryQuery } from '@subwallet/extension-base/services/storage-service/db-stores/Transaction';
|
|
11
|
-
import
|
|
12
|
-
import YieldPositionStore from '@subwallet/extension-base/services/storage-service/db-stores/YieldPositionStore';
|
|
13
|
-
import { BalanceItem, YieldPoolInfo, YieldPoolType, YieldPositionInfo } from '@subwallet/extension-base/types';
|
|
11
|
+
import { BalanceItem } from '@subwallet/extension-base/types';
|
|
14
12
|
import { Subscription } from 'dexie';
|
|
15
13
|
import { DexieExportJsonStructure } from 'dexie-export-import';
|
|
16
14
|
export declare const DEXIE_BACKUP_TABLES: string[];
|
|
@@ -29,8 +27,6 @@ export default class DatabaseService {
|
|
|
29
27
|
metadata: MetadataStore;
|
|
30
28
|
chain: ChainStore;
|
|
31
29
|
asset: AssetStore;
|
|
32
|
-
yieldPoolInfo: YieldPoolStore;
|
|
33
|
-
yieldPosition: YieldPositionStore;
|
|
34
30
|
chainStakingMetadata: ChainStakingMetadataStore;
|
|
35
31
|
nominatorMetadata: NominatorMetadataStore;
|
|
36
32
|
mantaPay: MantaPayStore;
|
|
@@ -39,7 +35,6 @@ export default class DatabaseService {
|
|
|
39
35
|
private logger;
|
|
40
36
|
private nftSubscription;
|
|
41
37
|
private stakingSubscription;
|
|
42
|
-
private yieldInfoSubscription;
|
|
43
38
|
constructor(eventService: EventService);
|
|
44
39
|
updatePriceStore(priceData: PriceJson): Promise<void>;
|
|
45
40
|
getPriceStore(): Promise<PriceJson | undefined>;
|
|
@@ -88,17 +83,6 @@ export default class DatabaseService {
|
|
|
88
83
|
subscribeMantaPayConfig(chain: string, callback: (data: MantaPayConfig[]) => void): void;
|
|
89
84
|
getMantaPayConfig(chain: string): Promise<any[]>;
|
|
90
85
|
getMantaPayFirstConfig(chain: string): Promise<any>;
|
|
91
|
-
updateYieldPoolStore(data: YieldPoolInfo): Promise<void>;
|
|
92
|
-
deleteYieldPoolInfo(slugs: string[]): Promise<void>;
|
|
93
|
-
getYieldPools(): Promise<YieldPoolInfo[]>;
|
|
94
|
-
getYieldPoolStakingInfo(chain: string, poolType: YieldPoolType): Promise<YieldPoolInfo | undefined>;
|
|
95
|
-
getYieldPool(slug: string): Promise<YieldPoolInfo | undefined>;
|
|
96
|
-
getYieldPositionByAddressAndSlug(address: string, slug: string): Promise<YieldPositionInfo | undefined>;
|
|
97
|
-
subscribeYieldPoolInfo(chains: string[], callback: (data: YieldPoolInfo[]) => void): Subscription;
|
|
98
|
-
updateYieldPosition(data: YieldPositionInfo): Promise<void>;
|
|
99
|
-
getYieldPositionByAddress(addresses: string[]): Promise<YieldPositionInfo[]>;
|
|
100
|
-
subscribeYieldPosition(addresses: string[], callback: (data: YieldPositionInfo[]) => void): Subscription;
|
|
101
|
-
getYieldNominationPoolPosition(addresses: string[], chains: string[]): Promise<YieldPositionInfo[]>;
|
|
102
86
|
subscribeProcessingCampaign(): import("dexie").Observable<import("@subwallet/extension-base/background/KoniTypes").CampaignData[]>;
|
|
103
87
|
getProcessingCampaign(): Promise<import("@subwallet/extension-base/background/KoniTypes").CampaignData[]>;
|
|
104
88
|
getCampaign(slug: string): Promise<import("@subwallet/extension-base/background/KoniTypes").CampaignData | undefined>;
|
|
@@ -8,8 +8,6 @@ import CampaignStore from '@subwallet/extension-base/services/storage-service/db
|
|
|
8
8
|
import ChainStakingMetadataStore from '@subwallet/extension-base/services/storage-service/db-stores/ChainStakingMetadata';
|
|
9
9
|
import MantaPayStore from '@subwallet/extension-base/services/storage-service/db-stores/MantaPay';
|
|
10
10
|
import NominatorMetadataStore from '@subwallet/extension-base/services/storage-service/db-stores/NominatorMetadata';
|
|
11
|
-
import YieldPoolStore from '@subwallet/extension-base/services/storage-service/db-stores/YieldPoolStore';
|
|
12
|
-
import YieldPositionStore from '@subwallet/extension-base/services/storage-service/db-stores/YieldPositionStore';
|
|
13
11
|
import { reformatAddress } from '@subwallet/extension-base/utils';
|
|
14
12
|
import { exportDB } from 'dexie-export-import';
|
|
15
13
|
import { logger as createLogger } from '@polkadot/util';
|
|
@@ -36,9 +34,6 @@ export default class DatabaseService {
|
|
|
36
34
|
metadata: new MetadataStore(this._db.metadata),
|
|
37
35
|
chain: new ChainStore(this._db.chain),
|
|
38
36
|
asset: new AssetStore(this._db.asset),
|
|
39
|
-
// yield
|
|
40
|
-
yieldPoolInfo: new YieldPoolStore(this._db.yieldPoolInfo),
|
|
41
|
-
yieldPosition: new YieldPositionStore(this._db.yieldPosition),
|
|
42
37
|
// staking
|
|
43
38
|
chainStakingMetadata: new ChainStakingMetadataStore(this._db.chainStakingMetadata),
|
|
44
39
|
nominatorMetadata: new NominatorMetadataStore(this._db.nominatorMetadata),
|
|
@@ -277,48 +272,6 @@ export default class DatabaseService {
|
|
|
277
272
|
return this.stores.mantaPay.getFirstConfig(chain);
|
|
278
273
|
}
|
|
279
274
|
|
|
280
|
-
/* Earning */
|
|
281
|
-
|
|
282
|
-
async updateYieldPoolStore(data) {
|
|
283
|
-
await this.stores.yieldPoolInfo.upsert(data);
|
|
284
|
-
}
|
|
285
|
-
async deleteYieldPoolInfo(slugs) {
|
|
286
|
-
await this.stores.yieldPoolInfo.bulkDelete(slugs);
|
|
287
|
-
}
|
|
288
|
-
async getYieldPools() {
|
|
289
|
-
return this.stores.yieldPoolInfo.getAll();
|
|
290
|
-
}
|
|
291
|
-
async getYieldPoolStakingInfo(chain, poolType) {
|
|
292
|
-
return this.stores.yieldPoolInfo.getByChainAndType(chain, poolType);
|
|
293
|
-
}
|
|
294
|
-
async getYieldPool(slug) {
|
|
295
|
-
return this.stores.yieldPoolInfo.getBySlug(slug);
|
|
296
|
-
}
|
|
297
|
-
async getYieldPositionByAddressAndSlug(address, slug) {
|
|
298
|
-
return this.stores.yieldPosition.getByAddressAndSlug(address, slug);
|
|
299
|
-
}
|
|
300
|
-
subscribeYieldPoolInfo(chains, callback) {
|
|
301
|
-
this.yieldInfoSubscription && this.yieldInfoSubscription.unsubscribe();
|
|
302
|
-
this.yieldInfoSubscription = this.stores.yieldPoolInfo.subscribeYieldPoolInfo(chains).subscribe({
|
|
303
|
-
next: data => callback && callback(data)
|
|
304
|
-
});
|
|
305
|
-
return this.yieldInfoSubscription;
|
|
306
|
-
}
|
|
307
|
-
async updateYieldPosition(data) {
|
|
308
|
-
await this.stores.yieldPosition.upsert(data);
|
|
309
|
-
}
|
|
310
|
-
async getYieldPositionByAddress(addresses) {
|
|
311
|
-
return this.stores.yieldPosition.getByAddress(addresses);
|
|
312
|
-
}
|
|
313
|
-
subscribeYieldPosition(addresses, callback) {
|
|
314
|
-
return this.stores.yieldPosition.subscribeYieldPositions(addresses).subscribe({
|
|
315
|
-
next: data => callback && callback(data)
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
async getYieldNominationPoolPosition(addresses, chains) {
|
|
319
|
-
return this.stores.yieldPosition.getByAddressAndChains(addresses, chains);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
275
|
/* Campaign */
|
|
323
276
|
|
|
324
277
|
subscribeProcessingCampaign() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
2
|
import { CampaignData, ChainStakingMetadata, CrowdloanItem, MetadataItem, NftCollection, NftItem, NominatorMetadata, PriceJson, StakingItem, TransactionHistoryItem } from '@subwallet/extension-base/background/KoniTypes';
|
|
3
|
-
import { BalanceItem
|
|
3
|
+
import { BalanceItem } from '@subwallet/extension-base/types';
|
|
4
4
|
import Dexie, { Table } from 'dexie';
|
|
5
5
|
export interface DefaultChainDoc {
|
|
6
6
|
chain: string;
|
|
@@ -45,8 +45,6 @@ export default class KoniDatabase extends Dexie {
|
|
|
45
45
|
asset: Table<_ChainAsset, object>;
|
|
46
46
|
chainStakingMetadata: Table<ChainStakingMetadata, object>;
|
|
47
47
|
nominatorMetadata: Table<NominatorMetadata, object>;
|
|
48
|
-
yieldPoolInfo: Table<YieldPoolInfo, object>;
|
|
49
|
-
yieldPosition: Table<YieldPositionInfo, object>;
|
|
50
48
|
mantaPay: Table<IMantaPayLedger, object>;
|
|
51
49
|
campaign: Table<ICampaign, object>;
|
|
52
50
|
private schemaVersion;
|
|
@@ -31,10 +31,6 @@ export default class KoniDatabase extends Dexie {
|
|
|
31
31
|
mantaPay: 'key, chain'
|
|
32
32
|
});
|
|
33
33
|
this.conditionalVersion(4, {
|
|
34
|
-
yieldPoolInfo: 'slug, chain, type',
|
|
35
|
-
yieldPosition: '[slug+chain+address], [address+slug], address, chain'
|
|
36
|
-
});
|
|
37
|
-
this.conditionalVersion(5, {
|
|
38
34
|
campaign: 'slug'
|
|
39
35
|
});
|
|
40
36
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { StakingStatus } from '@subwallet/extension-base/background/KoniTypes';
|
|
4
5
|
import BaseStoreWithAddressAndChain from '@subwallet/extension-base/services/storage-service/db-stores/BaseStoreWithAddressAndChain';
|
|
5
|
-
import { EarningStatus } from '@subwallet/extension-base/types';
|
|
6
6
|
import { liveQuery } from 'dexie';
|
|
7
7
|
export default class NominatorMetadataStore extends BaseStoreWithAddressAndChain {
|
|
8
8
|
async getAll() {
|
|
9
|
-
return this.table.filter(item => item.status !==
|
|
9
|
+
return this.table.filter(item => item.status !== StakingStatus.NOT_STAKING).toArray();
|
|
10
10
|
}
|
|
11
11
|
subscribeByAddresses(addresses) {
|
|
12
12
|
return liveQuery(() => this.getByAddress(addresses));
|
|
@@ -15,7 +15,7 @@ export default class NominatorMetadataStore extends BaseStoreWithAddressAndChain
|
|
|
15
15
|
return liveQuery(() => this.getAll());
|
|
16
16
|
}
|
|
17
17
|
getByAddress(addresses) {
|
|
18
|
-
return this.table.where('address').anyOfIgnoreCase(addresses).and(item => item.status !==
|
|
18
|
+
return this.table.where('address').anyOfIgnoreCase(addresses).and(item => item.status !== StakingStatus.NOT_STAKING).toArray();
|
|
19
19
|
}
|
|
20
20
|
async removeByAddress(address) {
|
|
21
21
|
return this.table.where('address').anyOfIgnoreCase(address).delete();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CrowdloanContributionsResponse, ExtrinsicItem, ExtrinsicsListResponse, IMultiChainBalance, RequestBlockRange,
|
|
1
|
+
import { CrowdloanContributionsResponse, ExtrinsicItem, ExtrinsicsListResponse, IMultiChainBalance, RequestBlockRange, TransferItem, TransfersListResponse } from '@subwallet/extension-base/services/subscan-service/types';
|
|
2
2
|
export declare class SubscanService {
|
|
3
3
|
private subscanChainMap;
|
|
4
4
|
private limitRate;
|
|
@@ -15,7 +15,7 @@ export declare class SubscanService {
|
|
|
15
15
|
});
|
|
16
16
|
private getApiUrl;
|
|
17
17
|
private postRequest;
|
|
18
|
-
addRequest
|
|
18
|
+
private addRequest;
|
|
19
19
|
private process;
|
|
20
20
|
checkSupportedSubscanChain(chain: string): boolean;
|
|
21
21
|
setSubscanChainMap(subscanChainMap: Record<string, string>): void;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
|
-
import {
|
|
2
|
+
import { TransactionHistoryItem } from '@subwallet/extension-base/background/KoniTypes';
|
|
3
3
|
import { EventRecord } from '@polkadot/types/interfaces';
|
|
4
4
|
export declare function parseXcmEventLogs(historyItem: Partial<TransactionHistoryItem>, eventLogs: EventRecord[], chain: string, sendingTokenInfo: _ChainAsset, chainInfo: _ChainInfo): void;
|
|
5
5
|
export declare function parseTransferEventLogs(historyItem: Partial<TransactionHistoryItem>, eventLogs: EventRecord[], chain: string, sendingTokenInfo: _ChainAsset, chainInfo: _ChainInfo): void;
|
|
6
|
-
export declare function parseLiquidStakingEvents(historyItem: Partial<TransactionHistoryItem>, eventLogs: EventRecord[], inputTokenInfo: _ChainAsset, chainInfo: _ChainInfo, feePaidWithInputAsset: boolean, extrinsicType: ExtrinsicType): void;
|
|
7
|
-
export declare function parseLiquidStakingFastUnstakeEvents(historyItem: Partial<TransactionHistoryItem>, eventLogs: EventRecord[], chainInfo: _ChainInfo, extrinsicType: ExtrinsicType): void;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { _getAssetDecimals, _getAssetSymbol, _getChainNativeTokenBasicInfo } from '@subwallet/extension-base/services/chain-service/utils';
|
|
4
|
+
import { _getAssetDecimals, _getChainNativeTokenBasicInfo } from '@subwallet/extension-base/services/chain-service/utils';
|
|
6
5
|
export function parseXcmEventLogs(historyItem, eventLogs, chain, sendingTokenInfo, chainInfo) {
|
|
7
6
|
for (let index = 0; index < eventLogs.length; index++) {
|
|
8
7
|
const record = eventLogs[index];
|
|
@@ -66,59 +65,4 @@ export function parseTransferEventLogs(historyItem, eventLogs, chain, sendingTok
|
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
|
-
}
|
|
70
|
-
export function parseLiquidStakingEvents(historyItem, eventLogs, inputTokenInfo, chainInfo, feePaidWithInputAsset, extrinsicType) {
|
|
71
|
-
if (feePaidWithInputAsset) {
|
|
72
|
-
historyItem.fee = {
|
|
73
|
-
value: '0',
|
|
74
|
-
// TODO
|
|
75
|
-
symbol: _getAssetSymbol(inputTokenInfo),
|
|
76
|
-
decimals: _getAssetDecimals(inputTokenInfo)
|
|
77
|
-
};
|
|
78
|
-
} else {
|
|
79
|
-
for (let index = 0; index < eventLogs.length; index++) {
|
|
80
|
-
const record = eventLogs[index];
|
|
81
|
-
const {
|
|
82
|
-
decimals: nativeDecimals,
|
|
83
|
-
symbol: nativeSymbol
|
|
84
|
-
} = _getChainNativeTokenBasicInfo(chainInfo);
|
|
85
|
-
const section = extrinsicType === ExtrinsicType.REDEEM_QDOT ? 'tokens' : 'balances';
|
|
86
|
-
const eventMethod = extrinsicType === ExtrinsicType.REDEEM_QDOT ? 'withdrawn' : 'withdraw';
|
|
87
|
-
if (record.event.section === section && record.event.method.toLowerCase() === eventMethod) {
|
|
88
|
-
var _record$event$data$9;
|
|
89
|
-
if ((_record$event$data$9 = record.event.data[2]) !== null && _record$event$data$9 !== void 0 && _record$event$data$9.toString()) {
|
|
90
|
-
var _record$event$data$10;
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
92
|
-
historyItem.fee = {
|
|
93
|
-
value: ((_record$event$data$10 = record.event.data[2]) === null || _record$event$data$10 === void 0 ? void 0 : _record$event$data$10.toString()) || '0',
|
|
94
|
-
symbol: nativeSymbol,
|
|
95
|
-
decimals: nativeDecimals
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
export function parseLiquidStakingFastUnstakeEvents(historyItem, eventLogs, chainInfo, extrinsicType) {
|
|
103
|
-
for (let index = 0; index < eventLogs.length; index++) {
|
|
104
|
-
const record = eventLogs[index];
|
|
105
|
-
const {
|
|
106
|
-
decimals: nativeDecimals,
|
|
107
|
-
symbol: nativeSymbol
|
|
108
|
-
} = _getChainNativeTokenBasicInfo(chainInfo);
|
|
109
|
-
const section = extrinsicType === ExtrinsicType.REDEEM_QDOT ? 'tokens' : 'balances';
|
|
110
|
-
const eventMethod = extrinsicType === ExtrinsicType.REDEEM_QDOT ? 'withdrawn' : 'withdraw';
|
|
111
|
-
if (record.event.section === section && record.event.method.toLowerCase() === eventMethod) {
|
|
112
|
-
var _record$event$data$11;
|
|
113
|
-
if ((_record$event$data$11 = record.event.data[2]) !== null && _record$event$data$11 !== void 0 && _record$event$data$11.toString()) {
|
|
114
|
-
var _record$event$data$12;
|
|
115
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
116
|
-
historyItem.fee = {
|
|
117
|
-
value: ((_record$event$data$12 = record.event.data[2]) === null || _record$event$data$12 === void 0 ? void 0 : _record$event$data$12.toString()) || '0',
|
|
118
|
-
symbol: nativeSymbol,
|
|
119
|
-
decimals: nativeDecimals
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
68
|
}
|
|
@@ -30,7 +30,7 @@ const typeName = type => {
|
|
|
30
30
|
case ExtrinsicType.STAKING_BOND:
|
|
31
31
|
return 'Bond';
|
|
32
32
|
case ExtrinsicType.STAKING_UNBOND:
|
|
33
|
-
return '
|
|
33
|
+
return 'Unbond';
|
|
34
34
|
case ExtrinsicType.STAKING_CLAIM_REWARD:
|
|
35
35
|
return 'Claim reward';
|
|
36
36
|
case ExtrinsicType.STAKING_WITHDRAW:
|
|
@@ -45,8 +45,6 @@ const typeName = type => {
|
|
|
45
45
|
return 'Cancel compounding';
|
|
46
46
|
case ExtrinsicType.STAKING_POOL_WITHDRAW:
|
|
47
47
|
return 'Withdraw pool';
|
|
48
|
-
case ExtrinsicType.JOIN_YIELD_POOL:
|
|
49
|
-
return 'Start earning';
|
|
50
48
|
case ExtrinsicType.UNKNOWN:
|
|
51
49
|
default:
|
|
52
50
|
return 'unknown';
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
2
|
-
import
|
|
2
|
+
import { BalanceService } from '@subwallet/extension-base/services/balance-service';
|
|
3
|
+
import { ChainService } from '@subwallet/extension-base/services/chain-service';
|
|
4
|
+
import { EventService } from '@subwallet/extension-base/services/event-service';
|
|
5
|
+
import { HistoryService } from '@subwallet/extension-base/services/history-service';
|
|
6
|
+
import NotificationService from '@subwallet/extension-base/services/notification-service/NotificationService';
|
|
7
|
+
import RequestService from '@subwallet/extension-base/services/request-service';
|
|
8
|
+
import DatabaseService from '@subwallet/extension-base/services/storage-service/DatabaseService';
|
|
3
9
|
import { SWTransaction, SWTransactionInput, SWTransactionResponse, TransactionEmitter } from '@subwallet/extension-base/services/transaction-service/types';
|
|
4
10
|
import { BehaviorSubject } from 'rxjs';
|
|
5
11
|
import { TransactionConfig } from 'web3-core';
|
|
6
12
|
import { HexString } from '@polkadot/util/types';
|
|
7
13
|
export default class TransactionService {
|
|
8
|
-
private readonly
|
|
14
|
+
private readonly balanceService;
|
|
15
|
+
private readonly chainService;
|
|
16
|
+
private readonly databaseService;
|
|
17
|
+
private readonly eventService;
|
|
18
|
+
private readonly historyService;
|
|
19
|
+
private readonly notificationService;
|
|
20
|
+
private readonly requestService;
|
|
9
21
|
private readonly transactionSubject;
|
|
10
22
|
private readonly watchTransactionSubscribes;
|
|
11
23
|
private get transactions();
|
|
12
|
-
constructor(
|
|
24
|
+
constructor(chainService: ChainService, eventService: EventService, requestService: RequestService, balanceService: BalanceService, historyService: HistoryService, notificationService: NotificationService, databaseService: DatabaseService);
|
|
13
25
|
private get allTransactions();
|
|
14
26
|
private get processingTransactions();
|
|
15
27
|
getTransaction(id: string): SWTransaction;
|
|
@@ -35,6 +47,5 @@ export default class TransactionService {
|
|
|
35
47
|
private signAndSendEvmTransaction;
|
|
36
48
|
private signAndSendSubstrateTransaction;
|
|
37
49
|
private handleTransactionTimeout;
|
|
38
|
-
private handlePostEarningTransaction;
|
|
39
50
|
resetWallet(): void;
|
|
40
51
|
}
|