Skip to content

Commit faceacf

Browse files
committed
[total-rewards] add new output to getStakeBalance
1 parent e3122f3 commit faceacf

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

changelog/next-release.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# New
2+
---
3+
4+
# Updates
5+
### 1. [sdk.vault.getStakeBalance](https://sdk.stakewise.io/vault/requests/getstakebalance)
6+
7+
#### New output:
8+
9+
```ts
10+
type Output = {
11+
assets: bigint
12+
totalEarnedAssets: bigint
13+
}
14+
```
15+
| Name | Description |
16+
|---------------------|-------------------------|
17+
| `assets` | Balance in ETH |
18+
| `totalEarnedAssets` | Total earned rewards |

src/graphql/subgraph/allocator/allocatorsQuery.graphql

+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ query Allocators($address: Bytes!, $vaultAddress: String!) {
66
}
77
) {
88
assets
9+
totalEarnedAssets
910
}
1011
}

src/methods/vault/requests/getStakeBalance/getStakeBalance.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ Getting user's balance in the vault
1818

1919
```ts
2020
type Output = {
21-
shares: bigint
2221
assets: bigint
22+
totalEarnedAssets: bigint
2323
}
2424
```
2525
26-
| Name | Description |
27-
|----------|-------------------------|
28-
| `assets` | Balance in ETH |
26+
| Name | Description |
27+
|---------------------|-------------------------|
28+
| `assets` | Balance in ETH |
29+
| `totalEarnedAssets` | Total earned rewards |
2930
3031
#### Example:
3132

src/methods/vault/requests/getStakeBalance/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const getStakeBalance = (values: GetStakeBalanceInput) => {
2222
},
2323
modifyResult: (data) => ({
2424
assets: BigInt(data?.allocators?.[0]?.assets || 0),
25+
totalEarnedAssets: BigInt(data?.allocators?.[0]?.totalEarnedAssets || 0),
2526
}),
2627
})
2728
}

0 commit comments

Comments
 (0)