import { Base, BaseConstructorOptions, ChainProviders } from './Base.js'; import { BigNumber, BigNumberish } from 'ethers'; import { Chain } from '#chains/index.js'; import { TokenIndex } from './constants/index.js'; import { TAmount, TChain, TProvider } from './types.js'; import { TransactionResponse } from '@ethersproject/abstract-provider'; import { TokenSymbol } from '#tokens/index.js'; export type AmmConstructorOptions = { tokenSymbol?: TokenSymbol | string; chain?: TChain; } & BaseConstructorOptions; /** * Class representing AMM contract * @namespace AMM */ export declare class AMM extends Base { /** Chain model */ chain: Chain; /** Token class instance */ tokenSymbol: TokenSymbol | string; /** * @desc Instantiates AMM instance. * Returns a new Hop AMM SDK instance. * @param networkOrOptionsObject - L1 network name (e.g. 'mainnet', 'goerli') * @param tokenSymbol - Token model * @param chain - Chain model * @param signer - Ethers `Signer` for signing transactions. * @Returns Hop AMM instance * @example *```js *import { AMM, Chain } from '@hop-protocol/sdk' * *const amm = new AMM('mainnet', 'USDC', Chain.Gnosis) *``` */ constructor(networkOrOptionsObject: string | AmmConstructorOptions, tokenSymbol?: TokenSymbol | string, chain?: TChain, signer?: TProvider, chainProviders?: ChainProviders); /** * @desc Returns hop AMM instance with signer connected. Used for adding or changing signer. * @param signer - Ethers `Signer` for signing transactions. * @returns Hop AMM instance with connected signer. * @example *```js *import { AMM } from '@hop-protocol/sdk' * *const signer = new Wallet(privateKey) *let amm = new AMM(...) * // ... *amm = amm.connect(signer) *``` */ connect(signer: TProvider): AMM; /** * @desc Sends transaction to add liquidity to AMM. * @param amount0Desired - Amount of token #0 in smallest unit * @param amount1Desired - Amount of token #1 in smallest unit * @param minToMint - Minimum amount of LP token to mint in order for * transaction to be successful. * @param deadline - Order deadline in seconds * @returns Ethers transaction object. * @example *```js *import { AMM } from '@hop-protocol/sdk' * *const amm = new AMM(...) *const tx = await amm.addLiquidity('1000000000000000000', '1000000000000000000', '0') *console.log(tx.hash) *``` */ addLiquidity(amount0Desired: TAmount, amount1Desired: TAmount, minToMint?: TAmount, deadline?: BigNumberish): Promise; populateAddLiquidityTx(amount0Desired: TAmount, amount1Desired: TAmount, minToMint?: TAmount, deadline?: BigNumberish): Promise; /** * @desc Sends transaction to remove liquidity from AMM. * @param liquidityTokenAmount - Amount of LP tokens to burn. * @param amount0Min - Minimum amount of token #0 to receive in order * for transaction to be successful. * @param amount1Min - Minimum amount of token #1 to receive in order * for transaction to be successful. * transaction to be successful. * @param deadline - Order deadline in seconds * @returns Ethers transaction object. * @example *```js *import { AMM } from '@hop-protocol/sdk' * *const amm = new AMM(...) *const tx = await amm.removeLiquidity('1000000000000000000', '0', '0') *console.log(tx.hash) *``` */ removeLiquidity(liquidityTokenAmount: TAmount, amount0Min?: TAmount, amount1Min?: TAmount, deadline?: BigNumberish): Promise; populateRemoveLiquidityTx(liquidityTokenAmount: TAmount, amount0Min?: TAmount, amount1Min?: TAmount, deadline?: BigNumberish): Promise; removeLiquidityOneToken(lpAmount: TAmount, tokenIndex: number, amountMin?: TAmount, deadline?: BigNumberish): Promise; removeLiquidityImbalance(amount0: TAmount, amount1: TAmount, maxBurnAmount?: TAmount, deadline?: BigNumberish): Promise; calculateRemoveLiquidityOneToken(tokenAmount: TAmount, tokenIndex: number): Promise; calculateToHToken(amount: BigNumberish): Promise; calculateFromHToken(amount: BigNumberish): Promise; calculateAddLiquidityMinimum(amount0: TAmount, amount1: TAmount): Promise; calculateRemoveLiquidityMinimum(lpTokenAmount: TAmount): Promise; calculateRemoveLiquidityMinimumLpTokens(amount0: TAmount, amount1: TAmount): Promise; /** * @desc Returns the address of the L2 canonical token. * @returns address */ getCanonicalTokenAddress(): Promise; /** * @desc Returns the address of the L2 hop token. * @returns address */ getHopTokenAddress(): Promise; /** * @desc Returns the Saddle swap contract instance for the specified chain. * @returns Ethers contract instance. */ getSaddleSwap(): Promise; getSwapFee(): Promise; getYieldStatsForDay(unixTimestamp: number, days?: number, etherscanApiKey?: string): Promise; getDailyVolume(): Promise; getApr(days?: number): Promise; getApy(days?: number): Promise; getYieldData(days?: number, etherscanApiKey?: string): Promise; calcYield(feesEarned: number, principal: number, days: number): any; getVirtualPrice(): Promise; getPriceImpact(amount0: TAmount, amount1: TAmount): Promise; getRemoveLiquidityPriceImpact(amount0: TAmount, amount1: TAmount): Promise; calculateSwap: (fromIndex: TokenIndex, toIndex: TokenIndex, amount: BigNumberish) => Promise; /** * @readonly * @desc The default deadline to use in seconds. * @returns Deadline in seconds */ get defaultDeadlineSeconds(): number; /** * @desc Truncate any decimal places in deadline unix timestamp. * @param deadline - deadline timestamp * @returns Deadline in seconds */ private normalizeDeadline; isHighPriceImpact(priceImpact: BigNumber): boolean; private calculatePriceImpact; getReserves(): Promise; getReservesTotal(): Promise; calculateAmountsForLpToken(lpTokenAmount: TAmount): Promise; calculateTotalAmountForLpToken(lpTokenAmount: TAmount): Promise; } //# sourceMappingURL=AMM.d.ts.map