From 759532787741d75ed40726a3e6dac37afcc2ad93 Mon Sep 17 00:00:00 2001 From: bluezdot <72647326+bluezdot@users.noreply.github.com> Date: Fri, 24 May 2024 15:16:40 +0700 Subject: [PATCH] [Issue-97] build: update chainlist --- package.json | 2 +- .../src/services/chain-service/index.ts | 30 ++++++++++++++++++- yarn.lock | 8 ++--- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 3f7e0cbe85..3d90981540 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/extension-base/src/services/chain-service/index.ts b/packages/extension-base/src/services/chain-service/index.ts index 45fe8155e3..e090760f33 100644 --- a/packages/extension-base/src/services/chain-service/index.ts +++ b/packages/extension-base/src/services/chain-service/index.ts @@ -28,6 +28,7 @@ import Web3 from 'web3'; import { logger as createLogger } from '@polkadot/util/logger'; import { Logger } from '@polkadot/util/types'; +// @ts-ignore const filterChainInfoMap = (data: Record): Record => { return Object.fromEntries( Object.entries(data) @@ -35,6 +36,33 @@ const filterChainInfoMap = (data: Record): Record { + 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, assets: Record): Record => { return Object.fromEntries( Object.entries(assets) @@ -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 = {}; storedChainSettings.forEach((chainStoredSetting) => { diff --git a/yarn.lock b/yarn.lock index 15c0c8d8d4..ba9024c750 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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