From 32445ff473a815e8fb238346cf67b7a616171b4b Mon Sep 17 00:00:00 2001 From: DLHTX <35157091+DLHTX@users.noreply.github.com> Date: Mon, 14 Aug 2023 18:00:43 +0800 Subject: [PATCH] fix(chain): update chain config from 1.5.4 (#264) --- src/server/routers/env.ts | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/server/routers/env.ts b/src/server/routers/env.ts index 4112044a..64bd0e03 100644 --- a/src/server/routers/env.ts +++ b/src/server/routers/env.ts @@ -26,21 +26,13 @@ export const envRouter = t.router({ } try { - // blockChains = await prisma.t_blockchain.findMany({ - // select: { - // f_id: true, - // f_chain_id: true, - // f_chain_address: true - // } - // }); - const ethClientRes = await axios.get(`${process.env.NEXT_PUBLIC_API_URL}/srv-applet-mgr/v0/configuration/eth_client`); - const clients: { [key: string]: string } = JSON.parse(ethClientRes.data.clients); - for (let key in clients) { - const f_chain_address = clients[key]; - const f_chain_id = BigInt(key); - const f_id = BigInt(key); - blockChains.push({ f_id, f_chain_id, f_chain_address }); - } + const ethClientRes = await axios.get(`${process.env.NEXT_PUBLIC_API_URL}/srv-applet-mgr/v0/configuration/chain_config`); + const chains: { chainID: number, name: string, endpoint: string }[] = JSON.parse(ethClientRes.data.chains); + chains.forEach(i => { + if (i.chainID) { + blockChains.push({ f_id: BigInt(i.chainID), f_chain_id: BigInt(i.chainID), f_chain_address: i.endpoint }) + } + }) } catch (error) { console.error(error); }