UNPKG

eth-crypto

Version:

Cryptographic functions for ethereum and how to use them with web3 and solidity

22 lines (18 loc) 476 B
import { utils as ethersUtils } from 'ethers'; export function keccak256(params) { const types = []; const values = []; if (!Array.isArray(params)) { types.push('string'); values.push(params); }else { params.forEach(p => { types.push(p.type); values.push(p.value); }); } return ethersUtils.solidityKeccak256(types, values); } export const SIGN_PREFIX = '\x19Ethereum Signed Message:\n32';