Update usePools.js
This commit is contained in:
5
packages/react-app/src/hooks/usePools.js
vendored
5
packages/react-app/src/hooks/usePools.js
vendored
@@ -3,10 +3,15 @@ import { useEffect, useState } from "react";
|
||||
import { useConfig } from "@usedapp/core";
|
||||
|
||||
import { ROUTER_ADDRESS } from "../config";
|
||||
import { getFactoryInfo, getRouterInfo } from "../utils";
|
||||
|
||||
export const loadPools = async (providerUrl) => { //fetch liquidity pool
|
||||
const provider = new Web3.providers.HttpProvider(providerUrl);
|
||||
const web3 = new Web3(provider);
|
||||
|
||||
const routerInfo = await getRouterInfo(ROUTER_ADDRESS, web3);
|
||||
const factoryInfo = await getFactoryInfo(routerInfo.factory, web3);
|
||||
return factoryInfo.pairsInfo;
|
||||
}
|
||||
export const usePools = () => {
|
||||
const { readOnlyChainId, readOnlyUrls } = useConfig();
|
||||
|
||||
Reference in New Issue
Block a user