@chain-registry/utils 1.13.2 → 1.14.0
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.
- package/CHANGELOG.md +8 -0
- package/package.json +3 -3
- package/types/asset-list-util.d.ts +11 -57
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.14.0](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/utils@1.13.2...@chain-registry/utils@1.14.0) (2023-09-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @chain-registry/utils
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [1.13.2](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/utils@1.13.1...@chain-registry/utils@1.13.2) (2023-07-30)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @chain-registry/utils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chain-registry/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "Chain Registry Utils",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/cosmology-tech/chain-registry",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@babel/runtime": "^7.21.0",
|
|
76
|
-
"@chain-registry/types": "^0.
|
|
76
|
+
"@chain-registry/types": "^0.17.0",
|
|
77
77
|
"bignumber.js": "9.1.1",
|
|
78
78
|
"sha.js": "^2.4.11"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "87f2c124ac734e0f47596e39407f5462c94a506b"
|
|
81
81
|
}
|
|
@@ -1,65 +1,19 @@
|
|
|
1
1
|
import { Asset, AssetDenomUnit } from '@chain-registry/types';
|
|
2
|
-
|
|
3
2
|
export type CoinDenom = AssetDenomUnit['denom'];
|
|
4
|
-
|
|
5
3
|
export type Exponent = AssetDenomUnit['exponent'];
|
|
6
|
-
|
|
7
4
|
export interface CoinGeckoUSD {
|
|
8
|
-
|
|
5
|
+
usd: number;
|
|
9
6
|
}
|
|
10
|
-
|
|
11
7
|
export interface PriceHash {
|
|
12
|
-
|
|
8
|
+
[key: CoinDenom]: number;
|
|
13
9
|
}
|
|
14
|
-
|
|
15
|
-
export declare function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
):
|
|
19
|
-
|
|
20
|
-
export declare function getDenomByCoinGeckoId(
|
|
21
|
-
assets: Asset[],
|
|
22
|
-
coinGeckoId: string
|
|
23
|
-
): CoinDenom;
|
|
24
|
-
|
|
25
|
-
export declare function getSymbolByChainDenom(
|
|
26
|
-
assets: Asset[],
|
|
27
|
-
denom: CoinDenom
|
|
28
|
-
): string;
|
|
29
|
-
|
|
30
|
-
export declare function getChainDenomBySymbol(
|
|
31
|
-
assets: Asset[],
|
|
32
|
-
token: string
|
|
33
|
-
): CoinDenom;
|
|
34
|
-
|
|
35
|
-
export declare function getExponentByDenom(
|
|
36
|
-
assets: Asset[],
|
|
37
|
-
denom: CoinDenom
|
|
38
|
-
): Exponent;
|
|
39
|
-
|
|
40
|
-
export declare function convertCoinGeckoPricesToDenomPriceMap(
|
|
41
|
-
assets: Asset[],
|
|
42
|
-
prices: Record<string, CoinGeckoUSD>
|
|
43
|
-
): PriceHash;
|
|
44
|
-
|
|
10
|
+
export declare function getAssetByDenom(assets: Asset[], denom: CoinDenom): Asset;
|
|
11
|
+
export declare function getDenomByCoinGeckoId(assets: Asset[], coinGeckoId: string): CoinDenom;
|
|
12
|
+
export declare function getSymbolByChainDenom(assets: Asset[], denom: CoinDenom): string;
|
|
13
|
+
export declare function getChainDenomBySymbol(assets: Asset[], token: string): CoinDenom;
|
|
14
|
+
export declare function getExponentByDenom(assets: Asset[], denom: CoinDenom): Exponent;
|
|
15
|
+
export declare function convertCoinGeckoPricesToDenomPriceMap(assets: Asset[], prices: Record<string, CoinGeckoUSD>): PriceHash;
|
|
45
16
|
export declare function noDecimals(num: number | string): string;
|
|
46
|
-
|
|
47
|
-
export declare function
|
|
48
|
-
|
|
49
|
-
prices: PriceHash,
|
|
50
|
-
symbol: string,
|
|
51
|
-
amount: string | number
|
|
52
|
-
): string;
|
|
53
|
-
|
|
54
|
-
export declare function convertDollarValueToDenomUnits(
|
|
55
|
-
assets: Asset[],
|
|
56
|
-
prices: PriceHash,
|
|
57
|
-
symbol: string,
|
|
58
|
-
value: string | number
|
|
59
|
-
): string;
|
|
60
|
-
|
|
61
|
-
export declare function convertBaseUnitsToDisplayUnits(
|
|
62
|
-
assets: Asset[],
|
|
63
|
-
symbol: string,
|
|
64
|
-
amount: string | number
|
|
65
|
-
): string;
|
|
17
|
+
export declare function convertBaseUnitsToDollarValue(assets: Asset[], prices: PriceHash, symbol: string, amount: string | number): string;
|
|
18
|
+
export declare function convertDollarValueToDenomUnits(assets: Asset[], prices: PriceHash, symbol: string, value: string | number): string;
|
|
19
|
+
export declare function convertBaseUnitsToDisplayUnits(assets: Asset[], symbol: string, amount: string | number): string;
|