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
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
const handleSendProposalButtonClick = async () => {
if (pythProgramClient && dataChanges && !isMultisigLoading && squads) {
const instructions: TransactionInstruction[] = []
const publisherInitializationsVerified: PublicKey[] = []
const publisherInPriceStoreInitializationsVerified: PublicKey[] = []

for (const symbol of Object.keys(dataChanges)) {
const multisigAuthority = squads.getAuthorityPDA(
Expand All @@ -301,9 +301,14 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
? mapKey(multisigAuthority)
: multisigAuthority

const initPublisher = async (publisherKey: PublicKey) => {
const initPublisherInPriceStore = async (publisherKey: PublicKey) => {
// Price store is only available in Pythnet and Pythtest-crosschain
if (cluster !== 'pythnet' && cluster !== 'pythtest-crosschain') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a better option would be to check if price store program is deployed on the current chain?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm that also works. I wanted to avoid doing it for pythtest-conformance but it doesn't matter probably.

return
}

if (
publisherInitializationsVerified.every(
publisherInPriceStoreInitializationsVerified.every(
(el) => !el.equals(publisherKey)
)
) {
Expand All @@ -321,7 +326,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
)
)
}
publisherInitializationsVerified.push(publisherKey)
publisherInPriceStoreInitializationsVerified.push(publisherKey)
}
}
const { prev, new: newChanges } = dataChanges[symbol]
Expand Down Expand Up @@ -406,7 +411,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
})
.instruction()
)
await initPublisher(publisherPubKey)
await initPublisherInPriceStore(publisherPubKey)
}

// create set min publisher instruction if there are any publishers
Expand Down Expand Up @@ -576,7 +581,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
})
.instruction()
)
await initPublisher(publisherPubKey)
await initPublisherInPriceStore(publisherPubKey)
}
}
}
Expand Down
Loading