@subwallet/extension-base 1.1.33-beta.1 → 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 -120
- package/background/KoniTypes.js +13 -22
- package/background/errors/TransactionError.js +0 -9
- package/cjs/background/KoniTypes.js +16 -23
- 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 +17 -2
- package/cjs/services/chain-service/index.js +3 -25
- package/cjs/services/chain-service/utils.js +1 -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 +1 -92
- package/cjs/services/storage-service/databases/index.js +0 -7
- 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 -252
- 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 +8 -331
- 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 -1
- package/services/chain-service/constants.js +15 -1
- package/services/chain-service/index.d.ts +0 -2
- package/services/chain-service/index.js +3 -25
- 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 -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 +3 -30
- package/services/storage-service/DatabaseService.js +1 -91
- package/services/storage-service/databases/index.d.ts +2 -8
- package/services/storage-service/databases/index.js +0 -7
- 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 -250
- 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 -49
- 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 -98
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost-manta.js +0 -140
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -299
- package/cjs/services/earning-service/handlers/liquid-staking/index.js +0 -41
- 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 -497
- package/cjs/services/earning-service/service.js +0 -741
- 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/AssetRef.js +0 -24
- 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 -48
- 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 -34
- 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 -90
- package/services/earning-service/handlers/liquid-staking/bifrost-manta.d.ts +0 -37
- package/services/earning-service/handlers/liquid-staking/bifrost-manta.js +0 -132
- package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +0 -46
- package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -288
- package/services/earning-service/handlers/liquid-staking/index.d.ts +0 -5
- package/services/earning-service/handlers/liquid-staking/index.js +0 -8
- 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 -489
- package/services/earning-service/service.d.ts +0 -94
- package/services/earning-service/service.js +0 -730
- 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/AssetRef.d.ts +0 -7
- package/services/storage-service/db-stores/AssetRef.js +0 -16
- 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 -96
- package/types/yield/actions/join/step.js +0 -47
- 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
|
@@ -10,14 +10,14 @@ var _TransactionError = require("@subwallet/extension-base/background/errors/Tra
|
|
|
10
10
|
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
11
11
|
var _TransactionWarning = require("@subwallet/extension-base/background/warnings/TransactionWarning");
|
|
12
12
|
var _constants = require("@subwallet/extension-base/constants");
|
|
13
|
+
var _constants2 = require("@subwallet/extension-base/services/chain-service/constants");
|
|
13
14
|
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
14
|
-
var
|
|
15
|
-
var
|
|
15
|
+
var _constants3 = require("@subwallet/extension-base/services/request-service/constants");
|
|
16
|
+
var _constants4 = require("@subwallet/extension-base/services/transaction-service/constants");
|
|
16
17
|
var _eventParser = require("@subwallet/extension-base/services/transaction-service/event-parser");
|
|
17
18
|
var _helpers = require("@subwallet/extension-base/services/transaction-service/helpers");
|
|
18
19
|
var _utils2 = require("@subwallet/extension-base/services/transaction-service/utils");
|
|
19
20
|
var _helpers2 = require("@subwallet/extension-base/services/wallet-connect-service/helpers");
|
|
20
|
-
var _types = require("@subwallet/extension-base/types");
|
|
21
21
|
var _utils3 = require("@subwallet/extension-base/utils");
|
|
22
22
|
var _eth = require("@subwallet/extension-base/utils/eth");
|
|
23
23
|
var _mergeTransactionAndSignature = require("@subwallet/extension-base/utils/eth/mergeTransactionAndSignature");
|
|
@@ -30,7 +30,6 @@ var _eventemitter = _interopRequireDefault(require("eventemitter3"));
|
|
|
30
30
|
var _i18next = require("i18next");
|
|
31
31
|
var _rxjs = require("rxjs");
|
|
32
32
|
var _util = require("@polkadot/util");
|
|
33
|
-
var _constants4 = require("../chain-service/constants");
|
|
34
33
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
35
34
|
// SPDX-License-Identifier: Apache-2.0
|
|
36
35
|
|
|
@@ -40,12 +39,14 @@ class TransactionService {
|
|
|
40
39
|
get transactions() {
|
|
41
40
|
return this.transactionSubject.getValue();
|
|
42
41
|
}
|
|
43
|
-
constructor(
|
|
44
|
-
this.
|
|
45
|
-
this.eventService =
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
48
|
-
this.
|
|
42
|
+
constructor(chainService, eventService, requestService, balanceService, historyService, notificationService, databaseService) {
|
|
43
|
+
this.chainService = chainService;
|
|
44
|
+
this.eventService = eventService;
|
|
45
|
+
this.requestService = requestService;
|
|
46
|
+
this.balanceService = balanceService;
|
|
47
|
+
this.historyService = historyService;
|
|
48
|
+
this.notificationService = notificationService;
|
|
49
|
+
this.databaseService = databaseService;
|
|
49
50
|
}
|
|
50
51
|
get allTransactions() {
|
|
51
52
|
return Object.values(this.transactions);
|
|
@@ -102,7 +103,7 @@ class TransactionService {
|
|
|
102
103
|
decimals: 0,
|
|
103
104
|
value: ''
|
|
104
105
|
};
|
|
105
|
-
const chainInfo = this.
|
|
106
|
+
const chainInfo = this.chainService.getChainInfoByKey(chain);
|
|
106
107
|
if (!chainInfo) {
|
|
107
108
|
validationResponse.errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INTERNAL_ERROR, (0, _i18next.t)('Cannot find network')));
|
|
108
109
|
} else {
|
|
@@ -117,7 +118,7 @@ class TransactionService {
|
|
|
117
118
|
if ((0, _helpers.isSubstrateTransaction)(transaction)) {
|
|
118
119
|
estimateFee.value = (await transaction.paymentInfo(address)).partialFee.toString();
|
|
119
120
|
} else {
|
|
120
|
-
const web3 = this.
|
|
121
|
+
const web3 = this.chainService.getEvmApi(chain);
|
|
121
122
|
if (!web3) {
|
|
122
123
|
validationResponse.errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.CHAIN_DISCONNECTED, undefined));
|
|
123
124
|
} else {
|
|
@@ -151,35 +152,32 @@ class TransactionService {
|
|
|
151
152
|
|
|
152
153
|
// Balance
|
|
153
154
|
const transferNative = validationResponse.transferNativeAmount || '0';
|
|
154
|
-
const nativeTokenInfo = this.
|
|
155
|
-
const balance = await this.
|
|
155
|
+
const nativeTokenInfo = this.chainService.getNativeTokenInfo(chain);
|
|
156
|
+
const balance = await this.balanceService.getTokenFreeBalance(address, chain, nativeTokenInfo.slug);
|
|
156
157
|
const existentialDeposit = nativeTokenInfo.minAmount || '0';
|
|
157
158
|
const feeNum = parseInt(estimateFee.value);
|
|
158
159
|
const balanceNum = parseInt(balance.value);
|
|
159
160
|
const edNum = parseInt(existentialDeposit);
|
|
160
161
|
const transferNativeNum = parseInt(transferNative);
|
|
161
|
-
if (!
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
if (!new _bignumber.default(balance.value).gt(0)) {
|
|
163
|
+
validationResponse.errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.NOT_ENOUGH_BALANCE));
|
|
164
|
+
}
|
|
165
|
+
if (transferNativeNum + feeNum > balanceNum) {
|
|
166
|
+
if (!isTransferAll) {
|
|
164
167
|
validationResponse.errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.NOT_ENOUGH_BALANCE));
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
} else {
|
|
169
|
+
if ([..._constants2._TRANSFER_CHAIN_GROUP.acala, ..._constants2._TRANSFER_CHAIN_GROUP.genshiro, ..._constants2._TRANSFER_CHAIN_GROUP.bitcountry, ..._constants2._TRANSFER_CHAIN_GROUP.statemine].includes(chain)) {
|
|
170
|
+
// Chain not have transfer all function
|
|
168
171
|
validationResponse.errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.NOT_ENOUGH_BALANCE));
|
|
169
|
-
} else {
|
|
170
|
-
if ([..._constants4._TRANSFER_CHAIN_GROUP.acala, ..._constants4._TRANSFER_CHAIN_GROUP.genshiro, ..._constants4._TRANSFER_CHAIN_GROUP.bitcountry, ..._constants4._TRANSFER_CHAIN_GROUP.statemine].includes(chain)) {
|
|
171
|
-
// Chain not have transfer all function
|
|
172
|
-
validationResponse.errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.NOT_ENOUGH_BALANCE));
|
|
173
|
-
}
|
|
174
172
|
}
|
|
175
173
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
174
|
+
}
|
|
175
|
+
if (!isTransferAll) {
|
|
176
|
+
if (balanceNum - (transferNativeNum + feeNum) < edNum) {
|
|
177
|
+
if (edAsWarning) {
|
|
178
|
+
validationResponse.warnings.push(new _TransactionWarning.TransactionWarning(_KoniTypes.BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT));
|
|
179
|
+
} else {
|
|
180
|
+
validationResponse.errors.push(new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.NOT_ENOUGH_EXISTENTIAL_DEPOSIT));
|
|
183
181
|
}
|
|
184
182
|
}
|
|
185
183
|
}
|
|
@@ -200,7 +198,7 @@ class TransactionService {
|
|
|
200
198
|
updatedAt: new Date().getTime(),
|
|
201
199
|
errors: transaction.errors || [],
|
|
202
200
|
warnings: transaction.warnings || [],
|
|
203
|
-
url: transaction.url ||
|
|
201
|
+
url: transaction.url || _constants3.EXTENSION_REQUEST_URL,
|
|
204
202
|
status: _KoniTypes.ExtrinsicStatus.QUEUED,
|
|
205
203
|
isInternal,
|
|
206
204
|
id: transactionId,
|
|
@@ -246,21 +244,12 @@ class TransactionService {
|
|
|
246
244
|
}
|
|
247
245
|
validatedTransaction.warnings = [];
|
|
248
246
|
const emitter = await this.addTransaction(validatedTransaction);
|
|
249
|
-
await new Promise(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
resolve();
|
|
256
|
-
});
|
|
257
|
-
} else {
|
|
258
|
-
emitter.on('signed', data => {
|
|
259
|
-
validatedTransaction.id = data.id;
|
|
260
|
-
validatedTransaction.extrinsicHash = data.extrinsicHash;
|
|
261
|
-
resolve();
|
|
262
|
-
});
|
|
263
|
-
}
|
|
247
|
+
await new Promise(resolve => {
|
|
248
|
+
emitter.on('signed', data => {
|
|
249
|
+
validatedTransaction.id = data.id;
|
|
250
|
+
validatedTransaction.extrinsicHash = data.extrinsicHash;
|
|
251
|
+
resolve();
|
|
252
|
+
});
|
|
264
253
|
emitter.on('error', data => {
|
|
265
254
|
if (data.errors.length > 0) {
|
|
266
255
|
validatedTransaction.errors.push(...data.errors);
|
|
@@ -332,7 +321,7 @@ class TransactionService {
|
|
|
332
321
|
}
|
|
333
322
|
getTransactionLink(id) {
|
|
334
323
|
const transaction = this.getTransaction(id);
|
|
335
|
-
const chainInfo = this.
|
|
324
|
+
const chainInfo = this.chainService.getChainInfoByKey(transaction.chain);
|
|
336
325
|
return (0, _utils2.getExplorerLink)(chainInfo, transaction.extrinsicHash, 'tx');
|
|
337
326
|
}
|
|
338
327
|
transactionToHistories(id, startBlock, nonce, eventLogs) {
|
|
@@ -360,7 +349,7 @@ class TransactionService {
|
|
|
360
349
|
nonce: nonce !== null && nonce !== void 0 ? nonce : 0,
|
|
361
350
|
startBlock: startBlock || 0
|
|
362
351
|
};
|
|
363
|
-
const chainInfo = this.
|
|
352
|
+
const chainInfo = this.chainService.getChainInfoByKey(transaction.chain);
|
|
364
353
|
const nativeAsset = (0, _utils._getChainNativeTokenBasicInfo)(chainInfo);
|
|
365
354
|
const baseNativeAmount = {
|
|
366
355
|
value: '0',
|
|
@@ -374,7 +363,7 @@ class TransactionService {
|
|
|
374
363
|
{
|
|
375
364
|
const inputData = (0, _utils2.parseTransactionData)(transaction.data);
|
|
376
365
|
historyItem.to = inputData.to;
|
|
377
|
-
const sendingTokenInfo = this.
|
|
366
|
+
const sendingTokenInfo = this.chainService.getAssetBySlug(inputData.tokenSlug);
|
|
378
367
|
historyItem.amount = {
|
|
379
368
|
value: inputData.value || '0',
|
|
380
369
|
decimals: sendingTokenInfo.decimals || 0,
|
|
@@ -387,7 +376,7 @@ class TransactionService {
|
|
|
387
376
|
{
|
|
388
377
|
const inputData = (0, _utils2.parseTransactionData)(transaction.data);
|
|
389
378
|
historyItem.to = inputData.to;
|
|
390
|
-
const sendingTokenInfo = this.
|
|
379
|
+
const sendingTokenInfo = this.chainService.getAssetBySlug(inputData.tokenSlug);
|
|
391
380
|
historyItem.amount = {
|
|
392
381
|
value: inputData.value || '0',
|
|
393
382
|
decimals: sendingTokenInfo.decimals || 0,
|
|
@@ -400,7 +389,7 @@ class TransactionService {
|
|
|
400
389
|
{
|
|
401
390
|
const inputData = (0, _utils2.parseTransactionData)(transaction.data);
|
|
402
391
|
historyItem.to = inputData.to;
|
|
403
|
-
const sendingTokenInfo = this.
|
|
392
|
+
const sendingTokenInfo = this.chainService.getAssetBySlug(inputData.tokenSlug);
|
|
404
393
|
historyItem.amount = {
|
|
405
394
|
value: inputData.value || '0',
|
|
406
395
|
decimals: sendingTokenInfo.decimals || 0,
|
|
@@ -449,29 +438,17 @@ class TransactionService {
|
|
|
449
438
|
case _KoniTypes.ExtrinsicType.STAKING_UNBOND:
|
|
450
439
|
{
|
|
451
440
|
const data = (0, _utils2.parseTransactionData)(transaction.data);
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
};
|
|
458
|
-
historyItem.additionalInfo = {
|
|
459
|
-
inputTokenSlug: data.inputTokenInfo.slug,
|
|
460
|
-
exchangeRate: data.exchangeRate
|
|
461
|
-
};
|
|
462
|
-
} else {
|
|
463
|
-
historyItem.to = data.validatorAddress || '';
|
|
464
|
-
historyItem.amount = {
|
|
465
|
-
...baseNativeAmount,
|
|
466
|
-
value: data.amount || '0'
|
|
467
|
-
};
|
|
468
|
-
}
|
|
441
|
+
historyItem.to = data.validatorAddress || '';
|
|
442
|
+
historyItem.amount = {
|
|
443
|
+
...baseNativeAmount,
|
|
444
|
+
value: data.amount || '0'
|
|
445
|
+
};
|
|
469
446
|
}
|
|
470
447
|
break;
|
|
471
448
|
case _KoniTypes.ExtrinsicType.STAKING_LEAVE_POOL:
|
|
472
449
|
{
|
|
473
450
|
const data = (0, _utils2.parseTransactionData)(transaction.data);
|
|
474
|
-
historyItem.to = data.address || '';
|
|
451
|
+
historyItem.to = data.nominatorMetadata.address || '';
|
|
475
452
|
historyItem.amount = {
|
|
476
453
|
...baseNativeAmount,
|
|
477
454
|
value: data.amount || '0'
|
|
@@ -490,21 +467,11 @@ class TransactionService {
|
|
|
490
467
|
case _KoniTypes.ExtrinsicType.STAKING_WITHDRAW:
|
|
491
468
|
{
|
|
492
469
|
const data = (0, _utils2.parseTransactionData)(transaction.data);
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
const amount = {
|
|
470
|
+
historyItem.to = data.validatorAddress || '';
|
|
471
|
+
historyItem.amount = {
|
|
496
472
|
...baseNativeAmount,
|
|
497
473
|
value: data.unstakingInfo.claimable || '0'
|
|
498
474
|
};
|
|
499
|
-
if (poolHandler) {
|
|
500
|
-
const asset = this.state.getAssetBySlug(poolHandler.metadataInfo.inputAsset);
|
|
501
|
-
if (asset) {
|
|
502
|
-
amount.decimals = asset.decimals || 0;
|
|
503
|
-
amount.symbol = asset.symbol;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
historyItem.to = data.unstakingInfo.validatorAddress || '';
|
|
507
|
-
historyItem.amount = amount;
|
|
508
475
|
break;
|
|
509
476
|
}
|
|
510
477
|
case _KoniTypes.ExtrinsicType.STAKING_CANCEL_UNSTAKE:
|
|
@@ -525,119 +492,6 @@ class TransactionService {
|
|
|
525
492
|
historyItem.to = (data === null || data === void 0 ? void 0 : data.to) || '';
|
|
526
493
|
break;
|
|
527
494
|
}
|
|
528
|
-
case _KoniTypes.ExtrinsicType.MINT_STDOT:
|
|
529
|
-
case _KoniTypes.ExtrinsicType.MINT_QDOT:
|
|
530
|
-
case _KoniTypes.ExtrinsicType.MINT_LDOT:
|
|
531
|
-
case _KoniTypes.ExtrinsicType.MINT_SDOT:
|
|
532
|
-
case _KoniTypes.ExtrinsicType.MINT_VMANTA:
|
|
533
|
-
|
|
534
|
-
// eslint-disable-next-line no-fallthrough
|
|
535
|
-
case _KoniTypes.ExtrinsicType.MINT_VDOT:
|
|
536
|
-
{
|
|
537
|
-
const params = (0, _utils2.parseTransactionData)(transaction.data);
|
|
538
|
-
const inputTokenInfo = this.state.chainService.getAssetBySlug(params.inputTokenSlug);
|
|
539
|
-
const isFeePaidWithInputAsset = params.feeTokenSlug === params.inputTokenSlug;
|
|
540
|
-
historyItem.amount = {
|
|
541
|
-
value: params.amount,
|
|
542
|
-
symbol: (0, _utils._getAssetSymbol)(inputTokenInfo),
|
|
543
|
-
decimals: (0, _utils._getAssetDecimals)(inputTokenInfo)
|
|
544
|
-
};
|
|
545
|
-
const additionalInfo = {
|
|
546
|
-
slug: params.slug,
|
|
547
|
-
derivativeTokenSlug: params.derivativeTokenSlug,
|
|
548
|
-
exchangeRate: params.exchangeRate
|
|
549
|
-
};
|
|
550
|
-
historyItem.additionalInfo = additionalInfo;
|
|
551
|
-
eventLogs && !(0, _utils._isChainEvmCompatible)(chainInfo) && (0, _eventParser.parseLiquidStakingEvents)(historyItem, eventLogs, inputTokenInfo, chainInfo, isFeePaidWithInputAsset, extrinsicType);
|
|
552
|
-
break;
|
|
553
|
-
}
|
|
554
|
-
case _KoniTypes.ExtrinsicType.UNSTAKE_QDOT:
|
|
555
|
-
|
|
556
|
-
// eslint-disable-next-line no-fallthrough
|
|
557
|
-
case _KoniTypes.ExtrinsicType.REDEEM_QDOT:
|
|
558
|
-
{
|
|
559
|
-
const data = (0, _utils2.parseTransactionData)(transaction.data);
|
|
560
|
-
const yieldPoolInfo = data.poolInfo;
|
|
561
|
-
if (yieldPoolInfo.metadata.derivativeAssets) {
|
|
562
|
-
const inputTokenSlug = yieldPoolInfo.metadata.inputAsset;
|
|
563
|
-
const inputTokenInfo = this.state.chainService.getAssetBySlug(inputTokenSlug);
|
|
564
|
-
historyItem.amount = {
|
|
565
|
-
value: data.amount,
|
|
566
|
-
symbol: (0, _utils._getAssetSymbol)(inputTokenInfo),
|
|
567
|
-
decimals: (0, _utils._getAssetDecimals)(inputTokenInfo)
|
|
568
|
-
};
|
|
569
|
-
eventLogs && (0, _eventParser.parseLiquidStakingFastUnstakeEvents)(historyItem, eventLogs, chainInfo, extrinsicType);
|
|
570
|
-
const additionalInfo = {
|
|
571
|
-
minAmountPercent: 1,
|
|
572
|
-
symbol: inputTokenInfo.symbol,
|
|
573
|
-
decimals: inputTokenInfo.decimals || 0,
|
|
574
|
-
exchangeRate: 1,
|
|
575
|
-
slug: yieldPoolInfo.slug,
|
|
576
|
-
type: yieldPoolInfo.type,
|
|
577
|
-
chain: yieldPoolInfo.chain,
|
|
578
|
-
group: yieldPoolInfo.group,
|
|
579
|
-
isFast: data.fastLeave
|
|
580
|
-
};
|
|
581
|
-
historyItem.additionalInfo = additionalInfo;
|
|
582
|
-
}
|
|
583
|
-
break;
|
|
584
|
-
}
|
|
585
|
-
case _KoniTypes.ExtrinsicType.UNSTAKE_VDOT:
|
|
586
|
-
case _KoniTypes.ExtrinsicType.UNSTAKE_VMANTA:
|
|
587
|
-
case _KoniTypes.ExtrinsicType.UNSTAKE_LDOT:
|
|
588
|
-
case _KoniTypes.ExtrinsicType.UNSTAKE_SDOT:
|
|
589
|
-
case _KoniTypes.ExtrinsicType.UNSTAKE_STDOT:
|
|
590
|
-
case _KoniTypes.ExtrinsicType.REDEEM_STDOT:
|
|
591
|
-
case _KoniTypes.ExtrinsicType.REDEEM_LDOT:
|
|
592
|
-
case _KoniTypes.ExtrinsicType.REDEEM_SDOT:
|
|
593
|
-
case _KoniTypes.ExtrinsicType.REDEEM_VMANTA:
|
|
594
|
-
|
|
595
|
-
// eslint-disable-next-line no-fallthrough
|
|
596
|
-
case _KoniTypes.ExtrinsicType.REDEEM_VDOT:
|
|
597
|
-
{
|
|
598
|
-
const data = (0, _utils2.parseTransactionData)(transaction.data);
|
|
599
|
-
const yieldPoolInfo = data.poolInfo;
|
|
600
|
-
const minAmountPercents = this.state.earningService.getMinAmountPercent();
|
|
601
|
-
if (yieldPoolInfo.metadata.derivativeAssets) {
|
|
602
|
-
var _yieldPoolInfo$statis;
|
|
603
|
-
const derivativeTokenSlug = yieldPoolInfo.metadata.derivativeAssets[0];
|
|
604
|
-
const derivativeTokenInfo = this.state.chainService.getAssetBySlug(derivativeTokenSlug);
|
|
605
|
-
const chainInfo = this.state.chainService.getChainInfoByKey(data.poolInfo.chain);
|
|
606
|
-
historyItem.amount = {
|
|
607
|
-
value: data.amount,
|
|
608
|
-
symbol: (0, _utils._getAssetSymbol)(derivativeTokenInfo),
|
|
609
|
-
decimals: (0, _utils._getAssetDecimals)(derivativeTokenInfo)
|
|
610
|
-
};
|
|
611
|
-
eventLogs && !(0, _utils._isChainEvmCompatible)(chainInfo) && (0, _eventParser.parseLiquidStakingFastUnstakeEvents)(historyItem, eventLogs, chainInfo, extrinsicType);
|
|
612
|
-
const minAmountPercent = minAmountPercents[yieldPoolInfo.slug] || 1;
|
|
613
|
-
const inputTokenSlug = yieldPoolInfo.metadata.inputAsset;
|
|
614
|
-
const inputTokenInfo = this.state.chainService.getAssetBySlug(inputTokenSlug);
|
|
615
|
-
const additionalInfo = {
|
|
616
|
-
minAmountPercent,
|
|
617
|
-
symbol: inputTokenInfo.symbol,
|
|
618
|
-
decimals: inputTokenInfo.decimals || 0,
|
|
619
|
-
exchangeRate: ((_yieldPoolInfo$statis = yieldPoolInfo.statistic) === null || _yieldPoolInfo$statis === void 0 ? void 0 : _yieldPoolInfo$statis.assetEarning[0].exchangeRate) || 1,
|
|
620
|
-
slug: yieldPoolInfo.slug,
|
|
621
|
-
type: yieldPoolInfo.type,
|
|
622
|
-
chain: yieldPoolInfo.chain,
|
|
623
|
-
group: yieldPoolInfo.group,
|
|
624
|
-
isFast: data.fastLeave
|
|
625
|
-
};
|
|
626
|
-
historyItem.additionalInfo = additionalInfo;
|
|
627
|
-
}
|
|
628
|
-
break;
|
|
629
|
-
}
|
|
630
|
-
case _KoniTypes.ExtrinsicType.TOKEN_APPROVE:
|
|
631
|
-
{
|
|
632
|
-
const data = (0, _utils2.parseTransactionData)(transaction.data);
|
|
633
|
-
const inputAsset = this.state.chainService.getAssetBySlug(data.inputTokenSlug);
|
|
634
|
-
historyItem.amount = {
|
|
635
|
-
value: '0',
|
|
636
|
-
symbol: (0, _utils._getAssetSymbol)(inputAsset),
|
|
637
|
-
decimals: (0, _utils._getAssetDecimals)(inputAsset)
|
|
638
|
-
};
|
|
639
|
-
break;
|
|
640
|
-
}
|
|
641
495
|
case _KoniTypes.ExtrinsicType.UNKNOWN:
|
|
642
496
|
break;
|
|
643
497
|
}
|
|
@@ -685,7 +539,7 @@ class TransactionService {
|
|
|
685
539
|
});
|
|
686
540
|
|
|
687
541
|
// Create Input History Transaction History
|
|
688
|
-
this.
|
|
542
|
+
this.historyService.insertHistories(this.transactionToHistories(id, startBlock, nonce)).catch(console.error);
|
|
689
543
|
console.debug(`Transaction "${id}" is sent`);
|
|
690
544
|
}
|
|
691
545
|
onHasTransactionHash(_ref3) {
|
|
@@ -703,12 +557,8 @@ class TransactionService {
|
|
|
703
557
|
this.updateTransaction(id, updateData);
|
|
704
558
|
|
|
705
559
|
// In this case transaction id is the same as extrinsic hash and will change after below update
|
|
706
|
-
this.
|
|
560
|
+
this.historyService.updateHistoryByExtrinsicHash(id, updateData).catch(console.error);
|
|
707
561
|
console.debug(`Transaction "${id}" is submitted with hash ${extrinsicHash || ''}`);
|
|
708
|
-
const transaction = this.getTransaction(id);
|
|
709
|
-
if ([_KoniTypes.ExtrinsicType.STAKING_JOIN_POOL, _KoniTypes.ExtrinsicType.JOIN_YIELD_POOL, _KoniTypes.ExtrinsicType.MINT_LDOT, _KoniTypes.ExtrinsicType.MINT_QDOT, _KoniTypes.ExtrinsicType.MINT_SDOT, _KoniTypes.ExtrinsicType.MINT_VDOT].includes(transaction.extrinsicType)) {
|
|
710
|
-
this.handlePostEarningTransaction(id);
|
|
711
|
-
}
|
|
712
562
|
}
|
|
713
563
|
handlePostProcessing(id) {
|
|
714
564
|
// must be done after success/failure to make sure the transaction is finalized
|
|
@@ -717,15 +567,15 @@ class TransactionService {
|
|
|
717
567
|
const inputData = (0, _utils2.parseTransactionData)(transaction.data);
|
|
718
568
|
try {
|
|
719
569
|
const sender = _uiKeyring.default.getPair(inputData.senderAddress);
|
|
720
|
-
sender && this.
|
|
721
|
-
this.
|
|
570
|
+
sender && this.databaseService.handleNftTransfer(transaction.chain, [sender.address, _constants.ALL_ACCOUNT_KEY], inputData.nftItem).then(() => {
|
|
571
|
+
this.eventService.emit('transaction.transferNft', undefined);
|
|
722
572
|
}).catch(console.error);
|
|
723
573
|
} catch (e) {
|
|
724
574
|
console.error(e);
|
|
725
575
|
}
|
|
726
576
|
try {
|
|
727
577
|
const recipient = _uiKeyring.default.getPair(inputData.recipientAddress);
|
|
728
|
-
recipient && this.
|
|
578
|
+
recipient && this.databaseService.addNft(recipient.address, {
|
|
729
579
|
...inputData.nftItem,
|
|
730
580
|
owner: recipient.address
|
|
731
581
|
}).catch(console.error);
|
|
@@ -733,7 +583,7 @@ class TransactionService {
|
|
|
733
583
|
console.error(e);
|
|
734
584
|
}
|
|
735
585
|
} else if ([_KoniTypes.ExtrinsicType.STAKING_BOND, _KoniTypes.ExtrinsicType.STAKING_UNBOND, _KoniTypes.ExtrinsicType.STAKING_WITHDRAW, _KoniTypes.ExtrinsicType.STAKING_CANCEL_UNSTAKE, _KoniTypes.ExtrinsicType.STAKING_CLAIM_REWARD, _KoniTypes.ExtrinsicType.STAKING_JOIN_POOL, _KoniTypes.ExtrinsicType.STAKING_POOL_WITHDRAW, _KoniTypes.ExtrinsicType.STAKING_LEAVE_POOL].includes(transaction.extrinsicType)) {
|
|
736
|
-
this.
|
|
586
|
+
this.eventService.emit('transaction.submitStaking', transaction.chain);
|
|
737
587
|
}
|
|
738
588
|
}
|
|
739
589
|
onSuccess(_ref4) {
|
|
@@ -750,14 +600,14 @@ class TransactionService {
|
|
|
750
600
|
});
|
|
751
601
|
|
|
752
602
|
// Write success transaction history
|
|
753
|
-
this.
|
|
603
|
+
this.historyService.updateHistoryByExtrinsicHash(transaction.extrinsicHash, {
|
|
754
604
|
extrinsicHash,
|
|
755
605
|
status: _KoniTypes.ExtrinsicStatus.SUCCESS,
|
|
756
606
|
blockNumber: blockNumber || 0,
|
|
757
607
|
blockHash: blockHash || ''
|
|
758
608
|
}).catch(console.error);
|
|
759
|
-
const info = (0, _util.isHex)(extrinsicHash) ? extrinsicHash : (0, _helpers.getBaseTransactionInfo)(transaction, this.
|
|
760
|
-
this.
|
|
609
|
+
const info = (0, _util.isHex)(extrinsicHash) ? extrinsicHash : (0, _helpers.getBaseTransactionInfo)(transaction, this.chainService.getChainInfoMap());
|
|
610
|
+
this.notificationService.notify({
|
|
761
611
|
type: _KoniTypes.NotificationType.SUCCESS,
|
|
762
612
|
title: (0, _i18next.t)('Transaction completed'),
|
|
763
613
|
message: (0, _i18next.t)('Transaction {{info}} completed', {
|
|
@@ -770,7 +620,7 @@ class TransactionService {
|
|
|
770
620
|
},
|
|
771
621
|
notifyViaBrowser: true
|
|
772
622
|
});
|
|
773
|
-
this.
|
|
623
|
+
this.eventService.emit('transaction.done', transaction);
|
|
774
624
|
}
|
|
775
625
|
onFailed(_ref5) {
|
|
776
626
|
let {
|
|
@@ -790,14 +640,14 @@ class TransactionService {
|
|
|
790
640
|
});
|
|
791
641
|
|
|
792
642
|
// Write failed transaction history
|
|
793
|
-
this.
|
|
643
|
+
this.historyService.updateHistoryByExtrinsicHash(transaction.extrinsicHash, {
|
|
794
644
|
extrinsicHash: extrinsicHash || transaction.extrinsicHash,
|
|
795
645
|
status: nextStatus,
|
|
796
646
|
blockNumber: blockNumber || 0,
|
|
797
647
|
blockHash: blockHash || ''
|
|
798
648
|
}).catch(console.error);
|
|
799
|
-
const info = (0, _util.isHex)(transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash) ? transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash : (0, _helpers.getBaseTransactionInfo)(transaction, this.
|
|
800
|
-
this.
|
|
649
|
+
const info = (0, _util.isHex)(transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash) ? transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash : (0, _helpers.getBaseTransactionInfo)(transaction, this.chainService.getChainInfoMap());
|
|
650
|
+
this.notificationService.notify({
|
|
801
651
|
type: _KoniTypes.NotificationType.ERROR,
|
|
802
652
|
title: (0, _i18next.t)('Transaction failed'),
|
|
803
653
|
message: (0, _i18next.t)('Transaction {{info}} failed', {
|
|
@@ -811,7 +661,7 @@ class TransactionService {
|
|
|
811
661
|
notifyViaBrowser: true
|
|
812
662
|
});
|
|
813
663
|
}
|
|
814
|
-
this.
|
|
664
|
+
this.eventService.emit('transaction.failed', transaction);
|
|
815
665
|
}
|
|
816
666
|
onTimeOut(_ref6) {
|
|
817
667
|
let {
|
|
@@ -854,7 +704,7 @@ class TransactionService {
|
|
|
854
704
|
}
|
|
855
705
|
generateHashPayload(chain, transaction) {
|
|
856
706
|
var _transaction$nonce;
|
|
857
|
-
const chainInfo = this.
|
|
707
|
+
const chainInfo = this.chainService.getChainInfoByKey(chain);
|
|
858
708
|
const txObject = {
|
|
859
709
|
nonce: (_transaction$nonce = transaction.nonce) !== null && _transaction$nonce !== void 0 ? _transaction$nonce : 0,
|
|
860
710
|
gasPrice: (0, _ethereumjsUtil.addHexPrefix)((0, _eth.anyNumberToBN)(transaction.gasPrice).toString(16)),
|
|
@@ -876,8 +726,8 @@ class TransactionService {
|
|
|
876
726
|
url
|
|
877
727
|
} = _ref7;
|
|
878
728
|
const payload = transaction;
|
|
879
|
-
const evmApi = this.
|
|
880
|
-
const chainInfo = this.
|
|
729
|
+
const evmApi = this.chainService.getEvmApi(chain);
|
|
730
|
+
const chainInfo = this.chainService.getChainInfoByKey(chain);
|
|
881
731
|
const accountPair = _uiKeyring.default.getPair(address);
|
|
882
732
|
const account = {
|
|
883
733
|
address,
|
|
@@ -907,7 +757,7 @@ class TransactionService {
|
|
|
907
757
|
|
|
908
758
|
// Set unique nonce to avoid transaction errors
|
|
909
759
|
if (!payload.nonce) {
|
|
910
|
-
const evmApi = this.
|
|
760
|
+
const evmApi = this.chainService.getEvmApi(chain);
|
|
911
761
|
payload.nonce = await evmApi.api.eth.getTransactionCount(address);
|
|
912
762
|
}
|
|
913
763
|
if (!payload.chainId) {
|
|
@@ -942,7 +792,7 @@ class TransactionService {
|
|
|
942
792
|
extrinsicHash: id
|
|
943
793
|
};
|
|
944
794
|
if (isInjected) {
|
|
945
|
-
this.
|
|
795
|
+
this.requestService.addConfirmation(id, url || _constants3.EXTENSION_REQUEST_URL, 'evmWatchTransactionRequest', payload, {}).then(async _ref8 => {
|
|
946
796
|
let {
|
|
947
797
|
isApproved,
|
|
948
798
|
payload
|
|
@@ -951,7 +801,7 @@ class TransactionService {
|
|
|
951
801
|
if (!payload) {
|
|
952
802
|
throw new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.UNAUTHORIZED, 'Bad signature');
|
|
953
803
|
}
|
|
954
|
-
const web3Api = this.
|
|
804
|
+
const web3Api = this.chainService.getEvmApi(chain).api;
|
|
955
805
|
|
|
956
806
|
// Emit signed event
|
|
957
807
|
emitter.emit('signed', eventData);
|
|
@@ -1007,7 +857,7 @@ class TransactionService {
|
|
|
1007
857
|
emitter.emit('error', eventData);
|
|
1008
858
|
});
|
|
1009
859
|
} else {
|
|
1010
|
-
this.
|
|
860
|
+
this.requestService.addConfirmation(id, url || _constants3.EXTENSION_REQUEST_URL, 'evmSendTransactionRequest', payload, {}).then(async _ref9 => {
|
|
1011
861
|
let {
|
|
1012
862
|
isApproved,
|
|
1013
863
|
payload
|
|
@@ -1017,7 +867,7 @@ class TransactionService {
|
|
|
1017
867
|
if (!payload) {
|
|
1018
868
|
throw new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.UNAUTHORIZED, (0, _i18next.t)('Failed to sign'));
|
|
1019
869
|
}
|
|
1020
|
-
const web3Api = this.
|
|
870
|
+
const web3Api = this.chainService.getEvmApi(chain).api;
|
|
1021
871
|
if (!isExternal) {
|
|
1022
872
|
signedTransaction = payload;
|
|
1023
873
|
} else {
|
|
@@ -1085,7 +935,7 @@ class TransactionService {
|
|
|
1085
935
|
transaction.signAsync(address, {
|
|
1086
936
|
signer: {
|
|
1087
937
|
signPayload: async payload => {
|
|
1088
|
-
const signing = await this.
|
|
938
|
+
const signing = await this.requestService.signInternalTransaction(id, address, url || _constants3.EXTENSION_REQUEST_URL, payload);
|
|
1089
939
|
return {
|
|
1090
940
|
id: new Date().getTime(),
|
|
1091
941
|
signature: signing.signature
|
|
@@ -1097,7 +947,7 @@ class TransactionService {
|
|
|
1097
947
|
emitter.emit('signed', eventData);
|
|
1098
948
|
|
|
1099
949
|
// Send transaction
|
|
1100
|
-
const api = this.
|
|
950
|
+
const api = this.chainService.getSubstrateApi(chain);
|
|
1101
951
|
eventData.nonce = rs.nonce.toNumber();
|
|
1102
952
|
eventData.startBlock = (await api.api.query.system.number()).toPrimitive();
|
|
1103
953
|
this.handleTransactionTimeout(emitter, eventData);
|
|
@@ -1161,7 +1011,7 @@ class TransactionService {
|
|
|
1161
1011
|
emitter.emit('timeout', eventData);
|
|
1162
1012
|
clearTimeout(timeout);
|
|
1163
1013
|
}
|
|
1164
|
-
},
|
|
1014
|
+
}, _constants4.TRANSACTION_TIMEOUT);
|
|
1165
1015
|
emitter.once('success', () => {
|
|
1166
1016
|
clearTimeout(timeout);
|
|
1167
1017
|
});
|
|
@@ -1169,33 +1019,6 @@ class TransactionService {
|
|
|
1169
1019
|
clearTimeout(timeout);
|
|
1170
1020
|
});
|
|
1171
1021
|
}
|
|
1172
|
-
handlePostEarningTransaction(id) {
|
|
1173
|
-
const transaction = this.getTransaction(id);
|
|
1174
|
-
let slug;
|
|
1175
|
-
|
|
1176
|
-
// TODO
|
|
1177
|
-
if ('data' in transaction.data) {
|
|
1178
|
-
slug = transaction.data.data.slug;
|
|
1179
|
-
} else {
|
|
1180
|
-
slug = transaction.data.slug;
|
|
1181
|
-
}
|
|
1182
|
-
const poolHandler = this.state.earningService.getPoolHandler(slug);
|
|
1183
|
-
if (poolHandler) {
|
|
1184
|
-
const type = poolHandler.type;
|
|
1185
|
-
if (type === _types.YieldPoolType.NATIVE_STAKING) {
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
} else {
|
|
1189
|
-
return;
|
|
1190
|
-
}
|
|
1191
|
-
this.state.mintCampaignService.unlockDotCampaign.mintNft({
|
|
1192
|
-
transactionId: id,
|
|
1193
|
-
address: transaction.address,
|
|
1194
|
-
slug: slug,
|
|
1195
|
-
network: transaction.chain,
|
|
1196
|
-
extrinsicHash: transaction.extrinsicHash
|
|
1197
|
-
}).catch(console.error);
|
|
1198
|
-
}
|
|
1199
1022
|
resetWallet() {
|
|
1200
1023
|
this.transactionSubject.next({});
|
|
1201
1024
|
}
|
package/cjs/types/index.js
CHANGED
|
@@ -24,48 +24,4 @@ Object.keys(_buy).forEach(function (key) {
|
|
|
24
24
|
return _buy[key];
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
});
|
|
28
|
-
var _campaigns = require("./campaigns");
|
|
29
|
-
Object.keys(_campaigns).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _campaigns[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _campaigns[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _ordinal = require("./ordinal");
|
|
40
|
-
Object.keys(_ordinal).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _ordinal[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _ordinal[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
var _transaction = require("./transaction");
|
|
51
|
-
Object.keys(_transaction).forEach(function (key) {
|
|
52
|
-
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (key in exports && exports[key] === _transaction[key]) return;
|
|
54
|
-
Object.defineProperty(exports, key, {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _transaction[key];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
var _yield = require("./yield");
|
|
62
|
-
Object.keys(_yield).forEach(function (key) {
|
|
63
|
-
if (key === "default" || key === "__esModule") return;
|
|
64
|
-
if (key in exports && exports[key] === _yield[key]) return;
|
|
65
|
-
Object.defineProperty(exports, key, {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function () {
|
|
68
|
-
return _yield[key];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
27
|
});
|
|
@@ -10,9 +10,8 @@ var _axios = _interopRequireDefault(require("axios"));
|
|
|
10
10
|
// Copyright 2019-2022 @subwallet/extension-base
|
|
11
11
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
12
|
|
|
13
|
-
const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
14
13
|
const branchName = process.env.BRANCH_NAME || 'koni-dev';
|
|
15
|
-
const fetchTarget =
|
|
14
|
+
const fetchTarget = branchName === 'master' || branchName === 'webapp' ? 'list.json' : 'preview.json';
|
|
16
15
|
async function fetchStaticData(slug, targetFile) {
|
|
17
16
|
const fetchFile = targetFile || fetchTarget;
|
|
18
17
|
try {
|