From c699eef4eed050d8e440e92dbef081e120f593eb Mon Sep 17 00:00:00 2001 From: Mike <17463738+mwmerz@users.noreply.github.com> Date: Tue, 4 Apr 2023 10:37:30 -0400 Subject: [PATCH] feat: guard against empty networks, chaindID, or lcd (#327) --- src/pages/history/HistoryList.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pages/history/HistoryList.tsx b/src/pages/history/HistoryList.tsx index 9e9a50ec7..7b1fea2a2 100644 --- a/src/pages/history/HistoryList.tsx +++ b/src/pages/history/HistoryList.tsx @@ -34,9 +34,13 @@ const HistoryList = ({ chainID }: Props) => { const result: any[] = [] const txhases: string[] = [] + if (!networks || !networks[chainID] || !networks[chainID].lcd) { + return result + } + const requests = await Promise.all( - EVENTS.map((event) => - axios.get(`/cosmos/tx/v1beta1/txs`, { + EVENTS.map((event) => { + return axios.get(`/cosmos/tx/v1beta1/txs`, { baseURL: networks[chainID].lcd, params: { events: `${event}='${address}'`, @@ -46,7 +50,7 @@ const HistoryList = ({ chainID }: Props) => { "pagination.limit": LIMIT, }, }) - ) + }) ) for (const { data } of requests) {