Socket
Socket
Sign inDemoInstall

@ethereumjs/tx

Package Overview
Dependencies
44
Maintainers
6
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.3 to 3.1.4

4

CHANGELOG.md

@@ -9,2 +9,6 @@ # Changelog

## 3.1.4 - 2021-04-22
- Added a new boolean `hashMessage` parameter (defaulting to `true`) to `getMessageToSign()` to allow for returning the raw unsigned `EIP-155` tx and not only the hash, PR [#1188](https://github.com/ethereumjs/ethereumjs-monorepo/issues/1188)
## 3.1.3 - 2021-04-09

@@ -11,0 +15,0 @@

7

dist.browser/baseTransaction.d.ts

@@ -66,5 +66,8 @@ /// <reference types="bn.js" />

/**
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
* Returns the serialized unsigned tx (hashed or raw), which is used to sign the transaction.
*
* @param hashMessage - Return hashed message if set to true (default: true)
*/
abstract getMessageToSign(): Buffer;
abstract getMessageToSign(hashMessage: false): Buffer[];
abstract getMessageToSign(hashMessage?: true): Buffer;
abstract hash(): Buffer;

@@ -71,0 +74,0 @@ abstract getMessageToVerifySignature(): Buffer;

@@ -171,3 +171,3 @@ "use strict";

}
var msgHash = this.getMessageToSign();
var msgHash = this.getMessageToSign(true);
var _a = ethereumjs_util_1.ecsign(msgHash, privateKey), v = _a.v, r = _a.r, s = _a.s;

@@ -174,0 +174,0 @@ return this._processSignature(v, r, s);

@@ -78,5 +78,8 @@ /// <reference types="bn.js" />

/**
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
* Returns the serialized unsigned tx (hashed or raw), which is used to sign the transaction.
*
* @param hashMessage - Return hashed message if set to true (default: true)
*/
getMessageToSign(): Buffer;
getMessageToSign(hashMessage: false): Buffer[];
getMessageToSign(hashMessage?: true): Buffer;
/**

@@ -83,0 +86,0 @@ * Computes a sha3-256 hash of the serialized tx

@@ -277,8 +277,12 @@ "use strict";

};
/**
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
*/
AccessListEIP2930Transaction.prototype.getMessageToSign = function () {
AccessListEIP2930Transaction.prototype.getMessageToSign = function (hashMessage) {
if (hashMessage === void 0) { hashMessage = true; }
var base = this.raw().slice(0, 8);
return ethereumjs_util_1.keccak256(Buffer.concat([Buffer.from('01', 'hex'), ethereumjs_util_1.rlp.encode(base)]));
var message = Buffer.concat([Buffer.from('01', 'hex'), ethereumjs_util_1.rlp.encode(base)]);
if (hashMessage) {
return ethereumjs_util_1.keccak256(message);
}
else {
return message;
}
};

@@ -285,0 +289,0 @@ /**

@@ -50,5 +50,8 @@ /// <reference types="node" />

/**
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
* Returns the serialized unsigned tx (hashed or raw), which is used to sign the transaction.
*
* @param hashMessage - Return hashed message if set to true (default: true)
*/
getMessageToSign(): Buffer;
getMessageToSign(hashMessage: false): Buffer[];
getMessageToSign(hashMessage?: true): Buffer;
/**

@@ -55,0 +58,0 @@ * Computes a sha3-256 hash of the serialized tx

@@ -153,9 +153,13 @@ "use strict";

}
return ethereumjs_util_1.rlphash(values);
return values;
};
/**
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
*/
Transaction.prototype.getMessageToSign = function () {
return this._getMessageToSign(this._unsignedTxImplementsEIP155());
Transaction.prototype.getMessageToSign = function (hashMessage) {
if (hashMessage === void 0) { hashMessage = true; }
var message = this._getMessageToSign(this._unsignedTxImplementsEIP155());
if (hashMessage) {
return ethereumjs_util_1.rlphash(message);
}
else {
return message;
}
};

@@ -173,3 +177,4 @@ /**

var withEIP155 = this._signedTxImplementsEIP155();
return this._getMessageToSign(withEIP155);
var message = this._getMessageToSign(withEIP155);
return ethereumjs_util_1.rlphash(message);
};

@@ -176,0 +181,0 @@ /**

@@ -66,5 +66,8 @@ /// <reference types="bn.js" />

/**
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
* Returns the serialized unsigned tx (hashed or raw), which is used to sign the transaction.
*
* @param hashMessage - Return hashed message if set to true (default: true)
*/
abstract getMessageToSign(): Buffer;
abstract getMessageToSign(hashMessage: false): Buffer[];
abstract getMessageToSign(hashMessage?: true): Buffer;
abstract hash(): Buffer;

@@ -71,0 +74,0 @@ abstract getMessageToVerifySignature(): Buffer;

@@ -134,3 +134,3 @@ "use strict";

}
const msgHash = this.getMessageToSign();
const msgHash = this.getMessageToSign(true);
const { v, r, s } = ethereumjs_util_1.ecsign(msgHash, privateKey);

@@ -137,0 +137,0 @@ return this._processSignature(v, r, s);

@@ -78,5 +78,8 @@ /// <reference types="bn.js" />

/**
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
* Returns the serialized unsigned tx (hashed or raw), which is used to sign the transaction.
*
* @param hashMessage - Return hashed message if set to true (default: true)
*/
getMessageToSign(): Buffer;
getMessageToSign(hashMessage: false): Buffer[];
getMessageToSign(hashMessage?: true): Buffer;
/**

@@ -83,0 +86,0 @@ * Computes a sha3-256 hash of the serialized tx

@@ -217,8 +217,11 @@ "use strict";

}
/**
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
*/
getMessageToSign() {
getMessageToSign(hashMessage = true) {
const base = this.raw().slice(0, 8);
return ethereumjs_util_1.keccak256(Buffer.concat([Buffer.from('01', 'hex'), ethereumjs_util_1.rlp.encode(base)]));
const message = Buffer.concat([Buffer.from('01', 'hex'), ethereumjs_util_1.rlp.encode(base)]);
if (hashMessage) {
return ethereumjs_util_1.keccak256(message);
}
else {
return message;
}
}

@@ -225,0 +228,0 @@ /**

@@ -50,5 +50,8 @@ /// <reference types="node" />

/**
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
* Returns the serialized unsigned tx (hashed or raw), which is used to sign the transaction.
*
* @param hashMessage - Return hashed message if set to true (default: true)
*/
getMessageToSign(): Buffer;
getMessageToSign(hashMessage: false): Buffer[];
getMessageToSign(hashMessage?: true): Buffer;
/**

@@ -55,0 +58,0 @@ * Computes a sha3-256 hash of the serialized tx

@@ -117,9 +117,12 @@ "use strict";

}
return ethereumjs_util_1.rlphash(values);
return values;
}
/**
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
*/
getMessageToSign() {
return this._getMessageToSign(this._unsignedTxImplementsEIP155());
getMessageToSign(hashMessage = true) {
const message = this._getMessageToSign(this._unsignedTxImplementsEIP155());
if (hashMessage) {
return ethereumjs_util_1.rlphash(message);
}
else {
return message;
}
}

@@ -137,3 +140,4 @@ /**

const withEIP155 = this._signedTxImplementsEIP155();
return this._getMessageToSign(withEIP155);
const message = this._getMessageToSign(withEIP155);
return ethereumjs_util_1.rlphash(message);
}

@@ -140,0 +144,0 @@ /**

{
"name": "@ethereumjs/tx",
"version": "3.1.3",
"version": "3.1.4",
"description": "A simple module for creating, manipulating and signing Ethereum transactions",

@@ -5,0 +5,0 @@ "license": "MPL-2.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc