Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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: {} }
Expand Down Expand Up @@ -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) {
Expand Down