Skip to content

Commit

Permalink
use getSignaturesForAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos committed Dec 4, 2024
1 parent 7e99d6f commit c6a78a6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,22 +508,6 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
)
}

// check if minPub has changed
if (
prev.priceAccounts[0].minPub !== newChanges.priceAccounts[0].minPub
) {
// create update product account instruction
instructions.push(
await pythProgramClient.methods
.setMinPub(newChanges.priceAccounts[0].minPub, [0, 0, 0])
.accounts({
priceAccount: new PublicKey(prev.priceAccounts[0].address),
fundingAccount,
})
.instruction()
)
}

// check if maxLatency has changed
if (
prev.priceAccounts[0].maxLatency !==
Expand Down Expand Up @@ -584,6 +568,22 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
)
await initPublisherInPriceStore(publisherPubKey)
}

// check if minPub has changed
if (
prev.priceAccounts[0].minPub !== newChanges.priceAccounts[0].minPub
) {
// create update product account instruction
instructions.push(
await pythProgramClient.methods
.setMinPub(newChanges.priceAccounts[0].minPub, [0, 0, 0])
.accounts({
priceAccount: new PublicKey(prev.priceAccounts[0].address),
fundingAccount,
})
.instruction()
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,13 @@ export const ProposalRow = ({

// set proposal time
if (!time) {
connection
.getConfirmedSignaturesForAddress2(proposal.publicKey)
.then((txs) => {
if (isCancelled) return
const firstBlockTime = txs?.[txs.length - 1]?.blockTime
if (firstBlockTime) {
setTime(new Date(firstBlockTime * 1000))
}
})
connection.getSignaturesForAddress(proposal.publicKey).then((txs) => {
if (isCancelled) return
const firstBlockTime = txs?.[txs.length - 1]?.blockTime
if (firstBlockTime) {
setTime(new Date(firstBlockTime * 1000))
}
})
}

// calculate instructions summary
Expand Down

0 comments on commit c6a78a6

Please sign in to comment.