Skip to main content
Version: V1

Fetcher

Fetcher (Abstract)#

Source Code

This is an abstract class, as it is meant to separate the data fetching logic from the rest of the code for better tree-shaking. This class contains static methods for constructing instances of pools and tokens from on-chain data.

Static Methods#

fetchTokenData#

Fetch information for a given token.

async fetchTokenData(
chainId: ChainId,
address: string,
provider = getDefaultProvider(getNetwork(chainId)),
symbol?: string,
name?: string
): Promise<Token>

fetchPairData#

Fetches information about pairs and constructs pairs array from the given two tokens.

async fetchPairData(
tokenA: Token,
tokenB: Token,
factoryAddress: string,
provider = getDefaultProvider(getNetwork(tokenA.chainId))
): Promise<Pair[]>

fetchPairAddresses#

Fetches information about pair addresses for the token pair.

async fetchPairAddresses(
tokenA: Token,
tokenB: Token,
factoryAddress: string,
provider = getDefaultProvider(getNetwork(tokenA.chainId))
): Promise<string[]>