@subwallet/extension-base 1.3.30-0 → 1.3.31-1

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.
Files changed (75) hide show
  1. package/background/KoniTypes.d.ts +12 -0
  2. package/cjs/constants/paraspell-chain-map.js +13 -0
  3. package/cjs/core/logic-validation/transfer.js +13 -1
  4. package/cjs/core/substrate/xcm-parser.js +5 -1
  5. package/cjs/core/utils.js +36 -15
  6. package/cjs/koni/background/handlers/Extension.js +136 -90
  7. package/cjs/koni/background/handlers/State.js +8 -1
  8. package/cjs/packageInfo.js +1 -1
  9. package/cjs/services/balance-service/helpers/process.js +27 -0
  10. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +33 -1
  11. package/cjs/services/balance-service/index.js +9 -0
  12. package/cjs/services/balance-service/transfer/xcm/acrossBridge/index.js +229 -0
  13. package/cjs/services/balance-service/transfer/xcm/index.js +96 -7
  14. package/cjs/services/balance-service/transfer/xcm/utils.js +213 -0
  15. package/cjs/services/chain-service/constants.js +2 -4
  16. package/cjs/services/chain-service/index.js +71 -17
  17. package/cjs/services/chain-service/utils/patch.js +1 -1
  18. package/cjs/services/earning-service/handlers/special.js +18 -9
  19. package/cjs/services/keyring-service/context/handlers/Ledger.js +1 -1
  20. package/cjs/services/keyring-service/context/state.js +3 -0
  21. package/cjs/services/migration-service/scripts/DisableZeroBalanceTokens.js +60 -0
  22. package/cjs/services/migration-service/scripts/EnableChain.js +1 -1
  23. package/cjs/services/migration-service/scripts/index.js +3 -2
  24. package/cjs/services/swap-service/handler/base-handler.js +24 -11
  25. package/cjs/services/transaction-service/utils.js +38 -14
  26. package/cjs/utils/fee/transfer.js +52 -28
  27. package/cjs/utils/staticData/index.js +7 -2
  28. package/constants/paraspell-chain-map.d.ts +1 -0
  29. package/constants/paraspell-chain-map.js +7 -0
  30. package/core/logic-validation/transfer.d.ts +1 -0
  31. package/core/logic-validation/transfer.js +12 -1
  32. package/core/substrate/xcm-parser.d.ts +1 -0
  33. package/core/substrate/xcm-parser.js +4 -1
  34. package/core/utils.d.ts +2 -2
  35. package/core/utils.js +36 -15
  36. package/koni/background/handlers/Extension.d.ts +1 -0
  37. package/koni/background/handlers/Extension.js +60 -15
  38. package/koni/background/handlers/State.d.ts +1 -0
  39. package/koni/background/handlers/State.js +7 -1
  40. package/package.json +23 -7
  41. package/packageInfo.js +1 -1
  42. package/services/balance-service/helpers/process.d.ts +2 -1
  43. package/services/balance-service/helpers/process.js +26 -0
  44. package/services/balance-service/helpers/subscribe/substrate/index.js +34 -2
  45. package/services/balance-service/index.js +11 -2
  46. package/services/balance-service/transfer/xcm/acrossBridge/index.d.ts +15 -0
  47. package/services/balance-service/transfer/xcm/acrossBridge/index.js +216 -0
  48. package/services/balance-service/transfer/xcm/index.d.ts +5 -1
  49. package/services/balance-service/transfer/xcm/index.js +85 -1
  50. package/services/balance-service/transfer/xcm/utils.d.ts +11 -0
  51. package/services/balance-service/transfer/xcm/utils.js +208 -0
  52. package/services/chain-service/constants.d.ts +0 -1
  53. package/services/chain-service/constants.js +1 -2
  54. package/services/chain-service/index.d.ts +9 -2
  55. package/services/chain-service/index.js +72 -18
  56. package/services/chain-service/utils/patch.js +1 -1
  57. package/services/earning-service/handlers/special.js +19 -10
  58. package/services/keyring-service/context/handlers/Ledger.js +1 -1
  59. package/services/keyring-service/context/state.d.ts +1 -0
  60. package/services/keyring-service/context/state.js +3 -0
  61. package/services/migration-service/scripts/DisableZeroBalanceTokens.d.ts +4 -0
  62. package/services/migration-service/scripts/DisableZeroBalanceTokens.js +51 -0
  63. package/services/migration-service/scripts/EnableChain.js +1 -1
  64. package/services/migration-service/scripts/index.js +3 -2
  65. package/services/swap-service/handler/base-handler.js +25 -12
  66. package/services/transaction-service/types.d.ts +3 -2
  67. package/services/transaction-service/utils.d.ts +1 -0
  68. package/services/transaction-service/utils.js +38 -15
  69. package/types/balance/transfer.d.ts +1 -0
  70. package/types/transaction/request.d.ts +7 -0
  71. package/utils/fee/transfer.d.ts +1 -0
  72. package/utils/fee/transfer.js +54 -30
  73. package/utils/staticData/index.d.ts +4 -1
  74. package/utils/staticData/index.js +5 -1
  75. package/utils/staticData/paraSpellChainMap.json +1 -0
@@ -35,6 +35,7 @@ var _smartContract = require("@subwallet/extension-base/services/balance-service
35
35
  var _token = require("@subwallet/extension-base/services/balance-service/transfer/token");
36
36
  var _tonTransfer = require("@subwallet/extension-base/services/balance-service/transfer/ton-transfer");
37
37
  var _xcm = require("@subwallet/extension-base/services/balance-service/transfer/xcm");
38
+ var _acrossBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/acrossBridge");
38
39
  var _availBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge");
39
40
  var _polygonBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/polygonBridge");
40
41
  var _posBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge");
@@ -1147,9 +1148,10 @@ class KoniExtension {
1147
1148
  owner,
1148
1149
  spenderAddress
1149
1150
  } = params;
1150
- if (!(0, _utils2.isSnowBridgeGatewayContract)(spenderAddress) && !(0, _utils2.isAvailBridgeGatewayContract)(spenderAddress)) {
1151
- throw new Error('Only SnowBridge and AvailBridge is supported'); // todo: support all ERC20 spending approval
1152
- }
1151
+
1152
+ // if (!isSnowBridgeGatewayContract(spenderAddress) && !isAvailBridgeGatewayContract(spenderAddress)) {
1153
+ // throw new Error('Only SnowBridge and AvailBridge is supported'); // todo: support all ERC20 spending approval
1154
+ // }
1153
1155
 
1154
1156
  const evmApi = this.#koniState.getEvmApi(chain);
1155
1157
  const transactionConfig = await (0, _web.getERC20SpendingApprovalTx)(spenderAddress, owner, contractAddress, evmApi, amount);
@@ -1341,7 +1343,8 @@ class KoniExtension {
1341
1343
  const receiverSendingTokenKeepAliveBalance = BigInt(_receiverSendingTokenKeepAliveBalance);
1342
1344
  const amount = BigInt(transferAmount.value);
1343
1345
  const substrateApi = this.#koniState.getSubstrateApi(chain);
1344
- const isSendingTokenSufficient = await (0, _utils._isSufficientToken)(transferTokenInfo, substrateApi);
1346
+ const sufficientChain = this.#koniState.chainService.value.sufficientChains;
1347
+ const isSendingTokenSufficient = await (0, _utils._isSufficientToken)(transferTokenInfo, substrateApi, sufficientChain);
1345
1348
  const [warnings, errors] = (0, _transfer.additionalValidateTransferForRecipient)(transferTokenInfo, nativeTokenInfo, extrinsicType, receiverSendingTokenKeepAliveBalance, amount, senderSendingTokenTransferable, receiverSystemAccountInfo, isSendingTokenSufficient);
1346
1349
  warnings.length && inputTransaction.warnings.push(...warnings);
1347
1350
  errors.length && inputTransaction.errors.push(...errors);
@@ -1393,7 +1396,7 @@ class KoniExtension {
1393
1396
  const destinationNativeTokenInfo = this.#koniState.getNativeTokenInfo(destinationNetworkKey);
1394
1397
  const destinationNativeTokenSlug = destinationNativeTokenInfo.slug;
1395
1398
  const [errors, fromKeyPair] = (0, _transfer.validateXcmTransferRequest)(destinationTokenInfo, from, value);
1396
- let extrinsic = null;
1399
+ let extrinsic;
1397
1400
  if (errors.length > 0) {
1398
1401
  return this.#koniState.transactionService.generateBeforeHandleResponseErrors(errors);
1399
1402
  }
@@ -1403,9 +1406,12 @@ class KoniExtension {
1403
1406
  const isSnowBridgeEvmTransfer = (0, _utils5._isPureEvmChain)(chainInfoMap[originNetworkKey]) && (0, _xcmParser._isSnowBridgeXcm)(chainInfoMap[originNetworkKey], chainInfoMap[destinationNetworkKey]) && !isAvailBridgeFromEvm;
1404
1407
  const isPolygonBridgeTransfer = (0, _polygonBridge._isPolygonChainBridge)(originNetworkKey, destinationNetworkKey);
1405
1408
  const isPosBridgeTransfer = (0, _posBridge._isPosChainBridge)(originNetworkKey, destinationNetworkKey);
1409
+ const isAcrossBridgeTransfer = (0, _acrossBridge._isAcrossChainBridge)(originNetworkKey, destinationNetworkKey);
1406
1410
  const extrinsicType = _KoniTypes.ExtrinsicType.TRANSFER_XCM;
1411
+ const isSubstrateXcm = !(isAvailBridgeFromEvm || isAvailBridgeFromAvail || isSnowBridgeEvmTransfer || isPolygonBridgeTransfer || isPosBridgeTransfer);
1407
1412
  const isTransferNative = this.#koniState.getNativeTokenInfo(originNetworkKey).slug === tokenSlug;
1408
1413
  const isTransferLocalTokenAndPayThatTokenAsFee = !isTransferNative && tokenSlug === tokenPayFeeSlug;
1414
+ let xcmFeeDryRun;
1409
1415
  let additionalValidator;
1410
1416
  let eventsHandler;
1411
1417
  if (fromKeyPair && destinationTokenInfo) {
@@ -1416,6 +1422,9 @@ class KoniExtension {
1416
1422
  if (isPosBridgeTransfer || isPolygonBridgeTransfer) {
1417
1423
  funcCreateExtrinsic = _xcm.createPolygonBridgeExtrinsic;
1418
1424
  type = 'evm';
1425
+ } else if (isAcrossBridgeTransfer) {
1426
+ funcCreateExtrinsic = _xcm.createAcrossBridgeExtrinsic;
1427
+ type = 'evm';
1419
1428
  } else if (isSnowBridgeEvmTransfer) {
1420
1429
  funcCreateExtrinsic = _xcm.createSnowBridgeExtrinsic;
1421
1430
  type = 'evm';
@@ -1426,7 +1435,7 @@ class KoniExtension {
1426
1435
  funcCreateExtrinsic = _xcm.createAvailBridgeExtrinsicFromAvail;
1427
1436
  type = 'substrate';
1428
1437
  } else {
1429
- funcCreateExtrinsic = _xcm.createXcmExtrinsic;
1438
+ funcCreateExtrinsic = _xcm.createXcmExtrinsicV2;
1430
1439
  type = 'substrate';
1431
1440
  }
1432
1441
  const feeInfo = await this.#koniState.feeService.subscribeChainFee((0, _getId.getId)(), originNetworkKey, type);
@@ -1445,6 +1454,19 @@ class KoniExtension {
1445
1454
  feeInfo
1446
1455
  };
1447
1456
  extrinsic = await funcCreateExtrinsic(params);
1457
+ let dryRunInfo;
1458
+ if (isSubstrateXcm) {
1459
+ dryRunInfo = await (0, _xcm.dryRunXcmExtrinsicV2)(params);
1460
+ xcmFeeDryRun = dryRunInfo.fee;
1461
+ }
1462
+ if (isAcrossBridgeTransfer) {
1463
+ const metadata = await (0, _acrossBridge.getAcrossQuote)(params);
1464
+ inputData.metadata = {
1465
+ amountOut: metadata.outputAmount,
1466
+ rate: metadata.rate,
1467
+ destChainSlug: destinationTokenInfo.slug
1468
+ };
1469
+ }
1448
1470
  if (_constants._SUPPORT_TOKEN_PAY_FEE_GROUP.hydration.includes(originNetworkKey)) {
1449
1471
  var _this$koniState$chain2, _substrateApi$api$que2;
1450
1472
  const hydrationFeeAssetId = tokenPayFeeSlug && ((_this$koniState$chain2 = this.#koniState.chainService.getAssetBySlug(tokenPayFeeSlug).metadata) === null || _this$koniState$chain2 === void 0 ? void 0 : _this$koniState$chain2.assetId);
@@ -1454,11 +1476,20 @@ class KoniExtension {
1454
1476
  extrinsic = (0, _tokenPayFee.batchExtrinsicSetFeeHydration)(substrateApi, _extrinsic, feeSetting, hydrationFeeAssetId);
1455
1477
  }
1456
1478
  additionalValidator = async inputTransaction => {
1479
+ // hotfix xcm mythos to mythos chain
1480
+ const mythosError = (0, _transfer.validateXcmMinAmountToMythos)(destinationNetworkKey, destinationTokenInfo.slug, value);
1481
+ if (mythosError) {
1482
+ inputTransaction.errors.push(mythosError);
1483
+ }
1457
1484
  let isSendingTokenSufficient = false;
1458
1485
  let receiverSystemAccountInfo;
1459
1486
  if (!(0, _utils5._isChainSubstrateCompatible)(chainInfoMap[destinationNetworkKey])) {
1460
1487
  return undefined;
1461
1488
  }
1489
+ const setting = {
1490
+ visible: true
1491
+ };
1492
+ await this.#koniState.chainService.updateAssetSetting(destinationTokenInfo.slug, setting, true);
1462
1493
  const {
1463
1494
  value: _senderTransferable
1464
1495
  } = await this.getAddressTransferableBalance({
@@ -1486,15 +1517,17 @@ class KoniExtension {
1486
1517
  });
1487
1518
  receiverSystemAccountInfo = _receiverNativeTotal.metadata;
1488
1519
  }
1489
- if ((0, _utils5._isChainSubstrateCompatible)(chainInfoMap[destinationNetworkKey])) {
1490
- const substrateApi = this.#koniState.getSubstrateApi(destinationNetworkKey);
1491
- isSendingTokenSufficient = await (0, _utils._isSufficientToken)(destinationTokenInfo, substrateApi);
1492
- }
1520
+ const substrateApi = this.#koniState.getSubstrateApi(destinationNetworkKey);
1521
+ const sufficientChain = this.#koniState.chainService.value.sufficientChains;
1522
+ isSendingTokenSufficient = await (0, _utils._isSufficientToken)(destinationTokenInfo, substrateApi, sufficientChain);
1493
1523
  const [warning, error] = (0, _transfer.additionalValidateTransferForRecipient)(destinationTokenInfo, destinationNativeTokenInfo, extrinsicType, receiverDestinationTokenKeepAliveBalance, sendingAmount, senderTransferable,
1494
1524
  // different from sendingTokenInfo being passed in
1495
1525
  receiverSystemAccountInfo, isSendingTokenSufficient);
1496
1526
  warning.length && inputTransaction.warnings.push(...warning);
1497
1527
  error.length && inputTransaction.errors.push(...error);
1528
+ if (isSubstrateXcm && !dryRunInfo.success) {
1529
+ inputTransaction.errors.push(new _TransactionError.TransactionError(_types3.BasicTxErrorType.UNABLE_TO_SEND, 'Unable to perform transaction. Select another token or destination chain and try again'));
1530
+ }
1498
1531
  };
1499
1532
  eventsHandler = eventEmitter => {
1500
1533
  eventEmitter.on('send', () => {
@@ -1527,13 +1560,14 @@ class KoniExtension {
1527
1560
  transaction: extrinsic,
1528
1561
  data: inputData,
1529
1562
  extrinsicType,
1530
- chainType: !isSnowBridgeEvmTransfer && !isAvailBridgeFromEvm && !isPolygonBridgeTransfer && !isPosBridgeTransfer ? _KoniTypes.ChainType.SUBSTRATE : _KoniTypes.ChainType.EVM,
1563
+ chainType: !isSnowBridgeEvmTransfer && !isAvailBridgeFromEvm && !isPolygonBridgeTransfer && !isPosBridgeTransfer && !isAcrossBridgeTransfer ? _KoniTypes.ChainType.SUBSTRATE : _KoniTypes.ChainType.EVM,
1531
1564
  transferNativeAmount: (0, _utils5._isNativeToken)(originTokenInfo) ? value : '0',
1532
1565
  ignoreWarnings,
1533
1566
  tokenPayFeeSlug,
1534
1567
  isTransferAll: transferAll,
1535
1568
  isTransferLocalTokenAndPayThatTokenAsFee,
1536
1569
  isPassConfirmation,
1570
+ xcmFeeDryRun,
1537
1571
  errors,
1538
1572
  additionalValidator: additionalValidator,
1539
1573
  eventsHandler: eventsHandler
@@ -1665,14 +1699,21 @@ class KoniExtension {
1665
1699
  } = _ref30;
1666
1700
  return await this.#koniState.enableChain(chainSlug, enableTokens);
1667
1701
  }
1702
+ async enableChainWithPriorityAssets(_ref31) {
1703
+ let {
1704
+ chainSlug,
1705
+ enableTokens
1706
+ } = _ref31;
1707
+ return await this.#koniState.enableChainWithPriorityAssets(chainSlug, enableTokens);
1708
+ }
1668
1709
  async reconnectChain(chainSlug) {
1669
1710
  return this.#koniState.chainService.reconnectChain(chainSlug);
1670
1711
  }
1671
- async validateNetwork(_ref31) {
1712
+ async validateNetwork(_ref32) {
1672
1713
  let {
1673
1714
  existedChainSlug,
1674
1715
  provider
1675
- } = _ref31;
1716
+ } = _ref32;
1676
1717
  return await this.#koniState.validateCustomChain(provider, existedChainSlug);
1677
1718
  }
1678
1719
  resetDefaultNetwork() {
@@ -1744,13 +1785,13 @@ class KoniExtension {
1744
1785
  async validateCustomAsset(data) {
1745
1786
  return await this.#koniState.validateCustomAsset(data);
1746
1787
  }
1747
- async getAddressTransferableBalance(_ref32) {
1788
+ async getAddressTransferableBalance(_ref33) {
1748
1789
  let {
1749
1790
  address,
1750
1791
  extrinsicType,
1751
1792
  networkKey,
1752
1793
  token
1753
- } = _ref32;
1794
+ } = _ref33;
1754
1795
  if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
1755
1796
  const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
1756
1797
  if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
@@ -1759,13 +1800,13 @@ class KoniExtension {
1759
1800
  }
1760
1801
  return await this.#koniState.balanceService.getTransferableBalance(address, networkKey, token, extrinsicType);
1761
1802
  }
1762
- async getAddressTotalBalance(_ref33) {
1803
+ async getAddressTotalBalance(_ref34) {
1763
1804
  let {
1764
1805
  address,
1765
1806
  extrinsicType,
1766
1807
  networkKey,
1767
1808
  token
1768
- } = _ref33;
1809
+ } = _ref34;
1769
1810
  return await this.#koniState.balanceService.getTotalBalance(address, networkKey, token, extrinsicType);
1770
1811
  }
1771
1812
  async subscribeMaxTransferable(request, id, port) {
@@ -1776,7 +1817,8 @@ class KoniExtension {
1776
1817
  feeCustom,
1777
1818
  feeOption,
1778
1819
  token,
1779
- tokenPayFeeSlug
1820
+ tokenPayFeeSlug,
1821
+ value
1780
1822
  } = request;
1781
1823
  const cb = (0, _subscriptions.createSubscription)(id, port);
1782
1824
  const transferTokenInfo = this.#koniState.chainService.getAssetBySlug(token);
@@ -1796,6 +1838,8 @@ class KoniExtension {
1796
1838
  }
1797
1839
  const _request = {
1798
1840
  address: address,
1841
+ value,
1842
+ // todo: lazy subscribe to improve performance
1799
1843
  cardanoApi: this.#koniState.chainService.getCardanoApi(chain),
1800
1844
  destChain,
1801
1845
  destToken,
@@ -1814,11 +1858,11 @@ class KoniExtension {
1814
1858
  freeBalance: freeBalanceSubject,
1815
1859
  fee: feeSubject
1816
1860
  }).subscribe({
1817
- next: _ref34 => {
1861
+ next: _ref35 => {
1818
1862
  let {
1819
1863
  fee,
1820
1864
  freeBalance
1821
- } = _ref34;
1865
+ } = _ref35;
1822
1866
  (0, _utils7.calculateMaxTransferable)(id, _request, freeBalance, fee).then(cb).catch(console.error);
1823
1867
  }
1824
1868
  });
@@ -1852,13 +1896,13 @@ class KoniExtension {
1852
1896
  });
1853
1897
  return (0, _utils7.calculateMaxTransferable)(id, _request, freeBalance, fee);
1854
1898
  }
1855
- async subscribeAddressTransferableBalance(_ref35, id, port) {
1899
+ async subscribeAddressTransferableBalance(_ref36, id, port) {
1856
1900
  let {
1857
1901
  address,
1858
1902
  extrinsicType,
1859
1903
  networkKey,
1860
1904
  token
1861
- } = _ref35;
1905
+ } = _ref36;
1862
1906
  const cb = (0, _subscriptions.createSubscription)(id, port);
1863
1907
  const convertData = data => {
1864
1908
  return {
@@ -1909,11 +1953,11 @@ class KoniExtension {
1909
1953
  isSendingSelf
1910
1954
  };
1911
1955
  }
1912
- async enableChains(_ref36) {
1956
+ async enableChains(_ref37) {
1913
1957
  let {
1914
1958
  chainSlugs,
1915
1959
  enableTokens
1916
- } = _ref36;
1960
+ } = _ref37;
1917
1961
  try {
1918
1962
  await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
1919
1963
  chainSlug,
@@ -2046,30 +2090,30 @@ class KoniExtension {
2046
2090
 
2047
2091
  // Parse transaction
2048
2092
 
2049
- parseSubstrateTransaction(_ref37) {
2093
+ parseSubstrateTransaction(_ref38) {
2050
2094
  let {
2051
2095
  data,
2052
2096
  networkKey
2053
- } = _ref37;
2097
+ } = _ref38;
2054
2098
  const apiProps = this.#koniState.getSubstrateApi(networkKey);
2055
2099
  const apiPromise = apiProps.api;
2056
2100
  return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
2057
2101
  }
2058
- async parseEVMRLP(_ref38) {
2102
+ async parseEVMRLP(_ref39) {
2059
2103
  let {
2060
2104
  data
2061
- } = _ref38;
2105
+ } = _ref39;
2062
2106
  return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
2063
2107
  }
2064
2108
 
2065
2109
  // Sign
2066
2110
 
2067
- qrSignSubstrate(_ref39) {
2111
+ qrSignSubstrate(_ref40) {
2068
2112
  let {
2069
2113
  address,
2070
2114
  data,
2071
2115
  networkKey
2072
- } = _ref39;
2116
+ } = _ref40;
2073
2117
  const pair = _uiKeyring.keyring.getPair(address);
2074
2118
  (0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
2075
2119
  if (pair.isLocked) {
@@ -2086,13 +2130,13 @@ class KoniExtension {
2086
2130
  signature: signed
2087
2131
  };
2088
2132
  }
2089
- async qrSignEVM(_ref40) {
2133
+ async qrSignEVM(_ref41) {
2090
2134
  let {
2091
2135
  address,
2092
2136
  chainId,
2093
2137
  message,
2094
2138
  type
2095
- } = _ref40;
2139
+ } = _ref41;
2096
2140
  let signed;
2097
2141
  const network = this.getNetworkJsonByChainId(chainId);
2098
2142
  if (!network) {
@@ -2176,11 +2220,11 @@ class KoniExtension {
2176
2220
  });
2177
2221
  return this.#koniState.getNominatorMetadata();
2178
2222
  }
2179
- async getBondingOptions(_ref41) {
2223
+ async getBondingOptions(_ref42) {
2180
2224
  let {
2181
2225
  chain,
2182
2226
  type
2183
- } = _ref41;
2227
+ } = _ref42;
2184
2228
  const apiProps = this.#koniState.getSubstrateApi(chain);
2185
2229
  const chainInfo = this.#koniState.getChainInfo(chain);
2186
2230
  const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
@@ -2370,12 +2414,12 @@ class KoniExtension {
2370
2414
  }
2371
2415
 
2372
2416
  // EVM Transaction
2373
- async parseContractInput(_ref42) {
2417
+ async parseContractInput(_ref43) {
2374
2418
  let {
2375
2419
  chainId,
2376
2420
  contract,
2377
2421
  data
2378
- } = _ref42;
2422
+ } = _ref43;
2379
2423
  const network = this.getNetworkJsonByChainId(chainId);
2380
2424
  return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
2381
2425
  }
@@ -2475,10 +2519,10 @@ class KoniExtension {
2475
2519
 
2476
2520
  // Unlock wallet
2477
2521
 
2478
- keyringUnlock(_ref43) {
2522
+ keyringUnlock(_ref44) {
2479
2523
  let {
2480
2524
  password
2481
- } = _ref43;
2525
+ } = _ref44;
2482
2526
  try {
2483
2527
  _uiKeyring.keyring.unlockKeyring(password);
2484
2528
  // this.#koniState.initMantaPay(password)
@@ -2509,11 +2553,11 @@ class KoniExtension {
2509
2553
 
2510
2554
  // Export mnemonic
2511
2555
 
2512
- keyringExportMnemonic(_ref44) {
2556
+ keyringExportMnemonic(_ref45) {
2513
2557
  let {
2514
2558
  address,
2515
2559
  password
2516
- } = _ref44;
2560
+ } = _ref45;
2517
2561
  const pair = _uiKeyring.keyring.getPair(address);
2518
2562
  const result = pair.exportMnemonic(password);
2519
2563
  return {
@@ -2523,10 +2567,10 @@ class KoniExtension {
2523
2567
 
2524
2568
  // Reset wallet
2525
2569
 
2526
- async resetWallet(_ref45) {
2570
+ async resetWallet(_ref46) {
2527
2571
  let {
2528
2572
  resetAll
2529
- } = _ref45;
2573
+ } = _ref46;
2530
2574
  try {
2531
2575
  await this.#koniState.resetWallet(resetAll);
2532
2576
  return {
@@ -2542,10 +2586,10 @@ class KoniExtension {
2542
2586
  }
2543
2587
 
2544
2588
  // Signing substrate request
2545
- async signingApprovePasswordV2(_ref46) {
2589
+ async signingApprovePasswordV2(_ref47) {
2546
2590
  let {
2547
2591
  id
2548
- } = _ref46;
2592
+ } = _ref47;
2549
2593
  const queued = this.#koniState.getSignRequest(id);
2550
2594
  (0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
2551
2595
  const {
@@ -2703,10 +2747,10 @@ class KoniExtension {
2703
2747
  getSupportedSmartContractTypes() {
2704
2748
  return this.#koniState.getSupportedSmartContractTypes();
2705
2749
  }
2706
- getTransaction(_ref47) {
2750
+ getTransaction(_ref48) {
2707
2751
  let {
2708
2752
  id
2709
- } = _ref47;
2753
+ } = _ref48;
2710
2754
  const {
2711
2755
  transaction,
2712
2756
  ...transactionResult
@@ -2716,8 +2760,8 @@ class KoniExtension {
2716
2760
  async subscribeTransactions(id, port) {
2717
2761
  const cb = (0, _subscriptions.createSubscription)(id, port);
2718
2762
  function convertRs(rs, processMap) {
2719
- return Object.fromEntries(Object.entries(rs).map(_ref48 => {
2720
- let [key, value] = _ref48;
2763
+ return Object.fromEntries(Object.entries(rs).map(_ref49 => {
2764
+ let [key, value] = _ref49;
2721
2765
  const {
2722
2766
  additionalValidator,
2723
2767
  eventsHandler,
@@ -2741,11 +2785,11 @@ class KoniExtension {
2741
2785
  const subscription = (0, _rxjs.combineLatest)({
2742
2786
  transactions: transactionsObservable,
2743
2787
  processMap: processTransactionObservable
2744
- }).subscribe(_ref49 => {
2788
+ }).subscribe(_ref50 => {
2745
2789
  let {
2746
2790
  processMap,
2747
2791
  transactions
2748
- } = _ref49;
2792
+ } = _ref50;
2749
2793
  cb(convertRs(transactions, processMap));
2750
2794
  });
2751
2795
  port.onDisconnect.addListener(() => {
@@ -2766,10 +2810,10 @@ class KoniExtension {
2766
2810
  });
2767
2811
  return notificationSubject.value;
2768
2812
  }
2769
- async reloadCron(_ref50) {
2813
+ async reloadCron(_ref51) {
2770
2814
  let {
2771
2815
  data
2772
- } = _ref50;
2816
+ } = _ref51;
2773
2817
  if (data === 'nft') {
2774
2818
  return await this.#koniState.reloadNft();
2775
2819
  } else if (data === 'staking') {
@@ -2812,10 +2856,10 @@ class KoniExtension {
2812
2856
  }
2813
2857
 
2814
2858
  // Phishing detect
2815
- async passPhishingPage(_ref51) {
2859
+ async passPhishingPage(_ref52) {
2816
2860
  let {
2817
2861
  url
2818
- } = _ref51;
2862
+ } = _ref52;
2819
2863
  return await this.#koniState.approvePassPhishingPage(url);
2820
2864
  }
2821
2865
 
@@ -2836,10 +2880,10 @@ class KoniExtension {
2836
2880
  /// Wallet connect
2837
2881
 
2838
2882
  // Connect
2839
- async connectWalletConnect(_ref52) {
2883
+ async connectWalletConnect(_ref53) {
2840
2884
  let {
2841
2885
  uri
2842
- } = _ref52;
2886
+ } = _ref53;
2843
2887
  await this.#koniState.walletConnectService.connect(uri);
2844
2888
  return true;
2845
2889
  }
@@ -2852,11 +2896,11 @@ class KoniExtension {
2852
2896
  });
2853
2897
  return this.#koniState.requestService.allConnectWCRequests;
2854
2898
  }
2855
- async approveWalletConnectSession(_ref53) {
2899
+ async approveWalletConnectSession(_ref54) {
2856
2900
  let {
2857
2901
  accounts: selectedAccounts,
2858
2902
  id
2859
- } = _ref53;
2903
+ } = _ref54;
2860
2904
  const request = this.#koniState.requestService.getConnectWCRequest(id);
2861
2905
  if ((0, _helpers2.isProposalExpired)(request.request.params)) {
2862
2906
  throw new Error('The proposal has been expired');
@@ -2868,8 +2912,8 @@ class KoniExtension {
2868
2912
  const availableNamespaces = {};
2869
2913
  const namespaces = {};
2870
2914
  const chainInfoMap = this.#koniState.getChainInfoMap();
2871
- Object.entries(requiredNamespaces).forEach(_ref54 => {
2872
- let [key, namespace] = _ref54;
2915
+ Object.entries(requiredNamespaces).forEach(_ref55 => {
2916
+ let [key, namespace] = _ref55;
2873
2917
  if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
2874
2918
  if (namespace.chains) {
2875
2919
  const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
@@ -2882,8 +2926,8 @@ class KoniExtension {
2882
2926
  throw new Error((0, _utils8.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
2883
2927
  }
2884
2928
  });
2885
- Object.entries(optionalNamespaces).forEach(_ref55 => {
2886
- let [key, namespace] = _ref55;
2929
+ Object.entries(optionalNamespaces).forEach(_ref56 => {
2930
+ let [key, namespace] = _ref56;
2887
2931
  if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
2888
2932
  if (namespace.chains) {
2889
2933
  const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
@@ -2907,8 +2951,8 @@ class KoniExtension {
2907
2951
  }
2908
2952
  }
2909
2953
  });
2910
- Object.entries(availableNamespaces).forEach(_ref56 => {
2911
- let [key, namespace] = _ref56;
2954
+ Object.entries(availableNamespaces).forEach(_ref57 => {
2955
+ let [key, namespace] = _ref57;
2912
2956
  if (namespace.chains) {
2913
2957
  const accounts = selectedAccounts.filter(address => {
2914
2958
  const [_namespace] = address.split(':');
@@ -2932,10 +2976,10 @@ class KoniExtension {
2932
2976
  request.resolve();
2933
2977
  return true;
2934
2978
  }
2935
- async rejectWalletConnectSession(_ref57) {
2979
+ async rejectWalletConnectSession(_ref58) {
2936
2980
  let {
2937
2981
  id
2938
- } = _ref57;
2982
+ } = _ref58;
2939
2983
  const request = this.#koniState.requestService.getConnectWCRequest(id);
2940
2984
  const wcId = request.request.id;
2941
2985
  if ((0, _helpers2.isProposalExpired)(request.request.params)) {
@@ -2957,10 +3001,10 @@ class KoniExtension {
2957
3001
  });
2958
3002
  return this.#koniState.walletConnectService.sessions;
2959
3003
  }
2960
- async disconnectWalletConnectSession(_ref58) {
3004
+ async disconnectWalletConnectSession(_ref59) {
2961
3005
  let {
2962
3006
  topic
2963
- } = _ref58;
3007
+ } = _ref59;
2964
3008
  await this.#koniState.walletConnectService.disconnect(topic);
2965
3009
  return true;
2966
3010
  }
@@ -2973,18 +3017,18 @@ class KoniExtension {
2973
3017
  });
2974
3018
  return this.#koniState.requestService.allNotSupportWCRequests;
2975
3019
  }
2976
- approveWalletConnectNotSupport(_ref59) {
3020
+ approveWalletConnectNotSupport(_ref60) {
2977
3021
  let {
2978
3022
  id
2979
- } = _ref59;
3023
+ } = _ref60;
2980
3024
  const request = this.#koniState.requestService.getNotSupportWCRequest(id);
2981
3025
  request.resolve();
2982
3026
  return true;
2983
3027
  }
2984
- rejectWalletConnectNotSupport(_ref60) {
3028
+ rejectWalletConnectNotSupport(_ref61) {
2985
3029
  let {
2986
3030
  id
2987
- } = _ref60;
3031
+ } = _ref61;
2988
3032
  const request = this.#koniState.requestService.getNotSupportWCRequest(id);
2989
3033
  request.reject(new Error('USER_REJECTED'));
2990
3034
  return true;
@@ -2992,11 +3036,11 @@ class KoniExtension {
2992
3036
 
2993
3037
  /// Manta
2994
3038
 
2995
- async enableMantaPay(_ref61) {
3039
+ async enableMantaPay(_ref62) {
2996
3040
  let {
2997
3041
  address,
2998
3042
  password
2999
- } = _ref61;
3043
+ } = _ref62;
3000
3044
  // always takes the current account
3001
3045
  function timeout() {
3002
3046
  return new Promise(resolve => setTimeout(resolve, 1500));
@@ -3086,11 +3130,11 @@ class KoniExtension {
3086
3130
  async disableMantaPay(address) {
3087
3131
  return this.#koniState.disableMantaPay(address);
3088
3132
  }
3089
- async isTonBounceableAddress(_ref62) {
3133
+ async isTonBounceableAddress(_ref63) {
3090
3134
  let {
3091
3135
  address,
3092
3136
  chain
3093
- } = _ref62;
3137
+ } = _ref63;
3094
3138
  try {
3095
3139
  const tonApi = this.#koniState.getTonApi(chain);
3096
3140
  const state = await tonApi.getAccountState(address);
@@ -3136,10 +3180,10 @@ class KoniExtension {
3136
3180
 
3137
3181
  /* Metadata */
3138
3182
 
3139
- async findRawMetadata(_ref63) {
3183
+ async findRawMetadata(_ref64) {
3140
3184
  let {
3141
3185
  genesisHash
3142
- } = _ref63;
3186
+ } = _ref64;
3143
3187
  const {
3144
3188
  metadata,
3145
3189
  specVersion,
@@ -3153,20 +3197,20 @@ class KoniExtension {
3153
3197
  userExtensions
3154
3198
  };
3155
3199
  }
3156
- async calculateMetadataHash(_ref64) {
3200
+ async calculateMetadataHash(_ref65) {
3157
3201
  let {
3158
3202
  chain
3159
- } = _ref64;
3203
+ } = _ref65;
3160
3204
  const hash = await this.#koniState.calculateMetadataHash(chain);
3161
3205
  return {
3162
3206
  metadataHash: hash || ''
3163
3207
  };
3164
3208
  }
3165
- async shortenMetadata(_ref65) {
3209
+ async shortenMetadata(_ref66) {
3166
3210
  let {
3167
3211
  chain,
3168
3212
  txBlob
3169
- } = _ref65;
3213
+ } = _ref66;
3170
3214
  const shorten = await this.#koniState.shortenMetadata(chain, txBlob);
3171
3215
  return {
3172
3216
  txMetadata: shorten || ''
@@ -3519,18 +3563,18 @@ class KoniExtension {
3519
3563
 
3520
3564
  /* Campaign */
3521
3565
 
3522
- unlockDotCheckCanMint(_ref66) {
3566
+ unlockDotCheckCanMint(_ref67) {
3523
3567
  let {
3524
3568
  address,
3525
3569
  network,
3526
3570
  slug
3527
- } = _ref66;
3571
+ } = _ref67;
3528
3572
  return this.#koniState.mintCampaignService.unlockDotCampaign.canMint(address, slug, network);
3529
3573
  }
3530
- unlockDotSubscribeMintedData(id, port, _ref67) {
3574
+ unlockDotSubscribeMintedData(id, port, _ref68) {
3531
3575
  let {
3532
3576
  transactionId
3533
- } = _ref67;
3577
+ } = _ref68;
3534
3578
  const cb = (0, _subscriptions.createSubscription)(id, port);
3535
3579
  const subscription = this.#koniState.mintCampaignService.unlockDotCampaign.subscribeMintedNft(transactionId, cb);
3536
3580
  this.createUnsubscriptionHandle(id, subscription.unsubscribe);
@@ -3562,10 +3606,10 @@ class KoniExtension {
3562
3606
  });
3563
3607
  return filterBanner(await this.#koniState.campaignService.getProcessingCampaign());
3564
3608
  }
3565
- async completeCampaignBanner(_ref68) {
3609
+ async completeCampaignBanner(_ref69) {
3566
3610
  let {
3567
3611
  slug
3568
- } = _ref68;
3612
+ } = _ref69;
3569
3613
  const campaign = await this.#koniState.dbService.getCampaign(slug);
3570
3614
  if (campaign) {
3571
3615
  await this.#koniState.dbService.upsertCampaign({
@@ -4081,8 +4125,8 @@ class KoniExtension {
4081
4125
  resolve();
4082
4126
  }
4083
4127
  };
4084
- this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(_ref69 => {
4085
- let [_unsub, rs] = _ref69;
4128
+ this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(_ref70 => {
4129
+ let [_unsub, rs] = _ref70;
4086
4130
  unsub = _unsub;
4087
4131
  onRs(rs);
4088
4132
  }).catch(console.error);
@@ -4473,6 +4517,8 @@ class KoniExtension {
4473
4517
  return this.getSupportedSmartContractTypes();
4474
4518
  case 'pri(chainService.enableChain)':
4475
4519
  return await this.enableChain(request);
4520
+ case 'pri(chainService.enableChainWithPriorityAssets)':
4521
+ return await this.enableChainWithPriorityAssets(request);
4476
4522
  case 'pri(chainService.reconnectChain)':
4477
4523
  return await this.reconnectChain(request);
4478
4524
  case 'pri(chainService.disableChain)':