Socket
Socket
Sign inDemoInstall

@chain-registry/keplr

Package Overview
Dependencies
Maintainers
3
Versions
309
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chain-registry/keplr - npm Package Compare versions

Comparing version 1.67.13 to 1.68.0

67

esm/index.js

@@ -6,20 +6,49 @@ import { Bech32Address } from '@keplr-wallet/cosmos';

const getExplr = (chain) => chain.explorers?.[0]?.url ?? '';
const cleanVer = (ver) => {
if (!semver.valid(ver)) {
// try to split by @ for repo@version
ver = ver.split('@').pop();
if (semver.valid(ver))
return 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 @chain-registry/keplr maintainers: bad version');
}
const versionPatterns = {
fullSemver: /v?(\d+\.\d+\.\d+)(?=-[\w.-]+|$)/, // Matches complete semver patterns like '0.47.20' or 'v0.47.20'
partialSemver: /v?(\d+\.\d+)(?=(?:\.\d+)?(?=-[\w.-]+|$))/, // Matches partial semver patterns like '0.47' or 'v0.47'
basicVersion: /v?(\d+)(?=(?:\.\d+)?(?:\.\d+)?(?=-[\w.-]+|$))/, // Matches basic versions like '0' or 'v0'
tagged: /@v(\d+\.\d+)(?:\.x)?(?=-[\w.-]+|$)/, // Specific for tagged formats
embedded: /\/v(\d+\.\d+\.\d+)(?=-[\w.-]+|$)/, // For versions embedded in paths
simple: /v?(\d+)(?:\.(\d+))?(?:\.(\d+))?$/, // General simple versions
complexEmbedded: /[\w-]+\/[\w-]+ v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-\d+[\w.-]*)/, // Complex formats with namespaces
taggedVersion: /[\w-]+\/[\w-]+ v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?=-[\w.-]+|$)/ // Versions with descriptive tags
};
export function extractVersion(input) {
let version = null;
// Check each pattern in turn
if (versionPatterns.fullSemver.test(input)) {
version = input.match(versionPatterns.fullSemver)?.[1];
}
};
else if (versionPatterns.partialSemver.test(input)) {
version = input.match(versionPatterns.partialSemver)?.[1];
}
else if (versionPatterns.basicVersion.test(input)) {
version = input.match(versionPatterns.basicVersion)?.[1];
}
else if (versionPatterns.taggedVersion.test(input)) {
version = input.match(versionPatterns.taggedVersion)?.[1];
}
else if (versionPatterns.complexEmbedded.test(input)) {
version = input.match(versionPatterns.complexEmbedded)?.[1];
}
else if (versionPatterns.simple.test(input)) {
version = input.match(versionPatterns.simple)?.[1];
}
else if (versionPatterns.tagged.test(input)) {
version = input.match(versionPatterns.tagged)?.[1];
}
else if (versionPatterns.embedded.test(input)) {
version = input.match(versionPatterns.embedded)?.[1];
}
return version ? normalizeVersion(version) : null;
}
function normalizeVersion(version) {
// Ensures the version is normalized to the 'x.y.z' format, if applicable
const parts = version.split('.');
while (parts.length < 3) {
parts.push('0');
}
return parts.join('.');
}
export const chainRegistryChainToKeplr = (chain, assets, options = {

@@ -39,3 +68,3 @@ getRpcEndpoint: getRpc,

const sdkVer = chain.codebase?.cosmos_sdk_version
? cleanVer(chain.codebase?.cosmos_sdk_version)
? extractVersion(chain.codebase?.cosmos_sdk_version)
: '0.40';

@@ -55,3 +84,3 @@ // stargate

features.push('cosmwasm');
const wasmVer = cleanVer(chain.codebase.cosmwasm_version ?? '0.24');
const wasmVer = extractVersion(chain.codebase.cosmwasm_version ?? '0.24');
if (semver.satisfies(wasmVer, '>=0.24'))

@@ -58,0 +87,0 @@ features.push('wasmd_0.24+');

import { AssetList, Chain } from '@chain-registry/types';
import { ChainInfo } from '@keplr-wallet/types';
export declare function extractVersion(input: string): string | null;
export declare const chainRegistryChainToKeplr: (chain: Chain, assets: AssetList[], options?: {

@@ -4,0 +5,0 @@ getRpcEndpoint?: (chain: Chain) => string;

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.chainRegistryChainToKeplr = void 0;
exports.chainRegistryChainToKeplr = exports.extractVersion = void 0;
const cosmos_1 = require("@keplr-wallet/cosmos");

@@ -13,20 +13,50 @@ const semver_1 = __importDefault(require("semver"));

const getExplr = (chain) => chain.explorers?.[0]?.url ?? '';
const cleanVer = (ver) => {
if (!semver_1.default.valid(ver)) {
// try to split by @ for repo@version
ver = ver.split('@').pop();
if (semver_1.default.valid(ver))
return 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 @chain-registry/keplr maintainers: bad version');
}
const versionPatterns = {
fullSemver: /v?(\d+\.\d+\.\d+)(?=-[\w.-]+|$)/, // Matches complete semver patterns like '0.47.20' or 'v0.47.20'
partialSemver: /v?(\d+\.\d+)(?=(?:\.\d+)?(?=-[\w.-]+|$))/, // Matches partial semver patterns like '0.47' or 'v0.47'
basicVersion: /v?(\d+)(?=(?:\.\d+)?(?:\.\d+)?(?=-[\w.-]+|$))/, // Matches basic versions like '0' or 'v0'
tagged: /@v(\d+\.\d+)(?:\.x)?(?=-[\w.-]+|$)/, // Specific for tagged formats
embedded: /\/v(\d+\.\d+\.\d+)(?=-[\w.-]+|$)/, // For versions embedded in paths
simple: /v?(\d+)(?:\.(\d+))?(?:\.(\d+))?$/, // General simple versions
complexEmbedded: /[\w-]+\/[\w-]+ v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-\d+[\w.-]*)/, // Complex formats with namespaces
taggedVersion: /[\w-]+\/[\w-]+ v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?=-[\w.-]+|$)/ // Versions with descriptive tags
};
function extractVersion(input) {
let version = null;
// Check each pattern in turn
if (versionPatterns.fullSemver.test(input)) {
version = input.match(versionPatterns.fullSemver)?.[1];
}
};
else if (versionPatterns.partialSemver.test(input)) {
version = input.match(versionPatterns.partialSemver)?.[1];
}
else if (versionPatterns.basicVersion.test(input)) {
version = input.match(versionPatterns.basicVersion)?.[1];
}
else if (versionPatterns.taggedVersion.test(input)) {
version = input.match(versionPatterns.taggedVersion)?.[1];
}
else if (versionPatterns.complexEmbedded.test(input)) {
version = input.match(versionPatterns.complexEmbedded)?.[1];
}
else if (versionPatterns.simple.test(input)) {
version = input.match(versionPatterns.simple)?.[1];
}
else if (versionPatterns.tagged.test(input)) {
version = input.match(versionPatterns.tagged)?.[1];
}
else if (versionPatterns.embedded.test(input)) {
version = input.match(versionPatterns.embedded)?.[1];
}
return version ? normalizeVersion(version) : null;
}
exports.extractVersion = extractVersion;
function normalizeVersion(version) {
// Ensures the version is normalized to the 'x.y.z' format, if applicable
const parts = version.split('.');
while (parts.length < 3) {
parts.push('0');
}
return parts.join('.');
}
const chainRegistryChainToKeplr = (chain, assets, options = {

@@ -46,3 +76,3 @@ getRpcEndpoint: getRpc,

const sdkVer = chain.codebase?.cosmos_sdk_version
? cleanVer(chain.codebase?.cosmos_sdk_version)
? extractVersion(chain.codebase?.cosmos_sdk_version)
: '0.40';

@@ -62,3 +92,3 @@ // stargate

features.push('cosmwasm');
const wasmVer = cleanVer(chain.codebase.cosmwasm_version ?? '0.24');
const wasmVer = extractVersion(chain.codebase.cosmwasm_version ?? '0.24');
if (semver_1.default.satisfies(wasmVer, '>=0.24'))

@@ -65,0 +95,0 @@ features.push('wasmd_0.24+');

{
"name": "@chain-registry/keplr",
"version": "1.67.13",
"version": "1.68.0",
"description": "Chain Registry to Keplr",

@@ -32,6 +32,6 @@ "author": "Dan Lynch <pyramation@gmail.com>",

"@types/semver": "^7.5.8",
"chain-registry": "^1.62.13"
"chain-registry": "^1.63.0"
},
"dependencies": {
"@chain-registry/types": "^0.44.11",
"@chain-registry/types": "^0.45.0",
"@keplr-wallet/cosmos": "0.12.28",

@@ -48,3 +48,3 @@ "@keplr-wallet/crypto": "0.12.28",

],
"gitHead": "7ec3056386ff38d794c79fb9b8ca8db35e691b1c"
"gitHead": "dc905987a07f8cd36cb05a57e6b8e2d49caee2ef"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc