@chain-registry/keplr 1.7.0 → 1.9.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 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.9.0](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/keplr@1.8.0...@chain-registry/keplr@1.9.0) (2022-12-08)
7
+
8
+ **Note:** Version bump only for package @chain-registry/keplr
9
+
10
+
11
+
12
+
13
+
14
+ # [1.8.0](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/keplr@1.7.0...@chain-registry/keplr@1.8.0) (2022-11-16)
15
+
16
+ **Note:** Version bump only for package @chain-registry/keplr
17
+
18
+
19
+
20
+
21
+
6
22
  # [1.7.0](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/keplr@1.6.0...@chain-registry/keplr@1.7.0) (2022-11-10)
7
23
 
8
24
  **Note:** Version bump only for package @chain-registry/keplr
package/main/index.js CHANGED
@@ -5,8 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.chainRegistryChainToKeplr = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
9
  var _cosmos = require("@keplr-wallet/cosmos");
9
10
  var _semver = _interopRequireDefault(require("semver"));
11
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
13
  var getRpc = function getRpc(chain) {
11
14
  var _chain$apis, _chain$apis$rpc$;
12
15
  return (_chain$apis = chain.apis) === null || _chain$apis === void 0 ? void 0 : (_chain$apis$rpc$ = _chain$apis.rpc[0]) === null || _chain$apis$rpc$ === void 0 ? void 0 : _chain$apis$rpc$.address;
@@ -34,7 +37,7 @@ var cleanVer = function cleanVer(ver) {
34
37
  }
35
38
  };
36
39
  var chainRegistryChainToKeplr = function chainRegistryChainToKeplr(chain, assets) {
37
- var _chain$codebase$cosmo, _chain$codebase, _chain$codebase2, _assets$find, _chain$fees, _chain$fees$fee_token, _chain$fees2, _chain$fees2$fee_toke, _chain$fees2$fee_toke2, _chain$fees$fee_token2, _chain$fees3, _chain$fees3$fee_toke, _chain$fees3$fee_toke2, _chain$fees$fee_token3, _chain$fees4, _chain$fees4$fee_toke, _chain$fees4$fee_toke2, _chain$staking, _currencies$find;
40
+ var _chain$codebase$cosmo, _chain$codebase, _chain$codebase2, _assets$find, _chain$fees, _chain$fees2, _chain$fees2$fee_toke, _chain$staking, _currencies$find;
38
41
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
39
42
  getRpcEndpoint: getRpc,
40
43
  getRestEndpoint: getRest,
@@ -74,11 +77,15 @@ var chainRegistryChainToKeplr = function chainRegistryChainToKeplr(chain, assets
74
77
  * If this field is empty, it just use the default gas price step (low: 0.01, average: 0.025, high: 0.04).
75
78
  * And, set field's type as primitive number because it is hard to restore the prototype after deserialzing if field's type is `Dec`.
76
79
  */
77
- var gasPriceStep = {
78
- low: (_chain$fees$fee_token = (_chain$fees2 = chain.fees) === null || _chain$fees2 === void 0 ? void 0 : (_chain$fees2$fee_toke = _chain$fees2.fee_tokens) === null || _chain$fees2$fee_toke === void 0 ? void 0 : (_chain$fees2$fee_toke2 = _chain$fees2$fee_toke[0]) === null || _chain$fees2$fee_toke2 === void 0 ? void 0 : _chain$fees2$fee_toke2.low_gas_price) !== null && _chain$fees$fee_token !== void 0 ? _chain$fees$fee_token : 0.01,
79
- average: (_chain$fees$fee_token2 = (_chain$fees3 = chain.fees) === null || _chain$fees3 === void 0 ? void 0 : (_chain$fees3$fee_toke = _chain$fees3.fee_tokens) === null || _chain$fees3$fee_toke === void 0 ? void 0 : (_chain$fees3$fee_toke2 = _chain$fees3$fee_toke[0]) === null || _chain$fees3$fee_toke2 === void 0 ? void 0 : _chain$fees3$fee_toke2.average_gas_price) !== null && _chain$fees$fee_token2 !== void 0 ? _chain$fees$fee_token2 : 0.025,
80
- high: (_chain$fees$fee_token3 = (_chain$fees4 = chain.fees) === null || _chain$fees4 === void 0 ? void 0 : (_chain$fees4$fee_toke = _chain$fees4.fee_tokens) === null || _chain$fees4$fee_toke === void 0 ? void 0 : (_chain$fees4$fee_toke2 = _chain$fees4$fee_toke[0]) === null || _chain$fees4$fee_toke2 === void 0 ? void 0 : _chain$fees4$fee_toke2.high_gas_price) !== null && _chain$fees$fee_token3 !== void 0 ? _chain$fees$fee_token3 : 0.04
81
- };
80
+ var gasPriceSteps = (_chain$fees2 = chain.fees) === null || _chain$fees2 === void 0 ? void 0 : (_chain$fees2$fee_toke = _chain$fees2.fee_tokens) === null || _chain$fees2$fee_toke === void 0 ? void 0 : _chain$fees2$fee_toke.reduce(function (m, feeToken) {
81
+ var _feeToken$low_gas_pri, _feeToken$average_gas, _feeToken$high_gas_pr;
82
+ m[feeToken.denom] = {
83
+ low: (_feeToken$low_gas_pri = feeToken.low_gas_price) !== null && _feeToken$low_gas_pri !== void 0 ? _feeToken$low_gas_pri : 0.01,
84
+ average: (_feeToken$average_gas = feeToken.average_gas_price) !== null && _feeToken$average_gas !== void 0 ? _feeToken$average_gas : 0.025,
85
+ high: (_feeToken$high_gas_pr = feeToken.high_gas_price) !== null && _feeToken$high_gas_pr !== void 0 ? _feeToken$high_gas_pr : 0.04
86
+ };
87
+ return m;
88
+ }, {});
82
89
  var stakingDenoms = ((_chain$staking = chain.staking) === null || _chain$staking === void 0 ? void 0 : _chain$staking.staking_tokens.map(function (stakingToken) {
83
90
  return stakingToken.denom;
84
91
  })) || [];
@@ -97,8 +104,31 @@ var chainRegistryChainToKeplr = function chainRegistryChainToKeplr(chain, assets
97
104
  var stakeCurrency = (_currencies$find = currencies.find(function (currency) {
98
105
  return stakingDenoms.includes(currency.coinDenom);
99
106
  })) !== null && _currencies$find !== void 0 ? _currencies$find : currencies[0];
100
- var feeCurrencies = currencies.filter(function (currency) {
101
- return feeDenoms.includes(currency.coinDenom);
107
+ var feeCurrencies = currencies
108
+ // USE THE FEE DENOMS
109
+ .filter(function (currency) {
110
+ return feeDenoms.includes(currency.coinMinimalDenom);
111
+ }).map(function (feeCurrency) {
112
+ if (!gasPriceSteps.hasOwnProperty(feeCurrency.coinMinimalDenom)) return feeCurrency;
113
+
114
+ // has gas
115
+ var gasPriceStep = gasPriceSteps[feeCurrency.coinMinimalDenom];
116
+ return _objectSpread(_objectSpread({}, feeCurrency), {}, {
117
+ gasPriceStep: gasPriceStep
118
+ });
119
+ });
120
+ var feeCurrenciesDefault = currencies
121
+ // USE THE STAKE CURRENCY
122
+ .filter(function (currency) {
123
+ return stakeCurrency.coinDenom === currency.coinDenom;
124
+ }).map(function (feeCurrency) {
125
+ if (!gasPriceSteps.hasOwnProperty(feeCurrency.coinMinimalDenom)) return feeCurrency;
126
+
127
+ // has gas
128
+ var gasPriceStep = gasPriceSteps[feeCurrency.coinMinimalDenom];
129
+ return _objectSpread(_objectSpread({}, feeCurrency), {}, {
130
+ gasPriceStep: gasPriceStep
131
+ });
102
132
  });
103
133
  var chainInfo = {
104
134
  rpc: options.getRpcEndpoint(chain),
@@ -108,11 +138,10 @@ var chainRegistryChainToKeplr = function chainRegistryChainToKeplr(chain, assets
108
138
  bip44: {
109
139
  coinType: chain.slip44
110
140
  },
111
- gasPriceStep: gasPriceStep,
112
141
  bech32Config: _cosmos.Bech32Address.defaultBech32Config(chain.bech32_prefix),
113
142
  currencies: currencies,
114
143
  stakeCurrency: stakeCurrency || currencies[0],
115
- feeCurrencies: feeCurrencies.length !== 0 ? feeCurrencies : currencies,
144
+ feeCurrencies: feeCurrencies.length !== 0 ? feeCurrencies : feeCurrenciesDefault,
116
145
  features: features
117
146
  };
118
147
  return chainInfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chain-registry/keplr",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Chain Registry to Keplr",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "homepage": "https://github.com/cosmology-tech/chain-registry",
@@ -57,7 +57,7 @@
57
57
  "babel-core": "7.0.0-bridge.0",
58
58
  "babel-jest": "29.2.1",
59
59
  "babel-watch": "^7.0.0",
60
- "chain-registry": "^1.5.0",
60
+ "chain-registry": "^1.6.0",
61
61
  "cross-env": "^7.0.2",
62
62
  "eslint": "8.25.0",
63
63
  "eslint-config-prettier": "^8.5.0",
@@ -73,10 +73,10 @@
73
73
  },
74
74
  "dependencies": {
75
75
  "@babel/runtime": "^7.19.4",
76
- "@chain-registry/types": "^0.13.1",
76
+ "@chain-registry/types": "^0.14.0",
77
77
  "@keplr-wallet/cosmos": "0.11.16",
78
78
  "@keplr-wallet/crypto": "0.11.16",
79
79
  "semver": "^7.3.8"
80
80
  },
81
- "gitHead": "c35d96830c1cb4f9cc26643e6238ff659867dfb7"
81
+ "gitHead": "ad0a582adf079e3d5bf899ef18e0f7c605b09579"
82
82
  }