Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue-97] Update chain #98

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"@polkadot/types-codec": "10.10.1",
"@polkadot/util": "^12.6.2",
"@polkadot/util-crypto": "^12.6.2",
"@subwallet/chain-list": "0.2.64-beta.2",
"@subwallet/chain-list": "0.2.64-beta.5",
"@subwallet/keyring": "file:./local-libs/keyring",
"@subwallet/ui-keyring": "file:./local-libs/ui-keyring",
"babel-core": "^7.0.0-bridge.0",
Expand Down
30 changes: 29 additions & 1 deletion packages/extension-base/src/services/chain-service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,41 @@ import Web3 from 'web3';
import { logger as createLogger } from '@polkadot/util/logger';
import { Logger } from '@polkadot/util/types';

// @ts-ignore
const filterChainInfoMap = (data: Record<string, _ChainInfo>): Record<string, _ChainInfo> => {
return Object.fromEntries(
Object.entries(data)
.filter(([, info]) => !info.substrateInfo)
);
};

const availChainInfoMap = (() => {
const nativeEvmList = [
'ethereum',
'polygon',
'arbitrum_one',
'base_mainnet',
'optimism',
'avalanche_c'
];
const bitcoinL2List = [
'bitlayer',
'bitlayerTest',
'bevm',
'bevmTest',
'b2',
'bobMainnet',
'merlinEvm',
'botanixEvmTest',
'bounceBitEvm'
];
const enableList = nativeEvmList.concat(bitcoinL2List);

return Object.fromEntries(enableList.map((slug) => {
return [slug, ChainInfoMap[slug]];
}));
})();

const filterAssetInfoMap = (chainInfo: Record<string, _ChainInfo>, assets: Record<string, _ChainAsset>): Record<string, _ChainAsset> => {
return Object.fromEntries(
Object.entries(assets)
Expand Down Expand Up @@ -1170,7 +1198,7 @@ export class ChainService {

private async initChains () {
const storedChainSettings = await this.dbService.getAllChainStore();
const defaultChainInfoMap = filterChainInfoMap(ChainInfoMap);
const defaultChainInfoMap = availChainInfoMap;
const storedChainSettingMap: Record<string, IChain> = {};

storedChainSettings.forEach((chainStoredSetting) => {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6231,14 +6231,14 @@ __metadata:
languageName: node
linkType: hard

"@subwallet/chain-list@npm:0.2.64-beta.2":
version: 0.2.64-beta.2
resolution: "@subwallet/chain-list@npm:0.2.64-beta.2"
"@subwallet/chain-list@npm:0.2.64-beta.5":
version: 0.2.64-beta.5
resolution: "@subwallet/chain-list@npm:0.2.64-beta.5"
dependencies:
"@polkadot/dev": 0.67.167
"@polkadot/util": ^12.5.1
eventemitter3: ^5.0.1
checksum: e74a0a1e86a25b013a788890ec1be679ec10d86d78d247070fb9360ad97fd310e20492b2f6f8a3de1317539a79705b0b61baaaefbc69662559d60bbac47bc411
checksum: 7144b439c244c47a713c56ef6c296a74883dff39b33bab1a1097e504d7769d3f128144f8c65fe784555065ef16a6d2852de441493290cd59b3afea4bfd79e875
languageName: node
linkType: hard

Expand Down
Loading