hermes-v2-sdk
Version:
⚒️ An SDK for building applications on top of Hermes V2
58 lines (57 loc) • 2.9 kB
TypeScript
import { CurrencyAmount, NativeToken, Price } from 'maia-core-sdk';
import { ComposableStablePoolWrapper } from '../vault/ComposableStablePoolWrapper';
import { BalancerComposableStablePool } from './BalancerComposableStablePool';
export declare class ComposableStablePool {
readonly token0: NativeToken;
readonly token1: NativeToken;
readonly wrapper?: ComposableStablePoolWrapper;
readonly wrappedTokenIndex: number;
private _pool;
private _token0Price?;
private _token1Price?;
constructor(tokenA: NativeToken, tokenB: NativeToken, pool: BalancerComposableStablePool, wrapper?: ComposableStablePoolWrapper);
get pool(): BalancerComposableStablePool;
set pool(value: BalancerComposableStablePool);
/**
* Returns true if the token is either token0 or token1
* @param token The token to check
* @returns True if token is either token0 or token
*/
involvesToken(token: NativeToken): boolean;
/**
* Returns the current mid price of the pool in terms of token0, i.e. the ratio of token1 over token0
*/
get token0Price(): Price<NativeToken, NativeToken>;
/**
* Returns the current mid price of the pool in terms of token1, i.e. the ratio of token0 over token1
*/
get token1Price(): Price<NativeToken, NativeToken>;
private getTokenPrice;
/**
* Return the price of the given token in terms of the other token in the pool.
* @param token The token to return price of
* @returns The price of the given token, in terms of the other.
*/
priceOf(token: NativeToken): Price<NativeToken, NativeToken>;
/**
* Returns the chain ID of the tokens in the pair.
*/
get chainId(): number;
/**
* Given an input amount of a token, return the computed output amount, and a pool with state updated after the trade
* @param inputAmount The input amount for which to quote the output amount
* @returns The output amount and the pool with updated state
* @throws if token is not in the pool
*/
getOutputAmount(inputAmount: CurrencyAmount<NativeToken>): Promise<[CurrencyAmount<NativeToken>, ComposableStablePool]>;
/**
* Given an output amount of a token, return the computed input amount, and a pool with state updated after the trade
* @param _outputAmount The output amount for which to quote the input amount
* @param inputToken The token from which the input amount should correspond (defaults to BPT if not specified)
* @returns The input amount and the pool with updated state
* @throws if token is not in the pool
* @throws if inputToken is not in the pool
* @throws if token and inputToken are the same
*/
getInputAmount(_outputAmount: CurrencyAmount<NativeToken>): Promise<[CurrencyAmount<NativeToken>, ComposableStablePool]>;
}