mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-22 14:57:56 +00:00
chore: update to version 14.0.11 and align website URLs
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.evmToAddress = evmToAddress;
|
||||
const util_1 = require("@pezkuwi/util");
|
||||
const hasher_js_1 = require("../secp256k1/hasher.js");
|
||||
const encode_js_1 = require("./encode.js");
|
||||
/**
|
||||
* @name evmToAddress
|
||||
* @summary Converts an EVM address to its corresponding SS58 address.
|
||||
*/
|
||||
function evmToAddress(evmAddress, ss58Format, hashType = 'blake2') {
|
||||
const message = (0, util_1.u8aConcat)('evm:', evmAddress);
|
||||
if (message.length !== 24) {
|
||||
throw new Error(`Converting ${evmAddress}: Invalid evm address length`);
|
||||
}
|
||||
return (0, encode_js_1.encodeAddress)((0, hasher_js_1.hasher)(hashType, message), ss58Format);
|
||||
}
|
||||
Reference in New Issue
Block a user