@subwallet/extension-base 1.0.7-0 → 1.0.7-2

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 (64) hide show
  1. package/background/KoniTypes.d.ts +7 -8
  2. package/cjs/constants/index.js +1 -1
  3. package/cjs/koni/api/staking/bonding/amplitude.js +83 -0
  4. package/cjs/koni/api/staking/bonding/astar.js +109 -5
  5. package/cjs/koni/api/staking/bonding/index.js +35 -0
  6. package/cjs/koni/api/staking/bonding/paraChain.js +97 -0
  7. package/cjs/koni/api/staking/bonding/relayChain.js +203 -15
  8. package/cjs/koni/api/staking/bonding/utils.js +7 -0
  9. package/cjs/koni/api/staking/index.js +11 -11
  10. package/cjs/koni/api/staking/paraChain.js +200 -130
  11. package/cjs/koni/api/staking/relayChain.js +66 -68
  12. package/cjs/koni/api/staking/subsquidStaking.js +6 -11
  13. package/cjs/koni/background/cron.js +0 -25
  14. package/cjs/koni/background/handlers/Extension.js +98 -74
  15. package/cjs/koni/background/handlers/State.js +17 -19
  16. package/cjs/koni/background/subscription.js +57 -12
  17. package/cjs/packageInfo.js +1 -1
  18. package/cjs/services/chain-service/constants.js +3 -1
  19. package/cjs/services/chain-service/utils.js +6 -1
  20. package/cjs/services/storage-service/DatabaseService.js +7 -3
  21. package/cjs/services/storage-service/db-stores/ChainStakingMetadata.js +5 -0
  22. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +4 -4
  23. package/cjs/services/transaction-service/index.js +6 -1
  24. package/constants/index.d.ts +1 -1
  25. package/constants/index.js +1 -1
  26. package/koni/api/staking/bonding/amplitude.d.ts +4 -0
  27. package/koni/api/staking/bonding/amplitude.js +81 -0
  28. package/koni/api/staking/bonding/astar.d.ts +4 -0
  29. package/koni/api/staking/bonding/astar.js +107 -5
  30. package/koni/api/staking/bonding/index.d.ts +1 -0
  31. package/koni/api/staking/bonding/index.js +38 -4
  32. package/koni/api/staking/bonding/paraChain.d.ts +4 -0
  33. package/koni/api/staking/bonding/paraChain.js +95 -0
  34. package/koni/api/staking/bonding/relayChain.d.ts +5 -0
  35. package/koni/api/staking/bonding/relayChain.js +198 -14
  36. package/koni/api/staking/bonding/utils.d.ts +5 -0
  37. package/koni/api/staking/bonding/utils.js +6 -0
  38. package/koni/api/staking/index.d.ts +4 -4
  39. package/koni/api/staking/index.js +11 -11
  40. package/koni/api/staking/paraChain.d.ts +5 -5
  41. package/koni/api/staking/paraChain.js +201 -131
  42. package/koni/api/staking/relayChain.d.ts +4 -4
  43. package/koni/api/staking/relayChain.js +66 -67
  44. package/koni/api/staking/subsquidStaking.d.ts +1 -1
  45. package/koni/api/staking/subsquidStaking.js +6 -11
  46. package/koni/background/cron.js +1 -26
  47. package/koni/background/handlers/Extension.js +29 -7
  48. package/koni/background/handlers/State.d.ts +2 -2
  49. package/koni/background/handlers/State.js +17 -19
  50. package/koni/background/subscription.d.ts +2 -1
  51. package/koni/background/subscription.js +58 -13
  52. package/package.json +5 -5
  53. package/packageInfo.js +1 -1
  54. package/services/chain-service/constants.d.ts +1 -0
  55. package/services/chain-service/constants.js +3 -2
  56. package/services/chain-service/types.d.ts +8 -0
  57. package/services/chain-service/utils.js +6 -1
  58. package/services/storage-service/DatabaseService.d.ts +2 -2
  59. package/services/storage-service/DatabaseService.js +7 -3
  60. package/services/storage-service/db-stores/ChainStakingMetadata.d.ts +1 -0
  61. package/services/storage-service/db-stores/ChainStakingMetadata.js +3 -0
  62. package/services/storage-service/db-stores/NominatorMetadata.d.ts +2 -2
  63. package/services/storage-service/db-stores/NominatorMetadata.js +4 -4
  64. package/services/transaction-service/index.js +6 -1
@@ -39,9 +39,8 @@ const getSubsquidQuery = (account, chain) => {
39
39
  }
40
40
  }`;
41
41
  };
42
- const getSubsquidStaking = async (accounts, chain, chainInfoMap) => {
42
+ const getSubsquidStaking = async (accounts, chain, chainInfoMap, callback) => {
43
43
  try {
44
- const result = [];
45
44
  await Promise.all(accounts.map(async account => {
46
45
  if ((0, _utils._isChainEvmCompatible)(chainInfoMap[chain]) && (0, _utilCrypto.isEthereumAddress)(account) || !(0, _utils._isChainEvmCompatible)(chainInfoMap[chain]) && !(0, _utilCrypto.isEthereumAddress)(account)) {
47
46
  const parsedAccount = (0, _utils2.reformatAddress)(account, (0, _utils._getChainSubstrateAddressPrefix)(chainInfoMap[chain]));
@@ -77,17 +76,15 @@ const getSubsquidStaking = async (accounts, chain, chainInfoMap) => {
77
76
  }
78
77
  }
79
78
  if (stakingRewardItem.totalReward && parseFloat(stakingRewardItem.totalReward) > 0) {
80
- result.push(stakingRewardItem);
79
+ callback(stakingRewardItem);
81
80
  }
82
81
  }
83
82
  }));
84
- return result;
85
83
  } catch (e) {
86
- return [];
84
+ console.debug(e);
87
85
  }
88
86
  };
89
- const getAllSubsquidStaking = async (accounts, chainInfoMap) => {
90
- let rewardList = [];
87
+ const getAllSubsquidStaking = async (accounts, chainInfoMap, callback) => {
91
88
  const filteredNetworks = [];
92
89
  Object.values(chainInfoMap).forEach(network => {
93
90
  if (_config.INDEXER_SUPPORTED_STAKING_CHAINS.includes(network.slug)) {
@@ -96,12 +93,10 @@ const getAllSubsquidStaking = async (accounts, chainInfoMap) => {
96
93
  });
97
94
  try {
98
95
  await Promise.all(filteredNetworks.map(async network => {
99
- const rewardItems = await getSubsquidStaking(accounts, network, chainInfoMap);
100
- rewardList = rewardList.concat(rewardItems);
96
+ await getSubsquidStaking(accounts, network, chainInfoMap, callback);
101
97
  }));
102
98
  } catch (e) {
103
- return rewardList;
99
+ console.debug(e);
104
100
  }
105
- return rewardList;
106
101
  };
107
102
  exports.getAllSubsquidStaking = getAllSubsquidStaking;
@@ -60,26 +60,6 @@ class KoniCron {
60
60
  delete this.cronMap[key];
61
61
  });
62
62
  };
63
-
64
- // init = () => {
65
- // const currentAccountInfo = this.state.keyringService.currentAccount;
66
- //
67
- // if (!currentAccountInfo?.address) {
68
- // return;
69
- // }
70
- //
71
- // if (Object.keys(this.state.getSubstrateApiMap()).length !== 0 || Object.keys(this.state.getEvmApiMap()).length !== 0) {
72
- // this.refreshNft(currentAccountInfo.address, this.state.getApiMap(), this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap());
73
- // this.updateApiMapStatus();
74
- // this.refreshStakingReward(currentAccountInfo.address);
75
- // this.refreshStakingRewardFastInterval(currentAccountInfo.address);
76
- // // this.updateChainStakingMetadata(this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap());
77
- // this.updateNominatorMetadata(currentAccountInfo.address, this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap());
78
- // } else {
79
- // this.setStakingRewardReady();
80
- // }
81
- // };
82
-
83
63
  start = () => {
84
64
  if (this.status === 'running') {
85
65
  return;
@@ -120,7 +100,6 @@ class KoniCron {
120
100
  (commonReload || needUpdateStaking || stakingSubmitted) && this.resetStakingReward();
121
101
  (commonReload || needUpdateStaking || stakingSubmitted) && this.removeCron('refreshStakingReward');
122
102
  (commonReload || needUpdateStaking || stakingSubmitted) && this.removeCron('refreshPoolingStakingReward');
123
- (commonReload || needUpdateStaking || stakingSubmitted) && this.removeCron('updateNominatorMetadata');
124
103
  needUpdateStaking && this.removeCron('updateChainStakingMetadata');
125
104
 
126
105
  // Chains
@@ -133,7 +112,6 @@ class KoniCron {
133
112
  chainUpdated && this.addCron('recoverApiMap', this.recoverApiMap, _constants.CRON_AUTO_RECOVER_DOTSAMA_INTERVAL, false);
134
113
  (commonReload || needUpdateStaking || stakingSubmitted) && this.addCron('refreshStakingReward', this.refreshStakingReward(address), _constants.CRON_REFRESH_STAKING_REWARD_INTERVAL);
135
114
  (commonReload || needUpdateStaking || stakingSubmitted) && this.addCron('refreshPoolingStakingReward', this.refreshStakingRewardFastInterval(address), _constants.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL);
136
- (commonReload || needUpdateStaking || stakingSubmitted) && this.addCron('updateNominatorMetadata', this.updateNominatorMetadata(address, serviceInfo.chainInfoMap, serviceInfo.chainStateMap, serviceInfo.chainApiMap.substrate), _constants.CRON_REFRESH_CHAIN_NOMINATOR_METADATA);
137
115
  needUpdateStaking && this.addCron('updateChainStakingMetadata', this.updateChainStakingMetadata(serviceInfo.chainInfoMap, serviceInfo.chainStateMap, serviceInfo.chainApiMap.substrate), _constants.CRON_REFRESH_CHAIN_STAKING_METADATA);
138
116
  } else {
139
117
  this.setStakingRewardReady();
@@ -151,7 +129,6 @@ class KoniCron {
151
129
  this.addCron('refreshStakingReward', this.refreshStakingReward(currentAccountInfo.address), _constants.CRON_REFRESH_STAKING_REWARD_INTERVAL);
152
130
  this.addCron('refreshPoolingStakingReward', this.refreshStakingRewardFastInterval(currentAccountInfo.address), _constants.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL);
153
131
  this.addCron('updateChainStakingMetadata', this.updateChainStakingMetadata(this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap()), _constants.CRON_REFRESH_CHAIN_STAKING_METADATA);
154
- this.addCron('updateNominatorMetadata', this.updateNominatorMetadata(currentAccountInfo.address, this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap()), _constants.CRON_REFRESH_CHAIN_NOMINATOR_METADATA);
155
132
  } else {
156
133
  this.setStakingRewardReady();
157
134
  }
@@ -246,10 +223,8 @@ class KoniCron {
246
223
  this.resetStakingReward();
247
224
  this.removeCron('refreshStakingReward');
248
225
  this.removeCron('refreshPoolingStakingReward');
249
- this.removeCron('updateNominatorMetadata');
250
226
  this.addCron('refreshStakingReward', this.refreshStakingReward(address), _constants.CRON_REFRESH_STAKING_REWARD_INTERVAL);
251
227
  this.addCron('refreshPoolingStakingReward', this.refreshStakingRewardFastInterval(address), _constants.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL);
252
- this.addCron('updateNominatorMetadata', this.updateNominatorMetadata(address, this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap()), _constants.CRON_REFRESH_CHAIN_NOMINATOR_METADATA);
253
228
  await (0, _utils2.waitTimeout)(1800);
254
229
  return true;
255
230
  }
@@ -11,6 +11,7 @@ var _Extension = require("@subwallet/extension-base/background/handlers/Extensio
11
11
  var _helpers = require("@subwallet/extension-base/background/handlers/helpers");
12
12
  var _subscriptions = require("@subwallet/extension-base/background/handlers/subscriptions");
13
13
  var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
14
+ var _TransactionWarning = require("@subwallet/extension-base/background/warnings/TransactionWarning");
14
15
  var _constants = require("@subwallet/extension-base/constants");
15
16
  var _defaults = require("@subwallet/extension-base/defaults");
16
17
  var _parseTransaction = require("@subwallet/extension-base/koni/api/dotsama/parseTransaction");
@@ -1471,6 +1472,17 @@ class KoniExtension {
1471
1472
  }
1472
1473
  const transferNativeAmount = isTransferNativeToken ? transferAmount.value : '0';
1473
1474
  this.addContact(to);
1475
+ const additionalValidator = async inputTransaction => {
1476
+ if (!isTransferNativeToken) {
1477
+ const {
1478
+ value: balance
1479
+ } = await this.#koniState.balanceService.getTokenFreeBalance(from, networkKey, tokenSlug);
1480
+ const minAmount = tokenInfo.minAmount || '0';
1481
+ if (new _bignumber.default(balance).minus(transferAmount.value).lt(minAmount)) {
1482
+ inputTransaction.warnings.push(new _TransactionWarning.TransactionWarning(_KoniTypes.BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT, ''));
1483
+ }
1484
+ }
1485
+ };
1474
1486
  return this.#koniState.transactionService.handleTransaction({
1475
1487
  errors,
1476
1488
  warnings,
@@ -1482,8 +1494,9 @@ class KoniExtension {
1482
1494
  data: inputData,
1483
1495
  extrinsicType: isTransferNativeToken ? _KoniTypes.ExtrinsicType.TRANSFER_BALANCE : _KoniTypes.ExtrinsicType.TRANSFER_TOKEN,
1484
1496
  ignoreWarnings: transferAll,
1485
- isTransferAll: transferAll,
1486
- edAsWarning: isTransferNativeToken
1497
+ isTransferAll: isTransferNativeToken ? transferAll : false,
1498
+ edAsWarning: true,
1499
+ additionalValidator: additionalValidator
1487
1500
  });
1488
1501
  }
1489
1502
  validateCrossChainTransfer(destinationNetworkKey, sendingTokenSlug, sender, sendingValue) {
@@ -1572,14 +1585,18 @@ class KoniExtension {
1572
1585
  disableChain(networkKey) {
1573
1586
  return this.#koniState.disableChain(networkKey);
1574
1587
  }
1575
- async enableChain(networkKey) {
1576
- return await this.#koniState.enableChain(networkKey);
1588
+ async enableChain(_ref39) {
1589
+ let {
1590
+ chainSlug,
1591
+ enableTokens
1592
+ } = _ref39;
1593
+ return await this.#koniState.enableChain(chainSlug, enableTokens);
1577
1594
  }
1578
- async validateNetwork(_ref39) {
1595
+ async validateNetwork(_ref40) {
1579
1596
  let {
1580
1597
  existedChainSlug,
1581
1598
  provider
1582
- } = _ref39;
1599
+ } = _ref40;
1583
1600
  return await this.#koniState.validateCustomChain(provider, existedChainSlug);
1584
1601
  }
1585
1602
  resetDefaultNetwork() {
@@ -1617,22 +1634,22 @@ class KoniExtension {
1617
1634
  async validateCustomAsset(data) {
1618
1635
  return await this.#koniState.validateCustomAsset(data);
1619
1636
  }
1620
- async getAddressFreeBalance(_ref40) {
1637
+ async getAddressFreeBalance(_ref41) {
1621
1638
  let {
1622
1639
  address,
1623
1640
  networkKey,
1624
1641
  token
1625
- } = _ref40;
1642
+ } = _ref41;
1626
1643
  return await this.#koniState.balanceService.getTokenFreeBalance(address, networkKey, token);
1627
1644
  }
1628
- async transferGetMaxTransferable(_ref41) {
1645
+ async transferGetMaxTransferable(_ref42) {
1629
1646
  let {
1630
1647
  address,
1631
1648
  destChain,
1632
1649
  isXcmTransfer,
1633
1650
  networkKey,
1634
1651
  token
1635
- } = _ref41;
1652
+ } = _ref42;
1636
1653
  const freeBalance = await this.#koniState.balanceService.getTokenFreeBalance(address, networkKey, token);
1637
1654
  const tokenInfo = token ? this.#koniState.chainService.getAssetBySlug(token) : this.#koniState.chainService.getNativeTokenInfo(networkKey);
1638
1655
  if (!(0, _utils._isNativeToken)(tokenInfo)) {
@@ -1703,12 +1720,12 @@ class KoniExtension {
1703
1720
  };
1704
1721
  }
1705
1722
  }
1706
- async subscribeAddressFreeBalance(_ref42, id, port) {
1723
+ async subscribeAddressFreeBalance(_ref43, id, port) {
1707
1724
  let {
1708
1725
  address,
1709
1726
  networkKey,
1710
1727
  token
1711
- } = _ref42;
1728
+ } = _ref43;
1712
1729
  const cb = (0, _subscriptions.createSubscription)(id, port);
1713
1730
  const [unsub, currentFreeBalance] = await this.#koniState.balanceService.subscribeTokenFreeBalance(address, networkKey, token, cb);
1714
1731
  this.createUnsubscriptionHandle(id, unsub);
@@ -1717,26 +1734,26 @@ class KoniExtension {
1717
1734
  });
1718
1735
  return currentFreeBalance;
1719
1736
  }
1720
- async transferCheckReferenceCount(_ref43) {
1737
+ async transferCheckReferenceCount(_ref44) {
1721
1738
  let {
1722
1739
  address,
1723
1740
  networkKey
1724
- } = _ref43;
1741
+ } = _ref44;
1725
1742
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return
1726
1743
  return await (0, _transfer.checkReferenceCount)(networkKey, address, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
1727
1744
  }
1728
- async transferCheckSupporting(_ref44) {
1745
+ async transferCheckSupporting(_ref45) {
1729
1746
  let {
1730
1747
  networkKey,
1731
1748
  tokenSlug
1732
- } = _ref44;
1749
+ } = _ref45;
1733
1750
  const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
1734
1751
  return await (0, _transfer.checkSupportTransfer)(networkKey, tokenInfo, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
1735
1752
  }
1736
- transferGetExistentialDeposit(_ref45) {
1753
+ transferGetExistentialDeposit(_ref46) {
1737
1754
  let {
1738
1755
  tokenSlug
1739
- } = _ref45;
1756
+ } = _ref46;
1740
1757
  const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
1741
1758
  return (0, _utils._getTokenMinAmount)(tokenInfo);
1742
1759
  }
@@ -1770,32 +1787,39 @@ class KoniExtension {
1770
1787
  isSendingSelf
1771
1788
  };
1772
1789
  }
1773
- async enableChains(targetKeys) {
1790
+ async enableChains(_ref47) {
1791
+ let {
1792
+ chainSlugs,
1793
+ enableTokens
1794
+ } = _ref47;
1774
1795
  try {
1775
- await Promise.all(targetKeys.map(networkKey => this.enableChain(networkKey)));
1796
+ await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
1797
+ chainSlug,
1798
+ enableTokens
1799
+ })));
1776
1800
  } catch (e) {
1777
1801
  return false;
1778
1802
  }
1779
1803
  return true;
1780
1804
  }
1781
- getAccountMeta(_ref46) {
1805
+ getAccountMeta(_ref48) {
1782
1806
  let {
1783
1807
  address
1784
- } = _ref46;
1808
+ } = _ref48;
1785
1809
  const pair = _uiKeyring.keyring.getPair(address);
1786
1810
  (0, _util.assert)(pair, 'Unable to find pair');
1787
1811
  return {
1788
1812
  meta: pair.meta
1789
1813
  };
1790
1814
  }
1791
- accountsTie2(_ref47) {
1815
+ accountsTie2(_ref49) {
1792
1816
  let {
1793
1817
  address,
1794
1818
  genesisHash
1795
- } = _ref47;
1819
+ } = _ref49;
1796
1820
  return this.#koniState.setAccountTie(address, genesisHash);
1797
1821
  }
1798
- async accountsCreateExternalV2(_ref48) {
1822
+ async accountsCreateExternalV2(_ref50) {
1799
1823
  let {
1800
1824
  address,
1801
1825
  genesisHash,
@@ -1803,7 +1827,7 @@ class KoniExtension {
1803
1827
  isEthereum,
1804
1828
  isReadOnly,
1805
1829
  name
1806
- } = _ref48;
1830
+ } = _ref50;
1807
1831
  try {
1808
1832
  let result;
1809
1833
  try {
@@ -1862,7 +1886,7 @@ class KoniExtension {
1862
1886
  }];
1863
1887
  }
1864
1888
  }
1865
- async accountsCreateHardwareV2(_ref49) {
1889
+ async accountsCreateHardwareV2(_ref51) {
1866
1890
  let {
1867
1891
  accountIndex,
1868
1892
  address,
@@ -1871,7 +1895,7 @@ class KoniExtension {
1871
1895
  hardwareType,
1872
1896
  isAllowed,
1873
1897
  name
1874
- } = _ref49;
1898
+ } = _ref51;
1875
1899
  const key = _uiKeyring.keyring.addHardware(address, hardwareType, {
1876
1900
  accountIndex,
1877
1901
  addressOffset,
@@ -1894,10 +1918,10 @@ class KoniExtension {
1894
1918
  });
1895
1919
  return true;
1896
1920
  }
1897
- async accountsCreateHardwareMultiple(_ref50) {
1921
+ async accountsCreateHardwareMultiple(_ref52) {
1898
1922
  let {
1899
1923
  accounts
1900
- } = _ref50;
1924
+ } = _ref52;
1901
1925
  const addresses = [];
1902
1926
  if (!accounts.length) {
1903
1927
  throw new Error('No accounts to import');
@@ -1948,14 +1972,14 @@ class KoniExtension {
1948
1972
  });
1949
1973
  return true;
1950
1974
  }
1951
- async accountsCreateWithSecret(_ref51) {
1975
+ async accountsCreateWithSecret(_ref53) {
1952
1976
  let {
1953
1977
  isAllow,
1954
1978
  isEthereum,
1955
1979
  name,
1956
1980
  publicKey,
1957
1981
  secretKey
1958
- } = _ref51;
1982
+ } = _ref53;
1959
1983
  try {
1960
1984
  let keyringPair = null;
1961
1985
  if (isEthereum) {
@@ -2098,30 +2122,30 @@ class KoniExtension {
2098
2122
 
2099
2123
  // Parse transaction
2100
2124
 
2101
- parseSubstrateTransaction(_ref52) {
2125
+ parseSubstrateTransaction(_ref54) {
2102
2126
  let {
2103
2127
  data,
2104
2128
  networkKey
2105
- } = _ref52;
2129
+ } = _ref54;
2106
2130
  const apiProps = this.#koniState.getSubstrateApi(networkKey);
2107
2131
  const apiPromise = apiProps.api;
2108
2132
  return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
2109
2133
  }
2110
- async parseEVMRLP(_ref53) {
2134
+ async parseEVMRLP(_ref55) {
2111
2135
  let {
2112
2136
  data
2113
- } = _ref53;
2137
+ } = _ref55;
2114
2138
  return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
2115
2139
  }
2116
2140
 
2117
2141
  // Sign
2118
2142
 
2119
- qrSignSubstrate(_ref54) {
2143
+ qrSignSubstrate(_ref56) {
2120
2144
  let {
2121
2145
  address,
2122
2146
  data,
2123
2147
  networkKey
2124
- } = _ref54;
2148
+ } = _ref56;
2125
2149
  const pair = _uiKeyring.keyring.getPair(address);
2126
2150
  (0, _util.assert)(pair, 'Unable to find pair');
2127
2151
  if (pair.isLocked) {
@@ -2138,13 +2162,13 @@ class KoniExtension {
2138
2162
  signature: signed
2139
2163
  };
2140
2164
  }
2141
- async qrSignEVM(_ref55) {
2165
+ async qrSignEVM(_ref57) {
2142
2166
  let {
2143
2167
  address,
2144
2168
  chainId,
2145
2169
  message,
2146
2170
  type
2147
- } = _ref55;
2171
+ } = _ref57;
2148
2172
  let signed;
2149
2173
  const network = this.getNetworkJsonByChainId(chainId);
2150
2174
  if (!network) {
@@ -2225,11 +2249,11 @@ class KoniExtension {
2225
2249
  });
2226
2250
  return this.#koniState.getNominatorMetadata();
2227
2251
  }
2228
- async getBondingOptions(_ref56) {
2252
+ async getBondingOptions(_ref58) {
2229
2253
  let {
2230
2254
  chain,
2231
2255
  type
2232
- } = _ref56;
2256
+ } = _ref58;
2233
2257
  const apiProps = this.#koniState.getSubstrateApi(chain);
2234
2258
  const chainInfo = this.#koniState.getChainInfo(chain);
2235
2259
  const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
@@ -2418,12 +2442,12 @@ class KoniExtension {
2418
2442
  }
2419
2443
 
2420
2444
  // EVM Transaction
2421
- async parseContractInput(_ref57) {
2445
+ async parseContractInput(_ref59) {
2422
2446
  let {
2423
2447
  chainId,
2424
2448
  contract,
2425
2449
  data
2426
- } = _ref57;
2450
+ } = _ref59;
2427
2451
  const network = this.getNetworkJsonByChainId(chainId);
2428
2452
  return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
2429
2453
  }
@@ -2494,12 +2518,12 @@ class KoniExtension {
2494
2518
 
2495
2519
  // Change master password
2496
2520
 
2497
- keyringChangeMasterPassword(_ref58) {
2521
+ keyringChangeMasterPassword(_ref60) {
2498
2522
  let {
2499
2523
  createNew,
2500
2524
  newPassword,
2501
2525
  oldPassword
2502
- } = _ref58;
2526
+ } = _ref60;
2503
2527
  try {
2504
2528
  // Remove isMasterPassword meta if createNew
2505
2529
  if (createNew) {
@@ -2533,11 +2557,11 @@ class KoniExtension {
2533
2557
 
2534
2558
  // Migrate password
2535
2559
 
2536
- keyringMigrateMasterPassword(_ref59) {
2560
+ keyringMigrateMasterPassword(_ref61) {
2537
2561
  let {
2538
2562
  address,
2539
2563
  password
2540
- } = _ref59;
2564
+ } = _ref61;
2541
2565
  try {
2542
2566
  _uiKeyring.keyring.migrateWithMasterPassword(address, password);
2543
2567
  } catch (e) {
@@ -2555,10 +2579,10 @@ class KoniExtension {
2555
2579
 
2556
2580
  // Unlock wallet
2557
2581
 
2558
- keyringUnlock(_ref60) {
2582
+ keyringUnlock(_ref62) {
2559
2583
  let {
2560
2584
  password
2561
- } = _ref60;
2585
+ } = _ref62;
2562
2586
  try {
2563
2587
  _uiKeyring.keyring.unlockKeyring(password);
2564
2588
  } catch (e) {
@@ -2584,11 +2608,11 @@ class KoniExtension {
2584
2608
 
2585
2609
  // Export mnemonic
2586
2610
 
2587
- keyringExportMnemonic(_ref61) {
2611
+ keyringExportMnemonic(_ref63) {
2588
2612
  let {
2589
2613
  address,
2590
2614
  password
2591
- } = _ref61;
2615
+ } = _ref63;
2592
2616
  const pair = _uiKeyring.keyring.getPair(address);
2593
2617
  const result = pair.exportMnemonic(password);
2594
2618
  return {
@@ -2598,10 +2622,10 @@ class KoniExtension {
2598
2622
 
2599
2623
  // Reset wallet
2600
2624
 
2601
- async resetWallet(_ref62) {
2625
+ async resetWallet(_ref64) {
2602
2626
  let {
2603
2627
  resetAll
2604
- } = _ref62;
2628
+ } = _ref64;
2605
2629
  try {
2606
2630
  await this.#koniState.resetWallet(resetAll);
2607
2631
  return {
@@ -2617,10 +2641,10 @@ class KoniExtension {
2617
2641
  }
2618
2642
 
2619
2643
  /// Signing external request
2620
- signingApprovePasswordV2(_ref63) {
2644
+ signingApprovePasswordV2(_ref65) {
2621
2645
  let {
2622
2646
  id
2623
- } = _ref63;
2647
+ } = _ref65;
2624
2648
  const queued = this.#koniState.getSignRequest(id);
2625
2649
  (0, _util.assert)(queued, 'Unable to find request');
2626
2650
  const {
@@ -2673,22 +2697,22 @@ class KoniExtension {
2673
2697
 
2674
2698
  /// Derive account
2675
2699
 
2676
- derivationCreateMultiple(_ref64) {
2700
+ derivationCreateMultiple(_ref66) {
2677
2701
  let {
2678
2702
  isAllowed,
2679
2703
  items,
2680
2704
  parentAddress
2681
- } = _ref64;
2705
+ } = _ref66;
2682
2706
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2683
2707
  const isEvm = parentPair.type === 'ethereum';
2684
2708
  if (parentPair.isLocked) {
2685
2709
  _uiKeyring.keyring.unlockPair(parentPair.address);
2686
2710
  }
2687
- const createChild = _ref65 => {
2711
+ const createChild = _ref67 => {
2688
2712
  let {
2689
2713
  name,
2690
2714
  suri
2691
- } = _ref65;
2715
+ } = _ref67;
2692
2716
  const meta = {
2693
2717
  name: name,
2694
2718
  parentAddress
@@ -2734,10 +2758,10 @@ class KoniExtension {
2734
2758
  }
2735
2759
  return true;
2736
2760
  }
2737
- derivationCreateV3(_ref66) {
2761
+ derivationCreateV3(_ref68) {
2738
2762
  let {
2739
2763
  address: parentAddress
2740
- } = _ref66;
2764
+ } = _ref68;
2741
2765
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2742
2766
  const isEvm = parentPair.type === 'ethereum';
2743
2767
  if (parentPair.isLocked) {
@@ -2769,11 +2793,11 @@ class KoniExtension {
2769
2793
  });
2770
2794
  return true;
2771
2795
  }
2772
- validateDerivePath(_ref67) {
2796
+ validateDerivePath(_ref69) {
2773
2797
  let {
2774
2798
  parentAddress,
2775
2799
  suri
2776
- } = _ref67;
2800
+ } = _ref69;
2777
2801
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2778
2802
  const isEvm = parentPair.type === 'ethereum';
2779
2803
  if (parentPair.isLocked) {
@@ -2806,12 +2830,12 @@ class KoniExtension {
2806
2830
  suri: meta.suri
2807
2831
  };
2808
2832
  }
2809
- getListDeriveAccounts(_ref68) {
2833
+ getListDeriveAccounts(_ref70) {
2810
2834
  let {
2811
2835
  limit,
2812
2836
  page,
2813
2837
  parentAddress
2814
- } = _ref68;
2838
+ } = _ref70;
2815
2839
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2816
2840
  const isEvm = parentPair.type === 'ethereum';
2817
2841
  if (parentPair.isLocked) {
@@ -2902,10 +2926,10 @@ class KoniExtension {
2902
2926
  getSupportedSmartContractTypes() {
2903
2927
  return this.#koniState.getSupportedSmartContractTypes();
2904
2928
  }
2905
- getTransaction(_ref69) {
2929
+ getTransaction(_ref71) {
2906
2930
  let {
2907
2931
  id
2908
- } = _ref69;
2932
+ } = _ref71;
2909
2933
  const {
2910
2934
  transaction,
2911
2935
  ...transactionResult
@@ -2915,8 +2939,8 @@ class KoniExtension {
2915
2939
  subscribeTransactions(id, port) {
2916
2940
  const cb = (0, _subscriptions.createSubscription)(id, port);
2917
2941
  function convertRs(rs) {
2918
- return Object.fromEntries(Object.entries(rs).map(_ref70 => {
2919
- let [key, value] = _ref70;
2942
+ return Object.fromEntries(Object.entries(rs).map(_ref72 => {
2943
+ let [key, value] = _ref72;
2920
2944
  const {
2921
2945
  additionalValidator,
2922
2946
  transaction,
@@ -2947,10 +2971,10 @@ class KoniExtension {
2947
2971
  });
2948
2972
  return notificationSubject.value;
2949
2973
  }
2950
- async reloadCron(_ref71) {
2974
+ async reloadCron(_ref73) {
2951
2975
  let {
2952
2976
  data
2953
- } = _ref71;
2977
+ } = _ref73;
2954
2978
  if (data === 'nft') {
2955
2979
  return await this.#koniState.reloadNft();
2956
2980
  } else if (data === 'staking') {
@@ -2968,10 +2992,10 @@ class KoniExtension {
2968
2992
 
2969
2993
  // Phishing detect
2970
2994
 
2971
- async passPhishingPage(_ref72) {
2995
+ async passPhishingPage(_ref74) {
2972
2996
  let {
2973
2997
  url
2974
- } = _ref72;
2998
+ } = _ref74;
2975
2999
  return await this.#koniState.approvePassPhishingPage(url);
2976
3000
  }
2977
3001