@subwallet/extension-base 1.3.55-1 → 1.3.57-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/cjs/koni/api/nft/config.js +1 -1
- package/cjs/koni/api/staking/bonding/utils.js +2 -0
- package/cjs/koni/background/handlers/Extension.js +5 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +7 -2
- package/cjs/services/chain-service/utils/index.js +0 -3
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/constants/chains.js +1 -0
- package/cjs/services/earning-service/handlers/native-staking/energy.js +394 -0
- package/cjs/services/earning-service/handlers/native-staking/index.js +8 -1
- package/cjs/services/earning-service/service.js +3 -0
- package/cjs/services/earning-service/utils/index.js +2 -0
- package/cjs/services/keyring-service/context/handlers/Json.js +2 -2
- package/cjs/services/migration-service/scripts/index.js +3 -1
- package/cjs/services/setting-service/constants.js +1 -1
- package/koni/api/nft/config.d.ts +1 -1
- package/koni/api/nft/config.js +1 -1
- package/koni/api/staking/bonding/utils.js +2 -0
- package/koni/background/handlers/Extension.js +7 -2
- package/package.json +11 -6
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.js +8 -2
- package/services/chain-service/utils/index.js +0 -3
- package/services/chain-service/utils/patch.d.ts +1 -1
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/constants/chains.d.ts +1 -0
- package/services/earning-service/constants/chains.js +1 -0
- package/services/earning-service/handlers/native-staking/energy.d.ts +30 -0
- package/services/earning-service/handlers/native-staking/energy.js +386 -0
- package/services/earning-service/handlers/native-staking/index.d.ts +1 -0
- package/services/earning-service/handlers/native-staking/index.js +2 -1
- package/services/earning-service/service.js +4 -1
- package/services/earning-service/utils/index.js +2 -0
- package/services/keyring-service/context/handlers/Json.js +2 -2
- package/services/migration-service/scripts/index.js +3 -1
- package/services/setting-service/constants.d.ts +1 -1
- package/services/setting-service/constants.js +1 -1
|
@@ -47,7 +47,7 @@ const ODYSSEY_ENDPOINT = 'https://indexer-v2.dev.aurascan.io/api/v2/graphql';
|
|
|
47
47
|
// export const UNIQUE_SCAN_ENDPOINT = 'https://explorer-api.unique.network/v1/graphql';
|
|
48
48
|
// export const QUARTZ_SCAN_ENDPOINT = 'https://hasura-quartz.unique.network/v1/graphql';
|
|
49
49
|
exports.ODYSSEY_ENDPOINT = ODYSSEY_ENDPOINT;
|
|
50
|
-
const VARA_SCAN_ENDPOINT = 'https://nft-explorer.vara
|
|
50
|
+
const VARA_SCAN_ENDPOINT = 'https://nft-explorer.vara.network/graphql';
|
|
51
51
|
exports.VARA_SCAN_ENDPOINT = VARA_SCAN_ENDPOINT;
|
|
52
52
|
const AVAIL_LIGHT_CLIENT_NFT = 'https://indexer.availspace.app/graphql'; // 'https://indexer-nft.availspace.app/graphql';
|
|
53
53
|
exports.AVAIL_LIGHT_CLIENT_NFT = AVAIL_LIGHT_CLIENT_NFT;
|
|
@@ -249,6 +249,8 @@ function getYieldAvailableActionsByType(yieldPoolInfo) {
|
|
|
249
249
|
const chain = yieldPoolInfo.chain;
|
|
250
250
|
if (_constants2._STAKING_CHAIN_GROUP.para.includes(chain)) {
|
|
251
251
|
return [YieldAction.STAKE, YieldAction.UNSTAKE, YieldAction.WITHDRAW, YieldAction.CANCEL_UNSTAKE];
|
|
252
|
+
} else if (_constants2._STAKING_CHAIN_GROUP.energy.includes(chain)) {
|
|
253
|
+
return [YieldAction.STAKE, YieldAction.UNSTAKE, YieldAction.WITHDRAW, YieldAction.CANCEL_UNSTAKE];
|
|
252
254
|
} else if (_constants2._STAKING_CHAIN_GROUP.astar.includes(chain)) {
|
|
253
255
|
return [YieldAction.STAKE, YieldAction.CLAIM_REWARD, YieldAction.UNSTAKE, YieldAction.WITHDRAW];
|
|
254
256
|
} else if (_constants2._STAKING_CHAIN_GROUP.amplitude.includes(chain)) {
|
|
@@ -329,6 +329,11 @@ class KoniExtension {
|
|
|
329
329
|
const accountProxiesFiltered = accountProxies.filter(accountProxy => {
|
|
330
330
|
var _accountProxy$account;
|
|
331
331
|
const signMode = (_accountProxy$account = accountProxy.accounts[0]) === null || _accountProxy$account === void 0 ? void 0 : _accountProxy$account.signMode;
|
|
332
|
+
if (signMode === _types4.AccountSignMode.GENERIC_LEDGER) {
|
|
333
|
+
if (accountProxy.chainTypes.includes(_types4.AccountChainType.ETHEREUM)) {
|
|
334
|
+
return (0, _utils6._isChainCompatibleLedgerEvm)(chainInfo);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
332
337
|
if (signMode === _types4.AccountSignMode.ECDSA_SUBSTRATE_LEDGER) {
|
|
333
338
|
if (actionType === _types2.ActionType.SEND_NFT) {
|
|
334
339
|
return false;
|
package/cjs/packageInfo.js
CHANGED
|
@@ -120,7 +120,10 @@ const _STAKING_ERA_LENGTH_MAP = {
|
|
|
120
120
|
analog_timechain: 12,
|
|
121
121
|
muse_testnet: 25 * 6 / 60 / 60,
|
|
122
122
|
// 25 blocks per session
|
|
123
|
-
mythos: 24
|
|
123
|
+
mythos: 24,
|
|
124
|
+
energy_web_x_testnet: 22 * 12 / 3600,
|
|
125
|
+
// 22 blocks per era, 1 block per 12s
|
|
126
|
+
energy_web_x: 7200 * 12 / 3600 // 24 hours, 7200 blocks per era, 1 block per 12s
|
|
124
127
|
};
|
|
125
128
|
exports._STAKING_ERA_LENGTH_MAP = _STAKING_ERA_LENGTH_MAP;
|
|
126
129
|
const _EXPECTED_BLOCK_TIME = {
|
|
@@ -156,7 +159,9 @@ const _EXPECTED_BLOCK_TIME = {
|
|
|
156
159
|
avail_mainnet: 20,
|
|
157
160
|
dentnet: 3,
|
|
158
161
|
muse_testnet: 6,
|
|
159
|
-
mythos: 6
|
|
162
|
+
mythos: 6,
|
|
163
|
+
energy_web_x_testnet: 12,
|
|
164
|
+
energy_web_x: 12
|
|
160
165
|
};
|
|
161
166
|
exports._EXPECTED_BLOCK_TIME = _EXPECTED_BLOCK_TIME;
|
|
162
167
|
const _PARACHAIN_INFLATION_DISTRIBUTION = {
|
|
@@ -851,9 +851,6 @@ const _isChainInfoCompatibleWithAccountInfo = (chainInfo, accountInfo) => {
|
|
|
851
851
|
if (accountSignMode === _types3.AccountSignMode.ECDSA_SUBSTRATE_LEDGER) {
|
|
852
852
|
return _isSubstrateEvmCompatibleChain(chainInfo) && _types4.EthereumKeypairTypes.includes(accountType);
|
|
853
853
|
}
|
|
854
|
-
if (accountSignMode === _types3.AccountSignMode.GENERIC_LEDGER) {
|
|
855
|
-
return _isChainCompatibleLedgerEvm(chainInfo) && _types4.EthereumKeypairTypes.includes(accountType);
|
|
856
|
-
}
|
|
857
854
|
return _isChainEvmCompatible(chainInfo) && _types4.EthereumKeypairTypes.includes(accountType);
|
|
858
855
|
}
|
|
859
856
|
if (accountChainType === _types3.AccountChainType.TON) {
|
|
@@ -12,7 +12,7 @@ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
|
12
12
|
const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
|
|
13
13
|
const fetchDomain = process.env.PATCH_CHAIN_LIST_URL || (PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev');
|
|
14
14
|
const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
|
|
15
|
-
const ChainListVersion = '0.2.
|
|
15
|
+
const ChainListVersion = '0.2.114'; // update this when build chain-list
|
|
16
16
|
|
|
17
17
|
// todo: move this interface to chainlist
|
|
18
18
|
exports.ChainListVersion = ChainListVersion;
|
|
@@ -24,6 +24,7 @@ const _STAKING_CHAIN_GROUP = {
|
|
|
24
24
|
krest_network: ['krest_network'],
|
|
25
25
|
manta: ['manta_network'],
|
|
26
26
|
bittensor: ['bittensor', 'bittensor_testnet'],
|
|
27
|
+
energy: ['energy_web_x_testnet', 'energy_web_x'],
|
|
27
28
|
mythos: ['mythos', 'muse_testnet']
|
|
28
29
|
};
|
|
29
30
|
exports._STAKING_CHAIN_GROUP = _STAKING_CHAIN_GROUP;
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _TransactionError = require("@subwallet/extension-base/background/errors/TransactionError");
|
|
9
|
+
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
10
|
+
var _utils = require("@subwallet/extension-base/koni/api/staking/bonding/utils");
|
|
11
|
+
var _constants = require("@subwallet/extension-base/services/chain-service/constants");
|
|
12
|
+
var _utils2 = require("@subwallet/extension-base/services/earning-service/utils");
|
|
13
|
+
var _types = require("@subwallet/extension-base/types");
|
|
14
|
+
var _utils3 = require("@subwallet/extension-base/utils");
|
|
15
|
+
var _util = require("@polkadot/util");
|
|
16
|
+
var _basePara = _interopRequireDefault(require("./base-para"));
|
|
17
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
18
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
19
|
+
|
|
20
|
+
class EnergyNativeStakingPoolHandler extends _basePara.default {
|
|
21
|
+
/* Subscribe pool info */
|
|
22
|
+
|
|
23
|
+
async subscribePoolInfo(callback) {
|
|
24
|
+
let cancel = false;
|
|
25
|
+
const chainApi = this.substrateApi;
|
|
26
|
+
const nativeToken = this.nativeToken;
|
|
27
|
+
const defaultCallback = async () => {
|
|
28
|
+
const data = {
|
|
29
|
+
...this.baseInfo,
|
|
30
|
+
type: this.type,
|
|
31
|
+
metadata: {
|
|
32
|
+
...this.metadataInfo,
|
|
33
|
+
description: this.getDescription()
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const poolInfo = await this.getPoolInfo();
|
|
37
|
+
!poolInfo && callback(data);
|
|
38
|
+
};
|
|
39
|
+
if (!this.isActive) {
|
|
40
|
+
await defaultCallback();
|
|
41
|
+
return () => {
|
|
42
|
+
cancel = true;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
await defaultCallback();
|
|
46
|
+
await chainApi.isReady;
|
|
47
|
+
const unsub = await chainApi.api.query.parachainStaking.era(async _era => {
|
|
48
|
+
var _chainApi$api$consts, _chainApi$api$consts$, _chainApi$api$consts$2, _chainApi$api$consts$3, _chainApi$api$query$p;
|
|
49
|
+
if (cancel) {
|
|
50
|
+
unsub();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const eraObj = _era.toHuman();
|
|
54
|
+
const era = (0, _utils3.parseRawNumber)(eraObj.current);
|
|
55
|
+
const maxNominations = (_chainApi$api$consts = chainApi.api.consts) === null || _chainApi$api$consts === void 0 ? void 0 : (_chainApi$api$consts$ = _chainApi$api$consts.parachainStaking) === null || _chainApi$api$consts$ === void 0 ? void 0 : (_chainApi$api$consts$2 = _chainApi$api$consts$.maxNominationsPerNominator) === null || _chainApi$api$consts$2 === void 0 ? void 0 : _chainApi$api$consts$2.toString();
|
|
56
|
+
const maxTopNominatorsPerCollator = (_chainApi$api$consts$3 = chainApi.api.consts.parachainStaking.maxTopNominationsPerCandidate) === null || _chainApi$api$consts$3 === void 0 ? void 0 : _chainApi$api$consts$3.toPrimitive();
|
|
57
|
+
const [_totalStake, unstakingDelay] = await Promise.all([(_chainApi$api$query$p = chainApi.api.query.parachainStaking) === null || _chainApi$api$query$p === void 0 ? void 0 : _chainApi$api$query$p.staked(era), chainApi.api.query.parachainStaking.delay()]);
|
|
58
|
+
const totalStake = _totalStake ? new _util.BN(_totalStake.toString()) : _util.BN_ZERO;
|
|
59
|
+
const eraTime = _constants._STAKING_ERA_LENGTH_MAP[this.chain] || _constants._STAKING_ERA_LENGTH_MAP.default; // in hours
|
|
60
|
+
const unstakingPeriod = parseInt(unstakingDelay.toString()) * eraTime;
|
|
61
|
+
const minStake = '0';
|
|
62
|
+
const minToHuman = (0, _utils3.formatNumber)(minStake.toString(), nativeToken.decimals || 0, _utils3.balanceFormatter);
|
|
63
|
+
const data = {
|
|
64
|
+
...this.baseInfo,
|
|
65
|
+
type: this.type,
|
|
66
|
+
metadata: {
|
|
67
|
+
...this.metadataInfo,
|
|
68
|
+
description: this.getDescription(minToHuman)
|
|
69
|
+
},
|
|
70
|
+
statistic: {
|
|
71
|
+
assetEarning: [{
|
|
72
|
+
slug: this.nativeToken.slug
|
|
73
|
+
}],
|
|
74
|
+
maxCandidatePerFarmer: parseInt(maxNominations),
|
|
75
|
+
maxWithdrawalRequestPerFarmer: 1,
|
|
76
|
+
// by default
|
|
77
|
+
earningThreshold: {
|
|
78
|
+
join: minStake.toString(),
|
|
79
|
+
defaultUnstake: '0',
|
|
80
|
+
fastUnstake: '0'
|
|
81
|
+
},
|
|
82
|
+
farmerCount: 0,
|
|
83
|
+
// TODO recheck
|
|
84
|
+
era,
|
|
85
|
+
eraTime,
|
|
86
|
+
totalApy: undefined,
|
|
87
|
+
// not have
|
|
88
|
+
tvl: totalStake.toString(),
|
|
89
|
+
unstakingPeriod: unstakingPeriod
|
|
90
|
+
},
|
|
91
|
+
maxPoolMembers: maxTopNominatorsPerCollator
|
|
92
|
+
};
|
|
93
|
+
callback(data);
|
|
94
|
+
});
|
|
95
|
+
return () => {
|
|
96
|
+
cancel = true;
|
|
97
|
+
unsub();
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Subscribe pool info */
|
|
102
|
+
|
|
103
|
+
/* Subscribe pool position */
|
|
104
|
+
|
|
105
|
+
async parseNominatorMetadata(chainInfo, address, substrateApi, nominatorState) {
|
|
106
|
+
const nominationList = [];
|
|
107
|
+
const unstakingMap = {};
|
|
108
|
+
const substrateIdentityApi = this.substrateIdentityApi;
|
|
109
|
+
let bnTotalActiveStake = _util.BN_ZERO;
|
|
110
|
+
let bnTotalStake = _util.BN_ZERO;
|
|
111
|
+
let bnTotalUnstaking = _util.BN_ZERO;
|
|
112
|
+
const _eraInfo = await substrateApi.api.query.parachainStaking.era();
|
|
113
|
+
const roundInfo = _eraInfo.toPrimitive();
|
|
114
|
+
const currentRound = roundInfo.current;
|
|
115
|
+
await Promise.all(nominatorState.nominations.map(async nomination => {
|
|
116
|
+
const [_nominationScheduledRequests, [identity], _collatorInfo, _currentBlock, _currentTimestamp] = await Promise.all([substrateApi.api.query.parachainStaking.nominationScheduledRequests(nomination.owner), (0, _utils2.parseIdentity)(substrateIdentityApi, nomination.owner), substrateApi.api.query.parachainStaking.candidateInfo(nomination.owner), substrateApi.api.query.system.number(), substrateApi.api.query.timestamp.now()]);
|
|
117
|
+
const currentBlock = _currentBlock.toPrimitive();
|
|
118
|
+
const currentTimestamp = _currentTimestamp.toPrimitive();
|
|
119
|
+
const collatorInfo = _collatorInfo.toPrimitive();
|
|
120
|
+
const minNomination = collatorInfo === null || collatorInfo === void 0 ? void 0 : collatorInfo.lowestTopNominationAmount.toString();
|
|
121
|
+
const nominationScheduledRequests = _nominationScheduledRequests.toPrimitive();
|
|
122
|
+
let hasUnstaking = false;
|
|
123
|
+
let nominationStatus = _types.EarningStatus.NOT_EARNING;
|
|
124
|
+
|
|
125
|
+
// parse unstaking info
|
|
126
|
+
if (nominationScheduledRequests) {
|
|
127
|
+
for (const scheduledRequest of nominationScheduledRequests) {
|
|
128
|
+
if ((0, _utils3.reformatAddress)(scheduledRequest.nominator, 0) === (0, _utils3.reformatAddress)(address, 0)) {
|
|
129
|
+
// add network prefix
|
|
130
|
+
const isClaimable = scheduledRequest.whenExecutable - parseInt(currentRound) <= 0;
|
|
131
|
+
const remainingEra = scheduledRequest.whenExecutable - parseInt(currentRound);
|
|
132
|
+
const waitingTime = remainingEra * _constants._STAKING_ERA_LENGTH_MAP[chainInfo.slug];
|
|
133
|
+
const claimable = Object.values(scheduledRequest.action)[0];
|
|
134
|
+
|
|
135
|
+
// noted: target timestamp in parachainStaking easily volatile if block time volatile
|
|
136
|
+
const targetBlock = remainingEra * parseInt(roundInfo.length) + parseInt(roundInfo.first);
|
|
137
|
+
const remainingBlock = targetBlock - currentBlock;
|
|
138
|
+
const targetTimestampMs = remainingBlock * _constants._EXPECTED_BLOCK_TIME[chainInfo.slug] * 1000 + currentTimestamp;
|
|
139
|
+
unstakingMap[nomination.owner] = {
|
|
140
|
+
chain: chainInfo.slug,
|
|
141
|
+
status: isClaimable ? _types.UnstakingStatus.CLAIMABLE : _types.UnstakingStatus.UNLOCKING,
|
|
142
|
+
validatorAddress: nomination.owner,
|
|
143
|
+
claimable: claimable.toString(),
|
|
144
|
+
waitingTime,
|
|
145
|
+
targetTimestampMs: targetTimestampMs
|
|
146
|
+
};
|
|
147
|
+
hasUnstaking = true;
|
|
148
|
+
break; // only handle 1 scheduledRequest per collator
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const bnStake = new _util.BN(nomination.amount);
|
|
154
|
+
const bnUnstakeBalance = unstakingMap[nomination.owner] ? new _util.BN(unstakingMap[nomination.owner].claimable) : _util.BN_ZERO;
|
|
155
|
+
const bnActiveStake = bnStake.sub(bnUnstakeBalance);
|
|
156
|
+
if (bnActiveStake.gt(_util.BN_ZERO) && bnActiveStake.gte(new _util.BN(minNomination))) {
|
|
157
|
+
nominationStatus = _types.EarningStatus.EARNING_REWARD;
|
|
158
|
+
}
|
|
159
|
+
bnTotalActiveStake = bnTotalActiveStake.add(bnActiveStake);
|
|
160
|
+
bnTotalStake = bnTotalStake.add(bnStake);
|
|
161
|
+
bnTotalUnstaking = bnTotalUnstaking.add(bnUnstakeBalance);
|
|
162
|
+
nominationList.push({
|
|
163
|
+
chain: chainInfo.slug,
|
|
164
|
+
status: nominationStatus,
|
|
165
|
+
validatorAddress: nomination.owner,
|
|
166
|
+
validatorIdentity: identity,
|
|
167
|
+
activeStake: bnActiveStake.toString(),
|
|
168
|
+
hasUnstaking,
|
|
169
|
+
validatorMinStake: collatorInfo.lowestTopNominationAmount.toString()
|
|
170
|
+
});
|
|
171
|
+
}));
|
|
172
|
+
const stakingStatus = (0, _utils.getEarningStatusByNominations)(bnTotalActiveStake, nominationList);
|
|
173
|
+
const totalStake = bnTotalStake.toString();
|
|
174
|
+
const activeStake = bnTotalActiveStake.toString();
|
|
175
|
+
const unstakingBalance = bnTotalUnstaking.toString();
|
|
176
|
+
const tokenInfo = this.state.chainService.getAssetBySlug(this.nativeToken.slug);
|
|
177
|
+
await this.createWithdrawNotifications(Object.values(unstakingMap), tokenInfo, address);
|
|
178
|
+
return {
|
|
179
|
+
status: stakingStatus,
|
|
180
|
+
totalStake,
|
|
181
|
+
balanceToken: this.nativeToken.slug,
|
|
182
|
+
activeStake: activeStake,
|
|
183
|
+
unstakeBalance: unstakingBalance,
|
|
184
|
+
isBondedBefore: !!nominationList.length,
|
|
185
|
+
nominations: nominationList,
|
|
186
|
+
unstakings: Object.values(unstakingMap)
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
async subscribePoolPosition(useAddresses, resultCallback) {
|
|
190
|
+
let cancel = false;
|
|
191
|
+
const substrateApi = this.substrateApi;
|
|
192
|
+
const defaultInfo = this.baseInfo;
|
|
193
|
+
const chainInfo = this.chainInfo;
|
|
194
|
+
await substrateApi.isReady;
|
|
195
|
+
const unsub = await substrateApi.api.query.parachainStaking.nominatorState.multi(useAddresses, async ledgers => {
|
|
196
|
+
if (cancel) {
|
|
197
|
+
unsub();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (ledgers) {
|
|
201
|
+
await Promise.all(ledgers.map(async (_nominatorState, i) => {
|
|
202
|
+
const nominatorState = _nominatorState.toPrimitive();
|
|
203
|
+
const owner = (0, _utils3.reformatAddress)(useAddresses[i], 42);
|
|
204
|
+
if (nominatorState) {
|
|
205
|
+
const nominatorMetadata = await this.parseNominatorMetadata(chainInfo, owner, substrateApi, nominatorState);
|
|
206
|
+
resultCallback({
|
|
207
|
+
...defaultInfo,
|
|
208
|
+
...nominatorMetadata,
|
|
209
|
+
address: owner,
|
|
210
|
+
type: this.type
|
|
211
|
+
});
|
|
212
|
+
} else {
|
|
213
|
+
resultCallback({
|
|
214
|
+
...defaultInfo,
|
|
215
|
+
type: this.type,
|
|
216
|
+
address: owner,
|
|
217
|
+
balanceToken: this.nativeToken.slug,
|
|
218
|
+
totalStake: '0',
|
|
219
|
+
activeStake: '0',
|
|
220
|
+
unstakeBalance: '0',
|
|
221
|
+
status: _types.EarningStatus.NOT_STAKING,
|
|
222
|
+
isBondedBefore: false,
|
|
223
|
+
nominations: [],
|
|
224
|
+
unstakings: []
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
return () => {
|
|
231
|
+
cancel = true;
|
|
232
|
+
unsub();
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
async checkAccountHaveStake(useAddresses) {
|
|
236
|
+
var _substrateApi$api$que, _substrateApi$api$que2, _substrateApi$api$que3;
|
|
237
|
+
const result = [];
|
|
238
|
+
const substrateApi = await this.substrateApi.isReady;
|
|
239
|
+
const ledgers = await ((_substrateApi$api$que = substrateApi.api.query.parachainStaking) === null || _substrateApi$api$que === void 0 ? void 0 : (_substrateApi$api$que2 = _substrateApi$api$que.nominatorState) === null || _substrateApi$api$que2 === void 0 ? void 0 : (_substrateApi$api$que3 = _substrateApi$api$que2.multi) === null || _substrateApi$api$que3 === void 0 ? void 0 : _substrateApi$api$que3.call(_substrateApi$api$que2, useAddresses));
|
|
240
|
+
if (!ledgers) {
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
for (let i = 0; i < useAddresses.length; i++) {
|
|
244
|
+
const owner = useAddresses[i];
|
|
245
|
+
const nominatorState = ledgers[i].toPrimitive();
|
|
246
|
+
if (nominatorState && nominatorState.total > 0) {
|
|
247
|
+
result.push(owner);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* Subscribe pool position */
|
|
254
|
+
|
|
255
|
+
/* Get pool targets */
|
|
256
|
+
async getPoolTargets() {
|
|
257
|
+
const apiProps = await this.substrateApi.isReady;
|
|
258
|
+
const substrateIdentityApi = this.substrateIdentityApi;
|
|
259
|
+
const allCollators = [];
|
|
260
|
+
const [_allCollators, _selectedCandidates] = await Promise.all([apiProps.api.query.parachainStaking.candidateInfo.entries(),
|
|
261
|
+
// use it when energy support collatorCommission
|
|
262
|
+
// apiProps.api.query.parachainStaking.collatorCommission(),
|
|
263
|
+
apiProps.api.query.parachainStaking.selectedCandidates()]);
|
|
264
|
+
const maxNominationPerCollator = apiProps.api.consts.parachainStaking.maxTopNominationsPerCandidate.toString();
|
|
265
|
+
const selectedCollators = _selectedCandidates.toPrimitive();
|
|
266
|
+
for (const collator of _allCollators) {
|
|
267
|
+
const _collatorAddress = collator[0].toHuman();
|
|
268
|
+
const collatorAddress = _collatorAddress[0];
|
|
269
|
+
const collatorInfo = collator[1].toPrimitive();
|
|
270
|
+
const bnTotalStake = new _util.BN(collatorInfo.totalCounted);
|
|
271
|
+
const bnOwnStake = new _util.BN(collatorInfo.bond);
|
|
272
|
+
const bnOtherStake = bnTotalStake.sub(bnOwnStake);
|
|
273
|
+
const bnMinBond = new _util.BN(collatorInfo.lowestTopNominationAmount);
|
|
274
|
+
const maxNominatorRewarded = parseInt(maxNominationPerCollator);
|
|
275
|
+
if (selectedCollators.includes(collatorAddress)) {
|
|
276
|
+
allCollators.push({
|
|
277
|
+
commission: 0,
|
|
278
|
+
expectedReturn: 0,
|
|
279
|
+
address: collatorAddress,
|
|
280
|
+
totalStake: bnTotalStake.toString(),
|
|
281
|
+
ownStake: bnOwnStake.toString(),
|
|
282
|
+
otherStake: bnOtherStake.toString(),
|
|
283
|
+
nominatorCount: collatorInfo.nominationCount,
|
|
284
|
+
blocked: false,
|
|
285
|
+
isVerified: false,
|
|
286
|
+
minBond: bnMinBond.toString(),
|
|
287
|
+
chain: this.chain,
|
|
288
|
+
isCrowded: collatorInfo.nominationCount >= maxNominatorRewarded
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const extraInfoMap = {};
|
|
293
|
+
await Promise.all(allCollators.map(async collator => {
|
|
294
|
+
const [_info, [identity, isReasonable]] = await Promise.all([apiProps.api.query.parachainStaking.candidateInfo(collator.address), (0, _utils2.parseIdentity)(substrateIdentityApi, collator.address)]);
|
|
295
|
+
const rawInfo = _info.toHuman();
|
|
296
|
+
const active = (rawInfo === null || rawInfo === void 0 ? void 0 : rawInfo.status) === 'Active';
|
|
297
|
+
extraInfoMap[collator.address] = {
|
|
298
|
+
identity,
|
|
299
|
+
isVerified: isReasonable,
|
|
300
|
+
active
|
|
301
|
+
};
|
|
302
|
+
}));
|
|
303
|
+
for (const validator of allCollators) {
|
|
304
|
+
validator.blocked = !extraInfoMap[validator.address].active;
|
|
305
|
+
validator.identity = extraInfoMap[validator.address].identity;
|
|
306
|
+
validator.isVerified = extraInfoMap[validator.address].isVerified;
|
|
307
|
+
}
|
|
308
|
+
return allCollators;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/* Get pool targets */
|
|
312
|
+
|
|
313
|
+
/* Join pool action */
|
|
314
|
+
|
|
315
|
+
async createJoinExtrinsic(data, positionInfo) {
|
|
316
|
+
const {
|
|
317
|
+
amount,
|
|
318
|
+
selectedValidators
|
|
319
|
+
} = data;
|
|
320
|
+
const apiPromise = await this.substrateApi.isReady;
|
|
321
|
+
const binaryAmount = new _util.BN(amount);
|
|
322
|
+
const selectedCollatorInfo = selectedValidators[0];
|
|
323
|
+
const {
|
|
324
|
+
address: selectedCollatorAddress,
|
|
325
|
+
nominatorCount: selectedCollatorNominatorCount
|
|
326
|
+
} = selectedCollatorInfo;
|
|
327
|
+
const compoundResult = extrinsic => {
|
|
328
|
+
return Promise.resolve([extrinsic, {
|
|
329
|
+
slug: this.nativeToken.slug,
|
|
330
|
+
amount: '0'
|
|
331
|
+
}]);
|
|
332
|
+
};
|
|
333
|
+
if (!positionInfo) {
|
|
334
|
+
const extrinsic = apiPromise.api.tx.parachainStaking.nominate(selectedCollatorAddress, binaryAmount, new _util.BN(selectedCollatorNominatorCount), 0);
|
|
335
|
+
return compoundResult(extrinsic);
|
|
336
|
+
}
|
|
337
|
+
const {
|
|
338
|
+
bondedValidators,
|
|
339
|
+
nominationCount
|
|
340
|
+
} = (0, _utils.getBondedValidators)(positionInfo.nominations);
|
|
341
|
+
const parsedSelectedCollatorAddress = (0, _utils3.reformatAddress)(selectedCollatorInfo.address, 0);
|
|
342
|
+
if (!bondedValidators.includes(parsedSelectedCollatorAddress)) {
|
|
343
|
+
const extrinsic = apiPromise.api.tx.parachainStaking.nominate(selectedCollatorAddress, binaryAmount, new _util.BN(selectedCollatorNominatorCount), nominationCount);
|
|
344
|
+
return compoundResult(extrinsic);
|
|
345
|
+
} else {
|
|
346
|
+
const extrinsic = apiPromise.api.tx.parachainStaking.bondExtra(selectedCollatorAddress, binaryAmount);
|
|
347
|
+
return compoundResult(extrinsic);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/* Join pool action */
|
|
352
|
+
|
|
353
|
+
/* Leave pool action */
|
|
354
|
+
|
|
355
|
+
async handleYieldUnstake(amount, address, selectedTarget) {
|
|
356
|
+
const apiPromise = await this.substrateApi.isReady;
|
|
357
|
+
const binaryAmount = new _util.BN(amount);
|
|
358
|
+
const poolPosition = await this.getPoolPosition(address);
|
|
359
|
+
if (!selectedTarget || !poolPosition) {
|
|
360
|
+
return Promise.reject(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS));
|
|
361
|
+
}
|
|
362
|
+
const unstakeAll = (0, _utils.isUnstakeAll)(selectedTarget, poolPosition.nominations, amount);
|
|
363
|
+
let extrinsic;
|
|
364
|
+
if (!unstakeAll) {
|
|
365
|
+
extrinsic = apiPromise.api.tx.parachainStaking.scheduleNominatorUnbond(selectedTarget, binaryAmount);
|
|
366
|
+
} else {
|
|
367
|
+
extrinsic = apiPromise.api.tx.parachainStaking.scheduleRevokeNomination(selectedTarget);
|
|
368
|
+
}
|
|
369
|
+
return [_KoniTypes.ExtrinsicType.STAKING_UNBOND, extrinsic];
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/* Leave pool action */
|
|
373
|
+
|
|
374
|
+
/* Other action */
|
|
375
|
+
|
|
376
|
+
async handleYieldCancelUnstake(params) {
|
|
377
|
+
const {
|
|
378
|
+
selectedUnstaking
|
|
379
|
+
} = params;
|
|
380
|
+
const chainApi = await this.substrateApi.isReady;
|
|
381
|
+
return chainApi.api.tx.parachainStaking.cancelNominationRequest(selectedUnstaking.validatorAddress);
|
|
382
|
+
}
|
|
383
|
+
async handleYieldWithdraw(address, unstakingInfo) {
|
|
384
|
+
const collatorAddress = unstakingInfo.validatorAddress;
|
|
385
|
+
if (!collatorAddress) {
|
|
386
|
+
return Promise.reject(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS));
|
|
387
|
+
}
|
|
388
|
+
const chainApi = await this.substrateApi.isReady;
|
|
389
|
+
return chainApi.api.tx.parachainStaking.executeNominationRequest(address, collatorAddress);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/* Other actions */
|
|
393
|
+
}
|
|
394
|
+
exports.default = EnergyNativeStakingPoolHandler;
|
|
@@ -16,6 +16,12 @@ Object.defineProperty(exports, "AstarNativeStakingPoolHandler", {
|
|
|
16
16
|
return _astar.default;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
+
Object.defineProperty(exports, "EnergyNativeStakingPoolHandler", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _energy.default;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
19
25
|
Object.defineProperty(exports, "ParaNativeStakingPoolHandler", {
|
|
20
26
|
enumerable: true,
|
|
21
27
|
get: function () {
|
|
@@ -45,4 +51,5 @@ var _astar = _interopRequireDefault(require("./astar"));
|
|
|
45
51
|
var _relayChain = _interopRequireDefault(require("./relay-chain"));
|
|
46
52
|
var _paraChain = _interopRequireDefault(require("./para-chain"));
|
|
47
53
|
var _tao = _interopRequireDefault(require("./tao"));
|
|
48
|
-
var _dtao = _interopRequireDefault(require("./dtao"));
|
|
54
|
+
var _dtao = _interopRequireDefault(require("./dtao"));
|
|
55
|
+
var _energy = _interopRequireDefault(require("./energy"));
|
|
@@ -100,6 +100,9 @@ class EarningService {
|
|
|
100
100
|
if (_constants2._STAKING_CHAIN_GROUP.mythos.includes(chain)) {
|
|
101
101
|
handlers.push(new _mythos.default(this.state, chain));
|
|
102
102
|
}
|
|
103
|
+
if (_constants2._STAKING_CHAIN_GROUP.energy.includes(chain)) {
|
|
104
|
+
handlers.push(new _handlers.EnergyNativeStakingPoolHandler(this.state, chain));
|
|
105
|
+
}
|
|
103
106
|
if (_constants2._STAKING_CHAIN_GROUP.nominationPool.includes(chain)) {
|
|
104
107
|
const ahChain = ahMapChain[chain];
|
|
105
108
|
if (ahChain) {
|
|
@@ -120,6 +120,8 @@ function isActionFromValidator(stakingType, chain) {
|
|
|
120
120
|
return true;
|
|
121
121
|
} else if (_constants._STAKING_CHAIN_GROUP.mythos.includes(chain)) {
|
|
122
122
|
return true;
|
|
123
|
+
} else if (_constants._STAKING_CHAIN_GROUP.energy.includes(chain)) {
|
|
124
|
+
return true;
|
|
123
125
|
}
|
|
124
126
|
return false;
|
|
125
127
|
}
|
|
@@ -117,10 +117,10 @@ class AccountJsonHandler extends _Base.AccountBaseHandler {
|
|
|
117
117
|
name: (exists === null || exists === void 0 ? void 0 : exists.name) || (exists === null || exists === void 0 ? void 0 : exists.address) || _pair.address
|
|
118
118
|
}
|
|
119
119
|
}));
|
|
120
|
+
const _name = _pair.meta.name || '';
|
|
121
|
+
const nameExists = this.state.checkNameExists(_name);
|
|
120
122
|
_uiKeyring.keyring.restoreAccount(file, password, withMasterPassword);
|
|
121
123
|
const pair = _uiKeyring.keyring.getPair(_pair.address);
|
|
122
|
-
const _name = pair.meta.name || '';
|
|
123
|
-
const nameExists = this.state.checkNameExists(_name);
|
|
124
124
|
if (nameExists) {
|
|
125
125
|
const newName = _name.concat(' - ').concat((0, _getId.generateRandomString)());
|
|
126
126
|
_uiKeyring.keyring.saveAccountMeta(pair, {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.MYTHOS_MIGRATION_KEY = exports.EVERYTIME = void 0;
|
|
8
|
+
var _MigrateChainPatrol = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service/scripts/MigrateChainPatrol"));
|
|
8
9
|
var _ClearMetadataDatabase = _interopRequireDefault(require("./databases/ClearMetadataDatabase"));
|
|
9
10
|
var _ClearMetadataForMythos = _interopRequireDefault(require("./databases/ClearMetadataForMythos"));
|
|
10
11
|
var _MigrateAssetSetting = _interopRequireDefault(require("./databases/MigrateAssetSetting"));
|
|
@@ -74,6 +75,7 @@ var _default = {
|
|
|
74
75
|
[MYTHOS_MIGRATION_KEY]: _ClearMetadataForMythos.default,
|
|
75
76
|
// [`${EVERYTIME}-1.1.42-02`]: MigrateTransactionHistoryBySymbol
|
|
76
77
|
// [`${EVERYTIME}-1`]: AutoEnableChainsTokens
|
|
77
|
-
'1.3.42-01': _MigrateNewUnifiedAccount.default
|
|
78
|
+
'1.3.42-01': _MigrateNewUnifiedAccount.default,
|
|
79
|
+
'1.3.54-01': _MigrateChainPatrol.default
|
|
78
80
|
};
|
|
79
81
|
exports.default = _default;
|
|
@@ -17,7 +17,7 @@ const DEFAULT_AUTO_LOCK_TIME = 15;
|
|
|
17
17
|
exports.DEFAULT_AUTO_LOCK_TIME = DEFAULT_AUTO_LOCK_TIME;
|
|
18
18
|
const DEFAULT_UNLOCK_TYPE = _utils.targetIsExtension ? _KoniTypes.WalletUnlockType.ALWAYS_REQUIRED : _KoniTypes.WalletUnlockType.WHEN_NEEDED;
|
|
19
19
|
exports.DEFAULT_UNLOCK_TYPE = DEFAULT_UNLOCK_TYPE;
|
|
20
|
-
const DEFAULT_CHAIN_PATROL_ENABLE =
|
|
20
|
+
const DEFAULT_CHAIN_PATROL_ENABLE = true;
|
|
21
21
|
exports.DEFAULT_CHAIN_PATROL_ENABLE = DEFAULT_CHAIN_PATROL_ENABLE;
|
|
22
22
|
const DEFAULT_LANGUAGE = 'en';
|
|
23
23
|
exports.DEFAULT_LANGUAGE = DEFAULT_LANGUAGE;
|
package/koni/api/nft/config.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const BIT_COUNTRY_LAND_ESTATE_METADATA_API = "https://pioneer-api
|
|
|
12
12
|
export declare const BIT_COUNTRY_THUMBNAIL_RESOLVER = "https://res.cloudinary.com/ddftctzph/image/upload/c_scale,q_100,w_250/production-ipfs/asset/";
|
|
13
13
|
export declare const CF_IPFS_GATEWAY = "https://cf-ipfs.com/ipfs/";
|
|
14
14
|
export declare const ODYSSEY_ENDPOINT = "https://indexer-v2.dev.aurascan.io/api/v2/graphql";
|
|
15
|
-
export declare const VARA_SCAN_ENDPOINT = "https://nft-explorer.vara
|
|
15
|
+
export declare const VARA_SCAN_ENDPOINT = "https://nft-explorer.vara.network/graphql";
|
|
16
16
|
export declare const AVAIL_LIGHT_CLIENT_NFT = "https://indexer.availspace.app/graphql";
|
|
17
17
|
export declare const UNIQUE_SCAN_ENDPOINT = "https://api-unique.uniquescan.io/v1/graphql";
|
|
18
18
|
export declare const QUARTZ_SCAN_ENDPOINT = "https://api-quartz.uniquescan.io/v1/graphql";
|
package/koni/api/nft/config.js
CHANGED
|
@@ -26,7 +26,7 @@ export const ODYSSEY_ENDPOINT = 'https://indexer-v2.dev.aurascan.io/api/v2/graph
|
|
|
26
26
|
// export const UNIQUE_SCAN_ENDPOINT = 'https://explorer-api.unique.network/v1/graphql';
|
|
27
27
|
// export const QUARTZ_SCAN_ENDPOINT = 'https://hasura-quartz.unique.network/v1/graphql';
|
|
28
28
|
|
|
29
|
-
export const VARA_SCAN_ENDPOINT = 'https://nft-explorer.vara
|
|
29
|
+
export const VARA_SCAN_ENDPOINT = 'https://nft-explorer.vara.network/graphql';
|
|
30
30
|
export const AVAIL_LIGHT_CLIENT_NFT = 'https://indexer.availspace.app/graphql'; // 'https://indexer-nft.availspace.app/graphql';
|
|
31
31
|
|
|
32
32
|
export const UNIQUE_SCAN_ENDPOINT = 'https://api-unique.uniquescan.io/v1/graphql';
|
|
@@ -206,6 +206,8 @@ export function getYieldAvailableActionsByType(yieldPoolInfo) {
|
|
|
206
206
|
const chain = yieldPoolInfo.chain;
|
|
207
207
|
if (_STAKING_CHAIN_GROUP.para.includes(chain)) {
|
|
208
208
|
return [YieldAction.STAKE, YieldAction.UNSTAKE, YieldAction.WITHDRAW, YieldAction.CANCEL_UNSTAKE];
|
|
209
|
+
} else if (_STAKING_CHAIN_GROUP.energy.includes(chain)) {
|
|
210
|
+
return [YieldAction.STAKE, YieldAction.UNSTAKE, YieldAction.WITHDRAW, YieldAction.CANCEL_UNSTAKE];
|
|
209
211
|
} else if (_STAKING_CHAIN_GROUP.astar.includes(chain)) {
|
|
210
212
|
return [YieldAction.STAKE, YieldAction.CLAIM_REWARD, YieldAction.UNSTAKE, YieldAction.WITHDRAW];
|
|
211
213
|
} else if (_STAKING_CHAIN_GROUP.amplitude.includes(chain)) {
|
|
@@ -39,7 +39,7 @@ import { _isPosChainBridge, getClaimPosBridge } from '@subwallet/extension-base/
|
|
|
39
39
|
import { estimateXcmFee } from '@subwallet/extension-base/services/balance-service/transfer/xcm/utils';
|
|
40
40
|
import { _DEFAULT_MANTA_ZK_CHAIN, _MANTA_ZK_CHAIN_GROUP, _ZK_ASSET_PREFIX } from '@subwallet/extension-base/services/chain-service/constants';
|
|
41
41
|
import { _ChainConnectionStatus } from '@subwallet/extension-base/services/chain-service/types';
|
|
42
|
-
import { _getAssetDecimals, _getAssetSymbol, _getChainNativeTokenBasicInfo, _getContractAddressOfToken, _getEvmChainId, _isAssetSmartContractNft, _isChainBitcoinCompatible, _isChainEnabled, _isChainEvmCompatible, _isChainSubstrateCompatible, _isCustomAsset, _isLocalToken, _isMantaZkAsset, _isNativeToken, _isNativeTokenBySlug, _isPureEvmChain, _isTokenEvmSmartContract, _isTokenTransferredByBitcoin, _isTokenTransferredByCardano, _isTokenTransferredByEvm, _isTokenTransferredByTon } from '@subwallet/extension-base/services/chain-service/utils';
|
|
42
|
+
import { _getAssetDecimals, _getAssetSymbol, _getChainNativeTokenBasicInfo, _getContractAddressOfToken, _getEvmChainId, _isAssetSmartContractNft, _isChainBitcoinCompatible, _isChainCompatibleLedgerEvm, _isChainEnabled, _isChainEvmCompatible, _isChainSubstrateCompatible, _isCustomAsset, _isLocalToken, _isMantaZkAsset, _isNativeToken, _isNativeTokenBySlug, _isPureEvmChain, _isTokenEvmSmartContract, _isTokenTransferredByBitcoin, _isTokenTransferredByCardano, _isTokenTransferredByEvm, _isTokenTransferredByTon } from '@subwallet/extension-base/services/chain-service/utils';
|
|
43
43
|
import { calculateToAmountByReservePool } from '@subwallet/extension-base/services/fee-service/utils';
|
|
44
44
|
import { batchExtrinsicSetFeeHydration, getAssetHubTokensCanPayFee, getHydrationTokensCanPayFee } from '@subwallet/extension-base/services/fee-service/utils/tokenPayFee';
|
|
45
45
|
import { EXTENSION_REQUEST_URL } from '@subwallet/extension-base/services/request-service/constants';
|
|
@@ -47,7 +47,7 @@ import { DEFAULT_AUTO_LOCK_TIME } from '@subwallet/extension-base/services/setti
|
|
|
47
47
|
import { isProposalExpired, isSupportWalletConnectChain, isSupportWalletConnectNamespace } from '@subwallet/extension-base/services/wallet-connect-service/helpers';
|
|
48
48
|
import { SWStorage } from '@subwallet/extension-base/storage';
|
|
49
49
|
import { AccountsStore } from '@subwallet/extension-base/stores';
|
|
50
|
-
import { AccountSignMode, BasicTxErrorType, BasicTxWarningCode, CommonStepType, EarningProcessType, ProcessType, StakingTxErrorType, StepStatus, SwapFeeType, YieldPoolType, YieldStepType } from '@subwallet/extension-base/types';
|
|
50
|
+
import { AccountChainType, AccountSignMode, BasicTxErrorType, BasicTxWarningCode, CommonStepType, EarningProcessType, ProcessType, StakingTxErrorType, StepStatus, SwapFeeType, YieldPoolType, YieldStepType } from '@subwallet/extension-base/types';
|
|
51
51
|
import { _analyzeAddress, calculateMaxTransferable, combineAllAccountProxy, combineBitcoinFee, createPromiseHandler, createTransactionFromRLP, detectTransferTxType, filterUneconomicalUtxos, getAccountSignMode, getSizeInfo, getTransferableBitcoinUtxos, isSameAddress, isSubstrateEcdsaLedgerAssetSupported, MODULE_SUPPORT, reformatAddress, signatureToHex, transformAccounts, transformAddresses, uniqueStringArray } from '@subwallet/extension-base/utils';
|
|
52
52
|
import { parseContractInput, parseEvmRlp } from '@subwallet/extension-base/utils/eth/parseTransaction';
|
|
53
53
|
import { getId } from '@subwallet/extension-base/utils/getId';
|
|
@@ -312,6 +312,11 @@ export default class KoniExtension {
|
|
|
312
312
|
const accountProxiesFiltered = accountProxies.filter(accountProxy => {
|
|
313
313
|
var _accountProxy$account;
|
|
314
314
|
const signMode = (_accountProxy$account = accountProxy.accounts[0]) === null || _accountProxy$account === void 0 ? void 0 : _accountProxy$account.signMode;
|
|
315
|
+
if (signMode === AccountSignMode.GENERIC_LEDGER) {
|
|
316
|
+
if (accountProxy.chainTypes.includes(AccountChainType.ETHEREUM)) {
|
|
317
|
+
return _isChainCompatibleLedgerEvm(chainInfo);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
315
320
|
if (signMode === AccountSignMode.ECDSA_SUBSTRATE_LEDGER) {
|
|
316
321
|
if (actionType === ActionType.SEND_NFT) {
|
|
317
322
|
return false;
|