@sega-so/sega-sdk
Version:
An SDK for building applications on top of SEGA.
43 lines (40 loc) • 1.47 kB
text/typescript
import { PublicKey } from '@solana/web3.js';
import BN__default from 'bn.js';
import { ApiV3Token } from '../../../api/type.mjs';
declare enum RoundDirection {
Floor = 0,
Ceiling = 1
}
type SwapWithoutFeesResult = {
destinationAmountSwapped: BN__default;
};
type TradingTokenResult = {
tokenAmount0: BN__default;
tokenAmount1: BN__default;
};
type SwapResult = {
newSwapDestinationAmount: BN__default;
sourceAmountSwapped: BN__default;
destinationAmountSwapped: BN__default;
tradeFee: BN__default;
};
declare class CurveCalculator {
static validate_supply(tokenAmount0: BN__default, tokenAmount1: BN__default): void;
static swap(sourceAmount: BN__default, swapSourceAmount: BN__default, swapDestinationAmount: BN__default, tradeFeeRate: BN__default): SwapResult;
static swapBaseOut({ poolMintA, poolMintB, tradeFeeRate, baseReserve, quoteReserve, outputMint, outputAmount, }: {
poolMintA: ApiV3Token;
poolMintB: ApiV3Token;
tradeFeeRate: BN__default;
baseReserve: BN__default;
quoteReserve: BN__default;
outputMint: string | PublicKey;
outputAmount: BN__default;
}): {
amountRealOut: BN__default;
amountIn: BN__default;
amountInWithoutFee: BN__default;
tradeFee: BN__default;
priceImpact: number;
};
}
export { CurveCalculator, RoundDirection, type SwapResult, type SwapWithoutFeesResult, type TradingTokenResult };