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.
21 lines
604 B
21 lines
604 B
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.addLeading0x = addLeading0x;
|
|
exports.hexToUnit8Array = hexToUnit8Array;
|
|
exports.removeLeading0x = removeLeading0x;
|
|
exports.uint8ArrayToHex = uint8ArrayToHex;
|
|
function removeLeading0x(str) {
|
|
if (str.startsWith('0x')) return str.substring(2);else return str;
|
|
}
|
|
function addLeading0x(str) {
|
|
if (!str.startsWith('0x')) return '0x' + str;else return str;
|
|
}
|
|
function uint8ArrayToHex(arr) {
|
|
return Buffer.from(arr).toString('hex');
|
|
}
|
|
function hexToUnit8Array(str) {
|
|
return new Uint8Array(Buffer.from(str, 'hex'));
|
|
} |