From 692a0e3c23787597de942b305aa47124cb4c1eb0 Mon Sep 17 00:00:00 2001 From: tomasklim Date: Tue, 6 Aug 2024 13:55:36 +0200 Subject: [PATCH] feat(connect): parseCoins start using chain shortcut and not just symbol --- packages/connect/src/api/ethereum/ethereumDefinitions.ts | 1 + packages/connect/src/data/coinInfo.ts | 6 +++--- packages/connect/src/types/coinInfo.ts | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/connect/src/api/ethereum/ethereumDefinitions.ts b/packages/connect/src/api/ethereum/ethereumDefinitions.ts index 3a1aaf98501..70c64619239 100644 --- a/packages/connect/src/api/ethereum/ethereumDefinitions.ts +++ b/packages/connect/src/api/ethereum/ethereumDefinitions.ts @@ -158,4 +158,5 @@ export const ethereumNetworkInfoFromDefinition = ( T3W1: '2.0.0', }, blockchainLink: undefined, + chain: '', }); diff --git a/packages/connect/src/data/coinInfo.ts b/packages/connect/src/data/coinInfo.ts index 777a605cdb8..74c91ea30f5 100644 --- a/packages/connect/src/data/coinInfo.ts +++ b/packages/connect/src/data/coinInfo.ts @@ -38,9 +38,8 @@ export const getEthereumNetwork = (pathOrName: DerivationPath) => { if (typeof pathOrName === 'string') { const name = pathOrName.toLowerCase(); - return networks.find( - n => n.name.toLowerCase() === name || n.shortcut.toLowerCase() === name, - ); + // name is network symbol (bnb, op, btc) + return networks.find(n => n.name.toLowerCase() === name || n.chain.toLowerCase() === name); } const slip44 = fromHardened(pathOrName[1]); @@ -266,6 +265,7 @@ const parseEthereumNetworksJson = (json: any) => { shortcut: network.shortcut, slip44: network.slip44, support: network.support, + chain: network.chain, }); }); }; diff --git a/packages/connect/src/types/coinInfo.ts b/packages/connect/src/types/coinInfo.ts index d4a03c9e71c..b7e4f7f2b8a 100644 --- a/packages/connect/src/types/coinInfo.ts +++ b/packages/connect/src/types/coinInfo.ts @@ -91,6 +91,7 @@ export const EthereumNetworkInfo = Type.Intersect([ type: Type.Literal('ethereum'), chainId: Type.Number(), network: Type.Optional(Type.Undefined()), + chain: Type.String(), }), ]);