Skip to content

Commit

Permalink
Merge pull request #6 from noumantahir/nt/wallet-api
Browse files Browse the repository at this point in the history
returning api response data
  • Loading branch information
feruzm authored Jul 26, 2024
2 parents eeb2d41 + 7d51f11 commit 9480fbb
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/server/handlers/wallet-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,25 @@ export const portfolio = async (req: express.Request, res: express.Response) =>
const accountData = getAccount(username);

//fetch market data
const marketData = apiRequest(`market-data/latest`, "GET");
const marketData = async () => {
const resp = await apiRequest(`market-data/latest`, "GET");
if(!resp.data){
throw new Error("failed to get market data");
}
return resp.data;
}

//fetch points data
const pointsData = apiRequest(`users/${username}`, "GET");
const pointsData = async () => {
const resp = await apiRequest(`users/${username}`, "GET");
if(!resp.data){
throw new Error("failed to get points data");
}
return resp.data;
}

//fetch engine assets
const engineData = fetchEngineTokensWithBalance(username)
const engineData = fetchEngineTokensWithBalance(username);

//fetch spk assets
const spkData = fetchSpkData(username);
Expand Down

0 comments on commit 9480fbb

Please sign in to comment.