@keplr-wallet/cosmos
Advanced tools
Comparing version 0.8.5 to 0.8.6-0.9.0-alpha.0.0
import { Bech32Config } from "@keplr-wallet/types"; | ||
export declare class Bech32Address { | ||
protected readonly address: Uint8Array; | ||
readonly address: Uint8Array; | ||
static shortenAddress(bech32: string, maxCharacters: number): string; | ||
static fromBech32(bech32Address: string, prefix?: string): Bech32Address; | ||
static validate(bech32Address: string, prefix?: string): void; | ||
@@ -6,0 +7,0 @@ static defaultBech32Config(mainPrefix: string, validatorPrefix?: string, consensusPrefix?: string, publicPrefix?: string, operatorPrefix?: string): Bech32Config; |
@@ -38,2 +38,9 @@ "use strict"; | ||
} | ||
static fromBech32(bech32Address, prefix) { | ||
const decoded = bech32_1.default.decode(bech32Address); | ||
if (prefix && decoded.prefix !== prefix) { | ||
throw new Error("Unmatched prefix"); | ||
} | ||
return new Bech32Address(new Uint8Array(decoded.words)); | ||
} | ||
static validate(bech32Address, prefix) { | ||
@@ -40,0 +47,0 @@ const { prefix: decodedPrefix } = bech32_1.default.decode(bech32Address); |
{ | ||
"name": "@keplr-wallet/cosmos", | ||
"version": "0.8.5", | ||
"version": "0.8.6-0.9.0-alpha.0.0", | ||
"main": "build/index.js", | ||
@@ -15,14 +15,11 @@ "author": "chainapsis", | ||
"dev": "tsc -w", | ||
"test": "mocha --timeout 30000 -r ts-node/register 'src/**/*.spec.ts'", | ||
"test": "jest --passWithNoTests", | ||
"lint-test": "eslint \"src/**/*\" && prettier --check \"src/**/*\"", | ||
"lint-fix": "eslint --fix \"src/**/*\" && prettier --write \"src/**/*\"" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^8.2.1" | ||
}, | ||
"dependencies": { | ||
"@cosmjs/launchpad": "^0.24.0-alpha.25", | ||
"@keplr-wallet/common": "^0.8.5", | ||
"@keplr-wallet/types": "^0.8.5", | ||
"@keplr-wallet/unit": "^0.8.5", | ||
"@keplr-wallet/common": "^0.8.6-0.9.0-alpha.0.0", | ||
"@keplr-wallet/types": "^0.8.6-0.9.0-alpha.0.0", | ||
"@keplr-wallet/unit": "^0.8.6-0.9.0-alpha.0.0", | ||
"axios": "^0.21.0", | ||
@@ -34,3 +31,3 @@ "bech32": "^1.1.4", | ||
}, | ||
"gitHead": "19f924f8784f3afb47444139436cb1aae4e796ed" | ||
"gitHead": "c4a99f5dbc5a99de2e7b79fc64314feae46159e6" | ||
} |
@@ -37,2 +37,11 @@ import bech32 from "bech32"; | ||
static fromBech32(bech32Address: string, prefix?: string): Bech32Address { | ||
const decoded = bech32.decode(bech32Address); | ||
if (prefix && decoded.prefix !== prefix) { | ||
throw new Error("Unmatched prefix"); | ||
} | ||
return new Bech32Address(new Uint8Array(decoded.words)); | ||
} | ||
static validate(bech32Address: string, prefix?: string) { | ||
@@ -66,3 +75,3 @@ const { prefix: decodedPrefix } = bech32.decode(bech32Address); | ||
constructor(protected readonly address: Uint8Array) {} | ||
constructor(public readonly address: Uint8Array) {} | ||
@@ -69,0 +78,0 @@ toBech32(prefix: string): string { |
import assert from "assert"; | ||
import "mocha"; | ||
import { ProtoSignDocDecoder } from "./index"; | ||
@@ -4,0 +3,0 @@ |
Sorry, the diff of this file is not supported yet
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
3430740
0
87958
62