Skip to content

Commit

Permalink
Create council proposal for new wallet if inactive VWR (#17)
Browse files Browse the repository at this point in the history
* Create council proposal for new wallet if inactive VWR

* fix errors
  • Loading branch information
0xShuk authored Oct 24, 2024
1 parent 21cd1bd commit 43fdb35
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions hub/components/NewWallet/useNewWalletTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ const useNewWalletCallback = (
if (!wallet?.publicKey) throw new Error('not signed in');
if (tokenOwnerRecord === undefined)
throw new Error('insufficient voting power');
if (!voterWeightPk)
throw new Error('voterWeightPk not found for current wallet');

const config = await rules2governanceConfig(
connection.current,
Expand All @@ -63,14 +61,16 @@ const useNewWalletCallback = (

const instructions: TransactionInstruction[] = [];
const createNftTicketsIxs: TransactionInstruction[] = [];

const { pre: preIx, post: postIx } = await updateVoterWeightRecords(
wallet.publicKey,
convertTypeToVoterWeightAction('createGovernance'),
);
instructions.push(...preIx);
createNftTicketsIxs.push(...postIx);


if (voterWeightPk) {
const { pre: preIx, post: postIx } = await updateVoterWeightRecords(
wallet.publicKey,
convertTypeToVoterWeightAction('createGovernance'),
);
instructions.push(...preIx);
createNftTicketsIxs.push(...postIx);
}

const governanceAddress = await withCreateGovernance(
instructions,
realm.owner,
Expand All @@ -81,7 +81,7 @@ const useNewWalletCallback = (
tokenOwnerRecord.pubkey,
wallet.publicKey,
wallet.publicKey,
voterWeightPk,
voterWeightPk ?? undefined,
);
await withCreateNativeTreasury(
instructions,
Expand Down

0 comments on commit 43fdb35

Please sign in to comment.