diff --git a/programs/src/main/java/software/sava/anchor/programs/glam/GlamStakePoolProgramClientImpl.java b/programs/src/main/java/software/sava/anchor/programs/glam/GlamStakePoolProgramClientImpl.java index 827d619..2f9291e 100644 --- a/programs/src/main/java/software/sava/anchor/programs/glam/GlamStakePoolProgramClientImpl.java +++ b/programs/src/main/java/software/sava/anchor/programs/glam/GlamStakePoolProgramClientImpl.java @@ -8,6 +8,7 @@ import software.sava.rpc.json.http.response.AccountInfo; import software.sava.solana.programs.clients.NativeProgramAccountClient; import software.sava.solana.programs.stakepool.StakePoolAccounts; +import software.sava.solana.programs.stakepool.StakePoolProgram; import software.sava.solana.programs.stakepool.StakePoolProgramClient; import software.sava.solana.programs.stakepool.StakePoolState; @@ -114,24 +115,25 @@ public Instruction depositStakeWithSlippage(final AccountInfo st } @Override - public Instruction withdrawSol(final AccountInfo stakePoolStateAccountInfo, + public Instruction withdrawSol(final PublicKey stakePoolProgram, + final StakePoolState stakePoolState, final PublicKey poolTokenATA, final long poolTokenAmount) { - final var stakePoolState = stakePoolStateAccountInfo.data(); - final var stakePoolWithdrawAuthority = findStakePoolWithdrawAuthority(stakePoolStateAccountInfo); + final var stakePoolWithdrawAuthority = StakePoolProgram. + findStakePoolWithdrawAuthority(stakePoolState.address(), stakePoolProgram); return GlamProgram.stakePoolWithdrawSol( invokedProgram, solanaAccounts, manager.publicKey(), glamFundAccounts.fundPublicKey(), glamFundAccounts.treasuryPublicKey(), - stakePoolStateAccountInfo.owner(), stakePoolState.address(), stakePoolWithdrawAuthority.publicKey(), stakePoolState.reserveStake(), stakePoolState.poolMint(), stakePoolState.managerFeeAccount(), poolTokenATA, + stakePoolProgram, stakePoolState.tokenProgramId(), poolTokenAmount ); diff --git a/programs/src/main/java/software/sava/anchor/programs/marinade/MarinadeAccounts.java b/programs/src/main/java/software/sava/anchor/programs/marinade/MarinadeAccounts.java index 246446b..3dd95a1 100644 --- a/programs/src/main/java/software/sava/anchor/programs/marinade/MarinadeAccounts.java +++ b/programs/src/main/java/software/sava/anchor/programs/marinade/MarinadeAccounts.java @@ -1,11 +1,11 @@ package software.sava.anchor.programs.marinade; -import software.sava.core.accounts.meta.AccountMeta; import software.sava.core.accounts.PublicKey; +import software.sava.core.accounts.meta.AccountMeta; +import static software.sava.core.accounts.PublicKey.fromBase58Encoded; import static software.sava.core.accounts.meta.AccountMeta.createInvoked; import static software.sava.core.accounts.meta.AccountMeta.createWrite; -import static software.sava.core.accounts.PublicKey.fromBase58Encoded; public interface MarinadeAccounts { @@ -20,7 +20,8 @@ public interface MarinadeAccounts { "HZsepB79dnpvH6qfVgvMpS738EndHw3qSHo4Gv5WX1KA", "7GgPYjS5Dza89wV6FpZ23kUJRG5vbQ1GM25ezspYFSoE", "EyaSjUtSgo9aRD1f8LWXwdvkpDTmXAW54yoSHZRF14WL", - "UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q" + "UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q", + "DwFYJNnhLmw19FBTrVaLWZ8SZJpxdPoSYVSJaio9tjbY" ); PublicKey mSolTokenMint(); @@ -57,6 +58,8 @@ public interface MarinadeAccounts { PublicKey liquidityPoolSolLegAccount(); + PublicKey validatorListAccount(); + static MarinadeAccounts createAddressConstants( final PublicKey mSolTokenMint, final PublicKey mSolTokenMintAuthorityPDA, @@ -68,7 +71,8 @@ static MarinadeAccounts createAddressConstants( final PublicKey lpAuthPDA, final PublicKey mSolLegAccount, final PublicKey mSolLegAuthority, - final PublicKey solLegAccount) { + final PublicKey solLegAccount, + final PublicKey validatorListAccount) { return new MarinadeAccountsRecord( mSolTokenMint, mSolTokenMintAuthorityPDA, @@ -84,7 +88,8 @@ static MarinadeAccounts createAddressConstants( lpAuthPDA, mSolLegAccount, mSolLegAuthority, - solLegAccount + solLegAccount, + validatorListAccount ); } @@ -99,7 +104,8 @@ static MarinadeAccounts createAddressConstants( final String lpAuthPDA, final String mSolLegAccount, final String mSolLegAuthority, - final String solLegAccount) { + final String solLegAccount, + final String validatorListAccount) { return createAddressConstants( fromBase58Encoded(mSolTokenMint), fromBase58Encoded(mSolTokenMintAuthorityPDA), @@ -111,7 +117,8 @@ static MarinadeAccounts createAddressConstants( fromBase58Encoded(lpAuthPDA), fromBase58Encoded(mSolLegAccount), fromBase58Encoded(mSolLegAuthority), - fromBase58Encoded(solLegAccount) + fromBase58Encoded(solLegAccount), + fromBase58Encoded(validatorListAccount) ); } } diff --git a/programs/src/main/java/software/sava/anchor/programs/marinade/MarinadeAccountsRecord.java b/programs/src/main/java/software/sava/anchor/programs/marinade/MarinadeAccountsRecord.java index 14fc1a3..bc54da6 100644 --- a/programs/src/main/java/software/sava/anchor/programs/marinade/MarinadeAccountsRecord.java +++ b/programs/src/main/java/software/sava/anchor/programs/marinade/MarinadeAccountsRecord.java @@ -1,7 +1,7 @@ package software.sava.anchor.programs.marinade; -import software.sava.core.accounts.meta.AccountMeta; import software.sava.core.accounts.PublicKey; +import software.sava.core.accounts.meta.AccountMeta; record MarinadeAccountsRecord(PublicKey mSolTokenMint, PublicKey mSolTokenMintAuthorityPDA, @@ -19,5 +19,6 @@ record MarinadeAccountsRecord(PublicKey mSolTokenMint, PublicKey liquidityPoolAuthPDA, PublicKey liquidityPoolMSolLegAccount, PublicKey liquidityPoolMSolLegAuthority, - PublicKey liquidityPoolSolLegAccount) implements MarinadeAccounts { + PublicKey liquidityPoolSolLegAccount, + PublicKey validatorListAccount) implements MarinadeAccounts { } diff --git a/settings.gradle b/settings.gradle index d9dfef7..9774e38 100644 --- a/settings.gradle +++ b/settings.gradle @@ -25,7 +25,7 @@ dependencyResolutionManagement { } versionCatalogs { libs { - from("software.sava:solana-version-catalog:0.4.14") + from("software.sava:solana-version-catalog:0.4.19") } } } \ No newline at end of file