@subwallet/extension-base 1.3.18-1 → 1.3.20-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/core/logic-validation/request.js +4 -1
- package/cjs/koni/background/handlers/Extension.js +21 -17
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +1 -1
- package/cjs/services/fee-service/service.js +3 -1
- package/core/logic-validation/request.js +4 -1
- package/koni/background/handlers/Extension.js +21 -17
- package/package.json +5 -5
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.js +1 -1
- package/services/fee-service/service.js +3 -1
|
@@ -353,7 +353,7 @@ async function validationEvmDataTransactionMiddleware(koni, url, payload) {
|
|
|
353
353
|
try {
|
|
354
354
|
const gasLimit = transaction.gas || (await evmApi.api.eth.estimateGas(transaction));
|
|
355
355
|
const id = (0, _getId.getId)();
|
|
356
|
-
const feeInfo = await koni.feeService.subscribeChainFee(id,
|
|
356
|
+
const feeInfo = await koni.feeService.subscribeChainFee(id, networkKey, 'evm');
|
|
357
357
|
const feeCombine = (0, _utils.combineEthFee)(feeInfo);
|
|
358
358
|
if (transaction.maxFeePerGas) {
|
|
359
359
|
estimateGas = new _bignumber.default(transaction.maxFeePerGas.toString()).multipliedBy(gasLimit).toFixed(0);
|
|
@@ -364,8 +364,11 @@ async function validationEvmDataTransactionMiddleware(koni, url, payload) {
|
|
|
364
364
|
const maxFee = new _bignumber.default(feeCombine.maxFeePerGas); // TODO: Need review
|
|
365
365
|
|
|
366
366
|
estimateGas = maxFee.multipliedBy(gasLimit).toFixed(0);
|
|
367
|
+
transaction.maxFeePerGas = feeCombine.maxFeePerGas;
|
|
368
|
+
transaction.maxPriorityFeePerGas = feeCombine.maxPriorityFeePerGas;
|
|
367
369
|
} else if (feeCombine.gasPrice) {
|
|
368
370
|
estimateGas = new _bignumber.default(feeCombine.gasPrice || 0).multipliedBy(gasLimit).toFixed(0);
|
|
371
|
+
transaction.maxPriorityFeePerGas = feeCombine.gasPrice;
|
|
369
372
|
}
|
|
370
373
|
}
|
|
371
374
|
} catch (e) {
|
|
@@ -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
|
@@ -272,7 +272,7 @@ const _TRANSFER_CHAIN_GROUP = {
|
|
|
272
272
|
avail: ['kate', 'goldberg_testnet'],
|
|
273
273
|
pendulum: ['pendulum', 'amplitude', 'amplitude_test', 'hydradx_main', 'bifrost', 'bifrost_dot'],
|
|
274
274
|
centrifuge: ['centrifuge'],
|
|
275
|
-
disable_transfer: ['
|
|
275
|
+
disable_transfer: ['crab', 'pangolin']
|
|
276
276
|
};
|
|
277
277
|
exports._TRANSFER_CHAIN_GROUP = _TRANSFER_CHAIN_GROUP;
|
|
278
278
|
const _BALANCE_PARSING_CHAIN_GROUP = {
|
|
@@ -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 => {
|
|
@@ -334,7 +334,7 @@ export async function validationEvmDataTransactionMiddleware(koni, url, payload)
|
|
|
334
334
|
try {
|
|
335
335
|
const gasLimit = transaction.gas || (await evmApi.api.eth.estimateGas(transaction));
|
|
336
336
|
const id = getId();
|
|
337
|
-
const feeInfo = await koni.feeService.subscribeChainFee(id,
|
|
337
|
+
const feeInfo = await koni.feeService.subscribeChainFee(id, networkKey, 'evm');
|
|
338
338
|
const feeCombine = combineEthFee(feeInfo);
|
|
339
339
|
if (transaction.maxFeePerGas) {
|
|
340
340
|
estimateGas = new BigN(transaction.maxFeePerGas.toString()).multipliedBy(gasLimit).toFixed(0);
|
|
@@ -345,8 +345,11 @@ export async function validationEvmDataTransactionMiddleware(koni, url, payload)
|
|
|
345
345
|
const maxFee = new BigN(feeCombine.maxFeePerGas); // TODO: Need review
|
|
346
346
|
|
|
347
347
|
estimateGas = maxFee.multipliedBy(gasLimit).toFixed(0);
|
|
348
|
+
transaction.maxFeePerGas = feeCombine.maxFeePerGas;
|
|
349
|
+
transaction.maxPriorityFeePerGas = feeCombine.maxPriorityFeePerGas;
|
|
348
350
|
} else if (feeCombine.gasPrice) {
|
|
349
351
|
estimateGas = new BigN(feeCombine.gasPrice || 0).multipliedBy(gasLimit).toFixed(0);
|
|
352
|
+
transaction.maxPriorityFeePerGas = feeCombine.gasPrice;
|
|
350
353
|
}
|
|
351
354
|
}
|
|
352
355
|
} 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.20-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.20-0",
|
|
2568
|
+
"@subwallet/extension-chains": "^1.3.20-0",
|
|
2569
|
+
"@subwallet/extension-dapp": "^1.3.20-0",
|
|
2570
|
+
"@subwallet/extension-inject": "^1.3.20-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.20-0'
|
|
11
11
|
};
|
|
@@ -254,7 +254,7 @@ export const _TRANSFER_CHAIN_GROUP = {
|
|
|
254
254
|
avail: ['kate', 'goldberg_testnet'],
|
|
255
255
|
pendulum: ['pendulum', 'amplitude', 'amplitude_test', 'hydradx_main', 'bifrost', 'bifrost_dot'],
|
|
256
256
|
centrifuge: ['centrifuge'],
|
|
257
|
-
disable_transfer: ['
|
|
257
|
+
disable_transfer: ['crab', 'pangolin']
|
|
258
258
|
};
|
|
259
259
|
export const _BALANCE_PARSING_CHAIN_GROUP = {
|
|
260
260
|
bobabeam: ['bobabeam', 'bobabase']
|
|
@@ -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 => {
|