blockchainethereumsmart-contractssoliditytutorialdappweb3ethtruffleweb3jstransactionsigntransactionsignaturesign-datasignpublickeyprivatekeyethereum-identityencryptioncipher
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
431 B
16 lines
431 B
import { utils as ethersUtils } from 'ethers';
|
|
export function keccak256(params) {
|
|
var types = [];
|
|
var values = [];
|
|
if (!Array.isArray(params)) {
|
|
types.push('string');
|
|
values.push(params);
|
|
} else {
|
|
params.forEach(function (p) {
|
|
types.push(p.type);
|
|
values.push(p.value);
|
|
});
|
|
}
|
|
return ethersUtils.solidityKeccak256(types, values);
|
|
}
|
|
export var SIGN_PREFIX = '\x19Ethereum Signed Message:\n32'; |