From 02d6b0c917628f2f0da619db12da2c686a67db23 Mon Sep 17 00:00:00 2001 From: Daniel Chew Date: Wed, 1 Mar 2023 16:30:53 +0900 Subject: [PATCH] remove duplicate publishers from json --- .../xc_admin_frontend/components/tabs/General.tsx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx b/governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx index bf1af67f3c..25ef7c0905 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx +++ b/governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx @@ -172,6 +172,10 @@ const General = () => { const fileDataParsed = sortData(JSON.parse(fileData as string)) const changes: Record = {} Object.keys(fileDataParsed).forEach((symbol) => { + // remove duplicate publishers + fileDataParsed[symbol].priceAccounts[0].publishers = [ + ...new Set(fileDataParsed[symbol].priceAccounts[0].publishers), + ] if (!existingSymbols.has(symbol)) { // if symbol is not in existing symbols, create new entry changes[symbol] = { new: {} } @@ -245,17 +249,6 @@ const General = () => { } }) - // check that there are no duplicate publishers - Object.keys(jsonParsed).forEach((symbol) => { - if ( - new Set(jsonParsed[symbol].priceAccounts[0].publishers).size != - jsonParsed[symbol].priceAccounts[0].publishers.length - ) { - toast.error(`${symbol} has a duplicate publisher.`) - isValid = false - } - }) - // check that no price account has more than 32 publishers Object.keys(jsonParsed).forEach((symbol) => { if (jsonParsed[symbol].priceAccounts[0].publishers.length > 32) {