@subwallet/extension-base 1.3.18-1 → 1.3.19-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.
|
@@ -1484,25 +1484,29 @@ class KoniExtension {
|
|
|
1484
1484
|
return tokensCanPayFee;
|
|
1485
1485
|
}
|
|
1486
1486
|
await Promise.all(tokenInfos.map(async tokenInfo => {
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
} else {
|
|
1501
|
-
const amount = (0, _utils6.estimateTokensForPool)(feeAmount, reserve);
|
|
1502
|
-
const liquidityError = (0, _utils6.checkLiquidityForPool)(amount, reserve[0], reserve[1]);
|
|
1503
|
-
if (!liquidityError) {
|
|
1487
|
+
try {
|
|
1488
|
+
const tokenSlug = tokenInfo.slug;
|
|
1489
|
+
const reserve = await (0, _utils6.getReserveForPool)(substrateApi.api, nativeTokenInfo, tokenInfo);
|
|
1490
|
+
if (!reserve || !reserve[0] || !reserve[1] || reserve[0] === '0' || reserve[1] === '0') {
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1493
|
+
const rate = new _bignumber.default(reserve[1]).div(reserve[0]).toFixed();
|
|
1494
|
+
const tokenCanPayFee = {
|
|
1495
|
+
slug: tokenSlug,
|
|
1496
|
+
free: tokensHasBalanceInfoMap[tokenSlug].free,
|
|
1497
|
+
rate
|
|
1498
|
+
};
|
|
1499
|
+
if (feeAmount === undefined) {
|
|
1504
1500
|
tokensCanPayFee.push(tokenCanPayFee);
|
|
1501
|
+
} else {
|
|
1502
|
+
const amount = (0, _utils6.estimateTokensForPool)(feeAmount, reserve);
|
|
1503
|
+
const liquidityError = (0, _utils6.checkLiquidityForPool)(amount, reserve[0], reserve[1]);
|
|
1504
|
+
if (!liquidityError) {
|
|
1505
|
+
tokensCanPayFee.push(tokenCanPayFee);
|
|
1506
|
+
}
|
|
1505
1507
|
}
|
|
1508
|
+
} catch (e) {
|
|
1509
|
+
console.error('error when fetching pool with token', tokenInfo.slug, e);
|
|
1506
1510
|
}
|
|
1507
1511
|
}));
|
|
1508
1512
|
return tokensCanPayFee;
|
package/cjs/packageInfo.js
CHANGED
|
@@ -107,7 +107,9 @@ class FeeService {
|
|
|
107
107
|
clearInterval(interval);
|
|
108
108
|
} else {
|
|
109
109
|
const api = this.state.getEvmApi(chain);
|
|
110
|
-
|
|
110
|
+
|
|
111
|
+
// TODO: Handle case type === evm and not have api
|
|
112
|
+
if (type === 'evm' && api) {
|
|
111
113
|
(0, _utils2.calculateGasFeeParams)(api, chain).then(info => {
|
|
112
114
|
observer.next(info);
|
|
113
115
|
}).catch(e => {
|
|
@@ -1444,25 +1444,29 @@ export default class KoniExtension {
|
|
|
1444
1444
|
return tokensCanPayFee;
|
|
1445
1445
|
}
|
|
1446
1446
|
await Promise.all(tokenInfos.map(async tokenInfo => {
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
} else {
|
|
1461
|
-
const amount = estimateTokensForPool(feeAmount, reserve);
|
|
1462
|
-
const liquidityError = checkLiquidityForPool(amount, reserve[0], reserve[1]);
|
|
1463
|
-
if (!liquidityError) {
|
|
1447
|
+
try {
|
|
1448
|
+
const tokenSlug = tokenInfo.slug;
|
|
1449
|
+
const reserve = await getReserveForPool(substrateApi.api, nativeTokenInfo, tokenInfo);
|
|
1450
|
+
if (!reserve || !reserve[0] || !reserve[1] || reserve[0] === '0' || reserve[1] === '0') {
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
const rate = new BigN(reserve[1]).div(reserve[0]).toFixed();
|
|
1454
|
+
const tokenCanPayFee = {
|
|
1455
|
+
slug: tokenSlug,
|
|
1456
|
+
free: tokensHasBalanceInfoMap[tokenSlug].free,
|
|
1457
|
+
rate
|
|
1458
|
+
};
|
|
1459
|
+
if (feeAmount === undefined) {
|
|
1464
1460
|
tokensCanPayFee.push(tokenCanPayFee);
|
|
1461
|
+
} else {
|
|
1462
|
+
const amount = estimateTokensForPool(feeAmount, reserve);
|
|
1463
|
+
const liquidityError = checkLiquidityForPool(amount, reserve[0], reserve[1]);
|
|
1464
|
+
if (!liquidityError) {
|
|
1465
|
+
tokensCanPayFee.push(tokenCanPayFee);
|
|
1466
|
+
}
|
|
1465
1467
|
}
|
|
1468
|
+
} catch (e) {
|
|
1469
|
+
console.error('error when fetching pool with token', tokenInfo.slug, e);
|
|
1466
1470
|
}
|
|
1467
1471
|
}));
|
|
1468
1472
|
return tokensCanPayFee;
|
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.19-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -2564,10 +2564,10 @@
|
|
|
2564
2564
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
2565
2565
|
"@substrate/connect": "^0.8.9",
|
|
2566
2566
|
"@subwallet/chain-list": "0.2.99-beta.14",
|
|
2567
|
-
"@subwallet/extension-base": "^1.3.
|
|
2568
|
-
"@subwallet/extension-chains": "^1.3.
|
|
2569
|
-
"@subwallet/extension-dapp": "^1.3.
|
|
2570
|
-
"@subwallet/extension-inject": "^1.3.
|
|
2567
|
+
"@subwallet/extension-base": "^1.3.19-0",
|
|
2568
|
+
"@subwallet/extension-chains": "^1.3.19-0",
|
|
2569
|
+
"@subwallet/extension-dapp": "^1.3.19-0",
|
|
2570
|
+
"@subwallet/extension-inject": "^1.3.19-0",
|
|
2571
2571
|
"@subwallet/keyring": "^0.1.8-beta.0",
|
|
2572
2572
|
"@subwallet/ui-keyring": "^0.1.8-beta.0",
|
|
2573
2573
|
"@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.19-0'
|
|
11
11
|
};
|
|
@@ -101,7 +101,9 @@ export default class FeeService {
|
|
|
101
101
|
clearInterval(interval);
|
|
102
102
|
} else {
|
|
103
103
|
const api = this.state.getEvmApi(chain);
|
|
104
|
-
|
|
104
|
+
|
|
105
|
+
// TODO: Handle case type === evm and not have api
|
|
106
|
+
if (type === 'evm' && api) {
|
|
105
107
|
calculateGasFeeParams(api, chain).then(info => {
|
|
106
108
|
observer.next(info);
|
|
107
109
|
}).catch(e => {
|