@chain-registry/client 1.19.2 → 1.20.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/main/client.js ADDED
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ChainRegistryClient = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
+ var _crossFetch = _interopRequireDefault(require("cross-fetch"));
15
+ var _bfsPath = require("bfs-path");
16
+ var _utils = require("@chain-registry/utils");
17
+ var _utils2 = require("./utils");
18
+ var DEFAULT_BASE_URL = 'https://raw.githubusercontent.com/cosmos/chain-registry/master';
19
+ var ChainRegistryClient = /*#__PURE__*/function () {
20
+ function ChainRegistryClient() {
21
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
22
+ (0, _classCallCheck2["default"])(this, ChainRegistryClient);
23
+ (0, _defineProperty2["default"])(this, "_allUrls", []);
24
+ (0, _defineProperty2["default"])(this, "_baseUrl", DEFAULT_BASE_URL);
25
+ (0, _defineProperty2["default"])(this, "_chainNames", []);
26
+ (0, _defineProperty2["default"])(this, "_notFoundUrls", []);
27
+ (0, _defineProperty2["default"])(this, "_chains", []);
28
+ (0, _defineProperty2["default"])(this, "_assetLists", []);
29
+ (0, _defineProperty2["default"])(this, "_ibcInfo", []);
30
+ var urls = options.urls,
31
+ chainNames = options.chainNames,
32
+ baseUrl = options.baseUrl;
33
+ this._baseUrl = baseUrl !== null && baseUrl !== void 0 ? baseUrl : this._baseUrl;
34
+ this._allUrls = this.generateUrls({
35
+ urls: urls,
36
+ chainNames: chainNames
37
+ });
38
+ }
39
+ (0, _createClass2["default"])(ChainRegistryClient, [{
40
+ key: "urls",
41
+ get: function get() {
42
+ return this._allUrls;
43
+ }
44
+ }, {
45
+ key: "chains",
46
+ get: function get() {
47
+ return this._chains;
48
+ }
49
+ }, {
50
+ key: "assetLists",
51
+ get: function get() {
52
+ return this._assetLists;
53
+ }
54
+ }, {
55
+ key: "ibcInfo",
56
+ get: function get() {
57
+ return this._ibcInfo;
58
+ }
59
+ }, {
60
+ key: "getChain",
61
+ value: function getChain(chainName) {
62
+ return this._chains.find(function (_ref) {
63
+ var chain_name = _ref.chain_name;
64
+ return chain_name === chainName;
65
+ });
66
+ }
67
+ }, {
68
+ key: "getChainAssetList",
69
+ value: function getChainAssetList(chainName) {
70
+ return this._assetLists.find(function (_ref2) {
71
+ var chain_name = _ref2.chain_name;
72
+ return chain_name === chainName;
73
+ });
74
+ }
75
+ }, {
76
+ key: "getChainIbcInfo",
77
+ value: function getChainIbcInfo(chainName) {
78
+ return this._ibcInfo.filter(function (info) {
79
+ return info.chain_1.chain_name === chainName || info.chain_2.chain_name === chainName;
80
+ });
81
+ }
82
+ }, {
83
+ key: "getChainIbcAssetList",
84
+ value: function getChainIbcAssetList(chainName) {
85
+ return (0, _utils.getAssetLists)(chainName, this._ibcInfo, this._assetLists)[0];
86
+ }
87
+ }, {
88
+ key: "getChainFullData",
89
+ value: function getChainFullData(chainName) {
90
+ return {
91
+ chain: this.getChain(chainName),
92
+ assetList: this.getChainAssetList(chainName),
93
+ ibcInfo: this.getChainIbcInfo(chainName),
94
+ ibcAssetList: this.getChainIbcAssetList(chainName)
95
+ };
96
+ }
97
+ }, {
98
+ key: "getChainUtils",
99
+ value: function getChainUtils(chainName) {
100
+ return new _utils2.ChainRegistryUtils({
101
+ chainName: chainName,
102
+ assetList: this.getChainAssetList(chainName),
103
+ ibcAssetList: this.getChainIbcAssetList(chainName)
104
+ });
105
+ }
106
+ }, {
107
+ key: "fetch",
108
+ value: function () {
109
+ var _fetch = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
110
+ var _this = this;
111
+ var options,
112
+ urls,
113
+ newUrls,
114
+ responses,
115
+ _args = arguments;
116
+ return _regenerator["default"].wrap(function _callee$(_context) {
117
+ while (1) switch (_context.prev = _context.next) {
118
+ case 0:
119
+ options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
120
+ urls = [];
121
+ if (Object.keys(options).length === 0) {
122
+ urls = this._allUrls;
123
+ } else {
124
+ newUrls = this.generateUrls(options);
125
+ urls = newUrls;
126
+ this._allUrls = (0, _toConsumableArray2["default"])(new Set([].concat((0, _toConsumableArray2["default"])(this._allUrls), (0, _toConsumableArray2["default"])(newUrls))));
127
+ }
128
+ _context.next = 5;
129
+ return Promise.all(urls.map(function (url) {
130
+ return _this.fetchUrl(url);
131
+ }));
132
+ case 5:
133
+ responses = _context.sent;
134
+ responses.filter(Boolean).forEach(function (data) {
135
+ return _this.save(data);
136
+ });
137
+ case 7:
138
+ case "end":
139
+ return _context.stop();
140
+ }
141
+ }, _callee, this);
142
+ }));
143
+ function fetch() {
144
+ return _fetch.apply(this, arguments);
145
+ }
146
+ return fetch;
147
+ }()
148
+ }, {
149
+ key: "formatChainUrl",
150
+ value: function formatChainUrl(chainName) {
151
+ return "".concat(this._baseUrl, "/").concat(chainName, "/chain.json");
152
+ }
153
+ }, {
154
+ key: "formatAssetListUrl",
155
+ value: function formatAssetListUrl(chainName) {
156
+ return "".concat(this._baseUrl, "/").concat(chainName, "/assetlist.json");
157
+ }
158
+ }, {
159
+ key: "formatIbcUrl",
160
+ value: function formatIbcUrl(chain1, chain2) {
161
+ return "".concat(this._baseUrl, "/_IBC/").concat(chain1, "-").concat(chain2, ".json");
162
+ }
163
+ }, {
164
+ key: "generateNamePairs",
165
+ value: function generateNamePairs(chainNames) {
166
+ var pairs = [];
167
+ for (var i = 0; i < chainNames.length; i++) {
168
+ for (var j = i + 1; j < chainNames.length; j++) {
169
+ pairs.push([chainNames[i], chainNames[j]].sort());
170
+ }
171
+ }
172
+ return pairs;
173
+ }
174
+ }, {
175
+ key: "generateUrls",
176
+ value: function generateUrls(_ref3) {
177
+ var _this2 = this;
178
+ var _ref3$urls = _ref3.urls,
179
+ urls = _ref3$urls === void 0 ? [] : _ref3$urls,
180
+ _ref3$chainNames = _ref3.chainNames,
181
+ chainNames = _ref3$chainNames === void 0 ? [] : _ref3$chainNames;
182
+ var chainUrls = chainNames.map(function (chain) {
183
+ return _this2.formatChainUrl(chain);
184
+ });
185
+ var assetListUrls = chainNames.map(function (chain) {
186
+ return _this2.formatAssetListUrl(chain);
187
+ });
188
+ this._chainNames = (0, _toConsumableArray2["default"])(new Set([].concat((0, _toConsumableArray2["default"])(this._chainNames), (0, _toConsumableArray2["default"])(chainNames))));
189
+ var allPairs = this.generateNamePairs(this._chainNames);
190
+ var newPairs = allPairs.filter(function (pair) {
191
+ return !_this2._ibcInfo.some(function (info) {
192
+ return info.chain_1.chain_name === pair[0] && info.chain_2.chain_name === pair[1];
193
+ });
194
+ });
195
+ var ibcUrls = newPairs.map(function (pair) {
196
+ return _this2.formatIbcUrl(pair[0], pair[1]);
197
+ });
198
+ var allUrls = (0, _toConsumableArray2["default"])(new Set([].concat((0, _toConsumableArray2["default"])(chainUrls), (0, _toConsumableArray2["default"])(assetListUrls), (0, _toConsumableArray2["default"])(ibcUrls), (0, _toConsumableArray2["default"])(urls))));
199
+ return allUrls.filter(function (url) {
200
+ return !_this2._notFoundUrls.includes(url);
201
+ });
202
+ }
203
+ }, {
204
+ key: "fetchUrl",
205
+ value: function () {
206
+ var _fetchUrl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(url) {
207
+ var _this3 = this;
208
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
209
+ while (1) switch (_context2.prev = _context2.next) {
210
+ case 0:
211
+ return _context2.abrupt("return", (0, _crossFetch["default"])(url).then(function (res) {
212
+ if (res.status === 404) {
213
+ console.error("Failed to fetch ".concat(url, " with status 404"));
214
+ _this3._notFoundUrls.push(url);
215
+ return null;
216
+ }
217
+ if (res.status >= 400) {
218
+ throw new Error("Failed to fetch ".concat(url, " with status ").concat(res.status));
219
+ }
220
+ return res.json();
221
+ }));
222
+ case 1:
223
+ case "end":
224
+ return _context2.stop();
225
+ }
226
+ }, _callee2);
227
+ }));
228
+ function fetchUrl(_x) {
229
+ return _fetchUrl.apply(this, arguments);
230
+ }
231
+ return fetchUrl;
232
+ }()
233
+ }, {
234
+ key: "upsert",
235
+ value: function upsert(array, element, filterFn) {
236
+ var res = array.find(filterFn);
237
+ if (!res) {
238
+ return [].concat((0, _toConsumableArray2["default"])(array), [element]);
239
+ }
240
+ return array.map(function (item) {
241
+ if (filterFn(item)) {
242
+ return element;
243
+ }
244
+ return item;
245
+ });
246
+ }
247
+ }, {
248
+ key: "save",
249
+ value: function save(data) {
250
+ if (!data.$schema) {
251
+ throw new Error('Invalid data: Missing $schema property');
252
+ }
253
+ var type = (0, _bfsPath.basename)(data.$schema, '.schema.json');
254
+ switch (type) {
255
+ case 'chain':
256
+ this._chains = this.upsert(this._chains, data, function (chain) {
257
+ return chain.chain_name === data.chain_name && chain.network_type === data.network_type;
258
+ });
259
+ break;
260
+ case 'assetlist':
261
+ this._assetLists = this.upsert(this._assetLists, data, function (assetList) {
262
+ return assetList.chain_name === data.chain_name;
263
+ });
264
+ break;
265
+ case 'ibc_data':
266
+ this._ibcInfo = this.upsert(this._ibcInfo, data, function (info) {
267
+ return info.chain_1.chain_name === data.chain_1.chain_name && info.chain_2.chain_name === data.chain_2.chain_name;
268
+ });
269
+ break;
270
+ default:
271
+ throw new Error("Unsupported json schema: ".concat(data.$schema));
272
+ }
273
+ }
274
+ }]);
275
+ return ChainRegistryClient;
276
+ }();
277
+ exports.ChainRegistryClient = ChainRegistryClient;
package/main/index.js CHANGED
@@ -3,47 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _chainInfo = require("./chain-info");
7
- Object.keys(_chainInfo).forEach(function (key) {
6
+ var _utils = require("./utils");
7
+ Object.keys(_utils).forEach(function (key) {
8
8
  if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _chainInfo[key]) return;
9
+ if (key in exports && exports[key] === _utils[key]) return;
10
10
  Object.defineProperty(exports, key, {
11
11
  enumerable: true,
12
12
  get: function get() {
13
- return _chainInfo[key];
13
+ return _utils[key];
14
14
  }
15
15
  });
16
16
  });
17
- var _chainUtil = require("./chain-util");
18
- Object.keys(_chainUtil).forEach(function (key) {
17
+ var _client = require("./client");
18
+ Object.keys(_client).forEach(function (key) {
19
19
  if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _chainUtil[key]) return;
20
+ if (key in exports && exports[key] === _client[key]) return;
21
21
  Object.defineProperty(exports, key, {
22
22
  enumerable: true,
23
23
  get: function get() {
24
- return _chainUtil[key];
25
- }
26
- });
27
- });
28
- var _fetcher = require("./fetcher");
29
- Object.keys(_fetcher).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _fetcher[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function get() {
35
- return _fetcher[key];
36
- }
37
- });
38
- });
39
- var _registry = require("./registry");
40
- Object.keys(_registry).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _registry[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function get() {
46
- return _registry[key];
24
+ return _client[key];
47
25
  }
48
26
  });
49
27
  });
package/main/utils.js ADDED
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ChainRegistryUtils = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+ var _utils = require("@chain-registry/utils");
13
+ var ChainRegistryUtils = /*#__PURE__*/function () {
14
+ function ChainRegistryUtils(options) {
15
+ var _options$assetList, _options$ibcAssetList;
16
+ (0, _classCallCheck2["default"])(this, ChainRegistryUtils);
17
+ (0, _defineProperty2["default"])(this, "_chainName", void 0);
18
+ (0, _defineProperty2["default"])(this, "_assets", []);
19
+ this._chainName = options.chainName;
20
+ this._assets = [{
21
+ assets: [].concat((0, _toConsumableArray2["default"])(((_options$assetList = options.assetList) === null || _options$assetList === void 0 ? void 0 : _options$assetList.assets) || []), (0, _toConsumableArray2["default"])(((_options$ibcAssetList = options.ibcAssetList) === null || _options$ibcAssetList === void 0 ? void 0 : _options$ibcAssetList.assets) || [])),
22
+ chain_name: options.chainName
23
+ }];
24
+ }
25
+ (0, _createClass2["default"])(ChainRegistryUtils, [{
26
+ key: "getAssetByDenom",
27
+ value: function getAssetByDenom(denom) {
28
+ return (0, _utils.getAssetByDenom)(this._assets, denom, this._chainName);
29
+ }
30
+ }, {
31
+ key: "getAssetBySymbol",
32
+ value: function getAssetBySymbol(symbol) {
33
+ return (0, _utils.getAssetBySymbol)(this._assets, symbol, this._chainName);
34
+ }
35
+ }, {
36
+ key: "getDenomByCoinGeckoId",
37
+ value: function getDenomByCoinGeckoId(coinGeckoId) {
38
+ return (0, _utils.getDenomByCoinGeckoId)(this._assets, coinGeckoId, this._chainName);
39
+ }
40
+ }, {
41
+ key: "getCoinGeckoIdByDenom",
42
+ value: function getCoinGeckoIdByDenom(coinGeckoId) {
43
+ return (0, _utils.getCoinGeckoIdByDenom)(this._assets, coinGeckoId, {
44
+ chainName: this._chainName
45
+ });
46
+ }
47
+ }, {
48
+ key: "getSymbolByDenom",
49
+ value: function getSymbolByDenom(denom) {
50
+ return (0, _utils.getSymbolByDenom)(this._assets, denom, this._chainName);
51
+ }
52
+ }, {
53
+ key: "getDenomBySymbol",
54
+ value: function getDenomBySymbol(symbol) {
55
+ return (0, _utils.getDenomBySymbol)(this._assets, symbol, this._chainName);
56
+ }
57
+ }, {
58
+ key: "getExponentByDenom",
59
+ value: function getExponentByDenom(denom) {
60
+ return (0, _utils.getExponentByDenom)(this._assets, denom, this._chainName);
61
+ }
62
+ }, {
63
+ key: "getExponentBySymbol",
64
+ value: function getExponentBySymbol(symbol) {
65
+ return (0, _utils.getExponentBySymbol)(this._assets, symbol, this._chainName);
66
+ }
67
+ }, {
68
+ key: "getTokenLogoByDenom",
69
+ value: function getTokenLogoByDenom(denom) {
70
+ return (0, _utils.getTokenLogoByDenom)(this._assets, denom, this._chainName);
71
+ }
72
+ }, {
73
+ key: "getTokenNameByDenom",
74
+ value: function getTokenNameByDenom(denom) {
75
+ return (0, _utils.getTokenNameByDenom)(this._assets, denom, this._chainName);
76
+ }
77
+ }, {
78
+ key: "getChainNameByDenom",
79
+ value: function getChainNameByDenom(denom) {
80
+ return (0, _utils.getChainNameByDenom)(this._assets, denom);
81
+ }
82
+ }, {
83
+ key: "mapCoinGeckoPricesToDenoms",
84
+ value: function mapCoinGeckoPricesToDenoms(prices) {
85
+ return (0, _utils.mapCoinGeckoPricesToDenoms)(this._assets, prices);
86
+ }
87
+ }, {
88
+ key: "convertBaseUnitToDollarValue",
89
+ value: function convertBaseUnitToDollarValue(prices, symbol, amount) {
90
+ return (0, _utils.convertBaseUnitToDollarValue)(this._assets, prices, symbol, amount, this._chainName);
91
+ }
92
+ }, {
93
+ key: "convertDollarValueToBaseUnit",
94
+ value: function convertDollarValueToBaseUnit(prices, symbol, value) {
95
+ return (0, _utils.convertDollarValueToBaseUnit)(this._assets, prices, symbol, value, this._chainName);
96
+ }
97
+ }, {
98
+ key: "convertBaseUnitToDisplayUnit",
99
+ value: function convertBaseUnitToDisplayUnit(symbol, amount) {
100
+ return (0, _utils.convertBaseUnitToDisplayUnit)(this._assets, symbol, amount, this._chainName);
101
+ }
102
+ }, {
103
+ key: "convertDisplayUnitToBaseUnit",
104
+ value: function convertDisplayUnitToBaseUnit(symbol, amount) {
105
+ return (0, _utils.convertDisplayUnitToBaseUnit)(this._assets, symbol, amount, this._chainName);
106
+ }
107
+ }]);
108
+ return ChainRegistryUtils;
109
+ }();
110
+ exports.ChainRegistryUtils = ChainRegistryUtils;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chain-registry/client",
3
- "version": "1.19.2",
3
+ "version": "1.20.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",
@@ -76,9 +76,9 @@
76
76
  "dependencies": {
77
77
  "@babel/runtime": "^7.21.0",
78
78
  "@chain-registry/types": "^0.18.1",
79
- "@chain-registry/utils": "^1.18.2",
79
+ "@chain-registry/utils": "^1.19.0",
80
80
  "bfs-path": "^1.0.2",
81
81
  "cross-fetch": "^3.1.5"
82
82
  },
83
- "gitHead": "2430b615d7efb97cefa0cb7a36282671c3b2a756"
83
+ "gitHead": "e57916824aad1598342fe9175e9e87b1ba0babcb"
84
84
  }
@@ -0,0 +1,43 @@
1
+ import { AssetList, Chain, IBCInfo } from '@chain-registry/types';
2
+ import { ChainRegistryUtils } from './utils';
3
+ export interface FetchOptions {
4
+ urls?: string[];
5
+ chainNames?: string[];
6
+ }
7
+ export interface ChainRegistryClientOptions extends FetchOptions {
8
+ baseUrl?: string;
9
+ }
10
+ export declare class ChainRegistryClient {
11
+ private _allUrls;
12
+ private _baseUrl;
13
+ private _chainNames;
14
+ private _notFoundUrls;
15
+ private _chains;
16
+ private _assetLists;
17
+ private _ibcInfo;
18
+ constructor(options?: ChainRegistryClientOptions);
19
+ get urls(): string[];
20
+ get chains(): Chain[];
21
+ get assetLists(): AssetList[];
22
+ get ibcInfo(): IBCInfo[];
23
+ getChain(chainName: string): Chain | undefined;
24
+ getChainAssetList(chainName: string): AssetList | undefined;
25
+ getChainIbcInfo(chainName: string): IBCInfo[];
26
+ getChainIbcAssetList(chainName: string): AssetList;
27
+ getChainFullData(chainName: string): {
28
+ chain: Chain;
29
+ assetList: AssetList;
30
+ ibcInfo: IBCInfo[];
31
+ ibcAssetList: AssetList;
32
+ };
33
+ getChainUtils(chainName: string): ChainRegistryUtils;
34
+ fetch(options?: FetchOptions): Promise<void>;
35
+ private formatChainUrl;
36
+ private formatAssetListUrl;
37
+ private formatIbcUrl;
38
+ private generateNamePairs;
39
+ private generateUrls;
40
+ private fetchUrl;
41
+ private upsert;
42
+ private save;
43
+ }
package/types/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- export * from './chain-info';
2
- export * from './chain-util';
3
- export * from './fetcher';
4
- export * from './registry';
1
+ export * from './utils';
2
+ export * from './client';
@@ -0,0 +1,28 @@
1
+ import { Asset, AssetList } from '@chain-registry/types';
2
+ import type { Denom, Exponent, DenomPriceMap, CoinGeckoUSDPrice } from '@chain-registry/utils';
3
+ export interface ChainRegistryUtilsOptions {
4
+ chainName: string;
5
+ assetList?: AssetList;
6
+ ibcAssetList?: AssetList;
7
+ }
8
+ export declare class ChainRegistryUtils {
9
+ private _chainName;
10
+ private _assets;
11
+ constructor(options: ChainRegistryUtilsOptions);
12
+ getAssetByDenom(denom: Denom): Asset | undefined;
13
+ getAssetBySymbol(symbol: string): Asset | undefined;
14
+ getDenomByCoinGeckoId(coinGeckoId: string): Denom | undefined;
15
+ getCoinGeckoIdByDenom(coinGeckoId: string): Denom | undefined;
16
+ getSymbolByDenom(denom: Denom): string | undefined;
17
+ getDenomBySymbol(symbol: string): Denom | undefined;
18
+ getExponentByDenom(denom: Denom): Exponent | undefined;
19
+ getExponentBySymbol(symbol: string): Exponent | undefined;
20
+ getTokenLogoByDenom(denom: Denom): string | undefined;
21
+ getTokenNameByDenom(denom: Denom): string | undefined;
22
+ getChainNameByDenom(denom: Denom): string | undefined;
23
+ mapCoinGeckoPricesToDenoms(prices: Record<string, CoinGeckoUSDPrice>): DenomPriceMap;
24
+ convertBaseUnitToDollarValue(prices: DenomPriceMap, symbol: string, amount: string | number): string;
25
+ convertDollarValueToBaseUnit(prices: DenomPriceMap, symbol: string, value: string | number): string;
26
+ convertBaseUnitToDisplayUnit(symbol: string, amount: string | number): string;
27
+ convertDisplayUnitToBaseUnit(symbol: string, amount: string | number): string;
28
+ }