@helium/address
Advanced tools
Comparing version 4.10.2 to 4.11.1-alpha.0
@@ -30,9 +30,9 @@ "use strict"; | ||
get b58() { | ||
return utils_1.bs58CheckEncode(this.version, this.bin); | ||
return (0, utils_1.bs58CheckEncode)(this.version, this.bin); | ||
} | ||
static fromB58(b58) { | ||
const version = utils_1.bs58Version(b58); | ||
const netType = utils_1.bs58NetType(b58); | ||
const keyType = utils_1.bs58KeyType(b58); | ||
const publicKey = utils_1.bs58PublicKey(b58); | ||
const version = (0, utils_1.bs58Version)(b58); | ||
const netType = (0, utils_1.bs58NetType)(b58); | ||
const keyType = (0, utils_1.bs58KeyType)(b58); | ||
const publicKey = (0, utils_1.bs58PublicKey)(b58); | ||
return new Address(version, netType, keyType, publicKey); | ||
@@ -43,4 +43,4 @@ } | ||
const byte = bin[0]; | ||
const netType = utils_1.byteToNetType(byte); | ||
const keyType = utils_1.byteToKeyType(byte); | ||
const netType = (0, utils_1.byteToNetType)(byte); | ||
const keyType = (0, utils_1.byteToKeyType)(byte); | ||
const publicKey = bin.slice(1, bin.length); | ||
@@ -47,0 +47,0 @@ return new Address(version, netType, keyType, publicKey); |
@@ -9,3 +9,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -12,0 +16,0 @@ if (k2 === undefined) k2 = k; |
@@ -7,3 +7,3 @@ export declare const ECC_COMPACT_KEY_TYPE = 0; | ||
export declare const SUPPORTED_KEY_TYPES: number[]; | ||
export declare type KeyType = number; | ||
export type KeyType = number; | ||
//# sourceMappingURL=KeyTypes.d.ts.map |
@@ -36,11 +36,11 @@ "use strict"; | ||
static fromB58(b58) { | ||
const keyType = utils_1.bs58KeyType(b58); | ||
const keyType = (0, utils_1.bs58KeyType)(b58); | ||
if (keyType !== KeyTypes_1.MULTISIG_KEY_TYPE) { | ||
throw new Error('invalid keytype for multisig address'); | ||
} | ||
const version = utils_1.bs58Version(b58); | ||
const netType = utils_1.bs58NetType(b58); | ||
const M = utils_1.bs58M(b58); | ||
const N = utils_1.bs58N(b58); | ||
const publicKey = utils_1.bs58MultisigPublicKey(b58); | ||
const version = (0, utils_1.bs58Version)(b58); | ||
const netType = (0, utils_1.bs58NetType)(b58); | ||
const M = (0, utils_1.bs58M)(b58); | ||
const N = (0, utils_1.bs58N)(b58); | ||
const publicKey = (0, utils_1.bs58MultisigPublicKey)(b58); | ||
return new MultisigAddress(version, netType, M, N, publicKey); | ||
@@ -51,4 +51,4 @@ } | ||
const byte = bin[0]; | ||
const netType = utils_1.byteToNetType(byte); | ||
const keyType = utils_1.byteToKeyType(byte); | ||
const netType = (0, utils_1.byteToNetType)(byte); | ||
const keyType = (0, utils_1.byteToKeyType)(byte); | ||
if (keyType !== KeyTypes_1.MULTISIG_KEY_TYPE) { | ||
@@ -67,3 +67,3 @@ throw new Error('invalid keytype for multisig address'); | ||
const version = 0; | ||
const multisigPubKeysBin = utils_1.sortAddresses(addresses).map((address) => address.bin); | ||
const multisigPubKeysBin = (0, utils_1.sortAddresses)(addresses).map((address) => address.bin); | ||
const publicKey = (await sha2_1.sha256.digest(multisigPubKeysBin.reduce((acc, curVal) => new Uint8Array([...acc, ...curVal]), new Uint8Array()))); | ||
@@ -70,0 +70,0 @@ return new MultisigAddress(version, netType || NetTypes_1.MAINNET, M, addresses.length, publicKey.bytes); |
export declare const MAINNET = 0; | ||
export declare const TESTNET = 16; | ||
export declare const SUPPORTED_NET_TYPES: number[]; | ||
export declare type NetType = number; | ||
export type NetType = number; | ||
//# sourceMappingURL=NetTypes.d.ts.map |
@@ -15,3 +15,3 @@ "use strict"; | ||
]); | ||
const checksum = js_sha256_1.sha256(Buffer.from(js_sha256_1.sha256(vPayload), 'hex')); | ||
const checksum = (0, js_sha256_1.sha256)(Buffer.from((0, js_sha256_1.sha256)(vPayload), 'hex')); | ||
const checksumBytes = Buffer.alloc(4, checksum, 'hex'); | ||
@@ -30,3 +30,3 @@ const result = Buffer.concat([ | ||
const checksum = bin.slice(-4); | ||
const checksumVerify = js_sha256_1.sha256(Buffer.from(js_sha256_1.sha256(vPayload), 'hex')); | ||
const checksumVerify = (0, js_sha256_1.sha256)(Buffer.from((0, js_sha256_1.sha256)(vPayload), 'hex')); | ||
const checksumVerifyBytes = Buffer.alloc(4, checksumVerify, 'hex'); | ||
@@ -44,11 +44,11 @@ if (!checksumVerifyBytes.equals(Buffer.from(checksum))) { | ||
const bs58NetType = (bs58Address) => { | ||
const bin = exports.bs58ToBin(bs58Address); | ||
const bin = (0, exports.bs58ToBin)(bs58Address); | ||
const byte = Buffer.from(bin).slice(0, 1)[0]; | ||
return exports.byteToNetType(byte); | ||
return (0, exports.byteToNetType)(byte); | ||
}; | ||
exports.bs58NetType = bs58NetType; | ||
const bs58KeyType = (bs58Address) => { | ||
const bin = exports.bs58ToBin(bs58Address); | ||
const bin = (0, exports.bs58ToBin)(bs58Address); | ||
const byte = Buffer.from(bin).slice(0, 1)[0]; | ||
return exports.byteToKeyType(byte); | ||
return (0, exports.byteToKeyType)(byte); | ||
}; | ||
@@ -63,3 +63,3 @@ exports.bs58KeyType = bs58KeyType; | ||
const bs58PublicKey = (bs58Address) => { | ||
const bin = exports.bs58ToBin(bs58Address); | ||
const bin = (0, exports.bs58ToBin)(bs58Address); | ||
const publicKey = Buffer.from(bin).slice(1); | ||
@@ -70,3 +70,3 @@ return publicKey; | ||
const bs58M = (bs58Address) => { | ||
const bin = exports.bs58ToBin(bs58Address); | ||
const bin = (0, exports.bs58ToBin)(bs58Address); | ||
const M = bin[1]; | ||
@@ -77,3 +77,3 @@ return M; | ||
const bs58N = (bs58Address) => { | ||
const bin = exports.bs58ToBin(bs58Address); | ||
const bin = (0, exports.bs58ToBin)(bs58Address); | ||
const N = bin[2]; | ||
@@ -84,3 +84,3 @@ return N; | ||
const bs58MultisigPublicKey = (bs58Address) => { | ||
const bin = exports.bs58ToBin(bs58Address); | ||
const bin = (0, exports.bs58ToBin)(bs58Address); | ||
const publicKey = Buffer.from(bin).slice(3); | ||
@@ -87,0 +87,0 @@ return publicKey; |
{ | ||
"name": "@helium/address", | ||
"version": "4.10.2", | ||
"version": "4.11.1-alpha.0", | ||
"description": "Helium public key utilities", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "48d167f9fbc9a5d304e9366d508f06704e5a4a1e", | ||
"gitHead": "9701c9e1bc21969f5e374712cc314702bd4b5708", | ||
"dependencies": { | ||
@@ -31,0 +31,0 @@ "bs58": "^5.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
39525
356
0
1