From 3c6fc350bff47c7e89bc883f8874b75f195724cd Mon Sep 17 00:00:00 2001 From: Rodrigo <95635797+poly-rodr@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:04:22 -0300 Subject: [PATCH] including types --- src/client.ts | 12 ++++++++---- src/types.ts | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/client.ts b/src/client.ts index 3876676..1b99409 100644 --- a/src/client.ts +++ b/src/client.ts @@ -33,6 +33,10 @@ import { MarketTradeEvent, DropNotificationParams, BookParams, + UserEarning, + RewardsPercentages, + CurrentReward, + MarketReward, } from "./types"; import { createL1Headers, createL2Headers } from "./headers"; import { @@ -662,7 +666,7 @@ export class ClobClient { } // Rewards - public async getEarningsForUserForDay(date: string): Promise { + public async getEarningsForUserForDay(date: string): Promise { this.canL2Auth(); const endpoint = GET_EARNINGS_FOR_USER_FOR_DAY; @@ -685,7 +689,7 @@ export class ClobClient { return this.get(`${this.host}${endpoint}`, { headers, params: _params }); } - public async getLiquidityRewardPercentages(): Promise { + public async getLiquidityRewardPercentages(): Promise { this.canL2Auth(); const endpoint = GET_LIQUIDITY_REWARD_PERCENTAGES; @@ -707,11 +711,11 @@ export class ClobClient { return this.get(`${this.host}${endpoint}`, { headers, params: _params }); } - public async getCurrentRewards(): Promise { + public async getCurrentRewards(): Promise { return this.get(`${this.host}${GET_REWARDS_MARKETS_CURRENT}`); } - public async getRawRewardsForMarket(conditionId: string): Promise { + public async getRawRewardsForMarket(conditionId: string): Promise { return this.get(`${this.host}${GET_REWARDS_MARKETS}${conditionId}`); } diff --git a/src/types.ts b/src/types.ts index 0e9b8b3..0ebf4ba 100644 --- a/src/types.ts +++ b/src/types.ts @@ -390,3 +390,35 @@ export interface BookParams { token_id: string; side: Side; } + +export interface UserEarning { + date: string; + market: string; + asset_address: string; + maker_address: string; + earnings: number; +} + +export interface RewardsPercentages { + [market: string]: number; +} + +export interface CurrentReward { + market: string; + asset_address: string; + start_date: string; + end_date: string; + current_rewards_per_day: number; + total_reward_amount: number; + remaining_reward_amount: number; +} + +export interface MarketReward { + market: string; + asset_address: string; + start_date: string; + end_date: string; + rate_per_day: number; + total_rewards: number; + total_days: number; +}