@chain-registry/client
Advanced tools
Comparing version 1.14.1 to 1.14.2
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.14.2](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/client@1.14.1...@chain-registry/client@1.14.2) (2023-07-30) | ||
**Note:** Version bump only for package @chain-registry/client | ||
## [1.14.1](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/client@1.14.0...@chain-registry/client@1.14.1) (2023-07-12) | ||
@@ -8,0 +16,0 @@ |
@@ -15,9 +15,9 @@ "use strict"; | ||
(0, _classCallCheck2["default"])(this, ChainInfo); | ||
(0, _defineProperty2["default"])(this, "chain_name", void 0); | ||
(0, _defineProperty2["default"])(this, "chainName", void 0); | ||
(0, _defineProperty2["default"])(this, "fetcher", void 0); | ||
(0, _defineProperty2["default"])(this, "_chain", void 0); | ||
(0, _defineProperty2["default"])(this, "_asset_list", void 0); | ||
(0, _defineProperty2["default"])(this, "_asset_lists", void 0); | ||
(0, _defineProperty2["default"])(this, "_ibc_data", []); | ||
this.chain_name = options.chain_name; | ||
(0, _defineProperty2["default"])(this, "_assetList", void 0); | ||
(0, _defineProperty2["default"])(this, "_assetLists", void 0); | ||
(0, _defineProperty2["default"])(this, "_ibcData", []); | ||
this.chainName = options.chainName; | ||
this.fetcher = options.fetcher; | ||
@@ -29,6 +29,6 @@ this.refresh(); | ||
value: function refresh() { | ||
this._asset_list = this.fetcher.getChainAssetList(this.chain_name); | ||
this._ibc_data = this.fetcher.getChainIbcData(this.chain_name); | ||
this._chain = this.fetcher.getChain(this.chain_name); | ||
var supportedChains = this._ibc_data.reduce(function (m, v) { | ||
this._assetList = this.fetcher.getChainAssetList(this.chainName); | ||
this._ibcData = this.fetcher.getChainIbcData(this.chainName); | ||
this._chain = this.fetcher.getChain(this.chainName); | ||
var supportedChains = this._ibcData.reduce(function (m, v) { | ||
if (!m.includes(v.chain_1.chain_name)) m.push(v.chain_1.chain_name); | ||
@@ -38,3 +38,3 @@ if (!m.includes(v.chain_2.chain_name)) m.push(v.chain_2.chain_name); | ||
}, []); | ||
this._asset_lists = this.fetcher.assetLists.filter(function (list) { | ||
this._assetLists = this.fetcher.assetLists.filter(function (list) { | ||
return supportedChains.includes(list.chain_name); | ||
@@ -51,3 +51,3 @@ }); | ||
get: function get() { | ||
return this._asset_list; | ||
return this._assetList; | ||
} | ||
@@ -57,3 +57,3 @@ }, { | ||
get: function get() { | ||
return (0, _utils.getAssetLists)(this.chain_name, this._ibc_data, this._asset_lists); | ||
return (0, _utils.getAssetLists)(this.chainName, this._ibcData, this._assetLists); | ||
} | ||
@@ -60,0 +60,0 @@ }]); |
@@ -16,11 +16,11 @@ "use strict"; | ||
(0, _classCallCheck2["default"])(this, ChainRegistryChainUtil); | ||
(0, _defineProperty2["default"])(this, "chain_name", void 0); | ||
(0, _defineProperty2["default"])(this, "chain_info", void 0); | ||
(0, _defineProperty2["default"])(this, "_all_Asset", void 0); | ||
this.chain_name = options.chain_name; | ||
this.chain_info = options.chain_info; | ||
this._all_Asset = this.chain_info.assetLists.reduce(function (m, it) { | ||
(0, _defineProperty2["default"])(this, "chainName", void 0); | ||
(0, _defineProperty2["default"])(this, "chainInfo", void 0); | ||
(0, _defineProperty2["default"])(this, "allAsset", void 0); | ||
this.chainName = options.chainName; | ||
this.chainInfo = options.chainInfo; | ||
this.allAsset = this.chainInfo.assetLists.reduce(function (m, it) { | ||
[].push.apply(m, it.assets); | ||
return m; | ||
}, (0, _toConsumableArray2["default"])(this.chain_info.nativeAssetLists.assets)); | ||
}, (0, _toConsumableArray2["default"])(this.chainInfo.nativeAssetLists.assets)); | ||
} | ||
@@ -30,3 +30,3 @@ (0, _createClass2["default"])(ChainRegistryChainUtil, [{ | ||
value: function getAssetByDenom(denom) { | ||
return (0, _utils.getAssetByDenom)(this._all_Asset, denom); | ||
return (0, _utils.getAssetByDenom)(this.allAsset, denom); | ||
} | ||
@@ -36,3 +36,3 @@ }, { | ||
value: function getDenomByCoinGeckoId(coinGeckoId) { | ||
return (0, _utils.getDenomByCoinGeckoId)(this._all_Asset, coinGeckoId); | ||
return (0, _utils.getDenomByCoinGeckoId)(this.allAsset, coinGeckoId); | ||
} | ||
@@ -42,3 +42,3 @@ }, { | ||
value: function getSymbolByChainDenom(denom) { | ||
return (0, _utils.getSymbolByChainDenom)(this._all_Asset, denom); | ||
return (0, _utils.getSymbolByChainDenom)(this.allAsset, denom); | ||
} | ||
@@ -48,3 +48,3 @@ }, { | ||
value: function getChainDenomBySymbol(token) { | ||
return (0, _utils.getChainDenomBySymbol)(this._all_Asset, token); | ||
return (0, _utils.getChainDenomBySymbol)(this.allAsset, token); | ||
} | ||
@@ -54,3 +54,3 @@ }, { | ||
value: function getExponentByDenom(denom) { | ||
return (0, _utils.getExponentByDenom)(this._all_Asset, denom); | ||
return (0, _utils.getExponentByDenom)(this.allAsset, denom); | ||
} | ||
@@ -60,3 +60,3 @@ }, { | ||
value: function convertCoinGeckoPricesToDenomPriceMap(prices) { | ||
return (0, _utils.convertCoinGeckoPricesToDenomPriceMap)(this._all_Asset, prices); | ||
return (0, _utils.convertCoinGeckoPricesToDenomPriceMap)(this.allAsset, prices); | ||
} | ||
@@ -71,3 +71,3 @@ }, { | ||
value: function convertBaseUnitsToDollarValue(prices, symbol, amount) { | ||
return (0, _utils.convertBaseUnitsToDollarValue)(this._all_Asset, prices, symbol, amount); | ||
return (0, _utils.convertBaseUnitsToDollarValue)(this.allAsset, prices, symbol, amount); | ||
} | ||
@@ -77,3 +77,3 @@ }, { | ||
value: function convertDollarValueToDenomUnits(prices, symbol, value) { | ||
return (0, _utils.convertDollarValueToDenomUnits)(this._all_Asset, prices, symbol, value); | ||
return (0, _utils.convertDollarValueToDenomUnits)(this.allAsset, prices, symbol, value); | ||
} | ||
@@ -83,3 +83,3 @@ }, { | ||
value: function convertBaseUnitsToDisplayUnits(symbol, amount) { | ||
return (0, _utils.convertBaseUnitsToDisplayUnits)(this._all_Asset, symbol, amount); | ||
return (0, _utils.convertBaseUnitsToDisplayUnits)(this.allAsset, symbol, amount); | ||
} | ||
@@ -86,0 +86,0 @@ }]); |
@@ -31,5 +31,5 @@ "use strict"; | ||
(0, _defineProperty2["default"])(this, "urls", []); | ||
(0, _defineProperty2["default"])(this, "_asset_lists", []); | ||
(0, _defineProperty2["default"])(this, "_assetLists", []); | ||
(0, _defineProperty2["default"])(this, "_chains", []); | ||
(0, _defineProperty2["default"])(this, "_ibc_data", []); | ||
(0, _defineProperty2["default"])(this, "_ibcData", []); | ||
(0, _defineProperty2["default"])(this, "chainInfoList", []); | ||
@@ -41,6 +41,6 @@ // | ||
if (options.assetLists) { | ||
this._asset_lists = options.assetLists; | ||
this._assetLists = options.assetLists; | ||
} | ||
if (options.ibcData) { | ||
this._ibc_data = options.ibcData; | ||
this._ibcData = options.ibcData; | ||
} | ||
@@ -59,3 +59,3 @@ if (options.urls) { | ||
get: function get() { | ||
return this._asset_lists; | ||
return this._assetLists; | ||
} | ||
@@ -65,3 +65,3 @@ }, { | ||
get: function get() { | ||
return this._ibc_data; | ||
return this._ibcData; | ||
} | ||
@@ -78,3 +78,3 @@ }, { | ||
value: function getChainAssetList(chainName) { | ||
return this._asset_lists.find(function (list) { | ||
return this._assetLists.find(function (list) { | ||
return list.chain_name === chainName; | ||
@@ -86,3 +86,3 @@ }); | ||
value: function getGeneratedAssetLists(chainName) { | ||
return (0, _utils.getAssetLists)(chainName, this._ibc_data, this._asset_lists); | ||
return (0, _utils.getAssetLists)(chainName, this._ibcData, this._assetLists); | ||
} | ||
@@ -92,3 +92,3 @@ }, { | ||
value: function getChainIbcData(chainName) { | ||
return this._ibc_data.filter(function (info) { | ||
return this._ibcData.filter(function (info) { | ||
return info.chain_1.chain_name === chainName || info.chain_2.chain_name === chainName; | ||
@@ -101,7 +101,7 @@ }); | ||
var chainInfo = this.chainInfoList.find(function (it) { | ||
return it.chain_name === chainName; | ||
return it.chainName === chainName; | ||
}); | ||
if (!chainInfo) { | ||
chainInfo = new _chainInfo.ChainInfo({ | ||
chain_name: chainName, | ||
chainName: chainName, | ||
fetcher: this | ||
@@ -134,10 +134,10 @@ }); | ||
value: function updateAssetList(data) { | ||
var found = this._asset_lists.find(function (list) { | ||
var found = this._assetLists.find(function (list) { | ||
return list.chain_name === data.chain_name; | ||
}); | ||
if (!found) { | ||
this._asset_lists.push(data); | ||
this._assetLists.push(data); | ||
return; | ||
} | ||
this._asset_lists = this._asset_lists.map(function (list) { | ||
this._assetLists = this._assetLists.map(function (list) { | ||
if (list.chain_name === data.chain_name) { | ||
@@ -153,10 +153,10 @@ return data; | ||
value: function upsertIbcData(data) { | ||
var found = this._ibc_data.find(function (info) { | ||
var found = this._ibcData.find(function (info) { | ||
return info.chain_1.chain_name === data.chain_1.chain_name && info.chain_2.chain_name === data.chain_2.chain_name; | ||
}); | ||
if (!found) { | ||
this._ibc_data.push(data); | ||
this._ibcData.push(data); | ||
return; | ||
} | ||
this._ibc_data = this._ibc_data.map(function (info) { | ||
this._ibcData = this._ibcData.map(function (info) { | ||
if (info.chain_1.chain_name === data.chain_1.chain_name && info.chain_2.chain_name === data.chain_2.chain_name) { | ||
@@ -163,0 +163,0 @@ return data; |
@@ -76,3 +76,3 @@ "use strict"; | ||
}); | ||
this.urls = [].concat((0, _toConsumableArray2["default"])(chainUrls), (0, _toConsumableArray2["default"])(assetlistUrls), (0, _toConsumableArray2["default"])(ibcUrls)); | ||
this.urls = (0, _toConsumableArray2["default"])(new Set([].concat((0, _toConsumableArray2["default"])(chainUrls), (0, _toConsumableArray2["default"])(assetlistUrls), (0, _toConsumableArray2["default"])(ibcUrls), (0, _toConsumableArray2["default"])(this.urls || [])))); | ||
} | ||
@@ -84,4 +84,4 @@ }, { | ||
return new _chainUtil.ChainRegistryChainUtil({ | ||
chain_name: chainName, | ||
chain_info: chainInfo | ||
chainName: chainName, | ||
chainInfo: chainInfo | ||
}); | ||
@@ -88,0 +88,0 @@ } |
{ | ||
"name": "@chain-registry/client", | ||
"version": "1.14.1", | ||
"version": "1.14.2", | ||
"description": "Chain Registry Client", | ||
@@ -56,2 +56,3 @@ "author": "Dan Lynch <pyramation@gmail.com>", | ||
"@types/sha.js": "^2.4.0", | ||
"@types/supertest": "2.0.12", | ||
"@typescript-eslint/eslint-plugin": "5.59.0", | ||
@@ -70,4 +71,6 @@ "@typescript-eslint/parser": "5.59.0", | ||
"long": "^5.2.0", | ||
"nock": "13.3.2", | ||
"prettier": "^2.8.7", | ||
"regenerator-runtime": "^0.13.11", | ||
"supertest": "6.3.3", | ||
"ts-jest": "^29.1.0", | ||
@@ -79,7 +82,7 @@ "typescript": "^5.0.4" | ||
"@chain-registry/types": "^0.16.0", | ||
"@chain-registry/utils": "^1.13.1", | ||
"@chain-registry/utils": "^1.13.2", | ||
"bfs-path": "^1.0.2", | ||
"cross-fetch": "^3.1.5" | ||
}, | ||
"gitHead": "6660513da7c427a1b8166f1a68a1c3af6079ab11" | ||
"gitHead": "7643eb9d080056f05ac9284447cfca8d4aaf5470" | ||
} |
@@ -104,3 +104,3 @@ # @chain-registry/client | ||
* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) for generated CosmWasm contract Typescript classes | ||
* [@osmonauts/telescope](https://github.com/osmosis-labs/telescope) a "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs. | ||
* [@cosmology/telescope](https://github.com/cosmology-tech/telescope) a "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs. | ||
* [chain-registry](https://github.com/cosmology-tech/chain-registry) an npm module for the official Cosmos chain-registry. | ||
@@ -107,0 +107,0 @@ * [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) A wallet connector for the Cosmos ⚛️ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36545
32