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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,7 +39,7 @@ function subscribeAstarStakingMetadata(chain, substrateApi, callback) {
39
39
  // temporary fix for Astar, there's no limit for now
40
40
  maxWithdrawalRequestPerValidator: 1,
41
41
  // by default
42
- allowCancelUnstaking: true,
42
+ allowCancelUnstaking: false,
43
43
  unstakingPeriod
44
44
  });
45
45
  });
@@ -75,7 +75,7 @@ async function getAstarStakingMetadata(chain, substrateApi) {
75
75
  // temporary fix for Astar, there's no limit for now
76
76
  maxWithdrawalRequestPerValidator: 1,
77
77
  // by default
78
- allowCancelUnstaking: true,
78
+ allowCancelUnstaking: false,
79
79
  unstakingPeriod
80
80
  };
81
81
  }
@@ -114,7 +114,7 @@ async function subscribeAstarNominatorMetadata(chainInfo, address, substrateApi,
114
114
  nominationList.push({
115
115
  status: dappStakingStatus,
116
116
  chain: chainInfo.slug,
117
- validatorAddress: dappAddress.toLowerCase(),
117
+ validatorAddress: (0, _utilCrypto.isEthereumAddress)(dappAddress) ? dappAddress.toLowerCase() : dappAddress,
118
118
  activeStake: currentStake,
119
119
  validatorMinStake: '0',
120
120
  validatorIdentity: dappInfo === null || dappInfo === void 0 ? void 0 : dappInfo.name,
@@ -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.1.20-0'
16
+ version: '1.1.20-2'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -645,9 +645,11 @@ class ChainService {
645
645
  } else {
646
646
  const mergedChainInfoMap = latestChainInfoMap;
647
647
  for (const [storedSlug, storedChainInfo] of Object.entries(storedChainSettingMap)) {
648
- if (storedSlug in latestChainInfoMap) {
649
- // check predefined chains first, keep setting for providers and currentProvider
650
- // TODO: review merging providers
648
+ const chainInfo = latestChainInfoMap[storedSlug];
649
+
650
+ // Network is existed on change list
651
+ // check predefined chains first, keep setting for providers and currentProvider
652
+ if (chainInfo) {
651
653
  // Keep customer provider only
652
654
  const providers = {
653
655
  ...mergedChainInfoMap[storedSlug].providers
@@ -673,18 +675,20 @@ class ChainService {
673
675
  }
674
676
  }
675
677
  }
678
+ const hasProvider = Object.values(providers).length > 0;
679
+ const canActive = hasProvider && chainInfo.chainStatus === _types._ChainStatus.ACTIVE;
676
680
  this.dataMap.chainStateMap[storedSlug] = {
677
681
  currentProvider: currentProvider,
678
682
  slug: storedSlug,
679
683
  connectionStatus: _types3._ChainConnectionStatus.DISCONNECTED,
680
- active: storedChainInfo.active
684
+ active: canActive && storedChainInfo.active
681
685
  };
682
686
  newStorageData.push({
683
687
  ...mergedChainInfoMap[storedSlug],
684
- active: storedChainInfo.active,
688
+ active: canActive && storedChainInfo.active,
685
689
  currentProvider: currentProvider
686
690
  });
687
- } else {
691
+ } else if ((0, _utils._isCustomChain)(storedSlug)) {
688
692
  var _storedChainInfo$subs, _storedChainInfo$evmI;
689
693
  // only custom chains are left
690
694
  // check custom chain duplicated with predefined chain => merge into predefined chain
@@ -731,6 +735,8 @@ class ChainService {
731
735
  currentProvider: storedChainInfo.currentProvider
732
736
  });
733
737
  }
738
+ } else {
739
+ // Todo: Remove chain from storage
734
740
  }
735
741
  }
736
742
 
@@ -11,7 +11,6 @@ var _recoverHistoryStatus = require("@subwallet/extension-base/services/history-
11
11
  var _promise = require("@subwallet/extension-base/utils/promise");
12
12
  var _uiKeyring = require("@subwallet/ui-keyring");
13
13
  var _rxjs = require("rxjs");
14
- var _subsquidMultiChainHistory = require("./subsquid-multi-chain-history");
15
14
  // Copyright 2019-2022 @subwallet/extension-base
16
15
  // SPDX-License-Identifier: Apache-2.0
17
16
 
@@ -32,10 +31,12 @@ class HistoryService {
32
31
  if (!addresses || addresses.length === 0) {
33
32
  return [];
34
33
  }
35
- const chainMap = this.chainService.getChainInfoMap();
36
34
 
37
35
  // Query data from subscan or any indexer
38
- const historyRecords = await (0, _subsquidMultiChainHistory.fetchMultiChainHistories)(addresses, chainMap);
36
+ // const chainMap = this.chainService.getChainInfoMap();
37
+ // const historyRecords = await fetchMultiChainHistories(addresses, chainMap);
38
+ // Pause deprecated until have new update
39
+ const historyRecords = [];
39
40
 
40
41
  // Fill additional info
41
42
  const accountMap = Object.entries(this.keyringService.accounts).reduce((map, _ref) => {
@@ -23,7 +23,7 @@ export function subscribeAstarStakingMetadata(chain, substrateApi, callback) {
23
23
  // temporary fix for Astar, there's no limit for now
24
24
  maxWithdrawalRequestPerValidator: 1,
25
25
  // by default
26
- allowCancelUnstaking: true,
26
+ allowCancelUnstaking: false,
27
27
  unstakingPeriod
28
28
  });
29
29
  });
@@ -59,7 +59,7 @@ export async function getAstarStakingMetadata(chain, substrateApi) {
59
59
  // temporary fix for Astar, there's no limit for now
60
60
  maxWithdrawalRequestPerValidator: 1,
61
61
  // by default
62
- allowCancelUnstaking: true,
62
+ allowCancelUnstaking: false,
63
63
  unstakingPeriod
64
64
  };
65
65
  }
@@ -98,7 +98,7 @@ export async function subscribeAstarNominatorMetadata(chainInfo, address, substr
98
98
  nominationList.push({
99
99
  status: dappStakingStatus,
100
100
  chain: chainInfo.slug,
101
- validatorAddress: dappAddress.toLowerCase(),
101
+ validatorAddress: isEthereumAddress(dappAddress) ? dappAddress.toLowerCase() : dappAddress,
102
102
  activeStake: currentStake,
103
103
  validatorMinStake: '0',
104
104
  validatorIdentity: dappInfo === null || dappInfo === void 0 ? void 0 : dappInfo.name,
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.1.20-0",
20
+ "version": "1.1.20-2",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -1307,11 +1307,11 @@
1307
1307
  "@reduxjs/toolkit": "^1.9.1",
1308
1308
  "@sora-substrate/type-definitions": "^1.17.7",
1309
1309
  "@substrate/connect": "^0.7.26",
1310
- "@subwallet/chain-list": "0.2.20-beta.5",
1311
- "@subwallet/extension-base": "^1.1.20-0",
1312
- "@subwallet/extension-chains": "^1.1.20-0",
1313
- "@subwallet/extension-dapp": "^1.1.20-0",
1314
- "@subwallet/extension-inject": "^1.1.20-0",
1310
+ "@subwallet/chain-list": "0.2.20-beta.7",
1311
+ "@subwallet/extension-base": "^1.1.20-2",
1312
+ "@subwallet/extension-chains": "^1.1.20-2",
1313
+ "@subwallet/extension-dapp": "^1.1.20-2",
1314
+ "@subwallet/extension-inject": "^1.1.20-2",
1315
1315
  "@subwallet/keyring": "^0.1.1",
1316
1316
  "@subwallet/ui-keyring": "^0.1.1",
1317
1317
  "@walletconnect/sign-client": "^2.8.4",
package/packageInfo.js CHANGED
@@ -7,5 +7,5 @@ export const packageInfo = {
7
7
  name: '@subwallet/extension-base',
8
8
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
9
9
  type: 'esm',
10
- version: '1.1.20-0'
10
+ version: '1.1.20-2'
11
11
  };
@@ -629,9 +629,11 @@ export class ChainService {
629
629
  } else {
630
630
  const mergedChainInfoMap = latestChainInfoMap;
631
631
  for (const [storedSlug, storedChainInfo] of Object.entries(storedChainSettingMap)) {
632
- if (storedSlug in latestChainInfoMap) {
633
- // check predefined chains first, keep setting for providers and currentProvider
634
- // TODO: review merging providers
632
+ const chainInfo = latestChainInfoMap[storedSlug];
633
+
634
+ // Network is existed on change list
635
+ // check predefined chains first, keep setting for providers and currentProvider
636
+ if (chainInfo) {
635
637
  // Keep customer provider only
636
638
  const providers = {
637
639
  ...mergedChainInfoMap[storedSlug].providers
@@ -657,18 +659,20 @@ export class ChainService {
657
659
  }
658
660
  }
659
661
  }
662
+ const hasProvider = Object.values(providers).length > 0;
663
+ const canActive = hasProvider && chainInfo.chainStatus === _ChainStatus.ACTIVE;
660
664
  this.dataMap.chainStateMap[storedSlug] = {
661
665
  currentProvider: currentProvider,
662
666
  slug: storedSlug,
663
667
  connectionStatus: _ChainConnectionStatus.DISCONNECTED,
664
- active: storedChainInfo.active
668
+ active: canActive && storedChainInfo.active
665
669
  };
666
670
  newStorageData.push({
667
671
  ...mergedChainInfoMap[storedSlug],
668
- active: storedChainInfo.active,
672
+ active: canActive && storedChainInfo.active,
669
673
  currentProvider: currentProvider
670
674
  });
671
- } else {
675
+ } else if (_isCustomChain(storedSlug)) {
672
676
  var _storedChainInfo$subs, _storedChainInfo$evmI;
673
677
  // only custom chains are left
674
678
  // check custom chain duplicated with predefined chain => merge into predefined chain
@@ -715,6 +719,8 @@ export class ChainService {
715
719
  currentProvider: storedChainInfo.currentProvider
716
720
  });
717
721
  }
722
+ } else {
723
+ // Todo: Remove chain from storage
718
724
  }
719
725
  }
720
726
 
@@ -8,7 +8,6 @@ import { historyRecover, HistoryRecoverStatus } from '@subwallet/extension-base/
8
8
  import { createPromiseHandler } from '@subwallet/extension-base/utils/promise';
9
9
  import { keyring } from '@subwallet/ui-keyring';
10
10
  import { BehaviorSubject } from 'rxjs';
11
- import { fetchMultiChainHistories } from "./subsquid-multi-chain-history.js";
12
11
  export class HistoryService {
13
12
  historySubject = new BehaviorSubject([]);
14
13
  #needRecoveryHistories = {};
@@ -26,10 +25,12 @@ export class HistoryService {
26
25
  if (!addresses || addresses.length === 0) {
27
26
  return [];
28
27
  }
29
- const chainMap = this.chainService.getChainInfoMap();
30
28
 
31
29
  // Query data from subscan or any indexer
32
- const historyRecords = await fetchMultiChainHistories(addresses, chainMap);
30
+ // const chainMap = this.chainService.getChainInfoMap();
31
+ // const historyRecords = await fetchMultiChainHistories(addresses, chainMap);
32
+ // Pause deprecated until have new update
33
+ const historyRecords = [];
33
34
 
34
35
  // Fill additional info
35
36
  const accountMap = Object.entries(this.keyringService.accounts).reduce((map, [address, account]) => {