Comparing version 0.0.40 to 0.0.41
@@ -9,5 +9,5 @@ interface Wallet { | ||
export declare function generateSeed(randomBytesFunc?: (x: number) => string): string; | ||
export declare function createCosmosAddress(publicKey: Uint8Array, path: string): string; | ||
export declare function generateWalletFromSeed(mnemonic: string, password: string, path: string): Promise<Wallet>; | ||
export declare function generateWallet(password: string, path: string, randomBytesFunc?: (x: number) => string): Promise<Wallet>; | ||
export declare function createCosmosAddress(publicKey: Uint8Array, prefix: string): string; | ||
export declare function generateWalletFromSeed(mnemonic: string, password: string, path: string, prefix: string): Promise<Wallet>; | ||
export declare function generateWallet(password: string, path: string, prefix: string, randomBytesFunc?: (x: number) => string): Promise<Wallet>; | ||
export {}; |
@@ -27,7 +27,7 @@ "use strict"; | ||
// NOTE: this only works with a compressed public key (33 bytes) | ||
function createCosmosAddress(publicKey, path) { | ||
function createCosmosAddress(publicKey, prefix) { | ||
var message = crypto_js_1.enc.Hex.parse(new Buffer(publicKey).toString('hex')); | ||
var hash = crypto_js_1.RIPEMD160(crypto_js_1.SHA256(message)).toString(); | ||
var address = Buffer.from(hash, "hex"); | ||
return bech32ify(address, path); | ||
return bech32ify(address, prefix); | ||
} | ||
@@ -60,3 +60,3 @@ exports.createCosmosAddress = createCosmosAddress; | ||
} | ||
function generateWalletFromSeed(mnemonic, password, path) { | ||
function generateWalletFromSeed(mnemonic, password, path, prefix) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
@@ -70,3 +70,3 @@ var masterKey, _a, privateKey, publicKey, address; | ||
_a = deriveKeypair(masterKey, path), privateKey = _a.privateKey, publicKey = _a.publicKey; | ||
address = createCosmosAddress(publicKey, path); | ||
address = createCosmosAddress(publicKey, prefix); | ||
return [2 /*return*/, { | ||
@@ -84,3 +84,3 @@ address: address, | ||
exports.generateWalletFromSeed = generateWalletFromSeed; | ||
function generateWallet(password, path, randomBytesFunc) { | ||
function generateWallet(password, path, prefix, randomBytesFunc) { | ||
if (randomBytesFunc === void 0) { randomBytesFunc = standardRandomBytesFunc; } | ||
@@ -93,3 +93,3 @@ return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
mnemonic = generateSeed(randomBytesFunc); | ||
return [4 /*yield*/, generateWalletFromSeed(mnemonic, password, path)]; | ||
return [4 /*yield*/, generateWalletFromSeed(mnemonic, password, path, prefix)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
@@ -101,2 +101,2 @@ } | ||
exports.generateWallet = generateWallet; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvc2VydmljZXMvc2RrL2V4dHJhL2NyeXB0by9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEscURBQWlDO0FBQ2pDLCtCQUFpRDtBQUNqRCwrQkFBNEU7QUFDNUUsdUNBQXdEO0FBQ3hELHVDQUE0QztBQWU1QyxJQUFNLHVCQUF1QixHQUEwQixVQUFDLENBQVM7SUFDaEUsT0FBQSxlQUFHLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQyxRQUFRLEVBQUU7QUFBbEMsQ0FBa0MsQ0FBQztBQUVwQyxTQUFTLFNBQVMsQ0FBQyxPQUEwQixFQUFFLE1BQWM7SUFDNUQsSUFBTSxLQUFLLEdBQWEsTUFBTSxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUVoRCxPQUFPLE1BQU0sQ0FBQyxNQUFNLENBQUMsTUFBTSxFQUFFLEtBQUssQ0FBQyxDQUFDO0FBQ3JDLENBQUM7QUFFRCxTQUFnQixZQUFZLENBQUMsZUFBZ0U7SUFBaEUsZ0NBQUEsRUFBQSx5Q0FBZ0U7SUFDNUYsSUFBTSxXQUFXLEdBQVcsTUFBTSxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsRUFBRSxDQUFD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QUFZLEVBQ1gsTUFBYyxFQUNmLGVBQWdFO0lBQWhFLGdDQUFBLEVBQUEseUNBQWdFOzs7Ozs7b0JBRTFELFFBQVEsR0FBVyxZQUFZLENBQUMsZUFBZSxDQUFDLENBQUM7b0JBRWhELHFCQUFNLHNCQUFzQixDQUFDLFFBQVEsRUFBRSxRQUFRLEVBQUUsSUFBSSxFQUFFLE1BQU0sQ0FBQyxFQUFBO3dCQUFyRSxzQkFBTyxTQUE4RCxFQUFDOzs7O0NBQ3RFO0FBVEQsd0NBU0MifQ== |
@@ -27,3 +27,3 @@ { | ||
"name": "dfin-jsdk", | ||
"version": "0.0.40" | ||
"version": "0.0.41" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
3831932
12982