@subwallet/extension-base 1.1.48-0 → 1.1.49-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/constants/index.js +1 -1
- package/cjs/koni/background/handlers/Extension.js +3 -3
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +4 -7
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/koni/background/handlers/Extension.js +3 -3
- package/package.json +5 -5
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/substrate/index.js +4 -7
package/cjs/constants/index.js
CHANGED
|
@@ -113,7 +113,7 @@ const IGNORE_QR_SIGNER = [];
|
|
|
113
113
|
exports.IGNORE_QR_SIGNER = IGNORE_QR_SIGNER;
|
|
114
114
|
const XCM_MIN_AMOUNT_RATIO = 1.2;
|
|
115
115
|
exports.XCM_MIN_AMOUNT_RATIO = XCM_MIN_AMOUNT_RATIO;
|
|
116
|
-
const XCM_FEE_RATIO =
|
|
116
|
+
const XCM_FEE_RATIO = 2;
|
|
117
117
|
exports.XCM_FEE_RATIO = XCM_FEE_RATIO;
|
|
118
118
|
const GAS_PRICE_RATIO = 1 + 2 / 100;
|
|
119
119
|
exports.GAS_PRICE_RATIO = GAS_PRICE_RATIO;
|
|
@@ -1944,7 +1944,7 @@ class KoniExtension {
|
|
|
1944
1944
|
if (!destinationTokenInfo) {
|
|
1945
1945
|
estimatedFee = '0';
|
|
1946
1946
|
} else {
|
|
1947
|
-
maxTransferable = maxTransferable.minus(new _bignumber.default(tokenInfo.minAmount || '0').multipliedBy(_constants.
|
|
1947
|
+
maxTransferable = maxTransferable.minus(new _bignumber.default(tokenInfo.minAmount || '0').multipliedBy(_constants.XCM_MIN_AMOUNT_RATIO));
|
|
1948
1948
|
const desChainInfo = chainInfoMap[destChain];
|
|
1949
1949
|
const orgChainInfo = chainInfoMap[networkKey];
|
|
1950
1950
|
const recipient = !(0, _utilCrypto.isEthereumAddress)(address) && (0, _utils2._isChainEvmCompatible)(desChainInfo) && !(0, _utils2._isChainEvmCompatible)(orgChainInfo) ? (0, _util.u8aToHex)((0, _utilCrypto.addressToEvm)(address)) : address;
|
|
@@ -2001,10 +2001,10 @@ class KoniExtension {
|
|
|
2001
2001
|
estimatedFee = '0';
|
|
2002
2002
|
console.warn('Unable to estimate fee', e);
|
|
2003
2003
|
}
|
|
2004
|
-
maxTransferable = maxTransferable.minus(new _bignumber.default(estimatedFee));
|
|
2004
|
+
maxTransferable = maxTransferable.minus(new _bignumber.default(estimatedFee).multipliedBy(isXcmTransfer ? _constants.XCM_FEE_RATIO : 1));
|
|
2005
2005
|
return {
|
|
2006
2006
|
...freeBalance,
|
|
2007
|
-
value: maxTransferable.gt(_utils4.BN_ZERO) ? maxTransferable.toFixed() || '0' : '0'
|
|
2007
|
+
value: maxTransferable.gt(_utils4.BN_ZERO) ? maxTransferable.toFixed(0) || '0' : '0'
|
|
2008
2008
|
};
|
|
2009
2009
|
}
|
|
2010
2010
|
}
|
package/cjs/packageInfo.js
CHANGED
|
@@ -284,22 +284,19 @@ async function subscribeAssetsAccountPallet(addresses, chain, api, callBack) {
|
|
|
284
284
|
// Get Token Balance
|
|
285
285
|
return await api.query.assets.account.multi(addresses.map(address => [assetIndex, address]), balances => {
|
|
286
286
|
const items = balances.map((balance, index) => {
|
|
287
|
-
|
|
288
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment
|
|
289
|
-
const bdata = balance === null || balance === void 0 ? void 0 : balance.toHuman();
|
|
287
|
+
const bdata = balance === null || balance === void 0 ? void 0 : balance.toPrimitive();
|
|
290
288
|
let frozen = _util.BN_ZERO;
|
|
291
289
|
let total = _util.BN_ZERO;
|
|
292
290
|
if (bdata) {
|
|
293
291
|
// @ts-ignore
|
|
294
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument
|
|
295
292
|
const addressBalance = new _util.BN(String(bdata === null || bdata === void 0 ? void 0 : bdata.balance).replaceAll(',', '') || '0');
|
|
296
293
|
|
|
297
294
|
// @ts-ignore
|
|
298
|
-
if (bdata !== null && bdata !== void 0 && bdata.isFrozen) {
|
|
295
|
+
if (bdata !== null && bdata !== void 0 && bdata.isFrozen || ['Blocked', 'Frozen'].includes(bdata === null || bdata === void 0 ? void 0 : bdata.status)) {
|
|
296
|
+
// Status 'Frozen' and 'Blocked' are for frozen balance
|
|
299
297
|
frozen = addressBalance;
|
|
300
|
-
} else {
|
|
301
|
-
total = addressBalance;
|
|
302
298
|
}
|
|
299
|
+
total = addressBalance;
|
|
303
300
|
}
|
|
304
301
|
const free = total.sub(frozen);
|
|
305
302
|
return {
|
package/constants/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare const ALL_GENESIS_HASH: null;
|
|
|
23
23
|
export declare const IGNORE_GET_SUBSTRATE_FEATURES_LIST: string[];
|
|
24
24
|
export declare const IGNORE_QR_SIGNER: string[];
|
|
25
25
|
export declare const XCM_MIN_AMOUNT_RATIO = 1.2;
|
|
26
|
-
export declare const XCM_FEE_RATIO =
|
|
26
|
+
export declare const XCM_FEE_RATIO = 2;
|
|
27
27
|
export declare const GAS_PRICE_RATIO: number;
|
|
28
28
|
export declare const NETWORK_MULTI_GAS_FEE: string[];
|
|
29
29
|
export declare const ORDINAL_COLLECTION = "__Ordinal__";
|
package/constants/index.js
CHANGED
|
@@ -26,7 +26,7 @@ export const ALL_GENESIS_HASH = null;
|
|
|
26
26
|
export const IGNORE_GET_SUBSTRATE_FEATURES_LIST = ['astarEvm', 'ethereum', 'ethereum_goerli', 'binance', 'binance_test', 'boba_rinkeby', 'boba', 'bobabase', 'bobabeam'];
|
|
27
27
|
export const IGNORE_QR_SIGNER = [];
|
|
28
28
|
export const XCM_MIN_AMOUNT_RATIO = 1.2;
|
|
29
|
-
export const XCM_FEE_RATIO =
|
|
29
|
+
export const XCM_FEE_RATIO = 2;
|
|
30
30
|
export const GAS_PRICE_RATIO = 1 + 2 / 100;
|
|
31
31
|
export const NETWORK_MULTI_GAS_FEE = ['*'];
|
|
32
32
|
export const ORDINAL_COLLECTION = '__Ordinal__';
|
|
@@ -1886,7 +1886,7 @@ export default class KoniExtension {
|
|
|
1886
1886
|
if (!destinationTokenInfo) {
|
|
1887
1887
|
estimatedFee = '0';
|
|
1888
1888
|
} else {
|
|
1889
|
-
maxTransferable = maxTransferable.minus(new BigN(tokenInfo.minAmount || '0').multipliedBy(
|
|
1889
|
+
maxTransferable = maxTransferable.minus(new BigN(tokenInfo.minAmount || '0').multipliedBy(XCM_MIN_AMOUNT_RATIO));
|
|
1890
1890
|
const desChainInfo = chainInfoMap[destChain];
|
|
1891
1891
|
const orgChainInfo = chainInfoMap[networkKey];
|
|
1892
1892
|
const recipient = !isEthereumAddress(address) && _isChainEvmCompatible(desChainInfo) && !_isChainEvmCompatible(orgChainInfo) ? u8aToHex(addressToEvm(address)) : address;
|
|
@@ -1943,10 +1943,10 @@ export default class KoniExtension {
|
|
|
1943
1943
|
estimatedFee = '0';
|
|
1944
1944
|
console.warn('Unable to estimate fee', e);
|
|
1945
1945
|
}
|
|
1946
|
-
maxTransferable = maxTransferable.minus(new BigN(estimatedFee));
|
|
1946
|
+
maxTransferable = maxTransferable.minus(new BigN(estimatedFee).multipliedBy(isXcmTransfer ? XCM_FEE_RATIO : 1));
|
|
1947
1947
|
return {
|
|
1948
1948
|
...freeBalance,
|
|
1949
|
-
value: maxTransferable.gt(BN_ZERO) ? maxTransferable.toFixed() || '0' : '0'
|
|
1949
|
+
value: maxTransferable.gt(BN_ZERO) ? maxTransferable.toFixed(0) || '0' : '0'
|
|
1950
1950
|
};
|
|
1951
1951
|
}
|
|
1952
1952
|
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.1.
|
|
20
|
+
"version": "1.1.49-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -1797,10 +1797,10 @@
|
|
|
1797
1797
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
1798
1798
|
"@substrate/connect": "^0.7.26",
|
|
1799
1799
|
"@subwallet/chain-list": "0.2.52",
|
|
1800
|
-
"@subwallet/extension-base": "^1.1.
|
|
1801
|
-
"@subwallet/extension-chains": "^1.1.
|
|
1802
|
-
"@subwallet/extension-dapp": "^1.1.
|
|
1803
|
-
"@subwallet/extension-inject": "^1.1.
|
|
1800
|
+
"@subwallet/extension-base": "^1.1.49-0",
|
|
1801
|
+
"@subwallet/extension-chains": "^1.1.49-0",
|
|
1802
|
+
"@subwallet/extension-dapp": "^1.1.49-0",
|
|
1803
|
+
"@subwallet/extension-inject": "^1.1.49-0",
|
|
1804
1804
|
"@subwallet/keyring": "^0.1.3",
|
|
1805
1805
|
"@subwallet/ui-keyring": "^0.1.3",
|
|
1806
1806
|
"@walletconnect/sign-client": "^2.8.4",
|
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.1.
|
|
10
|
+
version: '1.1.49-0'
|
|
11
11
|
};
|
|
@@ -276,22 +276,19 @@ async function subscribeAssetsAccountPallet(addresses, chain, api, callBack) {
|
|
|
276
276
|
// Get Token Balance
|
|
277
277
|
return await api.query.assets.account.multi(addresses.map(address => [assetIndex, address]), balances => {
|
|
278
278
|
const items = balances.map((balance, index) => {
|
|
279
|
-
|
|
280
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment
|
|
281
|
-
const bdata = balance === null || balance === void 0 ? void 0 : balance.toHuman();
|
|
279
|
+
const bdata = balance === null || balance === void 0 ? void 0 : balance.toPrimitive();
|
|
282
280
|
let frozen = BN_ZERO;
|
|
283
281
|
let total = BN_ZERO;
|
|
284
282
|
if (bdata) {
|
|
285
283
|
// @ts-ignore
|
|
286
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument
|
|
287
284
|
const addressBalance = new BN(String(bdata === null || bdata === void 0 ? void 0 : bdata.balance).replaceAll(',', '') || '0');
|
|
288
285
|
|
|
289
286
|
// @ts-ignore
|
|
290
|
-
if (bdata !== null && bdata !== void 0 && bdata.isFrozen) {
|
|
287
|
+
if (bdata !== null && bdata !== void 0 && bdata.isFrozen || ['Blocked', 'Frozen'].includes(bdata === null || bdata === void 0 ? void 0 : bdata.status)) {
|
|
288
|
+
// Status 'Frozen' and 'Blocked' are for frozen balance
|
|
291
289
|
frozen = addressBalance;
|
|
292
|
-
} else {
|
|
293
|
-
total = addressBalance;
|
|
294
290
|
}
|
|
291
|
+
total = addressBalance;
|
|
295
292
|
}
|
|
296
293
|
const free = total.sub(frozen);
|
|
297
294
|
return {
|