Skip to content

Commit

Permalink
chore: try to force connection on creation
Browse files Browse the repository at this point in the history
  • Loading branch information
bvotteler committed Nov 21, 2023
1 parent 9a3dbdd commit 8df7c5b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions api/tvl_dex.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { createInterBtcApi } from "@interlay/interbtc-api";

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 interbtcApi = await createInterBtcApi(
process.env.REACT_APP_RELAY_CHAIN_URL,
process.env.REACT_APP_BITCOIN_NETWORK,
undefined,
3
);

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

0 comments on commit 8df7c5b

Please sign in to comment.