@galacticcouncil/sdk 0.0.1-beta.10 → 0.0.1-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,8 +4,8 @@ export declare type RouterOptions = {
4
4
  };
5
5
  export declare class Router {
6
6
  private readonly routeSuggester;
7
- private readonly poolService;
8
7
  private readonly routerOptions;
8
+ protected readonly poolService: PoolService;
9
9
  private readonly defaultRouterOptions;
10
10
  /**
11
11
  * @param poolService - Fetch pool data from substrate based pools
@@ -27,47 +27,48 @@ export declare class Router {
27
27
  /**
28
28
  * Calculate and return list of all assets, given token can be trade with
29
29
  *
30
- * @param {string} token - Storage key of token
30
+ * @param {string} asset - Storage key of asset
31
31
  * @returns {PoolAsset[]} List of all available assets, given token can be trade with
32
32
  */
33
- getAssetPairs(token: string): Promise<PoolAsset[]>;
33
+ getAssetPairs(asset: string): Promise<PoolAsset[]>;
34
34
  /**
35
- * Calculate and return all possible paths for best swap tokenIn>tokenOut
35
+ * Calculate and return all possible paths for best swap assetIn>assetOut
36
36
  *
37
- * @param {string} tokenIn - Storage key of tokenIn
38
- * @param {string} tokenOut - Storage key of tokenOut
37
+ * @param {string} assetIn - Storage key of assetIn
38
+ * @param {string} assetOut - Storage key of assetOut
39
39
  * @returns {<Hop[][]>} All possible paths containing route hops
40
40
  */
41
- getAllPaths(tokenIn: string, tokenOut: string): Promise<Hop[][]>;
41
+ getAllPaths(assetIn: string, assetOut: string): Promise<Hop[][]>;
42
42
  /**
43
43
  * Return map of all available assets from substrate based pools
44
44
  *
45
+ * @param pools - pools
45
46
  * @returns Map of all available assets
46
47
  */
47
- protected getAssets(): Promise<Map<string, PoolAsset>>;
48
+ protected getAssets(pools: PoolBase[]): Promise<Map<string, PoolAsset>>;
48
49
  /**
49
- * Calculate and return all possible paths for best swap tokenIn>tokenOut
50
+ * Calculate and return all possible paths for best swap assetIn>assetOut
50
51
  *
51
- * @param tokenIn - Storage key of tokenIn
52
- * @param tokenOut - Storage key of tokenOut
52
+ * @param assetIn - Storage key of assetIn
53
+ * @param assetOut - Storage key of assetOut
53
54
  * @param poolsMap - pools map
54
55
  * @param pools - pools
55
56
  * @returns All possible paths containing route hops
56
57
  */
57
- protected getPaths(tokenIn: string, tokenOut: string | null, poolsMap: Map<string, Pool>, pools: PoolBase[]): Hop[][];
58
+ protected getPaths(assetIn: string, assetOut: string | null, poolsMap: Map<string, Pool>, pools: PoolBase[]): Hop[][];
58
59
  /**
59
60
  * Ckeck if input asset pair is valid and throw expection if not
60
61
  *
61
- * @param tokenIn - Storage key of tokenIn
62
- * @param tokenOut - Storage key of tokenOut
62
+ * @param assetIn - Storage key of assetIn
63
+ * @param assetOut - Storage key of assetOut
63
64
  * @returns Pool assets & map
64
65
  */
65
- protected validateTokenPair(tokenIn: string, tokenOut: string, pools: PoolBase[]): Promise<{
66
+ protected validateTokenPair(assetIn: string, assetOut: string, pools: PoolBase[]): Promise<{
66
67
  assets: Map<string, PoolAsset>;
67
68
  poolsMap: Map<string, Pool>;
68
69
  }>;
69
70
  /**
70
- * Ckeck if input asset is valid and throw expection if not
71
+ * Ckeck if input asset is valid and throw exception if not
71
72
  *
72
73
  * @param token - Storage key of token
73
74
  * @returns Pool assets & map
@@ -1,41 +1,57 @@
1
1
  import { Router } from './router';
2
- import { Trade } from '../types';
2
+ import { Trade, Amount } from '../types';
3
3
  import { BigNumber } from '../utils/bignumber';
4
4
  export declare class TradeRouter extends Router {
5
5
  /**
6
- * Calculate and return best possible sell trade for tokenIn>tokenOut
6
+ * Calculate and return best possible spot price for tokenIn>tokenOut
7
7
  *
8
- * @param {string} tokenIn - Storage key of tokenIn
9
- * @param {string} tokenOut - Storage key of tokenOut
10
- * @param {BigNumber} amountIn - Amount of tokenIn to sell for tokenOut
8
+ * @param {string} assetIn - Storage key of tokenIn
9
+ * @param {string} assetOut - Storage key of tokenOut
10
+ * @return Best possible spot price of given token pair
11
+ */
12
+ getBestSpotPrice(assetIn: string, assetOut: string): Promise<Amount>;
13
+ /**
14
+ * Calculate and return spot price for given path
15
+ *
16
+ * @param path - current path
17
+ * @param poolsMap - pools map
18
+ * @returns Spot price for given path
19
+ */
20
+ private getSpotPrice;
21
+ /**
22
+ * Calculate and return best possible sell trade for assetIn>assetOut
23
+ *
24
+ * @param {string} assetIn - Storage key of assetIn
25
+ * @param {string} assetOut - Storage key of assetOut
26
+ * @param {BigNumber} amountIn - Amount of assetIn to sell for assetOut
11
27
  * @returns Best possible sell trade of given token pair
12
28
  */
13
- getBestSell(tokenIn: string, tokenOut: string, amountIn: BigNumber | string | number): Promise<Trade>;
29
+ getBestSell(assetIn: string, assetOut: string, amountIn: BigNumber | string | number): Promise<Trade>;
14
30
  /**
15
31
  * Calculate and return sell swaps for given path
16
32
  * - final amount of previous swap is entry to next one
17
33
  *
18
- * @param amountIn - Amount of tokenIn to sell for tokenOut
34
+ * @param amountIn - Amount of assetIn to sell for assetOut
19
35
  * @param path - current path
20
36
  * @param poolsMap - pools map
21
37
  * @returns Sell swaps for given path with corresponding pool pairs
22
38
  */
23
39
  private toSellSwaps;
24
40
  /**
25
- * Calculate and return best possible buy trade for tokenIn>tokenOut
41
+ * Calculate and return best possible buy trade for assetIn>assetOut
26
42
  *
27
- * @param {string} tokenIn - Storage key of tokenIn
28
- * @param {string} tokenOut - Storage key of tokenOut
43
+ * @param {string} assetIn - Storage key of assetIn
44
+ * @param {string} assetOut - Storage key of assetOut
29
45
  * @param {BigNumber} amountOut - Amount of tokenOut to buy for tokenIn
30
46
  * @returns Best possible buy trade of given token pair
31
47
  */
32
- getBestBuy(tokenIn: string, tokenOut: string, amountOut: BigNumber | string | number): Promise<Trade>;
48
+ getBestBuy(assetIn: string, assetOut: string, amountOut: BigNumber | string | number): Promise<Trade>;
33
49
  /**
34
50
  * Calculate and return buy swaps for given path
35
51
  * - final amount of previous swap is entry to next one
36
- * - calculation is done backwards
52
+ * - calculation is done backwards (swaps in reversed order)
37
53
  *
38
- * @param amountOut - Amount of tokenOut to buy for tokenIn
54
+ * @param amountOut - Amount of assetOut to buy for assetIn
39
55
  * @param path - current path
40
56
  * @param poolsMap - pools map
41
57
  * @returns Buy swaps for given path
@@ -1 +1 @@
1
- export { PolkadotClient } from './polkadot';
1
+ export { PolkadotApiClient } from './polkadotApi';
@@ -0,0 +1,17 @@
1
+ import { ApiPromise } from '@polkadot/api';
2
+ import type { StorageKey } from '@polkadot/types';
3
+ import type { AnyTuple, Codec } from '@polkadot/types/types';
4
+ import type { AssetMetadata } from '@polkadot/types/interfaces';
5
+ import type { PoolToken } from '../types';
6
+ import '@polkadot/api-augment';
7
+ export declare class PolkadotApiClient {
8
+ protected readonly api: ApiPromise;
9
+ constructor(api: ApiPromise);
10
+ getStorageKey(asset: [StorageKey<AnyTuple>, Codec], index: number): string;
11
+ getStorageEntryArray(asset: [StorageKey<AnyTuple>, Codec]): string[];
12
+ getPoolTokens(poolAddress: string, assetKeys: string[]): Promise<PoolToken[]>;
13
+ getAssetMetadata(tokenKey: string): Promise<AssetMetadata>;
14
+ getAccountBalance(accountId: string, tokenKey: string): Promise<string>;
15
+ getSystemAccountBalance(accountId: string): Promise<string>;
16
+ getTokenAccountBalance(accountId: string, tokenKey: string): Promise<string>;
17
+ }
@@ -1,4 +1,4 @@
1
1
  export { Router, TradeRouter } from './api';
2
- export { PolkadotPoolService, PoolFactory, XykPool } from './pool';
2
+ export { PolkadotApiPoolService, PoolFactory, XykPool } from './pool';
3
3
  export * from './types';
4
4
  export * from './utils/bignumber';
@@ -1,3 +1,3 @@
1
- export { PolkadotPoolService } from './polkadotPoolService';
1
+ export { PolkadotApiPoolService } from './polkadotApiPoolService';
2
2
  export { PoolFactory } from './poolFactory';
3
3
  export { XykPool } from './xyk/xykPool';
@@ -0,0 +1,13 @@
1
+ declare function getSpotPrice(s: string, b: string, s_w: string, b_w: string, a: string): string;
2
+ declare function calculateInGivenOut(s: string, b: string, s_w: string, b_w: string, a: string): string;
3
+ declare function calculateOutGivenIn(s: string, b: string, s_w: string, b_w: string, a: string): string;
4
+ declare function calculateLinearWeights(start_x: string, end_x: string, start_y: string, end_y: string, at: string): string;
5
+ declare function calculatePoolTradeFee(a: string, fee_numerator: number, fee_denominator: number): string;
6
+ declare const _default: {
7
+ getSpotPrice: typeof getSpotPrice;
8
+ calculateInGivenOut: typeof calculateInGivenOut;
9
+ calculateOutGivenIn: typeof calculateOutGivenIn;
10
+ calculateLinearWeights: typeof calculateLinearWeights;
11
+ calculatePoolTradeFee: typeof calculatePoolTradeFee;
12
+ };
13
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { PolkadotApiClient } from '../../client';
2
+ import { PoolBase, PoolFee } from '../../types';
3
+ interface LbpPoolData {
4
+ readonly assets: string[];
5
+ readonly feeCollector: string;
6
+ readonly fee: number[];
7
+ readonly repayTarget: string;
8
+ readonly initialWeight: number;
9
+ readonly finalWeight: number;
10
+ readonly start: number;
11
+ readonly end: number;
12
+ }
13
+ export declare class LbpPolkadotApiClient extends PolkadotApiClient {
14
+ private readonly MAX_FINAL_WEIGHT;
15
+ getPools(): Promise<PoolBase[]>;
16
+ getLinearWeight(poolEntry: LbpPoolData): Promise<string>;
17
+ getRepayFee(): PoolFee;
18
+ isRepayFeeApplied(assetKey: string, poolEntry: LbpPoolData): Promise<boolean>;
19
+ }
20
+ export {};
@@ -0,0 +1,40 @@
1
+ import { BuyTransfer, Pool, PoolBase, PoolFee, PoolPair, PoolToken, PoolType, SellTransfer } from '../../types';
2
+ import { BigNumber } from '../../utils/bignumber';
3
+ export declare type WeightedPoolPair = PoolPair & {
4
+ weightIn: BigNumber;
5
+ weightOut: BigNumber;
6
+ };
7
+ export declare type WeightedPoolToken = PoolToken & {
8
+ weight: BigNumber;
9
+ };
10
+ export declare class LbpPool implements Pool {
11
+ type: PoolType;
12
+ address: string;
13
+ tradeFee: PoolFee;
14
+ tokens: WeightedPoolToken[];
15
+ repayFee: PoolFee;
16
+ repayFeeApply: boolean;
17
+ static fromPool(pool: PoolBase): LbpPool;
18
+ constructor(address: string, swapFee: PoolFee, tokens: WeightedPoolToken[], repayFee: PoolFee, repayFeeApply: boolean);
19
+ validPair(_tokenIn: string, _tokenOut: string): boolean;
20
+ parsePoolPair(tokenIn: string, tokenOut: string): WeightedPoolPair;
21
+ /**
22
+ * Validate buy transfer
23
+ *
24
+ * a) Accumulated asset is bought (out) from the pool for distributed asset (in) - User(Buyer) bears the fee
25
+ * b) Distributed asset is bought (out) from the pool for accumualted asset (in) - Pool bears the fee
26
+ */
27
+ validateBuy(poolPair: WeightedPoolPair, amountOut: BigNumber): BuyTransfer;
28
+ /**
29
+ * Validate sell transfer
30
+ *
31
+ * a) Accumulated asset is sold (in) to the pool for distributed asset (out) - Pool bears the fee
32
+ * b) Distributed asset is sold (in) to the pool for accumualted asset (out) - User(Seller) bears the fee
33
+ */
34
+ validateSell(poolPair: WeightedPoolPair, amountIn: BigNumber): SellTransfer;
35
+ calculateInGivenOut(poolPair: WeightedPoolPair, amountOut: BigNumber): BigNumber;
36
+ calculateOutGivenIn(poolPair: WeightedPoolPair, amountIn: BigNumber): BigNumber;
37
+ spotPriceInGivenOut(poolPair: WeightedPoolPair): BigNumber;
38
+ spotPriceOutGivenIn(poolPair: WeightedPoolPair): BigNumber;
39
+ calculateTradeFee(amount: BigNumber): BigNumber;
40
+ }
@@ -0,0 +1,10 @@
1
+ import { Hop, PoolBase, PoolService, Transaction } from '../types';
2
+ import { ApiPromise } from '@polkadot/api';
3
+ import { BigNumber } from '../utils/bignumber';
4
+ export declare class PolkadotApiPoolService implements PoolService {
5
+ private readonly api;
6
+ constructor(api: ApiPromise);
7
+ getPools(): Promise<PoolBase[]>;
8
+ buildBuyTx(assetIn: string, assetOut: string, amountOut: BigNumber, maxAmountIn: BigNumber, route: Hop[]): Transaction;
9
+ buildSellTx(assetIn: string, assetOut: string, amountIn: BigNumber, minAmountOut: BigNumber, route: Hop[]): Transaction;
10
+ }
@@ -1,9 +1,11 @@
1
1
  declare function getSpotPrice(a: string, b: string, c: string): string;
2
2
  declare function calculateInGivenOut(a: string, b: string, c: string): string;
3
3
  declare function calculateOutGivenIn(a: string, b: string, c: string): string;
4
+ declare function calculatePoolTradeFee(a: string, fee_numerator: number, fee_denominator: number): string;
4
5
  declare const _default: {
5
6
  getSpotPrice: typeof getSpotPrice;
6
7
  calculateInGivenOut: typeof calculateInGivenOut;
7
8
  calculateOutGivenIn: typeof calculateOutGivenIn;
9
+ calculatePoolTradeFee: typeof calculatePoolTradeFee;
8
10
  };
9
11
  export default _default;
@@ -0,0 +1,6 @@
1
+ import { PolkadotApiClient } from '../../client';
2
+ import { PoolBase, PoolFee } from '../../types';
3
+ export declare class XykPolkadotApiClient extends PolkadotApiClient {
4
+ getPools(): Promise<PoolBase[]>;
5
+ getTradeFee(): PoolFee;
6
+ }
@@ -1,16 +1,19 @@
1
- import { Pool, PoolBase, PoolPair, PoolToken, PoolType } from '../../types';
1
+ import { BuyTransfer, Pool, PoolBase, PoolFee, PoolPair, PoolToken, PoolType, SellTransfer } from '../../types';
2
2
  import { BigNumber } from '../../utils/bignumber';
3
3
  export declare class XykPool implements Pool {
4
4
  type: PoolType;
5
5
  address: string;
6
- tradeFee: string;
6
+ tradeFee: PoolFee;
7
7
  tokens: PoolToken[];
8
8
  static fromPool(pool: PoolBase): XykPool;
9
- constructor(address: string, swapFee: string, tokens: PoolToken[]);
9
+ constructor(address: string, swapFee: PoolFee, tokens: PoolToken[]);
10
10
  validPair(_tokenIn: string, _tokenOut: string): boolean;
11
11
  parsePoolPair(tokenIn: string, tokenOut: string): PoolPair;
12
+ validateBuy(poolPair: PoolPair, amountOut: BigNumber): BuyTransfer;
13
+ validateSell(poolPair: PoolPair, amountIn: BigNumber): SellTransfer;
12
14
  calculateInGivenOut(poolPair: PoolPair, amountOut: BigNumber): BigNumber;
13
- getSpotPriceIn(poolPair: PoolPair): BigNumber;
14
15
  calculateOutGivenIn(poolPair: PoolPair, amountIn: BigNumber): BigNumber;
15
- getSpotPriceOut(poolPair: PoolPair): BigNumber;
16
+ spotPriceInGivenOut(poolPair: PoolPair): BigNumber;
17
+ spotPriceOutGivenIn(poolPair: PoolPair): BigNumber;
18
+ calculateTradeFee(amount: BigNumber): BigNumber;
16
19
  }
@@ -1,6 +1,6 @@
1
1
  import { BigNumber } from './utils/bignumber';
2
2
  export declare type PoolAsset = {
3
- token: string;
3
+ id: string;
4
4
  symbol: string;
5
5
  };
6
6
  export declare enum PoolType {
@@ -9,10 +9,17 @@ export declare enum PoolType {
9
9
  Stable = "Stable",
10
10
  Omni = "Omni"
11
11
  }
12
+ export declare enum PoolError {
13
+ TradingLimitReached = "TradingLimitReached",
14
+ InsufficientTradingAmount = "InsufficientTradingAmount",
15
+ InsufficientBalance = "InsufficientBalance",
16
+ MaxInRatioExceeded = "MaxInRatioExceeded",
17
+ AssetAmountNotReachedLimit = "AssetAmountNotReachedLimit",
18
+ AssetAmountExceededLimit = "AssetAmountExceededLimit"
19
+ }
12
20
  export interface PoolPair {
13
- tradeFee: BigNumber;
14
- tokenIn: string;
15
- tokenOut: string;
21
+ assetIn: string;
22
+ assetOut: string;
16
23
  decimalsIn: number;
17
24
  decimalsOut: number;
18
25
  balanceIn: BigNumber;
@@ -21,61 +28,85 @@ export interface PoolPair {
21
28
  export declare type PoolBase = {
22
29
  address: string;
23
30
  type: PoolType;
24
- tradeFee: string;
31
+ tradeFee: PoolFee;
25
32
  tokens: PoolToken[];
33
+ repayFee?: PoolFee;
34
+ repayFeeApply?: boolean;
26
35
  };
27
- export declare type PoolToken = {
28
- id: string;
36
+ export declare type PoolFee = [numerator: number, denominator: number];
37
+ export declare type PoolToken = PoolAsset & {
29
38
  balance: string;
30
39
  decimals: number;
31
- symbol: string;
32
40
  };
41
+ export declare type PoolSell = {
42
+ calculatedOut: BigNumber;
43
+ };
44
+ export declare type PoolBuy = {
45
+ calculatedIn: BigNumber;
46
+ };
47
+ export declare type Transfer = {
48
+ amountIn: BigNumber;
49
+ amountOut: BigNumber;
50
+ feePct: number;
51
+ errors: PoolError[];
52
+ };
53
+ export declare type SellTransfer = Transfer & PoolSell;
54
+ export declare type BuyTransfer = Transfer & PoolBuy;
33
55
  export interface Pool extends PoolBase {
34
56
  validPair(tokenIn: string, tokenOut: string): boolean;
35
57
  parsePoolPair(tokenIn: string, tokenOut: string): PoolPair;
58
+ validateBuy(poolPair: PoolPair, amountOut: BigNumber): BuyTransfer;
59
+ validateSell(poolPair: PoolPair, amountOut: BigNumber): SellTransfer;
36
60
  calculateInGivenOut(poolPair: PoolPair, amountOut: BigNumber): BigNumber;
37
61
  calculateOutGivenIn(poolPair: PoolPair, amountIn: BigNumber): BigNumber;
38
- getSpotPriceIn(poolPair: PoolPair): BigNumber;
39
- getSpotPriceOut(poolPair: PoolPair): BigNumber;
62
+ spotPriceInGivenOut(poolPair: PoolPair): BigNumber;
63
+ spotPriceOutGivenIn(poolPair: PoolPair): BigNumber;
64
+ calculateTradeFee(amount: BigNumber): BigNumber;
40
65
  }
41
66
  export interface PoolService {
42
67
  getPools(): Promise<PoolBase[]>;
68
+ buildBuyTx(assetIn: string, assetOut: string, amountOut: BigNumber, maxAmountIn: BigNumber, route: Hop[]): Transaction;
69
+ buildSellTx(assetIn: string, assetOut: string, amountIn: BigNumber, minAmountOut: BigNumber, route: Hop[]): Transaction;
70
+ }
71
+ export interface Transaction {
72
+ hex: string;
73
+ name?: string;
74
+ get<T>(): T;
43
75
  }
44
76
  export declare type Hop = {
45
77
  poolType: PoolType;
46
78
  poolId: string;
47
- tokenIn: string;
48
- tokenOut: string;
49
- tradeFeePct: string;
79
+ assetIn: string;
80
+ assetOut: string;
50
81
  };
51
- export declare type Swap = Humanizer & Hop & {
52
- tokenInDecimals: number;
53
- tokenOutDecimals: number;
82
+ export declare type Swap = Hop & Humanizer & {
83
+ assetInDecimals: number;
84
+ assetOutDecimals: number;
54
85
  amountIn: BigNumber;
55
86
  amountOut: BigNumber;
56
- finalAmount: BigNumber;
57
- tradeFee: BigNumber;
58
87
  spotPrice: BigNumber;
59
- priceImpactPct: BigNumber;
60
- };
61
- export declare type SellSwap = Swap & {
62
- calculatedOut: BigNumber;
63
- };
64
- export declare type BuySwap = Swap & {
65
- calculatedIn: BigNumber;
88
+ tradeFeePct: number;
89
+ priceImpactPct: number;
66
90
  };
91
+ export declare type SellSwap = Swap & PoolSell;
92
+ export declare type BuySwap = Swap & PoolBuy;
67
93
  export declare enum TradeType {
68
94
  Buy = "Buy",
69
95
  Sell = "Sell"
70
96
  }
71
- export declare type Trade = Humanizer & {
97
+ export interface Trade extends Humanizer {
72
98
  type: TradeType;
73
99
  amountIn: BigNumber;
74
100
  amountOut: BigNumber;
75
101
  spotPrice: BigNumber;
76
- priceImpactPct: BigNumber;
102
+ priceImpactPct: number;
77
103
  swaps: Swap[];
78
- };
104
+ toTx(tradeLimit: BigNumber): Transaction;
105
+ }
79
106
  export interface Humanizer {
80
107
  toHuman(): any;
81
108
  }
109
+ export declare type Amount = {
110
+ amount: BigNumber;
111
+ decimals: number;
112
+ };
@@ -0,0 +1,4 @@
1
+ import { PoolFee } from '../types';
2
+ import { BigNumber } from './bignumber';
3
+ export declare function toHuman(amount: BigNumber, decimals: number): string;
4
+ export declare function toPct(fee: PoolFee): number;
@@ -1,16 +1,13 @@
1
1
  import { BigNumber } from './bignumber';
2
- export declare function pctToBn(pct: string): BigNumber;
3
- export declare function calculateTradeFee(amount: BigNumber, tradeFee: BigNumber): BigNumber;
4
2
  /**
5
3
  * Percentage Difference Formula
6
4
  *
7
5
  * (|𝑉1−𝑉2| / [(𝑉1+𝑉2)/2]) × 100
8
6
  *
9
- * @param amount - Amount of token in/out
10
- * @param decimals - Decimals of given token
7
+ * @param amount - Amount of asset in/out
8
+ * @param decimals - Decimals of given asset
11
9
  * @param spotPrice - Spot price
12
- * @param calculatedPrice - Calculated price
10
+ * @param calculatedAmount - Calculated amount of asset out/in
13
11
  * @returns Price impact percentage
14
12
  */
15
- export declare function calculatePriceImpact(amount: BigNumber, decimals: number, spotPrice: BigNumber, calculatedPrice: BigNumber): BigNumber;
16
- export declare function formatAmount(amount: BigNumber, decimals: number): string;
13
+ export declare function calculatePriceImpact(amount: BigNumber, decimals: number, spotPrice: BigNumber, calculatedAmount: BigNumber): BigNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacticcouncil/sdk",
3
- "version": "0.0.1-beta.10",
3
+ "version": "0.0.1-beta.12",
4
4
  "private": false,
5
5
  "description": "Galactic SDK",
6
6
  "author": "Pavol Noha <palo@hydradx.io>",
@@ -26,6 +26,7 @@
26
26
  "typescript": "^4.7.4"
27
27
  },
28
28
  "dependencies": {
29
+ "@galacticcouncil/math-lbp": "^0.0.0-beta-1",
29
30
  "@galacticcouncil/math-xyk": "^0.0.0-beta-1",
30
31
  "@polkadot/api": "^9.0.1",
31
32
  "bignumber.js": "^9.1.0",