@pangolindex/sdk
Advanced tools
Comparing version 2.1.11 to 3.0.0
export * from './token'; | ||
export * from './pair'; | ||
export * from './route'; | ||
@@ -7,1 +6,2 @@ export * from './trade'; | ||
export * from './fractions'; | ||
export * from './pools'; |
import { ChainId } from '../chains'; | ||
import { Currency } from './currency'; | ||
import { Token } from './token'; | ||
import { Pair } from './pair'; | ||
import { Pool } from './pools/pool'; | ||
import { Price } from './fractions/price'; | ||
export declare class Route { | ||
readonly pairs: Pair[]; | ||
readonly pools: Pool[]; | ||
readonly path: Token[]; | ||
@@ -12,4 +12,4 @@ readonly input: Currency; | ||
readonly midPrice: Price; | ||
constructor(pairs: Pair[], input: Currency, output?: Currency); | ||
constructor(pools: Pool[], input: Currency, output: Currency, hops?: Token[]); | ||
get chainId(): ChainId; | ||
} |
@@ -7,4 +7,5 @@ import { ChainId } from '..'; | ||
import { Price } from './fractions/price'; | ||
import { Pair } from './pair'; | ||
import { Pool } from './pools'; | ||
import { Route } from './route'; | ||
import { Token } from './token'; | ||
interface InputOutput { | ||
@@ -25,3 +26,3 @@ readonly inputAmount: CurrencyAmount; | ||
/** | ||
* Represents a trade executed against a list of pairs. | ||
* Represents a trade executed against a list of pools. | ||
* Does not account for slippage, i.e. trades that front run this trade and move the price. | ||
@@ -31,3 +32,3 @@ */ | ||
/** | ||
* The route of the trade, i.e. which pairs the trade goes through. | ||
* The route of the trade, i.e. which pools the trade goes through. | ||
*/ | ||
@@ -90,37 +91,39 @@ readonly route: Route; | ||
/** | ||
* Given a list of pairs, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token | ||
* Given a list of pools, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token | ||
* amount to an output token, making at most `maxHops` hops. | ||
* Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting | ||
* the amount in among multiple routes. | ||
* @param pairs the pairs to consider in finding the best trade | ||
* @param pools the pools to consider in finding the best trade | ||
* @param currencyAmountIn exact amount of input currency to spend | ||
* @param currencyOut the desired currency out | ||
* @param maxNumResults maximum number of results to return | ||
* @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair | ||
* @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pool | ||
* @param fee total fee possibly imposed via DEX as a service | ||
* @param feeTo possible DEX as a service partner | ||
* @param currentPairs used in recursion; the current list of pairs | ||
* @param currentPools used in recursion; the current list of pools | ||
* @param currentHops used in recursion; the current list of intermediate hops for pools with 3+ assets | ||
* @param originalAmountIn used in recursion; the original value of the currencyAmountIn parameter | ||
* @param bestTrades used in recursion; the current list of best trades | ||
*/ | ||
static bestTradeExactIn(pairs: Pair[], currencyAmountIn: CurrencyAmount, currencyOut: Currency, { maxNumResults, maxHops }?: BestTradeOptions, { fee, feeTo }?: DaasOptions, currentPairs?: Pair[], originalAmountIn?: CurrencyAmount, bestTrades?: Trade[]): Trade[]; | ||
static bestTradeExactIn(pools: Pool[], currencyAmountIn: CurrencyAmount, currencyOut: Currency, { maxNumResults, maxHops }?: BestTradeOptions, { fee, feeTo }?: DaasOptions, currentPools?: Pool[], currentHops?: Token[], originalAmountIn?: CurrencyAmount, bestTrades?: Trade[]): Trade[]; | ||
/** | ||
* similar to the above method but instead targets a fixed output amount | ||
* given a list of pairs, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token | ||
* given a list of pools, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token | ||
* to an output token amount, making at most `maxHops` hops | ||
* note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting | ||
* the amount in among multiple routes. | ||
* @param pairs the pairs to consider in finding the best trade | ||
* @param pools the pools to consider in finding the best trade | ||
* @param currencyIn the currency to spend | ||
* @param currencyAmountOut the exact amount of currency out | ||
* @param maxNumResults maximum number of results to return | ||
* @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair | ||
* @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pool | ||
* @param fee total fee possibly imposed via DEX as a service | ||
* @param feeTo possible DEX as a service partner | ||
* @param currentPairs used in recursion; the current list of pairs | ||
* @param currentPools used in recursion; the current list of pools | ||
* @param currentHops used in recursion; the current list of intermediate hops for pools with 3+ assets | ||
* @param originalAmountOut used in recursion; the original value of the currencyAmountOut parameter | ||
* @param bestTrades used in recursion; the current list of best trades | ||
*/ | ||
static bestTradeExactOut(pairs: Pair[], currencyIn: Currency, currencyAmountOut: CurrencyAmount, { maxNumResults, maxHops }?: BestTradeOptions, { fee, feeTo }?: DaasOptions, currentPairs?: Pair[], originalAmountOut?: CurrencyAmount, bestTrades?: Trade[]): Trade[]; | ||
static bestTradeExactOut(pools: Pool[], currencyIn: Currency, currencyAmountOut: CurrencyAmount, { maxNumResults, maxHops }?: BestTradeOptions, { fee, feeTo }?: DaasOptions, currentPools?: Pool[], currentHops?: Token[], originalAmountOut?: CurrencyAmount, bestTrades?: Trade[]): Trade[]; | ||
} | ||
export {}; |
@@ -17,1 +17,8 @@ /** | ||
} | ||
/** | ||
* Indicates that the pool method is not supported for the particular implementation | ||
*/ | ||
export declare class MethodNotSupported extends Error { | ||
readonly isMethodNotSupportedError: true; | ||
constructor(); | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Pair } from './entities/pair'; | ||
import { Pair } from './entities/pools'; | ||
import { ChainId } from './chains'; | ||
@@ -3,0 +3,0 @@ import { Token } from './entities/token'; |
@@ -7,2 +7,3 @@ import JSBI from 'jsbi'; | ||
export declare function sqrt(y: JSBI): JSBI; | ||
export declare function abs(x: JSBI): JSBI; | ||
export declare function sortedInsert<T>(items: T[], add: T, maxSize: number, comparator: (a: T, b: T) => number): T | null; |
{ | ||
"name": "@pangolindex/sdk", | ||
"license": "MIT", | ||
"version": "2.1.11", | ||
"version": "3.0.0", | ||
"description": "🛠 An SDK for building applications on top of Pangolin.", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
985695
32
7350
1
78