diff --git a/README.md b/README.md index dc3ddac6..c8a40d5e 100644 --- a/README.md +++ b/README.md @@ -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: @@ -272,7 +272,7 @@ type UserReward = { } type Output = { - days: Record | [] + days: Record } ``` diff --git a/src/methods/vault/requests/getUserRewards/index.ts b/src/methods/vault/requests/getUserRewards/index.ts index 06216d75..bd93ae94 100644 --- a/src/methods/vault/requests/getUserRewards/index.ts +++ b/src/methods/vault/requests/getUserRewards/index.ts @@ -9,8 +9,8 @@ type GetUserRewardsInput = { options: StakeWise.Options userAddress: UserRewardsQueryVariables['user'] vaultAddress: UserRewardsQueryVariables['vaultAddress'] - dateFrom: string - dateTo?: string + dateFrom: number + dateTo?: number fillGaps?: boolean } @@ -18,19 +18,19 @@ 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({ 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,