Skip to content

Commit

Permalink
chore: check connection, explicitly connect if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
bvotteler committed Nov 21, 2023
1 parent a24b33c commit 9a3dbdd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/tvl_dex.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const tvlDex = async (request, response) => {
if (request.method === 'GET') {
const interbtcApi = await createInterBtcApi(process.env.REACT_APP_RELAY_CHAIN_URL, process.env.REACT_APP_BITCOIN_NETWORK);

if (!interbtcApi.api.isConnected) {
await interbtcApi.api.connect();
}

const pools = await interbtcApi.amm.getLiquidityPools();
const currencies = pools.flatMap((pool) => pool.pooledCurrencies);

Expand Down

0 comments on commit 9a3dbdd

Please sign in to comment.