From 055f329f51d6a7f4d69d945bd657e2f592bb9cd3 Mon Sep 17 00:00:00 2001 From: jinoosss Date: Mon, 4 Sep 2023 19:46:57 +0900 Subject: [PATCH] fix: Change Network UI --- .../edit-custom-network-conatiner.tsx | 5 +++-- .../adena-extension/src/hooks/use-custom-network-input.tsx | 2 +- packages/adena-extension/src/hooks/use-network.ts | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/adena-extension/src/containers/edit-custom-network-conatiner/edit-custom-network-conatiner.tsx b/packages/adena-extension/src/containers/edit-custom-network-conatiner/edit-custom-network-conatiner.tsx index 3b52a5ab..1eb67a9a 100644 --- a/packages/adena-extension/src/containers/edit-custom-network-conatiner/edit-custom-network-conatiner.tsx +++ b/packages/adena-extension/src/containers/edit-custom-network-conatiner/edit-custom-network-conatiner.tsx @@ -97,12 +97,13 @@ const EditCustomNetworkConatiner: React.FC = () => { } const network = networks.find(current => current.id === currentNetworkId); if (network) { + const parsedName = name.trim(); await updateNetwork({ ...network, chainId: chainId, networkId: chainId, - chainName: name, - networkName: name, + chainName: parsedName, + networkName: parsedName, rpcUrl }); } diff --git a/packages/adena-extension/src/hooks/use-custom-network-input.tsx b/packages/adena-extension/src/hooks/use-custom-network-input.tsx index 5e954c83..d375b1f3 100644 --- a/packages/adena-extension/src/hooks/use-custom-network-input.tsx +++ b/packages/adena-extension/src/hooks/use-custom-network-input.tsx @@ -8,7 +8,7 @@ export const useCustomNetworkInput = () => { const [chainIdError, setChainIdError] = useState(''); const changeName = useCallback((name: string) => { - setName(name.trim()); + setName(name); }, [setName]); const changeRPCUrl = useCallback((rpcUrl: string) => { diff --git a/packages/adena-extension/src/hooks/use-network.ts b/packages/adena-extension/src/hooks/use-network.ts index f28d4383..0e662444 100644 --- a/packages/adena-extension/src/hooks/use-network.ts +++ b/packages/adena-extension/src/hooks/use-network.ts @@ -40,7 +40,8 @@ export const useNetwork = (): NetworkResponse => { const addNetwork = useCallback( async (name: string, rpcUrl: string, chainId: string) => { const changedRpcUrl = rpcUrl.endsWith('/') ? rpcUrl.substring(0, rpcUrl.length - 1) : rpcUrl; - await chainService.addGnoNetwork(name, changedRpcUrl, chainId); + const parsedName = name.trim(); + await chainService.addGnoNetwork(parsedName, changedRpcUrl, chainId); const networkMetainfos = await chainService.getNetworks(); setNetworkMetainfos(networkMetainfos); },