@subwallet/extension-base 1.1.31-beta.0 → 1.1.32-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 +69 -111
- package/background/KoniTypes.js +13 -19
- package/background/errors/TransactionError.js +0 -9
- package/cjs/background/KoniTypes.js +16 -20
- package/cjs/background/errors/TransactionError.js +0 -9
- package/cjs/constants/index.js +4 -19
- 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 +3 -4
- package/cjs/koni/api/staking/bonding/paraChain.js +29 -28
- 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 +1 -11
- package/cjs/koni/background/handlers/Extension.js +69 -362
- package/cjs/koni/background/handlers/State.js +3 -51
- package/cjs/koni/background/handlers/index.js +2 -4
- package/cjs/koni/background/subscription.js +37 -95
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/campaign-service/index.js +6 -9
- package/cjs/services/chain-service/constants.js +18 -3
- package/cjs/services/chain-service/index.js +2 -3
- 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 +1 -7
- package/cjs/services/notification-service/NotificationService.js +1 -1
- package/cjs/services/storage-service/DatabaseService.js +0 -51
- package/cjs/services/storage-service/databases/index.js +0 -4
- package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
- package/cjs/services/subscan-service/index.js +0 -16
- 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 +75 -231
- 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/cjs/utils/number.js +1 -3
- package/constants/index.d.ts +1 -6
- package/constants/index.js +1 -6
- 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 +2 -1
- package/koni/api/staking/bonding/index.js +3 -5
- package/koni/api/staking/bonding/paraChain.js +16 -15
- 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.d.ts +0 -1
- package/koni/background/cron.js +2 -12
- package/koni/background/handlers/Extension.d.ts +1 -17
- package/koni/background/handlers/Extension.js +30 -321
- 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 -6
- package/koni/background/subscription.js +38 -97
- package/package.json +8 -321
- 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 +16 -2
- package/services/chain-service/index.js +2 -3
- 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 +1 -7
- package/services/notification-service/NotificationService.js +1 -1
- package/services/storage-service/DatabaseService.d.ts +1 -18
- package/services/storage-service/DatabaseService.js +0 -51
- 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 -3
- package/services/subscan-service/index.js +0 -15
- package/services/subscan-service/types.d.ts +0 -20
- 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 +73 -229
- 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/utils/number.d.ts +1 -1
- package/utils/number.js +1 -1
- 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 -259
- 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 -191
- package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -239
- package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -43
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -297
- package/cjs/services/earning-service/handlers/liquid-staking/index.js +0 -34
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -226
- package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -395
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +0 -384
- package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -461
- package/cjs/services/earning-service/handlers/native-staking/base-para.js +0 -146
- package/cjs/services/earning-service/handlers/native-staking/base.js +0 -159
- package/cjs/services/earning-service/handlers/native-staking/index.js +0 -34
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -385
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +0 -558
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +0 -560
- package/cjs/services/earning-service/handlers/special.js +0 -503
- package/cjs/services/earning-service/service.js +0 -387
- package/cjs/services/earning-service/utils/index.js +0 -128
- 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/migration-service/scripts/databases/MigrateEarningHistory.js +0 -21
- package/cjs/services/migration-service/scripts/databases/MigrateEarningVersion.js +0 -21
- 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 -47
- 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 -41
- 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 -112
- package/services/earning-service/handlers/base.js +0 -253
- 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 -24
- package/services/earning-service/handlers/lending/interlay.js +0 -183
- package/services/earning-service/handlers/liquid-staking/acala.d.ts +0 -27
- package/services/earning-service/handlers/liquid-staking/acala.js +0 -231
- package/services/earning-service/handlers/liquid-staking/base.d.ts +0 -9
- package/services/earning-service/handlers/liquid-staking/base.js +0 -35
- package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +0 -46
- package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -286
- 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 -26
- package/services/earning-service/handlers/liquid-staking/parallel.js +0 -218
- package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +0 -34
- package/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -385
- package/services/earning-service/handlers/native-staking/amplitude.d.ts +0 -22
- package/services/earning-service/handlers/native-staking/amplitude.js +0 -375
- package/services/earning-service/handlers/native-staking/astar.d.ts +0 -19
- package/services/earning-service/handlers/native-staking/astar.js +0 -451
- package/services/earning-service/handlers/native-staking/base-para.d.ts +0 -11
- package/services/earning-service/handlers/native-staking/base-para.js +0 -138
- package/services/earning-service/handlers/native-staking/base.d.ts +0 -21
- package/services/earning-service/handlers/native-staking/base.js +0 -150
- 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 -377
- package/services/earning-service/handlers/native-staking/relay-chain.d.ts +0 -21
- package/services/earning-service/handlers/native-staking/relay-chain.js +0 -549
- package/services/earning-service/handlers/nomination-pool/index.d.ts +0 -36
- package/services/earning-service/handlers/nomination-pool/index.js +0 -550
- package/services/earning-service/handlers/special.d.ts +0 -65
- package/services/earning-service/handlers/special.js +0 -495
- package/services/earning-service/service.d.ts +0 -45
- package/services/earning-service/service.js +0 -379
- package/services/earning-service/utils/index.d.ts +0 -18
- package/services/earning-service/utils/index.js +0 -112
- 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/migration-service/scripts/databases/MigrateEarningHistory.d.ts +0 -4
- package/services/migration-service/scripts/databases/MigrateEarningHistory.js +0 -13
- package/services/migration-service/scripts/databases/MigrateEarningVersion.d.ts +0 -4
- package/services/migration-service/scripts/databases/MigrateEarningVersion.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 -95
- package/types/yield/actions/join/step.js +0 -46
- package/types/yield/actions/join/submit.d.ts +0 -57
- 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 -85
- 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 -92
- package/types/yield/info/account/info.js +0 -1
- package/types/yield/info/account/reward.d.ts +0 -45
- 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 -45
- package/types/yield/info/base.js +0 -36
- 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 -251
- package/types/yield/info/chain/info.js +0 -1
- package/types/yield/info/chain/target.d.ts +0 -37
- 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
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
5
|
-
import { BasicTxErrorType } from '@subwallet/extension-base/background/KoniTypes';
|
|
6
|
-
import { _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
|
|
7
|
-
import { _STAKING_CHAIN_GROUP } from '@subwallet/extension-base/services/earning-service/constants';
|
|
8
|
-
import BaseLiquidStakingPoolHandler from '@subwallet/extension-base/services/earning-service/handlers/liquid-staking/base';
|
|
9
|
-
import { YieldPoolType } from '@subwallet/extension-base/types';
|
|
10
|
-
import { categoryAddresses } from '@subwallet/extension-base/utils';
|
|
11
|
-
import { BehaviorSubject } from 'rxjs';
|
|
12
|
-
import { AcalaLiquidStakingPoolHandler, AmplitudeNativeStakingPoolHandler, AstarNativeStakingPoolHandler, BifrostLiquidStakingPoolHandler, InterlayLendingPoolHandler, NominationPoolHandler, ParallelLiquidStakingPoolHandler, ParaNativeStakingPoolHandler, RelayNativeStakingPoolHandler, StellaSwapLiquidStakingPoolHandler } from "./handlers/index.js";
|
|
13
|
-
export default class EarningService {
|
|
14
|
-
handlers = {};
|
|
15
|
-
earningRewardSubject = new BehaviorSubject({
|
|
16
|
-
ready: false,
|
|
17
|
-
data: {}
|
|
18
|
-
});
|
|
19
|
-
earningRewardHistorySubject = new BehaviorSubject({});
|
|
20
|
-
minAmountPercentSubject = new BehaviorSubject({});
|
|
21
|
-
constructor(state) {
|
|
22
|
-
this.state = state;
|
|
23
|
-
this.initHandlers().catch(console.error);
|
|
24
|
-
}
|
|
25
|
-
async initHandlers() {
|
|
26
|
-
await this.state.eventService.waitChainReady;
|
|
27
|
-
const chains = Object.keys(this.state.getChainInfoMap());
|
|
28
|
-
const minAmountPercent = {};
|
|
29
|
-
for (const chain of chains) {
|
|
30
|
-
const handlers = [];
|
|
31
|
-
if (_STAKING_CHAIN_GROUP.relay.includes(chain)) {
|
|
32
|
-
handlers.push(new RelayNativeStakingPoolHandler(this.state, chain));
|
|
33
|
-
}
|
|
34
|
-
if (_STAKING_CHAIN_GROUP.para.includes(chain)) {
|
|
35
|
-
handlers.push(new ParaNativeStakingPoolHandler(this.state, chain));
|
|
36
|
-
}
|
|
37
|
-
if (_STAKING_CHAIN_GROUP.astar.includes(chain)) {
|
|
38
|
-
handlers.push(new AstarNativeStakingPoolHandler(this.state, chain));
|
|
39
|
-
}
|
|
40
|
-
if (_STAKING_CHAIN_GROUP.amplitude.includes(chain)) {
|
|
41
|
-
handlers.push(new AmplitudeNativeStakingPoolHandler(this.state, chain));
|
|
42
|
-
}
|
|
43
|
-
if (_STAKING_CHAIN_GROUP.nominationPool.includes(chain)) {
|
|
44
|
-
handlers.push(new NominationPoolHandler(this.state, chain));
|
|
45
|
-
}
|
|
46
|
-
if (_STAKING_CHAIN_GROUP.liquidStaking.includes(chain)) {
|
|
47
|
-
if (chain === 'bifrost_dot') {
|
|
48
|
-
handlers.push(new BifrostLiquidStakingPoolHandler(this.state, chain));
|
|
49
|
-
}
|
|
50
|
-
if (chain === 'acala') {
|
|
51
|
-
handlers.push(new AcalaLiquidStakingPoolHandler(this.state, chain));
|
|
52
|
-
}
|
|
53
|
-
if (chain === 'parallel') {
|
|
54
|
-
handlers.push(new ParallelLiquidStakingPoolHandler(this.state, chain));
|
|
55
|
-
}
|
|
56
|
-
if (chain === 'moonbeam') {
|
|
57
|
-
handlers.push(new StellaSwapLiquidStakingPoolHandler(this.state, chain));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (_STAKING_CHAIN_GROUP.lending.includes(chain)) {
|
|
61
|
-
if (chain === 'interlay') {
|
|
62
|
-
handlers.push(new InterlayLendingPoolHandler(this.state, chain));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
for (const handler of handlers) {
|
|
66
|
-
this.handlers[handler.slug] = handler;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
for (const handler of Object.values(this.handlers)) {
|
|
70
|
-
if (handler.type === YieldPoolType.LIQUID_STAKING) {
|
|
71
|
-
minAmountPercent[handler.slug] = handler.minAmountPercent;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
minAmountPercent.default = BaseLiquidStakingPoolHandler.defaultMinAmountPercent;
|
|
75
|
-
this.minAmountPercentSubject.next(minAmountPercent);
|
|
76
|
-
}
|
|
77
|
-
getPoolHandler(slug) {
|
|
78
|
-
return this.handlers[slug];
|
|
79
|
-
}
|
|
80
|
-
isPoolSupportAlternativeFee(slug) {
|
|
81
|
-
const handler = this.getPoolHandler(slug);
|
|
82
|
-
if (handler) {
|
|
83
|
-
return handler.isPoolSupportAlternativeFee;
|
|
84
|
-
} else {
|
|
85
|
-
throw new TransactionError(BasicTxErrorType.INTERNAL_ERROR);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
subscribeMinAmountPercent() {
|
|
89
|
-
return this.minAmountPercentSubject;
|
|
90
|
-
}
|
|
91
|
-
getMinAmountPercent() {
|
|
92
|
-
return this.minAmountPercentSubject.getValue();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/* Subscribe pools' info */
|
|
96
|
-
|
|
97
|
-
async subscribePoolsInfo(callback) {
|
|
98
|
-
let cancel = false;
|
|
99
|
-
await this.state.eventService.waitChainReady;
|
|
100
|
-
const unsubList = [];
|
|
101
|
-
for (const handler of Object.values(this.handlers)) {
|
|
102
|
-
handler.subscribePoolInfo(callback).then(unsub => {
|
|
103
|
-
if (cancel) {
|
|
104
|
-
unsub();
|
|
105
|
-
} else {
|
|
106
|
-
unsubList.push(unsub);
|
|
107
|
-
}
|
|
108
|
-
}).catch(console.error);
|
|
109
|
-
}
|
|
110
|
-
return () => {
|
|
111
|
-
cancel = true;
|
|
112
|
-
unsubList.forEach(unsub => {
|
|
113
|
-
unsub === null || unsub === void 0 ? void 0 : unsub();
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/* Subscribe pools' info */
|
|
119
|
-
|
|
120
|
-
/* Subscribe pools' position */
|
|
121
|
-
|
|
122
|
-
async subscribePoolPositions(addresses, callback) {
|
|
123
|
-
let cancel = false;
|
|
124
|
-
await this.state.eventService.waitChainReady;
|
|
125
|
-
const [substrateAddresses, evmAddresses] = categoryAddresses(addresses);
|
|
126
|
-
const activeChains = this.state.activeChainSlugs;
|
|
127
|
-
const unsubList = [];
|
|
128
|
-
for (const handler of Object.values(this.handlers)) {
|
|
129
|
-
if (activeChains.includes(handler.chain)) {
|
|
130
|
-
const chainInfo = handler.chainInfo;
|
|
131
|
-
const useAddresses = _isChainEvmCompatible(chainInfo) ? evmAddresses : substrateAddresses;
|
|
132
|
-
handler.subscribePoolPosition(useAddresses, callback).then(unsub => {
|
|
133
|
-
if (cancel) {
|
|
134
|
-
unsub();
|
|
135
|
-
} else {
|
|
136
|
-
unsubList.push(unsub);
|
|
137
|
-
}
|
|
138
|
-
}).catch(console.error);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return () => {
|
|
142
|
-
cancel = true;
|
|
143
|
-
unsubList.forEach(unsub => {
|
|
144
|
-
unsub === null || unsub === void 0 ? void 0 : unsub();
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/* Subscribe pools' position */
|
|
150
|
-
|
|
151
|
-
/* Get pools' reward */
|
|
152
|
-
|
|
153
|
-
updateEarningReward(stakingRewardData) {
|
|
154
|
-
const stakingRewardState = this.earningRewardSubject.getValue();
|
|
155
|
-
stakingRewardState.ready = true;
|
|
156
|
-
const key = `${stakingRewardData.slug}---${stakingRewardData.address}`;
|
|
157
|
-
stakingRewardState.data[key] = stakingRewardData;
|
|
158
|
-
this.earningRewardSubject.next(stakingRewardState);
|
|
159
|
-
}
|
|
160
|
-
async getPoolReward(addresses, callback) {
|
|
161
|
-
let cancel = false;
|
|
162
|
-
await this.state.eventService.waitChainReady;
|
|
163
|
-
const [substrateAddresses, evmAddresses] = categoryAddresses(addresses);
|
|
164
|
-
const activeChains = this.state.activeChainSlugs;
|
|
165
|
-
const unsubList = [];
|
|
166
|
-
for (const handler of Object.values(this.handlers)) {
|
|
167
|
-
if (activeChains.includes(handler.chain)) {
|
|
168
|
-
const chainInfo = handler.chainInfo;
|
|
169
|
-
const useAddresses = _isChainEvmCompatible(chainInfo) ? evmAddresses : substrateAddresses;
|
|
170
|
-
handler.getPoolReward(useAddresses, callback).then(unsub => {
|
|
171
|
-
if (cancel) {
|
|
172
|
-
unsub();
|
|
173
|
-
} else {
|
|
174
|
-
unsubList.push(unsub);
|
|
175
|
-
}
|
|
176
|
-
}).catch(console.error);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return () => {
|
|
180
|
-
cancel = true;
|
|
181
|
-
unsubList.forEach(unsub => {
|
|
182
|
-
unsub === null || unsub === void 0 ? void 0 : unsub();
|
|
183
|
-
});
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
subscribeEarningReward() {
|
|
187
|
-
return this.earningRewardSubject;
|
|
188
|
-
}
|
|
189
|
-
getEarningRewards() {
|
|
190
|
-
return this.earningRewardSubject.getValue();
|
|
191
|
-
}
|
|
192
|
-
async fetchPoolRewardHistory(addresses, callback) {
|
|
193
|
-
let cancel = false;
|
|
194
|
-
await this.state.eventService.waitChainReady;
|
|
195
|
-
const [substrateAddresses, evmAddresses] = categoryAddresses(addresses);
|
|
196
|
-
const activeChains = this.state.activeChainSlugs;
|
|
197
|
-
const unsubList = [];
|
|
198
|
-
for (const handler of Object.values(this.handlers)) {
|
|
199
|
-
if (activeChains.includes(handler.chain)) {
|
|
200
|
-
const chainInfo = handler.chainInfo;
|
|
201
|
-
const useAddresses = _isChainEvmCompatible(chainInfo) ? evmAddresses : substrateAddresses;
|
|
202
|
-
handler.getPoolRewardHistory(useAddresses, callback).then(unsub => {
|
|
203
|
-
if (cancel) {
|
|
204
|
-
unsub();
|
|
205
|
-
} else {
|
|
206
|
-
unsubList.push(unsub);
|
|
207
|
-
}
|
|
208
|
-
}).catch(console.error);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
return () => {
|
|
212
|
-
cancel = true;
|
|
213
|
-
unsubList.forEach(unsub => {
|
|
214
|
-
unsub === null || unsub === void 0 ? void 0 : unsub();
|
|
215
|
-
});
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
updateEarningRewardHistory(earningRewardHistory) {
|
|
219
|
-
const earningRewardHistoryState = this.earningRewardHistorySubject.getValue();
|
|
220
|
-
const key = `${earningRewardHistory.slug}---${earningRewardHistory.address}---${earningRewardHistory.blockTimestamp}`;
|
|
221
|
-
earningRewardHistoryState[key] = earningRewardHistory;
|
|
222
|
-
this.earningRewardHistorySubject.next(earningRewardHistoryState);
|
|
223
|
-
}
|
|
224
|
-
subscribeEarningRewardHistory() {
|
|
225
|
-
return this.earningRewardHistorySubject;
|
|
226
|
-
}
|
|
227
|
-
getEarningRewardHistory() {
|
|
228
|
-
return this.earningRewardHistorySubject.getValue();
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/* Get pools' reward */
|
|
232
|
-
|
|
233
|
-
/* Get pool's targets */
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* @async
|
|
237
|
-
* @function getPoolTargets
|
|
238
|
-
* @param {string} slug - Pool's slug
|
|
239
|
-
* @return {Promise<YieldPoolTarget[]>} List of pool's target
|
|
240
|
-
* */
|
|
241
|
-
async getPoolTargets(slug) {
|
|
242
|
-
await this.state.eventService.waitChainReady;
|
|
243
|
-
const handler = this.getPoolHandler(slug);
|
|
244
|
-
if (handler) {
|
|
245
|
-
return await handler.getPoolTargets();
|
|
246
|
-
} else {
|
|
247
|
-
return [];
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/* Get pool's targets */
|
|
252
|
-
|
|
253
|
-
/* Handle actions */
|
|
254
|
-
|
|
255
|
-
/* Join */
|
|
256
|
-
|
|
257
|
-
async earlyValidateJoin(request) {
|
|
258
|
-
await this.state.eventService.waitChainReady;
|
|
259
|
-
const {
|
|
260
|
-
slug
|
|
261
|
-
} = request;
|
|
262
|
-
const handler = this.getPoolHandler(slug);
|
|
263
|
-
if (handler) {
|
|
264
|
-
return handler.earlyValidate(request);
|
|
265
|
-
} else {
|
|
266
|
-
throw new TransactionError(BasicTxErrorType.INTERNAL_ERROR);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
async generateOptimalSteps(params) {
|
|
270
|
-
await this.state.eventService.waitChainReady;
|
|
271
|
-
const {
|
|
272
|
-
slug
|
|
273
|
-
} = params;
|
|
274
|
-
const handler = this.getPoolHandler(slug);
|
|
275
|
-
if (handler) {
|
|
276
|
-
return handler.generateOptimalPath(params);
|
|
277
|
-
} else {
|
|
278
|
-
throw new TransactionError(BasicTxErrorType.INTERNAL_ERROR);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
async validateYieldJoin(params) {
|
|
282
|
-
await this.state.eventService.waitChainReady;
|
|
283
|
-
const {
|
|
284
|
-
slug
|
|
285
|
-
} = params.data;
|
|
286
|
-
const handler = this.getPoolHandler(slug);
|
|
287
|
-
if (handler) {
|
|
288
|
-
return handler.validateYieldJoin(params.data, params.path);
|
|
289
|
-
} else {
|
|
290
|
-
return [new TransactionError(BasicTxErrorType.INTERNAL_ERROR)];
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
async handleYieldJoin(params) {
|
|
294
|
-
await this.state.eventService.waitChainReady;
|
|
295
|
-
const {
|
|
296
|
-
slug
|
|
297
|
-
} = params.data;
|
|
298
|
-
const handler = this.getPoolHandler(slug);
|
|
299
|
-
if (handler) {
|
|
300
|
-
return handler.handleYieldJoin(params.data, params.path, params.currentStep);
|
|
301
|
-
} else {
|
|
302
|
-
return Promise.reject(new TransactionError(BasicTxErrorType.INTERNAL_ERROR));
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/* Join */
|
|
307
|
-
|
|
308
|
-
/* Leave */
|
|
309
|
-
|
|
310
|
-
async validateYieldLeave(params) {
|
|
311
|
-
await this.state.eventService.waitChainReady;
|
|
312
|
-
const {
|
|
313
|
-
slug
|
|
314
|
-
} = params;
|
|
315
|
-
const handler = this.getPoolHandler(slug);
|
|
316
|
-
if (handler) {
|
|
317
|
-
return handler.validateYieldLeave(params.amount, params.address, params.fastLeave, params.selectedTarget);
|
|
318
|
-
} else {
|
|
319
|
-
return Promise.reject(new TransactionError(BasicTxErrorType.INTERNAL_ERROR));
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
async handleYieldLeave(params) {
|
|
323
|
-
await this.state.eventService.waitChainReady;
|
|
324
|
-
const {
|
|
325
|
-
slug
|
|
326
|
-
} = params;
|
|
327
|
-
const handler = this.getPoolHandler(slug);
|
|
328
|
-
if (handler) {
|
|
329
|
-
return handler.handleYieldLeave(params.fastLeave, params.amount, params.address, params.selectedTarget);
|
|
330
|
-
} else {
|
|
331
|
-
return Promise.reject(new TransactionError(BasicTxErrorType.INTERNAL_ERROR));
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/* Leave */
|
|
336
|
-
|
|
337
|
-
/* Other */
|
|
338
|
-
|
|
339
|
-
async handleYieldWithdraw(params) {
|
|
340
|
-
await this.state.eventService.waitChainReady;
|
|
341
|
-
const {
|
|
342
|
-
slug
|
|
343
|
-
} = params;
|
|
344
|
-
const handler = this.getPoolHandler(slug);
|
|
345
|
-
if (handler) {
|
|
346
|
-
return handler.handleYieldWithdraw(params.address, params.unstakingInfo);
|
|
347
|
-
} else {
|
|
348
|
-
return Promise.reject(new TransactionError(BasicTxErrorType.INTERNAL_ERROR));
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
async handleYieldCancelUnstake(params) {
|
|
352
|
-
await this.state.eventService.waitChainReady;
|
|
353
|
-
const {
|
|
354
|
-
slug
|
|
355
|
-
} = params;
|
|
356
|
-
const handler = this.getPoolHandler(slug);
|
|
357
|
-
if (handler) {
|
|
358
|
-
return handler.handleYieldCancelUnstake(params);
|
|
359
|
-
} else {
|
|
360
|
-
return Promise.reject(new TransactionError(BasicTxErrorType.INTERNAL_ERROR));
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
async handleYieldClaimReward(params) {
|
|
364
|
-
await this.state.eventService.waitChainReady;
|
|
365
|
-
const {
|
|
366
|
-
slug
|
|
367
|
-
} = params;
|
|
368
|
-
const handler = this.getPoolHandler(slug);
|
|
369
|
-
if (handler) {
|
|
370
|
-
return handler.handleYieldClaimReward(params.address, params.bondReward);
|
|
371
|
-
} else {
|
|
372
|
-
return Promise.reject(new TransactionError(BasicTxErrorType.INTERNAL_ERROR));
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/* Other */
|
|
377
|
-
|
|
378
|
-
/* Handle actions */
|
|
379
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { _SubstrateApi } from '@subwallet/extension-base/services/chain-service/types';
|
|
2
|
-
import { LendingYieldPoolInfo, LiquidYieldPoolInfo, NativeYieldPoolInfo, NominationYieldPoolInfo, YieldAssetExpectedEarning, YieldCompoundingPeriod, YieldPoolInfo, YieldPoolType } from '@subwallet/extension-base/types';
|
|
3
|
-
export declare function calculateReward(apr: number, amount?: number, compoundingPeriod?: YieldCompoundingPeriod, isApy?: boolean): YieldAssetExpectedEarning;
|
|
4
|
-
/**
|
|
5
|
-
* @returns
|
|
6
|
-
* <p>
|
|
7
|
-
* [0] - identity
|
|
8
|
-
* </p>
|
|
9
|
-
* <p>
|
|
10
|
-
* [1] - isReasonable (isVerified)
|
|
11
|
-
* </p>
|
|
12
|
-
* */
|
|
13
|
-
export declare function parseIdentity(substrateApi: _SubstrateApi, address: string, children?: string): Promise<[string | undefined, boolean]>;
|
|
14
|
-
export declare function isActionFromValidator(stakingType: YieldPoolType, chain: string): boolean;
|
|
15
|
-
export declare const isNominationPool: (pool: YieldPoolInfo) => pool is NominationYieldPoolInfo;
|
|
16
|
-
export declare const isNativeStakingPool: (pool: YieldPoolInfo) => pool is NativeYieldPoolInfo;
|
|
17
|
-
export declare const isLiquidPool: (pool: YieldPoolInfo) => pool is LiquidYieldPoolInfo;
|
|
18
|
-
export declare const isLendingPool: (pool: YieldPoolInfo) => pool is LendingYieldPoolInfo;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { _STAKING_CHAIN_GROUP } from '@subwallet/extension-base/services/earning-service/constants';
|
|
5
|
-
import { YieldCompoundingPeriod, YieldPoolType } from '@subwallet/extension-base/types';
|
|
6
|
-
import { hexToString, isHex } from '@polkadot/util';
|
|
7
|
-
export function calculateReward(apr, amount = 0, compoundingPeriod = YieldCompoundingPeriod.YEARLY, isApy = false) {
|
|
8
|
-
if (!apr) {
|
|
9
|
-
return {};
|
|
10
|
-
}
|
|
11
|
-
if (!isApy) {
|
|
12
|
-
const periodApr = apr / 365 * compoundingPeriod; // APR is always annually
|
|
13
|
-
const earningRatio = periodApr / 100 / compoundingPeriod;
|
|
14
|
-
const periodApy = (1 + earningRatio) ** compoundingPeriod - 1;
|
|
15
|
-
const reward = periodApy * amount;
|
|
16
|
-
return {
|
|
17
|
-
apy: periodApy * 100,
|
|
18
|
-
rewardInToken: reward
|
|
19
|
-
};
|
|
20
|
-
} else {
|
|
21
|
-
const reward = apr / 100 * amount;
|
|
22
|
-
return {
|
|
23
|
-
apy: apr,
|
|
24
|
-
rewardInToken: reward * (compoundingPeriod / YieldCompoundingPeriod.YEARLY)
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @returns
|
|
31
|
-
* <p>
|
|
32
|
-
* [0] - identity
|
|
33
|
-
* </p>
|
|
34
|
-
* <p>
|
|
35
|
-
* [1] - isReasonable (isVerified)
|
|
36
|
-
* </p>
|
|
37
|
-
* */
|
|
38
|
-
export async function parseIdentity(substrateApi, address, children) {
|
|
39
|
-
const compactResult = rs => {
|
|
40
|
-
const result = [];
|
|
41
|
-
if (rs) {
|
|
42
|
-
result.push(rs);
|
|
43
|
-
}
|
|
44
|
-
if (children) {
|
|
45
|
-
result.push(children);
|
|
46
|
-
}
|
|
47
|
-
if (result.length > 0) {
|
|
48
|
-
return result.join('/');
|
|
49
|
-
} else {
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
if (substrateApi.api.query.identity) {
|
|
54
|
-
let identity;
|
|
55
|
-
const _parent = await substrateApi.api.query.identity.superOf(address);
|
|
56
|
-
const parentInfo = _parent.toHuman();
|
|
57
|
-
if (parentInfo) {
|
|
58
|
-
const [parentAddress, {
|
|
59
|
-
Raw: data
|
|
60
|
-
}] = parentInfo;
|
|
61
|
-
const child = isHex(data) ? hexToString(data) : data;
|
|
62
|
-
|
|
63
|
-
// TODO: Re-check
|
|
64
|
-
if (address !== parentAddress) {
|
|
65
|
-
const [rs, isReasonable] = await parseIdentity(substrateApi, parentAddress, child);
|
|
66
|
-
return [compactResult(rs), isReasonable];
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const _identity = await substrateApi.api.query.identity.identityOf(address);
|
|
70
|
-
const identityInfo = _identity.toHuman();
|
|
71
|
-
if (identityInfo) {
|
|
72
|
-
var _identityInfo$info, _identityInfo$info$di, _identityInfo$info2, _identityInfo$info2$w, _identityInfo$info3, _identityInfo$info3$r, _identityInfo$info4, _identityInfo$info4$t;
|
|
73
|
-
const displayName = (_identityInfo$info = identityInfo.info) === null || _identityInfo$info === void 0 ? void 0 : (_identityInfo$info$di = _identityInfo$info.display) === null || _identityInfo$info$di === void 0 ? void 0 : _identityInfo$info$di.Raw;
|
|
74
|
-
const web = (_identityInfo$info2 = identityInfo.info) === null || _identityInfo$info2 === void 0 ? void 0 : (_identityInfo$info2$w = _identityInfo$info2.web) === null || _identityInfo$info2$w === void 0 ? void 0 : _identityInfo$info2$w.Raw;
|
|
75
|
-
const riot = (_identityInfo$info3 = identityInfo.info) === null || _identityInfo$info3 === void 0 ? void 0 : (_identityInfo$info3$r = _identityInfo$info3.riot) === null || _identityInfo$info3$r === void 0 ? void 0 : _identityInfo$info3$r.Raw;
|
|
76
|
-
const twitter = (_identityInfo$info4 = identityInfo.info) === null || _identityInfo$info4 === void 0 ? void 0 : (_identityInfo$info4$t = _identityInfo$info4.twitter) === null || _identityInfo$info4$t === void 0 ? void 0 : _identityInfo$info4$t.Raw;
|
|
77
|
-
const isReasonable = identityInfo.judgements.length > 0;
|
|
78
|
-
if (displayName) {
|
|
79
|
-
identity = isHex(displayName) ? hexToString(displayName) : displayName;
|
|
80
|
-
} else {
|
|
81
|
-
identity = twitter || web || riot;
|
|
82
|
-
}
|
|
83
|
-
return [compactResult(identity), isReasonable];
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return [undefined, false];
|
|
87
|
-
}
|
|
88
|
-
export function isActionFromValidator(stakingType, chain) {
|
|
89
|
-
if (stakingType === YieldPoolType.NOMINATION_POOL || stakingType === YieldPoolType.LIQUID_STAKING || stakingType === YieldPoolType.LENDING) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
if (_STAKING_CHAIN_GROUP.astar.includes(chain)) {
|
|
93
|
-
return true;
|
|
94
|
-
} else if (_STAKING_CHAIN_GROUP.amplitude.includes(chain)) {
|
|
95
|
-
return true;
|
|
96
|
-
} else if (_STAKING_CHAIN_GROUP.para.includes(chain)) {
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
export const isNominationPool = pool => {
|
|
102
|
-
return pool.type === YieldPoolType.NOMINATION_POOL;
|
|
103
|
-
};
|
|
104
|
-
export const isNativeStakingPool = pool => {
|
|
105
|
-
return pool.type === YieldPoolType.NATIVE_STAKING;
|
|
106
|
-
};
|
|
107
|
-
export const isLiquidPool = pool => {
|
|
108
|
-
return pool.type === YieldPoolType.LIQUID_STAKING;
|
|
109
|
-
};
|
|
110
|
-
export const isLendingPool = pool => {
|
|
111
|
-
return pool.type === YieldPoolType.LENDING;
|
|
112
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';
|
|
5
|
-
export default class DeleteEarningData extends BaseMigrationJob {
|
|
6
|
-
async run() {
|
|
7
|
-
try {
|
|
8
|
-
await this.state.dbService.deleteYieldPoolInfo(['LcDOT___acala_euphrates_liquid_staking', 'xcDOT___moonwell_lending']);
|
|
9
|
-
} catch (e) {
|
|
10
|
-
console.error(e);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';
|
|
5
|
-
export default class EnableEarningChains extends BaseMigrationJob {
|
|
6
|
-
async run() {
|
|
7
|
-
try {
|
|
8
|
-
await this.state.chainService.enableChains(['moonbeam', 'acala', 'bifrost_dot', 'interlay', 'parallel']);
|
|
9
|
-
} catch (e) {
|
|
10
|
-
console.error(e);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';
|
|
5
|
-
export default class MigrateEarningHistory extends BaseMigrationJob {
|
|
6
|
-
async run() {
|
|
7
|
-
try {
|
|
8
|
-
await this.state.dbService.removeOldEarningData();
|
|
9
|
-
} catch (e) {
|
|
10
|
-
console.error(e);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';
|
|
5
|
-
export default class MigrateEarningVersion extends BaseMigrationJob {
|
|
6
|
-
async run() {
|
|
7
|
-
try {
|
|
8
|
-
await this.state.dbService.removeOldEarningData();
|
|
9
|
-
} catch (e) {
|
|
10
|
-
console.error(e);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
|
|
2
|
-
import { UnlockDotSubmitMintData, UnlockDotTransactionNft } from '@subwallet/extension-base/types';
|
|
3
|
-
export default class UnlockDotCampaign {
|
|
4
|
-
#private;
|
|
5
|
-
constructor(state: KoniState);
|
|
6
|
-
mintNft({ address, extrinsicHash, network, slug, transactionId }: UnlockDotSubmitMintData): Promise<void>;
|
|
7
|
-
private checkMint;
|
|
8
|
-
private submitNft;
|
|
9
|
-
private getMinted;
|
|
10
|
-
canMint(address: string, slug: string, network: string): Promise<boolean>;
|
|
11
|
-
subscribeMintedNft(transactionId: string, cb: (data: UnlockDotTransactionNft) => void): import("rxjs").Subscription;
|
|
12
|
-
getMintedNft(transactionId: string): UnlockDotTransactionNft;
|
|
13
|
-
}
|