Skip to content

Commit 0eb3044

Browse files
authored
reduce data load for Pyth (#213)
1 parent 34c2a42 commit 0eb3044

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

actions/castVote.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ export async function castVote(
239239
const castVoteIxs: TransactionInstruction[] = []
240240
const pluginCastVoteIxs: TransactionInstruction[] = []
241241

242-
if (calculatedVoterWeight !== null && calculatedVoterWeight.gtn(0)) {
242+
const isPyth = realm.owner.equals(new PublicKey('pytGY6tWRgGinSCvRLnSv4fHfBTMoiDGiCsesmHWM6U'))
243+
244+
if (isPyth || (calculatedVoterWeight !== null && calculatedVoterWeight.gtn(0))) {
243245
//will run only if any plugin is connected with realm
244246
const plugin = await votingPlugin?.withCastPluginVote(
245247
pluginCastVoteIxs,

hooks/useVoteRecords.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default function useVoteRecords(proposal?: ProgramAccount<Proposal>) {
4646

4747
const { vsrMode, isNftMode } = useRealm()
4848

49+
const isPyth = realm?.pubkey.equals(new PublicKey('pytGY6tWRgGinSCvRLnSv4fHfBTMoiDGiCsesmHWM6U'))
4950
//for vsr
5051
const [undecidedDepositByVoteRecord, setUndecidedDepositByVoteRecord] =
5152
useState<{ [walletPk: string]: BN }>({})
@@ -122,7 +123,7 @@ export default function useVoteRecords(proposal?: ProgramAccount<Proposal>) {
122123
///
123124

124125
useEffect(() => {
125-
if (context && proposal && realm) {
126+
if (context && proposal && realm && !isPyth) {
126127
// fetch vote records
127128
pipe(
128129
() =>

0 commit comments

Comments
 (0)