@chain-registry/client 1.17.0 → 1.18.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 +16 -0
- package/README.md +3 -3
- package/main/chain-info.js +1 -1
- package/main/chain-util.js +24 -14
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.18.0](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/client@1.17.1...@chain-registry/client@1.18.0) (2023-12-20)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @chain-registry/client
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.17.1](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/client@1.17.0...@chain-registry/client@1.17.1) (2023-12-15)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @chain-registry/client
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [1.17.0](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/client@1.16.0...@chain-registry/client@1.17.0) (2023-12-15)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @chain-registry/client
|
package/README.md
CHANGED
|
@@ -87,13 +87,13 @@ or get the `ChainInfo` object:
|
|
|
87
87
|
const chainInfo: ChainInfo = registry.getChainInfo('osmosis');
|
|
88
88
|
|
|
89
89
|
// AssetList[] of the generated assets
|
|
90
|
-
const
|
|
90
|
+
const assets: AssetList[] = chainInfo.assetLists;
|
|
91
91
|
|
|
92
92
|
// Chain
|
|
93
93
|
const chain: Chain = chainInfo.chain;
|
|
94
94
|
|
|
95
|
-
//
|
|
96
|
-
const
|
|
95
|
+
// Native asset list
|
|
96
|
+
const nativeAssetList: AssetList = chainInfo.nativeAssetList;
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
## Related
|
package/main/chain-info.js
CHANGED
package/main/chain-util.js
CHANGED
|
@@ -15,43 +15,53 @@ var ChainRegistryChainUtil = /*#__PURE__*/function () {
|
|
|
15
15
|
(0, _classCallCheck2["default"])(this, ChainRegistryChainUtil);
|
|
16
16
|
(0, _defineProperty2["default"])(this, "chainName", void 0);
|
|
17
17
|
(0, _defineProperty2["default"])(this, "chainInfo", void 0);
|
|
18
|
-
(0, _defineProperty2["default"])(this, "
|
|
18
|
+
(0, _defineProperty2["default"])(this, "_assets", []);
|
|
19
19
|
this.chainName = options.chainName;
|
|
20
20
|
this.chainInfo = options.chainInfo;
|
|
21
|
-
this.
|
|
22
|
-
[].
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
this._assets = [{
|
|
22
|
+
assets: [].concat((0, _toConsumableArray2["default"])(this.chainInfo.nativeAssetList.assets), (0, _toConsumableArray2["default"])(this.chainInfo.assetLists.flatMap(function (_ref) {
|
|
23
|
+
var assets = _ref.assets;
|
|
24
|
+
return assets;
|
|
25
|
+
}))),
|
|
26
|
+
chain_name: this.chainName
|
|
27
|
+
}];
|
|
25
28
|
}
|
|
26
29
|
(0, _createClass2["default"])(ChainRegistryChainUtil, [{
|
|
27
30
|
key: "getAssetByDenom",
|
|
28
31
|
value: function getAssetByDenom(denom) {
|
|
29
|
-
return (0, _utils.getAssetByDenom)(this.
|
|
32
|
+
return (0, _utils.getAssetByDenom)(this._assets, denom, this.chainName);
|
|
30
33
|
}
|
|
31
34
|
}, {
|
|
32
35
|
key: "getDenomByCoinGeckoId",
|
|
33
36
|
value: function getDenomByCoinGeckoId(coinGeckoId) {
|
|
34
|
-
return (0, _utils.getDenomByCoinGeckoId)(this.
|
|
37
|
+
return (0, _utils.getDenomByCoinGeckoId)(this._assets, coinGeckoId, this.chainName);
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
key: "getCoinGeckoIdByDenom",
|
|
41
|
+
value: function getCoinGeckoIdByDenom(coinGeckoId) {
|
|
42
|
+
return (0, _utils.getCoinGeckoIdByDenom)(this._assets, coinGeckoId, {
|
|
43
|
+
chainName: this.chainName
|
|
44
|
+
});
|
|
35
45
|
}
|
|
36
46
|
}, {
|
|
37
47
|
key: "getSymbolByChainDenom",
|
|
38
48
|
value: function getSymbolByChainDenom(denom) {
|
|
39
|
-
return (0, _utils.getSymbolByChainDenom)(this.
|
|
49
|
+
return (0, _utils.getSymbolByChainDenom)(this._assets, denom, this.chainName);
|
|
40
50
|
}
|
|
41
51
|
}, {
|
|
42
52
|
key: "getChainDenomBySymbol",
|
|
43
53
|
value: function getChainDenomBySymbol(token) {
|
|
44
|
-
return (0, _utils.getChainDenomBySymbol)(this.
|
|
54
|
+
return (0, _utils.getChainDenomBySymbol)(this._assets, token, this.chainName);
|
|
45
55
|
}
|
|
46
56
|
}, {
|
|
47
57
|
key: "getExponentByDenom",
|
|
48
58
|
value: function getExponentByDenom(denom) {
|
|
49
|
-
return (0, _utils.getExponentByDenom)(this.
|
|
59
|
+
return (0, _utils.getExponentByDenom)(this._assets, denom, this.chainName);
|
|
50
60
|
}
|
|
51
61
|
}, {
|
|
52
62
|
key: "convertCoinGeckoPricesToDenomPriceMap",
|
|
53
63
|
value: function convertCoinGeckoPricesToDenomPriceMap(prices) {
|
|
54
|
-
return (0, _utils.convertCoinGeckoPricesToDenomPriceMap)(this.
|
|
64
|
+
return (0, _utils.convertCoinGeckoPricesToDenomPriceMap)(this._assets, prices);
|
|
55
65
|
}
|
|
56
66
|
}, {
|
|
57
67
|
key: "noDecimals",
|
|
@@ -61,17 +71,17 @@ var ChainRegistryChainUtil = /*#__PURE__*/function () {
|
|
|
61
71
|
}, {
|
|
62
72
|
key: "convertBaseUnitsToDollarValue",
|
|
63
73
|
value: function convertBaseUnitsToDollarValue(prices, symbol, amount) {
|
|
64
|
-
return (0, _utils.convertBaseUnitsToDollarValue)(this.
|
|
74
|
+
return (0, _utils.convertBaseUnitsToDollarValue)(this._assets, prices, symbol, amount, this.chainName);
|
|
65
75
|
}
|
|
66
76
|
}, {
|
|
67
77
|
key: "convertDollarValueToDenomUnits",
|
|
68
78
|
value: function convertDollarValueToDenomUnits(prices, symbol, value) {
|
|
69
|
-
return (0, _utils.convertDollarValueToDenomUnits)(this.
|
|
79
|
+
return (0, _utils.convertDollarValueToDenomUnits)(this._assets, prices, symbol, value, this.chainName);
|
|
70
80
|
}
|
|
71
81
|
}, {
|
|
72
82
|
key: "convertBaseUnitsToDisplayUnits",
|
|
73
83
|
value: function convertBaseUnitsToDisplayUnits(symbol, amount) {
|
|
74
|
-
return (0, _utils.convertBaseUnitsToDisplayUnits)(this.
|
|
84
|
+
return (0, _utils.convertBaseUnitsToDisplayUnits)(this._assets, symbol, amount, this.chainName);
|
|
75
85
|
}
|
|
76
86
|
}]);
|
|
77
87
|
return ChainRegistryChainUtil;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chain-registry/client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Chain Registry Client",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/cosmology-tech/chain-registry",
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
"eslint-plugin-simple-import-sort": "8.0.0",
|
|
67
67
|
"eslint-plugin-unused-imports": "2.0.0",
|
|
68
68
|
"jest": "^29.5.0",
|
|
69
|
-
"long": "^5.2.0",
|
|
70
69
|
"nock": "13.3.2",
|
|
71
70
|
"prettier": "^2.8.7",
|
|
72
71
|
"regenerator-runtime": "^0.13.11",
|
|
@@ -76,10 +75,10 @@
|
|
|
76
75
|
},
|
|
77
76
|
"dependencies": {
|
|
78
77
|
"@babel/runtime": "^7.21.0",
|
|
79
|
-
"@chain-registry/types": "^0.17.
|
|
80
|
-
"@chain-registry/utils": "^1.
|
|
78
|
+
"@chain-registry/types": "^0.17.1",
|
|
79
|
+
"@chain-registry/utils": "^1.17.0",
|
|
81
80
|
"bfs-path": "^1.0.2",
|
|
82
81
|
"cross-fetch": "^3.1.5"
|
|
83
82
|
},
|
|
84
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "c8644d2e748b506abf7e174f2c50bfdb77277ca8"
|
|
85
84
|
}
|