@subwallet/extension-base 1.1.2-0 → 1.1.2-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 (77) hide show
  1. package/background/KoniTypes.d.ts +14 -4
  2. package/cjs/constants/i18n.js +10 -2
  3. package/cjs/koni/api/dotsama/transfer.js +6 -0
  4. package/cjs/koni/api/nft/acala_nft/index.js +0 -2
  5. package/cjs/koni/api/nft/bit.country/index.js +49 -18
  6. package/cjs/koni/api/nft/config.js +5 -3
  7. package/cjs/koni/api/nft/evm_nft/index.js +0 -5
  8. package/cjs/koni/api/nft/index.js +2 -3
  9. package/cjs/koni/api/nft/karura_nft/index.js +0 -2
  10. package/cjs/koni/api/nft/rmrk_nft/index.js +0 -4
  11. package/cjs/koni/api/nft/statemine_nft/index.js +0 -2
  12. package/cjs/koni/api/nft/unique_nft/index.js +0 -5
  13. package/cjs/koni/api/nft/wasm_nft/index.js +0 -5
  14. package/cjs/koni/api/staking/bonding/amplitude.js +6 -6
  15. package/cjs/koni/api/staking/bonding/astar.js +6 -6
  16. package/cjs/koni/api/staking/bonding/paraChain.js +5 -5
  17. package/cjs/koni/api/staking/bonding/relayChain.js +24 -14
  18. package/cjs/koni/api/staking/bonding/utils.js +1 -7
  19. package/cjs/koni/api/xcm/xTokens.js +1 -1
  20. package/cjs/koni/background/cron.js +2 -37
  21. package/cjs/koni/background/handlers/Extension.js +133 -123
  22. package/cjs/koni/background/handlers/State.js +6 -43
  23. package/cjs/koni/background/subscription.js +6 -88
  24. package/cjs/packageInfo.js +1 -1
  25. package/cjs/services/chain-service/constants.js +6 -4
  26. package/cjs/services/setting-service/constants.js +16 -6
  27. package/cjs/services/storage-service/DatabaseService.js +3 -0
  28. package/cjs/services/storage-service/db-stores/Nft.js +3 -0
  29. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -2
  30. package/cjs/utils/index.js +12 -0
  31. package/cjs/utils/translate.js +11 -0
  32. package/constants/i18n.d.ts +2 -1
  33. package/constants/i18n.js +8 -1
  34. package/koni/api/dotsama/transfer.js +6 -0
  35. package/koni/api/nft/acala_nft/index.js +0 -2
  36. package/koni/api/nft/bit.country/index.d.ts +1 -0
  37. package/koni/api/nft/bit.country/index.js +50 -19
  38. package/koni/api/nft/config.d.ts +2 -1
  39. package/koni/api/nft/config.js +2 -1
  40. package/koni/api/nft/evm_nft/index.js +0 -4
  41. package/koni/api/nft/index.d.ts +1 -1
  42. package/koni/api/nft/index.js +2 -3
  43. package/koni/api/nft/karura_nft/index.js +0 -2
  44. package/koni/api/nft/nft.d.ts +0 -1
  45. package/koni/api/nft/rmrk_nft/index.js +0 -4
  46. package/koni/api/nft/statemine_nft/index.js +0 -2
  47. package/koni/api/nft/unique_nft/index.js +0 -5
  48. package/koni/api/nft/wasm_nft/index.js +0 -4
  49. package/koni/api/staking/bonding/amplitude.js +6 -6
  50. package/koni/api/staking/bonding/astar.js +6 -6
  51. package/koni/api/staking/bonding/paraChain.js +5 -5
  52. package/koni/api/staking/bonding/relayChain.js +24 -14
  53. package/koni/api/staking/bonding/utils.js +1 -7
  54. package/koni/api/xcm/xTokens.js +1 -1
  55. package/koni/background/cron.d.ts +0 -5
  56. package/koni/background/cron.js +4 -39
  57. package/koni/background/handlers/Extension.d.ts +2 -0
  58. package/koni/background/handlers/Extension.js +25 -17
  59. package/koni/background/handlers/State.d.ts +2 -6
  60. package/koni/background/handlers/State.js +6 -43
  61. package/koni/background/subscription.d.ts +1 -4
  62. package/koni/background/subscription.js +9 -88
  63. package/package.json +11 -6
  64. package/packageInfo.js +1 -1
  65. package/services/chain-service/constants.d.ts +1 -0
  66. package/services/chain-service/constants.js +6 -4
  67. package/services/setting-service/constants.d.ts +6 -1
  68. package/services/setting-service/constants.js +10 -5
  69. package/services/storage-service/DatabaseService.d.ts +1 -0
  70. package/services/storage-service/DatabaseService.js +3 -0
  71. package/services/storage-service/db-stores/Nft.d.ts +1 -0
  72. package/services/storage-service/db-stores/Nft.js +3 -0
  73. package/services/storage-service/db-stores/NominatorMetadata.js +3 -2
  74. package/utils/index.d.ts +1 -0
  75. package/utils/index.js +2 -1
  76. package/utils/translate.d.ts +1 -0
  77. 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,21 @@ 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);
915
921
  return true;
916
922
  }
917
923
  async subscribeAuthUrls(id, port) {
@@ -1086,7 +1092,7 @@ class KoniExtension {
1086
1092
  }
1087
1093
  });
1088
1094
  }
1089
- async accountsCreateSuriV2(_ref31) {
1095
+ async accountsCreateSuriV2(_ref33) {
1090
1096
  let {
1091
1097
  genesisHash,
1092
1098
  isAllowed,
@@ -1094,7 +1100,7 @@ class KoniExtension {
1094
1100
  password,
1095
1101
  suri: _suri,
1096
1102
  types
1097
- } = _ref31;
1103
+ } = _ref33;
1098
1104
  const addressDict = {};
1099
1105
  let changedAccount = false;
1100
1106
  const hasMasterPassword = _uiKeyring.keyring.keyring.hasMasterPassword;
@@ -1142,10 +1148,10 @@ class KoniExtension {
1142
1148
  });
1143
1149
  return addressDict;
1144
1150
  }
1145
- async accountsForgetOverride(_ref32) {
1151
+ async accountsForgetOverride(_ref34) {
1146
1152
  let {
1147
1153
  address
1148
- } = _ref32;
1154
+ } = _ref34;
1149
1155
  _uiKeyring.keyring.forgetAccount(address);
1150
1156
  await new Promise(resolve => {
1151
1157
  this.#koniState.removeAccountRef(address, () => {
@@ -1178,12 +1184,12 @@ class KoniExtension {
1178
1184
  await this.#koniState.disableMantaPay(address);
1179
1185
  return true;
1180
1186
  }
1181
- seedCreateV2(_ref33) {
1187
+ seedCreateV2(_ref35) {
1182
1188
  let {
1183
1189
  length = _Extension.SEED_DEFAULT_LENGTH,
1184
1190
  seed: _seed,
1185
1191
  types
1186
- } = _ref33;
1192
+ } = _ref35;
1187
1193
  const seed = _seed || (0, _utilCrypto.mnemonicGenerate)(length);
1188
1194
  const rs = {
1189
1195
  seed: seed,
@@ -1194,11 +1200,11 @@ class KoniExtension {
1194
1200
  });
1195
1201
  return rs;
1196
1202
  }
1197
- seedValidateV2(_ref34) {
1203
+ seedValidateV2(_ref36) {
1198
1204
  let {
1199
1205
  suri,
1200
1206
  types
1201
- } = _ref34;
1207
+ } = _ref36;
1202
1208
  const {
1203
1209
  phrase
1204
1210
  } = (0, _utilCrypto.keyExtractSuri)(suri);
@@ -1218,11 +1224,11 @@ class KoniExtension {
1218
1224
  });
1219
1225
  return rs;
1220
1226
  }
1221
- _checkValidatePrivateKey(_ref35) {
1227
+ _checkValidatePrivateKey(_ref37) {
1222
1228
  let {
1223
1229
  suri,
1224
1230
  types
1225
- } = _ref35;
1231
+ } = _ref37;
1226
1232
  let autoAddPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1227
1233
  const {
1228
1234
  phrase
@@ -1245,11 +1251,11 @@ class KoniExtension {
1245
1251
  }
1246
1252
  return rs;
1247
1253
  }
1248
- metamaskPrivateKeyValidateV2(_ref36) {
1254
+ metamaskPrivateKeyValidateV2(_ref38) {
1249
1255
  let {
1250
1256
  suri,
1251
1257
  types
1252
- } = _ref36;
1258
+ } = _ref38;
1253
1259
  const isValidSuri = suri.startsWith('0x');
1254
1260
  if (isValidSuri) {
1255
1261
  return this._checkValidatePrivateKey({
@@ -1274,14 +1280,14 @@ class KoniExtension {
1274
1280
  throw new Error(`"${suri}" is not a valid derivation path`);
1275
1281
  }
1276
1282
  }
1277
- derivationCreateV2(_ref37) {
1283
+ derivationCreateV2(_ref39) {
1278
1284
  let {
1279
1285
  genesisHash,
1280
1286
  isAllowed,
1281
1287
  name,
1282
1288
  parentAddress,
1283
1289
  suri
1284
- } = _ref37;
1290
+ } = _ref39;
1285
1291
  const childPair = this.deriveV2(parentAddress, suri, {
1286
1292
  genesisHash,
1287
1293
  name,
@@ -1295,14 +1301,14 @@ class KoniExtension {
1295
1301
  });
1296
1302
  return true;
1297
1303
  }
1298
- jsonRestoreV2(_ref38) {
1304
+ jsonRestoreV2(_ref40) {
1299
1305
  let {
1300
1306
  address,
1301
1307
  file,
1302
1308
  isAllowed,
1303
1309
  password,
1304
1310
  withMasterPassword
1305
- } = _ref38;
1311
+ } = _ref40;
1306
1312
  const isPasswordValidated = this.validatePassword(file, password);
1307
1313
  if (isPasswordValidated) {
1308
1314
  try {
@@ -1317,13 +1323,13 @@ class KoniExtension {
1317
1323
  throw new Error('Unable to decode using the supplied passphrase');
1318
1324
  }
1319
1325
  }
1320
- batchRestoreV2(_ref39) {
1326
+ batchRestoreV2(_ref41) {
1321
1327
  let {
1322
1328
  accountsInfo,
1323
1329
  file,
1324
1330
  isAllowed,
1325
1331
  password
1326
- } = _ref39;
1332
+ } = _ref41;
1327
1333
  const addressList = accountsInfo.map(acc => acc.address);
1328
1334
  const isPasswordValidated = this.validatedAccountsPassword(file, password);
1329
1335
  if (isPasswordValidated) {
@@ -1694,18 +1700,18 @@ class KoniExtension {
1694
1700
  disableChain(networkKey) {
1695
1701
  return this.#koniState.disableChain(networkKey);
1696
1702
  }
1697
- async enableChain(_ref40) {
1703
+ async enableChain(_ref42) {
1698
1704
  let {
1699
1705
  chainSlug,
1700
1706
  enableTokens
1701
- } = _ref40;
1707
+ } = _ref42;
1702
1708
  return await this.#koniState.enableChain(chainSlug, enableTokens);
1703
1709
  }
1704
- async validateNetwork(_ref41) {
1710
+ async validateNetwork(_ref43) {
1705
1711
  let {
1706
1712
  existedChainSlug,
1707
1713
  provider
1708
- } = _ref41;
1714
+ } = _ref43;
1709
1715
  return await this.#koniState.validateCustomChain(provider, existedChainSlug);
1710
1716
  }
1711
1717
  resetDefaultNetwork() {
@@ -1743,12 +1749,12 @@ class KoniExtension {
1743
1749
  async validateCustomAsset(data) {
1744
1750
  return await this.#koniState.validateCustomAsset(data);
1745
1751
  }
1746
- async getAddressFreeBalance(_ref42) {
1752
+ async getAddressFreeBalance(_ref44) {
1747
1753
  let {
1748
1754
  address,
1749
1755
  networkKey,
1750
1756
  token
1751
- } = _ref42;
1757
+ } = _ref44;
1752
1758
  if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
1753
1759
  const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
1754
1760
  if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
@@ -1757,14 +1763,14 @@ class KoniExtension {
1757
1763
  }
1758
1764
  return await this.#koniState.balanceService.getTokenFreeBalance(address, networkKey, token);
1759
1765
  }
1760
- async transferGetMaxTransferable(_ref43) {
1766
+ async transferGetMaxTransferable(_ref45) {
1761
1767
  let {
1762
1768
  address,
1763
1769
  destChain,
1764
1770
  isXcmTransfer,
1765
1771
  networkKey,
1766
1772
  token
1767
- } = _ref43;
1773
+ } = _ref45;
1768
1774
  const freeBalance = await this.getAddressFreeBalance({
1769
1775
  address,
1770
1776
  networkKey,
@@ -1839,12 +1845,12 @@ class KoniExtension {
1839
1845
  };
1840
1846
  }
1841
1847
  }
1842
- async subscribeAddressFreeBalance(_ref44, id, port) {
1848
+ async subscribeAddressFreeBalance(_ref46, id, port) {
1843
1849
  let {
1844
1850
  address,
1845
1851
  networkKey,
1846
1852
  token
1847
- } = _ref44;
1853
+ } = _ref46;
1848
1854
  const cb = (0, _subscriptions.createSubscription)(id, port);
1849
1855
  const [unsub, currentFreeBalance] = await this.#koniState.balanceService.subscribeTokenFreeBalance(address, networkKey, token, cb);
1850
1856
  this.createUnsubscriptionHandle(id, unsub);
@@ -1853,26 +1859,26 @@ class KoniExtension {
1853
1859
  });
1854
1860
  return currentFreeBalance;
1855
1861
  }
1856
- async transferCheckReferenceCount(_ref45) {
1862
+ async transferCheckReferenceCount(_ref47) {
1857
1863
  let {
1858
1864
  address,
1859
1865
  networkKey
1860
- } = _ref45;
1866
+ } = _ref47;
1861
1867
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return
1862
1868
  return await (0, _transfer.checkReferenceCount)(networkKey, address, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
1863
1869
  }
1864
- async transferCheckSupporting(_ref46) {
1870
+ async transferCheckSupporting(_ref48) {
1865
1871
  let {
1866
1872
  networkKey,
1867
1873
  tokenSlug
1868
- } = _ref46;
1874
+ } = _ref48;
1869
1875
  const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
1870
1876
  return await (0, _transfer.checkSupportTransfer)(networkKey, tokenInfo, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
1871
1877
  }
1872
- transferGetExistentialDeposit(_ref47) {
1878
+ transferGetExistentialDeposit(_ref49) {
1873
1879
  let {
1874
1880
  tokenSlug
1875
- } = _ref47;
1881
+ } = _ref49;
1876
1882
  const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
1877
1883
  return (0, _utils._getTokenMinAmount)(tokenInfo);
1878
1884
  }
@@ -1908,11 +1914,11 @@ class KoniExtension {
1908
1914
  isSendingSelf
1909
1915
  };
1910
1916
  }
1911
- async enableChains(_ref48) {
1917
+ async enableChains(_ref50) {
1912
1918
  let {
1913
1919
  chainSlugs,
1914
1920
  enableTokens
1915
- } = _ref48;
1921
+ } = _ref50;
1916
1922
  try {
1917
1923
  await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
1918
1924
  chainSlug,
@@ -1923,24 +1929,24 @@ class KoniExtension {
1923
1929
  }
1924
1930
  return true;
1925
1931
  }
1926
- getAccountMeta(_ref49) {
1932
+ getAccountMeta(_ref51) {
1927
1933
  let {
1928
1934
  address
1929
- } = _ref49;
1935
+ } = _ref51;
1930
1936
  const pair = _uiKeyring.keyring.getPair(address);
1931
1937
  (0, _util.assert)(pair, 'Unable to find pair');
1932
1938
  return {
1933
1939
  meta: pair.meta
1934
1940
  };
1935
1941
  }
1936
- accountsTie2(_ref50) {
1942
+ accountsTie2(_ref52) {
1937
1943
  let {
1938
1944
  address,
1939
1945
  genesisHash
1940
- } = _ref50;
1946
+ } = _ref52;
1941
1947
  return this.#koniState.setAccountTie(address, genesisHash);
1942
1948
  }
1943
- async accountsCreateExternalV2(_ref51) {
1949
+ async accountsCreateExternalV2(_ref53) {
1944
1950
  let {
1945
1951
  address,
1946
1952
  genesisHash,
@@ -1948,7 +1954,7 @@ class KoniExtension {
1948
1954
  isEthereum,
1949
1955
  isReadOnly,
1950
1956
  name
1951
- } = _ref51;
1957
+ } = _ref53;
1952
1958
  try {
1953
1959
  let result;
1954
1960
  try {
@@ -2007,7 +2013,7 @@ class KoniExtension {
2007
2013
  }];
2008
2014
  }
2009
2015
  }
2010
- async accountsCreateHardwareV2(_ref52) {
2016
+ async accountsCreateHardwareV2(_ref54) {
2011
2017
  let {
2012
2018
  accountIndex,
2013
2019
  address,
@@ -2016,7 +2022,7 @@ class KoniExtension {
2016
2022
  hardwareType,
2017
2023
  isAllowed,
2018
2024
  name
2019
- } = _ref52;
2025
+ } = _ref54;
2020
2026
  const key = _uiKeyring.keyring.addHardware(address, hardwareType, {
2021
2027
  accountIndex,
2022
2028
  addressOffset,
@@ -2039,10 +2045,10 @@ class KoniExtension {
2039
2045
  });
2040
2046
  return true;
2041
2047
  }
2042
- async accountsCreateHardwareMultiple(_ref53) {
2048
+ async accountsCreateHardwareMultiple(_ref55) {
2043
2049
  let {
2044
2050
  accounts
2045
- } = _ref53;
2051
+ } = _ref55;
2046
2052
  const addresses = [];
2047
2053
  if (!accounts.length) {
2048
2054
  throw new Error('No accounts to import');
@@ -2120,14 +2126,14 @@ class KoniExtension {
2120
2126
  }
2121
2127
  return true;
2122
2128
  }
2123
- async accountsCreateWithSecret(_ref54) {
2129
+ async accountsCreateWithSecret(_ref56) {
2124
2130
  let {
2125
2131
  isAllow,
2126
2132
  isEthereum,
2127
2133
  name,
2128
2134
  publicKey,
2129
2135
  secretKey
2130
- } = _ref54;
2136
+ } = _ref56;
2131
2137
  try {
2132
2138
  let keyringPair = null;
2133
2139
  if (isEthereum) {
@@ -2270,30 +2276,30 @@ class KoniExtension {
2270
2276
 
2271
2277
  // Parse transaction
2272
2278
 
2273
- parseSubstrateTransaction(_ref55) {
2279
+ parseSubstrateTransaction(_ref57) {
2274
2280
  let {
2275
2281
  data,
2276
2282
  networkKey
2277
- } = _ref55;
2283
+ } = _ref57;
2278
2284
  const apiProps = this.#koniState.getSubstrateApi(networkKey);
2279
2285
  const apiPromise = apiProps.api;
2280
2286
  return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
2281
2287
  }
2282
- async parseEVMRLP(_ref56) {
2288
+ async parseEVMRLP(_ref58) {
2283
2289
  let {
2284
2290
  data
2285
- } = _ref56;
2291
+ } = _ref58;
2286
2292
  return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
2287
2293
  }
2288
2294
 
2289
2295
  // Sign
2290
2296
 
2291
- qrSignSubstrate(_ref57) {
2297
+ qrSignSubstrate(_ref59) {
2292
2298
  let {
2293
2299
  address,
2294
2300
  data,
2295
2301
  networkKey
2296
- } = _ref57;
2302
+ } = _ref59;
2297
2303
  const pair = _uiKeyring.keyring.getPair(address);
2298
2304
  (0, _util.assert)(pair, 'Unable to find pair');
2299
2305
  if (pair.isLocked) {
@@ -2310,13 +2316,13 @@ class KoniExtension {
2310
2316
  signature: signed
2311
2317
  };
2312
2318
  }
2313
- async qrSignEVM(_ref58) {
2319
+ async qrSignEVM(_ref60) {
2314
2320
  let {
2315
2321
  address,
2316
2322
  chainId,
2317
2323
  message,
2318
2324
  type
2319
- } = _ref58;
2325
+ } = _ref60;
2320
2326
  let signed;
2321
2327
  const network = this.getNetworkJsonByChainId(chainId);
2322
2328
  if (!network) {
@@ -2397,11 +2403,11 @@ class KoniExtension {
2397
2403
  });
2398
2404
  return this.#koniState.getNominatorMetadata();
2399
2405
  }
2400
- async getBondingOptions(_ref59) {
2406
+ async getBondingOptions(_ref61) {
2401
2407
  let {
2402
2408
  chain,
2403
2409
  type
2404
- } = _ref59;
2410
+ } = _ref61;
2405
2411
  const apiProps = this.#koniState.getSubstrateApi(chain);
2406
2412
  const chainInfo = this.#koniState.getChainInfo(chain);
2407
2413
  const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
@@ -2590,12 +2596,12 @@ class KoniExtension {
2590
2596
  }
2591
2597
 
2592
2598
  // EVM Transaction
2593
- async parseContractInput(_ref60) {
2599
+ async parseContractInput(_ref62) {
2594
2600
  let {
2595
2601
  chainId,
2596
2602
  contract,
2597
2603
  data
2598
- } = _ref60;
2604
+ } = _ref62;
2599
2605
  const network = this.getNetworkJsonByChainId(chainId);
2600
2606
  return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
2601
2607
  }
@@ -2666,12 +2672,12 @@ class KoniExtension {
2666
2672
 
2667
2673
  // Change master password
2668
2674
 
2669
- keyringChangeMasterPassword(_ref61) {
2675
+ keyringChangeMasterPassword(_ref63) {
2670
2676
  let {
2671
2677
  createNew,
2672
2678
  newPassword,
2673
2679
  oldPassword
2674
- } = _ref61;
2680
+ } = _ref63;
2675
2681
  try {
2676
2682
  // Remove isMasterPassword meta if createNew
2677
2683
  if (createNew) {
@@ -2705,11 +2711,11 @@ class KoniExtension {
2705
2711
 
2706
2712
  // Migrate password
2707
2713
 
2708
- keyringMigrateMasterPassword(_ref62) {
2714
+ keyringMigrateMasterPassword(_ref64) {
2709
2715
  let {
2710
2716
  address,
2711
2717
  password
2712
- } = _ref62;
2718
+ } = _ref64;
2713
2719
  try {
2714
2720
  _uiKeyring.keyring.migrateWithMasterPassword(address, password);
2715
2721
  } catch (e) {
@@ -2727,10 +2733,10 @@ class KoniExtension {
2727
2733
 
2728
2734
  // Unlock wallet
2729
2735
 
2730
- keyringUnlock(_ref63) {
2736
+ keyringUnlock(_ref65) {
2731
2737
  let {
2732
2738
  password
2733
- } = _ref63;
2739
+ } = _ref65;
2734
2740
  try {
2735
2741
  _uiKeyring.keyring.unlockKeyring(password);
2736
2742
  this.#koniState.initMantaPay(password).catch(console.error);
@@ -2757,11 +2763,11 @@ class KoniExtension {
2757
2763
 
2758
2764
  // Export mnemonic
2759
2765
 
2760
- keyringExportMnemonic(_ref64) {
2766
+ keyringExportMnemonic(_ref66) {
2761
2767
  let {
2762
2768
  address,
2763
2769
  password
2764
- } = _ref64;
2770
+ } = _ref66;
2765
2771
  const pair = _uiKeyring.keyring.getPair(address);
2766
2772
  const result = pair.exportMnemonic(password);
2767
2773
  return {
@@ -2771,10 +2777,10 @@ class KoniExtension {
2771
2777
 
2772
2778
  // Reset wallet
2773
2779
 
2774
- async resetWallet(_ref65) {
2780
+ async resetWallet(_ref67) {
2775
2781
  let {
2776
2782
  resetAll
2777
- } = _ref65;
2783
+ } = _ref67;
2778
2784
  try {
2779
2785
  await this.#koniState.resetWallet(resetAll);
2780
2786
  return {
@@ -2790,10 +2796,10 @@ class KoniExtension {
2790
2796
  }
2791
2797
 
2792
2798
  /// Signing external request
2793
- signingApprovePasswordV2(_ref66) {
2799
+ signingApprovePasswordV2(_ref68) {
2794
2800
  let {
2795
2801
  id
2796
- } = _ref66;
2802
+ } = _ref68;
2797
2803
  const queued = this.#koniState.getSignRequest(id);
2798
2804
  (0, _util.assert)(queued, 'Unable to find request');
2799
2805
  const {
@@ -2846,22 +2852,22 @@ class KoniExtension {
2846
2852
 
2847
2853
  /// Derive account
2848
2854
 
2849
- derivationCreateMultiple(_ref67) {
2855
+ derivationCreateMultiple(_ref69) {
2850
2856
  let {
2851
2857
  isAllowed,
2852
2858
  items,
2853
2859
  parentAddress
2854
- } = _ref67;
2860
+ } = _ref69;
2855
2861
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2856
2862
  const isEvm = parentPair.type === 'ethereum';
2857
2863
  if (parentPair.isLocked) {
2858
2864
  _uiKeyring.keyring.unlockPair(parentPair.address);
2859
2865
  }
2860
- const createChild = _ref68 => {
2866
+ const createChild = _ref70 => {
2861
2867
  let {
2862
2868
  name,
2863
2869
  suri
2864
- } = _ref68;
2870
+ } = _ref70;
2865
2871
  const meta = {
2866
2872
  name: name,
2867
2873
  parentAddress
@@ -2907,10 +2913,10 @@ class KoniExtension {
2907
2913
  }
2908
2914
  return true;
2909
2915
  }
2910
- derivationCreateV3(_ref69) {
2916
+ derivationCreateV3(_ref71) {
2911
2917
  let {
2912
2918
  address: parentAddress
2913
- } = _ref69;
2919
+ } = _ref71;
2914
2920
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2915
2921
  const isEvm = parentPair.type === 'ethereum';
2916
2922
  if (parentPair.isLocked) {
@@ -2942,11 +2948,11 @@ class KoniExtension {
2942
2948
  });
2943
2949
  return true;
2944
2950
  }
2945
- validateDerivePath(_ref70) {
2951
+ validateDerivePath(_ref72) {
2946
2952
  let {
2947
2953
  parentAddress,
2948
2954
  suri
2949
- } = _ref70;
2955
+ } = _ref72;
2950
2956
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2951
2957
  const isEvm = parentPair.type === 'ethereum';
2952
2958
  if (parentPair.isLocked) {
@@ -2979,12 +2985,12 @@ class KoniExtension {
2979
2985
  suri: meta.suri
2980
2986
  };
2981
2987
  }
2982
- getListDeriveAccounts(_ref71) {
2988
+ getListDeriveAccounts(_ref73) {
2983
2989
  let {
2984
2990
  limit,
2985
2991
  page,
2986
2992
  parentAddress
2987
- } = _ref71;
2993
+ } = _ref73;
2988
2994
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
2989
2995
  const isEvm = parentPair.type === 'ethereum';
2990
2996
  if (parentPair.isLocked) {
@@ -3075,10 +3081,10 @@ class KoniExtension {
3075
3081
  getSupportedSmartContractTypes() {
3076
3082
  return this.#koniState.getSupportedSmartContractTypes();
3077
3083
  }
3078
- getTransaction(_ref72) {
3084
+ getTransaction(_ref74) {
3079
3085
  let {
3080
3086
  id
3081
- } = _ref72;
3087
+ } = _ref74;
3082
3088
  const {
3083
3089
  transaction,
3084
3090
  ...transactionResult
@@ -3088,8 +3094,8 @@ class KoniExtension {
3088
3094
  subscribeTransactions(id, port) {
3089
3095
  const cb = (0, _subscriptions.createSubscription)(id, port);
3090
3096
  function convertRs(rs) {
3091
- return Object.fromEntries(Object.entries(rs).map(_ref73 => {
3092
- let [key, value] = _ref73;
3097
+ return Object.fromEntries(Object.entries(rs).map(_ref75 => {
3098
+ let [key, value] = _ref75;
3093
3099
  const {
3094
3100
  additionalValidator,
3095
3101
  eventsHandler,
@@ -3121,10 +3127,10 @@ class KoniExtension {
3121
3127
  });
3122
3128
  return notificationSubject.value;
3123
3129
  }
3124
- async reloadCron(_ref74) {
3130
+ async reloadCron(_ref76) {
3125
3131
  let {
3126
3132
  data
3127
- } = _ref74;
3133
+ } = _ref76;
3128
3134
  if (data === 'nft') {
3129
3135
  return await this.#koniState.reloadNft();
3130
3136
  } else if (data === 'staking') {
@@ -3142,20 +3148,20 @@ class KoniExtension {
3142
3148
 
3143
3149
  // Phishing detect
3144
3150
 
3145
- async passPhishingPage(_ref75) {
3151
+ async passPhishingPage(_ref77) {
3146
3152
  let {
3147
3153
  url
3148
- } = _ref75;
3154
+ } = _ref77;
3149
3155
  return await this.#koniState.approvePassPhishingPage(url);
3150
3156
  }
3151
3157
 
3152
3158
  /// Wallet connect
3153
3159
 
3154
3160
  // Connect
3155
- async connectWalletConnect(_ref76) {
3161
+ async connectWalletConnect(_ref78) {
3156
3162
  let {
3157
3163
  uri
3158
- } = _ref76;
3164
+ } = _ref78;
3159
3165
  await this.#koniState.walletConnectService.connect(uri);
3160
3166
  return true;
3161
3167
  }
@@ -3168,11 +3174,11 @@ class KoniExtension {
3168
3174
  });
3169
3175
  return this.#koniState.requestService.allConnectWCRequests;
3170
3176
  }
3171
- async approveWalletConnectSession(_ref77) {
3177
+ async approveWalletConnectSession(_ref79) {
3172
3178
  let {
3173
3179
  accounts: selectedAccounts,
3174
3180
  id
3175
- } = _ref77;
3181
+ } = _ref79;
3176
3182
  const request = this.#koniState.requestService.getConnectWCRequest(id);
3177
3183
  if ((0, _helpers2.isProposalExpired)(request.request.params)) {
3178
3184
  throw new Error('The proposal has been expired');
@@ -3184,8 +3190,8 @@ class KoniExtension {
3184
3190
  const availableNamespaces = {};
3185
3191
  const namespaces = {};
3186
3192
  const chainInfoMap = this.#koniState.getChainInfoMap();
3187
- Object.entries(requiredNamespaces).forEach(_ref78 => {
3188
- let [key, namespace] = _ref78;
3193
+ Object.entries(requiredNamespaces).forEach(_ref80 => {
3194
+ let [key, namespace] = _ref80;
3189
3195
  if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
3190
3196
  if (namespace.chains) {
3191
3197
  const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
@@ -3198,8 +3204,8 @@ class KoniExtension {
3198
3204
  throw new Error((0, _utils3.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
3199
3205
  }
3200
3206
  });
3201
- Object.entries(optionalNamespaces).forEach(_ref79 => {
3202
- let [key, namespace] = _ref79;
3207
+ Object.entries(optionalNamespaces).forEach(_ref81 => {
3208
+ let [key, namespace] = _ref81;
3203
3209
  if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
3204
3210
  if (namespace.chains) {
3205
3211
  const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
@@ -3223,8 +3229,8 @@ class KoniExtension {
3223
3229
  }
3224
3230
  }
3225
3231
  });
3226
- Object.entries(availableNamespaces).forEach(_ref80 => {
3227
- let [key, namespace] = _ref80;
3232
+ Object.entries(availableNamespaces).forEach(_ref82 => {
3233
+ let [key, namespace] = _ref82;
3228
3234
  if (namespace.chains) {
3229
3235
  const accounts = [];
3230
3236
  const chains = (0, _utils2.uniqueStringArray)(namespace.chains);
@@ -3248,10 +3254,10 @@ class KoniExtension {
3248
3254
  request.resolve();
3249
3255
  return true;
3250
3256
  }
3251
- async rejectWalletConnectSession(_ref81) {
3257
+ async rejectWalletConnectSession(_ref83) {
3252
3258
  let {
3253
3259
  id
3254
- } = _ref81;
3260
+ } = _ref83;
3255
3261
  const request = this.#koniState.requestService.getConnectWCRequest(id);
3256
3262
  const wcId = request.request.id;
3257
3263
  if ((0, _helpers2.isProposalExpired)(request.request.params)) {
@@ -3273,18 +3279,18 @@ class KoniExtension {
3273
3279
  });
3274
3280
  return this.#koniState.walletConnectService.sessions;
3275
3281
  }
3276
- async disconnectWalletConnectSession(_ref82) {
3282
+ async disconnectWalletConnectSession(_ref84) {
3277
3283
  let {
3278
3284
  topic
3279
- } = _ref82;
3285
+ } = _ref84;
3280
3286
  await this.#koniState.walletConnectService.disconnect(topic);
3281
3287
  return true;
3282
3288
  }
3283
- async enableMantaPay(_ref83) {
3289
+ async enableMantaPay(_ref85) {
3284
3290
  let {
3285
3291
  address,
3286
3292
  password
3287
- } = _ref83;
3293
+ } = _ref85;
3288
3294
  // always takes the current account
3289
3295
  function timeout() {
3290
3296
  return new Promise(resolve => setTimeout(resolve, 1500));
@@ -3495,13 +3501,17 @@ class KoniExtension {
3495
3501
  case 'pri(settings.saveCamera)':
3496
3502
  return this.setCamera(request);
3497
3503
  case 'pri(settings.saveTheme)':
3498
- return this.saveTheme(request, id, port);
3504
+ return this.saveTheme(request);
3499
3505
  case 'pri(settings.saveBrowserConfirmationType)':
3500
- return this.saveBrowserConfirmationType(request, id, port);
3506
+ return this.saveBrowserConfirmationType(request);
3501
3507
  case 'pri(settings.saveAutoLockTime)':
3502
3508
  return this.setAutoLockTime(request);
3503
3509
  case 'pri(settings.saveEnableChainPatrol)':
3504
3510
  return this.setEnableChainPatrol(request);
3511
+ case 'pri(settings.saveShowZeroBalance)':
3512
+ return this.setShowZeroBalance(request);
3513
+ case 'pri(settings.saveLanguage)':
3514
+ return this.setLanguage(request);
3505
3515
  case 'pri(price.getPrice)':
3506
3516
  return await this.getPrice();
3507
3517
  case 'pri(price.getSubscription)':