-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Teddy Ding <[email protected]>
- Loading branch information
1 parent
d9ce4d9
commit 62044d0
Showing
7 changed files
with
656 additions
and
161 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.lcd.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { LCDClient } from "@osmonauts/lcd"; | ||
import { AffiliateInfoRequest, AffiliateInfoResponseSDKType, ReferredByRequest, ReferredByResponseSDKType, AllAffiliateTiersRequest, AllAffiliateTiersResponseSDKType, AffiliateWhitelistRequest, AffiliateWhitelistResponseSDKType } from "./query"; | ||
export class LCDQueryClient { | ||
req: LCDClient; | ||
|
||
constructor({ | ||
requestClient | ||
}: { | ||
requestClient: LCDClient; | ||
}) { | ||
this.req = requestClient; | ||
this.affiliateInfo = this.affiliateInfo.bind(this); | ||
this.referredBy = this.referredBy.bind(this); | ||
this.allAffiliateTiers = this.allAffiliateTiers.bind(this); | ||
this.affiliateWhitelist = this.affiliateWhitelist.bind(this); | ||
} | ||
/* Query AffiliateInfo returns the affiliate info for a given address. */ | ||
|
||
|
||
async affiliateInfo(params: AffiliateInfoRequest): Promise<AffiliateInfoResponseSDKType> { | ||
const endpoint = `dydxprotocol/affiliates/affiliate_info/${params.address}`; | ||
return await this.req.get<AffiliateInfoResponseSDKType>(endpoint); | ||
} | ||
/* Query ReferredBy returns the affiliate that referred a given address. */ | ||
|
||
|
||
async referredBy(params: ReferredByRequest): Promise<ReferredByResponseSDKType> { | ||
const endpoint = `dydxprotocol/affiliates/referred_by/${params.address}`; | ||
return await this.req.get<ReferredByResponseSDKType>(endpoint); | ||
} | ||
/* Query AllAffiliateTiers returns all affiliate tiers. */ | ||
|
||
|
||
async allAffiliateTiers(_params: AllAffiliateTiersRequest = {}): Promise<AllAffiliateTiersResponseSDKType> { | ||
const endpoint = `dydxprotocol/affiliates/all_affiliate_tiers`; | ||
return await this.req.get<AllAffiliateTiersResponseSDKType>(endpoint); | ||
} | ||
/* Query AffiliateWhitelist returns the affiliate whitelist. */ | ||
|
||
|
||
async affiliateWhitelist(_params: AffiliateWhitelistRequest = {}): Promise<AffiliateWhitelistResponseSDKType> { | ||
const endpoint = `dydxprotocol/affiliates/affiliate_whitelist`; | ||
return await this.req.get<AffiliateWhitelistResponseSDKType>(endpoint); | ||
} | ||
|
||
} |
Oops, something went wrong.