Skip to content

Commit

Permalink
[vault-test]: improves PR
Browse files Browse the repository at this point in the history
  • Loading branch information
dfkadyr committed Jan 18, 2024
1 parent 81c174f commit c3e018f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Daily rewards for the user who has made a deposit in the vault. With the help of
| userAddress | `string` | **Require** | - |
| dateFrom | `number` | **Require** | Time to start |
| dateTo | `number` | **Optional** | Time to end |
| fillGaps | `boolean` | **Optional** | To fill in all the days, or not |
| fillGaps | `boolean` | **Optional** | Fill in the empty days with zeros |
#### Returns:
Expand All @@ -272,7 +272,7 @@ type UserReward = {
}

type Output = {
days: Record<number, UserReward> | []
days: Record<number, UserReward>
}
```
Expand Down
12 changes: 6 additions & 6 deletions src/methods/vault/requests/getUserRewards/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ type GetUserRewardsInput = {
options: StakeWise.Options
userAddress: UserRewardsQueryVariables['user']
vaultAddress: UserRewardsQueryVariables['vaultAddress']
dateFrom: string
dateTo?: string
dateFrom: number
dateTo?: number
fillGaps?: boolean
}

const getUserRewards = async (input: GetUserRewardsInput) => {
const { options, vaultAddress, userAddress, dateFrom, dateTo, fillGaps } = input

validateArgs.address({ vaultAddress, userAddress })
validateArgs.string({ dateFrom })
validateArgs.number({ dateFrom })

if (dateTo) {
validateArgs.string({ dateTo })
validateArgs.number({ dateTo })
}

const data = await graphql.backend.vault.fetchUserRewardsQuery<ModifyUserReward>({
url: apiUrls.getBackendUrl(options),
variables: {
dateTo,
dateFrom,
fillGaps,
dateFrom: String(dateFrom),
user: userAddress.toLowerCase(),
dateTo: dateTo ? String(dateTo) : undefined,
vaultAddress: vaultAddress.toLowerCase(),
} as UserRewardsQueryVariables,
modifyResult: modifyUserRewards,
Expand Down

0 comments on commit c3e018f

Please sign in to comment.