Skip to content

Commit 17c4cb7

Browse files
authored
Merge pull request #142 from TosiDrop/GH-132-getpools-api
feat/server: /getpools API call
2 parents 1af99f1 + ce80722 commit 17c4cb7

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

client/src/entities/vm.entities.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,20 @@ export interface TokenInfo {
5353
visible: string,
5454
info: string
5555
}
56+
57+
export interface GetPools {
58+
[key: string]: PoolInfo;
59+
}
60+
61+
export interface PoolInfo {
62+
id: string,
63+
ticker: string,
64+
name: string,
65+
enabled: string,
66+
logo: string,
67+
last_delegator_refresh: string,
68+
loading_addr: string,
69+
description: string,
70+
visible: string,
71+
delegator_count: string
72+
}

server/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from "../client/src/entities/koios.entities";
1515
import {
1616
ClaimableToken,
17+
GetPools,
1718
GetRewards,
1819
GetTokens,
1920
SanitizeAddress,
@@ -120,10 +121,19 @@ async function postPoolInfo(pools: string[]) {
120121
return postFromKoios<PoolInfo[]>("pool_info", { _pool_bech32_ids: pools });
121122
}
122123

124+
async function getPools() {
125+
return getFromVM<GetPools>("get_pools");
126+
}
127+
123128
async function getTokens() {
124129
return getFromVM<GetTokens>("get_tokens");
125130
}
126131

132+
app.get("/getpools", async (req, res) => {
133+
const pools = await getPools();
134+
return res.status(200).send(pools);
135+
});
136+
127137
app.get("/getsettings", async (req, res) => {
128138
const settings = await getFromVM("get_settings");
129139
return res.status(200).send(settings);

0 commit comments

Comments
 (0)