[xc-admin] Output symbol when more than 32 publishers (#625)

* Make change

* Add check for duplicates

* Remove console log
This commit is contained in:
guibescos 2023-02-23 18:32:00 -06:00 committed by GitHub
parent 8cb720c476
commit a549d535f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -245,10 +245,21 @@ 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) {
toast.error(`A price account can't have more than 32 publishers.`)
toast.error(`${symbol} has more than 32 publishers.`)
isValid = false
}
})