@keplr-wallet/common
Advanced tools
Comparing version 0.9.0-alpha.4 to 0.9.0-alpha.6
export declare class DenomHelper { | ||
protected readonly _denom: string; | ||
static ibcDenom(paths: { | ||
portId: string; | ||
channelId: string; | ||
}[], coinMinimalDenom: string): string; | ||
protected readonly _type: string; | ||
@@ -4,0 +8,0 @@ protected readonly _contractAddress: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DenomHelper = void 0; | ||
const buffer_1 = require("buffer/"); | ||
const crypto_1 = require("@keplr-wallet/crypto"); | ||
class DenomHelper { | ||
@@ -15,2 +17,14 @@ constructor(_denom) { | ||
} | ||
static ibcDenom(paths, coinMinimalDenom) { | ||
const prefixes = []; | ||
for (const path of paths) { | ||
prefixes.push(`${path.portId}/${path.channelId}`); | ||
} | ||
const prefix = prefixes.join("/"); | ||
const denom = `${prefix}/${coinMinimalDenom}`; | ||
return ("ibc/" + | ||
buffer_1.Buffer.from(crypto_1.Hash.sha256(buffer_1.Buffer.from(denom))) | ||
.toString("hex") | ||
.toUpperCase()); | ||
} | ||
get denom() { | ||
@@ -17,0 +31,0 @@ return this._denom; |
{ | ||
"name": "@keplr-wallet/common", | ||
"version": "0.9.0-alpha.4", | ||
"version": "0.9.0-alpha.6", | ||
"main": "build/index.js", | ||
@@ -20,5 +20,7 @@ "author": "chainapsis", | ||
"dependencies": { | ||
"@keplr-wallet/crypto": "^0.9.0-alpha.6", | ||
"buffer": "^6.0.3", | ||
"delay": "^4.4.0" | ||
}, | ||
"gitHead": "6c196a5f457949b646657eb5d62555c3ff066300" | ||
"gitHead": "f11fdd3d5c968bf408431eeb50e9f3c251b18bcb" | ||
} |
@@ -0,2 +1,28 @@ | ||
import { Buffer } from "buffer/"; | ||
import { Hash } from "@keplr-wallet/crypto"; | ||
export class DenomHelper { | ||
static ibcDenom( | ||
paths: { | ||
portId: string; | ||
channelId: string; | ||
}[], | ||
coinMinimalDenom: string | ||
): string { | ||
const prefixes: string[] = []; | ||
for (const path of paths) { | ||
prefixes.push(`${path.portId}/${path.channelId}`); | ||
} | ||
const prefix = prefixes.join("/"); | ||
const denom = `${prefix}/${coinMinimalDenom}`; | ||
return ( | ||
"ibc/" + | ||
Buffer.from(Hash.sha256(Buffer.from(denom))) | ||
.toString("hex") | ||
.toUpperCase() | ||
); | ||
} | ||
protected readonly _type: string; | ||
@@ -3,0 +29,0 @@ protected readonly _contractAddress: string; |
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
53771
66
871
3
+ Addedbuffer@^6.0.3
+ Added@keplr-wallet/crypto@0.9.10(transitive)
+ Added@noble/hashes@1.5.0(transitive)
+ Added@types/node@10.12.18(transitive)
+ Addedbase-x@3.0.10(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbindings@1.5.0(transitive)
+ Addedbip32@2.0.6(transitive)
+ Addedbip39@3.1.0(transitive)
+ Addedbn.js@4.12.0(transitive)
+ Addedbrorand@1.1.0(transitive)
+ Addedbs58@4.0.1(transitive)
+ Addedbs58check@2.1.2(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedcipher-base@1.0.4(transitive)
+ Addedcreate-hash@1.2.0(transitive)
+ Addedcreate-hmac@1.1.7(transitive)
+ Addedcrypto-js@4.2.0(transitive)
+ Addedelliptic@6.5.7(transitive)
+ Addedfile-uri-to-path@1.0.0(transitive)
+ Addedhash-base@3.1.0(transitive)
+ Addedhash.js@1.1.7(transitive)
+ Addedhmac-drbg@1.0.1(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedmd5.js@1.3.5(transitive)
+ Addedminimalistic-assert@1.0.1(transitive)
+ Addedminimalistic-crypto-utils@1.0.1(transitive)
+ Addednan@2.20.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedripemd160@2.0.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsha.js@2.4.11(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedtiny-secp256k1@1.1.6(transitive)
+ Addedtypeforce@1.18.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwif@2.0.6(transitive)