@subwallet/extension-base 1.2.3-1 → 1.2.4-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 (53) hide show
  1. package/background/KoniTypes.d.ts +0 -153
  2. package/background/KoniTypes.js +0 -21
  3. package/cjs/background/KoniTypes.js +1 -22
  4. package/cjs/core/logic-validation/earning.js +2 -2
  5. package/cjs/core/logic-validation/transfer.js +0 -7
  6. package/cjs/core/substrate/nominationpools-pallet.js +11 -1
  7. package/cjs/core/substrate/system-pallet.js +2 -3
  8. package/cjs/core/substrate/xcm-parser.js +190 -0
  9. package/cjs/koni/api/dotsama/transfer.js +10 -119
  10. package/cjs/koni/api/xcm/polkadotXcm.js +12 -20
  11. package/cjs/koni/api/xcm/utils.js +8 -126
  12. package/cjs/koni/api/xcm/xTokens.js +10 -8
  13. package/cjs/koni/api/xcm/xcmPallet.js +6 -6
  14. package/cjs/koni/background/handlers/Extension.js +90 -113
  15. package/cjs/packageInfo.js +1 -1
  16. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +6 -3
  17. package/cjs/services/chain-service/constants.js +2 -2
  18. package/cjs/services/chain-service/utils/index.js +7 -2
  19. package/cjs/services/earning-service/handlers/special.js +3 -3
  20. package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +2 -1
  21. package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting.js +2 -1
  22. package/cjs/services/migration-service/scripts/index.js +2 -2
  23. package/cjs/services/swap-service/handler/base-handler.js +5 -3
  24. package/cjs/services/swap-service/handler/hydradx-handler.js +1 -1
  25. package/core/logic-validation/earning.d.ts +1 -1
  26. package/core/logic-validation/earning.js +2 -2
  27. package/core/logic-validation/transfer.js +0 -7
  28. package/core/substrate/nominationpools-pallet.d.ts +4 -1
  29. package/core/substrate/nominationpools-pallet.js +8 -1
  30. package/core/substrate/system-pallet.js +2 -3
  31. package/core/substrate/xcm-parser.d.ts +49 -0
  32. package/core/substrate/xcm-parser.js +181 -0
  33. package/koni/api/dotsama/transfer.d.ts +0 -3
  34. package/koni/api/dotsama/transfer.js +12 -119
  35. package/koni/api/xcm/polkadotXcm.js +14 -22
  36. package/koni/api/xcm/utils.d.ts +3 -48
  37. package/koni/api/xcm/utils.js +5 -114
  38. package/koni/api/xcm/xTokens.js +12 -10
  39. package/koni/api/xcm/xcmPallet.js +7 -7
  40. package/koni/background/handlers/Extension.d.ts +1 -3
  41. package/koni/background/handlers/Extension.js +8 -28
  42. package/package.json +11 -6
  43. package/packageInfo.js +1 -1
  44. package/services/balance-service/helpers/subscribe/substrate/index.js +8 -5
  45. package/services/chain-service/constants.js +2 -2
  46. package/services/chain-service/utils/index.d.ts +3 -2
  47. package/services/chain-service/utils/index.js +5 -2
  48. package/services/earning-service/handlers/special.js +3 -3
  49. package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +2 -1
  50. package/services/migration-service/scripts/databases/MigrateAssetSetting.js +2 -1
  51. package/services/migration-service/scripts/index.js +2 -2
  52. package/services/swap-service/handler/base-handler.js +5 -3
  53. package/services/swap-service/handler/hydradx-handler.js +1 -1
@@ -43,6 +43,7 @@ var _uiKeyring = require("@subwallet/ui-keyring");
43
43
  var _utils4 = require("@walletconnect/utils");
44
44
  var _bignumber = _interopRequireDefault(require("bignumber.js"));
45
45
  var _i18next = require("i18next");
46
+ var _rxjs = require("rxjs");
46
47
  var _types3 = require("@polkadot/types");
47
48
  var _util = require("@polkadot/util");
48
49
  var _utilCrypto = require("@polkadot/util-crypto");
@@ -87,6 +88,7 @@ class KoniExtension {
87
88
  #skipAutoLock = false;
88
89
  #firstTime = true;
89
90
  #alwaysLock = false;
91
+ #keyringLockSubject = new _rxjs.Subject();
90
92
  constructor(state) {
91
93
  this.#koniState = state;
92
94
  const updateTimeAutoLock = rs => {
@@ -1976,29 +1978,6 @@ class KoniExtension {
1976
1978
  });
1977
1979
  return convertData(currentFreeBalance);
1978
1980
  }
1979
- async transferCheckReferenceCount(_ref52) {
1980
- let {
1981
- address,
1982
- networkKey
1983
- } = _ref52;
1984
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return
1985
- return await (0, _transfer2.checkReferenceCount)(networkKey, address, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
1986
- }
1987
- async transferCheckSupporting(_ref53) {
1988
- let {
1989
- networkKey,
1990
- tokenSlug
1991
- } = _ref53;
1992
- const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
1993
- return await (0, _transfer2.checkSupportTransfer)(networkKey, tokenInfo, this.#koniState.getSubstrateApiMap(), this.#koniState.getChainInfo(networkKey));
1994
- }
1995
- transferGetExistentialDeposit(_ref54) {
1996
- let {
1997
- tokenSlug
1998
- } = _ref54;
1999
- const tokenInfo = this.#koniState.getAssetBySlug(tokenSlug);
2000
- return (0, _utils2._getTokenMinAmount)(tokenInfo);
2001
- }
2002
1981
  async substrateNftSubmitTransaction(inputData) {
2003
1982
  const {
2004
1983
  params,
@@ -2031,11 +2010,11 @@ class KoniExtension {
2031
2010
  isSendingSelf
2032
2011
  };
2033
2012
  }
2034
- async enableChains(_ref55) {
2013
+ async enableChains(_ref52) {
2035
2014
  let {
2036
2015
  chainSlugs,
2037
2016
  enableTokens
2038
- } = _ref55;
2017
+ } = _ref52;
2039
2018
  try {
2040
2019
  await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
2041
2020
  chainSlug,
@@ -2046,24 +2025,24 @@ class KoniExtension {
2046
2025
  }
2047
2026
  return true;
2048
2027
  }
2049
- getAccountMeta(_ref56) {
2028
+ getAccountMeta(_ref53) {
2050
2029
  let {
2051
2030
  address
2052
- } = _ref56;
2031
+ } = _ref53;
2053
2032
  const pair = _uiKeyring.keyring.getPair(address);
2054
2033
  (0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
2055
2034
  return {
2056
2035
  meta: pair.meta
2057
2036
  };
2058
2037
  }
2059
- accountsTie2(_ref57) {
2038
+ accountsTie2(_ref54) {
2060
2039
  let {
2061
2040
  address,
2062
2041
  genesisHash
2063
- } = _ref57;
2042
+ } = _ref54;
2064
2043
  return this.#koniState.setAccountTie(address, genesisHash);
2065
2044
  }
2066
- async accountsCreateExternalV2(_ref58) {
2045
+ async accountsCreateExternalV2(_ref55) {
2067
2046
  let {
2068
2047
  address,
2069
2048
  genesisHash,
@@ -2071,7 +2050,7 @@ class KoniExtension {
2071
2050
  isEthereum,
2072
2051
  isReadOnly,
2073
2052
  name
2074
- } = _ref58;
2053
+ } = _ref55;
2075
2054
  try {
2076
2055
  let result;
2077
2056
  try {
@@ -2130,7 +2109,7 @@ class KoniExtension {
2130
2109
  }];
2131
2110
  }
2132
2111
  }
2133
- async accountsCreateHardwareV2(_ref59) {
2112
+ async accountsCreateHardwareV2(_ref56) {
2134
2113
  let {
2135
2114
  accountIndex,
2136
2115
  address,
@@ -2139,7 +2118,7 @@ class KoniExtension {
2139
2118
  hardwareType,
2140
2119
  isAllowed,
2141
2120
  name
2142
- } = _ref59;
2121
+ } = _ref56;
2143
2122
  const key = _uiKeyring.keyring.addHardware(address, hardwareType, {
2144
2123
  accountIndex,
2145
2124
  addressOffset,
@@ -2162,10 +2141,10 @@ class KoniExtension {
2162
2141
  });
2163
2142
  return true;
2164
2143
  }
2165
- async accountsCreateHardwareMultiple(_ref60) {
2144
+ async accountsCreateHardwareMultiple(_ref57) {
2166
2145
  let {
2167
2146
  accounts
2168
- } = _ref60;
2147
+ } = _ref57;
2169
2148
  const addresses = [];
2170
2149
  if (!accounts.length) {
2171
2150
  throw new Error((0, _i18next.t)("Can't find an account. Please try again"));
@@ -2243,14 +2222,14 @@ class KoniExtension {
2243
2222
  }
2244
2223
  return true;
2245
2224
  }
2246
- async accountsCreateWithSecret(_ref61) {
2225
+ async accountsCreateWithSecret(_ref58) {
2247
2226
  let {
2248
2227
  isAllow,
2249
2228
  isEthereum,
2250
2229
  name,
2251
2230
  publicKey,
2252
2231
  secretKey
2253
- } = _ref61;
2232
+ } = _ref58;
2254
2233
  try {
2255
2234
  let keyringPair = null;
2256
2235
  if (isEthereum) {
@@ -2396,30 +2375,30 @@ class KoniExtension {
2396
2375
 
2397
2376
  // Parse transaction
2398
2377
 
2399
- parseSubstrateTransaction(_ref62) {
2378
+ parseSubstrateTransaction(_ref59) {
2400
2379
  let {
2401
2380
  data,
2402
2381
  networkKey
2403
- } = _ref62;
2382
+ } = _ref59;
2404
2383
  const apiProps = this.#koniState.getSubstrateApi(networkKey);
2405
2384
  const apiPromise = apiProps.api;
2406
2385
  return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
2407
2386
  }
2408
- async parseEVMRLP(_ref63) {
2387
+ async parseEVMRLP(_ref60) {
2409
2388
  let {
2410
2389
  data
2411
- } = _ref63;
2390
+ } = _ref60;
2412
2391
  return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
2413
2392
  }
2414
2393
 
2415
2394
  // Sign
2416
2395
 
2417
- qrSignSubstrate(_ref64) {
2396
+ qrSignSubstrate(_ref61) {
2418
2397
  let {
2419
2398
  address,
2420
2399
  data,
2421
2400
  networkKey
2422
- } = _ref64;
2401
+ } = _ref61;
2423
2402
  const pair = _uiKeyring.keyring.getPair(address);
2424
2403
  (0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
2425
2404
  if (pair.isLocked) {
@@ -2436,13 +2415,13 @@ class KoniExtension {
2436
2415
  signature: signed
2437
2416
  };
2438
2417
  }
2439
- async qrSignEVM(_ref65) {
2418
+ async qrSignEVM(_ref62) {
2440
2419
  let {
2441
2420
  address,
2442
2421
  chainId,
2443
2422
  message,
2444
2423
  type
2445
- } = _ref65;
2424
+ } = _ref62;
2446
2425
  let signed;
2447
2426
  const network = this.getNetworkJsonByChainId(chainId);
2448
2427
  if (!network) {
@@ -2526,11 +2505,11 @@ class KoniExtension {
2526
2505
  });
2527
2506
  return this.#koniState.getNominatorMetadata();
2528
2507
  }
2529
- async getBondingOptions(_ref66) {
2508
+ async getBondingOptions(_ref63) {
2530
2509
  let {
2531
2510
  chain,
2532
2511
  type
2533
- } = _ref66;
2512
+ } = _ref63;
2534
2513
  const apiProps = this.#koniState.getSubstrateApi(chain);
2535
2514
  const chainInfo = this.#koniState.getChainInfo(chain);
2536
2515
  const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
@@ -2720,12 +2699,12 @@ class KoniExtension {
2720
2699
  }
2721
2700
 
2722
2701
  // EVM Transaction
2723
- async parseContractInput(_ref67) {
2702
+ async parseContractInput(_ref64) {
2724
2703
  let {
2725
2704
  chainId,
2726
2705
  contract,
2727
2706
  data
2728
- } = _ref67;
2707
+ } = _ref64;
2729
2708
  const network = this.getNetworkJsonByChainId(chainId);
2730
2709
  return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
2731
2710
  }
@@ -2796,12 +2775,12 @@ class KoniExtension {
2796
2775
 
2797
2776
  // Change master password
2798
2777
 
2799
- keyringChangeMasterPassword(_ref68) {
2778
+ keyringChangeMasterPassword(_ref65) {
2800
2779
  let {
2801
2780
  createNew,
2802
2781
  newPassword,
2803
2782
  oldPassword
2804
- } = _ref68;
2783
+ } = _ref65;
2805
2784
  try {
2806
2785
  // Remove isMasterPassword meta if createNew
2807
2786
  if (createNew && !_uiKeyring.keyring.keyring.hasMasterPassword) {
@@ -2851,11 +2830,11 @@ class KoniExtension {
2851
2830
  }
2852
2831
  }
2853
2832
  }
2854
- keyringMigrateMasterPassword(_ref69) {
2833
+ keyringMigrateMasterPassword(_ref66) {
2855
2834
  let {
2856
2835
  address,
2857
2836
  password
2858
- } = _ref69;
2837
+ } = _ref66;
2859
2838
  try {
2860
2839
  _uiKeyring.keyring.migrateWithMasterPassword(address, password);
2861
2840
  this.checkLockAfterMigrate();
@@ -2874,10 +2853,10 @@ class KoniExtension {
2874
2853
 
2875
2854
  // Unlock wallet
2876
2855
 
2877
- keyringUnlock(_ref70) {
2856
+ keyringUnlock(_ref67) {
2878
2857
  let {
2879
2858
  password
2880
- } = _ref70;
2859
+ } = _ref67;
2881
2860
  try {
2882
2861
  _uiKeyring.keyring.unlockKeyring(password);
2883
2862
  // this.#koniState.initMantaPay(password)
@@ -2899,16 +2878,20 @@ class KoniExtension {
2899
2878
 
2900
2879
  keyringLock() {
2901
2880
  this.#koniState.keyringService.lock();
2881
+ this.#keyringLockSubject.next(true);
2902
2882
  clearTimeout(this.#lockTimeOut);
2903
2883
  }
2884
+ keyringLockSubscribe(cb) {
2885
+ this.#keyringLockSubject.subscribe(cb);
2886
+ }
2904
2887
 
2905
2888
  // Export mnemonic
2906
2889
 
2907
- keyringExportMnemonic(_ref71) {
2890
+ keyringExportMnemonic(_ref68) {
2908
2891
  let {
2909
2892
  address,
2910
2893
  password
2911
- } = _ref71;
2894
+ } = _ref68;
2912
2895
  const pair = _uiKeyring.keyring.getPair(address);
2913
2896
  const result = pair.exportMnemonic(password);
2914
2897
  return {
@@ -2918,10 +2901,10 @@ class KoniExtension {
2918
2901
 
2919
2902
  // Reset wallet
2920
2903
 
2921
- async resetWallet(_ref72) {
2904
+ async resetWallet(_ref69) {
2922
2905
  let {
2923
2906
  resetAll
2924
- } = _ref72;
2907
+ } = _ref69;
2925
2908
  try {
2926
2909
  await this.#koniState.resetWallet(resetAll);
2927
2910
  return {
@@ -2937,10 +2920,10 @@ class KoniExtension {
2937
2920
  }
2938
2921
 
2939
2922
  /// Signing substrate request
2940
- signingApprovePasswordV2(_ref73) {
2923
+ signingApprovePasswordV2(_ref70) {
2941
2924
  let {
2942
2925
  id
2943
- } = _ref73;
2926
+ } = _ref70;
2944
2927
  const queued = this.#koniState.getSignRequest(id);
2945
2928
  (0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
2946
2929
  const {
@@ -3019,22 +3002,22 @@ class KoniExtension {
3019
3002
 
3020
3003
  /// Derive account
3021
3004
 
3022
- derivationCreateMultiple(_ref74) {
3005
+ derivationCreateMultiple(_ref71) {
3023
3006
  let {
3024
3007
  isAllowed,
3025
3008
  items,
3026
3009
  parentAddress
3027
- } = _ref74;
3010
+ } = _ref71;
3028
3011
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
3029
3012
  const isEvm = parentPair.type === 'ethereum';
3030
3013
  if (parentPair.isLocked) {
3031
3014
  _uiKeyring.keyring.unlockPair(parentPair.address);
3032
3015
  }
3033
- const createChild = _ref75 => {
3016
+ const createChild = _ref72 => {
3034
3017
  let {
3035
3018
  name,
3036
3019
  suri
3037
- } = _ref75;
3020
+ } = _ref72;
3038
3021
  const meta = {
3039
3022
  name: name,
3040
3023
  parentAddress
@@ -3080,10 +3063,10 @@ class KoniExtension {
3080
3063
  }
3081
3064
  return true;
3082
3065
  }
3083
- derivationCreateV3(_ref76) {
3066
+ derivationCreateV3(_ref73) {
3084
3067
  let {
3085
3068
  address: parentAddress
3086
- } = _ref76;
3069
+ } = _ref73;
3087
3070
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
3088
3071
  const isEvm = parentPair.type === 'ethereum';
3089
3072
  if (parentPair.isLocked) {
@@ -3118,11 +3101,11 @@ class KoniExtension {
3118
3101
  }
3119
3102
  return true;
3120
3103
  }
3121
- validateDerivePath(_ref77) {
3104
+ validateDerivePath(_ref74) {
3122
3105
  let {
3123
3106
  parentAddress,
3124
3107
  suri
3125
- } = _ref77;
3108
+ } = _ref74;
3126
3109
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
3127
3110
  const isEvm = parentPair.type === 'ethereum';
3128
3111
  if (parentPair.isLocked) {
@@ -3155,12 +3138,12 @@ class KoniExtension {
3155
3138
  suri: meta.suri
3156
3139
  };
3157
3140
  }
3158
- getListDeriveAccounts(_ref78) {
3141
+ getListDeriveAccounts(_ref75) {
3159
3142
  let {
3160
3143
  limit,
3161
3144
  page,
3162
3145
  parentAddress
3163
- } = _ref78;
3146
+ } = _ref75;
3164
3147
  const parentPair = _uiKeyring.keyring.getPair(parentAddress);
3165
3148
  const isEvm = parentPair.type === 'ethereum';
3166
3149
  if (parentPair.isLocked) {
@@ -3270,10 +3253,10 @@ class KoniExtension {
3270
3253
  getSupportedSmartContractTypes() {
3271
3254
  return this.#koniState.getSupportedSmartContractTypes();
3272
3255
  }
3273
- getTransaction(_ref79) {
3256
+ getTransaction(_ref76) {
3274
3257
  let {
3275
3258
  id
3276
- } = _ref79;
3259
+ } = _ref76;
3277
3260
  const {
3278
3261
  transaction,
3279
3262
  ...transactionResult
@@ -3283,8 +3266,8 @@ class KoniExtension {
3283
3266
  subscribeTransactions(id, port) {
3284
3267
  const cb = (0, _subscriptions.createSubscription)(id, port);
3285
3268
  function convertRs(rs) {
3286
- return Object.fromEntries(Object.entries(rs).map(_ref80 => {
3287
- let [key, value] = _ref80;
3269
+ return Object.fromEntries(Object.entries(rs).map(_ref77 => {
3270
+ let [key, value] = _ref77;
3288
3271
  const {
3289
3272
  additionalValidator,
3290
3273
  eventsHandler,
@@ -3316,10 +3299,10 @@ class KoniExtension {
3316
3299
  });
3317
3300
  return notificationSubject.value;
3318
3301
  }
3319
- async reloadCron(_ref81) {
3302
+ async reloadCron(_ref78) {
3320
3303
  let {
3321
3304
  data
3322
- } = _ref81;
3305
+ } = _ref78;
3323
3306
  if (data === 'nft') {
3324
3307
  return await this.#koniState.reloadNft();
3325
3308
  } else if (data === 'staking') {
@@ -3363,20 +3346,20 @@ class KoniExtension {
3363
3346
 
3364
3347
  // Phishing detect
3365
3348
 
3366
- async passPhishingPage(_ref82) {
3349
+ async passPhishingPage(_ref79) {
3367
3350
  let {
3368
3351
  url
3369
- } = _ref82;
3352
+ } = _ref79;
3370
3353
  return await this.#koniState.approvePassPhishingPage(url);
3371
3354
  }
3372
3355
 
3373
3356
  /// Wallet connect
3374
3357
 
3375
3358
  // Connect
3376
- async connectWalletConnect(_ref83) {
3359
+ async connectWalletConnect(_ref80) {
3377
3360
  let {
3378
3361
  uri
3379
- } = _ref83;
3362
+ } = _ref80;
3380
3363
  await this.#koniState.walletConnectService.connect(uri);
3381
3364
  return true;
3382
3365
  }
@@ -3389,11 +3372,11 @@ class KoniExtension {
3389
3372
  });
3390
3373
  return this.#koniState.requestService.allConnectWCRequests;
3391
3374
  }
3392
- async approveWalletConnectSession(_ref84) {
3375
+ async approveWalletConnectSession(_ref81) {
3393
3376
  let {
3394
3377
  accounts: selectedAccounts,
3395
3378
  id
3396
- } = _ref84;
3379
+ } = _ref81;
3397
3380
  const request = this.#koniState.requestService.getConnectWCRequest(id);
3398
3381
  if ((0, _helpers2.isProposalExpired)(request.request.params)) {
3399
3382
  throw new Error('The proposal has been expired');
@@ -3405,8 +3388,8 @@ class KoniExtension {
3405
3388
  const availableNamespaces = {};
3406
3389
  const namespaces = {};
3407
3390
  const chainInfoMap = this.#koniState.getChainInfoMap();
3408
- Object.entries(requiredNamespaces).forEach(_ref85 => {
3409
- let [key, namespace] = _ref85;
3391
+ Object.entries(requiredNamespaces).forEach(_ref82 => {
3392
+ let [key, namespace] = _ref82;
3410
3393
  if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
3411
3394
  if (namespace.chains) {
3412
3395
  const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
@@ -3419,8 +3402,8 @@ class KoniExtension {
3419
3402
  throw new Error((0, _utils4.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
3420
3403
  }
3421
3404
  });
3422
- Object.entries(optionalNamespaces).forEach(_ref86 => {
3423
- let [key, namespace] = _ref86;
3405
+ Object.entries(optionalNamespaces).forEach(_ref83 => {
3406
+ let [key, namespace] = _ref83;
3424
3407
  if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
3425
3408
  if (namespace.chains) {
3426
3409
  const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
@@ -3444,8 +3427,8 @@ class KoniExtension {
3444
3427
  }
3445
3428
  }
3446
3429
  });
3447
- Object.entries(availableNamespaces).forEach(_ref87 => {
3448
- let [key, namespace] = _ref87;
3430
+ Object.entries(availableNamespaces).forEach(_ref84 => {
3431
+ let [key, namespace] = _ref84;
3449
3432
  if (namespace.chains) {
3450
3433
  const accounts = [];
3451
3434
  const chains = (0, _utils3.uniqueStringArray)(namespace.chains);
@@ -3469,10 +3452,10 @@ class KoniExtension {
3469
3452
  request.resolve();
3470
3453
  return true;
3471
3454
  }
3472
- async rejectWalletConnectSession(_ref88) {
3455
+ async rejectWalletConnectSession(_ref85) {
3473
3456
  let {
3474
3457
  id
3475
- } = _ref88;
3458
+ } = _ref85;
3476
3459
  const request = this.#koniState.requestService.getConnectWCRequest(id);
3477
3460
  const wcId = request.request.id;
3478
3461
  if ((0, _helpers2.isProposalExpired)(request.request.params)) {
@@ -3494,10 +3477,10 @@ class KoniExtension {
3494
3477
  });
3495
3478
  return this.#koniState.walletConnectService.sessions;
3496
3479
  }
3497
- async disconnectWalletConnectSession(_ref89) {
3480
+ async disconnectWalletConnectSession(_ref86) {
3498
3481
  let {
3499
3482
  topic
3500
- } = _ref89;
3483
+ } = _ref86;
3501
3484
  await this.#koniState.walletConnectService.disconnect(topic);
3502
3485
  return true;
3503
3486
  }
@@ -3510,18 +3493,18 @@ class KoniExtension {
3510
3493
  });
3511
3494
  return this.#koniState.requestService.allNotSupportWCRequests;
3512
3495
  }
3513
- approveWalletConnectNotSupport(_ref90) {
3496
+ approveWalletConnectNotSupport(_ref87) {
3514
3497
  let {
3515
3498
  id
3516
- } = _ref90;
3499
+ } = _ref87;
3517
3500
  const request = this.#koniState.requestService.getNotSupportWCRequest(id);
3518
3501
  request.resolve();
3519
3502
  return true;
3520
3503
  }
3521
- rejectWalletConnectNotSupport(_ref91) {
3504
+ rejectWalletConnectNotSupport(_ref88) {
3522
3505
  let {
3523
3506
  id
3524
- } = _ref91;
3507
+ } = _ref88;
3525
3508
  const request = this.#koniState.requestService.getNotSupportWCRequest(id);
3526
3509
  request.reject(new Error('USER_REJECTED'));
3527
3510
  return true;
@@ -3529,11 +3512,11 @@ class KoniExtension {
3529
3512
 
3530
3513
  /// Manta
3531
3514
 
3532
- async enableMantaPay(_ref92) {
3515
+ async enableMantaPay(_ref89) {
3533
3516
  let {
3534
3517
  address,
3535
3518
  password
3536
- } = _ref92;
3519
+ } = _ref89;
3537
3520
  // always takes the current account
3538
3521
  function timeout() {
3539
3522
  return new Promise(resolve => setTimeout(resolve, 1500));
@@ -3657,10 +3640,10 @@ class KoniExtension {
3657
3640
 
3658
3641
  /// Metadata
3659
3642
 
3660
- async findRawMetadata(_ref93) {
3643
+ async findRawMetadata(_ref90) {
3661
3644
  let {
3662
3645
  genesisHash
3663
- } = _ref93;
3646
+ } = _ref90;
3664
3647
  const {
3665
3648
  metadata,
3666
3649
  specVersion
@@ -3907,18 +3890,18 @@ class KoniExtension {
3907
3890
 
3908
3891
  /* Campaign */
3909
3892
 
3910
- unlockDotCheckCanMint(_ref94) {
3893
+ unlockDotCheckCanMint(_ref91) {
3911
3894
  let {
3912
3895
  address,
3913
3896
  network,
3914
3897
  slug
3915
- } = _ref94;
3898
+ } = _ref91;
3916
3899
  return this.#koniState.mintCampaignService.unlockDotCampaign.canMint(address, slug, network);
3917
3900
  }
3918
- unlockDotSubscribeMintedData(id, port, _ref95) {
3901
+ unlockDotSubscribeMintedData(id, port, _ref92) {
3919
3902
  let {
3920
3903
  transactionId
3921
- } = _ref95;
3904
+ } = _ref92;
3922
3905
  const cb = (0, _subscriptions.createSubscription)(id, port);
3923
3906
  const subscription = this.#koniState.mintCampaignService.unlockDotCampaign.subscribeMintedNft(transactionId, cb);
3924
3907
  this.createUnsubscriptionHandle(id, subscription.unsubscribe);
@@ -3950,10 +3933,10 @@ class KoniExtension {
3950
3933
  });
3951
3934
  return filterBanner(await this.#koniState.campaignService.getProcessingCampaign());
3952
3935
  }
3953
- async completeCampaignBanner(_ref96) {
3936
+ async completeCampaignBanner(_ref93) {
3954
3937
  let {
3955
3938
  slug
3956
- } = _ref96;
3939
+ } = _ref93;
3957
3940
  const campaign = await this.#koniState.dbService.getCampaign(slug);
3958
3941
  if (campaign) {
3959
3942
  await this.#koniState.dbService.upsertCampaign({
@@ -4406,12 +4389,6 @@ class KoniExtension {
4406
4389
  return this.subscribeAssetSetting(id, port);
4407
4390
  case 'pri(assetSetting.update)':
4408
4391
  return await this.updateAssetSetting(request);
4409
- case 'pri(transfer.checkReferenceCount)':
4410
- return await this.transferCheckReferenceCount(request);
4411
- case 'pri(transfer.checkSupporting)':
4412
- return await this.transferCheckSupporting(request);
4413
- case 'pri(transfer.getExistentialDeposit)':
4414
- return this.transferGetExistentialDeposit(request);
4415
4392
  case 'pri(transfer.getMaxTransferable)':
4416
4393
  return this.getMaxTransferable(request);
4417
4394
  case 'pri(transfer.subscribeMaxTransferable)':
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@subwallet/extension-base',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '1.2.3-1'
16
+ version: '1.2.4-0'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -141,7 +141,7 @@ const subscribeWithSystemAccountPallet = async _ref => {
141
141
  const items = balances.map((_balance, index) => {
142
142
  const balanceInfo = _balance.toPrimitive();
143
143
  const poolMemberInfo = poolMemberInfos[index].toPrimitive();
144
- const nominationPoolBalance = poolMemberInfo ? (0, _nominationpoolsPallet._getActiveStakeInNominationPool)(poolMemberInfo) : '0';
144
+ const nominationPoolBalance = poolMemberInfo ? (0, _nominationpoolsPallet._getTotalStakeInNominationPool)(poolMemberInfo) : new _bignumber.default(0);
145
145
  const transferableBalance = (0, _systemPallet._getSystemPalletTransferable)(balanceInfo, (0, _utils2._getChainExistentialDeposit)(chainInfo), extrinsicType);
146
146
  const totalBalance = (0, _systemPallet._getSystemPalletTotalBalance)(balanceInfo);
147
147
  const totalLockedFromTransfer = new _bignumber.default(totalBalance).minus(transferableBalance).plus(nominationPoolBalance);
@@ -176,8 +176,8 @@ const subscribeBridgedBalance = async _ref3 => {
176
176
  try {
177
177
  const isBridgedToken = (0, _utils2._isBridgedToken)(tokenInfo);
178
178
  if (isBridgedToken) {
179
- const multiLocation = (0, _utils2._getXcmAssetMultilocation)(tokenInfo);
180
- return await substrateApi.query.foreignAssets.account.multi(addresses.map(address => [multiLocation, address]), balances => {
179
+ const onChainInfo = (0, _utils2._getTokenOnChainInfo)(tokenInfo);
180
+ return await substrateApi.query.foreignAssets.account.multi(addresses.map(address => [onChainInfo, address]), balances => {
181
181
  const items = balances.map((balance, index) => {
182
182
  const bdata = balance === null || balance === void 0 ? void 0 : balance.toHuman();
183
183
  let frozen = _util.BN_ZERO;
@@ -354,6 +354,9 @@ const subscribeAssetsAccountPallet = async _ref7 => {
354
354
  const unsubList = await Promise.all(Object.values(tokenMap).map(async tokenInfo => {
355
355
  try {
356
356
  const assetIndex = (0, _utils2._getTokenOnChainAssetId)(tokenInfo);
357
+ if (assetIndex === '-1') {
358
+ return undefined;
359
+ }
357
360
 
358
361
  // Get Token Balance
359
362
  return await substrateApi.query.assets.account.multi(addresses.map(address => [assetIndex, address]), balances => {
@@ -45,7 +45,7 @@ const _BALANCE_CHAIN_GROUP = {
45
45
  kusama: ['kusama', 'kintsugi', 'kintsugi_test', 'interlay', 'acala', 'statemint', 'karura', 'bifrost'],
46
46
  // perhaps there are some runtime updates
47
47
  centrifuge: ['centrifuge'],
48
- supportBridged: ['rococo_assethub']
48
+ supportBridged: ['rococo_assethub', 'statemint', 'statemine']
49
49
  };
50
50
  exports._BALANCE_CHAIN_GROUP = _BALANCE_CHAIN_GROUP;
51
51
  const _BALANCE_TOKEN_GROUP = {
@@ -271,7 +271,7 @@ const _DEFAULT_MANTA_ZK_CHAIN = 'calamari';
271
271
  // XCM------------------------------------------------------------------------------------------------------------------
272
272
  exports._DEFAULT_MANTA_ZK_CHAIN = _DEFAULT_MANTA_ZK_CHAIN;
273
273
  const _XCM_CHAIN_GROUP = {
274
- polkadotXcm: ['astar', 'shiden', 'statemine', 'statemint', 'equilibrium_parachain'],
274
+ polkadotXcm: ['astar', 'shiden', 'statemine', 'statemint', 'equilibrium_parachain', 'rococo_assethub'],
275
275
  xcmPallet: ['polkadot', 'kusama']
276
276
  // default is xTokens pallet
277
277
  };