Skip to content

Commit 9e5dc77

Browse files
authored
fix: create token owner record on stake (#2033)
1 parent a65f121 commit 9e5dc77

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

governance/pyth_staking_sdk/src/pyth-staking-client.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,20 @@ export class PythStakingClient {
250250
stakeAccountPositions: PublicKey,
251251
amount: bigint,
252252
) {
253-
const instructions = [];
253+
const globalConfig = await this.getGlobalConfig();
254+
const instructions: TransactionInstruction[] = [];
255+
256+
if (!(await this.hasGovernanceRecord(globalConfig))) {
257+
await withCreateTokenOwnerRecord(
258+
instructions,
259+
GOVERNANCE_ADDRESS,
260+
PROGRAM_VERSION_V2,
261+
globalConfig.pythGovernanceRealm,
262+
this.wallet.publicKey,
263+
globalConfig.pythTokenMint,
264+
this.wallet.publicKey,
265+
);
266+
}
254267

255268
if (!(await this.hasJoinedDaoLlc(stakeAccountPositions))) {
256269
instructions.push(

0 commit comments

Comments
 (0)