Skip to content

Commit 62f6715

Browse files
committed
chore: add support to get networks
1 parent 61ff834 commit 62f6715

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Provider.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ export class Provider {
4848
return this.baseUrl;
4949
}
5050

51+
//** Returns the result from the officially hosted list of Blockcore supported chains. */
52+
public getNetworks<AxiosResponse>(): Promise<AxiosResponse | undefined> {
53+
return this.executeGet('https://chains.blockcore.net/CHAINS.json')
54+
}
55+
5156
public getSupply<AxiosResponse>(): Promise<AxiosResponse | undefined> {
5257
return this.executeGet(this.baseUrl + "/api/insight/supply")
5358
}

test/Provider.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ describe("Provider test suit", () => {
3636
// return expect(provider.getAddress(getSupplyMock)).resolves.toMatchObject(someResponse);
3737
// })
3838

39+
it('should get networks', async () => {
40+
let result: any = await provider.getNetworks();
41+
expect(result.data[0].symbol).toMatch('BTC');
42+
})
43+
3944
it('should get correct network url', async () => {
4045
let result = await provider.getNetworkUrl('CITY');
4146
expect(result).toMatch('https://city.indexer.blockcore.net');

0 commit comments

Comments
 (0)