import { Options as RetryOptions } from "async-retry"; import { ChainId, Token } from "@onyxcoindev/sdk-core-test"; import { FeeAmount, Pool } from "@onyxcoindev/pool-sdk-test"; import { IMulticallProvider, Result } from "../multicall-provider"; import { ProviderConfig } from "../provider"; import { ISlot0, ILiquidity, PoolProvider } from "../pool-provider"; import { GasModelProviderConfig } from "../../routers"; type V3ISlot0 = ISlot0; type V3ILiquidity = ILiquidity; /** * Provider or getting V3 pools. * * @export * @interface IV3PoolProvider */ export interface IV3PoolProvider { /** * Gets the specified pools. * * @param tokenPairs The token pairs and fee amount of the pools to get. * @param [providerConfig] The provider config. * @returns A pool accessor with methods for accessing the pools. */ getPools(tokenPairs: V3PoolConstruct[], providerConfig?: ProviderConfig): Promise; /** * Gets the pool address for the specified token pair and fee tier. * * @param tokenA Token A in the pool. * @param tokenB Token B in the pool. * @param feeAmount The fee amount of the pool. * @returns The pool address and the two tokens. */ getPoolAddress(tokenA: Token, tokenB: Token, feeAmount: FeeAmount): { poolAddress: string; token0: Token; token1: Token; }; } export type V3PoolAccessor = { getPool: (tokenA: Token, tokenB: Token, feeAmount: FeeAmount) => Pool | undefined; getPoolByAddress: (address: string) => Pool | undefined; getAllPools: () => Pool[]; }; export type V3PoolRetryOptions = RetryOptions; export type V3PoolConstruct = [Token, Token, FeeAmount]; export declare class V3PoolProvider extends PoolProvider implements IV3PoolProvider { protected multicall2Provider: IMulticallProvider; protected retryOptions: V3PoolRetryOptions; private POOL_ADDRESS_CACHE; /** * Creates an instance of V3PoolProvider. * @param chainId The chain id to use. * @param multicall2Provider The multicall provider to use to get the pools. * @param retryOptions The retry options for each call to the multicall. */ constructor(chainId: ChainId, multicall2Provider: IMulticallProvider, retryOptions?: V3PoolRetryOptions); getPools(tokenPairs: V3PoolConstruct[], providerConfig?: ProviderConfig): Promise; getPoolAddress(tokenA: Token, tokenB: Token, feeAmount: FeeAmount): { poolAddress: string; token0: Token; token1: Token; }; protected getLiquidityFunctionName(): string; protected getSlot0FunctionName(): string; protected getPoolsData(poolAddresses: string[], functionName: string, providerConfig?: GasModelProviderConfig): Promise[]>; protected getPoolIdentifier(pool: V3PoolConstruct): { poolAddress: string; token0: Token; token1: Token; }; protected instantiatePool(pool: V3PoolConstruct, slot0: V3ISlot0, liquidity: V3ILiquidity): Pool; protected instantiatePoolAccessor(poolIdentifierToPool: { [p: string]: Pool; }): V3PoolAccessor; } export {};