From 10350dee09a83036d2003a23418ad6bae7d5cd13 Mon Sep 17 00:00:00 2001 From: Sudeep Biswas Date: Tue, 9 Apr 2024 22:22:33 +0530 Subject: [PATCH] Add referral rewards data in tokens --- src/common/subgraphMapper.ts | 2 ++ src/interfaces/subgraphTypes.ts | 6 ++++++ src/subgraph/orders/subgraphQueries.ts | 2 ++ 3 files changed, 10 insertions(+) diff --git a/src/common/subgraphMapper.ts b/src/common/subgraphMapper.ts index d5b0c25..2ad1a3b 100644 --- a/src/common/subgraphMapper.ts +++ b/src/common/subgraphMapper.ts @@ -305,7 +305,9 @@ export const mapReferralDataToInterface = (response: any): Referral | undefined sizeInUsd: response.sizeInUsd, timestamp: response.timestamp, txHash: response.txHash, + rewardToken: response.rewardToken ? mapSubgraphResponseToTokenInterface(response.rewardToken) : undefined, referralRewardsInUsd: response.referralRewardsInUsd, + referralRewardsInToken: response.referralRewardsInToken, }; } catch (error) { console.log('Error while mapping data', error); diff --git a/src/interfaces/subgraphTypes.ts b/src/interfaces/subgraphTypes.ts index 808fca1..5f4395e 100644 --- a/src/interfaces/subgraphTypes.ts +++ b/src/interfaces/subgraphTypes.ts @@ -553,4 +553,10 @@ export interface Referral { // " Referral rewards in USD " referralRewardsInUsd?: string; + + // " ERC20 Token in which referral rewards are received " + rewardToken?: Token; + + // " Referral reward in reward token " + referralRewardsInToken?: string; } diff --git a/src/subgraph/orders/subgraphQueries.ts b/src/subgraph/orders/subgraphQueries.ts index b3f74a5..dac1342 100644 --- a/src/subgraph/orders/subgraphQueries.ts +++ b/src/subgraph/orders/subgraphQueries.ts @@ -154,7 +154,9 @@ export const fetchPartnerRewards = (partnerAddress: string, count: number = 20, sizeInUsd timestamp txHash + rewardToken { id symbol decimals } referralRewardsInUsd + referralRewardsInToken } } `;