@galacticcouncil/sdk 0.5.0 โ†’ 0.5.2

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.
@@ -8,3 +8,4 @@ export * from './types';
8
8
  export * from './errors';
9
9
  export * from './consts';
10
10
  export * from './utils/bignumber';
11
+ export * from './utils/math';
@@ -4,12 +4,13 @@ export type PoolAsset = {
4
4
  symbol: string;
5
5
  };
6
6
  export declare enum PoolType {
7
- XYK = "XYK",
8
- LBP = "LBP",
9
- Stable = "Stable",
10
- Omni = "Omni"
7
+ XYK = "Xyk",
8
+ LBP = "Lbp",
9
+ Stable = "Stableswap",
10
+ Omni = "Omnipool"
11
11
  }
12
12
  export declare enum PoolError {
13
+ UnknownError = "UnknownError",
13
14
  InsufficientTradingAmount = "InsufficientTradingAmount",
14
15
  MaxInRatioExceeded = "MaxInRatioExceeded",
15
16
  MaxOutRatioExceeded = "MaxOutRatioExceeded"
@@ -76,7 +77,7 @@ export interface Transaction {
76
77
  get<T>(): T;
77
78
  }
78
79
  export type Hop = {
79
- poolType: PoolType;
80
+ pool: PoolType;
80
81
  poolId: string;
81
82
  assetIn: string;
82
83
  assetOut: string;
@@ -4,13 +4,34 @@ import { BigNumber } from './bignumber';
4
4
  *
5
5
  * (|๐‘‰1โˆ’๐‘‰2| / [(๐‘‰1+๐‘‰2)/2]) ร— 100
6
6
  *
7
- * @param amount - Amount of asset in/out
8
- * @param decimals - Decimals of given asset
9
- * @param spotPrice - Spot price
10
- * @param calculatedAmount - Calculated amount of asset out/in
11
- * @returns Price impact percentage
7
+ * This formula calculates the percentage difference by comparing
8
+ * the absolute difference between the two values with their <b>average</b>.
9
+ *
10
+ * Usage: It's used when you want to find the percentage difference between
11
+ * two quantities where both quantities are significant.
12
+ *
13
+ * @param v1 - 1st value
14
+ * @param v2 - 2nd value
15
+ * @returns Difference between two values in relation to their average
16
+ */
17
+ export declare function calculateDiffToAvg(v1: BigNumber, v2: BigNumber): BigNumber;
18
+ /**
19
+ * Percentage Difference Formula (Relative Change)
20
+ *
21
+ * ((Vfin-Vref) / Vref) * 100
22
+ *
23
+ * This formula calculates the percentage difference by comparing
24
+ * the absolute difference between the two values with the <b>reference value</b>.
25
+ *
26
+ * Usage: This formula isn't suitable for finding percentage differences
27
+ * when the values being compared are not reference and final values of the
28
+ * same quantity.
29
+ *
30
+ * @param vFin - final value
31
+ * @param vRef - reference value
32
+ * @returns Difference between a final value and a reference value in relation to the reference value
12
33
  */
13
- export declare function calculatePriceImpact(amount: BigNumber, decimals: number, spotPrice: BigNumber, calculatedAmount: BigNumber): BigNumber;
34
+ export declare function calculateDiffToRef(vFin: BigNumber, vRef: BigNumber): BigNumber;
14
35
  /**
15
36
  * The total fee paid for a โ€˜sellโ€™ transaction
16
37
  * Suppose the trader is selling X for Y
@@ -22,7 +43,7 @@ export declare function calculatePriceImpact(amount: BigNumber, decimals: number
22
43
  */
23
44
  export declare function calculateSellFee(delta0Y: BigNumber, deltaY: BigNumber): BigNumber;
24
45
  /**
25
- * The total fee paid for a buy transaction
46
+ * The total fee paid for a โ€˜buyโ€˜ transaction
26
47
  * Suppose the trader is buying Y using X
27
48
  *
28
49
  * fee = (deltaX / delta0X) - 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacticcouncil/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "private": false,
5
5
  "description": "Galactic SDK",
6
6
  "author": "Pavol Noha <palo@hydradx.io>",
@@ -15,7 +15,7 @@
15
15
  "test:coverage": "jest --coverage",
16
16
  "pckg:build": "npm run cleanup && npm run build",
17
17
  "pckg:beta": "npm run pckg:build && npm publish --tag beta",
18
- "pckg:release": "npm run pckg:build && npm release",
18
+ "pckg:release": "npm run pckg:build && standard-version --tag-prefix=''",
19
19
  "pckg:publish": "git push --follow-tags origin master && npm publish",
20
20
  "xcmgr:sync": "node ./xcmgr.sync.mjs"
21
21
  },