diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ff5897..2ba3e50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v5.0.14 + +### Feat: + + - Expose withdraw stake account method from program + ## v5.0.13 ### Fix: diff --git a/package.json b/package.json index 1e7fd42..f6b1d28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@marinade.finance/marinade-ts-sdk", - "version": "5.0.13", + "version": "5.0.14", "description": "Marinade SDK for Typescript", "main": "dist/src/index.js", "repository": { diff --git a/src/programs/marinade-finance-program.ts b/src/programs/marinade-finance-program.ts index 1aa5905..74d2bbc 100644 --- a/src/programs/marinade-finance-program.ts +++ b/src/programs/marinade-finance-program.ts @@ -282,4 +282,50 @@ export class MarinadeFinanceProgram { tokenProgram: TOKEN_PROGRAM_ID, }) .instruction() + + withdrawStakeAccountInstructionBuilder = async ({ + marinadeState, + ownerAddress, + associatedMSolTokenAccountAddress, // burnMsolFrom + stakeAccountAddress, + splitStakeAccountAddress, + splitStakeRentPayer, + stakeIndex, + validatorIndex, + msolAmount, + beneficiary, + }: { + marinadeState: MarinadeState + ownerAddress: web3.PublicKey + associatedMSolTokenAccountAddress: web3.PublicKey + stakeAccountAddress: web3.PublicKey + splitStakeAccountAddress: web3.PublicKey + splitStakeRentPayer: web3.PublicKey + stakeIndex: number + validatorIndex: number + msolAmount: BN + beneficiary: web3.PublicKey + }): Promise => + await this.program.methods + .withdrawStakeAccount(stakeIndex, validatorIndex, msolAmount, beneficiary) + .accountsStrict({ + state: marinadeState.marinadeStateAddress, + msolMint: marinadeState.mSolMintAddress, + burnMsolFrom: associatedMSolTokenAccountAddress, + burnMsolAuthority: ownerAddress, + treasuryMsolAccount: marinadeState.treasuryMsolAccount, + validatorList: + marinadeState.state.validatorSystem.validatorList.account, + stakeList: marinadeState.state.stakeSystem.stakeList.account, + stakeWithdrawAuthority: await marinadeState.stakeWithdrawAuthority(), + stakeDepositAuthority: await marinadeState.stakeDepositAuthority(), + stakeAccount: stakeAccountAddress, + splitStakeAccount: splitStakeAccountAddress, + splitStakeRentPayer, + clock: web3.SYSVAR_CLOCK_PUBKEY, + systemProgram: SYSTEM_PROGRAM_ID, + tokenProgram: TOKEN_PROGRAM_ID, + stakeProgram: STAKE_PROGRAM_ID, + }) + .instruction() }