Socket
Socket
Sign inDemoInstall

@ethereumjs/tx

Package Overview
Dependencies
Maintainers
6
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethereumjs/tx - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

7

CHANGELOG.md

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

## 3.0.2 - 2021-02-16
Follow-up release on `v3.0.1` which only partly addressed a **critical** bug. An update is - again - strongly recommended.
- Fixes `tx.isSigned()` always returning true when using the `Tx.fromValuesArray()` static constructor, see PR [#1077](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1077)
## 3.0.1 - 2021-01-20

@@ -11,0 +18,0 @@

32

dist.browser/transaction.js

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

if (opts === null || opts === void 0 ? void 0 : opts.common) {
this.common = opts.common;
this.common = Object.assign(Object.create(Object.getPrototypeOf(opts.common)), opts.common);
}

@@ -121,5 +121,5 @@ else {

data: data !== null && data !== void 0 ? data : emptyBuffer,
v: !(v === null || v === void 0 ? void 0 : v.equals(emptyBuffer)) ? new ethereumjs_util_1.BN(v) : undefined,
r: !(r === null || r === void 0 ? void 0 : r.equals(emptyBuffer)) ? new ethereumjs_util_1.BN(r) : undefined,
s: !(s === null || s === void 0 ? void 0 : s.equals(emptyBuffer)) ? new ethereumjs_util_1.BN(s) : undefined,
v: v && !v.equals(emptyBuffer) ? new ethereumjs_util_1.BN(v) : undefined,
r: r && !r.equals(emptyBuffer) ? new ethereumjs_util_1.BN(r) : undefined,
s: s && !s.equals(emptyBuffer) ? new ethereumjs_util_1.BN(s) : undefined,
}, opts);

@@ -137,14 +137,3 @@ };

Transaction.prototype.hash = function () {
var values = [
ethereumjs_util_1.bnToRlp(this.nonce),
ethereumjs_util_1.bnToRlp(this.gasPrice),
ethereumjs_util_1.bnToRlp(this.gasLimit),
this.to !== undefined ? this.to.buf : buffer_1.Buffer.from([]),
ethereumjs_util_1.bnToRlp(this.value),
this.data,
this.v ? ethereumjs_util_1.bnToRlp(this.v) : buffer_1.Buffer.from([]),
this.r ? ethereumjs_util_1.bnToRlp(this.r) : buffer_1.Buffer.from([]),
this.s ? ethereumjs_util_1.bnToRlp(this.s) : buffer_1.Buffer.from([]),
];
return ethereumjs_util_1.rlphash(values);
return ethereumjs_util_1.rlphash(this.raw());
};

@@ -335,10 +324,3 @@ Transaction.prototype.getMessageToSign = function () {

Transaction.prototype._getMessageToSign = function (withEIP155) {
var values = [
ethereumjs_util_1.bnToRlp(this.nonce),
ethereumjs_util_1.bnToRlp(this.gasPrice),
ethereumjs_util_1.bnToRlp(this.gasLimit),
this.to !== undefined ? this.to.buf : buffer_1.Buffer.from([]),
ethereumjs_util_1.bnToRlp(this.value),
this.data,
];
var values = this.raw().slice(0, 6);
if (withEIP155) {

@@ -355,3 +337,3 @@ values.push(ethereumjs_util_1.toBuffer(this.getChainId()));

Transaction.prototype._validateTxV = function (v) {
if (v === undefined || v.toNumber() === 0) {
if (v === undefined) {
return;

@@ -358,0 +340,0 @@ }

@@ -10,2 +10,5 @@ import { AddressLike, BNLike, BufferLike } from 'ethereumjs-util';

*
* Object will be internally copied so that tx behavior don't incidentally
* change on future HF changes.
*
* Default: `Common` object set to `mainnet` and the default hardfork as defined in the `Common` class.

@@ -12,0 +15,0 @@ *

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

if (opts === null || opts === void 0 ? void 0 : opts.common) {
this.common = opts.common;
this.common = Object.assign(Object.create(Object.getPrototypeOf(opts.common)), opts.common);
}

@@ -83,5 +83,5 @@ else {

data: data !== null && data !== void 0 ? data : emptyBuffer,
v: !(v === null || v === void 0 ? void 0 : v.equals(emptyBuffer)) ? new ethereumjs_util_1.BN(v) : undefined,
r: !(r === null || r === void 0 ? void 0 : r.equals(emptyBuffer)) ? new ethereumjs_util_1.BN(r) : undefined,
s: !(s === null || s === void 0 ? void 0 : s.equals(emptyBuffer)) ? new ethereumjs_util_1.BN(s) : undefined,
v: v && !v.equals(emptyBuffer) ? new ethereumjs_util_1.BN(v) : undefined,
r: r && !r.equals(emptyBuffer) ? new ethereumjs_util_1.BN(r) : undefined,
s: s && !s.equals(emptyBuffer) ? new ethereumjs_util_1.BN(s) : undefined,
}, opts);

@@ -99,14 +99,3 @@ }

hash() {
const values = [
ethereumjs_util_1.bnToRlp(this.nonce),
ethereumjs_util_1.bnToRlp(this.gasPrice),
ethereumjs_util_1.bnToRlp(this.gasLimit),
this.to !== undefined ? this.to.buf : buffer_1.Buffer.from([]),
ethereumjs_util_1.bnToRlp(this.value),
this.data,
this.v ? ethereumjs_util_1.bnToRlp(this.v) : buffer_1.Buffer.from([]),
this.r ? ethereumjs_util_1.bnToRlp(this.r) : buffer_1.Buffer.from([]),
this.s ? ethereumjs_util_1.bnToRlp(this.s) : buffer_1.Buffer.from([]),
];
return ethereumjs_util_1.rlphash(values);
return ethereumjs_util_1.rlphash(this.raw());
}

@@ -296,10 +285,3 @@ getMessageToSign() {

_getMessageToSign(withEIP155) {
const values = [
ethereumjs_util_1.bnToRlp(this.nonce),
ethereumjs_util_1.bnToRlp(this.gasPrice),
ethereumjs_util_1.bnToRlp(this.gasLimit),
this.to !== undefined ? this.to.buf : buffer_1.Buffer.from([]),
ethereumjs_util_1.bnToRlp(this.value),
this.data,
];
const values = this.raw().slice(0, 6);
if (withEIP155) {

@@ -316,3 +298,3 @@ values.push(ethereumjs_util_1.toBuffer(this.getChainId()));

_validateTxV(v) {
if (v === undefined || v.toNumber() === 0) {
if (v === undefined) {
return;

@@ -319,0 +301,0 @@ }

@@ -10,2 +10,5 @@ import { AddressLike, BNLike, BufferLike } from 'ethereumjs-util';

*
* Object will be internally copied so that tx behavior don't incidentally
* change on future HF changes.
*
* Default: `Common` object set to `mainnet` and the default hardfork as defined in the `Common` class.

@@ -12,0 +15,0 @@ *

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

@@ -35,3 +35,3 @@ "main": "dist/index.js",

"@ethereumjs/common": "^2.0.0",
"ethereumjs-util": "^7.0.7"
"ethereumjs-util": "^7.0.8"
},

@@ -38,0 +38,0 @@ "devDependencies": {

@@ -34,3 +34,3 @@ # @ethereumjs/tx

const commmon = new Common({ chain: 'mainnet' })
const common = new Common({ chain: 'mainnet' })
const tx = Transaction.fromTxData(txParams, { common })

@@ -114,3 +114,3 @@

[tx-actions-link]: https://github.com/ethereumjs/ethereumjs-vm/actions?query=workflow%3A%22Tx+Test%22
[tx-coverage-badge]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/branch/master/graph/badge.svg?flag=tx
[tx-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/tree/master/packages/tx
[tx-coverage-badge]: https://codecov.io/gh/ethereumjs/ethereumjs-monorepo/branch/master/graph/badge.svg?flag=tx
[tx-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc