Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add check for price data format
  • Loading branch information
cryptopapi997 committed Jan 31, 2023
commit c95ef72f968853798540faf0c2b39bc825e4f23e
5 changes: 5 additions & 0 deletions src/PythHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ export class PythHttpClient {
if (!accInfo) {
throw new Error('Could not get account info for account ' + priceAccounts[i].toBase58())
}

const baseData = parseBaseData(accInfo.data)
if (baseData === undefined || baseData.type !== AccountType.Price) {
throw new Error('Account ' + priceAccounts[i].toBase58() + ' is not a price account')
}

const priceData = parsePriceData(accInfo.data, currentSlot)
priceDatas.push(priceData)
Expand Down