@@ -7,7 +7,7 @@ import { ADDRESSES } from '../globals';
77import {
88 EthereumStakeOptions ,
99 EthereumTx ,
10- EthNetworkStats ,
10+ EthNetworkStats , EthRewards ,
1111 EthStakes , EthTxStatus ,
1212 InternalEthereumConfig ,
1313 ValidationKeyDepositData ,
@@ -193,7 +193,7 @@ export class EthService extends Service {
193193 * @param accountIds: account ids of which you wish to retrieve rewards
194194 * @returns {EthStakes } Ethereum Stakes
195195 */
196- async getAccountsRewards (
196+ async getStakesByAccounts (
197197 accountIds : string [ ] ,
198198 ) : Promise < EthStakes > {
199199 const { data } = await api . get < EthStakes > (
@@ -202,11 +202,11 @@ export class EthService extends Service {
202202 }
203203
204204 /**
205- * Retrieve stakes made with given wallets
205+ * Retrieve stakes of given wallets
206206 * @param walletAddresses addresses of the wallets of which you wish to retrieve rewards
207207 * @returns {EthStakes } Ethereum Stakes
208208 */
209- async getWalletsRewards (
209+ async getStakesByWallets (
210210 walletAddresses : string [ ] ,
211211 ) : Promise < EthStakes > {
212212 const { data } = await api . get < EthStakes > (
@@ -216,17 +216,74 @@ export class EthService extends Service {
216216 }
217217
218218 /**
219- * Retrieve stake on given validators
219+ * Retrieve stake on given validator addresses
220220 * @param validatorAddresses validator addresses of which you wish to retrieve rewards
221221 * @returns {EthStakes } Ethereum Stakes
222222 */
223- async getStakesRewards ( validatorAddresses : string [ ] ) : Promise < EthStakes > {
223+ async getStakesByValidators ( validatorAddresses : string [ ] ) : Promise < EthStakes > {
224224 const { data } = await api . get < EthStakes > (
225225 `/v1/eth/stakes?validators=${ validatorAddresses . join ( ',' ) } ` ,
226226 ) ;
227227 return data ;
228228 }
229229
230+ /**
231+ * Retrieve rewards of given kiln accounts
232+ * @param accountIds: account ids of which you wish to retrieve rewards
233+ * @param startDay: optional date YYYY-MM-DD from which you wish to retrieve rewards
234+ * @param endDay: optional date YYYY-MM-DD until you wish to retrieve rewards
235+ * @returns {EthRewards } Ethereum rewards
236+ */
237+ async getRewardsByAccounts (
238+ accountIds : string [ ] ,
239+ startDay ?: string ,
240+ endDay ?: string ,
241+ ) : Promise < EthRewards > {
242+ const query = `/v1/eth/rewards?accounts=${ accountIds . join ( ',' ) } ${
243+ startDay ? `&start_day=${ startDay } ` : ''
244+ } ${ endDay ? `&end_day=${ endDay } ` : '' } `;
245+ const { data } = await api . get < EthRewards > ( query ) ;
246+ return data ;
247+ }
248+
249+ /**
250+ * Retrieve stakes of given wallets
251+ * @param walletAddresses addresses of the wallets of which you wish to retrieve rewards
252+ * @param startDay: optional date YYYY-MM-DD from which you wish to retrieve rewards
253+ * @param endDay: optional date YYYY-MM-DD until you wish to retrieve rewards
254+ * @returns {EthRewards } Ethereum rewards
255+ */
256+ async getRewardsByWallets (
257+ walletAddresses : string [ ] ,
258+ startDay ?: string ,
259+ endDay ?: string ,
260+ ) : Promise < EthRewards > {
261+ const query = `/v1/eth/rewards?wallets=${ walletAddresses . join ( ',' ) } ${
262+ startDay ? `&start_day=${ startDay } ` : ''
263+ } ${ endDay ? `&end_day=${ endDay } ` : '' } `;
264+ const { data } = await api . get < EthRewards > ( query ) ;
265+ return data ;
266+ }
267+
268+ /**
269+ * Retrieve stake on given validator addresses
270+ * @param validatorAddresses validator addresses of which you wish to retrieve rewards
271+ * @param startDay: optional date YYYY-MM-DD from which you wish to retrieve rewards
272+ * @param endDay: optional date YYYY-MM-DD until you wish to retrieve rewards
273+ * @returns {EthRewards } Ethereum rewards
274+ */
275+ async getRewardsByValidators (
276+ validatorAddresses : string [ ] ,
277+ startDay ?: string ,
278+ endDay ?: string ,
279+ ) : Promise < EthRewards > {
280+ const query = `/v1/eth/rewards?validators=${ validatorAddresses . join ( ',' ) } ${
281+ startDay ? `&start_day=${ startDay } ` : ''
282+ } ${ endDay ? `&end_day=${ endDay } ` : '' } `;
283+ const { data } = await api . get < EthRewards > ( query ) ;
284+ return data ;
285+ }
286+
230287 /**
231288 * Retrieve ETH network stats
232289 */
0 commit comments