File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { COINGECKO_API_BASE_URL , COINGECKO_API_URL_PARAMS } from "../constants"
2
+
3
+ export async function fetchEthereumEcosystemData ( ) {
4
+ const url = `${ COINGECKO_API_BASE_URL } ethereum-ecosystem${ COINGECKO_API_URL_PARAMS } `
5
+
6
+ try {
7
+ const ethereumEcosystemData = await fetch ( url ) . then ( ( res ) => res . json ( ) )
8
+
9
+ return ethereumEcosystemData
10
+ } catch ( error ) {
11
+ // In production mode, throw an error to stop the build in case this fetch fails
12
+ console . error ( error )
13
+ throw new Error (
14
+ "Something went wrong with requesting the Ethereum ecosystem data."
15
+ )
16
+ }
17
+ }
18
+
19
+ export async function fetchEthereumStablecoinsData ( ) {
20
+ const url = `${ COINGECKO_API_BASE_URL } stablecoins${ COINGECKO_API_URL_PARAMS } `
21
+
22
+ try {
23
+ const ethereumStablecoinsData = await fetch ( url ) . then ( ( res ) => res . json ( ) )
24
+
25
+ return ethereumStablecoinsData
26
+ } catch ( error ) {
27
+ // In production mode, throw an error to stop the build in case this fetch fails
28
+ console . error ( error )
29
+ throw new Error (
30
+ "Something went wrong with requesting the Ethereum ecosystem data."
31
+ )
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments