Skip to content

Commit

Permalink
including types
Browse files Browse the repository at this point in the history
  • Loading branch information
poly-rodr committed Mar 22, 2024
1 parent fb811e0 commit 3c6fc35
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import {
MarketTradeEvent,
DropNotificationParams,
BookParams,
UserEarning,
RewardsPercentages,
CurrentReward,
MarketReward,
} from "./types";
import { createL1Headers, createL2Headers } from "./headers";
import {
Expand Down Expand Up @@ -662,7 +666,7 @@ export class ClobClient {
}

// Rewards
public async getEarningsForUserForDay(date: string): Promise<any> {
public async getEarningsForUserForDay(date: string): Promise<UserEarning[]> {
this.canL2Auth();

const endpoint = GET_EARNINGS_FOR_USER_FOR_DAY;
Expand All @@ -685,7 +689,7 @@ export class ClobClient {
return this.get(`${this.host}${endpoint}`, { headers, params: _params });
}

public async getLiquidityRewardPercentages(): Promise<any> {
public async getLiquidityRewardPercentages(): Promise<RewardsPercentages> {
this.canL2Auth();

const endpoint = GET_LIQUIDITY_REWARD_PERCENTAGES;
Expand All @@ -707,11 +711,11 @@ export class ClobClient {
return this.get(`${this.host}${endpoint}`, { headers, params: _params });
}

public async getCurrentRewards(): Promise<any> {
public async getCurrentRewards(): Promise<CurrentReward[]> {
return this.get(`${this.host}${GET_REWARDS_MARKETS_CURRENT}`);
}

public async getRawRewardsForMarket(conditionId: string): Promise<any> {
public async getRawRewardsForMarket(conditionId: string): Promise<MarketReward[]> {
return this.get(`${this.host}${GET_REWARDS_MARKETS}${conditionId}`);
}

Expand Down
32 changes: 32 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 3c6fc35

Please sign in to comment.