Skip to content

Commit

Permalink
Merge pull request #72 from marinade-finance/feat/expose-withdraw-sta…
Browse files Browse the repository at this point in the history
…ke-account-fee

feat: expose withdrawStakeAccountFee
  • Loading branch information
AlexStefan authored Nov 29, 2024
2 parents 8117e77 + a3df315 commit 8fa179b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
node-version: [16]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
version: 7
- name: Install, build and test
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v5.0.15

### Feat:

- Expose withdraw stake account fee value from program

## v5.0.14

### Feat:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@marinade.finance/marinade-ts-sdk",
"version": "5.0.14",
"version": "5.0.15",
"description": "Marinade SDK for Typescript",
"main": "dist/src/index.js",
"repository": {
Expand Down
6 changes: 6 additions & 0 deletions src/marinade-state/marinade-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,10 @@ export class MarinadeState {
*/
maxStakeMovedPerEpoch: number =
this.state.maxStakeMovedPerEpoch.basisPoints / 100

/**
* % Fee when withdrawing stake account
*/
withdrawStakeAccountFee: number =
this.state.withdrawStakeAccountFee.bpCents / 10000 / 100
}
6 changes: 5 additions & 1 deletion src/util/anchor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ export async function getParsedStakeAccountInfo(
)
}

if (!stakeAccountInfo.data || stakeAccountInfo.data instanceof Buffer) {
if (
!stakeAccountInfo.data ||
stakeAccountInfo.data instanceof Buffer ||
!('parsed' in stakeAccountInfo.data)
) {
throw new Error('Failed to parse the stake account data')
}

Expand Down

0 comments on commit 8fa179b

Please sign in to comment.