remove duplicate publishers from json (#646)
This commit is contained in:
parent
b3c697e5f5
commit
c3ca23f3b6
|
@ -172,6 +172,10 @@ const General = () => {
|
|||
const fileDataParsed = sortData(JSON.parse(fileData as string))
|
||||
const changes: Record<string, any> = {}
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue