From 2424bc83cb114def8daf49321479e65a54fa71f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Brzezi=C5=84ski?= Date: Wed, 23 Aug 2023 10:31:57 +0200 Subject: [PATCH] fix vsr create token owner reocrd during grant, withdraw (#1789) --- VoteStakeRegistry/components/instructions/Grant.tsx | 5 ++--- VoteStakeRegistry/sdk/withCreateNewDeposit.ts | 2 +- VoteStakeRegistry/sdk/withVoteRegistryWithdraw.ts | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/VoteStakeRegistry/components/instructions/Grant.tsx b/VoteStakeRegistry/components/instructions/Grant.tsx index 5098900b69..cb93d0fd46 100644 --- a/VoteStakeRegistry/components/instructions/Grant.tsx +++ b/VoteStakeRegistry/components/instructions/Grant.tsx @@ -160,7 +160,6 @@ const Grant = ({ form.amount!, form.governedTokenAccount.extensions.mint.account.decimals ) - //const currentTokenOwnerRecord = tokenRecords[form.destinationAccount] const destinationTokenOwnerRecordPk = await getTokenOwnerRecordAddress( realm.owner, @@ -168,7 +167,7 @@ const Grant = ({ realm.account.communityMint, destinationAccount ) - const currentTokenOwnerRecord = queryClient.fetchQuery({ + const currentTokenOwnerRecord = await queryClient.fetchQuery({ queryKey: tokenOwnerRecordQueryKeys.byPubkey( connection.cluster, destinationTokenOwnerRecordPk @@ -180,7 +179,7 @@ const Grant = ({ ), }) - if (!currentTokenOwnerRecord) { + if (!currentTokenOwnerRecord.found) { await withCreateTokenOwnerRecord( prerequisiteInstructions, realm!.owner, diff --git a/VoteStakeRegistry/sdk/withCreateNewDeposit.ts b/VoteStakeRegistry/sdk/withCreateNewDeposit.ts index 3eb8f89402..d1e747908a 100644 --- a/VoteStakeRegistry/sdk/withCreateNewDeposit.ts +++ b/VoteStakeRegistry/sdk/withCreateNewDeposit.ts @@ -88,7 +88,7 @@ export const withCreateNewDeposit = async ({ programVersion, realmPk, walletPk, - mintPk, + communityMintPk, walletPk ) } diff --git a/VoteStakeRegistry/sdk/withVoteRegistryWithdraw.ts b/VoteStakeRegistry/sdk/withVoteRegistryWithdraw.ts index fbf659753f..1b41f3838f 100644 --- a/VoteStakeRegistry/sdk/withVoteRegistryWithdraw.ts +++ b/VoteStakeRegistry/sdk/withVoteRegistryWithdraw.ts @@ -97,7 +97,7 @@ export const withVoteRegistryWithdraw = async ({ splProgramVersion, realmPk, walletPk, - mintPk, + communityMintPk, walletPk ) }