pull/675/head
pubkey 2 years ago
parent d4f5f70a61
commit 0bc0bf95de
  1. 2
      dist/es/calculate-contract-address.js
  2. 2
      dist/es/create-identity.js
  3. 2
      dist/es/decrypt-with-private-key.js
  4. 2
      dist/es/encrypt-with-public-key.js
  5. 20
      dist/es/index.js
  6. 2
      dist/es/public-key-by-private-key.js
  7. 2
      dist/es/recover-public-key.js
  8. 4
      dist/es/recover.js
  9. 4
      dist/es/sign-transaction.js
  10. 2
      dist/es/sign.js
  11. 2
      dist/es/tx-data-by-compiled.js
  12. 2
      dist/lib/calculate-contract-address.js
  13. 2
      dist/lib/create-identity.js
  14. 2
      dist/lib/decrypt-with-private-key.js
  15. 2
      dist/lib/encrypt-with-public-key.js
  16. 61
      dist/lib/index.js
  17. 4
      dist/lib/public-key-by-private-key.js
  18. 2
      dist/lib/recover-public-key.js
  19. 7
      dist/lib/recover.js
  20. 7
      dist/lib/sign-transaction.js
  21. 2
      dist/lib/sign.js
  22. 2
      dist/lib/tx-data-by-compiled.js
  23. 2
      package.json
  24. 3
      perf.txt

@ -1,6 +1,6 @@
import { generateAddress, toChecksumAddress, toBuffer } from 'ethereumjs-util'; import { generateAddress, toChecksumAddress, toBuffer } from 'ethereumjs-util';
import { addLeading0x } from './util'; import { addLeading0x } from './util';
export default function calculateContractAddress(creatorAddress, nonce) { export function calculateContractAddress(creatorAddress, nonce) {
var addressBuffer = generateAddress(toBuffer(addLeading0x(creatorAddress)), toBuffer(nonce)); var addressBuffer = generateAddress(toBuffer(addLeading0x(creatorAddress)), toBuffer(nonce));
var address = addressBuffer.toString('hex'); var address = addressBuffer.toString('hex');
return toChecksumAddress(addLeading0x(address)); return toChecksumAddress(addLeading0x(address));

@ -27,7 +27,7 @@ export function createPrivateKey(entropy) {
* private-, public-Key and address * private-, public-Key and address
* @param {Buffer?} entropy if provided, will use that as single random-source * @param {Buffer?} entropy if provided, will use that as single random-source
*/ */
export default function createIdentity(entropy) { export function createIdentity(entropy) {
var privateKey = createPrivateKey(entropy); var privateKey = createPrivateKey(entropy);
var wallet = new Wallet(privateKey); var wallet = new Wallet(privateKey);
var identity = { var identity = {

@ -1,7 +1,7 @@
import { decrypt } from 'eccrypto'; import { decrypt } from 'eccrypto';
import { parse } from './cipher'; import { parse } from './cipher';
import { removeLeading0x } from './util'; import { removeLeading0x } from './util';
export default function decryptWithPrivateKey(privateKey, encrypted) { export function decryptWithPrivateKey(privateKey, encrypted) {
encrypted = parse(encrypted); encrypted = parse(encrypted);
// remove trailing '0x' from privateKey // remove trailing '0x' from privateKey

@ -1,6 +1,6 @@
import { encrypt } from 'eccrypto'; import { encrypt } from 'eccrypto';
import { decompress } from './public-key'; import { decompress } from './public-key';
export default function encryptWithPublicKey(publicKey, message, opts) { export function encryptWithPublicKey(publicKey, message, opts) {
// ensure its an uncompressed publicKey // ensure its an uncompressed publicKey
publicKey = decompress(publicKey); publicKey = decompress(publicKey);

20
dist/es/index.js vendored

@ -1,15 +1,15 @@
import createIdentity from './create-identity'; import { createIdentity } from './create-identity';
import * as publicKey from './public-key'; import * as publicKey from './public-key';
import decryptWithPrivateKey from './decrypt-with-private-key'; import { decryptWithPrivateKey } from './decrypt-with-private-key';
import encryptWithPublicKey from './encrypt-with-public-key'; import { encryptWithPublicKey } from './encrypt-with-public-key';
import * as cipher from './cipher'; import * as cipher from './cipher';
import publicKeyByPrivateKey from './public-key-by-private-key'; import { publicKeyByPrivateKey } from './public-key-by-private-key';
import recover from './recover'; import { recover } from './recover';
import recoverPublicKey from './recover-public-key'; import { recoverPublicKey } from './recover-public-key';
import sign from './sign'; import { sign } from './sign';
import signTransaction from './sign-transaction'; import { signTransaction } from './sign-transaction';
import txDataByCompiled from './tx-data-by-compiled'; import { txDataByCompiled } from './tx-data-by-compiled';
import calculateContractAddress from './calculate-contract-address'; import { calculateContractAddress } from './calculate-contract-address';
import * as hash from './hash'; import * as hash from './hash';
import * as hex from './hex'; import * as hex from './hex';
import * as vrs from './vrs'; import * as vrs from './vrs';

@ -7,7 +7,7 @@ import { addLeading0x } from './util';
* where 04 has stripped from left * where 04 has stripped from left
* @returns {string} * @returns {string}
*/ */
export default function publicKeyOfPrivateKey(privateKey) { export function publicKeyByPrivateKey(privateKey) {
privateKey = addLeading0x(privateKey); privateKey = addLeading0x(privateKey);
var publicKeyBuffer = privateToPublic(toBuffer(privateKey)); var publicKeyBuffer = privateToPublic(toBuffer(privateKey));
return publicKeyBuffer.toString('hex'); return publicKeyBuffer.toString('hex');

@ -7,7 +7,7 @@ import { removeLeading0x, hexToUnit8Array, uint8ArrayToHex } from './util';
* @param {string} hash * @param {string} hash
* @return {string} publicKey * @return {string} publicKey
*/ */
export default function recoverPublicKey(signature, hash) { export function recoverPublicKey(signature, hash) {
signature = removeLeading0x(signature); signature = removeLeading0x(signature);
// split into v-value and sig // split into v-value and sig

@ -1,4 +1,4 @@
import recoverPublicKey from './recover-public-key'; import { recoverPublicKey } from './recover-public-key';
import { toAddress as addressByPublicKey } from './public-key'; import { toAddress as addressByPublicKey } from './public-key';
/** /**
@ -7,7 +7,7 @@ import { toAddress as addressByPublicKey } from './public-key';
* @param {string} hash * @param {string} hash
* @return {string} address * @return {string} address
*/ */
export default function recover(sigString, hash) { export function recover(sigString, hash) {
var pubkey = recoverPublicKey(sigString, hash); var pubkey = recoverPublicKey(sigString, hash);
var address = addressByPublicKey(pubkey); var address = addressByPublicKey(pubkey);
return address; return address;

@ -1,7 +1,7 @@
import { Transaction } from '@ethereumjs/tx'; import { Transaction } from '@ethereumjs/tx';
import publicKeyByPrivateKey from './public-key-by-private-key'; import { publicKeyByPrivateKey } from './public-key-by-private-key';
import { toAddress as addressByPublicKey } from './public-key'; import { toAddress as addressByPublicKey } from './public-key';
export default function signTransaction(rawTx, privateKey) { export function signTransaction(rawTx, privateKey) {
var txOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var txOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
// check if privateKey->address matches rawTx.from // check if privateKey->address matches rawTx.from
var publicKey = publicKeyByPrivateKey(privateKey); var publicKey = publicKeyByPrivateKey(privateKey);

2
dist/es/sign.js vendored

@ -8,7 +8,7 @@ import { addLeading0x, removeLeading0x } from './util';
* @param {string} hash * @param {string} hash
* @return {string} hexString * @return {string} hexString
*/ */
export default function sign(privateKey, hash) { export function sign(privateKey, hash) {
hash = addLeading0x(hash); hash = addLeading0x(hash);
if (hash.length !== 66) throw new Error('EthCrypto.sign(): Can only sign hashes, given: ' + hash); if (hash.length !== 66) throw new Error('EthCrypto.sign(): Can only sign hashes, given: ' + hash);
var sigObj = secp256k1_sign(new Uint8Array(Buffer.from(removeLeading0x(hash), 'hex')), new Uint8Array(Buffer.from(removeLeading0x(privateKey), 'hex'))); var sigObj = secp256k1_sign(new Uint8Array(Buffer.from(removeLeading0x(hash), 'hex')), new Uint8Array(Buffer.from(removeLeading0x(privateKey), 'hex')));

@ -1,6 +1,6 @@
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
import { ContractFactory } from 'ethers'; import { ContractFactory } from 'ethers';
export default function txDataByCompiled(abi, bytecode, args) { export function txDataByCompiled(abi, bytecode, args) {
// solc returns a string which is often passed instead of the json // solc returns a string which is often passed instead of the json
if (typeof abi === 'string') abi = JSON.parse(abi); if (typeof abi === 'string') abi = JSON.parse(abi);

@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports["default"] = calculateContractAddress; exports.calculateContractAddress = calculateContractAddress;
var _ethereumjsUtil = require("ethereumjs-util"); var _ethereumjsUtil = require("ethereumjs-util");
var _util = require("./util"); var _util = require("./util");
function calculateContractAddress(creatorAddress, nonce) { function calculateContractAddress(creatorAddress, nonce) {

@ -3,8 +3,8 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.createIdentity = createIdentity;
exports.createPrivateKey = createPrivateKey; exports.createPrivateKey = createPrivateKey;
exports["default"] = createIdentity;
var _ethers = require("ethers"); var _ethers = require("ethers");
var _ethereumjsUtil = require("ethereumjs-util"); var _ethereumjsUtil = require("ethereumjs-util");
var MIN_ENTROPY_SIZE = 128; var MIN_ENTROPY_SIZE = 128;

@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports["default"] = decryptWithPrivateKey; exports.decryptWithPrivateKey = decryptWithPrivateKey;
var _eccrypto = require("eccrypto"); var _eccrypto = require("eccrypto");
var _cipher = require("./cipher"); var _cipher = require("./cipher");
var _util = require("./util"); var _util = require("./util");

@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports["default"] = encryptWithPublicKey; exports.encryptWithPublicKey = encryptWithPublicKey;
var _eccrypto = require("eccrypto"); var _eccrypto = require("eccrypto");
var _publicKey = require("./public-key"); var _publicKey = require("./public-key");
function encryptWithPublicKey(publicKey, message, opts) { function encryptWithPublicKey(publicKey, message, opts) {

61
dist/lib/index.js vendored

@ -1,6 +1,5 @@
"use strict"; "use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof"); var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
@ -8,81 +7,81 @@ Object.defineProperty(exports, "__esModule", {
Object.defineProperty(exports, "calculateContractAddress", { Object.defineProperty(exports, "calculateContractAddress", {
enumerable: true, enumerable: true,
get: function get() { get: function get() {
return _calculateContractAddress["default"]; return _calculateContractAddress.calculateContractAddress;
} }
}); });
exports.cipher = void 0; exports.cipher = void 0;
Object.defineProperty(exports, "createIdentity", { Object.defineProperty(exports, "createIdentity", {
enumerable: true, enumerable: true,
get: function get() { get: function get() {
return _createIdentity["default"]; return _createIdentity.createIdentity;
} }
}); });
Object.defineProperty(exports, "decryptWithPrivateKey", { Object.defineProperty(exports, "decryptWithPrivateKey", {
enumerable: true, enumerable: true,
get: function get() { get: function get() {
return _decryptWithPrivateKey["default"]; return _decryptWithPrivateKey.decryptWithPrivateKey;
} }
}); });
exports["default"] = void 0; exports["default"] = void 0;
Object.defineProperty(exports, "encryptWithPublicKey", { Object.defineProperty(exports, "encryptWithPublicKey", {
enumerable: true, enumerable: true,
get: function get() { get: function get() {
return _encryptWithPublicKey["default"]; return _encryptWithPublicKey.encryptWithPublicKey;
} }
}); });
exports.publicKey = exports.hex = exports.hash = void 0; exports.publicKey = exports.hex = exports.hash = void 0;
Object.defineProperty(exports, "publicKeyByPrivateKey", { Object.defineProperty(exports, "publicKeyByPrivateKey", {
enumerable: true, enumerable: true,
get: function get() { get: function get() {
return _publicKeyByPrivateKey["default"]; return _publicKeyByPrivateKey.publicKeyByPrivateKey;
} }
}); });
Object.defineProperty(exports, "recover", { Object.defineProperty(exports, "recover", {
enumerable: true, enumerable: true,
get: function get() { get: function get() {
return _recover["default"]; return _recover.recover;
} }
}); });
Object.defineProperty(exports, "recoverPublicKey", { Object.defineProperty(exports, "recoverPublicKey", {
enumerable: true, enumerable: true,
get: function get() { get: function get() {
return _recoverPublicKey["default"]; return _recoverPublicKey.recoverPublicKey;
} }
}); });
Object.defineProperty(exports, "sign", { Object.defineProperty(exports, "sign", {
enumerable: true, enumerable: true,
get: function get() { get: function get() {
return _sign["default"]; return _sign.sign;
} }
}); });
Object.defineProperty(exports, "signTransaction", { Object.defineProperty(exports, "signTransaction", {
enumerable: true, enumerable: true,
get: function get() { get: function get() {
return _signTransaction["default"]; return _signTransaction.signTransaction;
} }
}); });
Object.defineProperty(exports, "txDataByCompiled", { Object.defineProperty(exports, "txDataByCompiled", {
enumerable: true, enumerable: true,
get: function get() { get: function get() {
return _txDataByCompiled["default"]; return _txDataByCompiled.txDataByCompiled;
} }
}); });
exports.vrs = exports.util = void 0; exports.vrs = exports.util = void 0;
var _createIdentity = _interopRequireDefault(require("./create-identity")); var _createIdentity = require("./create-identity");
var publicKey = _interopRequireWildcard(require("./public-key")); var publicKey = _interopRequireWildcard(require("./public-key"));
exports.publicKey = publicKey; exports.publicKey = publicKey;
var _decryptWithPrivateKey = _interopRequireDefault(require("./decrypt-with-private-key")); var _decryptWithPrivateKey = require("./decrypt-with-private-key");
var _encryptWithPublicKey = _interopRequireDefault(require("./encrypt-with-public-key")); var _encryptWithPublicKey = require("./encrypt-with-public-key");
var cipher = _interopRequireWildcard(require("./cipher")); var cipher = _interopRequireWildcard(require("./cipher"));
exports.cipher = cipher; exports.cipher = cipher;
var _publicKeyByPrivateKey = _interopRequireDefault(require("./public-key-by-private-key")); var _publicKeyByPrivateKey = require("./public-key-by-private-key");
var _recover = _interopRequireDefault(require("./recover")); var _recover = require("./recover");
var _recoverPublicKey = _interopRequireDefault(require("./recover-public-key")); var _recoverPublicKey = require("./recover-public-key");
var _sign = _interopRequireDefault(require("./sign")); var _sign = require("./sign");
var _signTransaction = _interopRequireDefault(require("./sign-transaction")); var _signTransaction = require("./sign-transaction");
var _txDataByCompiled = _interopRequireDefault(require("./tx-data-by-compiled")); var _txDataByCompiled = require("./tx-data-by-compiled");
var _calculateContractAddress = _interopRequireDefault(require("./calculate-contract-address")); var _calculateContractAddress = require("./calculate-contract-address");
var hash = _interopRequireWildcard(require("./hash")); var hash = _interopRequireWildcard(require("./hash"));
exports.hash = hash; exports.hash = hash;
var hex = _interopRequireWildcard(require("./hex")); var hex = _interopRequireWildcard(require("./hex"));
@ -94,18 +93,18 @@ exports.util = util;
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var _default = { var _default = {
createIdentity: _createIdentity["default"], createIdentity: _createIdentity.createIdentity,
publicKey: publicKey, publicKey: publicKey,
decryptWithPrivateKey: _decryptWithPrivateKey["default"], decryptWithPrivateKey: _decryptWithPrivateKey.decryptWithPrivateKey,
encryptWithPublicKey: _encryptWithPublicKey["default"], encryptWithPublicKey: _encryptWithPublicKey.encryptWithPublicKey,
cipher: cipher, cipher: cipher,
publicKeyByPrivateKey: _publicKeyByPrivateKey["default"], publicKeyByPrivateKey: _publicKeyByPrivateKey.publicKeyByPrivateKey,
recover: _recover["default"], recover: _recover.recover,
recoverPublicKey: _recoverPublicKey["default"], recoverPublicKey: _recoverPublicKey.recoverPublicKey,
sign: _sign["default"], sign: _sign.sign,
signTransaction: _signTransaction["default"], signTransaction: _signTransaction.signTransaction,
txDataByCompiled: _txDataByCompiled["default"], txDataByCompiled: _txDataByCompiled.txDataByCompiled,
calculateContractAddress: _calculateContractAddress["default"], calculateContractAddress: _calculateContractAddress.calculateContractAddress,
hash: hash, hash: hash,
hex: hex, hex: hex,
vrs: vrs, vrs: vrs,

@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports["default"] = publicKeyOfPrivateKey; exports.publicKeyByPrivateKey = publicKeyByPrivateKey;
var _ethereumjsUtil = require("ethereumjs-util"); var _ethereumjsUtil = require("ethereumjs-util");
var _util = require("./util"); var _util = require("./util");
/** /**
@ -12,7 +12,7 @@ var _util = require("./util");
* where 04 has stripped from left * where 04 has stripped from left
* @returns {string} * @returns {string}
*/ */
function publicKeyOfPrivateKey(privateKey) { function publicKeyByPrivateKey(privateKey) {
privateKey = (0, _util.addLeading0x)(privateKey); privateKey = (0, _util.addLeading0x)(privateKey);
var publicKeyBuffer = (0, _ethereumjsUtil.privateToPublic)((0, _ethereumjsUtil.toBuffer)(privateKey)); var publicKeyBuffer = (0, _ethereumjsUtil.privateToPublic)((0, _ethereumjsUtil.toBuffer)(privateKey));
return publicKeyBuffer.toString('hex'); return publicKeyBuffer.toString('hex');

@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports["default"] = recoverPublicKey; exports.recoverPublicKey = recoverPublicKey;
var _secp256k = require("secp256k1"); var _secp256k = require("secp256k1");
var _util = require("./util"); var _util = require("./util");
/** /**

@ -1,11 +1,10 @@
"use strict"; "use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports["default"] = recover; exports.recover = recover;
var _recoverPublicKey = _interopRequireDefault(require("./recover-public-key")); var _recoverPublicKey = require("./recover-public-key");
var _publicKey = require("./public-key"); var _publicKey = require("./public-key");
/** /**
* returns the adress with which the messageHash was signed * returns the adress with which the messageHash was signed
@ -14,7 +13,7 @@ var _publicKey = require("./public-key");
* @return {string} address * @return {string} address
*/ */
function recover(sigString, hash) { function recover(sigString, hash) {
var pubkey = (0, _recoverPublicKey["default"])(sigString, hash); var pubkey = (0, _recoverPublicKey.recoverPublicKey)(sigString, hash);
var address = (0, _publicKey.toAddress)(pubkey); var address = (0, _publicKey.toAddress)(pubkey);
return address; return address;
} }

@ -1,17 +1,16 @@
"use strict"; "use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports["default"] = signTransaction; exports.signTransaction = signTransaction;
var _tx = require("@ethereumjs/tx"); var _tx = require("@ethereumjs/tx");
var _publicKeyByPrivateKey = _interopRequireDefault(require("./public-key-by-private-key")); var _publicKeyByPrivateKey = require("./public-key-by-private-key");
var _publicKey = require("./public-key"); var _publicKey = require("./public-key");
function signTransaction(rawTx, privateKey) { function signTransaction(rawTx, privateKey) {
var txOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var txOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
// check if privateKey->address matches rawTx.from // check if privateKey->address matches rawTx.from
var publicKey = (0, _publicKeyByPrivateKey["default"])(privateKey); var publicKey = (0, _publicKeyByPrivateKey.publicKeyByPrivateKey)(privateKey);
var address = (0, _publicKey.toAddress)(publicKey); var address = (0, _publicKey.toAddress)(publicKey);
if (address != rawTx.from) throw new Error('EthCrypto.signTransaction(): rawTx.from does not match the address of the privateKey'); if (address != rawTx.from) throw new Error('EthCrypto.signTransaction(): rawTx.from does not match the address of the privateKey');
var privateKeyBuffer = Buffer.from(privateKey.replace(/^.{2}/g, ''), 'hex'); var privateKeyBuffer = Buffer.from(privateKey.replace(/^.{2}/g, ''), 'hex');

2
dist/lib/sign.js vendored

@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports["default"] = sign; exports.sign = sign;
var _secp256k = require("secp256k1"); var _secp256k = require("secp256k1");
var _util = require("./util"); var _util = require("./util");
/** /**

@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports["default"] = txDataByCompiled; exports.txDataByCompiled = txDataByCompiled;
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _ethers = require("ethers"); var _ethers = require("ethers");
function txDataByCompiled(abi, bytecode, args) { function txDataByCompiled(abi, bytecode, args) {

@ -1,6 +1,6 @@
{ {
"name": "eth-crypto", "name": "eth-crypto",
"version": "2.5.0", "version": "2.6.0",
"description": "Cryptographic functions for ethereum and how to use them with web3 and solidity", "description": "Cryptographic functions for ethereum and how to use them with web3 and solidity",
"keywords": [ "keywords": [
"ethereum", "ethereum",

@ -1,3 +0,0 @@
=== build size
BEFORE: 140000
AFTER: 123499
Loading…
Cancel
Save