diff options
Diffstat (limited to 'packages/instant/src/util/coinbase_api.ts')
-rw-r--r-- | packages/instant/src/util/coinbase_api.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/instant/src/util/coinbase_api.ts b/packages/instant/src/util/coinbase_api.ts new file mode 100644 index 000000000..63c8077da --- /dev/null +++ b/packages/instant/src/util/coinbase_api.ts @@ -0,0 +1,8 @@ +const baseEndpoint = 'https://api.coinbase.com/v2'; +export const coinbaseApi = { + getEthUsdPrice: async (): Promise<string> => { + const res = await fetch(`${baseEndpoint}/prices/ETH-USD/buy`); + const resJson = await res.json(); + return resJson.data.amount; + }, +}; |