@subwallet/extension-base 1.3.61-0 → 1.3.62-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/staking/bonding/utils.js +1 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/utils/patch.js +2 -2
- package/cjs/services/earning-service/constants/chains.js +6 -2
- package/cjs/services/fee-service/utils/tokenPayFee.js +25 -2
- package/cjs/services/migration-service/scripts/DeleteEarningData20251010.js +21 -0
- package/cjs/services/migration-service/scripts/index.js +3 -1
- package/cjs/utils/fee/transfer.js +9 -1
- package/koni/api/staking/bonding/utils.js +2 -2
- package/package.json +11 -6
- package/packageInfo.js +1 -1
- package/services/chain-service/utils/patch.d.ts +1 -1
- package/services/chain-service/utils/patch.js +2 -2
- package/services/earning-service/constants/chains.d.ts +1 -0
- package/services/earning-service/constants/chains.js +4 -1
- package/services/fee-service/utils/tokenPayFee.js +25 -2
- package/services/migration-service/scripts/DeleteEarningData20251010.d.ts +4 -0
- package/services/migration-service/scripts/DeleteEarningData20251010.js +13 -0
- package/services/migration-service/scripts/index.js +3 -1
- package/types/balance/transfer.d.ts +1 -0
- package/utils/fee/transfer.js +9 -1
- package/utils/staticData/assetHubStaking.json +6 -1
|
@@ -396,7 +396,7 @@ function getEarningStatusByNominations(bnTotalActiveStake, nominationList) {
|
|
|
396
396
|
function getValidatorLabel(chain) {
|
|
397
397
|
if (_constants2._STAKING_CHAIN_GROUP.astar.includes(chain)) {
|
|
398
398
|
return 'dApp';
|
|
399
|
-
} else if (_constants2.
|
|
399
|
+
} else if (_constants2.RELAY_HANDLER_DIRECT_STAKING_CHAINS.includes(chain) || _constants2._STAKING_CHAIN_GROUP.bittensor.includes(chain)) {
|
|
400
400
|
return 'Validator';
|
|
401
401
|
}
|
|
402
402
|
return 'Collator';
|
package/cjs/packageInfo.js
CHANGED
|
@@ -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.118'; // update this when build chain-list
|
|
16
16
|
|
|
17
17
|
// todo: move this interface to chainlist
|
|
18
18
|
exports.ChainListVersion = ChainListVersion;
|
|
@@ -23,7 +23,7 @@ async function fetchPatchData() {
|
|
|
23
23
|
const id = setTimeout(() => {
|
|
24
24
|
clearTimeout(id);
|
|
25
25
|
resolve(null);
|
|
26
|
-
},
|
|
26
|
+
}, 2000);
|
|
27
27
|
});
|
|
28
28
|
const rs = await Promise.race([timeout, fetchPromise]);
|
|
29
29
|
if (!rs) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports._STAKING_CHAIN_GROUP = exports.TON_CHAINS = exports.ST_LIQUID_TOKEN_ABI = exports.STAKING_IDENTITY_API_SLUG = exports.MaxEraRewardPointsEras = exports.MANTA_VALIDATOR_POINTS_PER_BLOCK = exports.MANTA_MIN_DELEGATION = exports.CHANNEL_ID = void 0;
|
|
6
|
+
exports._STAKING_CHAIN_GROUP = exports.TON_CHAINS = exports.ST_LIQUID_TOKEN_ABI = exports.STAKING_IDENTITY_API_SLUG = exports.RELAY_HANDLER_DIRECT_STAKING_CHAINS = exports.MaxEraRewardPointsEras = exports.MANTA_VALIDATOR_POINTS_PER_BLOCK = exports.MANTA_MIN_DELEGATION = exports.CHANNEL_ID = void 0;
|
|
7
7
|
// Copyright 2019-2022 @subwallet/extension-base
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
|
|
@@ -28,6 +28,8 @@ const _STAKING_CHAIN_GROUP = {
|
|
|
28
28
|
mythos: ['mythos', 'muse_testnet']
|
|
29
29
|
};
|
|
30
30
|
exports._STAKING_CHAIN_GROUP = _STAKING_CHAIN_GROUP;
|
|
31
|
+
const RELAY_HANDLER_DIRECT_STAKING_CHAINS = [..._STAKING_CHAIN_GROUP.relay, ..._STAKING_CHAIN_GROUP.assetHub];
|
|
32
|
+
exports.RELAY_HANDLER_DIRECT_STAKING_CHAINS = RELAY_HANDLER_DIRECT_STAKING_CHAINS;
|
|
31
33
|
const TON_CHAINS = ['ton', 'ton_testnet'];
|
|
32
34
|
exports.TON_CHAINS = TON_CHAINS;
|
|
33
35
|
const MaxEraRewardPointsEras = 14;
|
|
@@ -43,7 +45,9 @@ exports.MANTA_MIN_DELEGATION = MANTA_MIN_DELEGATION;
|
|
|
43
45
|
const CHANNEL_ID = 7;
|
|
44
46
|
exports.CHANNEL_ID = CHANNEL_ID;
|
|
45
47
|
const STAKING_IDENTITY_API_SLUG = {
|
|
48
|
+
// @TODO: Remove polkadot then migrate
|
|
46
49
|
polkadot: 'polkadot_people',
|
|
47
|
-
|
|
50
|
+
statemine: 'peopleKusama',
|
|
51
|
+
statemint: 'polkadot_people'
|
|
48
52
|
};
|
|
49
53
|
exports.STAKING_IDENTITY_API_SLUG = STAKING_IDENTITY_API_SLUG;
|
|
@@ -32,7 +32,18 @@ async function getAssetHubTokensCanPayFee(request) {
|
|
|
32
32
|
|
|
33
33
|
// ensure nativeTokenInfo and localTokenInfo have multi-location metadata beforehand to improve performance.
|
|
34
34
|
const tokensHasBalanceSlug = Object.keys(tokensHasBalanceInfoMap);
|
|
35
|
-
const tokenInfos = tokensHasBalanceSlug.map(tokenSlug =>
|
|
35
|
+
const tokenInfos = tokensHasBalanceSlug.map(tokenSlug => {
|
|
36
|
+
const token = chainService.getAssetBySlug(tokenSlug);
|
|
37
|
+
if (!token) {
|
|
38
|
+
console.error(`[getAssetHubTokensCanPayFee] Token not found for slug: ${tokenSlug}`);
|
|
39
|
+
}
|
|
40
|
+
return token;
|
|
41
|
+
}).filter(token => {
|
|
42
|
+
if (!token) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return token.originChain === substrateApi.chainSlug && token.assetType !== _types._AssetType.NATIVE && token.metadata && token.metadata.multilocation;
|
|
46
|
+
});
|
|
36
47
|
await Promise.all(tokenInfos.map(async tokenInfo => {
|
|
37
48
|
try {
|
|
38
49
|
const tokenSlug = tokenInfo.slug;
|
|
@@ -80,7 +91,19 @@ async function getHydrationTokensCanPayFee(request) {
|
|
|
80
91
|
if (!nativePriceId) {
|
|
81
92
|
return tokensList;
|
|
82
93
|
}
|
|
83
|
-
const tokenInfos = Object.keys(tokensHasBalanceInfoMap).map(tokenSlug =>
|
|
94
|
+
const tokenInfos = Object.keys(tokensHasBalanceInfoMap).map(tokenSlug => {
|
|
95
|
+
const token = chainService.getAssetBySlug(tokenSlug);
|
|
96
|
+
if (!token) {
|
|
97
|
+
console.error(`[getHydrationTokensCanPayFee] Token not found for slug: ${tokenSlug}`);
|
|
98
|
+
}
|
|
99
|
+
return token;
|
|
100
|
+
}).filter(token => {
|
|
101
|
+
var _token$metadata;
|
|
102
|
+
if (!token) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return token.originChain === substrateApi.chainSlug && token.assetType !== _types._AssetType.NATIVE && !!((_token$metadata = token.metadata) !== null && _token$metadata !== void 0 && _token$metadata.assetId);
|
|
106
|
+
});
|
|
84
107
|
await Promise.all(tokenInfos.map(async tokenInfo => {
|
|
85
108
|
const priceId = (0, _utils._getAssetPriceId)(tokenInfo);
|
|
86
109
|
const rate = await getHydrationRate(address, nativeTokenInfo, tokenInfo);
|
|
@@ -0,0 +1,21 @@
|
|
|
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 _Base = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service/Base"));
|
|
9
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
10
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
11
|
+
|
|
12
|
+
class DeleteEarningData20251010 extends _Base.default {
|
|
13
|
+
async run() {
|
|
14
|
+
try {
|
|
15
|
+
await this.state.dbService.deleteYieldPoolInfo(['KSM___native_staking___kusama', 'KSM___nomination_pool___kusama']);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
console.error(e);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = DeleteEarningData20251010;
|
|
@@ -22,6 +22,7 @@ var _MigratePolygonUSDCProvider = _interopRequireDefault(require("./tokens/Migra
|
|
|
22
22
|
var _DeleteChain = _interopRequireDefault(require("./DeleteChain"));
|
|
23
23
|
var _DeleteChainStaking = _interopRequireDefault(require("./DeleteChainStaking"));
|
|
24
24
|
var _DeleteEarningData = _interopRequireDefault(require("./DeleteEarningData"));
|
|
25
|
+
var _DeleteEarningData2 = _interopRequireDefault(require("./DeleteEarningData20251010"));
|
|
25
26
|
var _DisableZeroBalanceTokens = _interopRequireDefault(require("./DisableZeroBalanceTokens"));
|
|
26
27
|
var _EnableVaraChain = _interopRequireDefault(require("./EnableVaraChain"));
|
|
27
28
|
var _MigrateAuthUrls = _interopRequireDefault(require("./MigrateAuthUrls"));
|
|
@@ -76,6 +77,7 @@ var _default = {
|
|
|
76
77
|
// [`${EVERYTIME}-1.1.42-02`]: MigrateTransactionHistoryBySymbol
|
|
77
78
|
// [`${EVERYTIME}-1`]: AutoEnableChainsTokens
|
|
78
79
|
'1.3.42-01': _MigrateNewUnifiedAccount.default,
|
|
79
|
-
'1.3.54-01': _MigrateChainPatrol.default
|
|
80
|
+
'1.3.54-01': _MigrateChainPatrol.default,
|
|
81
|
+
'1.3.62-01': _DeleteEarningData2.default
|
|
80
82
|
};
|
|
81
83
|
exports.default = _default;
|
|
@@ -107,6 +107,7 @@ const calculateTransferMaxTransferable = async (id, request, freeBalance, fee) =
|
|
|
107
107
|
let feeOptions;
|
|
108
108
|
let maxTransferable;
|
|
109
109
|
let error;
|
|
110
|
+
let isEvmRpcError = false;
|
|
110
111
|
const fakeAddress = '5DRewsYzhJqZXU3SRaWy1FSt5iDr875ao91aw5fjrJmDG4Ap'; // todo: move this
|
|
111
112
|
const substrateAddress = fakeAddress; // todo: move this
|
|
112
113
|
const evmAddress = (0, _util.u8aToHex)((0, _utilCrypto.addressToEvm)(fakeAddress)); // todo: move this
|
|
@@ -131,6 +132,9 @@ const calculateTransferMaxTransferable = async (id, request, freeBalance, fee) =
|
|
|
131
132
|
value,
|
|
132
133
|
fallbackFee: true
|
|
133
134
|
});
|
|
135
|
+
if (error) {
|
|
136
|
+
isEvmRpcError = true;
|
|
137
|
+
}
|
|
134
138
|
} else {
|
|
135
139
|
[transaction,, error] = await (0, _smartContract.getEVMTransactionObject)({
|
|
136
140
|
chain: srcChain.slug,
|
|
@@ -144,6 +148,9 @@ const calculateTransferMaxTransferable = async (id, request, freeBalance, fee) =
|
|
|
144
148
|
value,
|
|
145
149
|
fallbackFee: true
|
|
146
150
|
});
|
|
151
|
+
if (error) {
|
|
152
|
+
isEvmRpcError = true;
|
|
153
|
+
}
|
|
147
154
|
}
|
|
148
155
|
} else if ((0, _keyring.isTonAddress)(address) && (0, _utils2._isTokenTransferredByTon)(srcToken)) {
|
|
149
156
|
[transaction] = await (0, _tonTransfer.createTonTransaction)({
|
|
@@ -318,7 +325,8 @@ const calculateTransferMaxTransferable = async (id, request, freeBalance, fee) =
|
|
|
318
325
|
feeOptions: feeOptions,
|
|
319
326
|
feeType: feeChainType,
|
|
320
327
|
id: id,
|
|
321
|
-
error
|
|
328
|
+
error,
|
|
329
|
+
isEvmRpcError: isEvmRpcError
|
|
322
330
|
};
|
|
323
331
|
};
|
|
324
332
|
exports.calculateTransferMaxTransferable = calculateTransferMaxTransferable;
|
|
@@ -5,7 +5,7 @@ import { StakingType } from '@subwallet/extension-base/background/KoniTypes';
|
|
|
5
5
|
import { getAstarWithdrawable } from '@subwallet/extension-base/koni/api/staking/bonding/astar';
|
|
6
6
|
import { _KNOWN_CHAIN_INFLATION_PARAMS, _SUBSTRATE_DEFAULT_INFLATION_PARAMS } from '@subwallet/extension-base/services/chain-service/constants';
|
|
7
7
|
import { _getChainNativeTokenBasicInfo } from '@subwallet/extension-base/services/chain-service/utils';
|
|
8
|
-
import { _STAKING_CHAIN_GROUP } from '@subwallet/extension-base/services/earning-service/constants';
|
|
8
|
+
import { _STAKING_CHAIN_GROUP, RELAY_HANDLER_DIRECT_STAKING_CHAINS } from '@subwallet/extension-base/services/earning-service/constants';
|
|
9
9
|
import { EarningStatus, UnstakingStatus, YieldPoolType } from '@subwallet/extension-base/types';
|
|
10
10
|
import { detectTranslate, parseRawNumber, reformatAddress } from '@subwallet/extension-base/utils';
|
|
11
11
|
import { balanceFormatter, formatNumber } from '@subwallet/extension-base/utils/number';
|
|
@@ -352,7 +352,7 @@ export function getEarningStatusByNominations(bnTotalActiveStake, nominationList
|
|
|
352
352
|
export function getValidatorLabel(chain) {
|
|
353
353
|
if (_STAKING_CHAIN_GROUP.astar.includes(chain)) {
|
|
354
354
|
return 'dApp';
|
|
355
|
-
} else if (
|
|
355
|
+
} else if (RELAY_HANDLER_DIRECT_STAKING_CHAINS.includes(chain) || _STAKING_CHAIN_GROUP.bittensor.includes(chain)) {
|
|
356
356
|
return 'Validator';
|
|
357
357
|
}
|
|
358
358
|
return 'Collator';
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.3.
|
|
20
|
+
"version": "1.3.62-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -1511,6 +1511,11 @@
|
|
|
1511
1511
|
"require": "./cjs/services/migration-service/scripts/DeleteEarningData.js",
|
|
1512
1512
|
"default": "./services/migration-service/scripts/DeleteEarningData.js"
|
|
1513
1513
|
},
|
|
1514
|
+
"./services/migration-service/scripts/DeleteEarningData20251010": {
|
|
1515
|
+
"types": "./services/migration-service/scripts/DeleteEarningData20251010.d.ts",
|
|
1516
|
+
"require": "./cjs/services/migration-service/scripts/DeleteEarningData20251010.js",
|
|
1517
|
+
"default": "./services/migration-service/scripts/DeleteEarningData20251010.js"
|
|
1518
|
+
},
|
|
1514
1519
|
"./services/migration-service/scripts/DisableZeroBalanceTokens": {
|
|
1515
1520
|
"types": "./services/migration-service/scripts/DisableZeroBalanceTokens.d.ts",
|
|
1516
1521
|
"require": "./cjs/services/migration-service/scripts/DisableZeroBalanceTokens.js",
|
|
@@ -2878,11 +2883,11 @@
|
|
|
2878
2883
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
2879
2884
|
"@substrate/connect": "^0.8.9",
|
|
2880
2885
|
"@subwallet-monorepos/subwallet-services-sdk": "^0.1.8",
|
|
2881
|
-
"@subwallet/chain-list": "0.2.
|
|
2882
|
-
"@subwallet/extension-base": "^1.3.
|
|
2883
|
-
"@subwallet/extension-chains": "^1.3.
|
|
2884
|
-
"@subwallet/extension-dapp": "^1.3.
|
|
2885
|
-
"@subwallet/extension-inject": "^1.3.
|
|
2886
|
+
"@subwallet/chain-list": "0.2.118",
|
|
2887
|
+
"@subwallet/extension-base": "^1.3.62-0",
|
|
2888
|
+
"@subwallet/extension-chains": "^1.3.62-0",
|
|
2889
|
+
"@subwallet/extension-dapp": "^1.3.62-0",
|
|
2890
|
+
"@subwallet/extension-inject": "^1.3.62-0",
|
|
2886
2891
|
"@subwallet/keyring": "^0.1.13",
|
|
2887
2892
|
"@subwallet/ui-keyring": "^0.1.13",
|
|
2888
2893
|
"@ton/core": "^0.56.3",
|
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@subwallet/extension-base',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '1.3.
|
|
10
|
+
version: '1.3.62-0'
|
|
11
11
|
};
|
|
@@ -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.118";
|
|
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.118'; // update this when build chain-list
|
|
9
9
|
|
|
10
10
|
// todo: move this interface to chainlist
|
|
11
11
|
|
|
@@ -16,7 +16,7 @@ export async function fetchPatchData() {
|
|
|
16
16
|
const id = setTimeout(() => {
|
|
17
17
|
clearTimeout(id);
|
|
18
18
|
resolve(null);
|
|
19
|
-
},
|
|
19
|
+
}, 2000);
|
|
20
20
|
});
|
|
21
21
|
const rs = await Promise.race([timeout, fetchPromise]);
|
|
22
22
|
if (!rs) {
|
|
@@ -16,6 +16,7 @@ export declare const _STAKING_CHAIN_GROUP: {
|
|
|
16
16
|
energy: string[];
|
|
17
17
|
mythos: string[];
|
|
18
18
|
};
|
|
19
|
+
export declare const RELAY_HANDLER_DIRECT_STAKING_CHAINS: string[];
|
|
19
20
|
export declare const TON_CHAINS: string[];
|
|
20
21
|
export declare const MaxEraRewardPointsEras = 14;
|
|
21
22
|
export declare const ST_LIQUID_TOKEN_ABI: Record<string, any>;
|
|
@@ -21,6 +21,7 @@ export const _STAKING_CHAIN_GROUP = {
|
|
|
21
21
|
energy: ['energy_web_x_testnet', 'energy_web_x'],
|
|
22
22
|
mythos: ['mythos', 'muse_testnet']
|
|
23
23
|
};
|
|
24
|
+
export const RELAY_HANDLER_DIRECT_STAKING_CHAINS = [..._STAKING_CHAIN_GROUP.relay, ..._STAKING_CHAIN_GROUP.assetHub];
|
|
24
25
|
export const TON_CHAINS = ['ton', 'ton_testnet'];
|
|
25
26
|
export const MaxEraRewardPointsEras = 14;
|
|
26
27
|
|
|
@@ -30,6 +31,8 @@ export const MANTA_VALIDATOR_POINTS_PER_BLOCK = 20;
|
|
|
30
31
|
export const MANTA_MIN_DELEGATION = 500;
|
|
31
32
|
export const CHANNEL_ID = 7;
|
|
32
33
|
export const STAKING_IDENTITY_API_SLUG = {
|
|
34
|
+
// @TODO: Remove polkadot then migrate
|
|
33
35
|
polkadot: 'polkadot_people',
|
|
34
|
-
|
|
36
|
+
statemine: 'peopleKusama',
|
|
37
|
+
statemint: 'polkadot_people'
|
|
35
38
|
};
|
|
@@ -22,7 +22,18 @@ export async function getAssetHubTokensCanPayFee(request) {
|
|
|
22
22
|
|
|
23
23
|
// ensure nativeTokenInfo and localTokenInfo have multi-location metadata beforehand to improve performance.
|
|
24
24
|
const tokensHasBalanceSlug = Object.keys(tokensHasBalanceInfoMap);
|
|
25
|
-
const tokenInfos = tokensHasBalanceSlug.map(tokenSlug =>
|
|
25
|
+
const tokenInfos = tokensHasBalanceSlug.map(tokenSlug => {
|
|
26
|
+
const token = chainService.getAssetBySlug(tokenSlug);
|
|
27
|
+
if (!token) {
|
|
28
|
+
console.error(`[getAssetHubTokensCanPayFee] Token not found for slug: ${tokenSlug}`);
|
|
29
|
+
}
|
|
30
|
+
return token;
|
|
31
|
+
}).filter(token => {
|
|
32
|
+
if (!token) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return token.originChain === substrateApi.chainSlug && token.assetType !== _AssetType.NATIVE && token.metadata && token.metadata.multilocation;
|
|
36
|
+
});
|
|
26
37
|
await Promise.all(tokenInfos.map(async tokenInfo => {
|
|
27
38
|
try {
|
|
28
39
|
const tokenSlug = tokenInfo.slug;
|
|
@@ -70,7 +81,19 @@ export async function getHydrationTokensCanPayFee(request) {
|
|
|
70
81
|
if (!nativePriceId) {
|
|
71
82
|
return tokensList;
|
|
72
83
|
}
|
|
73
|
-
const tokenInfos = Object.keys(tokensHasBalanceInfoMap).map(tokenSlug =>
|
|
84
|
+
const tokenInfos = Object.keys(tokensHasBalanceInfoMap).map(tokenSlug => {
|
|
85
|
+
const token = chainService.getAssetBySlug(tokenSlug);
|
|
86
|
+
if (!token) {
|
|
87
|
+
console.error(`[getHydrationTokensCanPayFee] Token not found for slug: ${tokenSlug}`);
|
|
88
|
+
}
|
|
89
|
+
return token;
|
|
90
|
+
}).filter(token => {
|
|
91
|
+
var _token$metadata;
|
|
92
|
+
if (!token) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return token.originChain === substrateApi.chainSlug && token.assetType !== _AssetType.NATIVE && !!((_token$metadata = token.metadata) !== null && _token$metadata !== void 0 && _token$metadata.assetId);
|
|
96
|
+
});
|
|
74
97
|
await Promise.all(tokenInfos.map(async tokenInfo => {
|
|
75
98
|
const priceId = _getAssetPriceId(tokenInfo);
|
|
76
99
|
const rate = await getHydrationRate(address, nativeTokenInfo, tokenInfo);
|
|
@@ -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 DeleteEarningData20251010 extends BaseMigrationJob {
|
|
6
|
+
async run() {
|
|
7
|
+
try {
|
|
8
|
+
await this.state.dbService.deleteYieldPoolInfo(['KSM___native_staking___kusama', 'KSM___nomination_pool___kusama']);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
console.error(e);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -18,6 +18,7 @@ import MigratePolygonUSDCProvider from "./tokens/MigratePolygonUSDCProvider.js";
|
|
|
18
18
|
import DeleteChain from "./DeleteChain.js";
|
|
19
19
|
import DeleteChainStaking from "./DeleteChainStaking.js";
|
|
20
20
|
import DeleteEarningData from "./DeleteEarningData.js";
|
|
21
|
+
import DeleteEarningData20251010 from "./DeleteEarningData20251010.js";
|
|
21
22
|
import DisableZeroBalanceTokens from "./DisableZeroBalanceTokens.js";
|
|
22
23
|
import EnableVaraChain from "./EnableVaraChain.js";
|
|
23
24
|
import MigrateAuthUrls from "./MigrateAuthUrls.js";
|
|
@@ -67,5 +68,6 @@ export default {
|
|
|
67
68
|
// [`${EVERYTIME}-1.1.42-02`]: MigrateTransactionHistoryBySymbol
|
|
68
69
|
// [`${EVERYTIME}-1`]: AutoEnableChainsTokens
|
|
69
70
|
'1.3.42-01': MigrateNewUnifiedAccount,
|
|
70
|
-
'1.3.54-01': MigrateChainPatrol
|
|
71
|
+
'1.3.54-01': MigrateChainPatrol,
|
|
72
|
+
'1.3.62-01': DeleteEarningData20251010
|
|
71
73
|
};
|
package/utils/fee/transfer.js
CHANGED
|
@@ -96,6 +96,7 @@ export const calculateTransferMaxTransferable = async (id, request, freeBalance,
|
|
|
96
96
|
let feeOptions;
|
|
97
97
|
let maxTransferable;
|
|
98
98
|
let error;
|
|
99
|
+
let isEvmRpcError = false;
|
|
99
100
|
const fakeAddress = '5DRewsYzhJqZXU3SRaWy1FSt5iDr875ao91aw5fjrJmDG4Ap'; // todo: move this
|
|
100
101
|
const substrateAddress = fakeAddress; // todo: move this
|
|
101
102
|
const evmAddress = u8aToHex(addressToEvm(fakeAddress)); // todo: move this
|
|
@@ -120,6 +121,9 @@ export const calculateTransferMaxTransferable = async (id, request, freeBalance,
|
|
|
120
121
|
value,
|
|
121
122
|
fallbackFee: true
|
|
122
123
|
});
|
|
124
|
+
if (error) {
|
|
125
|
+
isEvmRpcError = true;
|
|
126
|
+
}
|
|
123
127
|
} else {
|
|
124
128
|
[transaction,, error] = await getEVMTransactionObject({
|
|
125
129
|
chain: srcChain.slug,
|
|
@@ -133,6 +137,9 @@ export const calculateTransferMaxTransferable = async (id, request, freeBalance,
|
|
|
133
137
|
value,
|
|
134
138
|
fallbackFee: true
|
|
135
139
|
});
|
|
140
|
+
if (error) {
|
|
141
|
+
isEvmRpcError = true;
|
|
142
|
+
}
|
|
136
143
|
}
|
|
137
144
|
} else if (isTonAddress(address) && _isTokenTransferredByTon(srcToken)) {
|
|
138
145
|
[transaction] = await createTonTransaction({
|
|
@@ -307,7 +314,8 @@ export const calculateTransferMaxTransferable = async (id, request, freeBalance,
|
|
|
307
314
|
feeOptions: feeOptions,
|
|
308
315
|
feeType: feeChainType,
|
|
309
316
|
id: id,
|
|
310
|
-
error
|
|
317
|
+
error,
|
|
318
|
+
isEvmRpcError: isEvmRpcError
|
|
311
319
|
};
|
|
312
320
|
};
|
|
313
321
|
export const calculateXcmMaxTransferable = async (id, request, freeBalance, fee) => {
|