UNPKG

@eth-optimism/ethereumjs-vm

Version:
24 lines 806 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toAddressBuf = exports.fromHexString = exports.toHexString = exports.toHexAddress = void 0; exports.toHexAddress = function (buf) { // pad shorter values out if (buf.length < 20) { buf = Buffer.concat([Buffer.alloc(31), buf]); } return ('0x' + buf .slice(buf.length - 20) .toString('hex') .padStart(40, '0')); }; exports.toHexString = function (buf) { return '0x' + buf.toString('hex'); }; exports.fromHexString = function (str) { return Buffer.from(str.slice(2), 'hex'); }; exports.toAddressBuf = function (address) { return typeof address === 'string' ? exports.fromHexString(address) : address; }; //# sourceMappingURL=buffer-utils.js.map