Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
angleapihelper private method
Browse files Browse the repository at this point in the history
  • Loading branch information
teddav committed Jul 9, 2022
1 parent 08b971e commit 26351a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Network } from '~types/network.interface';

import { ANGLE_DEFINITION } from '../angle.definition';
import { AngleContractFactory, AngleVeangle, AngleSantoken } from '../contracts';
import { AngleApiHelper } from '../helpers/angle.api';

const appId = ANGLE_DEFINITION.id;
const groupId = ANGLE_DEFINITION.groups.veangle.id;
Expand All @@ -20,8 +19,6 @@ export class EthereumAngleVeAngleContractPositionFetcher implements PositionFetc
constructor(
@Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit,
@Inject(AngleContractFactory) private readonly angleContractFactory: AngleContractFactory,
@Inject(AngleApiHelper)
private readonly angleApiHelper: AngleApiHelper,
@Inject(CurveVotingEscrowContractPositionHelper)
private readonly curveVotingEscrowContractPositionHelper: CurveVotingEscrowContractPositionHelper,
) {}
Expand Down
12 changes: 6 additions & 6 deletions src/apps/angle/helpers/angle.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ type TVault = {
export class AngleApiHelper {
constructor(@Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit) {}

async #callAngleApi<T>(endpoint: string, params?: Record<string, any>): Promise<T> {
private async callAngleApi<T>(endpoint: string, params?: Record<string, any>): Promise<T> {
let url = `${BASE_URL}/${endpoint}`;
if (params) {
url += `?${querystring.stringify(params)}`;
Expand All @@ -108,7 +108,7 @@ export class AngleApiHelper {
ttl: 15 * 60,
})
async getApr() {
return this.#callAngleApi<Record<string, TAPR>>('apr');
return this.callAngleApi<Record<string, TAPR>>('apr');
}

@Cache({
Expand All @@ -117,7 +117,7 @@ export class AngleApiHelper {
ttl: 15 * 60,
})
async getVaultManagers() {
return this.#callAngleApi<Record<string, TVaultManager>>('vaultManagers', { chainId: 1 });
return this.callAngleApi<Record<string, TVaultManager>>('vaultManagers', { chainId: 1 });
}

@Cache({
Expand All @@ -126,7 +126,7 @@ export class AngleApiHelper {
ttl: 15 * 60,
})
async getUserPerpetuals(address: string) {
return this.#callAngleApi<{ perpetuals: TPerpetual[] }>('perpetuals', {
return this.callAngleApi<{ perpetuals: TPerpetual[] }>('perpetuals', {
chainId: 1,
user: address,
});
Expand All @@ -138,7 +138,7 @@ export class AngleApiHelper {
ttl: 15 * 60,
})
async getUserVaults(address: string) {
return this.#callAngleApi<Record<string, TVault>>('vaults', {
return this.callAngleApi<Record<string, TVault>>('vaults', {
chainId: 1,
user: address,
});
Expand All @@ -150,7 +150,7 @@ export class AngleApiHelper {
ttl: 30 * 60,
})
async getRewardsData(address: string) {
return this.#callAngleApi<{ rewardsData: { totalClaimable: number } }>('dao', {
return this.callAngleApi<{ rewardsData: { totalClaimable: number } }>('dao', {
chainId: 1,
user: address,
});
Expand Down

0 comments on commit 26351a2

Please sign in to comment.