Socket
Socket
Sign inDemoInstall

@ethereumjs/tx

Package Overview
Dependencies
Maintainers
3
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 4.0.0-beta.1 to 4.0.0-beta.2

2

dist/baseTransaction.d.ts
/// <reference types="node" />
import Common, { Chain, Hardfork } from '@ethereumjs/common';
import { Chain, Common, Hardfork } from '@ethereumjs/common';
import { Address, BigIntLike } from '@ethereumjs/util';

@@ -4,0 +4,0 @@ import { TxData, JsonTx, AccessListEIP2930ValuesArray, AccessListEIP2930TxData, FeeMarketEIP1559ValuesArray, FeeMarketEIP1559TxData, TxValuesArray, Capability, TxOptions } from './types';

@@ -6,2 +6,3 @@ "use strict";

const util_1 = require("@ethereumjs/util");
const util_2 = require("@ethereumjs/util");
const types_1 = require("./types");

@@ -44,16 +45,16 @@ /**

const { nonce, gasLimit, to, value, data, v, r, s, type } = txData;
this._type = Number((0, util_1.bufferToBigInt)((0, util_1.toBuffer)(type)));
this._type = Number((0, util_2.bufferToBigInt)((0, util_2.toBuffer)(type)));
this.txOptions = opts;
const toB = (0, util_1.toBuffer)(to === '' ? '0x' : to);
const vB = (0, util_1.toBuffer)(v === '' ? '0x' : v);
const rB = (0, util_1.toBuffer)(r === '' ? '0x' : r);
const sB = (0, util_1.toBuffer)(s === '' ? '0x' : s);
this.nonce = (0, util_1.bufferToBigInt)((0, util_1.toBuffer)(nonce === '' ? '0x' : nonce));
this.gasLimit = (0, util_1.bufferToBigInt)((0, util_1.toBuffer)(gasLimit === '' ? '0x' : gasLimit));
this.to = toB.length > 0 ? new util_1.Address(toB) : undefined;
this.value = (0, util_1.bufferToBigInt)((0, util_1.toBuffer)(value === '' ? '0x' : value));
this.data = (0, util_1.toBuffer)(data === '' ? '0x' : data);
this.v = vB.length > 0 ? (0, util_1.bufferToBigInt)(vB) : undefined;
this.r = rB.length > 0 ? (0, util_1.bufferToBigInt)(rB) : undefined;
this.s = sB.length > 0 ? (0, util_1.bufferToBigInt)(sB) : undefined;
const toB = (0, util_2.toBuffer)(to === '' ? '0x' : to);
const vB = (0, util_2.toBuffer)(v === '' ? '0x' : v);
const rB = (0, util_2.toBuffer)(r === '' ? '0x' : r);
const sB = (0, util_2.toBuffer)(s === '' ? '0x' : s);
this.nonce = (0, util_2.bufferToBigInt)((0, util_2.toBuffer)(nonce === '' ? '0x' : nonce));
this.gasLimit = (0, util_2.bufferToBigInt)((0, util_2.toBuffer)(gasLimit === '' ? '0x' : gasLimit));
this.to = toB.length > 0 ? new util_2.Address(toB) : undefined;
this.value = (0, util_2.bufferToBigInt)((0, util_2.toBuffer)(value === '' ? '0x' : value));
this.data = (0, util_2.toBuffer)(data === '' ? '0x' : data);
this.v = vB.length > 0 ? (0, util_2.bufferToBigInt)(vB) : undefined;
this.r = rB.length > 0 ? (0, util_2.bufferToBigInt)(rB) : undefined;
this.s = sB.length > 0 ? (0, util_2.bufferToBigInt)(sB) : undefined;
this._validateCannotExceedMaxInteger({ value: this.value, r: this.r, s: this.s });

@@ -115,3 +116,3 @@ // geth limits gasLimit to 2^64-1

const { s } = this;
if (this.common.gteHardfork('homestead') && s !== undefined && s > util_1.SECP256K1_ORDER_DIV_2) {
if (this.common.gteHardfork('homestead') && s !== undefined && s > util_2.SECP256K1_ORDER_DIV_2) {
const msg = this._errorMsg('Invalid Signature: s-values greater than secp256k1n/2 are considered invalid');

@@ -175,3 +176,3 @@ throw new Error(msg);

const publicKey = this.getSenderPublicKey();
return (0, util_1.unpadBuffer)(publicKey).length !== 0;
return (0, util_2.unpadBuffer)(publicKey).length !== 0;
}

@@ -186,3 +187,3 @@ catch (e) {

getSenderAddress() {
return new util_1.Address((0, util_1.publicToAddress)(this.getSenderPublicKey()));
return new util_2.Address((0, util_2.publicToAddress)(this.getSenderPublicKey()));
}

@@ -215,3 +216,3 @@ /**

const msgHash = this.getMessageToSign(true);
const { v, r, s } = (0, util_1.ecsign)(msgHash, privateKey);
const { v, r, s } = (0, util_2.ecsign)(msgHash, privateKey);
const tx = this._processSignature(v, r, s);

@@ -237,4 +238,4 @@ // Hack part 2

// Chain ID provided
if (chainId) {
const chainIdBigInt = (0, util_1.bufferToBigInt)((0, util_1.toBuffer)(chainId));
if ((0, util_1.isTruthy)(chainId)) {
const chainIdBigInt = (0, util_2.bufferToBigInt)((0, util_2.toBuffer)(chainId));
if (common) {

@@ -250,6 +251,6 @@ if (common.chainId() !== chainIdBigInt) {

else {
if (common_1.default.isSupportedChainId(chainIdBigInt)) {
if (common_1.Common.isSupportedChainId(chainIdBigInt)) {
// No Common, chain ID supported by Common
// -> Instantiate Common with chain ID
return new common_1.default({ chain: chainIdBigInt, hardfork: this.DEFAULT_HARDFORK });
return new common_1.Common({ chain: chainIdBigInt, hardfork: this.DEFAULT_HARDFORK });
}

@@ -259,3 +260,3 @@ else {

// -> Instantiate custom Common derived from DEFAULT_CHAIN
return common_1.default.custom({
return common_1.Common.custom({
name: 'custom-chain',

@@ -271,3 +272,3 @@ networkId: chainIdBigInt,

// -> return Common provided or create new default Common
return (common?.copy() ?? new common_1.default({ chain: this.DEFAULT_CHAIN, hardfork: this.DEFAULT_HARDFORK }));
return (common?.copy() ?? new common_1.Common({ chain: this.DEFAULT_CHAIN, hardfork: this.DEFAULT_HARDFORK }));
}

@@ -286,3 +287,3 @@ }

if (cannotEqual) {
if (value !== undefined && value >= util_1.MAX_UINT64) {
if (value !== undefined && value >= util_2.MAX_UINT64) {
const msg = this._errorMsg(`${key} cannot equal or exceed MAX_UINT64 (2^64-1), given ${value}`);

@@ -293,3 +294,3 @@ throw new Error(msg);

else {
if (value !== undefined && value > util_1.MAX_UINT64) {
if (value !== undefined && value > util_2.MAX_UINT64) {
const msg = this._errorMsg(`${key} cannot exceed MAX_UINT64 (2^64-1), given ${value}`);

@@ -302,3 +303,3 @@ throw new Error(msg);

if (cannotEqual) {
if (value !== undefined && value >= util_1.MAX_INTEGER) {
if (value !== undefined && value >= util_2.MAX_INTEGER) {
const msg = this._errorMsg(`${key} cannot equal or exceed MAX_INTEGER (2^256-1), given ${value}`);

@@ -309,3 +310,3 @@ throw new Error(msg);

else {
if (value !== undefined && value > util_1.MAX_INTEGER) {
if (value !== undefined && value > util_2.MAX_INTEGER) {
const msg = this._errorMsg(`${key} cannot exceed MAX_INTEGER (2^256-1), given ${value}`);

@@ -330,3 +331,3 @@ throw new Error(msg);

try {
hash = this.isSigned() ? (0, util_1.bufferToHex)(this.hash()) : 'not available (unsigned)';
hash = this.isSigned() ? (0, util_2.bufferToHex)(this.hash()) : 'not available (unsigned)';
}

@@ -333,0 +334,0 @@ catch (e) {

/// <reference types="node" />
import Common from '@ethereumjs/common';
import { Common } from '@ethereumjs/common';
import { BaseTransaction } from './baseTransaction';

@@ -11,3 +11,3 @@ import { AccessList, AccessListBuffer, FeeMarketEIP1559TxData, FeeMarketEIP1559ValuesArray, JsonTx, TxOptions } from './types';

*/
export default class FeeMarketEIP1559Transaction extends BaseTransaction<FeeMarketEIP1559Transaction> {
export declare class FeeMarketEIP1559Transaction extends BaseTransaction<FeeMarketEIP1559Transaction> {
readonly chainId: bigint;

@@ -14,0 +14,0 @@ readonly accessList: AccessListBuffer;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FeeMarketEIP1559Transaction = void 0;
const keccak_1 = require("ethereum-cryptography/keccak");

@@ -36,3 +37,3 @@ const util_1 = require("@ethereumjs/util");

this.chainId = this.common.chainId();
if (!this.common.isActivatedEIP(1559)) {
if (this.common.isActivatedEIP(1559) === false) {
throw new Error('EIP-1559 not enabled on Common');

@@ -96,3 +97,3 @@ }

}
const values = (0, util_1.arrToBufArr)(rlp_1.default.decode(serialized.slice(1)));
const values = (0, util_1.arrToBufArr)(rlp_1.RLP.decode(serialized.slice(1)));
if (!Array.isArray(values)) {

@@ -201,3 +202,3 @@ throw new Error('Invalid serialized tx input: must be array');

TRANSACTION_TYPE_BUFFER,
Buffer.from(rlp_1.default.encode((0, util_1.bufArrToArr)(base))),
Buffer.from(rlp_1.RLP.encode((0, util_1.bufArrToArr)(base))),
]);

@@ -222,3 +223,3 @@ }

TRANSACTION_TYPE_BUFFER,
Buffer.from(rlp_1.default.encode((0, util_1.bufArrToArr)(base))),
Buffer.from(rlp_1.RLP.encode((0, util_1.bufArrToArr)(base))),
]);

@@ -332,3 +333,3 @@ if (hashMessage) {

}
exports.default = FeeMarketEIP1559Transaction;
exports.FeeMarketEIP1559Transaction = FeeMarketEIP1559Transaction;
//# sourceMappingURL=eip1559Transaction.js.map
/// <reference types="node" />
import Common from '@ethereumjs/common';
import { Common } from '@ethereumjs/common';
import { BaseTransaction } from './baseTransaction';

@@ -11,3 +11,3 @@ import { AccessList, AccessListBuffer, AccessListEIP2930TxData, AccessListEIP2930ValuesArray, JsonTx, TxOptions } from './types';

*/
export default class AccessListEIP2930Transaction extends BaseTransaction<AccessListEIP2930Transaction> {
export declare class AccessListEIP2930Transaction extends BaseTransaction<AccessListEIP2930Transaction> {
readonly chainId: bigint;

@@ -14,0 +14,0 @@ readonly accessList: AccessListBuffer;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccessListEIP2930Transaction = void 0;
const keccak_1 = require("ethereum-cryptography/keccak");

@@ -90,3 +91,3 @@ const util_1 = require("@ethereumjs/util");

}
const values = (0, util_1.arrToBufArr)(rlp_1.default.decode(Uint8Array.from(serialized.slice(1))));
const values = (0, util_1.arrToBufArr)(rlp_1.RLP.decode(Uint8Array.from(serialized.slice(1))));
if (!Array.isArray(values)) {

@@ -189,3 +190,3 @@ throw new Error('Invalid serialized tx input: must be array');

TRANSACTION_TYPE_BUFFER,
Buffer.from(rlp_1.default.encode((0, util_1.bufArrToArr)(base))),
Buffer.from(rlp_1.RLP.encode((0, util_1.bufArrToArr)(base))),
]);

@@ -210,3 +211,3 @@ }

TRANSACTION_TYPE_BUFFER,
Buffer.from(rlp_1.default.encode((0, util_1.bufArrToArr)(base))),
Buffer.from(rlp_1.RLP.encode((0, util_1.bufArrToArr)(base))),
]);

@@ -319,3 +320,3 @@ if (hashMessage) {

}
exports.default = AccessListEIP2930Transaction;
exports.AccessListEIP2930Transaction = AccessListEIP2930Transaction;
//# sourceMappingURL=eip2930Transaction.js.map

@@ -1,6 +0,6 @@

export { default as Transaction } from './legacyTransaction';
export { default as AccessListEIP2930Transaction } from './eip2930Transaction';
export { default as TransactionFactory } from './transactionFactory';
export { default as FeeMarketEIP1559Transaction } from './eip1559Transaction';
export { Transaction } from './legacyTransaction';
export { AccessListEIP2930Transaction } from './eip2930Transaction';
export { TransactionFactory } from './transactionFactory';
export { FeeMarketEIP1559Transaction } from './eip1559Transaction';
export * from './types';
//# sourceMappingURL=index.d.ts.map

@@ -19,10 +19,10 @@ "use strict";

var legacyTransaction_1 = require("./legacyTransaction");
Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return legacyTransaction_1.default; } });
Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return legacyTransaction_1.Transaction; } });
var eip2930Transaction_1 = require("./eip2930Transaction");
Object.defineProperty(exports, "AccessListEIP2930Transaction", { enumerable: true, get: function () { return eip2930Transaction_1.default; } });
Object.defineProperty(exports, "AccessListEIP2930Transaction", { enumerable: true, get: function () { return eip2930Transaction_1.AccessListEIP2930Transaction; } });
var transactionFactory_1 = require("./transactionFactory");
Object.defineProperty(exports, "TransactionFactory", { enumerable: true, get: function () { return transactionFactory_1.default; } });
Object.defineProperty(exports, "TransactionFactory", { enumerable: true, get: function () { return transactionFactory_1.TransactionFactory; } });
var eip1559Transaction_1 = require("./eip1559Transaction");
Object.defineProperty(exports, "FeeMarketEIP1559Transaction", { enumerable: true, get: function () { return eip1559Transaction_1.default; } });
Object.defineProperty(exports, "FeeMarketEIP1559Transaction", { enumerable: true, get: function () { return eip1559Transaction_1.FeeMarketEIP1559Transaction; } });
__exportStar(require("./types"), exports);
//# sourceMappingURL=index.js.map
/// <reference types="node" />
import { TxOptions, TxData, JsonTx, TxValuesArray } from './types';
import { BaseTransaction } from './baseTransaction';
import Common from '@ethereumjs/common';
import { Common } from '@ethereumjs/common';
/**
* An Ethereum non-typed (legacy) transaction
*/
export default class Transaction extends BaseTransaction<Transaction> {
export declare class Transaction extends BaseTransaction<Transaction> {
readonly gasPrice: bigint;

@@ -74,3 +74,3 @@ readonly common: Common;

* import { bufArrToArr } from '@ethereumjs/util'
* import RLP from 'rlp'
* import { RLP } from 'rlp'
* const message = tx.getMessageToSign(false)

@@ -77,0 +77,0 @@ * const serializedMessage = Buffer.from(RLP.encode(bufArrToArr(message))) // use this for the HW wallet input

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Transaction = void 0;
const keccak_1 = require("ethereum-cryptography/keccak");

@@ -76,3 +77,3 @@ const util_1 = require("@ethereumjs/util");

static fromSerializedTx(serialized, opts = {}) {
const values = (0, util_1.arrToBufArr)(rlp_1.default.decode(Uint8Array.from(serialized)));
const values = (0, util_1.arrToBufArr)(rlp_1.RLP.decode(Uint8Array.from(serialized)));
if (!Array.isArray(values)) {

@@ -144,3 +145,3 @@ throw new Error('Invalid serialized tx input. Must be array');

serialize() {
return Buffer.from(rlp_1.default.encode((0, util_1.bufArrToArr)(this.raw())));
return Buffer.from(rlp_1.RLP.encode((0, util_1.bufArrToArr)(this.raw())));
}

@@ -166,3 +167,3 @@ _getMessageToSign() {

if (hashMessage) {
return Buffer.from((0, keccak_1.keccak256)(rlp_1.default.encode((0, util_1.bufArrToArr)(message))));
return Buffer.from((0, keccak_1.keccak256)(rlp_1.RLP.encode((0, util_1.bufArrToArr)(message))));
}

@@ -207,7 +208,7 @@ else {

if (!this.cache.hash) {
this.cache.hash = Buffer.from((0, keccak_1.keccak256)(rlp_1.default.encode((0, util_1.bufArrToArr)(this.raw()))));
this.cache.hash = Buffer.from((0, keccak_1.keccak256)(rlp_1.RLP.encode((0, util_1.bufArrToArr)(this.raw()))));
}
return this.cache.hash;
}
return Buffer.from((0, keccak_1.keccak256)(rlp_1.default.encode((0, util_1.bufArrToArr)(this.raw()))));
return Buffer.from((0, keccak_1.keccak256)(rlp_1.RLP.encode((0, util_1.bufArrToArr)(this.raw()))));
}

@@ -223,3 +224,3 @@ /**

const message = this._getMessageToSign();
return Buffer.from((0, keccak_1.keccak256)(rlp_1.default.encode((0, util_1.bufArrToArr)(message))));
return Buffer.from((0, keccak_1.keccak256)(rlp_1.RLP.encode((0, util_1.bufArrToArr)(message))));
}

@@ -335,3 +336,3 @@ /**

}
exports.default = Transaction;
exports.Transaction = Transaction;
//# sourceMappingURL=legacyTransaction.js.map
/// <reference types="node" />
import { TxOptions, TypedTransaction, TxData, AccessListEIP2930TxData, FeeMarketEIP1559TxData } from './types';
export default class TransactionFactory {
export declare class TransactionFactory {
private constructor();

@@ -5,0 +5,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TransactionFactory = void 0;
const util_1 = require("@ethereumjs/util");

@@ -89,3 +90,3 @@ const _1 = require(".");

}
exports.default = TransactionFactory;
exports.TransactionFactory = TransactionFactory;
//# sourceMappingURL=transactionFactory.js.map
/// <reference types="node" />
import { AddressLike, BigIntLike, BufferLike, PrefixedHexString } from '@ethereumjs/util';
import Common from '@ethereumjs/common';
import { default as Transaction } from './legacyTransaction';
import { default as AccessListEIP2930Transaction } from './eip2930Transaction';
import { default as FeeMarketEIP1559Transaction } from './eip1559Transaction';
import { Common } from '@ethereumjs/common';
import { Transaction } from './legacyTransaction';
import { AccessListEIP2930Transaction } from './eip2930Transaction';
import { FeeMarketEIP1559Transaction } from './eip1559Transaction';
/**

@@ -8,0 +8,0 @@ * Can be used in conjunction with {@link Transaction.supports}

@@ -1,2 +0,2 @@

import Common from '@ethereumjs/common';
import { Common } from '@ethereumjs/common';
import { AccessList, AccessListBuffer } from './types';

@@ -3,0 +3,0 @@ export declare function checkMaxInitCodeSize(common: Common, length: number): void;

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

let bufferAccessList;
if (accessList && (0, types_1.isAccessList)(accessList)) {
if ((0, types_1.isAccessList)(accessList)) {
AccessListJSON = accessList;

@@ -20,0 +20,0 @@ const newAccessList = [];

{
"name": "@ethereumjs/tx",
"version": "4.0.0-beta.1",
"version": "4.0.0-beta.2",
"description": "A simple module for creating, manipulating and signing Ethereum transactions",

@@ -33,6 +33,6 @@ "license": "MPL-2.0",

"dependencies": {
"@ethereumjs/common": "3.0.0-beta.1",
"@ethereumjs/util": "8.0.0-beta.1",
"ethereum-cryptography": "^1.0.3",
"rlp": "4.0.0-beta.1"
"@ethereumjs/common": "3.0.0-beta.2",
"@ethereumjs/util": "8.0.0-beta.2",
"ethereum-cryptography": "^1.1.2",
"rlp": "4.0.0-beta.2"
},

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

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

| Implements schema and functions related to Ethereum's transaction. |
| --- |
| ------------------------------------------------------------------ |

@@ -45,9 +45,9 @@ Note: this `README` reflects the state of the library from `v3.0.0` onwards. See `README` from the [standalone repository](https://github.com/ethereumjs/ethereumjs-tx) for an introduction on the last preceding release.

Hardfork | Introduced | Description
--- | --- | ---
`london` | `v3.2.0` | `EIP-1559` Transactions
`berlin` | `v3.1.0` | `EIP-2718` Typed Transactions, Optional Access Lists Tx Type `EIP-2930`
`muirGlacier` | `v2.1.2` | -
`istanbul` | `v2.1.1` | Support for reduced non-zero call data gas prices ([EIP-2028](https://eips.ethereum.org/EIPS/eip-2028))
`spuriousDragon` | `v2.0.0` | `EIP-155` replay protection (disable by setting HF pre-`spuriousDragon`)
| Hardfork | Introduced | Description |
| ---------------- | ---------- | ------------------------------------------------------------------------------------------------------- |
| `london` | `v3.2.0` | `EIP-1559` Transactions |
| `berlin` | `v3.1.0` |  `EIP-2718` Typed Transactions, Optional Access Lists Tx Type `EIP-2930` |
| `muirGlacier` |  `v2.1.2` |  - |
| `istanbul` |  `v2.1.1`  | Support for reduced non-zero call data gas prices ([EIP-2028](https://eips.ethereum.org/EIPS/eip-2028)) |
| `spuriousDragon` |  `v2.0.0` |  `EIP-155` replay protection (disable by setting HF pre-`spuriousDragon`) |

@@ -59,3 +59,3 @@ ### Standalone EIPs

```typescript
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.London, eips: [ 3860 ] })
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.London, eips: [3860] })
```

@@ -82,3 +82,3 @@

```typescript
import Common, { Chain, Hardfork } from '@ethereumjs/common'
import { Chain, Common, Hardfork } from '@ethereumjs/common'
import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx'

@@ -89,15 +89,15 @@

const txData = {
"data": "0x1a8451e600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x02625a00",
"maxPriorityFeePerGas": "0x01",
"maxFeePerGas": "0xff",
"nonce": "0x00",
"to": "0xcccccccccccccccccccccccccccccccccccccccc",
"value": "0x0186a0",
"v": "0x01",
"r": "0xafb6e247b1c490e284053c87ab5f6b59e219d51f743f7a4d83e400782bc7e4b9",
"s": "0x479a268e0e0acd4de3f1e28e4fac2a6b32a4195e8dfa9d19147abe8807aa6f64",
"chainId": "0x01",
"accessList": [],
"type": "0x02"
data: '0x1a8451e600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
gasLimit: '0x02625a00',
maxPriorityFeePerGas: '0x01',
maxFeePerGas: '0xff',
nonce: '0x00',
to: '0xcccccccccccccccccccccccccccccccccccccccc',
value: '0x0186a0',
v: '0x01',
r: '0xafb6e247b1c490e284053c87ab5f6b59e219d51f743f7a4d83e400782bc7e4b9',
s: '0x479a268e0e0acd4de3f1e28e4fac2a6b32a4195e8dfa9d19147abe8807aa6f64',
chainId: '0x01',
accessList: [],
type: '0x02',
}

@@ -117,3 +117,3 @@

```typescript
import Common, { Chain, Hardfork } from '@ethereumjs/common'
import { Chain, Common, Hardfork } from '@ethereumjs/common'
import { AccessListEIP2930Transaction } from '@ethereumjs/tx'

@@ -124,22 +124,22 @@

const txData = {
"data": "0x1a8451e600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x02625a00",
"gasPrice": "0x01",
"nonce": "0x00",
"to": "0xcccccccccccccccccccccccccccccccccccccccc",
"value": "0x0186a0",
"v": "0x01",
"r": "0xafb6e247b1c490e284053c87ab5f6b59e219d51f743f7a4d83e400782bc7e4b9",
"s": "0x479a268e0e0acd4de3f1e28e4fac2a6b32a4195e8dfa9d19147abe8807aa6f64",
"chainId": "0x01",
"accessList": [
data: '0x1a8451e600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
gasLimit: '0x02625a00',
gasPrice: '0x01',
nonce: '0x00',
to: '0xcccccccccccccccccccccccccccccccccccccccc',
value: '0x0186a0',
v: '0x01',
r: '0xafb6e247b1c490e284053c87ab5f6b59e219d51f743f7a4d83e400782bc7e4b9',
s: '0x479a268e0e0acd4de3f1e28e4fac2a6b32a4195e8dfa9d19147abe8807aa6f64',
chainId: '0x01',
accessList: [
{
"address": "0x0000000000000000000000000000000000000101",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x00000000000000000000000000000000000000000000000000000000000060a7"
]
}
address: '0x0000000000000000000000000000000000000101',
storageKeys: [
'0x0000000000000000000000000000000000000000000000000000000000000000',
'0x00000000000000000000000000000000000000000000000000000000000060a7',
],
},
],
"type": "0x01"
type: '0x01',
}

@@ -163,3 +163,3 @@

```typescript
import Common, { Chain, Hardfork } from '@ethereumjs/common'
import { Chain, Common, Hardfork } from '@ethereumjs/common'
import { Transaction } from '@ethereumjs/tx'

@@ -181,3 +181,3 @@

'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109',
'hex',
'hex'
)

@@ -195,3 +195,3 @@

```typescript
import Common, { Chain, Hardfork } from '@ethereumjs/common'
import { Chain, Common, Hardfork } from '@ethereumjs/common'
import { TransactionFactory } from '@ethereumjs/tx'

@@ -225,3 +225,3 @@

import { Transaction } from '@ethereumjs/tx'
import Common from '@ethereumjs/common'
import { Common } from '@ethereumjs/common'

@@ -249,10 +249,10 @@ const from = 'PUBLIC_KEY'

| L2 Network | Common name | Issue |
|---|---|---|
| Arbitrum Rinkeby Testnet | `CustomChain.ArbitrumRinkebyTestnet` | [#1290](https://github.com/ethereumjs/ethereumjs-monorepo/issues/1290) |
| Polygon Mainnet | `CustomChain.PolygonMainnet` | [#1289](https://github.com/ethereumjs/ethereumjs-monorepo/issues/1289) |
| Polygon Mumbai Testnet | `CustomChain.PolygonMumbai` | [#1289](https://github.com/ethereumjs/ethereumjs-monorepo/issues/1289) |
| xDai Chain | `Common.xDaiChain` | [#1323](https://github.com/ethereumjs/ethereumjs-monorepo/issues/1323) |
| Optimistic Kovan | `Common.OptimisticKovan` | [#1554](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1554)
| Optimistic Ethereum | `Common.OptimisticEthereum` | [#1554](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1554)
|  L2 Network |  Common name |  Issue |
| ------------------------ | ------------------------------------- | ----------------------------------------------------------------------- |
| Arbitrum Rinkeby Testnet |  `CustomChain.ArbitrumRinkebyTestnet` |  [#1290](https://github.com/ethereumjs/ethereumjs-monorepo/issues/1290) |
| Polygon Mainnet |  `CustomChain.PolygonMainnet` |  [#1289](https://github.com/ethereumjs/ethereumjs-monorepo/issues/1289) |
| Polygon Mumbai Testnet |  `CustomChain.PolygonMumbai` |  [#1289](https://github.com/ethereumjs/ethereumjs-monorepo/issues/1289) |
| xDai Chain |  `Common.xDaiChain` |  [#1323](https://github.com/ethereumjs/ethereumjs-monorepo/issues/1323) |
| Optimistic Kovan | `Common.OptimisticKovan` | [#1554](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1554) |
| Optimistic Ethereum | `Common.OptimisticEthereum` | [#1554](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1554) |

@@ -280,5 +280,5 @@ Note: For Optimistic Kovan and Optimistic Ethereum, the London hardfork has not been implemented so transactions submitted with a `baseFee` will revert.

import { Transaction, FeeMarketEIP1559Transaction } from '@ethereumjs/tx'
import Common, { Chain } from '@ethereumjs/common'
import { Chain, Common } from '@ethereumjs/common'
import { bufArrToArr } from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import Eth from '@ledgerhq/hw-app-eth'

@@ -344,4 +344,12 @@

[Documentation](./docs/README.md)
## Docs
Generated TypeDoc API [Documentation](./docs/README.md)
## BigInt Support
Starting with v4 the usage of [BN.js](https://github.com/indutny/bn.js/) for big numbers has been removed from the library and replaced with the usage of the native JS [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) data type (introduced in `ES2020`).
Please note that number-related API signatures have changed along with this version update and the minimal build target has been updated to `ES2020`.
# EthereumJS

@@ -348,0 +356,0 @@

@@ -1,2 +0,3 @@

import Common, { Chain, Hardfork } from '@ethereumjs/common'
import { Chain, Common, Hardfork } from '@ethereumjs/common'
import { isTruthy } from '@ethereumjs/util'
import {

@@ -362,3 +363,3 @@ Address,

// Chain ID provided
if (chainId) {
if (isTruthy(chainId)) {
const chainIdBigInt = bufferToBigInt(toBuffer(chainId))

@@ -365,0 +366,0 @@ if (common) {

@@ -13,4 +13,4 @@ import { keccak256 } from 'ethereum-cryptography/keccak'

} from '@ethereumjs/util'
import RLP from 'rlp'
import Common from '@ethereumjs/common'
import { RLP } from 'rlp'
import { Common } from '@ethereumjs/common'
import { BaseTransaction } from './baseTransaction'

@@ -36,3 +36,3 @@ import {

*/
export default class FeeMarketEIP1559Transaction extends BaseTransaction<FeeMarketEIP1559Transaction> {
export class FeeMarketEIP1559Transaction extends BaseTransaction<FeeMarketEIP1559Transaction> {
public readonly chainId: bigint

@@ -155,3 +155,3 @@ public readonly accessList: AccessListBuffer

if (!this.common.isActivatedEIP(1559)) {
if (this.common.isActivatedEIP(1559) === false) {
throw new Error('EIP-1559 not enabled on Common')

@@ -158,0 +158,0 @@ }

@@ -13,4 +13,4 @@ import { keccak256 } from 'ethereum-cryptography/keccak'

} from '@ethereumjs/util'
import RLP from 'rlp'
import Common from '@ethereumjs/common'
import { RLP } from 'rlp'
import { Common } from '@ethereumjs/common'
import { BaseTransaction } from './baseTransaction'

@@ -37,3 +37,3 @@ import {

*/
export default class AccessListEIP2930Transaction extends BaseTransaction<AccessListEIP2930Transaction> {
export class AccessListEIP2930Transaction extends BaseTransaction<AccessListEIP2930Transaction> {
public readonly chainId: bigint

@@ -40,0 +40,0 @@ public readonly accessList: AccessListBuffer

@@ -1,5 +0,5 @@

export { default as Transaction } from './legacyTransaction'
export { default as AccessListEIP2930Transaction } from './eip2930Transaction'
export { default as TransactionFactory } from './transactionFactory'
export { default as FeeMarketEIP1559Transaction } from './eip1559Transaction'
export { Transaction } from './legacyTransaction'
export { AccessListEIP2930Transaction } from './eip2930Transaction'
export { TransactionFactory } from './transactionFactory'
export { FeeMarketEIP1559Transaction } from './eip1559Transaction'
export * from './types'

@@ -14,6 +14,6 @@ import { keccak256 } from 'ethereum-cryptography/keccak'

} from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import { TxOptions, TxData, JsonTx, TxValuesArray, Capability } from './types'
import { BaseTransaction } from './baseTransaction'
import Common from '@ethereumjs/common'
import { Common } from '@ethereumjs/common'
import { checkMaxInitCodeSize } from './util'

@@ -32,3 +32,3 @@

*/
export default class Transaction extends BaseTransaction<Transaction> {
export class Transaction extends BaseTransaction<Transaction> {
public readonly gasPrice: bigint

@@ -213,3 +213,3 @@

* import { bufArrToArr } from '@ethereumjs/util'
* import RLP from 'rlp'
* import { RLP } from 'rlp'
* const message = tx.getMessageToSign(false)

@@ -216,0 +216,0 @@ * const serializedMessage = Buffer.from(RLP.encode(bufArrToArr(message))) // use this for the HW wallet input

@@ -11,3 +11,3 @@ import { bufferToBigInt, toBuffer } from '@ethereumjs/util'

export default class TransactionFactory {
export class TransactionFactory {
// It is not possible to instantiate a TransactionFactory object.

@@ -14,0 +14,0 @@ private constructor() {}

import { AddressLike, BigIntLike, BufferLike, PrefixedHexString } from '@ethereumjs/util'
import Common from '@ethereumjs/common'
import { default as Transaction } from './legacyTransaction'
import { default as AccessListEIP2930Transaction } from './eip2930Transaction'
import { default as FeeMarketEIP1559Transaction } from './eip1559Transaction'
import { Common } from '@ethereumjs/common'
import { Transaction } from './legacyTransaction'
import { AccessListEIP2930Transaction } from './eip2930Transaction'
import { FeeMarketEIP1559Transaction } from './eip1559Transaction'

@@ -7,0 +7,0 @@ /**

@@ -1,2 +0,2 @@

import Common from '@ethereumjs/common'
import { Common } from '@ethereumjs/common'
import { bufferToHex, setLengthLeft, toBuffer } from '@ethereumjs/util'

@@ -21,3 +21,3 @@ import { AccessList, AccessListBuffer, AccessListItem, isAccessList } from './types'

let bufferAccessList
if (accessList && isAccessList(accessList)) {
if (isAccessList(accessList)) {
AccessListJSON = accessList

@@ -24,0 +24,0 @@ const newAccessList: AccessListBuffer = []

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

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc