@chain-registry/keplr
Advanced tools
Comparing version 0.4.6 to 0.4.7
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.4.7](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/keplr@0.4.6...@chain-registry/keplr@0.4.7) (2022-08-18) | ||
**Note:** Version bump only for package @chain-registry/keplr | ||
## [0.4.6](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/keplr@0.4.5...@chain-registry/keplr@0.4.6) (2022-08-18) | ||
@@ -8,0 +16,0 @@ |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -10,2 +12,4 @@ value: true | ||
var _semver = _interopRequireDefault(require("semver")); | ||
var getRpc = function getRpc(chain) { | ||
@@ -29,2 +33,20 @@ var _chain$apis, _chain$apis$rpc$; | ||
var cleanVer = function cleanVer(ver) { | ||
if (!_semver["default"].valid(ver)) { | ||
var spaces = ver.split('.').length; | ||
switch (spaces) { | ||
case 1: | ||
return ver + '.0.0'; | ||
case 2: | ||
return ver + '.0'; | ||
case 3: | ||
default: | ||
throw new Error('contact maintainers: bad version'); | ||
} | ||
} | ||
}; | ||
var chainRegistryChainToKeplr = function chainRegistryChainToKeplr(chain, assets) { | ||
@@ -43,18 +65,18 @@ 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; | ||
var sdkVersion = Number((_chain$codebase$cosmo = (_chain$codebase = chain.codebase) === null || _chain$codebase === void 0 ? void 0 : _chain$codebase.cosmos_sdk_version) !== null && _chain$codebase$cosmo !== void 0 ? _chain$codebase$cosmo : 0.4); // stargate | ||
var sdkVer = cleanVer((_chain$codebase$cosmo = (_chain$codebase = chain.codebase) === null || _chain$codebase === void 0 ? void 0 : _chain$codebase.cosmos_sdk_version) !== null && _chain$codebase$cosmo !== void 0 ? _chain$codebase$cosmo : '0.4'); // stargate | ||
if (sdkVersion >= 0.4) features.push('stargate'); // no-legacy-stdTx | ||
if (_semver["default"].satisfies(sdkVer, '>=0.4')) features.push('stargate'); // no-legacy-stdTx | ||
if (sdkVersion >= 0.43) features.push('no-legacy-stdTx'); // until further notice, assume 'ibc-transfer' | ||
if (_semver["default"].satisfies(sdkVer, '>=0.43')) features.push('no-legacy-stdTx'); // until further notice, assume 'ibc-transfer' | ||
features.push('ibc-transfer'); // ibc-go | ||
if (sdkVersion >= 0.43) features.push('ibc-go'); | ||
if (_semver["default"].satisfies(sdkVer, '>=0.45')) features.push('ibc-go'); | ||
if ((_chain$codebase2 = chain.codebase) !== null && _chain$codebase2 !== void 0 && _chain$codebase2.cosmwasm_enabled) { | ||
var _chain$codebase$cosmw; | ||
features.push('cosmwasm'); | ||
if (Number(chain.codebase.cosmwasm_version) >= 0.24) { | ||
features.push('wasmd_0.24+'); | ||
} | ||
var wasmVer = cleanVer((_chain$codebase$cosmw = chain.codebase.cosmwasm_version) !== null && _chain$codebase$cosmw !== void 0 ? _chain$codebase$cosmw : '0.24'); | ||
if (_semver["default"].satisfies(wasmVer, '>=0.24')) features.push('wasmd_0.24+'); | ||
} | ||
@@ -61,0 +83,0 @@ |
import { Bech32Address } from '@keplr-wallet/cosmos'; | ||
import semver from 'semver'; | ||
@@ -9,2 +10,20 @@ const getRpc = chain => chain.apis?.rpc[0]?.address; | ||
const cleanVer = ver => { | ||
if (!semver.valid(ver)) { | ||
const spaces = ver.split('.').length; | ||
switch (spaces) { | ||
case 1: | ||
return ver + '.0.0'; | ||
case 2: | ||
return ver + '.0'; | ||
case 3: | ||
default: | ||
throw new Error('contact maintainers: bad version'); | ||
} | ||
} | ||
}; | ||
export const chainRegistryChainToKeplr = (chain, assets, options = { | ||
@@ -20,18 +39,16 @@ getRpcEndpoint: getRpc, | ||
const sdkVersion = Number(chain.codebase?.cosmos_sdk_version ?? 0.4); // stargate | ||
const sdkVer = cleanVer(chain.codebase?.cosmos_sdk_version ?? '0.4'); // stargate | ||
if (sdkVersion >= 0.4) features.push('stargate'); // no-legacy-stdTx | ||
if (semver.satisfies(sdkVer, '>=0.4')) features.push('stargate'); // no-legacy-stdTx | ||
if (sdkVersion >= 0.43) features.push('no-legacy-stdTx'); // until further notice, assume 'ibc-transfer' | ||
if (semver.satisfies(sdkVer, '>=0.43')) features.push('no-legacy-stdTx'); // until further notice, assume 'ibc-transfer' | ||
features.push('ibc-transfer'); // ibc-go | ||
if (sdkVersion >= 0.43) features.push('ibc-go'); | ||
if (semver.satisfies(sdkVer, '>=0.45')) features.push('ibc-go'); | ||
if (chain.codebase?.cosmwasm_enabled) { | ||
features.push('cosmwasm'); | ||
if (Number(chain.codebase.cosmwasm_version) >= 0.24) { | ||
features.push('wasmd_0.24+'); | ||
} | ||
const wasmVer = cleanVer(chain.codebase.cosmwasm_version ?? '0.24'); | ||
if (semver.satisfies(wasmVer, '>=0.24')) features.push('wasmd_0.24+'); | ||
} | ||
@@ -38,0 +55,0 @@ |
{ | ||
"name": "@chain-registry/keplr", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"description": "Chain Registry to Keplr", | ||
@@ -82,5 +82,6 @@ "author": "Dan Lynch <pyramation@gmail.com>", | ||
"@keplr-wallet/cosmos": "^0.10.3", | ||
"@keplr-wallet/crypto": "^0.10.11" | ||
"@keplr-wallet/crypto": "^0.10.11", | ||
"semver": "^7.3.7" | ||
}, | ||
"gitHead": "c77425b25f513b698e60f8905496de3fa212a3fe" | ||
"gitHead": "7735741b7a32d388905448047689189db9bb49d8" | ||
} |
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
19625
202
5
+ Addedsemver@^7.3.7
+ Addedsemver@7.6.3(transitive)