From e665e70be25c103c142933eec3dc1e9310b7daa3 Mon Sep 17 00:00:00 2001 From: KillariDev Date: Fri, 13 Dec 2024 16:06:57 +0200 Subject: [PATCH] update settings chain id when its opened, show `chainId: ` for unknown chains --- app/ts/components/Navbar.tsx | 1 + app/ts/components/Settings.tsx | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/ts/components/Navbar.tsx b/app/ts/components/Navbar.tsx index cce1583..c72c8ba 100644 --- a/app/ts/components/Navbar.tsx +++ b/app/ts/components/Navbar.tsx @@ -47,6 +47,7 @@ export const Navbar = ({ className='px-2 py-1 bg-black' > {bouquetSettings.value.map((network) => )} + {bouquetSettings.value.find((network) => network.chainId === provider.value?.chainId) === undefined ? : <>} diff --git a/app/ts/components/Settings.tsx b/app/ts/components/Settings.tsx index 4f215ee..5c86525 100644 --- a/app/ts/components/Settings.tsx +++ b/app/ts/components/Settings.tsx @@ -39,7 +39,7 @@ export const SettingsModal = ({ display, bouquetNetwork, bouquetSettings }: { di const mempoolSubmitRpcEndpoint = useSignal({ value: bouquetNetwork.peek().mempoolSubmitRpcEndpoint, valid: true }) const relayMode = useSignal({ value: bouquetNetwork.peek().relayMode, valid: true }) const loaded = useSignal(false) - + useEffect(() => { bringSettingsValues() loaded.value = display.value @@ -108,7 +108,7 @@ export const SettingsModal = ({ display, bouquetNetwork, bouquetSettings }: { di { ...newSettings, chainId: chainId.value.value, - networkName: `ChainId: ${ chainId }`, + networkName: `ChainId: ${ chainId.value.value }`, blockExplorerApi: '', blockExplorer: '', } @@ -120,6 +120,7 @@ export const SettingsModal = ({ display, bouquetNetwork, bouquetSettings }: { di function bringSettingsValues() { batch(() => { + chainId.value = { value: bouquetNetwork.peek().chainId, valid: true } simulationRelayEndpointInput.value = { value: bouquetNetwork.peek().simulationRelayEndpoint, valid: true } submissionRelayEndpointInput.value = { value: bouquetNetwork.peek().submissionRelayEndpoint, valid: true } priorityFeeInput.value = { value: formatUnits(bouquetNetwork.peek().priorityFee, 'gwei'), valid: true } @@ -155,7 +156,7 @@ export const SettingsModal = ({ display, bouquetNetwork, bouquetSettings }: { di Mempool Submit RPC URL ) => validateMempoolSubmitRpcEndpoint(e.currentTarget.value)} value={mempoolSubmitRpcEndpoint.value.value} type='text' className='bg-transparent outline-none placeholder:text-gray-600' placeholder='https://' /> - : <> + : <>
Bundle Simulation Relay URL ) => validateSimulationRelayEndpointInput(e.currentTarget.value)} value={simulationRelayEndpointInput.value.value} type='text' className='bg-transparent outline-none placeholder:text-gray-600' placeholder='https://' />