@subwallet/extension-base 1.1.33-beta.0 → 1.1.34-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 +16 -19
- 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 +17 -10
- package/cjs/koni/api/staking/relayChain.js +2 -3
- package/cjs/koni/background/cron.js +21 -3
- package/cjs/koni/background/handlers/Extension.js +69 -368
- package/cjs/koni/background/handlers/State.js +12 -18
- package/cjs/koni/background/handlers/index.js +2 -4
- package/cjs/koni/background/subscription.js +104 -7
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +1 -3
- package/cjs/services/campaign-service/index.js +6 -9
- package/cjs/services/chain-service/constants.js +19 -2
- package/cjs/services/chain-service/handler/SubstrateApi.js +10 -5
- package/cjs/services/chain-service/index.js +101 -40
- package/cjs/services/chain-service/utils.js +69 -7
- package/cjs/services/event-service/index.js +0 -5
- 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 -6
- package/cjs/services/notification-service/NotificationService.js +1 -1
- package/cjs/services/storage-service/DatabaseService.js +0 -63
- 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 -249
- 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 +2 -6
- 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 +10 -13
- 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 +18 -11
- package/koni/api/staking/relayChain.js +3 -4
- package/koni/background/cron.d.ts +4 -0
- package/koni/background/cron.js +22 -4
- package/koni/background/handlers/Extension.d.ts +1 -17
- package/koni/background/handlers/Extension.js +30 -327
- package/koni/background/handlers/State.d.ts +1 -6
- package/koni/background/handlers/State.js +12 -17
- package/koni/background/handlers/index.js +2 -4
- package/koni/background/subscription.d.ts +6 -1
- package/koni/background/subscription.js +104 -8
- package/package.json +7 -320
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/substrate/index.js +2 -4
- package/services/campaign-service/index.js +6 -9
- package/services/chain-service/constants.d.ts +13 -0
- package/services/chain-service/constants.js +15 -0
- package/services/chain-service/handler/SubstrateApi.js +10 -5
- package/services/chain-service/index.d.ts +9 -1
- package/services/chain-service/index.js +97 -37
- package/services/chain-service/utils.d.ts +10 -2
- package/services/chain-service/utils.js +67 -6
- package/services/event-service/index.d.ts +0 -2
- package/services/event-service/index.js +0 -5
- package/services/event-service/types.d.ts +0 -9
- 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 -6
- package/services/notification-service/NotificationService.js +1 -1
- package/services/storage-service/DatabaseService.d.ts +1 -22
- package/services/storage-service/DatabaseService.js +0 -63
- 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 +13 -6
- package/services/transaction-service/index.js +73 -247
- 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 +0 -52
- package/utils/number.d.ts +1 -2
- package/utils/number.js +1 -2
- 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 -30
- 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 -262
- package/cjs/services/earning-service/handlers/index.js +0 -60
- package/cjs/services/earning-service/handlers/lending/base.js +0 -81
- package/cjs/services/earning-service/handlers/lending/index.js +0 -13
- package/cjs/services/earning-service/handlers/lending/interlay.js +0 -192
- package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -240
- package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -97
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -298
- package/cjs/services/earning-service/handlers/liquid-staking/index.js +0 -34
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -227
- package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -404
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +0 -434
- package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -466
- package/cjs/services/earning-service/handlers/native-staking/base-para.js +0 -146
- package/cjs/services/earning-service/handlers/native-staking/base.js +0 -161
- package/cjs/services/earning-service/handlers/native-staking/index.js +0 -34
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -390
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +0 -567
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +0 -566
- package/cjs/services/earning-service/handlers/special.js +0 -493
- package/cjs/services/earning-service/service.js +0 -740
- 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 -71
- 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 -15
- package/services/earning-service/constants/chains.js +0 -22
- 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 -113
- package/services/earning-service/handlers/base.js +0 -256
- 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 -8
- package/services/earning-service/handlers/lending/base.js +0 -73
- 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 -184
- package/services/earning-service/handlers/liquid-staking/acala.d.ts +0 -27
- package/services/earning-service/handlers/liquid-staking/acala.js +0 -232
- package/services/earning-service/handlers/liquid-staking/base.d.ts +0 -11
- package/services/earning-service/handlers/liquid-staking/base.js +0 -89
- package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +0 -46
- package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -287
- 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 -219
- package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +0 -34
- package/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -394
- package/services/earning-service/handlers/native-staking/amplitude.d.ts +0 -22
- package/services/earning-service/handlers/native-staking/amplitude.js +0 -425
- package/services/earning-service/handlers/native-staking/astar.d.ts +0 -19
- package/services/earning-service/handlers/native-staking/astar.js +0 -456
- 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 -152
- 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 -382
- package/services/earning-service/handlers/native-staking/relay-chain.d.ts +0 -21
- package/services/earning-service/handlers/native-staking/relay-chain.js +0 -558
- package/services/earning-service/handlers/nomination-pool/index.d.ts +0 -36
- package/services/earning-service/handlers/nomination-pool/index.js +0 -556
- package/services/earning-service/handlers/special.d.ts +0 -64
- package/services/earning-service/handlers/special.js +0 -485
- package/services/earning-service/service.d.ts +0 -94
- package/services/earning-service/service.js +0 -729
- 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 -11
- package/services/storage-service/db-stores/YieldPositionStore.js +0 -63
- 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 -58
- 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 -47
- 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 -252
- 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
|
@@ -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,64 +272,6 @@ export default class DatabaseService {
|
|
|
277
272
|
return this.stores.mantaPay.getFirstConfig(chain);
|
|
278
273
|
}
|
|
279
274
|
|
|
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
|
-
|
|
338
275
|
/* Campaign */
|
|
339
276
|
|
|
340
277
|
getAllCampaign() {
|
|
@@ -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;
|
|
@@ -31,5 +31,4 @@ 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>;
|
|
35
34
|
}
|
|
@@ -237,19 +237,4 @@ 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
|
-
}
|
|
255
240
|
}
|
|
@@ -175,23 +175,3 @@ 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,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,19 +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
|
|
9
|
-
private readonly
|
|
14
|
+
private readonly balanceService;
|
|
15
|
+
private readonly chainService;
|
|
16
|
+
private readonly databaseService;
|
|
10
17
|
private readonly eventService;
|
|
11
18
|
private readonly historyService;
|
|
12
19
|
private readonly notificationService;
|
|
13
|
-
private readonly
|
|
20
|
+
private readonly requestService;
|
|
21
|
+
private readonly transactionSubject;
|
|
14
22
|
private readonly watchTransactionSubscribes;
|
|
15
23
|
private get transactions();
|
|
16
|
-
constructor(
|
|
24
|
+
constructor(chainService: ChainService, eventService: EventService, requestService: RequestService, balanceService: BalanceService, historyService: HistoryService, notificationService: NotificationService, databaseService: DatabaseService);
|
|
17
25
|
private get allTransactions();
|
|
18
26
|
private get processingTransactions();
|
|
19
27
|
getTransaction(id: string): SWTransaction;
|
|
@@ -40,6 +48,5 @@ export default class TransactionService {
|
|
|
40
48
|
private signAndSendEvmTransaction;
|
|
41
49
|
private signAndSendSubstrateTransaction;
|
|
42
50
|
private handleTransactionTimeout;
|
|
43
|
-
private handlePostEarningTransaction;
|
|
44
51
|
resetWallet(): void;
|
|
45
52
|
}
|