@subwallet/extension-base 1.1.2-0 → 1.1.3-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.
Files changed (110) hide show
  1. package/background/KoniTypes.d.ts +32 -4
  2. package/background/KoniTypes.js +2 -1
  3. package/cjs/background/KoniTypes.js +4 -2
  4. package/cjs/constants/i18n.js +10 -2
  5. package/cjs/koni/api/dotsama/transfer.js +6 -2
  6. package/cjs/koni/api/nft/acala_nft/index.js +0 -2
  7. package/cjs/koni/api/nft/bit.country/index.js +49 -18
  8. package/cjs/koni/api/nft/config.js +5 -3
  9. package/cjs/koni/api/nft/evm_nft/index.js +0 -5
  10. package/cjs/koni/api/nft/index.js +2 -3
  11. package/cjs/koni/api/nft/karura_nft/index.js +0 -2
  12. package/cjs/koni/api/nft/rmrk_nft/index.js +0 -4
  13. package/cjs/koni/api/nft/statemine_nft/index.js +0 -2
  14. package/cjs/koni/api/nft/unique_nft/index.js +0 -5
  15. package/cjs/koni/api/nft/wasm_nft/index.js +0 -5
  16. package/cjs/koni/api/staking/bonding/amplitude.js +6 -6
  17. package/cjs/koni/api/staking/bonding/astar.js +6 -6
  18. package/cjs/koni/api/staking/bonding/paraChain.js +5 -5
  19. package/cjs/koni/api/staking/bonding/relayChain.js +24 -14
  20. package/cjs/koni/api/staking/bonding/utils.js +1 -7
  21. package/cjs/koni/api/xcm/xTokens.js +1 -1
  22. package/cjs/koni/background/cron.js +2 -37
  23. package/cjs/koni/background/handlers/Extension.js +206 -137
  24. package/cjs/koni/background/handlers/State.js +72 -84
  25. package/cjs/koni/background/subscription.js +6 -88
  26. package/cjs/packageInfo.js +1 -1
  27. package/cjs/services/chain-service/constants.js +8 -5
  28. package/cjs/services/chain-service/handler/SubstrateApi.js +8 -0
  29. package/cjs/services/chain-service/handler/manta/MantaPrivateHandler.js +1 -1
  30. package/cjs/services/chain-service/handler/manta/manta-extension-sdk-empty.js +13 -0
  31. package/cjs/services/chain-service/index.js +11 -6
  32. package/cjs/services/request-service/handler/PopupHandler.js +2 -2
  33. package/cjs/services/request-service/helper/index.js +2 -26
  34. package/cjs/services/setting-service/constants.js +16 -6
  35. package/cjs/services/storage-service/DatabaseService.js +3 -0
  36. package/cjs/services/storage-service/db-stores/Metadata.js +1 -1
  37. package/cjs/services/storage-service/db-stores/Nft.js +3 -0
  38. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -2
  39. package/cjs/services/wallet-connect-service/constants.js +8 -5
  40. package/cjs/services/wallet-connect-service/index.js +50 -36
  41. package/cjs/utils/environment.js +32 -2
  42. package/cjs/utils/index.js +33 -5
  43. package/cjs/utils/registry.js +25 -0
  44. package/cjs/utils/translate.js +11 -0
  45. package/constants/i18n.d.ts +2 -1
  46. package/constants/i18n.js +8 -1
  47. package/koni/api/dotsama/transfer.js +6 -2
  48. package/koni/api/nft/acala_nft/index.js +0 -2
  49. package/koni/api/nft/bit.country/index.d.ts +1 -0
  50. package/koni/api/nft/bit.country/index.js +50 -19
  51. package/koni/api/nft/config.d.ts +2 -1
  52. package/koni/api/nft/config.js +2 -1
  53. package/koni/api/nft/evm_nft/index.js +0 -4
  54. package/koni/api/nft/index.d.ts +1 -1
  55. package/koni/api/nft/index.js +2 -3
  56. package/koni/api/nft/karura_nft/index.js +0 -2
  57. package/koni/api/nft/nft.d.ts +0 -1
  58. package/koni/api/nft/rmrk_nft/index.js +0 -4
  59. package/koni/api/nft/statemine_nft/index.js +0 -2
  60. package/koni/api/nft/unique_nft/index.js +0 -5
  61. package/koni/api/nft/wasm_nft/index.js +0 -4
  62. package/koni/api/staking/bonding/amplitude.js +6 -6
  63. package/koni/api/staking/bonding/astar.js +6 -6
  64. package/koni/api/staking/bonding/paraChain.js +5 -5
  65. package/koni/api/staking/bonding/relayChain.js +24 -14
  66. package/koni/api/staking/bonding/utils.js +1 -7
  67. package/koni/api/xcm/xTokens.js +1 -1
  68. package/koni/background/cron.d.ts +0 -5
  69. package/koni/background/cron.js +4 -39
  70. package/koni/background/handlers/Extension.d.ts +4 -0
  71. package/koni/background/handlers/Extension.js +97 -32
  72. package/koni/background/handlers/State.d.ts +8 -7
  73. package/koni/background/handlers/State.js +72 -84
  74. package/koni/background/subscription.d.ts +1 -4
  75. package/koni/background/subscription.js +9 -88
  76. package/package.json +22 -6
  77. package/packageInfo.js +1 -1
  78. package/services/chain-service/constants.d.ts +2 -0
  79. package/services/chain-service/constants.js +8 -5
  80. package/services/chain-service/handler/SubstrateApi.js +8 -0
  81. package/services/chain-service/handler/manta/MantaPrivateHandler.d.ts +1 -1
  82. package/services/chain-service/handler/manta/MantaPrivateHandler.js +1 -1
  83. package/services/chain-service/handler/manta/manta-extension-sdk-empty.d.ts +4 -0
  84. package/services/chain-service/handler/manta/manta-extension-sdk-empty.js +5 -0
  85. package/services/chain-service/index.d.ts +2 -1
  86. package/services/chain-service/index.js +11 -6
  87. package/services/request-service/handler/PopupHandler.js +1 -1
  88. package/services/request-service/helper/index.d.ts +0 -2
  89. package/services/request-service/helper/index.js +0 -23
  90. package/services/request-service/types.d.ts +0 -1
  91. package/services/setting-service/constants.d.ts +6 -1
  92. package/services/setting-service/constants.js +10 -5
  93. package/services/storage-service/DatabaseService.d.ts +1 -0
  94. package/services/storage-service/DatabaseService.js +3 -0
  95. package/services/storage-service/db-stores/Metadata.js +1 -1
  96. package/services/storage-service/db-stores/Nft.d.ts +1 -0
  97. package/services/storage-service/db-stores/Nft.js +3 -0
  98. package/services/storage-service/db-stores/NominatorMetadata.js +3 -2
  99. package/services/wallet-connect-service/constants.d.ts +2 -1
  100. package/services/wallet-connect-service/constants.js +5 -3
  101. package/services/wallet-connect-service/index.d.ts +0 -1
  102. package/services/wallet-connect-service/index.js +50 -36
  103. package/utils/environment.d.ts +4 -1
  104. package/utils/environment.js +28 -1
  105. package/utils/index.d.ts +3 -0
  106. package/utils/index.js +6 -2
  107. package/utils/registry.d.ts +4 -0
  108. package/utils/registry.js +18 -0
  109. package/utils/translate.d.ts +1 -0
  110. package/utils/translate.js +4 -0
@@ -864,34 +864,26 @@ class KoniExtension {
864
864
  });
865
865
  return true;
866
866
  }
867
- saveTheme(data, id, port) {
868
- const cb = (0, _subscriptions.createSubscription)(id, port);
869
- this.#koniState.setTheme(data, cb);
870
- port.onDisconnect.addListener(() => {
871
- this.cancelSubscription(id);
872
- });
867
+ saveTheme(data) {
868
+ this.#koniState.updateSetting('theme', data);
873
869
  return true;
874
870
  }
875
871
  setCamera(_ref28) {
876
872
  let {
877
873
  camera
878
874
  } = _ref28;
879
- this.#koniState.setCamera(camera);
875
+ this.#koniState.updateSetting('camera', camera);
880
876
  return true;
881
877
  }
882
- saveBrowserConfirmationType(data, id, port) {
883
- const cb = (0, _subscriptions.createSubscription)(id, port);
884
- this.#koniState.setBrowserConfirmationType(data, cb);
885
- port.onDisconnect.addListener(() => {
886
- this.cancelSubscription(id);
887
- });
878
+ saveBrowserConfirmationType(data) {
879
+ this.#koniState.updateSetting('browserConfirmationType', data);
888
880
  return true;
889
881
  }
890
882
  setAutoLockTime(_ref29) {
891
883
  let {
892
884
  autoLockTime
893
885
  } = _ref29;
894
- this.#koniState.setAutoLockTime(autoLockTime);
886
+ this.#koniState.updateSetting('timeAutoLock', autoLockTime);
895
887
  return true;
896
888
  }
897
889
  async subscribeSettings(id, port) {
@@ -911,7 +903,28 @@ class KoniExtension {
911
903
  let {
912
904
  enable
913
905
  } = _ref30;
914
- this.#koniState.setEnableChainPatrol(enable);
906
+ this.#koniState.updateSetting('enableChainPatrol', enable);
907
+ return true;
908
+ }
909
+ setShowZeroBalance(_ref31) {
910
+ let {
911
+ show
912
+ } = _ref31;
913
+ this.#koniState.updateSetting('isShowZeroBalance', show);
914
+ return true;
915
+ }
916
+ setLanguage(_ref32) {
917
+ let {
918
+ language
919
+ } = _ref32;
920
+ this.#koniState.updateSetting('language', language);
921
+ return true;
922
+ }
923
+ setShowBalance(_ref33) {
924
+ let {
925
+ enable
926
+ } = _ref33;
927
+ this.#koniState.updateSetting('isShowBalance', enable);
915
928
  return true;
916
929
  }
917
930
  async subscribeAuthUrls(id, port) {
@@ -1086,7 +1099,7 @@ class KoniExtension {
1086
1099
  }
1087
1100
  });
1088
1101
  }
1089
- async accountsCreateSuriV2(_ref31) {
1102
+ async accountsCreateSuriV2(_ref34) {
1090
1103
  let {
1091
1104
  genesisHash,
1092
1105
  isAllowed,
@@ -1094,7 +1107,7 @@ class KoniExtension {
1094
1107
  password,
1095
1108
  suri: _suri,
1096
1109
  types
1097
- } = _ref31;
1110
+ } = _ref34;
1098
1111
  const addressDict = {};
1099
1112
  let changedAccount = false;
1100
1113
  const hasMasterPassword = _uiKeyring.keyring.keyring.hasMasterPassword;
@@ -1142,10 +1155,10 @@ class KoniExtension {
1142
1155
  });
1143
1156
  return addressDict;
1144
1157
  }
1145
- async accountsForgetOverride(_ref32) {
1158
+ async accountsForgetOverride(_ref35) {
1146
1159
  let {
1147
1160
  address
1148
- } = _ref32;
1161
+ } = _ref35;
1149
1162
  _uiKeyring.keyring.forgetAccount(address);
1150
1163
  await new Promise(resolve => {
1151
1164
  this.#koniState.removeAccountRef(address, () => {
@@ -1178,12 +1191,12 @@ class KoniExtension {
1178
1191
  await this.#koniState.disableMantaPay(address);
1179
1192
  return true;
1180
1193
  }
1181
- seedCreateV2(_ref33) {
1194
+ seedCreateV2(_ref36) {
1182
1195
  let {
1183
1196
  length = _Extension.SEED_DEFAULT_LENGTH,
1184
1197
  seed: _seed,
1185
1198
  types
1186
- } = _ref33;
1199
+ } = _ref36;
1187
1200
  const seed = _seed || (0, _utilCrypto.mnemonicGenerate)(length);
1188
1201
  const rs = {
1189
1202
  seed: seed,
@@ -1194,11 +1207,11 @@ class KoniExtension {
1194
1207
  });
1195
1208
  return rs;
1196
1209
  }
1197
- seedValidateV2(_ref34) {
1210
+ seedValidateV2(_ref37) {
1198
1211
  let {
1199
1212
  suri,
1200
1213
  types
1201
- } = _ref34;
1214
+ } = _ref37;
1202
1215
  const {
1203
1216
  phrase
1204
1217
  } = (0, _utilCrypto.keyExtractSuri)(suri);
@@ -1218,11 +1231,11 @@ class KoniExtension {
1218
1231
  });
1219
1232
  return rs;
1220
1233
  }
1221
- _checkValidatePrivateKey(_ref35) {
1234
+ _checkValidatePrivateKey(_ref38) {
1222
1235
  let {
1223
1236
  suri,
1224
1237
  types
1225
- } = _ref35;
1238
+ } = _ref38;
1226
1239
  let autoAddPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1227
1240
  const {
1228
1241
  phrase
@@ -1245,11 +1258,11 @@ class KoniExtension {
1245
1258
  }
1246
1259
  return rs;
1247
1260
  }
1248
- metamaskPrivateKeyValidateV2(_ref36) {
1261
+ metamaskPrivateKeyValidateV2(_ref39) {
1249
1262
  let {
1250
1263
  suri,
1251
1264
  types
1252
- } = _ref36;
1265
+ } = _ref39;
1253
1266
  const isValidSuri = suri.startsWith('0x');
1254
1267
  if (isValidSuri) {
1255
1268
  return this._checkValidatePrivateKey({
@@ -1274,14 +1287,14 @@ class KoniExtension {
1274
1287
  throw new Error(`"${suri}" is not a valid derivation path`);
1275
1288
  }
1276
1289
  }
1277
- derivationCreateV2(_ref37) {
1290
+ derivationCreateV2(_ref40) {
1278
1291
  let {
1279
1292
  genesisHash,
1280
1293
  isAllowed,
1281
1294
  name,
1282
1295
  parentAddress,
1283
1296
  suri
1284
- } = _ref37;
1297
+ } = _ref40;
1285
1298
  const childPair = this.deriveV2(parentAddress, suri, {
1286
1299
  genesisHash,
1287
1300
  name,
@@ -1295,14 +1308,14 @@ class KoniExtension {
1295
1308
  });
1296
1309
  return true;
1297
1310
  }
1298
- jsonRestoreV2(_ref38) {
1311
+ jsonRestoreV2(_ref41) {
1299
1312
  let {
1300
1313
  address,
1301
1314
  file,
1302
1315
  isAllowed,
1303
1316
  password,
1304
1317
  withMasterPassword
1305
- } = _ref38;
1318
+ } = _ref41;
1306
1319
  const isPasswordValidated = this.validatePassword(file, password);
1307
1320
  if (isPasswordValidated) {
1308
1321
  try {
@@ -1317,13 +1330,13 @@ class KoniExtension {
1317
1330
  throw new Error('Unable to decode using the supplied passphrase');
1318
1331
  }
1319
1332
  }
1320
- batchRestoreV2(_ref39) {
1333
+ batchRestoreV2(_ref42) {
1321
1334
  let {
1322
1335
  accountsInfo,
1323
1336
  file,
1324
1337
  isAllowed,
1325
1338
  password
1326
- } = _ref39;
1339
+ } = _ref42;
1327
1340
  const addressList = accountsInfo.map(acc => acc.address);
1328
1341
  const isPasswordValidated = this.validatedAccountsPassword(file, password);
1329
1342
  if (isPasswordValidated) {
@@ -1524,6 +1537,8 @@ class KoniExtension {
1524
1537
 
1525
1538
  const additionalValidator = async inputTransaction => {
1526
1539
  const minAmount = tokenInfo.minAmount || '0';
1540
+
1541
+ // Check ed for sender
1527
1542
  if (!isTransferNativeToken) {
1528
1543
  const {
1529
1544
  value: balance
@@ -1539,10 +1554,12 @@ class KoniExtension {
1539
1554
  const {
1540
1555
  value: receiverBalance
1541
1556
  } = await this.getAddressFreeBalance({
1542
- address: from,
1557
+ address: to,
1543
1558
  networkKey,
1544
1559
  token: tokenSlug
1545
1560
  });
1561
+
1562
+ // Check ed for receiver
1546
1563
  if (new _bignumber.default(receiverBalance).plus(transferAmount.value).lt(minAmount)) {
1547
1564
  const atLeast = new _bignumber.default(minAmount).minus(receiverBalance).plus((tokenInfo.decimals || 0) === 0 ? 0 : 1);
1548
1565
  const atLeastStr = (0, _number.formatNumber)(atLeast, tokenInfo.decimals || 0, _number.balanceFormatter);
@@ -1606,16 +1623,24 @@ class KoniExtension {
1606
1623
  additionalValidator = async inputTransaction => {
1607
1624
  const destMinAmount = destinationTokenInfo.minAmount || '0';
1608
1625
  const atLeast = new _bignumber.default(destMinAmount).multipliedBy(_constants.XCM_MIN_AMOUNT_RATIO);
1626
+
1627
+ // Check ed for receiver
1609
1628
  if (new _bignumber.default(value).lt(atLeast)) {
1610
1629
  const atLeastStr = (0, _number.formatNumber)(atLeast, destinationTokenInfo.decimals || 0, _number.balanceFormatter);
1611
1630
  inputTransaction.errors.push(new _TransactionError.TransactionError(_KoniTypes.TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, `You must transfer at least ${atLeastStr} ${originTokenInfo.symbol} to keep the destination account alive`));
1612
1631
  }
1613
1632
  const srcMinAmount = originTokenInfo.minAmount || '0';
1614
1633
  const isTransferNativeToken = originTokenInfo.assetType === _types._AssetType.NATIVE;
1634
+
1635
+ // Check ed for sender
1615
1636
  if (!isTransferNativeToken) {
1616
1637
  const {
1617
1638
  value: balance
1618
- } = await this.#koniState.balanceService.getTokenFreeBalance(from, originNetworkKey, originTokenInfo.slug);
1639
+ } = await this.getAddressFreeBalance({
1640
+ address: from,
1641
+ networkKey: originNetworkKey,
1642
+ token: originTokenInfo.slug
1643
+ });
1619
1644
  if (new _bignumber.default(balance).minus(value).lt(srcMinAmount)) {
1620
1645
  inputTransaction.warnings.push(new _TransactionWarning.TransactionWarning(_KoniTypes.BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT, ''));
1621
1646
  }
@@ -1694,18 +1719,18 @@ class KoniExtension {
1694
1719
  disableChain(networkKey) {
1695
1720
  return this.#koniState.disableChain(networkKey);
1696
1721
  }
1697
- async enableChain(_ref40) {
1722
+ async enableChain(_ref43) {
1698
1723
  let {
1699
1724
  chainSlug,
1700
1725
  enableTokens
1701
- } = _ref40;
1726
+ } = _ref43;
1702
1727
  return await this.#koniState.enableChain(chainSlug, enableTokens);
1703
1728
  }
1704
- async validateNetwork(_ref41) {
1729
+ async validateNetwork(_ref44) {
1705
1730
  let {
1706
1731
  existedChainSlug,
1707
1732
  provider
1708
- } = _ref41;
1733
+ } = _ref44;
1709
1734
  return await this.#koniState.validateCustomChain(provider, existedChainSlug);
1710
1735
  }
1711
1736
  resetDefaultNetwork() {
@@ -1743,12 +1768,12 @@ class KoniExtension {
1743
1768
  async validateCustomAsset(data) {
1744
1769
  return await this.#koniState.validateCustomAsset(data);
1745
1770
  }
1746
- async getAddressFreeBalance(_ref42) {
1771
+ async getAddressFreeBalance(_ref45) {
1747
1772
  let {
1748
1773
  address,
1749
1774
  networkKey,
1750
1775
  token
1751
- } = _ref42;
1776
+ } = _ref45;
1752
1777
  if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
1753
1778
  const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
1754
1779
  if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
@@ -1757,14 +1782,14 @@ class KoniExtension {
1757
1782
  }
1758
1783
  return await this.#koniState.balanceService.getTokenFreeBalance(address, networkKey, token);
1759
1784
  }
1760
- async transferGetMaxTransferable(_ref43) {
1785
+ async transferGetMaxTransferable(_ref46) {
1761
1786
  let {
1762
1787
  address,
1763
1788
  destChain,
1764
1789
  isXcmTransfer,
1765
1790
  networkKey,
1766
1791
  token
1767
- } = _ref43;
1792
+ } = _ref46;
1768
1793
  const freeBalance = await this.getAddressFreeBalance({
1769
1794
  address,
1770
1795
  networkKey,
@@ -1839,12 +1864,12 @@ class KoniExtension {
1839
1864
  };
1840
1865
  }
1841
1866
  }
1842
- async subscribeAddressFreeBalance(_ref44, id, port) {
1867
+ async subscribeAddressFreeBalance(_ref47, id, port) {
1843
1868
  let {
1844
1869
  address,
1845
1870
  networkKey,
1846
1871
  token
1847
- } = _ref44;
1872
+ } = _ref47;
1848
1873
  const cb = (0, _subscriptions.createSubscription)(id, port);
1849
1874
  const [unsub, currentFreeBalance] = await this.#koniState.balanceService.subscribeTokenFreeBalance(address, networkKey, token, cb);
1850
1875
  this.createUnsubscriptionHandle(id, unsub);
@@ -1853,26 +1878,26 @@ class KoniExtension {
1853
1878
  });
1854
1879
  return currentFreeBalance;
1855
1880
  }
1856
- async transferCheckReferenceCount(_ref45) {
1881
+ async transferCheckReferenceCount(_ref48) {
1857
1882
  let {
1858
1883
  address,
1859
1884
  networkKey
1860
- } = _ref45;
1885
+ } = _ref48;
1861
1886
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return
1862
1887
  return await (0, _transfer.checkReferenceCount)(networkKey, address, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
1863
1888
  }
1864
- async transferCheckSupporting(_ref46) {
1889
+ async transferCheckSupporting(_ref49) {
1865
1890
  let {
1866
1891
  networkKey,
1867
1892
  tokenSlug
1868
- } = _ref46;
1893
+ } = _ref49;
1869
1894
  const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
1870
1895
  return await (0, _transfer.checkSupportTransfer)(networkKey, tokenInfo, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
1871
1896
  }
1872
- transferGetExistentialDeposit(_ref47) {
1897
+ transferGetExistentialDeposit(_ref50) {
1873
1898
  let {
1874
1899
  tokenSlug
1875
- } = _ref47;
1900
+ } = _ref50;
1876
1901
  const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
1877
1902
  return (0, _utils._getTokenMinAmount)(tokenInfo);
1878
1903
  }
@@ -1908,11 +1933,11 @@ class KoniExtension {
1908
1933
  isSendingSelf
1909
1934
  };
1910
1935
  }
1911
- async enableChains(_ref48) {
1936
+ async enableChains(_ref51) {
1912
1937
  let {
1913
1938
  chainSlugs,
1914
1939
  enableTokens
1915
- } = _ref48;
1940
+ } = _ref51;
1916
1941
  try {
1917
1942
  await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
1918
1943
  chainSlug,
@@ -1923,24 +1948,24 @@ class KoniExtension {
1923
1948
  }
1924
1949
  return true;
1925
1950
  }
1926
- getAccountMeta(_ref49) {
1951
+ getAccountMeta(_ref52) {
1927
1952
  let {
1928
1953
  address
1929
- } = _ref49;
1954
+ } = _ref52;
1930
1955
  const pair = _uiKeyring.keyring.getPair(address);
1931
1956
  (0, _util.assert)(pair, 'Unable to find pair');
1932
1957
  return {
1933
1958
  meta: pair.meta
1934
1959
  };
1935
1960
  }
1936
- accountsTie2(_ref50) {
1961
+ accountsTie2(_ref53) {
1937
1962
  let {
1938
1963
  address,
1939
1964
  genesisHash
1940
- } = _ref50;
1965
+ } = _ref53;
1941
1966
  return this.#koniState.setAccountTie(address, genesisHash);
1942
1967
  }
1943
- async accountsCreateExternalV2(_ref51) {
1968
+ async accountsCreateExternalV2(_ref54) {
1944
1969
  let {
1945
1970
  address,
1946
1971
  genesisHash,
@@ -1948,7 +1973,7 @@ class KoniExtension {
1948
1973
  isEthereum,
1949
1974
  isReadOnly,
1950
1975
  name
1951
- } = _ref51;
1976
+ } = _ref54;
1952
1977
  try {
1953
1978
  let result;
1954
1979
  try {
@@ -2007,7 +2032,7 @@ class KoniExtension {
2007
2032
  }];
2008
2033
  }
2009
2034
  }
2010
- async accountsCreateHardwareV2(_ref52) {
2035
+ async accountsCreateHardwareV2(_ref55) {
2011
2036
  let {
2012
2037
  accountIndex,
2013
2038
  address,
@@ -2016,7 +2041,7 @@ class KoniExtension {
2016
2041
  hardwareType,
2017
2042
  isAllowed,
2018
2043
  name
2019
- } = _ref52;
2044
+ } = _ref55;
2020
2045
  const key = _uiKeyring.keyring.addHardware(address, hardwareType, {
2021
2046
  accountIndex,
2022
2047
  addressOffset,
@@ -2039,10 +2064,10 @@ class KoniExtension {
2039
2064
  });
2040
2065
  return true;
2041
2066
  }
2042
- async accountsCreateHardwareMultiple(_ref53) {
2067
+ async accountsCreateHardwareMultiple(_ref56) {
2043
2068
  let {
2044
2069
  accounts
2045
- } = _ref53;
2070
+ } = _ref56;
2046
2071
  const addresses = [];
2047
2072
  if (!accounts.length) {
2048
2073
  throw new Error('No accounts to import');
@@ -2120,14 +2145,14 @@ class KoniExtension {
2120
2145
  }
2121
2146
  return true;
2122
2147
  }
2123
- async accountsCreateWithSecret(_ref54) {
2148
+ async accountsCreateWithSecret(_ref57) {
2124
2149
  let {
2125
2150
  isAllow,
2126
2151
  isEthereum,
2127
2152
  name,
2128
2153
  publicKey,
2129
2154
  secretKey
2130
- } = _ref54;
2155
+ } = _ref57;
2131
2156
  try {
2132
2157
  let keyringPair = null;
2133
2158
  if (isEthereum) {
@@ -2270,30 +2295,30 @@ class KoniExtension {
2270
2295
 
2271
2296
  // Parse transaction
2272
2297
 
2273
- parseSubstrateTransaction(_ref55) {
2298
+ parseSubstrateTransaction(_ref58) {
2274
2299
  let {
2275
2300
  data,
2276
2301
  networkKey
2277
- } = _ref55;
2302
+ } = _ref58;
2278
2303
  const apiProps = this.#koniState.getSubstrateApi(networkKey);
2279
2304
  const apiPromise = apiProps.api;
2280
2305
  return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
2281
2306
  }
2282
- async parseEVMRLP(_ref56) {
2307
+ async parseEVMRLP(_ref59) {
2283
2308
  let {
2284
2309
  data
2285
- } = _ref56;
2310
+ } = _ref59;
2286
2311
  return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
2287
2312
  }
2288
2313
 
2289
2314
  // Sign
2290
2315
 
2291
- qrSignSubstrate(_ref57) {
2316
+ qrSignSubstrate(_ref60) {
2292
2317
  let {
2293
2318
  address,
2294
2319
  data,
2295
2320
  networkKey
2296
- } = _ref57;
2321
+ } = _ref60;
2297
2322
  const pair = _uiKeyring.keyring.getPair(address);
2298
2323
  (0, _util.assert)(pair, 'Unable to find pair');
2299
2324
  if (pair.isLocked) {
@@ -2310,13 +2335,13 @@ class KoniExtension {
2310
2335
  signature: signed
2311
2336
  };
2312
2337
  }
2313
- async qrSignEVM(_ref58) {
2338
+ async qrSignEVM(_ref61) {
2314
2339
  let {
2315
2340
  address,
2316
2341
  chainId,
2317
2342
  message,
2318
2343
  type
2319
- } = _ref58;
2344
+ } = _ref61;
2320
2345
  let signed;
2321
2346
  const network = this.getNetworkJsonByChainId(chainId);
2322
2347
  if (!network) {
@@ -2397,11 +2422,11 @@ class KoniExtension {
2397
2422
  });
2398
2423
  return this.#koniState.getNominatorMetadata();
2399
2424
  }
2400
- async getBondingOptions(_ref59) {
2425
+ async getBondingOptions(_ref62) {
2401
2426
  let {
2402
2427
  chain,
2403
2428
  type
2404
- } = _ref59;
2429
+ } = _ref62;
2405
2430
  const apiProps = this.#koniState.getSubstrateApi(chain);
2406
2431
  const chainInfo = this.#koniState.getChainInfo(chain);
2407
2432
  const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
@@ -2590,12 +2615,12 @@ class KoniExtension {
2590
2615
  }
2591
2616
 
2592
2617
  // EVM Transaction
2593
- async parseContractInput(_ref60) {
2618
+ async parseContractInput(_ref63) {
2594
2619
  let {
2595
2620
  chainId,
2596
2621
  contract,
2597
2622
  data
2598
- } = _ref60;
2623
+ } = _ref63;
2599
2624
  const network = this.getNetworkJsonByChainId(chainId);
2600
2625
  return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
2601
2626
  }
@@ -2666,12 +2691,12 @@ class KoniExtension {
2666
2691
 
2667
2692
  // Change master password
2668
2693
 
2669
- keyringChangeMasterPassword(_ref61) {
2694
+ keyringChangeMasterPassword(_ref64) {
2670
2695
  let {
2671
2696
  createNew,
2672
2697
  newPassword,
2673
2698
  oldPassword
2674
- } = _ref61;
2699
+ } = _ref64;
2675
2700
  try {
2676
2701
  // Remove isMasterPassword meta if createNew
2677
2702
  if (createNew) {
@@ -2705,11 +2730,11 @@ class KoniExtension {
2705
2730
 
2706
2731
  // Migrate password
2707
2732
 
2708
- keyringMigrateMasterPassword(_ref62) {
2733
+ keyringMigrateMasterPassword(_ref65) {
2709
2734
  let {
2710
2735
  address,
2711
2736
  password
2712
- } = _ref62;
2737
+ } = _ref65;
2713
2738
  try {
2714
2739
  _uiKeyring.keyring.migrateWithMasterPassword(address, password);
2715
2740
  } catch (e) {
@@ -2727,10 +2752,10 @@ class KoniExtension {
2727
2752
 
2728
2753
  // Unlock wallet
2729
2754
 
2730
- keyringUnlock(_ref63) {
2755
+ keyringUnlock(_ref66) {
2731
2756
  let {
2732
2757
  password
2733
- } = _ref63;
2758
+ } = _ref66;
2734
2759
  try {
2735
2760
  _uiKeyring.keyring.unlockKeyring(password);
2736
2761
  this.#koniState.initMantaPay(password).catch(console.error);
@@ -2757,11 +2782,11 @@ class KoniExtension {
2757
2782
 
2758
2783
  // Export mnemonic
2759
2784
 
2760
- keyringExportMnemonic(_ref64) {
2785
+ keyringExportMnemonic(_ref67) {
2761
2786
  let {
2762
2787
  address,
2763
2788
  password
2764
- } = _ref64;
2789
+ } = _ref67;
2765
2790
  const pair = _uiKeyring.keyring.getPair(address);
2766
2791
  const result = pair.exportMnemonic(password);
2767
2792
  return {
@@ -2771,10 +2796,10 @@ class KoniExtension {
2771
2796
 
2772
2797
  // Reset wallet
2773
2798
 
2774
- async resetWallet(_ref65) {
2799
+ async resetWallet(_ref68) {
2775
2800
  let {
2776
2801
  resetAll
2777
- } = _ref65;
2802
+ } = _ref68;
2778
2803
  try {
2779
2804
  await this.#koniState.resetWallet(resetAll);
2780
2805
  return {
@@ -2790,10 +2815,10 @@ class KoniExtension {
2790
2815
  }
2791
2816
 
2792
2817
  /// Signing external request
2793
- signingApprovePasswordV2(_ref66) {
2818
+ signingApprovePasswordV2(_ref69) {
2794
2819
  let {
2795
2820
  id
2796
- } = _ref66;
2821
+ } = _ref69;
2797
2822
  const queued = this.#koniState.getSignRequest(id);
2798
2823
  (0, _util.assert)(queued, 'Unable to find request');
2799
2824
  const {
@@ -2819,7 +2844,7 @@ class KoniExtension {
2819
2844
  const {
2820
2845
  payload
2821
2846
  } = request;
2822
- const registry = new _types3.TypeRegistry();
2847
+ let registry = new _types3.TypeRegistry();
2823
2848
  let isEvm = false;
2824
2849
  if ((0, _Extension.isJsonPayload)(payload)) {
2825
2850
  // Get the metadata for the genesisHash
@@ -2831,6 +2856,15 @@ class KoniExtension {
2831
2856
  registry.register(currentMetadata === null || currentMetadata === void 0 ? void 0 : currentMetadata.types);
2832
2857
  }
2833
2858
  const [, chainInfo] = this.#koniState.findNetworkKeyByGenesisHash(payload.genesisHash);
2859
+ if (chainInfo && _constants2._API_OPTIONS_CHAIN_GROUP.avail.includes(chainInfo.slug)) {
2860
+ const isChainActive = this.#koniState.getChainStateByKey(chainInfo.slug).active;
2861
+ if (!isChainActive) {
2862
+ reject(new Error('Unable to sign'));
2863
+ return false;
2864
+ } else {
2865
+ registry = this.#koniState.getSubstrateApi(chainInfo.slug).api.registry;
2866
+ }
2867
+ }
2834
2868
  if (chainInfo) {
2835
2869
  isEvm = (0, _utils._isChainEvmCompatible)(chainInfo);
2836
2870
  }
@@ -2846,22 +2880,22 @@ class KoniExtension {
2846
2880
 
2847
2881
  /// Derive account
2848
2882
 
2849
- derivationCreateMultiple(_ref67) {
2883
+ derivationCreateMultiple(_ref70) {
2850
2884
  let {
2851
2885
  isAllowed,
2852
2886
  items,
2853
2887
  parentAddress
2854
- } = _ref67;
2888
+ } = _ref70;
2855
2889
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2856
2890
  const isEvm = parentPair.type === 'ethereum';
2857
2891
  if (parentPair.isLocked) {
2858
2892
  _uiKeyring.keyring.unlockPair(parentPair.address);
2859
2893
  }
2860
- const createChild = _ref68 => {
2894
+ const createChild = _ref71 => {
2861
2895
  let {
2862
2896
  name,
2863
2897
  suri
2864
- } = _ref68;
2898
+ } = _ref71;
2865
2899
  const meta = {
2866
2900
  name: name,
2867
2901
  parentAddress
@@ -2907,10 +2941,10 @@ class KoniExtension {
2907
2941
  }
2908
2942
  return true;
2909
2943
  }
2910
- derivationCreateV3(_ref69) {
2944
+ derivationCreateV3(_ref72) {
2911
2945
  let {
2912
2946
  address: parentAddress
2913
- } = _ref69;
2947
+ } = _ref72;
2914
2948
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2915
2949
  const isEvm = parentPair.type === 'ethereum';
2916
2950
  if (parentPair.isLocked) {
@@ -2942,11 +2976,11 @@ class KoniExtension {
2942
2976
  });
2943
2977
  return true;
2944
2978
  }
2945
- validateDerivePath(_ref70) {
2979
+ validateDerivePath(_ref73) {
2946
2980
  let {
2947
2981
  parentAddress,
2948
2982
  suri
2949
- } = _ref70;
2983
+ } = _ref73;
2950
2984
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2951
2985
  const isEvm = parentPair.type === 'ethereum';
2952
2986
  if (parentPair.isLocked) {
@@ -2979,12 +3013,12 @@ class KoniExtension {
2979
3013
  suri: meta.suri
2980
3014
  };
2981
3015
  }
2982
- getListDeriveAccounts(_ref71) {
3016
+ getListDeriveAccounts(_ref74) {
2983
3017
  let {
2984
3018
  limit,
2985
3019
  page,
2986
3020
  parentAddress
2987
- } = _ref71;
3021
+ } = _ref74;
2988
3022
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2989
3023
  const isEvm = parentPair.type === 'ethereum';
2990
3024
  if (parentPair.isLocked) {
@@ -3075,10 +3109,10 @@ class KoniExtension {
3075
3109
  getSupportedSmartContractTypes() {
3076
3110
  return this.#koniState.getSupportedSmartContractTypes();
3077
3111
  }
3078
- getTransaction(_ref72) {
3112
+ getTransaction(_ref75) {
3079
3113
  let {
3080
3114
  id
3081
- } = _ref72;
3115
+ } = _ref75;
3082
3116
  const {
3083
3117
  transaction,
3084
3118
  ...transactionResult
@@ -3088,8 +3122,8 @@ class KoniExtension {
3088
3122
  subscribeTransactions(id, port) {
3089
3123
  const cb = (0, _subscriptions.createSubscription)(id, port);
3090
3124
  function convertRs(rs) {
3091
- return Object.fromEntries(Object.entries(rs).map(_ref73 => {
3092
- let [key, value] = _ref73;
3125
+ return Object.fromEntries(Object.entries(rs).map(_ref76 => {
3126
+ let [key, value] = _ref76;
3093
3127
  const {
3094
3128
  additionalValidator,
3095
3129
  eventsHandler,
@@ -3121,10 +3155,10 @@ class KoniExtension {
3121
3155
  });
3122
3156
  return notificationSubject.value;
3123
3157
  }
3124
- async reloadCron(_ref74) {
3158
+ async reloadCron(_ref77) {
3125
3159
  let {
3126
3160
  data
3127
- } = _ref74;
3161
+ } = _ref77;
3128
3162
  if (data === 'nft') {
3129
3163
  return await this.#koniState.reloadNft();
3130
3164
  } else if (data === 'staking') {
@@ -3142,20 +3176,20 @@ class KoniExtension {
3142
3176
 
3143
3177
  // Phishing detect
3144
3178
 
3145
- async passPhishingPage(_ref75) {
3179
+ async passPhishingPage(_ref78) {
3146
3180
  let {
3147
3181
  url
3148
- } = _ref75;
3182
+ } = _ref78;
3149
3183
  return await this.#koniState.approvePassPhishingPage(url);
3150
3184
  }
3151
3185
 
3152
3186
  /// Wallet connect
3153
3187
 
3154
3188
  // Connect
3155
- async connectWalletConnect(_ref76) {
3189
+ async connectWalletConnect(_ref79) {
3156
3190
  let {
3157
3191
  uri
3158
- } = _ref76;
3192
+ } = _ref79;
3159
3193
  await this.#koniState.walletConnectService.connect(uri);
3160
3194
  return true;
3161
3195
  }
@@ -3168,11 +3202,11 @@ class KoniExtension {
3168
3202
  });
3169
3203
  return this.#koniState.requestService.allConnectWCRequests;
3170
3204
  }
3171
- async approveWalletConnectSession(_ref77) {
3205
+ async approveWalletConnectSession(_ref80) {
3172
3206
  let {
3173
3207
  accounts: selectedAccounts,
3174
3208
  id
3175
- } = _ref77;
3209
+ } = _ref80;
3176
3210
  const request = this.#koniState.requestService.getConnectWCRequest(id);
3177
3211
  if ((0, _helpers2.isProposalExpired)(request.request.params)) {
3178
3212
  throw new Error('The proposal has been expired');
@@ -3184,8 +3218,8 @@ class KoniExtension {
3184
3218
  const availableNamespaces = {};
3185
3219
  const namespaces = {};
3186
3220
  const chainInfoMap = this.#koniState.getChainInfoMap();
3187
- Object.entries(requiredNamespaces).forEach(_ref78 => {
3188
- let [key, namespace] = _ref78;
3221
+ Object.entries(requiredNamespaces).forEach(_ref81 => {
3222
+ let [key, namespace] = _ref81;
3189
3223
  if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
3190
3224
  if (namespace.chains) {
3191
3225
  const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
@@ -3198,8 +3232,8 @@ class KoniExtension {
3198
3232
  throw new Error((0, _utils3.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
3199
3233
  }
3200
3234
  });
3201
- Object.entries(optionalNamespaces).forEach(_ref79 => {
3202
- let [key, namespace] = _ref79;
3235
+ Object.entries(optionalNamespaces).forEach(_ref82 => {
3236
+ let [key, namespace] = _ref82;
3203
3237
  if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
3204
3238
  if (namespace.chains) {
3205
3239
  const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
@@ -3223,8 +3257,8 @@ class KoniExtension {
3223
3257
  }
3224
3258
  }
3225
3259
  });
3226
- Object.entries(availableNamespaces).forEach(_ref80 => {
3227
- let [key, namespace] = _ref80;
3260
+ Object.entries(availableNamespaces).forEach(_ref83 => {
3261
+ let [key, namespace] = _ref83;
3228
3262
  if (namespace.chains) {
3229
3263
  const accounts = [];
3230
3264
  const chains = (0, _utils2.uniqueStringArray)(namespace.chains);
@@ -3248,10 +3282,10 @@ class KoniExtension {
3248
3282
  request.resolve();
3249
3283
  return true;
3250
3284
  }
3251
- async rejectWalletConnectSession(_ref81) {
3285
+ async rejectWalletConnectSession(_ref84) {
3252
3286
  let {
3253
3287
  id
3254
- } = _ref81;
3288
+ } = _ref84;
3255
3289
  const request = this.#koniState.requestService.getConnectWCRequest(id);
3256
3290
  const wcId = request.request.id;
3257
3291
  if ((0, _helpers2.isProposalExpired)(request.request.params)) {
@@ -3273,23 +3307,24 @@ class KoniExtension {
3273
3307
  });
3274
3308
  return this.#koniState.walletConnectService.sessions;
3275
3309
  }
3276
- async disconnectWalletConnectSession(_ref82) {
3310
+ async disconnectWalletConnectSession(_ref85) {
3277
3311
  let {
3278
3312
  topic
3279
- } = _ref82;
3313
+ } = _ref85;
3280
3314
  await this.#koniState.walletConnectService.disconnect(topic);
3281
3315
  return true;
3282
3316
  }
3283
- async enableMantaPay(_ref83) {
3317
+ async enableMantaPay(_ref86) {
3284
3318
  let {
3285
3319
  address,
3286
3320
  password
3287
- } = _ref83;
3321
+ } = _ref86;
3288
3322
  // always takes the current account
3289
3323
  function timeout() {
3290
3324
  return new Promise(resolve => setTimeout(resolve, 1500));
3291
3325
  }
3292
3326
  try {
3327
+ var _this$koniState$chain, _this$koniState$chain2;
3293
3328
  await this.#koniState.chainService.enableChain(_constants2._DEFAULT_MANTA_ZK_CHAIN);
3294
3329
  this.#koniState.chainService.setMantaZkAssetSettings(true);
3295
3330
  const mnemonic = this.keyringExportMnemonic({
@@ -3308,16 +3343,16 @@ class KoniExtension {
3308
3343
  await this.saveCurrentAccountAddress({
3309
3344
  address
3310
3345
  });
3311
- const unsubSyncProgress = await this.#koniState.chainService.mantaPay.subscribeSyncProgress();
3346
+ const unsubSyncProgress = await ((_this$koniState$chain = this.#koniState.chainService) === null || _this$koniState$chain === void 0 ? void 0 : (_this$koniState$chain2 = _this$koniState$chain.mantaPay) === null || _this$koniState$chain2 === void 0 ? void 0 : _this$koniState$chain2.subscribeSyncProgress());
3312
3347
  console.debug('Start initial sync for MantaPay');
3313
3348
  this.#koniState.initialSyncMantaPay(address).then(() => {
3314
3349
  console.debug('Finished initial sync for MantaPay');
3315
3350
  this.#skipAutoLock = false;
3316
- unsubSyncProgress();
3351
+ unsubSyncProgress && unsubSyncProgress();
3317
3352
  }).catch(e => {
3318
3353
  console.error('Error syncing MantaPay', e);
3319
3354
  this.#skipAutoLock = false;
3320
- unsubSyncProgress();
3355
+ unsubSyncProgress && unsubSyncProgress();
3321
3356
  });
3322
3357
  return {
3323
3358
  success: !!result,
@@ -3339,29 +3374,32 @@ class KoniExtension {
3339
3374
  }
3340
3375
  }
3341
3376
  async initSyncMantaPay(address) {
3342
- if (this.#koniState.chainService.mantaPay.getSyncState().isSyncing) {
3377
+ var _this$koniState$chain3, _this$koniState$chain4, _this$koniState$chain5, _this$koniState$chain6;
3378
+ if ((_this$koniState$chain3 = this.#koniState.chainService) !== null && _this$koniState$chain3 !== void 0 && (_this$koniState$chain4 = _this$koniState$chain3.mantaPay) !== null && _this$koniState$chain4 !== void 0 && _this$koniState$chain4.getSyncState().isSyncing) {
3343
3379
  return;
3344
3380
  }
3345
3381
  this.#skipAutoLock = true;
3346
3382
  await this.saveCurrentAccountAddress({
3347
3383
  address
3348
3384
  });
3349
- const unsubSyncProgress = await this.#koniState.chainService.mantaPay.subscribeSyncProgress();
3385
+ const unsubSyncProgress = await ((_this$koniState$chain5 = this.#koniState.chainService) === null || _this$koniState$chain5 === void 0 ? void 0 : (_this$koniState$chain6 = _this$koniState$chain5.mantaPay) === null || _this$koniState$chain6 === void 0 ? void 0 : _this$koniState$chain6.subscribeSyncProgress());
3350
3386
  console.debug('Start initial sync for MantaPay');
3351
3387
  this.#koniState.initialSyncMantaPay(address).then(() => {
3388
+ var _this$koniState$chain7, _this$koniState$chain8;
3352
3389
  console.debug('Finished initial sync for MantaPay');
3353
3390
  this.#skipAutoLock = false;
3354
- unsubSyncProgress();
3391
+ unsubSyncProgress && unsubSyncProgress();
3355
3392
  // make sure the sync state is set, just in case it gets unsubscribed
3356
- this.#koniState.chainService.mantaPay.setSyncState({
3393
+ (_this$koniState$chain7 = this.#koniState.chainService) === null || _this$koniState$chain7 === void 0 ? void 0 : (_this$koniState$chain8 = _this$koniState$chain7.mantaPay) === null || _this$koniState$chain8 === void 0 ? void 0 : _this$koniState$chain8.setSyncState({
3357
3394
  progress: 100,
3358
3395
  isSyncing: false
3359
3396
  });
3360
3397
  }).catch(e => {
3398
+ var _this$koniState$chain9, _this$koniState$chain10;
3361
3399
  console.error('Error syncing MantaPay', e);
3362
3400
  this.#skipAutoLock = false;
3363
- unsubSyncProgress();
3364
- this.#koniState.chainService.mantaPay.setSyncState({
3401
+ unsubSyncProgress && unsubSyncProgress();
3402
+ (_this$koniState$chain9 = this.#koniState.chainService) === null || _this$koniState$chain9 === void 0 ? void 0 : (_this$koniState$chain10 = _this$koniState$chain9.mantaPay) === null || _this$koniState$chain10 === void 0 ? void 0 : _this$koniState$chain10.setSyncState({
3365
3403
  progress: 0,
3366
3404
  isSyncing: false
3367
3405
  });
@@ -3384,8 +3422,9 @@ class KoniExtension {
3384
3422
  return this.#koniState.getMantaPayConfig('calamari');
3385
3423
  }
3386
3424
  subscribeMantaPaySyncState(id, port) {
3425
+ var _this$koniState$subsc, _this$koniState$chain11, _this$koniState$chain12;
3387
3426
  const cb = (0, _subscriptions.createSubscription)(id, port);
3388
- const syncingStateSubscription = this.#koniState.subscribeMantaPaySyncState().subscribe({
3427
+ const syncingStateSubscription = (_this$koniState$subsc = this.#koniState.subscribeMantaPaySyncState()) === null || _this$koniState$subsc === void 0 ? void 0 : _this$koniState$subsc.subscribe({
3389
3428
  next: rs => {
3390
3429
  cb(rs);
3391
3430
  }
@@ -3394,7 +3433,27 @@ class KoniExtension {
3394
3433
  port.onDisconnect.addListener(() => {
3395
3434
  this.cancelSubscription(id);
3396
3435
  });
3397
- return this.#koniState.chainService.mantaPay.getSyncState();
3436
+ return ((_this$koniState$chain11 = this.#koniState.chainService) === null || _this$koniState$chain11 === void 0 ? void 0 : (_this$koniState$chain12 = _this$koniState$chain11.mantaPay) === null || _this$koniState$chain12 === void 0 ? void 0 : _this$koniState$chain12.getSyncState()) || {
3437
+ isSyncing: false,
3438
+ progress: 0,
3439
+ needManualSync: false
3440
+ };
3441
+ }
3442
+
3443
+ /// Metadata
3444
+
3445
+ async findRawMetadata(_ref87) {
3446
+ let {
3447
+ genesisHash
3448
+ } = _ref87;
3449
+ const {
3450
+ metadata,
3451
+ specVersion
3452
+ } = await this.#koniState.findMetadata(genesisHash);
3453
+ return {
3454
+ rawMetadata: metadata,
3455
+ specVersion
3456
+ };
3398
3457
  }
3399
3458
 
3400
3459
  // --------------------------------------------------------------
@@ -3495,13 +3554,19 @@ class KoniExtension {
3495
3554
  case 'pri(settings.saveCamera)':
3496
3555
  return this.setCamera(request);
3497
3556
  case 'pri(settings.saveTheme)':
3498
- return this.saveTheme(request, id, port);
3557
+ return this.saveTheme(request);
3499
3558
  case 'pri(settings.saveBrowserConfirmationType)':
3500
- return this.saveBrowserConfirmationType(request, id, port);
3559
+ return this.saveBrowserConfirmationType(request);
3501
3560
  case 'pri(settings.saveAutoLockTime)':
3502
3561
  return this.setAutoLockTime(request);
3503
3562
  case 'pri(settings.saveEnableChainPatrol)':
3504
3563
  return this.setEnableChainPatrol(request);
3564
+ case 'pri(settings.saveShowZeroBalance)':
3565
+ return this.setShowZeroBalance(request);
3566
+ case 'pri(settings.saveLanguage)':
3567
+ return this.setLanguage(request);
3568
+ case 'pri(settings.saveShowBalance)':
3569
+ return this.setShowBalance(request);
3505
3570
  case 'pri(price.getPrice)':
3506
3571
  return await this.getPrice();
3507
3572
  case 'pri(price.getSubscription)':
@@ -3795,6 +3860,10 @@ class KoniExtension {
3795
3860
  return await this.disableMantaPay(request);
3796
3861
  case 'pri(mantaPay.subscribeSyncingState)':
3797
3862
  return this.subscribeMantaPaySyncState(id, port);
3863
+
3864
+ // Metadata
3865
+ case 'pri(metadata.find)':
3866
+ return this.findRawMetadata(request);
3798
3867
  // Default
3799
3868
  default:
3800
3869
  throw new Error(`Unable to handle message of type ${type}`);