-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added supported chains endpoint in Census3
- Loading branch information
1 parent
d162ccb
commit b2bb670
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './census'; | ||
export * from './strategy'; | ||
export * from './service'; | ||
export * from './token'; | ||
export * from './errors'; |
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,35 @@ | ||
import axios from 'axios'; | ||
import { Census3API } from './api'; | ||
|
||
enum Census3ServiceAPIMethods { | ||
INFO = '/info', | ||
} | ||
|
||
export interface ICensus3ServiceInfoResponse { | ||
/** | ||
* The list of supported chains | ||
*/ | ||
chainIDs: Array<number>; | ||
} | ||
|
||
export abstract class Census3ServiceAPI extends Census3API { | ||
/** | ||
* Cannot be constructed. | ||
*/ | ||
private constructor() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Fetches supported chains from the service | ||
* | ||
* @param {string} url API endpoint URL | ||
* @returns {Promise<ICensus3ServiceInfoResponse>} | ||
*/ | ||
public static info(url: string): Promise<ICensus3ServiceInfoResponse> { | ||
return axios | ||
.get<ICensus3ServiceInfoResponse>(url + Census3ServiceAPIMethods.INFO) | ||
.then((response) => response.data) | ||
.catch(this.isApiError); | ||
} | ||
} |
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