@subwallet/extension-base 1.1.28-beta.1 → 1.1.30-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/background/KoniTypes.d.ts +70 -93
- package/background/KoniTypes.js +14 -16
- package/background/errors/TransactionError.js +4 -9
- package/cjs/background/KoniTypes.js +17 -17
- package/cjs/background/errors/TransactionError.js +4 -9
- package/cjs/constants/index.js +3 -9
- package/cjs/koni/api/nft/config.js +23 -33
- package/cjs/koni/api/nft/index.js +0 -14
- package/cjs/koni/api/nft/nft.js +22 -1
- package/cjs/koni/api/staking/bonding/amplitude.js +15 -17
- package/cjs/koni/api/staking/bonding/astar.js +10 -11
- package/cjs/koni/api/staking/bonding/index.js +1 -4
- package/cjs/koni/api/staking/bonding/paraChain.js +23 -25
- package/cjs/koni/api/staking/bonding/relayChain.js +45 -48
- package/cjs/koni/api/staking/bonding/utils.js +86 -104
- package/cjs/koni/api/staking/index.js +5 -6
- package/cjs/koni/api/staking/paraChain.js +5 -6
- package/cjs/koni/api/staking/relayChain.js +2 -3
- package/cjs/koni/background/cron.js +0 -2
- package/cjs/koni/background/handlers/Extension.js +88 -326
- package/cjs/koni/background/handlers/State.js +3 -51
- package/cjs/koni/background/handlers/index.js +2 -4
- package/cjs/koni/background/subscription.js +18 -88
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/campaign-service/index.js +6 -9
- package/cjs/services/chain-service/constants.js +16 -2
- package/cjs/services/chain-service/utils.js +1 -7
- package/cjs/services/event-service/index.js +0 -4
- package/cjs/services/keyring-service/index.js +2 -14
- package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
- package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
- package/cjs/services/migration-service/scripts/index.js +0 -4
- package/cjs/services/notification-service/NotificationService.js +1 -1
- package/cjs/services/storage-service/DatabaseService.js +0 -47
- package/cjs/services/storage-service/databases/index.js +0 -4
- package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
- package/cjs/services/transaction-service/event-parser/index.js +0 -58
- package/cjs/services/transaction-service/helpers/index.js +1 -3
- package/cjs/services/transaction-service/index.js +74 -180
- package/cjs/services/transaction-service/utils.js +0 -1
- package/cjs/types/index.js +0 -44
- package/cjs/utils/fetchStaticData.js +1 -2
- package/cjs/utils/index.js +1 -89
- package/constants/index.d.ts +0 -2
- package/constants/index.js +0 -2
- package/koni/api/nft/config.js +23 -33
- package/koni/api/nft/index.js +1 -15
- package/koni/api/nft/nft.js +23 -2
- package/koni/api/staking/bonding/amplitude.js +9 -11
- package/koni/api/staking/bonding/astar.js +8 -9
- package/koni/api/staking/bonding/index.d.ts +1 -1
- package/koni/api/staking/bonding/index.js +1 -5
- package/koni/api/staking/bonding/paraChain.js +10 -12
- package/koni/api/staking/bonding/relayChain.d.ts +2 -2
- package/koni/api/staking/bonding/relayChain.js +30 -33
- package/koni/api/staking/bonding/utils.d.ts +38 -15
- package/koni/api/staking/bonding/utils.js +69 -85
- package/koni/api/staking/index.js +1 -2
- package/koni/api/staking/paraChain.js +6 -7
- package/koni/api/staking/relayChain.js +3 -4
- package/koni/background/cron.js +0 -2
- package/koni/background/handlers/Extension.d.ts +1 -14
- package/koni/background/handlers/Extension.js +50 -286
- package/koni/background/handlers/State.d.ts +2 -18
- package/koni/background/handlers/State.js +3 -50
- package/koni/background/handlers/index.js +2 -4
- package/koni/background/subscription.d.ts +1 -5
- package/koni/background/subscription.js +20 -90
- package/package.json +8 -311
- package/packageInfo.js +1 -1
- package/services/campaign-service/index.js +6 -9
- package/services/chain-service/constants.d.ts +11 -0
- package/services/chain-service/constants.js +14 -1
- package/services/chain-service/utils.d.ts +0 -1
- package/services/chain-service/utils.js +1 -5
- package/services/event-service/index.d.ts +0 -1
- package/services/event-service/index.js +0 -4
- package/services/event-service/types.d.ts +0 -8
- package/services/keyring-service/index.d.ts +1 -2
- package/services/keyring-service/index.js +2 -14
- package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
- package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
- package/services/migration-service/scripts/index.js +0 -4
- package/services/notification-service/NotificationService.js +1 -1
- package/services/storage-service/DatabaseService.d.ts +1 -17
- package/services/storage-service/DatabaseService.js +0 -47
- package/services/storage-service/databases/index.d.ts +1 -3
- package/services/storage-service/databases/index.js +0 -4
- package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
- package/services/subscan-service/index.d.ts +2 -2
- package/services/transaction-service/event-parser/index.d.ts +1 -3
- package/services/transaction-service/event-parser/index.js +1 -57
- package/services/transaction-service/helpers/index.js +1 -3
- package/services/transaction-service/index.d.ts +15 -4
- package/services/transaction-service/index.js +72 -178
- package/services/transaction-service/types.d.ts +0 -2
- package/services/transaction-service/utils.js +0 -1
- package/types/index.d.ts +0 -5
- package/types/index.js +1 -5
- package/utils/fetchStaticData.js +1 -2
- package/utils/index.d.ts +0 -5
- package/utils/index.js +1 -53
- package/cjs/koni/api/dotsama/balance.js +0 -464
- package/cjs/koni/api/nft/ordinal_nft/constants.js +0 -21
- package/cjs/koni/api/nft/ordinal_nft/index.js +0 -121
- package/cjs/koni/api/nft/ordinal_nft/utils.js +0 -41
- package/cjs/koni/api/yield/helper/utils.js +0 -46
- package/cjs/services/earning-service/constants/chains.js +0 -29
- package/cjs/services/earning-service/constants/index.js +0 -27
- package/cjs/services/earning-service/constants/step.js +0 -18
- package/cjs/services/earning-service/handlers/base.js +0 -202
- package/cjs/services/earning-service/handlers/index.js +0 -60
- package/cjs/services/earning-service/handlers/lending/base.js +0 -20
- package/cjs/services/earning-service/handlers/lending/index.js +0 -13
- package/cjs/services/earning-service/handlers/lending/interlay.js +0 -168
- package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -196
- package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -39
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -257
- package/cjs/services/earning-service/handlers/liquid-staking/index.js +0 -34
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -180
- package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -373
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +0 -359
- package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -426
- package/cjs/services/earning-service/handlers/native-staking/base-para.js +0 -137
- package/cjs/services/earning-service/handlers/native-staking/base.js +0 -109
- package/cjs/services/earning-service/handlers/native-staking/index.js +0 -34
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -361
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +0 -512
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +0 -501
- package/cjs/services/earning-service/handlers/special.js +0 -387
- package/cjs/services/earning-service/service.js +0 -327
- package/cjs/services/earning-service/utils/index.js +0 -111
- package/cjs/services/migration-service/scripts/DeleteEarningData.js +0 -21
- package/cjs/services/migration-service/scripts/EnableEarningChains.js +0 -21
- package/cjs/services/migration-service/scripts/MigrateEthProvider.js +0 -17
- package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +0 -17
- package/cjs/services/migration-service/scripts/MigrateProvider.js +0 -29
- package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -149
- package/cjs/services/mint-campaign-service/campaigns/index.js +0 -13
- package/cjs/services/mint-campaign-service/constants.js +0 -11
- package/cjs/services/mint-campaign-service/index.js +0 -18
- package/cjs/services/storage-service/db-stores/YieldPoolStore.js +0 -36
- package/cjs/services/storage-service/db-stores/YieldPositionStore.js +0 -65
- package/cjs/services/storage-service/index.js +0 -241
- package/cjs/types/campaigns/index.js +0 -16
- package/cjs/types/campaigns/unlock-dot.js +0 -1
- package/cjs/types/ordinal.js +0 -1
- package/cjs/types/transaction.js +0 -1
- package/cjs/types/yield/actions/index.js +0 -27
- package/cjs/types/yield/actions/join/index.js +0 -38
- package/cjs/types/yield/actions/join/step.js +0 -37
- package/cjs/types/yield/actions/join/submit.js +0 -1
- package/cjs/types/yield/actions/join/validate.js +0 -16
- package/cjs/types/yield/actions/others.js +0 -1
- package/cjs/types/yield/index.js +0 -27
- package/cjs/types/yield/info/account/index.js +0 -49
- package/cjs/types/yield/info/account/info.js +0 -1
- package/cjs/types/yield/info/account/reward.js +0 -1
- package/cjs/types/yield/info/account/target.js +0 -32
- package/cjs/types/yield/info/account/unstake.js +0 -27
- package/cjs/types/yield/info/base.js +0 -34
- package/cjs/types/yield/info/chain/index.js +0 -27
- package/cjs/types/yield/info/chain/info.js +0 -1
- package/cjs/types/yield/info/chain/target.js +0 -1
- package/cjs/types/yield/info/index.js +0 -49
- package/cjs/types/yield/info/pallet.js +0 -15
- package/cjs/types.js +0 -1
- package/cjs/utils/address.js +0 -34
- package/cjs/utils/keyring.js +0 -57
- package/cjs/utils/object.js +0 -12
- package/koni/api/nft/ordinal_nft/constants.d.ts +0 -9
- package/koni/api/nft/ordinal_nft/constants.js +0 -12
- package/koni/api/nft/ordinal_nft/index.d.ts +0 -8
- package/koni/api/nft/ordinal_nft/index.js +0 -114
- package/koni/api/nft/ordinal_nft/utils.d.ts +0 -2
- package/koni/api/nft/ordinal_nft/utils.js +0 -33
- package/koni/api/yield/helper/utils.d.ts +0 -10
- package/koni/api/yield/helper/utils.js +0 -32
- package/services/earning-service/constants/abis/compound_finance_v2_abi.json +0 -1235
- package/services/earning-service/constants/abis/st_liquid_token_abi.json +0 -1355
- package/services/earning-service/constants/chains.d.ts +0 -14
- package/services/earning-service/constants/chains.js +0 -21
- package/services/earning-service/constants/index.d.ts +0 -2
- package/services/earning-service/constants/index.js +0 -5
- package/services/earning-service/constants/step.d.ts +0 -3
- package/services/earning-service/constants/step.js +0 -10
- package/services/earning-service/handlers/base.d.ts +0 -105
- package/services/earning-service/handlers/base.js +0 -195
- package/services/earning-service/handlers/index.d.ts +0 -5
- package/services/earning-service/handlers/index.js +0 -8
- package/services/earning-service/handlers/lending/base.d.ts +0 -6
- package/services/earning-service/handlers/lending/base.js +0 -12
- package/services/earning-service/handlers/lending/index.d.ts +0 -1
- package/services/earning-service/handlers/lending/index.js +0 -4
- package/services/earning-service/handlers/lending/interlay.d.ts +0 -22
- package/services/earning-service/handlers/lending/interlay.js +0 -160
- package/services/earning-service/handlers/liquid-staking/acala.d.ts +0 -27
- package/services/earning-service/handlers/liquid-staking/acala.js +0 -188
- package/services/earning-service/handlers/liquid-staking/base.d.ts +0 -8
- package/services/earning-service/handlers/liquid-staking/base.js +0 -31
- package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +0 -44
- package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -246
- package/services/earning-service/handlers/liquid-staking/index.d.ts +0 -4
- package/services/earning-service/handlers/liquid-staking/index.js +0 -7
- package/services/earning-service/handlers/liquid-staking/parallel.d.ts +0 -27
- package/services/earning-service/handlers/liquid-staking/parallel.js +0 -172
- package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +0 -36
- package/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -363
- package/services/earning-service/handlers/native-staking/amplitude.d.ts +0 -22
- package/services/earning-service/handlers/native-staking/amplitude.js +0 -350
- package/services/earning-service/handlers/native-staking/astar.d.ts +0 -18
- package/services/earning-service/handlers/native-staking/astar.js +0 -416
- package/services/earning-service/handlers/native-staking/base-para.d.ts +0 -11
- package/services/earning-service/handlers/native-staking/base-para.js +0 -129
- package/services/earning-service/handlers/native-staking/base.d.ts +0 -19
- package/services/earning-service/handlers/native-staking/base.js +0 -101
- package/services/earning-service/handlers/native-staking/index.d.ts +0 -4
- package/services/earning-service/handlers/native-staking/index.js +0 -7
- package/services/earning-service/handlers/native-staking/para-chain.d.ts +0 -15
- package/services/earning-service/handlers/native-staking/para-chain.js +0 -353
- package/services/earning-service/handlers/native-staking/relay-chain.d.ts +0 -21
- package/services/earning-service/handlers/native-staking/relay-chain.js +0 -503
- package/services/earning-service/handlers/nomination-pool/index.d.ts +0 -33
- package/services/earning-service/handlers/nomination-pool/index.js +0 -492
- package/services/earning-service/handlers/special.d.ts +0 -56
- package/services/earning-service/handlers/special.js +0 -379
- package/services/earning-service/service.d.ts +0 -36
- package/services/earning-service/service.js +0 -320
- package/services/earning-service/utils/index.d.ts +0 -14
- package/services/earning-service/utils/index.js +0 -100
- package/services/migration-service/scripts/DeleteEarningData.d.ts +0 -4
- package/services/migration-service/scripts/DeleteEarningData.js +0 -13
- package/services/migration-service/scripts/EnableEarningChains.d.ts +0 -4
- package/services/migration-service/scripts/EnableEarningChains.js +0 -13
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +0 -13
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -139
- package/services/mint-campaign-service/campaigns/index.d.ts +0 -1
- package/services/mint-campaign-service/campaigns/index.js +0 -4
- package/services/mint-campaign-service/constants.d.ts +0 -1
- package/services/mint-campaign-service/constants.js +0 -4
- package/services/mint-campaign-service/index.d.ts +0 -7
- package/services/mint-campaign-service/index.js +0 -11
- package/services/storage-service/db-stores/YieldPoolStore.d.ts +0 -10
- package/services/storage-service/db-stores/YieldPoolStore.js +0 -28
- package/services/storage-service/db-stores/YieldPositionStore.d.ts +0 -9
- package/services/storage-service/db-stores/YieldPositionStore.js +0 -57
- package/types/campaigns/index.d.ts +0 -1
- package/types/campaigns/index.js +0 -4
- package/types/campaigns/unlock-dot.d.ts +0 -71
- package/types/campaigns/unlock-dot.js +0 -1
- package/types/ordinal.d.ts +0 -69
- package/types/ordinal.js +0 -1
- package/types/transaction.d.ts +0 -3
- package/types/transaction.js +0 -1
- package/types/yield/actions/index.d.ts +0 -2
- package/types/yield/actions/index.js +0 -5
- package/types/yield/actions/join/index.d.ts +0 -3
- package/types/yield/actions/join/index.js +0 -6
- package/types/yield/actions/join/step.d.ts +0 -75
- package/types/yield/actions/join/step.js +0 -34
- package/types/yield/actions/join/submit.d.ts +0 -53
- package/types/yield/actions/join/submit.js +0 -1
- package/types/yield/actions/join/validate.d.ts +0 -18
- package/types/yield/actions/join/validate.js +0 -10
- package/types/yield/actions/others.d.ts +0 -60
- package/types/yield/actions/others.js +0 -1
- package/types/yield/index.d.ts +0 -2
- package/types/yield/index.js +0 -5
- package/types/yield/info/account/index.d.ts +0 -4
- package/types/yield/info/account/index.js +0 -7
- package/types/yield/info/account/info.d.ts +0 -112
- package/types/yield/info/account/info.js +0 -1
- package/types/yield/info/account/reward.d.ts +0 -41
- package/types/yield/info/account/reward.js +0 -1
- package/types/yield/info/account/target.d.ts +0 -43
- package/types/yield/info/account/target.js +0 -27
- package/types/yield/info/account/unstake.d.ts +0 -31
- package/types/yield/info/account/unstake.js +0 -22
- package/types/yield/info/base.d.ts +0 -28
- package/types/yield/info/base.js +0 -28
- package/types/yield/info/chain/index.d.ts +0 -2
- package/types/yield/info/chain/index.js +0 -5
- package/types/yield/info/chain/info.d.ts +0 -190
- package/types/yield/info/chain/info.js +0 -1
- package/types/yield/info/chain/target.d.ts +0 -33
- package/types/yield/info/chain/target.js +0 -1
- package/types/yield/info/index.d.ts +0 -4
- package/types/yield/info/index.js +0 -7
- package/types/yield/info/pallet.d.ts +0 -143
- package/types/yield/info/pallet.js +0 -9
- package/utils/object.d.ts +0 -1
- package/utils/object.js +0 -6
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.UnstakingStatus = void 0;
|
|
7
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
8
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
/**
|
|
10
|
-
* @enum {string}
|
|
11
|
-
* @description The status of un-staked request.
|
|
12
|
-
* */
|
|
13
|
-
let UnstakingStatus;
|
|
14
|
-
/**
|
|
15
|
-
* @interface UnstakingInfo
|
|
16
|
-
* @description Info of un-stake request
|
|
17
|
-
* @prop {string} chain - Slug of chain
|
|
18
|
-
* @prop {UnstakingStatus} status - Status of request
|
|
19
|
-
* @prop {string} claimable - Amount to be withdrawn
|
|
20
|
-
* @prop {number} [waitingTime] - Time remains to wait (in hours)
|
|
21
|
-
* @prop {string} [validatorAddress] - Address of validator
|
|
22
|
-
* */
|
|
23
|
-
exports.UnstakingStatus = UnstakingStatus;
|
|
24
|
-
(function (UnstakingStatus) {
|
|
25
|
-
UnstakingStatus["CLAIMABLE"] = "CLAIMABLE";
|
|
26
|
-
UnstakingStatus["UNLOCKING"] = "UNLOCKING";
|
|
27
|
-
})(UnstakingStatus || (exports.UnstakingStatus = UnstakingStatus = {}));
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.YieldPoolType = exports.YieldCompoundingPeriod = void 0;
|
|
7
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
8
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
/**
|
|
10
|
-
* @enum {string}
|
|
11
|
-
* @description The types of yield pool.
|
|
12
|
-
* */
|
|
13
|
-
let YieldPoolType;
|
|
14
|
-
/**
|
|
15
|
-
* @enum {number}
|
|
16
|
-
* @description Time to calculate profit
|
|
17
|
-
* */
|
|
18
|
-
exports.YieldPoolType = YieldPoolType;
|
|
19
|
-
(function (YieldPoolType) {
|
|
20
|
-
YieldPoolType["LIQUID_STAKING"] = "LIQUID_STAKING";
|
|
21
|
-
YieldPoolType["LENDING"] = "LENDING";
|
|
22
|
-
YieldPoolType["SINGLE_FARMING"] = "SINGLE_FARMING";
|
|
23
|
-
YieldPoolType["NOMINATION_POOL"] = "NOMINATION_POOL";
|
|
24
|
-
YieldPoolType["NATIVE_STAKING"] = "NATIVE_STAKING";
|
|
25
|
-
YieldPoolType["PARACHAIN_STAKING"] = "PARACHAIN_STAKING";
|
|
26
|
-
})(YieldPoolType || (exports.YieldPoolType = YieldPoolType = {}));
|
|
27
|
-
let YieldCompoundingPeriod;
|
|
28
|
-
exports.YieldCompoundingPeriod = YieldCompoundingPeriod;
|
|
29
|
-
(function (YieldCompoundingPeriod) {
|
|
30
|
-
YieldCompoundingPeriod[YieldCompoundingPeriod["DAILY"] = 1] = "DAILY";
|
|
31
|
-
YieldCompoundingPeriod[YieldCompoundingPeriod["WEEKLY"] = 7] = "WEEKLY";
|
|
32
|
-
YieldCompoundingPeriod[YieldCompoundingPeriod["MONTHLY"] = 30] = "MONTHLY";
|
|
33
|
-
YieldCompoundingPeriod[YieldCompoundingPeriod["YEARLY"] = 365] = "YEARLY";
|
|
34
|
-
})(YieldCompoundingPeriod || (exports.YieldCompoundingPeriod = YieldCompoundingPeriod = {}));
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _info = require("./info");
|
|
7
|
-
Object.keys(_info).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _info[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _info[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _target = require("./target");
|
|
18
|
-
Object.keys(_target).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _target[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _target[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _account = require("./account");
|
|
7
|
-
Object.keys(_account).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _account[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _account[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _base = require("./base");
|
|
18
|
-
Object.keys(_base).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _base[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _base[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _chain = require("./chain");
|
|
29
|
-
Object.keys(_chain).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _chain[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _chain[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _pallet = require("./pallet");
|
|
40
|
-
Object.keys(_pallet).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _pallet[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _pallet[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PalletParachainStakingRequestType = void 0;
|
|
7
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
8
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
let PalletParachainStakingRequestType;
|
|
10
|
-
exports.PalletParachainStakingRequestType = PalletParachainStakingRequestType;
|
|
11
|
-
(function (PalletParachainStakingRequestType) {
|
|
12
|
-
PalletParachainStakingRequestType["REVOKE"] = "revoke";
|
|
13
|
-
PalletParachainStakingRequestType["DECREASE"] = "decrease";
|
|
14
|
-
PalletParachainStakingRequestType["BOND_LESS"] = "bondLess";
|
|
15
|
-
})(PalletParachainStakingRequestType || (exports.PalletParachainStakingRequestType = PalletParachainStakingRequestType = {}));
|
package/cjs/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/cjs/utils/address.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.convertSubjectInfoToAddresses = void 0;
|
|
7
|
-
exports.quickFormatAddressToCompare = quickFormatAddressToCompare;
|
|
8
|
-
exports.simpleAddress = void 0;
|
|
9
|
-
var _index = require("@subwallet/extension-base/utils/index");
|
|
10
|
-
var _utilCrypto = require("@polkadot/util-crypto");
|
|
11
|
-
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
12
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
13
|
-
|
|
14
|
-
const simpleAddress = address => {
|
|
15
|
-
if ((0, _utilCrypto.isEthereumAddress)(address)) {
|
|
16
|
-
return address;
|
|
17
|
-
}
|
|
18
|
-
return (0, _utilCrypto.encodeAddress)((0, _utilCrypto.decodeAddress)(address));
|
|
19
|
-
};
|
|
20
|
-
exports.simpleAddress = simpleAddress;
|
|
21
|
-
function quickFormatAddressToCompare(address) {
|
|
22
|
-
if (!(0, _utilCrypto.isAddress)(address)) {
|
|
23
|
-
return address;
|
|
24
|
-
}
|
|
25
|
-
return (0, _index.reformatAddress)(address, 42).toLowerCase();
|
|
26
|
-
}
|
|
27
|
-
const convertSubjectInfoToAddresses = subjectInfo => {
|
|
28
|
-
return Object.values(subjectInfo).map(info => ({
|
|
29
|
-
address: info.json.address,
|
|
30
|
-
type: info.type,
|
|
31
|
-
...info.json.meta
|
|
32
|
-
}));
|
|
33
|
-
};
|
|
34
|
-
exports.convertSubjectInfoToAddresses = convertSubjectInfoToAddresses;
|
package/cjs/utils/keyring.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extractPrivateKey = extractPrivateKey;
|
|
7
|
-
exports.unlockAccount = exports.lockAccount = void 0;
|
|
8
|
-
var _uiKeyring = require("@subwallet/ui-keyring");
|
|
9
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
10
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
11
|
-
|
|
12
|
-
// import _decode from '@polkadot/keyring/pair/decode';
|
|
13
|
-
|
|
14
|
-
function extract(address) {
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
|
17
|
-
const rs = this.getPair(address);
|
|
18
|
-
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
20
|
-
console.log(rs.publicKey);
|
|
21
|
-
}
|
|
22
|
-
function extractPrivateKey(keyring, address, password) {
|
|
23
|
-
extract.call(keyring, address);
|
|
24
|
-
}
|
|
25
|
-
const unlockAccount = signAddress => {
|
|
26
|
-
let publicKey;
|
|
27
|
-
try {
|
|
28
|
-
publicKey = _uiKeyring.keyring.decodeAddress(signAddress);
|
|
29
|
-
} catch (error) {
|
|
30
|
-
console.error(error);
|
|
31
|
-
return 'Unable to decode address';
|
|
32
|
-
}
|
|
33
|
-
const pair = _uiKeyring.keyring.getPair(publicKey);
|
|
34
|
-
if (!pair) {
|
|
35
|
-
return 'Unable to find pair';
|
|
36
|
-
}
|
|
37
|
-
if (pair.isLocked) {
|
|
38
|
-
try {
|
|
39
|
-
_uiKeyring.keyring.unlockPair(pair.address);
|
|
40
|
-
} catch (e) {
|
|
41
|
-
return e.message;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
45
|
-
};
|
|
46
|
-
exports.unlockAccount = unlockAccount;
|
|
47
|
-
const lockAccount = address => {
|
|
48
|
-
try {
|
|
49
|
-
const pair = _uiKeyring.keyring.getPair(address);
|
|
50
|
-
if (pair) {
|
|
51
|
-
pair.lock();
|
|
52
|
-
}
|
|
53
|
-
} catch (error) {
|
|
54
|
-
console.error('Unable to lock account', error);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
exports.lockAccount = lockAccount;
|
package/cjs/utils/object.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isEmptyObject = isEmptyObject;
|
|
7
|
-
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
8
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
|
|
10
|
-
function isEmptyObject(input) {
|
|
11
|
-
return Object.keys(input).length === 0;
|
|
12
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const GET_EVENT_LIST_API = "https://{{chain}}.api.subscan.io/api/v2/scan/events";
|
|
2
|
-
export declare const GET_EXTRINSIC_PARAMS_API = "https://{{chain}}.api.subscan.io/api/scan/extrinsic/params";
|
|
3
|
-
export declare const BASE_FETCH_ORDINAL_EVENT_DATA: {
|
|
4
|
-
event_id: string;
|
|
5
|
-
module: string;
|
|
6
|
-
order: string;
|
|
7
|
-
success: boolean;
|
|
8
|
-
row: number;
|
|
9
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
export const GET_EVENT_LIST_API = 'https://{{chain}}.api.subscan.io/api/v2/scan/events';
|
|
5
|
-
export const GET_EXTRINSIC_PARAMS_API = 'https://{{chain}}.api.subscan.io/api/scan/extrinsic/params';
|
|
6
|
-
export const BASE_FETCH_ORDINAL_EVENT_DATA = {
|
|
7
|
-
event_id: 'Remarked',
|
|
8
|
-
module: 'system',
|
|
9
|
-
order: 'desc',
|
|
10
|
-
success: true,
|
|
11
|
-
row: 100
|
|
12
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BaseNftApi, HandleNftParams } from '@subwallet/extension-base/koni/api/nft/nft';
|
|
2
|
-
export default class OrdinalNftApi extends BaseNftApi {
|
|
3
|
-
subscanChain: string;
|
|
4
|
-
constructor(addresses: string[], chain: string, subscanChain: string);
|
|
5
|
-
handleNft(address: string, handleNftParams: HandleNftParams): Promise<void>;
|
|
6
|
-
handleNfts(params: HandleNftParams): Promise<void>;
|
|
7
|
-
fetchNfts(params: HandleNftParams): Promise<number>;
|
|
8
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { ORDINAL_COLLECTION } from '@subwallet/extension-base/constants';
|
|
5
|
-
import { BaseNftApi } from '@subwallet/extension-base/koni/api/nft/nft';
|
|
6
|
-
import { fetchExtrinsicParams, fetchRemarkEvent } from '@subwallet/extension-base/koni/api/nft/ordinal_nft/utils';
|
|
7
|
-
import { state } from '@subwallet/extension-base/koni/background/handlers';
|
|
8
|
-
const parseParamData = (param, event, chain, address) => {
|
|
9
|
-
const ordinalData = JSON.parse(param.value);
|
|
10
|
-
if ('p' in ordinalData) {
|
|
11
|
-
const properties = {};
|
|
12
|
-
for (const [key, value] of Object.entries(ordinalData)) {
|
|
13
|
-
const _name = key.charAt(0).toUpperCase() + key.slice(1);
|
|
14
|
-
properties[_name] = {
|
|
15
|
-
value: value
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
properties['Block number'] = {
|
|
19
|
-
value: event.extrinsic_index.split('-')[0]
|
|
20
|
-
};
|
|
21
|
-
properties.Timestamp = {
|
|
22
|
-
value: event.block_timestamp
|
|
23
|
-
};
|
|
24
|
-
const op = ordinalData.op.charAt(0).toUpperCase() + ordinalData.op.slice(1);
|
|
25
|
-
const nameParams = [op];
|
|
26
|
-
if (ordinalData.amt !== undefined) {
|
|
27
|
-
nameParams.push(ordinalData.amt);
|
|
28
|
-
}
|
|
29
|
-
nameParams.push(ordinalData.tick);
|
|
30
|
-
const name = nameParams.join(' ');
|
|
31
|
-
return {
|
|
32
|
-
chain: chain,
|
|
33
|
-
collectionId: ORDINAL_COLLECTION,
|
|
34
|
-
id: event.extrinsic_hash,
|
|
35
|
-
description: JSON.stringify(ordinalData),
|
|
36
|
-
name,
|
|
37
|
-
owner: address,
|
|
38
|
-
properties: properties
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
return undefined;
|
|
42
|
-
};
|
|
43
|
-
export default class OrdinalNftApi extends BaseNftApi {
|
|
44
|
-
constructor(addresses, chain, subscanChain) {
|
|
45
|
-
super(chain, undefined, addresses);
|
|
46
|
-
this.subscanChain = subscanChain;
|
|
47
|
-
}
|
|
48
|
-
async handleNft(address, handleNftParams) {
|
|
49
|
-
const events = await state.subscanService.addRequest(async () => {
|
|
50
|
-
return await fetchRemarkEvent(this.subscanChain, address);
|
|
51
|
-
});
|
|
52
|
-
if (events && events.length) {
|
|
53
|
-
const extrinsicIds = events.map(data => data.extrinsic_index);
|
|
54
|
-
const extrinsicParams = await state.subscanService.addRequest(async () => {
|
|
55
|
-
return await fetchExtrinsicParams(this.subscanChain, extrinsicIds);
|
|
56
|
-
});
|
|
57
|
-
const items = [];
|
|
58
|
-
for (const data of extrinsicParams) {
|
|
59
|
-
const {
|
|
60
|
-
extrinsic_index: extrinsicIndex,
|
|
61
|
-
params
|
|
62
|
-
} = data;
|
|
63
|
-
const event = events.find(item => item.extrinsic_index === extrinsicIndex);
|
|
64
|
-
if (params.length === 1 && event) {
|
|
65
|
-
const [param] = params;
|
|
66
|
-
if (param.name === 'remark') {
|
|
67
|
-
const childParam = {
|
|
68
|
-
name: param.name,
|
|
69
|
-
type: param.type,
|
|
70
|
-
value: param.value
|
|
71
|
-
};
|
|
72
|
-
const item = parseParamData(childParam, event, this.chain, address);
|
|
73
|
-
if (item) {
|
|
74
|
-
items.push(item);
|
|
75
|
-
}
|
|
76
|
-
} else if (param.name === 'calls') {
|
|
77
|
-
const children = param.value;
|
|
78
|
-
for (const child of children) {
|
|
79
|
-
if (child.call_module === 'System' && child.call_name === 'remark_with_event') {
|
|
80
|
-
for (const childParam of child.params) {
|
|
81
|
-
const item = parseParamData(childParam, event, this.chain, address);
|
|
82
|
-
if (item) {
|
|
83
|
-
items.push(item);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (items.length) {
|
|
92
|
-
// handleNftParams.updateCollection(this.chain, {
|
|
93
|
-
// chain: this.chain,
|
|
94
|
-
// collectionId: ORDINAL_COLLECTION
|
|
95
|
-
// });
|
|
96
|
-
|
|
97
|
-
for (const item of items) {
|
|
98
|
-
handleNftParams.updateItem(this.chain, item, address);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
async handleNfts(params) {
|
|
104
|
-
await Promise.all(this.addresses.map(address => this.handleNft(address, params)));
|
|
105
|
-
}
|
|
106
|
-
async fetchNfts(params) {
|
|
107
|
-
try {
|
|
108
|
-
await this.handleNfts(params);
|
|
109
|
-
} catch (e) {
|
|
110
|
-
return 0;
|
|
111
|
-
}
|
|
112
|
-
return 1;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const fetchRemarkEvent: (chain: string, address: string) => Promise<import("@subwallet/extension-base/types").SubscanEventBaseItemData[]>;
|
|
2
|
-
export declare const fetchExtrinsicParams: (chain: string, extrinsicIndexes: string[]) => Promise<import("@subwallet/extension-base/types").SubscanExtrinsicParam[]>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { BASE_FETCH_ORDINAL_EVENT_DATA, GET_EVENT_LIST_API, GET_EXTRINSIC_PARAMS_API } from "./constants.js";
|
|
5
|
-
export const fetchRemarkEvent = async (chain, address) => {
|
|
6
|
-
const params = {
|
|
7
|
-
...BASE_FETCH_ORDINAL_EVENT_DATA,
|
|
8
|
-
address
|
|
9
|
-
};
|
|
10
|
-
const response = await fetch(GET_EVENT_LIST_API.replace('{{chain}}', chain), {
|
|
11
|
-
method: 'POST',
|
|
12
|
-
headers: {
|
|
13
|
-
'Content-Type': 'application/json'
|
|
14
|
-
},
|
|
15
|
-
body: JSON.stringify(params)
|
|
16
|
-
});
|
|
17
|
-
const data = await response.json();
|
|
18
|
-
return data.data.events;
|
|
19
|
-
};
|
|
20
|
-
export const fetchExtrinsicParams = async (chain, extrinsicIndexes) => {
|
|
21
|
-
const params = {
|
|
22
|
-
extrinsic_index: extrinsicIndexes
|
|
23
|
-
};
|
|
24
|
-
const response = await fetch(GET_EXTRINSIC_PARAMS_API.replace('{{chain}}', chain), {
|
|
25
|
-
method: 'POST',
|
|
26
|
-
headers: {
|
|
27
|
-
'Content-Type': 'application/json'
|
|
28
|
-
},
|
|
29
|
-
body: JSON.stringify(params)
|
|
30
|
-
});
|
|
31
|
-
const data = await response.json();
|
|
32
|
-
return data.data;
|
|
33
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { _ChainAsset } from '@subwallet/chain-list/types';
|
|
2
|
-
import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
3
|
-
import { RuntimeDispatchInfo, SpecialYieldPoolInfo, YieldStepDetail } from '@subwallet/extension-base/types';
|
|
4
|
-
export declare const syntheticSelectedValidators: string[];
|
|
5
|
-
export declare function calculateAlternativeFee(feeInfo: RuntimeDispatchInfo): number;
|
|
6
|
-
export declare const DEFAULT_YIELD_FIRST_STEP: YieldStepDetail;
|
|
7
|
-
export declare const YIELD_EXTRINSIC_TYPES: ExtrinsicType[];
|
|
8
|
-
export declare const YIELD_POOL_STAT_REFRESH_INTERVAL = 90000;
|
|
9
|
-
export declare const YIELD_POOL_MIN_AMOUNT_PERCENT: Record<string, number>;
|
|
10
|
-
export declare function convertDerivativeToOriginToken(amount: string, poolInfo: SpecialYieldPoolInfo, derivativeTokenInfo: _ChainAsset, originTokenInfo: _ChainAsset): number;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
5
|
-
import { _getAssetDecimals } from '@subwallet/extension-base/services/chain-service/utils';
|
|
6
|
-
import { YieldStepType } from '@subwallet/extension-base/types';
|
|
7
|
-
export const syntheticSelectedValidators = ['15MLn9YQaHZ4GMkhK3qXqR5iGGSdULyJ995ctjeBgFRseyi6', '1REAJ1k691g5Eqqg9gL7vvZCBG7FCCZ8zgQkZWd4va5ESih', '1yGJ3h7TQuJWLYSsUVPZbM8aR8UsQXCqMvrFx5Fn1ktiAmq', '16GDRhRYxk42paoK6TfHAqWej8PdDDUwdDazjv4bAn4KGNeb', '13Ybj8CPEArUee78DxUAP9yX3ABmFNVQME1ZH4w8HVncHGzc', '14yx4vPAACZRhoDQm1dyvXD3QdRQyCRRCe5tj1zPomhhS29a', '14Vh8S1DzzycngbAB9vqEgPFR9JpSvmF1ezihTUES1EaHAV', '153YD8ZHD9dRh82U419bSCB5SzWhbdAFzjj4NtA5pMazR2yC', '1LUckyocmz9YzeQZHVpBvYYRGXb3rnSm2tvfz79h3G3JDgP', '14oRE62MB1SWR6h5RTx3GY5HK2oZipi1Gp3zdiLwVYLfEyRZ', '1cFsLn7o74nmjbRyDtMAnMpQMc5ZLsjgCSz9Np2mcejUK83', '15ZvLonEseaWZNy8LDkXXj3Y8bmAjxCjwvpy4pXWSL4nGSBs', '1NebF2xZHb4TJJpiqZZ3reeTo8dZov6LZ49qZqcHHbsmHfo', '1HmAqbBRrWvsqbLkvpiVDkdA2PcctUE5JUe3qokEh1FN455', '15tfUt4iQNjMyhZiJGBf4EpETE2KqtW1nfJwbBT1MvWjvcK9', '12RXTLiaYh59PokjZVhQvKzcfBEB5CvDnjKKUmDUotzcTH3S'];
|
|
8
|
-
export function calculateAlternativeFee(feeInfo) {
|
|
9
|
-
return feeInfo.partialFee;
|
|
10
|
-
}
|
|
11
|
-
export const DEFAULT_YIELD_FIRST_STEP = {
|
|
12
|
-
id: 0,
|
|
13
|
-
name: 'Fill information',
|
|
14
|
-
type: YieldStepType.DEFAULT
|
|
15
|
-
};
|
|
16
|
-
export const YIELD_EXTRINSIC_TYPES = [ExtrinsicType.MINT_VDOT, ExtrinsicType.MINT_LDOT, ExtrinsicType.MINT_SDOT, ExtrinsicType.MINT_QDOT, ExtrinsicType.MINT_STDOT, ExtrinsicType.REDEEM_QDOT, ExtrinsicType.REDEEM_SDOT, ExtrinsicType.REDEEM_VDOT, ExtrinsicType.REDEEM_LDOT, ExtrinsicType.REDEEM_STDOT, ExtrinsicType.STAKING_JOIN_POOL, ExtrinsicType.STAKING_CLAIM_REWARD, ExtrinsicType.STAKING_LEAVE_POOL, ExtrinsicType.STAKING_POOL_WITHDRAW];
|
|
17
|
-
export const YIELD_POOL_STAT_REFRESH_INTERVAL = 90000;
|
|
18
|
-
export const YIELD_POOL_MIN_AMOUNT_PERCENT = {
|
|
19
|
-
DOT___acala_liquid_staking: 0.98,
|
|
20
|
-
DOT___bifrost_liquid_staking: 0.99,
|
|
21
|
-
DOT___parallel_liquid_staking: 0.97,
|
|
22
|
-
default: 0.98
|
|
23
|
-
};
|
|
24
|
-
export function convertDerivativeToOriginToken(amount, poolInfo, derivativeTokenInfo, originTokenInfo) {
|
|
25
|
-
var _poolInfo$metadata$as;
|
|
26
|
-
const derivativeDecimals = _getAssetDecimals(derivativeTokenInfo);
|
|
27
|
-
const originDecimals = _getAssetDecimals(originTokenInfo);
|
|
28
|
-
const exchangeRate = ((_poolInfo$metadata$as = poolInfo.metadata.assetEarning) === null || _poolInfo$metadata$as === void 0 ? void 0 : _poolInfo$metadata$as[0].exchangeRate) || 1;
|
|
29
|
-
const formattedAmount = parseInt(amount) / 10 ** derivativeDecimals; // TODO: decimals
|
|
30
|
-
const minAmount = formattedAmount * exchangeRate;
|
|
31
|
-
return Math.floor(minAmount * 10 ** originDecimals);
|
|
32
|
-
}
|