@subwallet/extension-base 1.1.32-0 → 1.1.32-beta.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 +112 -69
- package/background/KoniTypes.js +19 -13
- package/background/errors/TransactionError.js +9 -0
- package/cjs/background/KoniTypes.js +20 -16
- package/cjs/background/errors/TransactionError.js +9 -0
- package/cjs/constants/index.js +19 -4
- package/cjs/koni/api/dotsama/balance.js +464 -0
- package/cjs/koni/api/nft/config.js +33 -23
- package/cjs/koni/api/nft/index.js +14 -0
- package/cjs/koni/api/nft/nft.js +1 -22
- package/cjs/koni/api/nft/ordinal_nft/constants.js +21 -0
- package/cjs/koni/api/nft/ordinal_nft/index.js +121 -0
- package/cjs/koni/api/nft/ordinal_nft/utils.js +41 -0
- package/cjs/koni/api/staking/bonding/amplitude.js +17 -15
- package/cjs/koni/api/staking/bonding/astar.js +11 -10
- package/cjs/koni/api/staking/bonding/index.js +4 -1
- package/cjs/koni/api/staking/bonding/paraChain.js +25 -23
- package/cjs/koni/api/staking/bonding/relayChain.js +48 -45
- package/cjs/koni/api/staking/bonding/utils.js +104 -86
- package/cjs/koni/api/staking/index.js +6 -5
- package/cjs/koni/api/staking/paraChain.js +6 -5
- package/cjs/koni/api/staking/relayChain.js +3 -2
- package/cjs/koni/api/yield/helper/utils.js +46 -0
- package/cjs/koni/background/cron.js +3 -21
- package/cjs/koni/background/handlers/Extension.js +368 -69
- package/cjs/koni/background/handlers/State.js +18 -12
- package/cjs/koni/background/handlers/index.js +4 -2
- package/cjs/koni/background/subscription.js +7 -104
- package/cjs/services/campaign-service/index.js +28 -6
- package/cjs/services/chain-service/constants.js +1 -15
- package/cjs/services/chain-service/index.js +3 -2
- package/cjs/services/chain-service/utils.js +7 -1
- package/cjs/services/earning-service/constants/chains.js +29 -0
- package/cjs/services/earning-service/constants/index.js +27 -0
- package/cjs/services/earning-service/constants/step.js +18 -0
- package/cjs/services/earning-service/handlers/base.js +262 -0
- package/cjs/services/earning-service/handlers/index.js +60 -0
- package/cjs/services/earning-service/handlers/lending/base.js +81 -0
- package/cjs/services/earning-service/handlers/lending/index.js +13 -0
- package/cjs/services/earning-service/handlers/lending/interlay.js +192 -0
- package/cjs/services/earning-service/handlers/liquid-staking/acala.js +240 -0
- package/cjs/services/earning-service/handlers/liquid-staking/base.js +97 -0
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +298 -0
- package/cjs/services/earning-service/handlers/liquid-staking/index.js +34 -0
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +227 -0
- package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +404 -0
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +389 -0
- package/cjs/services/earning-service/handlers/native-staking/astar.js +466 -0
- package/cjs/services/earning-service/handlers/native-staking/base-para.js +146 -0
- package/cjs/services/earning-service/handlers/native-staking/base.js +161 -0
- package/cjs/services/earning-service/handlers/native-staking/index.js +34 -0
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +390 -0
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +567 -0
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +566 -0
- package/cjs/services/earning-service/handlers/special.js +493 -0
- package/cjs/services/earning-service/service.js +720 -0
- package/cjs/services/earning-service/utils/index.js +128 -0
- package/cjs/services/event-service/index.js +5 -0
- package/cjs/services/keyring-service/index.js +14 -2
- package/cjs/services/migration-service/scripts/DeleteEarningData.js +21 -0
- package/cjs/services/migration-service/scripts/EnableEarningChains.js +21 -0
- package/cjs/services/migration-service/scripts/MigrateEthProvider.js +17 -0
- package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
- package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +17 -0
- package/cjs/services/migration-service/scripts/MigrateProvider.js +29 -0
- package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
- package/cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js +21 -0
- package/cjs/services/migration-service/scripts/databases/MigrateEarningVersion.js +21 -0
- package/cjs/services/migration-service/scripts/index.js +6 -1
- package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +149 -0
- package/cjs/services/mint-campaign-service/campaigns/index.js +13 -0
- package/cjs/services/mint-campaign-service/constants.js +11 -0
- package/cjs/services/mint-campaign-service/index.js +18 -0
- package/cjs/services/notification-service/NotificationService.js +1 -1
- package/cjs/services/storage-service/DatabaseService.js +66 -0
- package/cjs/services/storage-service/databases/index.js +4 -0
- package/cjs/services/storage-service/db-stores/Campaign.js +9 -3
- package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
- package/cjs/services/storage-service/db-stores/YieldPoolStore.js +36 -0
- package/cjs/services/storage-service/db-stores/YieldPositionStore.js +71 -0
- package/cjs/services/storage-service/index.js +241 -0
- package/cjs/services/subscan-service/index.js +16 -0
- package/cjs/services/transaction-service/event-parser/index.js +58 -0
- package/cjs/services/transaction-service/helpers/index.js +3 -1
- package/cjs/services/transaction-service/index.js +245 -75
- package/cjs/services/transaction-service/utils.js +1 -0
- package/cjs/types/campaigns/index.js +16 -0
- package/cjs/types/campaigns/unlock-dot.js +1 -0
- package/cjs/types/index.js +44 -0
- package/cjs/types/ordinal.js +1 -0
- package/cjs/types/transaction.js +1 -0
- package/cjs/types/yield/actions/index.js +27 -0
- package/cjs/types/yield/actions/join/index.js +38 -0
- package/cjs/types/yield/actions/join/step.js +47 -0
- package/cjs/types/yield/actions/join/submit.js +1 -0
- package/cjs/types/yield/actions/join/validate.js +16 -0
- package/cjs/types/yield/actions/others.js +1 -0
- package/cjs/types/yield/index.js +27 -0
- package/cjs/types/yield/info/account/index.js +49 -0
- package/cjs/types/yield/info/account/info.js +1 -0
- package/cjs/types/yield/info/account/reward.js +1 -0
- package/cjs/types/yield/info/account/target.js +32 -0
- package/cjs/types/yield/info/account/unstake.js +27 -0
- package/cjs/types/yield/info/base.js +41 -0
- package/cjs/types/yield/info/chain/index.js +27 -0
- package/cjs/types/yield/info/chain/info.js +1 -0
- package/cjs/types/yield/info/chain/target.js +1 -0
- package/cjs/types/yield/info/index.js +49 -0
- package/cjs/types/yield/info/pallet.js +15 -0
- package/cjs/types.js +1 -0
- package/cjs/utils/address.js +34 -0
- package/cjs/utils/fetchStaticData.js +2 -1
- package/cjs/utils/index.js +89 -1
- package/cjs/utils/keyring.js +57 -0
- package/cjs/utils/number.js +6 -2
- package/cjs/utils/object.js +12 -0
- package/constants/index.d.ts +6 -1
- package/constants/index.js +6 -1
- package/koni/api/nft/config.js +33 -23
- package/koni/api/nft/index.js +15 -1
- package/koni/api/nft/nft.js +2 -23
- package/koni/api/nft/ordinal_nft/constants.d.ts +9 -0
- package/koni/api/nft/ordinal_nft/constants.js +12 -0
- package/koni/api/nft/ordinal_nft/index.d.ts +8 -0
- package/koni/api/nft/ordinal_nft/index.js +114 -0
- package/koni/api/nft/ordinal_nft/utils.d.ts +2 -0
- package/koni/api/nft/ordinal_nft/utils.js +33 -0
- package/koni/api/staking/bonding/amplitude.js +11 -9
- package/koni/api/staking/bonding/astar.js +9 -8
- package/koni/api/staking/bonding/index.d.ts +1 -1
- package/koni/api/staking/bonding/index.js +5 -1
- package/koni/api/staking/bonding/paraChain.js +12 -10
- package/koni/api/staking/bonding/relayChain.d.ts +2 -2
- package/koni/api/staking/bonding/relayChain.js +33 -30
- package/koni/api/staking/bonding/utils.d.ts +15 -38
- package/koni/api/staking/bonding/utils.js +85 -69
- package/koni/api/staking/index.js +2 -1
- package/koni/api/staking/paraChain.js +7 -6
- package/koni/api/staking/relayChain.js +4 -3
- package/koni/api/yield/helper/utils.d.ts +10 -0
- package/koni/api/yield/helper/utils.js +32 -0
- package/koni/background/cron.d.ts +0 -4
- package/koni/background/cron.js +4 -22
- package/koni/background/handlers/Extension.d.ts +17 -1
- package/koni/background/handlers/Extension.js +327 -30
- package/koni/background/handlers/State.d.ts +6 -1
- package/koni/background/handlers/State.js +17 -12
- package/koni/background/handlers/index.js +4 -2
- package/koni/background/subscription.d.ts +1 -6
- package/koni/background/subscription.js +8 -104
- package/package.json +316 -3
- package/services/campaign-service/index.js +28 -6
- package/services/chain-service/constants.d.ts +0 -11
- package/services/chain-service/constants.js +0 -13
- package/services/chain-service/index.js +3 -2
- package/services/chain-service/utils.d.ts +1 -0
- package/services/chain-service/utils.js +5 -1
- package/services/earning-service/constants/abis/compound_finance_v2_abi.json +1235 -0
- package/services/earning-service/constants/abis/st_liquid_token_abi.json +1355 -0
- package/services/earning-service/constants/chains.d.ts +14 -0
- package/services/earning-service/constants/chains.js +21 -0
- package/services/earning-service/constants/index.d.ts +2 -0
- package/services/earning-service/constants/index.js +5 -0
- package/services/earning-service/constants/step.d.ts +3 -0
- package/services/earning-service/constants/step.js +10 -0
- package/services/earning-service/handlers/base.d.ts +113 -0
- package/services/earning-service/handlers/base.js +256 -0
- package/services/earning-service/handlers/index.d.ts +5 -0
- package/services/earning-service/handlers/index.js +8 -0
- package/services/earning-service/handlers/lending/base.d.ts +8 -0
- package/services/earning-service/handlers/lending/base.js +73 -0
- package/services/earning-service/handlers/lending/index.d.ts +1 -0
- package/services/earning-service/handlers/lending/index.js +4 -0
- package/services/earning-service/handlers/lending/interlay.d.ts +24 -0
- package/services/earning-service/handlers/lending/interlay.js +184 -0
- package/services/earning-service/handlers/liquid-staking/acala.d.ts +27 -0
- package/services/earning-service/handlers/liquid-staking/acala.js +232 -0
- package/services/earning-service/handlers/liquid-staking/base.d.ts +11 -0
- package/services/earning-service/handlers/liquid-staking/base.js +89 -0
- package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +46 -0
- package/services/earning-service/handlers/liquid-staking/bifrost.js +287 -0
- package/services/earning-service/handlers/liquid-staking/index.d.ts +4 -0
- package/services/earning-service/handlers/liquid-staking/index.js +7 -0
- package/services/earning-service/handlers/liquid-staking/parallel.d.ts +26 -0
- package/services/earning-service/handlers/liquid-staking/parallel.js +219 -0
- package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +34 -0
- package/services/earning-service/handlers/liquid-staking/stella-swap.js +394 -0
- package/services/earning-service/handlers/native-staking/amplitude.d.ts +22 -0
- package/services/earning-service/handlers/native-staking/amplitude.js +380 -0
- package/services/earning-service/handlers/native-staking/astar.d.ts +19 -0
- package/services/earning-service/handlers/native-staking/astar.js +456 -0
- package/services/earning-service/handlers/native-staking/base-para.d.ts +11 -0
- package/services/earning-service/handlers/native-staking/base-para.js +138 -0
- package/services/earning-service/handlers/native-staking/base.d.ts +21 -0
- package/services/earning-service/handlers/native-staking/base.js +152 -0
- package/services/earning-service/handlers/native-staking/index.d.ts +4 -0
- package/services/earning-service/handlers/native-staking/index.js +7 -0
- package/services/earning-service/handlers/native-staking/para-chain.d.ts +15 -0
- package/services/earning-service/handlers/native-staking/para-chain.js +382 -0
- package/services/earning-service/handlers/native-staking/relay-chain.d.ts +21 -0
- package/services/earning-service/handlers/native-staking/relay-chain.js +558 -0
- package/services/earning-service/handlers/nomination-pool/index.d.ts +36 -0
- package/services/earning-service/handlers/nomination-pool/index.js +556 -0
- package/services/earning-service/handlers/special.d.ts +64 -0
- package/services/earning-service/handlers/special.js +485 -0
- package/services/earning-service/service.d.ts +93 -0
- package/services/earning-service/service.js +709 -0
- package/services/earning-service/utils/index.d.ts +18 -0
- package/services/earning-service/utils/index.js +112 -0
- package/services/event-service/index.d.ts +2 -0
- package/services/event-service/index.js +5 -0
- package/services/event-service/types.d.ts +9 -0
- package/services/keyring-service/index.d.ts +2 -1
- package/services/keyring-service/index.js +14 -2
- package/services/migration-service/scripts/DeleteEarningData.d.ts +4 -0
- package/services/migration-service/scripts/DeleteEarningData.js +13 -0
- package/services/migration-service/scripts/EnableEarningChains.d.ts +4 -0
- package/services/migration-service/scripts/EnableEarningChains.js +13 -0
- package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
- package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
- package/services/migration-service/scripts/databases/MigrateEarningHistory.d.ts +4 -0
- package/services/migration-service/scripts/databases/MigrateEarningHistory.js +13 -0
- package/services/migration-service/scripts/databases/MigrateEarningVersion.d.ts +4 -0
- package/services/migration-service/scripts/databases/MigrateEarningVersion.js +13 -0
- package/services/migration-service/scripts/index.js +6 -1
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +13 -0
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +139 -0
- package/services/mint-campaign-service/campaigns/index.d.ts +1 -0
- package/services/mint-campaign-service/campaigns/index.js +4 -0
- package/services/mint-campaign-service/constants.d.ts +1 -0
- package/services/mint-campaign-service/constants.js +4 -0
- package/services/mint-campaign-service/index.d.ts +7 -0
- package/services/mint-campaign-service/index.js +11 -0
- package/services/notification-service/NotificationService.js +1 -1
- package/services/storage-service/DatabaseService.d.ts +23 -1
- package/services/storage-service/DatabaseService.js +66 -0
- package/services/storage-service/databases/index.d.ts +3 -1
- package/services/storage-service/databases/index.js +4 -0
- package/services/storage-service/db-stores/Campaign.js +9 -3
- package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
- package/services/storage-service/db-stores/YieldPoolStore.d.ts +10 -0
- package/services/storage-service/db-stores/YieldPoolStore.js +28 -0
- package/services/storage-service/db-stores/YieldPositionStore.d.ts +11 -0
- package/services/storage-service/db-stores/YieldPositionStore.js +63 -0
- package/services/subscan-service/index.d.ts +3 -2
- package/services/subscan-service/index.js +15 -0
- package/services/subscan-service/types.d.ts +20 -0
- package/services/transaction-service/event-parser/index.d.ts +3 -1
- package/services/transaction-service/event-parser/index.js +57 -1
- package/services/transaction-service/helpers/index.js +3 -1
- package/services/transaction-service/index.d.ts +4 -15
- package/services/transaction-service/index.js +243 -73
- package/services/transaction-service/types.d.ts +2 -0
- package/services/transaction-service/utils.js +1 -0
- package/types/campaigns/index.d.ts +1 -0
- package/types/campaigns/index.js +4 -0
- package/types/campaigns/unlock-dot.d.ts +71 -0
- package/types/campaigns/unlock-dot.js +1 -0
- package/types/index.d.ts +5 -0
- package/types/index.js +5 -1
- package/types/ordinal.d.ts +69 -0
- package/types/ordinal.js +1 -0
- package/types/transaction.d.ts +3 -0
- package/types/transaction.js +1 -0
- package/types/yield/actions/index.d.ts +2 -0
- package/types/yield/actions/index.js +5 -0
- package/types/yield/actions/join/index.d.ts +3 -0
- package/types/yield/actions/join/index.js +6 -0
- package/types/yield/actions/join/step.d.ts +95 -0
- package/types/yield/actions/join/step.js +46 -0
- package/types/yield/actions/join/submit.d.ts +58 -0
- package/types/yield/actions/join/submit.js +1 -0
- package/types/yield/actions/join/validate.d.ts +18 -0
- package/types/yield/actions/join/validate.js +10 -0
- package/types/yield/actions/others.d.ts +85 -0
- package/types/yield/actions/others.js +1 -0
- package/types/yield/index.d.ts +2 -0
- package/types/yield/index.js +5 -0
- package/types/yield/info/account/index.d.ts +4 -0
- package/types/yield/info/account/index.js +7 -0
- package/types/yield/info/account/info.d.ts +92 -0
- package/types/yield/info/account/info.js +1 -0
- package/types/yield/info/account/reward.d.ts +47 -0
- package/types/yield/info/account/reward.js +1 -0
- package/types/yield/info/account/target.d.ts +43 -0
- package/types/yield/info/account/target.js +27 -0
- package/types/yield/info/account/unstake.d.ts +31 -0
- package/types/yield/info/account/unstake.js +22 -0
- package/types/yield/info/base.d.ts +45 -0
- package/types/yield/info/base.js +36 -0
- package/types/yield/info/chain/index.d.ts +2 -0
- package/types/yield/info/chain/index.js +5 -0
- package/types/yield/info/chain/info.d.ts +251 -0
- package/types/yield/info/chain/info.js +1 -0
- package/types/yield/info/chain/target.d.ts +37 -0
- package/types/yield/info/chain/target.js +1 -0
- package/types/yield/info/index.d.ts +4 -0
- package/types/yield/info/index.js +7 -0
- package/types/yield/info/pallet.d.ts +143 -0
- package/types/yield/info/pallet.js +9 -0
- package/utils/fetchStaticData.js +2 -1
- package/utils/index.d.ts +5 -0
- package/utils/index.js +53 -1
- package/utils/number.d.ts +2 -1
- package/utils/number.js +2 -1
- package/utils/object.d.ts +1 -0
- package/utils/object.js +6 -0
|
@@ -8,6 +8,8 @@ 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';
|
|
11
13
|
import { reformatAddress } from '@subwallet/extension-base/utils';
|
|
12
14
|
import { exportDB } from 'dexie-export-import';
|
|
13
15
|
import { logger as createLogger } from '@polkadot/util';
|
|
@@ -34,6 +36,9 @@ export default class DatabaseService {
|
|
|
34
36
|
metadata: new MetadataStore(this._db.metadata),
|
|
35
37
|
chain: new ChainStore(this._db.chain),
|
|
36
38
|
asset: new AssetStore(this._db.asset),
|
|
39
|
+
// yield
|
|
40
|
+
yieldPoolInfo: new YieldPoolStore(this._db.yieldPoolInfo),
|
|
41
|
+
yieldPosition: new YieldPositionStore(this._db.yieldPosition),
|
|
37
42
|
// staking
|
|
38
43
|
chainStakingMetadata: new ChainStakingMetadataStore(this._db.chainStakingMetadata),
|
|
39
44
|
nominatorMetadata: new NominatorMetadataStore(this._db.nominatorMetadata),
|
|
@@ -272,8 +277,69 @@ export default class DatabaseService {
|
|
|
272
277
|
return this.stores.mantaPay.getFirstConfig(chain);
|
|
273
278
|
}
|
|
274
279
|
|
|
280
|
+
/* Earning */
|
|
281
|
+
|
|
282
|
+
async removeOldEarningData() {
|
|
283
|
+
await this.stores.yieldPoolInfo.clear();
|
|
284
|
+
await this.stores.yieldPosition.clear();
|
|
285
|
+
}
|
|
286
|
+
async updateYieldPoolStore(data) {
|
|
287
|
+
await this.stores.yieldPoolInfo.upsert(data);
|
|
288
|
+
}
|
|
289
|
+
async updateYieldPoolsStore(data) {
|
|
290
|
+
await this.stores.yieldPoolInfo.bulkUpsert(data);
|
|
291
|
+
}
|
|
292
|
+
async deleteYieldPoolInfo(slugs) {
|
|
293
|
+
await this.stores.yieldPoolInfo.bulkDelete(slugs);
|
|
294
|
+
}
|
|
295
|
+
async getYieldPools() {
|
|
296
|
+
return this.stores.yieldPoolInfo.getAll();
|
|
297
|
+
}
|
|
298
|
+
async getYieldPoolStakingInfo(chain, poolType) {
|
|
299
|
+
return this.stores.yieldPoolInfo.getByChainAndType(chain, poolType);
|
|
300
|
+
}
|
|
301
|
+
async getYieldPool(slug) {
|
|
302
|
+
return this.stores.yieldPoolInfo.getBySlug(slug);
|
|
303
|
+
}
|
|
304
|
+
async getYieldPositionByAddressAndSlug(address, slug) {
|
|
305
|
+
return this.stores.yieldPosition.getByAddressAndSlug(address, slug);
|
|
306
|
+
}
|
|
307
|
+
subscribeYieldPoolInfo(chains, callback) {
|
|
308
|
+
this.yieldInfoSubscription && this.yieldInfoSubscription.unsubscribe();
|
|
309
|
+
this.yieldInfoSubscription = this.stores.yieldPoolInfo.subscribeYieldPoolInfo(chains).subscribe({
|
|
310
|
+
next: data => callback && callback(data)
|
|
311
|
+
});
|
|
312
|
+
return this.yieldInfoSubscription;
|
|
313
|
+
}
|
|
314
|
+
removeYieldPositionByAddresses(addresses) {
|
|
315
|
+
return this.stores.yieldPosition.removeByAddresses(addresses);
|
|
316
|
+
}
|
|
317
|
+
removeYieldPositionByChains(chains) {
|
|
318
|
+
return this.stores.yieldPosition.removeByChains(chains);
|
|
319
|
+
}
|
|
320
|
+
async updateYieldPosition(data) {
|
|
321
|
+
await this.stores.yieldPosition.upsert(data);
|
|
322
|
+
}
|
|
323
|
+
async updateYieldPositions(data) {
|
|
324
|
+
await this.stores.yieldPosition.bulkUpsert(data);
|
|
325
|
+
}
|
|
326
|
+
async getYieldPositionByAddress(addresses) {
|
|
327
|
+
return this.stores.yieldPosition.getByAddress(addresses);
|
|
328
|
+
}
|
|
329
|
+
subscribeYieldPosition(addresses, callback) {
|
|
330
|
+
return this.stores.yieldPosition.subscribeYieldPositions(addresses).subscribe({
|
|
331
|
+
next: data => callback && callback(data)
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
async getYieldNominationPoolPosition(addresses, chains) {
|
|
335
|
+
return this.stores.yieldPosition.getByAddressAndChains(addresses, chains);
|
|
336
|
+
}
|
|
337
|
+
|
|
275
338
|
/* Campaign */
|
|
276
339
|
|
|
340
|
+
getAllCampaign() {
|
|
341
|
+
return this.stores.campaign.getAll();
|
|
342
|
+
}
|
|
277
343
|
subscribeProcessingCampaign() {
|
|
278
344
|
return this.stores.campaign.subscribeProcessingCampaign();
|
|
279
345
|
}
|
|
@@ -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 } from '@subwallet/extension-base/types';
|
|
3
|
+
import { BalanceItem, YieldPoolInfo, YieldPositionInfo } from '@subwallet/extension-base/types';
|
|
4
4
|
import Dexie, { Table } from 'dexie';
|
|
5
5
|
export interface DefaultChainDoc {
|
|
6
6
|
chain: string;
|
|
@@ -45,6 +45,8 @@ 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>;
|
|
48
50
|
mantaPay: Table<IMantaPayLedger, object>;
|
|
49
51
|
campaign: Table<ICampaign, object>;
|
|
50
52
|
private schemaVersion;
|
|
@@ -31,6 +31,10 @@ 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, {
|
|
34
38
|
campaign: 'slug'
|
|
35
39
|
});
|
|
36
40
|
}
|
|
@@ -6,7 +6,13 @@ import { liveQuery } from 'dexie';
|
|
|
6
6
|
const filterProcessing = campaign => {
|
|
7
7
|
const now = new Date().getTime();
|
|
8
8
|
const isExpired = now <= campaign.startTime || now >= campaign.endTime;
|
|
9
|
-
return !(campaign.isDone || isExpired);
|
|
9
|
+
return !(campaign.isArchive || campaign.isDone || isExpired);
|
|
10
|
+
};
|
|
11
|
+
const getId = campaign => {
|
|
12
|
+
return campaign.campaignId;
|
|
13
|
+
};
|
|
14
|
+
const sortById = (a, b) => {
|
|
15
|
+
return getId(a) - getId(b);
|
|
10
16
|
};
|
|
11
17
|
export default class CampaignStore extends BaseStore {
|
|
12
18
|
async getAll() {
|
|
@@ -16,10 +22,10 @@ export default class CampaignStore extends BaseStore {
|
|
|
16
22
|
return this.table.get(slug);
|
|
17
23
|
}
|
|
18
24
|
async getProcessingCampaign() {
|
|
19
|
-
return (await this.table.toArray()).filter(filterProcessing);
|
|
25
|
+
return (await this.table.toArray()).filter(filterProcessing).sort(sortById);
|
|
20
26
|
}
|
|
21
27
|
subscribeProcessingCampaign() {
|
|
22
|
-
return liveQuery(() => this.table.filter(filterProcessing).toArray());
|
|
28
|
+
return liveQuery(async () => (await this.table.filter(filterProcessing).toArray()).sort(sortById));
|
|
23
29
|
}
|
|
24
30
|
upsertCampaign(campaign) {
|
|
25
31
|
return this.table.put(campaign);
|
|
@@ -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';
|
|
5
4
|
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 !== EarningStatus.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 !== EarningStatus.NOT_STAKING).toArray();
|
|
19
19
|
}
|
|
20
20
|
async removeByAddress(address) {
|
|
21
21
|
return this.table.where('address').anyOfIgnoreCase(address).delete();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import BaseStore from '@subwallet/extension-base/services/storage-service/db-stores/BaseStore';
|
|
2
|
+
import { YieldPoolInfo, YieldPoolType } from '@subwallet/extension-base/types';
|
|
3
|
+
export default class YieldPoolStore extends BaseStore<YieldPoolInfo> {
|
|
4
|
+
getAll(): Promise<YieldPoolInfo[]>;
|
|
5
|
+
getByChains(chains: string[]): Promise<YieldPoolInfo[]>;
|
|
6
|
+
getByChainAndType(chain: string, poolType: YieldPoolType): Promise<YieldPoolInfo | undefined>;
|
|
7
|
+
bulkDelete(slugs: string[]): Promise<void>;
|
|
8
|
+
getBySlug(slug: string): Promise<YieldPoolInfo | undefined>;
|
|
9
|
+
subscribeYieldPoolInfo(chains: string[]): import("dexie").Observable<YieldPoolInfo[]>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import BaseStore from '@subwallet/extension-base/services/storage-service/db-stores/BaseStore';
|
|
5
|
+
import { liveQuery } from 'dexie';
|
|
6
|
+
export default class YieldPoolStore extends BaseStore {
|
|
7
|
+
async getAll() {
|
|
8
|
+
return this.table.toArray();
|
|
9
|
+
}
|
|
10
|
+
async getByChains(chains) {
|
|
11
|
+
if (chains.length === 0) {
|
|
12
|
+
return this.getAll();
|
|
13
|
+
}
|
|
14
|
+
return this.table.where('chain').anyOfIgnoreCase(chains).toArray();
|
|
15
|
+
}
|
|
16
|
+
async getByChainAndType(chain, poolType) {
|
|
17
|
+
return this.table.where('chain').equals(chain).and(item => item.type === poolType).first();
|
|
18
|
+
}
|
|
19
|
+
async bulkDelete(slugs) {
|
|
20
|
+
return this.table.bulkDelete(slugs);
|
|
21
|
+
}
|
|
22
|
+
async getBySlug(slug) {
|
|
23
|
+
return this.table.get(slug);
|
|
24
|
+
}
|
|
25
|
+
subscribeYieldPoolInfo(chains) {
|
|
26
|
+
return liveQuery(() => this.getByChains(chains));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import BaseStore from '@subwallet/extension-base/services/storage-service/db-stores/BaseStore';
|
|
2
|
+
import { YieldPositionInfo } from '@subwallet/extension-base/types';
|
|
3
|
+
export default class YieldPositionStore extends BaseStore<YieldPositionInfo> {
|
|
4
|
+
getAll(): Promise<YieldPositionInfo[]>;
|
|
5
|
+
getByAddress(addresses: string[]): Promise<YieldPositionInfo[]>;
|
|
6
|
+
removeByAddresses(addresses: string[]): import("dexie").PromiseExtended<number>;
|
|
7
|
+
removeByChains(chains: string[]): import("dexie").PromiseExtended<number>;
|
|
8
|
+
getByAddressAndChains(addresses: string[], chains: string[]): Promise<YieldPositionInfo[]>;
|
|
9
|
+
getByAddressAndSlug(address: string, slug: string): import("dexie").PromiseExtended<YieldPositionInfo | undefined>;
|
|
10
|
+
subscribeYieldPositions(addresses: string[]): import("dexie").Observable<YieldPositionInfo[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import BaseStore from '@subwallet/extension-base/services/storage-service/db-stores/BaseStore';
|
|
5
|
+
import { liveQuery } from 'dexie';
|
|
6
|
+
export default class YieldPositionStore extends BaseStore {
|
|
7
|
+
async getAll() {
|
|
8
|
+
return this.table
|
|
9
|
+
// .filter((item) => {
|
|
10
|
+
// let isValidLiquidStaking = false;
|
|
11
|
+
//
|
|
12
|
+
// if (item.type === YieldPoolType.LIQUID_STAKING) {
|
|
13
|
+
// const nominatorMetadata = item.metadata as NominatorMetadata;
|
|
14
|
+
//
|
|
15
|
+
// if (nominatorMetadata.unstakings.length > 0) {
|
|
16
|
+
// console.log('true', item);
|
|
17
|
+
// isValidLiquidStaking = true;
|
|
18
|
+
// }
|
|
19
|
+
// }
|
|
20
|
+
//
|
|
21
|
+
// return parseInt(item.balance[0].activeBalance) > 0 || isValidLiquidStaking;
|
|
22
|
+
// })
|
|
23
|
+
.toArray();
|
|
24
|
+
}
|
|
25
|
+
async getByAddress(addresses) {
|
|
26
|
+
if (addresses.length === 0) {
|
|
27
|
+
return this.getAll();
|
|
28
|
+
}
|
|
29
|
+
return this.table.where('address').anyOfIgnoreCase(addresses)
|
|
30
|
+
// .filter((item) => {
|
|
31
|
+
// let isValidLiquidStaking = false;
|
|
32
|
+
//
|
|
33
|
+
// if (item.type === YieldPoolType.LIQUID_STAKING) {
|
|
34
|
+
// const nominatorMetadata = item.metadata as NominatorMetadata;
|
|
35
|
+
//
|
|
36
|
+
// if (nominatorMetadata && nominatorMetadata?.unstakings?.length > 0) {
|
|
37
|
+
// isValidLiquidStaking = true;
|
|
38
|
+
// }
|
|
39
|
+
// }
|
|
40
|
+
//
|
|
41
|
+
// return parseInt(item.balance[0].activeBalance) > 0 || isValidLiquidStaking;
|
|
42
|
+
// })
|
|
43
|
+
.toArray();
|
|
44
|
+
}
|
|
45
|
+
removeByAddresses(addresses) {
|
|
46
|
+
return this.table.where('address').anyOf(addresses).delete();
|
|
47
|
+
}
|
|
48
|
+
removeByChains(chains) {
|
|
49
|
+
return this.table.where('chain').anyOf(chains).delete();
|
|
50
|
+
}
|
|
51
|
+
async getByAddressAndChains(addresses, chains) {
|
|
52
|
+
return this.table.where('address').anyOfIgnoreCase(addresses).filter(item => chains.includes(item.chain)).toArray();
|
|
53
|
+
}
|
|
54
|
+
getByAddressAndSlug(address, slug) {
|
|
55
|
+
return this.table.get({
|
|
56
|
+
address,
|
|
57
|
+
slug
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
subscribeYieldPositions(addresses) {
|
|
61
|
+
return liveQuery(() => this.getByAddress(addresses));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CrowdloanContributionsResponse, ExtrinsicItem, ExtrinsicsListResponse, IMultiChainBalance, RequestBlockRange, TransferItem, TransfersListResponse } from '@subwallet/extension-base/services/subscan-service/types';
|
|
1
|
+
import { CrowdloanContributionsResponse, ExtrinsicItem, ExtrinsicsListResponse, IMultiChainBalance, RequestBlockRange, RewardHistoryListResponse, SubscanRequest, 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
|
-
|
|
18
|
+
addRequest<T>(run: SubscanRequest<T>['run']): Promise<T>;
|
|
19
19
|
private process;
|
|
20
20
|
checkSupportedSubscanChain(chain: string): boolean;
|
|
21
21
|
setSubscanChainMap(subscanChainMap: Record<string, string>): void;
|
|
@@ -31,4 +31,5 @@ export declare class SubscanService {
|
|
|
31
31
|
page: number;
|
|
32
32
|
record: number;
|
|
33
33
|
}): Promise<Record<string, TransferItem[]>>;
|
|
34
|
+
getRewardHistoryList(chain: string, address: string, page?: number): Promise<RewardHistoryListResponse>;
|
|
34
35
|
}
|
|
@@ -237,4 +237,19 @@ export class SubscanService {
|
|
|
237
237
|
await _getTransferItems(0);
|
|
238
238
|
return resultMap;
|
|
239
239
|
}
|
|
240
|
+
getRewardHistoryList(chain, address, page = 0) {
|
|
241
|
+
return this.addRequest(async () => {
|
|
242
|
+
const rs = await this.postRequest(this.getApiUrl(chain, 'api/scan/account/reward_slash'), {
|
|
243
|
+
page,
|
|
244
|
+
category: 'Reward',
|
|
245
|
+
row: 10,
|
|
246
|
+
address
|
|
247
|
+
});
|
|
248
|
+
if (rs.status !== 200) {
|
|
249
|
+
throw new SWError('SubscanService.getRewardHistoryList', await rs.text());
|
|
250
|
+
}
|
|
251
|
+
const jsonData = await rs.json();
|
|
252
|
+
return jsonData.data;
|
|
253
|
+
});
|
|
254
|
+
}
|
|
240
255
|
}
|
|
@@ -175,3 +175,23 @@ export declare type RequestBlockRange = {
|
|
|
175
175
|
from: number | null;
|
|
176
176
|
to: number | null;
|
|
177
177
|
};
|
|
178
|
+
export interface RewardHistoryItem {
|
|
179
|
+
block_num: number;
|
|
180
|
+
extrinsic_idx: number;
|
|
181
|
+
stash: string;
|
|
182
|
+
account: string;
|
|
183
|
+
module_id: string;
|
|
184
|
+
event_id: string;
|
|
185
|
+
event_method: string;
|
|
186
|
+
params: string;
|
|
187
|
+
extrinsic_hash: string;
|
|
188
|
+
event_idx: number;
|
|
189
|
+
amount: string;
|
|
190
|
+
block_timestamp: number;
|
|
191
|
+
event_index: string;
|
|
192
|
+
extrinsic_index: string;
|
|
193
|
+
}
|
|
194
|
+
export interface RewardHistoryListResponse {
|
|
195
|
+
count: number;
|
|
196
|
+
list: null | RewardHistoryItem[];
|
|
197
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
|
-
import { TransactionHistoryItem } from '@subwallet/extension-base/background/KoniTypes';
|
|
2
|
+
import { ExtrinsicType, 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,7 +1,8 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
5
|
+
import { _getAssetDecimals, _getAssetSymbol, _getChainNativeTokenBasicInfo } from '@subwallet/extension-base/services/chain-service/utils';
|
|
5
6
|
export function parseXcmEventLogs(historyItem, eventLogs, chain, sendingTokenInfo, chainInfo) {
|
|
6
7
|
for (let index = 0; index < eventLogs.length; index++) {
|
|
7
8
|
const record = eventLogs[index];
|
|
@@ -65,4 +66,59 @@ export function parseTransferEventLogs(historyItem, eventLogs, chain, sendingTok
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
}
|
|
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
|
+
}
|
|
68
124
|
}
|
|
@@ -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 'Unstake';
|
|
34
34
|
case ExtrinsicType.STAKING_CLAIM_REWARD:
|
|
35
35
|
return 'Claim reward';
|
|
36
36
|
case ExtrinsicType.STAKING_WITHDRAW:
|
|
@@ -45,6 +45,8 @@ 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';
|
|
48
50
|
case ExtrinsicType.UNKNOWN:
|
|
49
51
|
default:
|
|
50
52
|
return 'unknown';
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
2
|
-
import
|
|
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';
|
|
2
|
+
import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
|
|
9
3
|
import { SWTransaction, SWTransactionInput, SWTransactionResponse, TransactionEmitter } from '@subwallet/extension-base/services/transaction-service/types';
|
|
10
4
|
import { BehaviorSubject } from 'rxjs';
|
|
11
5
|
import { TransactionConfig } from 'web3-core';
|
|
12
6
|
import { HexString } from '@polkadot/util/types';
|
|
13
7
|
export default class TransactionService {
|
|
14
|
-
private readonly
|
|
15
|
-
private readonly chainService;
|
|
16
|
-
private readonly databaseService;
|
|
17
|
-
private readonly eventService;
|
|
18
|
-
private readonly historyService;
|
|
19
|
-
private readonly notificationService;
|
|
20
|
-
private readonly requestService;
|
|
8
|
+
private readonly state;
|
|
21
9
|
private readonly transactionSubject;
|
|
22
10
|
private readonly watchTransactionSubscribes;
|
|
23
11
|
private get transactions();
|
|
24
|
-
constructor(
|
|
12
|
+
constructor(state: KoniState);
|
|
25
13
|
private get allTransactions();
|
|
26
14
|
private get processingTransactions();
|
|
27
15
|
getTransaction(id: string): SWTransaction;
|
|
@@ -47,5 +35,6 @@ export default class TransactionService {
|
|
|
47
35
|
private signAndSendEvmTransaction;
|
|
48
36
|
private signAndSendSubstrateTransaction;
|
|
49
37
|
private handleTransactionTimeout;
|
|
38
|
+
private handlePostEarningTransaction;
|
|
50
39
|
resetWallet(): void;
|
|
51
40
|
}
|