Skip to content

Commit c3ca23f

Browse files
authored
remove duplicate publishers from json (#646)
1 parent b3c697e commit c3ca23f

File tree

1 file changed

+4
-11
lines changed
  • governance/xc_admin/packages/xc_admin_frontend/components/tabs

1 file changed

+4
-11
lines changed

governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ const General = () => {
172172
const fileDataParsed = sortData(JSON.parse(fileData as string))
173173
const changes: Record<string, any> = {}
174174
Object.keys(fileDataParsed).forEach((symbol) => {
175+
// remove duplicate publishers
176+
fileDataParsed[symbol].priceAccounts[0].publishers = [
177+
...new Set(fileDataParsed[symbol].priceAccounts[0].publishers),
178+
]
175179
if (!existingSymbols.has(symbol)) {
176180
// if symbol is not in existing symbols, create new entry
177181
changes[symbol] = { new: {} }
@@ -245,17 +249,6 @@ const General = () => {
245249
}
246250
})
247251

248-
// check that there are no duplicate publishers
249-
Object.keys(jsonParsed).forEach((symbol) => {
250-
if (
251-
new Set(jsonParsed[symbol].priceAccounts[0].publishers).size !=
252-
jsonParsed[symbol].priceAccounts[0].publishers.length
253-
) {
254-
toast.error(`${symbol} has a duplicate publisher.`)
255-
isValid = false
256-
}
257-
})
258-
259252
// check that no price account has more than 32 publishers
260253
Object.keys(jsonParsed).forEach((symbol) => {
261254
if (jsonParsed[symbol].priceAccounts[0].publishers.length > 32) {

0 commit comments

Comments
 (0)