Skip to content

Instantly share code, notes, and snippets.

@dgabriele
Created December 9, 2021 17:42
Show Gist options
  • Save dgabriele/ed86d14f1b6292ead9d5d4ba949d632c to your computer and use it in GitHub Desktop.
Save dgabriele/ed86d14f1b6292ead9d5d4ba949d632c to your computer and use it in GitHub Desktop.
query builder for web3.js getParsedProgramAccounts
async getUserLikes(
userPubkey: PublicKey,
): Promise<Array<Account<UserVotingRecordAccountData>>> {
return await this.query(UserVotingRecordAccountData)
.match({
kind: 2,
user_pubkey: userPubkey,
choice: 1
})
.size(32 * 2 + 2)
.execute();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment