@subwallet/extension-base 1.0.13-0 → 1.1.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 (67) hide show
  1. package/background/KoniTypes.d.ts +37 -0
  2. package/background/KoniTypes.js +8 -1
  3. package/background/handlers/Extension.js +17 -2
  4. package/background/types.d.ts +6 -1
  5. package/cjs/background/KoniTypes.js +10 -2
  6. package/cjs/background/handlers/Extension.js +22 -6
  7. package/cjs/constants/index.js +7 -1
  8. package/cjs/defaults.js +1 -1
  9. package/cjs/koni/api/dotsama/balance.js +5 -0
  10. package/cjs/koni/api/dotsama/transfer.js +6 -0
  11. package/cjs/koni/background/cron.js +12 -1
  12. package/cjs/koni/background/handlers/Extension.js +324 -147
  13. package/cjs/koni/background/handlers/State.js +222 -50
  14. package/cjs/koni/background/subscription.js +3 -0
  15. package/cjs/packageInfo.js +1 -1
  16. package/cjs/services/chain-service/constants.js +10 -4
  17. package/cjs/services/chain-service/handler/SubstrateApi.js +2 -1
  18. package/cjs/services/chain-service/handler/SubstrateChainHandler.js +3 -1
  19. package/cjs/services/chain-service/handler/manta/MantaPrivateHandler.js +147 -0
  20. package/cjs/services/chain-service/index.js +54 -5
  21. package/cjs/services/chain-service/utils.js +6 -1
  22. package/cjs/services/event-service/types.js +3 -1
  23. package/cjs/services/storage-service/DatabaseService.js +31 -1
  24. package/cjs/services/storage-service/databases/index.js +3 -0
  25. package/cjs/services/storage-service/db-stores/MantaPay.js +40 -0
  26. package/cjs/utils/index.js +12 -0
  27. package/cjs/utils/lazy.js +52 -0
  28. package/constants/index.d.ts +2 -0
  29. package/constants/index.js +2 -0
  30. package/defaults.d.ts +1 -1
  31. package/defaults.js +1 -1
  32. package/koni/api/dotsama/balance.js +6 -1
  33. package/koni/api/dotsama/transfer.js +7 -1
  34. package/koni/background/cron.d.ts +1 -0
  35. package/koni/background/cron.js +13 -2
  36. package/koni/background/handlers/Extension.d.ts +5 -0
  37. package/koni/background/handlers/Extension.js +186 -11
  38. package/koni/background/handlers/State.d.ts +15 -3
  39. package/koni/background/handlers/State.js +224 -49
  40. package/koni/background/subscription.js +3 -0
  41. package/package.json +22 -5
  42. package/packageInfo.js +1 -1
  43. package/services/chain-service/constants.d.ts +3 -0
  44. package/services/chain-service/constants.js +5 -2
  45. package/services/chain-service/handler/SubstrateApi.d.ts +1 -1
  46. package/services/chain-service/handler/SubstrateApi.js +2 -1
  47. package/services/chain-service/handler/SubstrateChainHandler.d.ts +1 -1
  48. package/services/chain-service/handler/SubstrateChainHandler.js +3 -1
  49. package/services/chain-service/handler/manta/MantaPrivateHandler.d.ts +30 -0
  50. package/services/chain-service/handler/manta/MantaPrivateHandler.js +140 -0
  51. package/services/chain-service/handler/types.d.ts +2 -0
  52. package/services/chain-service/index.d.ts +7 -3
  53. package/services/chain-service/index.js +56 -7
  54. package/services/chain-service/utils.d.ts +1 -0
  55. package/services/chain-service/utils.js +5 -1
  56. package/services/event-service/types.d.ts +3 -0
  57. package/services/event-service/types.js +3 -1
  58. package/services/storage-service/DatabaseService.d.ts +10 -1
  59. package/services/storage-service/DatabaseService.js +31 -1
  60. package/services/storage-service/databases/index.d.ts +2 -0
  61. package/services/storage-service/databases/index.js +3 -0
  62. package/services/storage-service/db-stores/MantaPay.d.ts +9 -0
  63. package/services/storage-service/db-stores/MantaPay.js +32 -0
  64. package/utils/index.d.ts +1 -0
  65. package/utils/index.js +2 -1
  66. package/utils/lazy.d.ts +2 -0
  67. package/utils/lazy.js +43 -0
@@ -7,7 +7,7 @@ import { TransactionError } from '@subwallet/extension-base/background/errors/Tr
7
7
  import { isJsonPayload, SEED_DEFAULT_LENGTH, SEED_LENGTHS } from '@subwallet/extension-base/background/handlers/Extension';
8
8
  import { withErrorLog } from '@subwallet/extension-base/background/handlers/helpers';
9
9
  import { createSubscription } from '@subwallet/extension-base/background/handlers/subscriptions';
10
- import { AccountExternalErrorCode, BasicTxErrorType, BasicTxWarningCode, ChainType, ExternalRequestPromiseStatus, ExtrinsicType, StakingType, TransferTxErrorType } from '@subwallet/extension-base/background/KoniTypes';
10
+ import { AccountExternalErrorCode, BasicTxErrorType, BasicTxWarningCode, ChainType, ExternalRequestPromiseStatus, ExtrinsicType, MantaPayEnableMessage, StakingType, TransferTxErrorType } from '@subwallet/extension-base/background/KoniTypes';
11
11
  import { TransactionWarning } from '@subwallet/extension-base/background/warnings/TransactionWarning';
12
12
  import { ALL_ACCOUNT_KEY, ALL_GENESIS_HASH, XCM_MIN_AMOUNT_RATIO } from '@subwallet/extension-base/constants';
13
13
  import { ALLOWED_PATH } from '@subwallet/extension-base/defaults';
@@ -20,7 +20,9 @@ import { getPoolingBondingExtrinsic, getPoolingUnbondingExtrinsic, validatePoolB
20
20
  import { getERC20TransactionObject, getERC721Transaction, getEVMTransactionObject } from '@subwallet/extension-base/koni/api/tokens/evm/transfer';
21
21
  import { getPSP34TransferExtrinsic } from '@subwallet/extension-base/koni/api/tokens/wasm';
22
22
  import { createXcmExtrinsic } from '@subwallet/extension-base/koni/api/xcm';
23
- import { _getChainNativeTokenBasicInfo, _getContractAddressOfToken, _getEvmChainId, _getSubstrateGenesisHash, _getTokenMinAmount, _isAssetSmartContractNft, _isChainEvmCompatible, _isCustomAsset, _isLocalToken, _isNativeToken, _isTokenEvmSmartContract, _isTokenTransferredByEvm } from '@subwallet/extension-base/services/chain-service/utils';
23
+ import { _DEFAULT_MANTA_ZK_CHAIN, _MANTA_ZK_CHAIN_GROUP, _ZK_ASSET_PREFIX } from '@subwallet/extension-base/services/chain-service/constants';
24
+ import { _ChainConnectionStatus } from '@subwallet/extension-base/services/chain-service/types';
25
+ import { _getChainNativeTokenBasicInfo, _getContractAddressOfToken, _getEvmChainId, _getSubstrateGenesisHash, _getTokenMinAmount, _isAssetSmartContractNft, _isChainEvmCompatible, _isCustomAsset, _isLocalToken, _isMantaZkAsset, _isNativeToken, _isTokenEvmSmartContract, _isTokenTransferredByEvm } from '@subwallet/extension-base/services/chain-service/utils';
24
26
  import { EXTENSION_REQUEST_URL } from '@subwallet/extension-base/services/request-service/constants';
25
27
  import { DEFAULT_AUTO_LOCK_TIME } from '@subwallet/extension-base/services/setting-service/constants';
26
28
  import { WALLET_CONNECT_EIP155_NAMESPACE } from '@subwallet/extension-base/services/wallet-connect-service/constants';
@@ -63,13 +65,16 @@ export default class KoniExtension {
63
65
  #lockTimeOut = undefined;
64
66
  #koniState;
65
67
  #timeAutoLock = DEFAULT_AUTO_LOCK_TIME;
68
+ #skipAutoLock = false;
66
69
  constructor(state) {
67
70
  this.#koniState = state;
68
71
  const updateTimeAutoLock = rs => {
69
72
  this.#timeAutoLock = rs.timeAutoLock;
70
73
  clearTimeout(this.#lockTimeOut);
71
74
  this.#lockTimeOut = setTimeout(() => {
72
- this.keyringLock();
75
+ if (!this.#skipAutoLock) {
76
+ this.keyringLock();
77
+ }
73
78
  }, this.#timeAutoLock * 60 * 1000);
74
79
  };
75
80
  this.#koniState.settingService.getSettings(updateTimeAutoLock);
@@ -342,9 +347,25 @@ export default class KoniExtension {
342
347
  });
343
348
  return true;
344
349
  }
345
- windowOpen(path) {
346
- const url = `${chrome.extension.getURL('index.html')}#${path}`;
350
+ windowOpen({
351
+ allowedPath: path,
352
+ params,
353
+ subPath
354
+ }) {
355
+ let paramString = '';
356
+ if (params) {
357
+ paramString += '?';
358
+ for (let i = 0; i < Object.keys(params).length; i++) {
359
+ const [key, value] = Object.entries(params)[i];
360
+ paramString += `${key}=${value}`;
361
+ if (i !== Object.keys(params).length - 1) {
362
+ paramString += '&';
363
+ }
364
+ }
365
+ }
366
+ const url = `${chrome.extension.getURL('index.html')}#${path}${subPath || ''}${paramString}`;
347
367
  if (!ALLOWED_PATH.includes(path)) {
368
+ console.error('Not allowed to open the url:', url);
348
369
  return false;
349
370
  }
350
371
  withErrorLog(() => chrome.tabs.create({
@@ -1113,6 +1134,7 @@ export default class KoniExtension {
1113
1134
  address: ALL_ACCOUNT_KEY
1114
1135
  }, resolve);
1115
1136
  });
1137
+ await this.#koniState.disableMantaPay(address);
1116
1138
  return true;
1117
1139
  }
1118
1140
  seedCreateV2({
@@ -1407,7 +1429,11 @@ export default class KoniExtension {
1407
1429
  let transaction;
1408
1430
 
1409
1431
  // Get native token amount
1410
- const freeBalance = await this.#koniState.balanceService.getTokenFreeBalance(from, networkKey, tokenSlug);
1432
+ const freeBalance = await this.getAddressFreeBalance({
1433
+ address: from,
1434
+ networkKey,
1435
+ token: tokenSlug
1436
+ });
1411
1437
  try {
1412
1438
  if (isEthereumAddress(from) && isEthereumAddress(to) && _isTokenTransferredByEvm(tokenInfo)) {
1413
1439
  // TODO: review this
@@ -1420,6 +1446,10 @@ export default class KoniExtension {
1420
1446
  } else {
1421
1447
  [transaction, transferAmount.value] = await getEVMTransactionObject(chainInfo, to, txVal, !!transferAll, evmApiMap);
1422
1448
  }
1449
+ } else if (_isMantaZkAsset(tokenInfo)) {
1450
+ // TODO
1451
+ transaction = undefined;
1452
+ transferAmount.value = '0';
1423
1453
  } else {
1424
1454
  const substrateApi = this.#koniState.getSubstrateApi(networkKey);
1425
1455
  [transaction, transferAmount.value] = await createTransferExtrinsic({
@@ -1448,14 +1478,22 @@ export default class KoniExtension {
1448
1478
  if (!isTransferNativeToken) {
1449
1479
  const {
1450
1480
  value: balance
1451
- } = await this.#koniState.balanceService.getTokenFreeBalance(from, networkKey, tokenSlug);
1481
+ } = await this.getAddressFreeBalance({
1482
+ address: from,
1483
+ networkKey,
1484
+ token: tokenSlug
1485
+ });
1452
1486
  if (new BigN(balance).minus(transferAmount.value).lt(minAmount)) {
1453
1487
  inputTransaction.warnings.push(new TransactionWarning(BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT, ''));
1454
1488
  }
1455
1489
  }
1456
1490
  const {
1457
1491
  value: receiverBalance
1458
- } = await this.#koniState.balanceService.getTokenFreeBalance(to, networkKey, tokenSlug);
1492
+ } = await this.getAddressFreeBalance({
1493
+ address: from,
1494
+ networkKey,
1495
+ token: tokenSlug
1496
+ });
1459
1497
  if (new BigN(receiverBalance).plus(transferAmount.value).lt(minAmount)) {
1460
1498
  const atLeast = new BigN(minAmount).minus(receiverBalance).plus((tokenInfo.decimals || 0) === 0 ? 0 : 1);
1461
1499
  const atLeastStr = formatNumber(atLeast, tokenInfo.decimals || 0, balanceFormatter);
@@ -1659,6 +1697,12 @@ export default class KoniExtension {
1659
1697
  networkKey,
1660
1698
  token
1661
1699
  }) {
1700
+ if (token && _MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
1701
+ const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
1702
+ if (tokenInfo.symbol.startsWith(_ZK_ASSET_PREFIX)) {
1703
+ return await this.#koniState.getMantaPayZkBalance(address, tokenInfo);
1704
+ }
1705
+ }
1662
1706
  return await this.#koniState.balanceService.getTokenFreeBalance(address, networkKey, token);
1663
1707
  }
1664
1708
  async transferGetMaxTransferable({
@@ -1668,7 +1712,11 @@ export default class KoniExtension {
1668
1712
  networkKey,
1669
1713
  token
1670
1714
  }) {
1671
- const freeBalance = await this.#koniState.balanceService.getTokenFreeBalance(address, networkKey, token);
1715
+ const freeBalance = await this.getAddressFreeBalance({
1716
+ address,
1717
+ networkKey,
1718
+ token
1719
+ });
1672
1720
  const tokenInfo = token ? this.#koniState.chainService.getAssetBySlug(token) : this.#koniState.chainService.getNativeTokenInfo(networkKey);
1673
1721
  if (!_isNativeToken(tokenInfo)) {
1674
1722
  return freeBalance;
@@ -2612,6 +2660,7 @@ export default class KoniExtension {
2612
2660
  }) {
2613
2661
  try {
2614
2662
  keyring.unlockKeyring(password);
2663
+ this.#koniState.initMantaPay(password).catch(console.error);
2615
2664
  } catch (e) {
2616
2665
  return {
2617
2666
  errors: [e.message],
@@ -3139,13 +3188,130 @@ export default class KoniExtension {
3139
3188
  await this.#koniState.walletConnectService.disconnect(topic);
3140
3189
  return true;
3141
3190
  }
3191
+ async enableMantaPay({
3192
+ address,
3193
+ password
3194
+ }) {
3195
+ // always takes the current account
3196
+ function timeout() {
3197
+ return new Promise(resolve => setTimeout(resolve, 1500));
3198
+ }
3199
+ try {
3200
+ await this.#koniState.chainService.enableChain(_DEFAULT_MANTA_ZK_CHAIN);
3201
+ this.#koniState.chainService.setMantaZkAssetSettings(true);
3202
+ const mnemonic = this.keyringExportMnemonic({
3203
+ address,
3204
+ password
3205
+ });
3206
+ const {
3207
+ connectionStatus
3208
+ } = this.#koniState.chainService.getChainStateByKey(_DEFAULT_MANTA_ZK_CHAIN);
3209
+ if (connectionStatus !== _ChainConnectionStatus.CONNECTED) {
3210
+ // TODO: do better
3211
+ await timeout();
3212
+ }
3213
+ const result = await this.#koniState.enableMantaPay(true, address, password, mnemonic.result);
3214
+ this.#skipAutoLock = true;
3215
+ await this.saveCurrentAccountAddress({
3216
+ address
3217
+ });
3218
+ const unsubSyncProgress = await this.#koniState.chainService.mantaPay.subscribeSyncProgress();
3219
+ console.debug('Start initial sync for MantaPay');
3220
+ this.#koniState.initialSyncMantaPay(address).then(() => {
3221
+ console.debug('Finished initial sync for MantaPay');
3222
+ this.#skipAutoLock = false;
3223
+ unsubSyncProgress();
3224
+ }).catch(e => {
3225
+ console.error('Error syncing MantaPay', e);
3226
+ this.#skipAutoLock = false;
3227
+ unsubSyncProgress();
3228
+ });
3229
+ return {
3230
+ success: !!result,
3231
+ message: result ? MantaPayEnableMessage.SUCCESS : MantaPayEnableMessage.UNKNOWN_ERROR
3232
+ };
3233
+ } catch (e) {
3234
+ // @ts-ignore
3235
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
3236
+ if (e.toString() === 'Error: Unable to decode using the supplied passphrase') {
3237
+ return {
3238
+ success: false,
3239
+ message: MantaPayEnableMessage.WRONG_PASSWORD
3240
+ };
3241
+ }
3242
+ return {
3243
+ success: false,
3244
+ message: MantaPayEnableMessage.UNKNOWN_ERROR
3245
+ };
3246
+ }
3247
+ }
3248
+ async initSyncMantaPay(address) {
3249
+ if (this.#koniState.chainService.mantaPay.getSyncState().isSyncing) {
3250
+ return;
3251
+ }
3252
+ this.#skipAutoLock = true;
3253
+ await this.saveCurrentAccountAddress({
3254
+ address
3255
+ });
3256
+ const unsubSyncProgress = await this.#koniState.chainService.mantaPay.subscribeSyncProgress();
3257
+ console.debug('Start initial sync for MantaPay');
3258
+ this.#koniState.initialSyncMantaPay(address).then(() => {
3259
+ console.debug('Finished initial sync for MantaPay');
3260
+ this.#skipAutoLock = false;
3261
+ unsubSyncProgress();
3262
+ // make sure the sync state is set, just in case it gets unsubscribed
3263
+ this.#koniState.chainService.mantaPay.setSyncState({
3264
+ progress: 100,
3265
+ isSyncing: false
3266
+ });
3267
+ }).catch(e => {
3268
+ console.error('Error syncing MantaPay', e);
3269
+ this.#skipAutoLock = false;
3270
+ unsubSyncProgress();
3271
+ this.#koniState.chainService.mantaPay.setSyncState({
3272
+ progress: 0,
3273
+ isSyncing: false
3274
+ });
3275
+ });
3276
+ }
3277
+ async disableMantaPay(address) {
3278
+ return this.#koniState.disableMantaPay(address);
3279
+ }
3280
+ subscribeMantaPayConfig(id, port) {
3281
+ const cb = createSubscription(id, port);
3282
+ const mantaPayConfigSubscription = this.#koniState.subscribeMantaPayConfig().subscribe({
3283
+ next: rs => {
3284
+ cb(rs);
3285
+ }
3286
+ });
3287
+ this.createUnsubscriptionHandle(id, mantaPayConfigSubscription.unsubscribe);
3288
+ port.onDisconnect.addListener(() => {
3289
+ this.cancelSubscription(id);
3290
+ });
3291
+ return this.#koniState.getMantaPayConfig('calamari');
3292
+ }
3293
+ subscribeMantaPaySyncState(id, port) {
3294
+ const cb = createSubscription(id, port);
3295
+ const syncingStateSubscription = this.#koniState.subscribeMantaPaySyncState().subscribe({
3296
+ next: rs => {
3297
+ cb(rs);
3298
+ }
3299
+ });
3300
+ this.createUnsubscriptionHandle(id, syncingStateSubscription.unsubscribe);
3301
+ port.onDisconnect.addListener(() => {
3302
+ this.cancelSubscription(id);
3303
+ });
3304
+ return this.#koniState.chainService.mantaPay.getSyncState();
3305
+ }
3142
3306
 
3143
3307
  // --------------------------------------------------------------
3144
3308
  // eslint-disable-next-line @typescript-eslint/require-await
3145
3309
  async handle(id, type, request, port) {
3146
3310
  clearTimeout(this.#lockTimeOut);
3147
3311
  this.#lockTimeOut = setTimeout(() => {
3148
- this.keyringLock();
3312
+ if (!this.#skipAutoLock) {
3313
+ this.keyringLock();
3314
+ }
3149
3315
  }, this.#timeAutoLock * 60 * 1000);
3150
3316
  switch (type) {
3151
3317
  /// Clone from PolkadotJs
@@ -3526,7 +3692,16 @@ export default class KoniExtension {
3526
3692
  return this.subscribeWalletConnectSessions(id, port);
3527
3693
  case 'pri(walletConnect.session.disconnect)':
3528
3694
  return this.disconnectWalletConnectSession(request);
3529
-
3695
+ case 'pri(mantaPay.enable)':
3696
+ return await this.enableMantaPay(request);
3697
+ case 'pri(mantaPay.initSyncMantaPay)':
3698
+ return await this.initSyncMantaPay(request);
3699
+ case 'pri(mantaPay.subscribeConfig)':
3700
+ return await this.subscribeMantaPayConfig(id, port);
3701
+ case 'pri(mantaPay.disable)':
3702
+ return await this.disableMantaPay(request);
3703
+ case 'pri(mantaPay.subscribeSyncingState)':
3704
+ return this.subscribeMantaPaySyncState(id, port);
3530
3705
  // Default
3531
3706
  default:
3532
3707
  throw new Error(`Unable to handle message of type ${type}`);
@@ -1,10 +1,10 @@
1
1
  /// <reference types="chrome" />
2
2
  import { _AssetRef, _AssetType, _ChainAsset, _ChainInfo, _MultiChainAsset } from '@subwallet/chain-list/types';
3
- import { AddTokenRequestExternal, ApiMap, AuthRequestV2, BalanceItem, BalanceJson, BrowserConfirmationType, ChainStakingMetadata, ConfirmationsQueue, CrowdloanItem, CrowdloanJson, CurrentAccountInfo, EvmSendTransactionParams, ExternalRequestPromise, NftCollection, NftItem, NftJson, NominatorMetadata, RequestAccountExportPrivateKey, RequestCheckPublicAndSecretKey, RequestConfirmationComplete, RequestSettingsType, ResponseAccountExportPrivateKey, ResponseCheckPublicAndSecretKey, ServiceInfo, SingleModeJson, StakingItem, StakingJson, StakingRewardItem, StakingRewardJson, StakingType, ThemeNames, UiSettings } from '@subwallet/extension-base/background/KoniTypes';
3
+ import { AddTokenRequestExternal, AmountData, ApiMap, AuthRequestV2, BalanceItem, BalanceJson, BrowserConfirmationType, ChainStakingMetadata, ConfirmationsQueue, CrowdloanItem, CrowdloanJson, CurrentAccountInfo, EvmSendTransactionParams, ExternalRequestPromise, MantaPayConfig, NftCollection, NftItem, NftJson, NominatorMetadata, RequestAccountExportPrivateKey, RequestCheckPublicAndSecretKey, RequestConfirmationComplete, RequestSettingsType, ResponseAccountExportPrivateKey, ResponseCheckPublicAndSecretKey, ServiceInfo, SingleModeJson, StakingItem, StakingJson, StakingRewardItem, StakingRewardJson, StakingType, ThemeNames, UiSettings } from '@subwallet/extension-base/background/KoniTypes';
4
4
  import { AccountJson, RequestAuthorizeTab, RequestRpcSend, RequestRpcSubscribe, RequestRpcUnsubscribe, RequestSign, ResponseRpcListProviders, ResponseSigning } from '@subwallet/extension-base/background/types';
5
5
  import { BalanceService } from '@subwallet/extension-base/services/balance-service';
6
6
  import { ChainService } from '@subwallet/extension-base/services/chain-service';
7
- import { _ChainConnectionStatus, _ChainState, _NetworkUpsertParams, _ValidateCustomAssetRequest } from '@subwallet/extension-base/services/chain-service/types';
7
+ import { _ChainState, _NetworkUpsertParams, _ValidateCustomAssetRequest } from '@subwallet/extension-base/services/chain-service/types';
8
8
  import { EventService } from '@subwallet/extension-base/services/event-service';
9
9
  import { HistoryService } from '@subwallet/extension-base/services/history-service';
10
10
  import { KeyringService } from '@subwallet/extension-base/services/keyring-service';
@@ -37,6 +37,8 @@ export default class KoniState {
37
37
  private crowdloanMap;
38
38
  private crowdloanSubject;
39
39
  private nftSubject;
40
+ private mantaPayConfigSubject;
41
+ isMantaPayEnabled: boolean;
40
42
  private stakingSubject;
41
43
  private chainStakingMetadataSubject;
42
44
  private stakingNominatorMetadataSubject;
@@ -79,6 +81,7 @@ export default class KoniState {
79
81
  get authSubjectV2(): BehaviorSubject<import("@subwallet/extension-base/background/types").AuthorizeRequest[]>;
80
82
  generateDefaultBalanceMap(): Record<string, BalanceItem>;
81
83
  init(): Promise<void>;
84
+ initMantaPay(password: string): Promise<void>;
82
85
  private startSubscription;
83
86
  onReady(): void;
84
87
  updateKeyringState(isReady?: boolean, callback?: () => void): void;
@@ -96,9 +99,11 @@ export default class KoniState {
96
99
  getChainStakingMetadata(): Promise<ChainStakingMetadata[]>;
97
100
  getStakingMetadataByChain(chain: string, type: StakingType): Promise<ChainStakingMetadata | undefined>;
98
101
  getNominatorMetadata(): Promise<NominatorMetadata[]>;
102
+ getMantaPayConfig(chain: string): Promise<MantaPayConfig[]>;
99
103
  getStaking(): Promise<StakingJson>;
100
104
  getStakingOwnersByChains(chains: string[]): Promise<string[]>;
101
105
  getPooledStakingRecordsByAddress(addresses: string[]): Promise<StakingItem[]>;
106
+ subscribeMantaPayConfig(): Subject<MantaPayConfig[]>;
102
107
  subscribeStaking(): Subject<StakingJson>;
103
108
  subscribeChainStakingMetadata(): Subject<ChainStakingMetadata[]>;
104
109
  subscribeNominatorMetadata(): Subject<NominatorMetadata[]>;
@@ -221,7 +226,6 @@ export default class KoniState {
221
226
  wakeup(): Promise<void>;
222
227
  cancelSubscription(id: string): boolean;
223
228
  createUnsubscriptionHandle(id: string, unsubscribe: () => void): void;
224
- updateChainConnectionStatus(chain: string, status: _ChainConnectionStatus): void;
225
229
  autoEnableChains(addresses: string[]): Promise<void>;
226
230
  onAccountAdd(): void;
227
231
  onAccountRemove(): void;
@@ -229,5 +233,13 @@ export default class KoniState {
229
233
  reloadStaking(): Promise<boolean>;
230
234
  approvePassPhishingPage(_url: string): Promise<boolean>;
231
235
  resetWallet(resetAll: boolean): Promise<void>;
236
+ enableMantaPay(updateStore: boolean, address: string, password: string, seedPhrase?: string): Promise<string | undefined>;
237
+ disableMantaPay(address: string): Promise<boolean>;
238
+ initialSyncMantaPay(address: string): Promise<boolean | undefined>;
239
+ getMantaZkBalance(): void;
240
+ subscribeMantaPayBalance(): () => void;
241
+ syncMantaPay(): Promise<void>;
242
+ getMantaPayZkBalance(address: string, tokenInfo: _ChainAsset): Promise<AmountData>;
243
+ subscribeMantaPaySyncState(): Subject<import("@subwallet/extension-base/background/KoniTypes").MantaPaySyncState>;
232
244
  }
233
245
  export {};