@subwallet/extension-base 1.3.64-0 → 1.3.66-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/background/handlers/State.js +1 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/index.js +158 -16
- package/cjs/services/balance-service/transfer/xcm/acrossBridge/index.js +50 -4
- package/cjs/services/balance-service/transfer/xcm/index.js +7 -2
- package/cjs/services/chain-online-service/index.js +0 -3
- package/cjs/services/chain-service/index.js +6 -1
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/constants/chains.js +0 -2
- package/cjs/services/earning-service/handlers/lending/interlay.js +1 -0
- package/cjs/services/earning-service/handlers/liquid-staking/acala.js +1 -1
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +1 -1
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +1 -0
- package/cjs/services/earning-service/handlers/native-staking/tanssi.js +65 -9
- package/cjs/services/migration-service/scripts/DeleteEarningData20251105.js +21 -0
- package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251107.js +51 -0
- package/cjs/services/migration-service/scripts/OptimizeEnableToken.js +19 -0
- package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251107.js +37 -0
- package/cjs/services/migration-service/scripts/index.js +16 -8
- package/cjs/services/request-service/handler/EvmRequestHandler.js +1 -1
- package/cjs/services/transaction-service/index.js +1 -1
- package/cjs/utils/eth.js +2 -1
- package/cjs/utils/fee/transfer.js +1 -5
- package/koni/background/handlers/State.js +1 -0
- package/package.json +28 -8
- package/packageInfo.js +1 -1
- package/services/balance-service/index.d.ts +8 -0
- package/services/balance-service/index.js +158 -17
- package/services/balance-service/transfer/xcm/acrossBridge/index.d.ts +2 -0
- package/services/balance-service/transfer/xcm/acrossBridge/index.js +47 -2
- package/services/balance-service/transfer/xcm/index.js +7 -2
- package/services/chain-online-service/index.js +0 -3
- package/services/chain-service/index.d.ts +1 -0
- package/services/chain-service/index.js +6 -1
- 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.js +0 -2
- package/services/earning-service/handlers/lending/interlay.js +2 -0
- package/services/earning-service/handlers/liquid-staking/acala.js +1 -1
- package/services/earning-service/handlers/liquid-staking/bifrost.js +1 -1
- package/services/earning-service/handlers/liquid-staking/parallel.js +2 -0
- package/services/earning-service/handlers/native-staking/tanssi.js +62 -6
- package/services/migration-service/scripts/DeleteEarningData20251105.d.ts +4 -0
- package/services/migration-service/scripts/DeleteEarningData20251105.js +13 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251107.d.ts +4 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251107.js +42 -0
- package/services/migration-service/scripts/OptimizeEnableToken.d.ts +4 -0
- package/services/migration-service/scripts/OptimizeEnableToken.js +11 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251107.d.ts +4 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251107.js +29 -0
- package/services/migration-service/scripts/index.js +9 -1
- package/services/request-service/handler/EvmRequestHandler.js +1 -1
- package/services/transaction-service/index.js +1 -1
- package/types/transaction/data.d.ts +1 -1
- package/utils/eth.js +2 -1
- package/utils/fee/transfer.js +2 -6
- package/utils/staticData/buyTokenConfigs.json +0 -46
|
@@ -583,7 +583,6 @@ export class ChainService {
|
|
|
583
583
|
this.xcmRefMapSubject.next(this.xcmRefMap);
|
|
584
584
|
await this.initApis();
|
|
585
585
|
this.initAssetSettings();
|
|
586
|
-
await this.autoEnableTokens();
|
|
587
586
|
}
|
|
588
587
|
initAssetRefMap() {
|
|
589
588
|
this.dataMap.assetRefMap = AssetRefMap;
|
|
@@ -661,6 +660,12 @@ export class ChainService {
|
|
|
661
660
|
}
|
|
662
661
|
}
|
|
663
662
|
}
|
|
663
|
+
resetPopularTokenList() {
|
|
664
|
+
this.priorityTokensSubject.next({
|
|
665
|
+
token: {},
|
|
666
|
+
tokenGroup: {}
|
|
667
|
+
});
|
|
668
|
+
}
|
|
664
669
|
async enablePopularTokens() {
|
|
665
670
|
const assetSettings = this.assetSettingSubject.value;
|
|
666
671
|
const chainStateMap = this.getChainStateMap();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ChainAsset, _ChainInfo, _MultiChainAsset } from '@subwallet/chain-list/types';
|
|
2
|
-
export declare const ChainListVersion = "0.2.
|
|
2
|
+
export declare const ChainListVersion = "0.2.121";
|
|
3
3
|
export interface PatchInfo {
|
|
4
4
|
patchVersion: string;
|
|
5
5
|
appliedVersion: string;
|
|
@@ -5,7 +5,7 @@ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
|
5
5
|
const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
|
|
6
6
|
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');
|
|
7
7
|
const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
|
|
8
|
-
export const ChainListVersion = '0.2.
|
|
8
|
+
export const ChainListVersion = '0.2.121'; // update this when build chain-list
|
|
9
9
|
|
|
10
10
|
// todo: move this interface to chainlist
|
|
11
11
|
|
|
@@ -32,8 +32,6 @@ export const MANTA_VALIDATOR_POINTS_PER_BLOCK = 20;
|
|
|
32
32
|
export const MANTA_MIN_DELEGATION = 500;
|
|
33
33
|
export const CHANNEL_ID = 7;
|
|
34
34
|
export const STAKING_IDENTITY_API_SLUG = {
|
|
35
|
-
// @TODO: Remove polkadot then migrate
|
|
36
|
-
polkadot: 'polkadot_people',
|
|
37
35
|
statemine: 'peopleKusama',
|
|
38
36
|
statemint: 'polkadot_people'
|
|
39
37
|
};
|
|
@@ -8,6 +8,8 @@ import { BasicTxErrorType, EarningStatus, YieldStepType } from '@subwallet/exten
|
|
|
8
8
|
import { BN, BN_TEN, BN_ZERO } from '@polkadot/util';
|
|
9
9
|
import { fakeAddress } from "../../constants/index.js";
|
|
10
10
|
import BaseLendingPoolHandler from "./base.js";
|
|
11
|
+
|
|
12
|
+
// TODO: disable earning and stake actions but keep showing existing earning positions (currently handle on UI)
|
|
11
13
|
export default class InterlayLendingPoolHandler extends BaseLendingPoolHandler {
|
|
12
14
|
altInputAsset = 'polkadot-NATIVE-DOT';
|
|
13
15
|
derivativeAssets = ['interlay-LOCAL-qDOT'];
|
|
@@ -14,7 +14,7 @@ function convertDerivativeToken(amount, exchangeRate, decimals) {
|
|
|
14
14
|
return amount.mul(new BN(exchangeRate)).div(BN_TEN.pow(new BN(decimals)));
|
|
15
15
|
}
|
|
16
16
|
export default class AcalaLiquidStakingPoolHandler extends BaseLiquidStakingPoolHandler {
|
|
17
|
-
altInputAsset = '
|
|
17
|
+
altInputAsset = 'statemint-NATIVE-DOT';
|
|
18
18
|
derivativeAssets = ['acala-LOCAL-LDOT'];
|
|
19
19
|
inputAsset = 'acala-LOCAL-DOT';
|
|
20
20
|
rewardAssets = ['acala-LOCAL-DOT'];
|
|
@@ -14,7 +14,7 @@ const STATS_URL = 'https://dapi.bifrost.io/api/site';
|
|
|
14
14
|
const BIFROST_GRAPHQL_ENDPOINT = 'https://bifrost-subsql.liebi.com/v1/graphql';
|
|
15
15
|
const BIFROST_EXCHANGE_RATE_REQUEST = 'query MyQuery{slp_polkadot_ratio(limit:1 where:{key:{_eq:"0"}} order_by:{timestamp:desc_nulls_first}){ratio key timestamp total_issuance token_pool}}';
|
|
16
16
|
export default class BifrostLiquidStakingPoolHandler extends BaseLiquidStakingPoolHandler {
|
|
17
|
-
altInputAsset = '
|
|
17
|
+
altInputAsset = 'statemint-NATIVE-DOT';
|
|
18
18
|
derivativeAssets = ['bifrost_dot-LOCAL-vDOT'];
|
|
19
19
|
inputAsset = 'bifrost_dot-LOCAL-DOT';
|
|
20
20
|
rewardAssets = ['bifrost_dot-LOCAL-DOT'];
|
|
@@ -8,6 +8,8 @@ import { fakeAddress } from '@subwallet/extension-base/services/earning-service/
|
|
|
8
8
|
import { EarningStatus, UnstakingStatus, YieldStepType } from '@subwallet/extension-base/types';
|
|
9
9
|
import { BN, BN_TEN, BN_ZERO } from '@polkadot/util';
|
|
10
10
|
import BaseLiquidStakingPoolHandler from "./base.js";
|
|
11
|
+
|
|
12
|
+
// TODO: disable earning and stake actions but keep showing existing earning positions (currently handle on UI)
|
|
11
13
|
export default class ParallelLiquidStakingPoolHandler extends BaseLiquidStakingPoolHandler {
|
|
12
14
|
altInputAsset = 'polkadot-NATIVE-DOT';
|
|
13
15
|
derivativeAssets = ['parallel-LOCAL-sDOT'];
|
|
@@ -3,10 +3,33 @@
|
|
|
3
3
|
|
|
4
4
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
5
5
|
import { APIItemState, ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
6
|
+
import { _getAssetDecimals } from '@subwallet/extension-base/services/chain-service/utils';
|
|
6
7
|
import { BasicTxErrorType, EarningStatus } from '@subwallet/extension-base/types';
|
|
8
|
+
import { formatNumber } from '@subwallet/extension-base/utils';
|
|
7
9
|
import BigN from 'bignumber.js';
|
|
8
10
|
import { parseIdentity } from "../../utils/index.js";
|
|
9
11
|
import BaseParaNativeStakingPoolHandler from "./base-para.js";
|
|
12
|
+
// Constants
|
|
13
|
+
const sequencersPerAppchain = new BigN(5);
|
|
14
|
+
const rewardsForStakers = new BigN(0.8);
|
|
15
|
+
const blocksPerYear = new BigN(5256000); // 6 seconds block time hence 365 * 24 * 60 * 60 / 6 (5.256.000) blocks per year
|
|
16
|
+
|
|
17
|
+
function calculateCollatorApy(rewardsPerBlock, totalStake, nativeTokenDecimals) {
|
|
18
|
+
const rewardsPerChainPerYear = new BigN(rewardsPerBlock).times(blocksPerYear);
|
|
19
|
+
const rewardsPerSequencerPerYear = rewardsPerChainPerYear.div(sequencersPerAppchain);
|
|
20
|
+
const rewardsForStakersPerSequencerPerYear = rewardsPerSequencerPerYear.times(rewardsForStakers);
|
|
21
|
+
const formattedTotalStake = formatNumber(totalStake.toString(), nativeTokenDecimals);
|
|
22
|
+
if (formattedTotalStake === '0') {
|
|
23
|
+
return new BigN(0);
|
|
24
|
+
}
|
|
25
|
+
return rewardsForStakersPerSequencerPerYear.times(100).div(formattedTotalStake);
|
|
26
|
+
}
|
|
27
|
+
async function getActiveCollators(api) {
|
|
28
|
+
const collatorAssignment = await api.query.tanssiCollatorAssignment.collatorContainerChain();
|
|
29
|
+
const activeCollatorContainerChain = collatorAssignment.toPrimitive();
|
|
30
|
+
const activeCollators = Object.values(activeCollatorContainerChain.containerChains || {}).flat().map(c => c.toString());
|
|
31
|
+
return activeCollators;
|
|
32
|
+
}
|
|
10
33
|
function perbillToPercentBn(perbill) {
|
|
11
34
|
const raw = new BigN((perbill === null || perbill === void 0 ? void 0 : perbill.toString()) || '0');
|
|
12
35
|
const bnPercent = raw.multipliedBy(new BigN(100)).div(new BigN(1000000000));
|
|
@@ -124,9 +147,18 @@ export default class TanssiNativeStakingPoolHandler extends BaseParaNativeStakin
|
|
|
124
147
|
async subscribePoolInfo(callback) {
|
|
125
148
|
let cancel = false;
|
|
126
149
|
const defaultCallback = async () => {
|
|
127
|
-
const
|
|
128
|
-
const activeConfig = (await
|
|
150
|
+
const chainApi = await this.substrateApi.isReady;
|
|
151
|
+
const activeConfig = (await chainApi.api.query.collatorConfiguration.activeConfig()).toPrimitive();
|
|
129
152
|
const maxCollators = activeConfig.maxCollators;
|
|
153
|
+
const chainsToRewardOpt = await chainApi.api.query.inflationRewards.chainsToReward();
|
|
154
|
+
const chainsToReward = chainsToRewardOpt.toPrimitive();
|
|
155
|
+
const rewardsPerBlock = chainsToReward.rewardsPerChain;
|
|
156
|
+
const formatRewardsPerBlock = formatNumber(rewardsPerBlock, _getAssetDecimals(this.nativeToken));
|
|
157
|
+
const candidates = await chainApi.api.query.pooledStaking.sortedEligibleCandidates();
|
|
158
|
+
const activeCollators = await getActiveCollators(chainApi.api);
|
|
159
|
+
const decimals = _getAssetDecimals(this.nativeToken);
|
|
160
|
+
const apyList = candidates.filter(c => activeCollators.includes(c.candidate.toString())).map(c => calculateCollatorApy(formatRewardsPerBlock, new BigN(c.stake.toString()), decimals));
|
|
161
|
+
const totalApy = apyList.length ? BigN.max(...apyList).toNumber() : 0;
|
|
130
162
|
const data = {
|
|
131
163
|
...this.baseInfo,
|
|
132
164
|
type: this.type,
|
|
@@ -147,7 +179,8 @@ export default class TanssiNativeStakingPoolHandler extends BaseParaNativeStakin
|
|
|
147
179
|
},
|
|
148
180
|
era: 0,
|
|
149
181
|
eraTime: 6 / 3600,
|
|
150
|
-
unstakingPeriod: 12
|
|
182
|
+
unstakingPeriod: 12,
|
|
183
|
+
totalApy
|
|
151
184
|
}
|
|
152
185
|
};
|
|
153
186
|
if (!cancel) {
|
|
@@ -165,10 +198,10 @@ export default class TanssiNativeStakingPoolHandler extends BaseParaNativeStakin
|
|
|
165
198
|
/* Subscribe pool position */
|
|
166
199
|
|
|
167
200
|
async subscribePoolPosition(useAddresses, onUpdate) {
|
|
168
|
-
const substrateApi = this.substrateApi;
|
|
169
|
-
await substrateApi.isReady;
|
|
201
|
+
const substrateApi = await this.substrateApi.isReady;
|
|
170
202
|
let cancel = false;
|
|
171
203
|
const intervalIds = [];
|
|
204
|
+
const activeCollators = await getActiveCollators(substrateApi.api);
|
|
172
205
|
for (const delegator of useAddresses) {
|
|
173
206
|
const fetchAndUpdate = async () => {
|
|
174
207
|
if (cancel) {
|
|
@@ -230,6 +263,19 @@ export default class TanssiNativeStakingPoolHandler extends BaseParaNativeStakin
|
|
|
230
263
|
validatorMinStake: '0'
|
|
231
264
|
});
|
|
232
265
|
}
|
|
266
|
+
let status;
|
|
267
|
+
if (nominations.length === 0) {
|
|
268
|
+
status = EarningStatus.NOT_STAKING;
|
|
269
|
+
} else {
|
|
270
|
+
const activeCount = nominations.filter(n => activeCollators.includes(n.validatorAddress)).length;
|
|
271
|
+
if (activeCount === 0) {
|
|
272
|
+
status = EarningStatus.WAITING;
|
|
273
|
+
} else if (activeCount < nominations.length) {
|
|
274
|
+
status = EarningStatus.PARTIALLY_EARNING;
|
|
275
|
+
} else {
|
|
276
|
+
status = EarningStatus.EARNING_REWARD;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
233
279
|
onUpdate({
|
|
234
280
|
...this.baseInfo,
|
|
235
281
|
type: this.type,
|
|
@@ -238,7 +284,7 @@ export default class TanssiNativeStakingPoolHandler extends BaseParaNativeStakin
|
|
|
238
284
|
totalStake: bnTotalStake.toString(),
|
|
239
285
|
activeStake: bnActiveStake.toString(),
|
|
240
286
|
unstakeBalance: bnUnstakeBalance.toString(),
|
|
241
|
-
status
|
|
287
|
+
status,
|
|
242
288
|
isBondedBefore: nominations.length > 0,
|
|
243
289
|
nominations,
|
|
244
290
|
unstakings: [],
|
|
@@ -289,6 +335,11 @@ export default class TanssiNativeStakingPoolHandler extends BaseParaNativeStakin
|
|
|
289
335
|
candidateSummariesMap[address] = summary.toJSON();
|
|
290
336
|
});
|
|
291
337
|
const candidateAddresses = candidates.map(c => c.candidate.toString());
|
|
338
|
+
const activeCollators = await getActiveCollators(chainApi.api);
|
|
339
|
+
const chainsToRewardOpt = await chainApi.api.query.inflationRewards.chainsToReward();
|
|
340
|
+
const chainsToReward = chainsToRewardOpt.toPrimitive();
|
|
341
|
+
const rewardsPerBlock = chainsToReward.rewardsPerChain;
|
|
342
|
+
const formatRewardsPerBlock = formatNumber(rewardsPerBlock, _getAssetDecimals(this.nativeToken));
|
|
292
343
|
const targets = await Promise.all(candidates.map(async c => {
|
|
293
344
|
const address = c.candidate.toString();
|
|
294
345
|
const totalStake = new BigN(c.stake.toString());
|
|
@@ -299,6 +350,10 @@ export default class TanssiNativeStakingPoolHandler extends BaseParaNativeStakin
|
|
|
299
350
|
const ownStake = ownStakeInfo ? new BigN(ownStakeInfo.totalStake) : new BigN(0);
|
|
300
351
|
const otherStake = BigN.max(totalStake.minus(ownStake), 0);
|
|
301
352
|
const [identity, isReasonable] = await parseIdentity(this.substrateApi, address);
|
|
353
|
+
let apy = new BigN(0);
|
|
354
|
+
if (activeCollators.includes(address)) {
|
|
355
|
+
apy = calculateCollatorApy(formatRewardsPerBlock, totalStake, _getAssetDecimals(this.nativeToken));
|
|
356
|
+
}
|
|
302
357
|
const validator = {
|
|
303
358
|
address,
|
|
304
359
|
chain: this.chain,
|
|
@@ -311,6 +366,7 @@ export default class TanssiNativeStakingPoolHandler extends BaseParaNativeStakin
|
|
|
311
366
|
blocked: false,
|
|
312
367
|
isVerified: isReasonable,
|
|
313
368
|
isCrowded: false,
|
|
369
|
+
expectedReturn: apy.toNumber(),
|
|
314
370
|
identity
|
|
315
371
|
};
|
|
316
372
|
return validator;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';
|
|
5
|
+
export default class DeleteEarningData20251105 extends BaseMigrationJob {
|
|
6
|
+
async run() {
|
|
7
|
+
try {
|
|
8
|
+
await this.state.dbService.deleteYieldPoolInfo(['DOT___native_staking___polkadot', 'DOT___nomination_pool___polkadot']);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
console.error(e);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';
|
|
5
|
+
export default class MigrateTransactionHistoryBySymbol20251107 extends BaseMigrationJob {
|
|
6
|
+
async run() {
|
|
7
|
+
const state = this.state;
|
|
8
|
+
try {
|
|
9
|
+
const changeSlugsMap = {
|
|
10
|
+
'bittensor-LOCAL-ف': 'bittensor-LOCAL-ㄴ'
|
|
11
|
+
};
|
|
12
|
+
const allTxs = [];
|
|
13
|
+
await Promise.all(Object.entries(changeSlugsMap).map(async ([oldSlug, newSlug], i) => {
|
|
14
|
+
const oldSlugSplit = oldSlug.split('-');
|
|
15
|
+
const oldChainSlug = oldSlugSplit[0];
|
|
16
|
+
const oldSymbolSlug = oldSlugSplit[2];
|
|
17
|
+
const newSlugSplit = newSlug.split('-');
|
|
18
|
+
const newSymbolSlug = newSlugSplit[2];
|
|
19
|
+
const filterTransactions = await state.dbService.stores.transaction.table.where({
|
|
20
|
+
chain: oldChainSlug
|
|
21
|
+
}).and(tx => {
|
|
22
|
+
var _tx$amount;
|
|
23
|
+
return ((_tx$amount = tx.amount) === null || _tx$amount === void 0 ? void 0 : _tx$amount.symbol) === oldSymbolSlug;
|
|
24
|
+
}).toArray();
|
|
25
|
+
if (filterTransactions.length > 0) {
|
|
26
|
+
for (const transaction of filterTransactions) {
|
|
27
|
+
if (transaction.amount && transaction.amount.symbol === oldSymbolSlug) {
|
|
28
|
+
transaction.amount.symbol = newSymbolSlug;
|
|
29
|
+
}
|
|
30
|
+
if (transaction.fee && transaction.fee.symbol === oldSymbolSlug) {
|
|
31
|
+
transaction.fee.symbol = newSymbolSlug;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
allTxs.push(...filterTransactions);
|
|
36
|
+
}));
|
|
37
|
+
await state.dbService.stores.transaction.table.bulkPut(allTxs);
|
|
38
|
+
} catch (e) {
|
|
39
|
+
this.logger.error(e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';
|
|
5
|
+
export default class OptimizeEnableToken extends BaseMigrationJob {
|
|
6
|
+
async run() {
|
|
7
|
+
// Reset the hasOptimizedTokens flag to allow re-optimize tokens
|
|
8
|
+
this.state.balanceService.enableOptimizeTokenPromise();
|
|
9
|
+
return Promise.resolve();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';
|
|
5
|
+
export default class MigrateAssetSetting20251107 extends BaseMigrationJob {
|
|
6
|
+
async run() {
|
|
7
|
+
try {
|
|
8
|
+
const changeSlugsMap = {
|
|
9
|
+
'bittensor-LOCAL-ف': 'bittensor-LOCAL-ㄴ'
|
|
10
|
+
};
|
|
11
|
+
const assetSetting = await this.state.chainService.getAssetSettings();
|
|
12
|
+
const migratedAssetSetting = {};
|
|
13
|
+
for (const [oldSlug, newSlug] of Object.entries(changeSlugsMap)) {
|
|
14
|
+
if (Object.keys(assetSetting).includes(oldSlug)) {
|
|
15
|
+
const isVisible = assetSetting[oldSlug].visible;
|
|
16
|
+
migratedAssetSetting[newSlug] = {
|
|
17
|
+
visible: isVisible
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
this.state.chainService.setAssetSettings({
|
|
22
|
+
...assetSetting,
|
|
23
|
+
...migratedAssetSetting
|
|
24
|
+
});
|
|
25
|
+
} catch (e) {
|
|
26
|
+
console.error(e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import MigrateAssetSetting20251107 from '@subwallet/extension-base/services/migration-service/scripts/databases/MigrateAssetSetting20251107';
|
|
4
5
|
import MigrateChainPatrol from '@subwallet/extension-base/services/migration-service/scripts/MigrateChainPatrol';
|
|
6
|
+
import MigrateTransactionHistoryBySymbol20251107 from '@subwallet/extension-base/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251107';
|
|
5
7
|
import ClearMetadataDatabase from "./databases/ClearMetadataDatabase.js";
|
|
6
8
|
import ClearMetadataForMythos from "./databases/ClearMetadataForMythos.js";
|
|
7
9
|
import MigrateAssetSetting from "./databases/MigrateAssetSetting.js";
|
|
@@ -20,6 +22,7 @@ import DeleteChain from "./DeleteChain.js";
|
|
|
20
22
|
import DeleteChainStaking from "./DeleteChainStaking.js";
|
|
21
23
|
import DeleteEarningData from "./DeleteEarningData.js";
|
|
22
24
|
import DeleteEarningData20251010 from "./DeleteEarningData20251010.js";
|
|
25
|
+
import DeleteEarningData20251105 from "./DeleteEarningData20251105.js";
|
|
23
26
|
import DisableZeroBalanceTokens from "./DisableZeroBalanceTokens.js";
|
|
24
27
|
import EnableVaraChain from "./EnableVaraChain.js";
|
|
25
28
|
import MigrateAuthUrls from "./MigrateAuthUrls.js";
|
|
@@ -32,6 +35,7 @@ import MigrateTransactionHistoryBridge from "./MigrateTransactionHistoryBridge.j
|
|
|
32
35
|
import MigrateTransactionHistoryBySymbol from "./MigrateTransactionHistoryBySymbol.js";
|
|
33
36
|
import MigrateTransactionHistoryBySymbol20251027 from "./MigrateTransactionHistoryBySymbol20251027.js";
|
|
34
37
|
import MigrateWalletReference from "./MigrateWalletReference.js";
|
|
38
|
+
import OptimizeEnableToken from "./OptimizeEnableToken.js";
|
|
35
39
|
export const EVERYTIME = '__everytime__';
|
|
36
40
|
export const MYTHOS_MIGRATION_KEY = '1.3.21-01';
|
|
37
41
|
export default {
|
|
@@ -72,6 +76,10 @@ export default {
|
|
|
72
76
|
'1.3.42-01': MigrateNewUnifiedAccount,
|
|
73
77
|
'1.3.54-01': MigrateChainPatrol,
|
|
74
78
|
'1.3.62-01': DeleteEarningData20251010,
|
|
79
|
+
'1.3.58-01': OptimizeEnableToken,
|
|
75
80
|
'1.3.64-01': MigrateAssetSetting20251027,
|
|
76
|
-
'1.3.64-02': MigrateTransactionHistoryBySymbol20251027
|
|
81
|
+
'1.3.64-02': MigrateTransactionHistoryBySymbol20251027,
|
|
82
|
+
'1.3.65-01': DeleteEarningData20251105,
|
|
83
|
+
'1.3.66-01': MigrateAssetSetting20251107,
|
|
84
|
+
'1.3.66-02': MigrateTransactionHistoryBySymbol20251107
|
|
77
85
|
};
|
|
@@ -194,7 +194,7 @@ export default class EvmRequestHandler {
|
|
|
194
194
|
const params = {
|
|
195
195
|
...transaction,
|
|
196
196
|
gas: anyNumberToBN(gas).toNumber(),
|
|
197
|
-
value: anyNumberToBN(value).
|
|
197
|
+
value: anyNumberToBN(value).toFixed(),
|
|
198
198
|
gasPrice: anyNumberToBN(gasPrice).toNumber(),
|
|
199
199
|
gasLimit: anyNumberToBN(estimateGas).toNumber(),
|
|
200
200
|
maxFeePerGas: anyNumberToBN(maxFeePerGas).toNumber(),
|
|
@@ -1416,7 +1416,7 @@ export default class TransactionService {
|
|
|
1416
1416
|
maxPriorityFeePerGas: anyNumberToBN(payload.maxPriorityFeePerGas).toNumber(),
|
|
1417
1417
|
gasLimit: anyNumberToBN(payload.gas).toNumber(),
|
|
1418
1418
|
to: payload.to,
|
|
1419
|
-
value: anyNumberToBN(payload.value).
|
|
1419
|
+
value: anyNumberToBN(payload.value).toFixed(),
|
|
1420
1420
|
data: payload.data,
|
|
1421
1421
|
chainId: payload.chainId
|
|
1422
1422
|
};
|
package/utils/eth.js
CHANGED
|
@@ -25,12 +25,13 @@ export class Transaction {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
export const anyNumberToBN = value => {
|
|
28
|
+
// TODO: Be careful when using .toNumber() outside this function. It may not round exactly for very large numbers.
|
|
28
29
|
if (typeof value === 'string' || typeof value === 'number') {
|
|
29
30
|
return new BigN(value);
|
|
30
31
|
} else if (typeof value === 'undefined') {
|
|
31
32
|
return new BigN(0);
|
|
32
33
|
} else {
|
|
33
|
-
return new BigN(value.
|
|
34
|
+
return new BigN(value.toString());
|
|
34
35
|
}
|
|
35
36
|
};
|
|
36
37
|
export const createTransactionFromRLP = rlp => {
|
package/utils/fee/transfer.js
CHANGED
|
@@ -10,7 +10,7 @@ import { getERC20TransactionObject, getEVMTransactionObject } from '@subwallet/e
|
|
|
10
10
|
import { createSubstrateExtrinsic } from '@subwallet/extension-base/services/balance-service/transfer/token';
|
|
11
11
|
import { createTonTransaction } from '@subwallet/extension-base/services/balance-service/transfer/ton-transfer';
|
|
12
12
|
import { createAcrossBridgeExtrinsic, createAvailBridgeExtrinsicFromAvail, createAvailBridgeTxFromEth, createPolygonBridgeExtrinsic, createSnowBridgeExtrinsic, createXcmExtrinsicV2 } from '@subwallet/extension-base/services/balance-service/transfer/xcm';
|
|
13
|
-
import { _isAcrossChainBridge, _isAcrossTestnetBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/acrossBridge';
|
|
13
|
+
import { _isAcrossChainBridge, _isAcrossTestnetBridge, getAcrossSendingValue } from '@subwallet/extension-base/services/balance-service/transfer/xcm/acrossBridge';
|
|
14
14
|
import { isAvailChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge';
|
|
15
15
|
import { _isPolygonChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/polygonBridge';
|
|
16
16
|
import { _isPosChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge';
|
|
@@ -375,11 +375,7 @@ export const calculateXcmMaxTransferable = async (id, request, freeBalance, fee)
|
|
|
375
375
|
funcCreateExtrinsic = createPolygonBridgeExtrinsic;
|
|
376
376
|
} else if (isAcrossBridgeTransfer) {
|
|
377
377
|
funcCreateExtrinsic = createAcrossBridgeExtrinsic;
|
|
378
|
-
|
|
379
|
-
params.sendingValue = BigN(0.0037).shiftedBy(_getAssetDecimals(srcToken)).toFixed(0, 1);
|
|
380
|
-
} else {
|
|
381
|
-
params.sendingValue = BigN(1).shiftedBy(_getAssetDecimals(srcToken)).toFixed(0, 1);
|
|
382
|
-
}
|
|
378
|
+
params.sendingValue = await getAcrossSendingValue(srcChain, srcToken, destChain, _isAcrossTestnetBridge(srcChain.slug));
|
|
383
379
|
} else if (isSnowBridgeEvmTransfer) {
|
|
384
380
|
funcCreateExtrinsic = createSnowBridgeExtrinsic;
|
|
385
381
|
} else if (isAvailBridgeFromEvm) {
|
|
@@ -1,50 +1,4 @@
|
|
|
1
1
|
[
|
|
2
|
-
{
|
|
3
|
-
"serviceInfo": {
|
|
4
|
-
"transak": {
|
|
5
|
-
"network": "mainnet",
|
|
6
|
-
"symbol": "DOT",
|
|
7
|
-
"isSuspended": false
|
|
8
|
-
},
|
|
9
|
-
"banxa": {
|
|
10
|
-
"network": "DOT",
|
|
11
|
-
"symbol": "DOT",
|
|
12
|
-
"isSuspended": false
|
|
13
|
-
},
|
|
14
|
-
"coinbase": {
|
|
15
|
-
"network": "polkadot",
|
|
16
|
-
"symbol": "DOT",
|
|
17
|
-
"isSuspended": false
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"network": "polkadot",
|
|
21
|
-
"slug": "polkadot-NATIVE-DOT",
|
|
22
|
-
"symbol": "DOT",
|
|
23
|
-
"support": "SUBSTRATE"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"serviceInfo": {
|
|
27
|
-
"transak": {
|
|
28
|
-
"network": "mainnet",
|
|
29
|
-
"symbol": "KSM",
|
|
30
|
-
"isSuspended": false
|
|
31
|
-
},
|
|
32
|
-
"banxa": {
|
|
33
|
-
"network": "KSM",
|
|
34
|
-
"symbol": "KSM",
|
|
35
|
-
"isSuspended": false
|
|
36
|
-
},
|
|
37
|
-
"coinbase": {
|
|
38
|
-
"network": "kusama",
|
|
39
|
-
"symbol": "KSM",
|
|
40
|
-
"isSuspended": false
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"network": "kusama",
|
|
44
|
-
"slug": "kusama-NATIVE-KSM",
|
|
45
|
-
"symbol": "KSM",
|
|
46
|
-
"support": "SUBSTRATE"
|
|
47
|
-
},
|
|
48
2
|
{
|
|
49
3
|
"serviceInfo": {
|
|
50
4
|
"transak": {
|