diff --git a/CHANGELOG.md b/CHANGELOG.md index 73f9ba3..1f3c4c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,68 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [2.0.0] - 2019-06-03 + +**TypeScript / Module Import / Node Support** + +First `TypeScript` based release of the library, see +PR [#145](https://github.com/ethereumjs/ethereumjs-tx/pull/145) for details. + +This comes along with some changes on the API, Node import of the exposed +classes now goes like this: + +```javascript +const EthereumTx = require('ethereumjs-transaction').Transaction +const FakeEthereumTx = require('ethereumjs-transaction').FakeTransaction +``` + +The library now also comes with a **type declaration file** distributed along +with the package published. + +Along with this release we drop official support for `Node` versions `4`,`5` +and `6`. Officially tested versions are now `Node` `8`, `10` and `11` +(see PRs [#138](https://github.com/ethereumjs/ethereumjs-tx/pull/138) and +[#146](https://github.com/ethereumjs/ethereumjs-tx/pull/146)). + +**Hardfork Support / Official Test Updates** + +Along with a long overdue update of the official Ethereum Transaction tests +(see PRs [#131](https://github.com/ethereumjs/ethereumjs-tx/pull/131) and +[#138](https://github.com/ethereumjs/ethereumjs-tx/pull/138) for +`FakeTransaction`) and +an introduction of setting chain and hardfork by using our shared +[ethereumjs-common](https://github.com/ethereumjs/ethereumjs-common) class +(see PR [#131](https://github.com/ethereumjs/ethereumjs-tx/pull/130)) the +transaction library now supports all HFs up to the `Petersburg` hardfork, +see [constructor option docs](https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/interfaces/transactionoptions.md) for information on instantiation and default values (current hardfork default: `petersburg`). + +API Changes: + +- Removal of the `data.chainId` parameter, use the `opts.chain` parameter or a custom `Common` instance + +**Default EIP-155 Support** + +Along with defaulting to a post-`Spurious Dragon` HF replay protection from +[EIP-155](https://eips.ethereum.org/EIPS/eip-155) is now activated by default. Transactions are subsequently also by default signed with `EIP-155` replay protection, +see PRs [#153](https://github.com/ethereumjs/ethereumjs-tx/pull/153), +[#147](https://github.com/ethereumjs/ethereumjs-tx/pull/147) and +[#143](https://github.com/ethereumjs/ethereumjs-tx/pull/143). + +This comes with some changes in how different `v` values passed on instantation +or changed on runtime are handled: + +- The constructor throws if the `v` value is present, indicates that `EIP-155` + was enabled, and the chain id it indicates doesn't match the one of the + internal `common` object +- No default `v` is set. If a transaction isn't signed, it would be an empty + buffer +- If `v` is changed after construction its value is validated in its setter + +For activating non-`EIP-155` behavior instantiate the transaction with a +pre-`Spurious Dragon` hardfork option. + +[2.0.0]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.3.7...v2.0.0 + ## [1.3.7] - 2018-07-25 - Fix bug causing `FakeTransaction.from` to not retrieve sender address from tx signature, see PR [#118](https://github.com/ethereumjs/ethereumjs-tx/pull/118) diff --git a/README.md b/README.md index 6c7315c..254bc09 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ # USAGE -- [example](https://github.com/ethereumjs/ethereumjs-tx/blob/master/examples/transactions.js) +- [example](https://github.com/ethereumjs/ethereumjs-tx/blob/master/examples/transactions.ts) ```javascript -const EthereumTx = require('ethereumjs-tx') +const EthereumTx = require('ethereumjs-tx').Transaction const privateKey = Buffer.from( 'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', 'hex', @@ -34,11 +34,14 @@ tx.sign(privateKey) const serializedTx = tx.serialize() ``` -**Note:** this package expects ECMAScript 6 (ES6) as a minimum environment. From browsers lacking ES6 support, please use a shim (like [es6-shim](https://github.com/paulmillr/es6-shim)) before including any of the builds from this repo. +# Chain and Hardfork Support -# BROWSER +This library uses the [ethereumjs-common](https://github.com/ethereumjs/ethereumjs-common) +package to support different chain and hardfork options, see API documentation +for details. -For a browser build please see https://github.com/ethereumjs/browser-builds. +Currently all hardforks up to `petersburg` are supported, `EIP-155` replay protection +is activated since the `spuriousDragon` hardfork. # API diff --git a/docs/README.md b/docs/README.md index 081adaa..c1b6080 100644 --- a/docs/README.md +++ b/docs/README.md @@ -29,7 +29,7 @@ **Ƭ BufferLike**: _`Buffer` \| [TransformableToBuffer](interfaces/transformabletobuffer.md) \| [PrefixedHexString](#prefixedhexstring) \| `number`_ -_Defined in [types.ts:19](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L19)_ +_Defined in [types.ts:19](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L19)_ A Buffer, hex string prefixed with `0x`, Number, or an object with a toBuffer method such as BN. @@ -41,7 +41,7 @@ A Buffer, hex string prefixed with `0x`, Number, or an object with a toBuffer me **Ƭ PrefixedHexString**: _`string`_ -_Defined in [types.ts:14](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L14)_ +_Defined in [types.ts:14](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L14)_ A hex string prefixed with `0x`. diff --git a/docs/classes/faketransaction.md b/docs/classes/faketransaction.md index 8a845b0..4fef598 100644 --- a/docs/classes/faketransaction.md +++ b/docs/classes/faketransaction.md @@ -4,7 +4,7 @@ Creates a new transaction object that doesn't need to be signed. -_**param**_: A transaction can be initialized with its rlp representation, an array containing the value of its fields in order, or an object containing them by name. If the latter is used, a `chainId` and `from` can also be provided. +_**param**_: A transaction can be initialized with its rlp representation, an array containing the value of its fields in order, or an object containing them by name. _**param**_: The transaction's options, used to indicate the chain and hardfork the transactions belongs to. @@ -49,6 +49,7 @@ _**see**_: Transaction - [serialize](faketransaction.md#serialize) - [sign](faketransaction.md#sign) - [toCreationAddress](faketransaction.md#tocreationaddress) +- [toJSON](faketransaction.md#tojson) - [validate](faketransaction.md#validate) - [verifySignature](faketransaction.md#verifysignature) @@ -64,7 +65,7 @@ _**see**_: Transaction _Overrides [Transaction](transaction.md).[constructor](transaction.md#constructor)_ -_Defined in [fake.ts:23](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/fake.ts#L23)_ +_Defined in [fake.ts:22](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/fake.ts#L22)_ **Parameters:** @@ -87,7 +88,7 @@ _Defined in [fake.ts:23](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b8 _Inherited from [Transaction](transaction.md).[\_from](transaction.md#_from)_ -_Defined in [transaction.ts:37](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L37)_ +_Defined in [transaction.ts:37](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L37)_ --- @@ -99,7 +100,7 @@ _Defined in [transaction.ts:37](https://github.com/alcuadrado/ethereumjs-tx/blob _Inherited from [Transaction](transaction.md).[data](transaction.md#data)_ -_Defined in [transaction.ts:29](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L29)_ +_Defined in [transaction.ts:30](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L30)_ --- @@ -109,7 +110,7 @@ _Defined in [transaction.ts:29](https://github.com/alcuadrado/ethereumjs-tx/blob **● from**: _`Buffer`_ -_Defined in [fake.ts:23](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/fake.ts#L23)_ +_Defined in [fake.ts:22](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/fake.ts#L22)_ Set from address to bypass transaction signing. This is not an optional property, as its getter never returns undefined. @@ -123,7 +124,7 @@ Set from address to bypass transaction signing. This is not an optional property _Inherited from [Transaction](transaction.md).[gasLimit](transaction.md#gaslimit)_ -_Defined in [transaction.ts:25](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L25)_ +_Defined in [transaction.ts:26](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L26)_ --- @@ -135,7 +136,7 @@ _Defined in [transaction.ts:25](https://github.com/alcuadrado/ethereumjs-tx/blob _Inherited from [Transaction](transaction.md).[gasPrice](transaction.md#gasprice)_ -_Defined in [transaction.ts:26](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L26)_ +_Defined in [transaction.ts:27](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L27)_ --- @@ -147,7 +148,7 @@ _Defined in [transaction.ts:26](https://github.com/alcuadrado/ethereumjs-tx/blob _Inherited from [Transaction](transaction.md).[nonce](transaction.md#nonce)_ -_Defined in [transaction.ts:24](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L24)_ +_Defined in [transaction.ts:25](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L25)_ --- @@ -159,7 +160,7 @@ _Defined in [transaction.ts:24](https://github.com/alcuadrado/ethereumjs-tx/blob _Inherited from [Transaction](transaction.md).[r](transaction.md#r)_ -_Defined in [transaction.ts:31](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L31)_ +_Defined in [transaction.ts:32](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L32)_ --- @@ -171,7 +172,7 @@ _Defined in [transaction.ts:31](https://github.com/alcuadrado/ethereumjs-tx/blob _Inherited from [Transaction](transaction.md).[raw](transaction.md#raw)_ -_Defined in [transaction.ts:23](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L23)_ +_Defined in [transaction.ts:24](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L24)_ --- @@ -183,7 +184,7 @@ _Defined in [transaction.ts:23](https://github.com/alcuadrado/ethereumjs-tx/blob _Inherited from [Transaction](transaction.md).[s](transaction.md#s)_ -_Defined in [transaction.ts:32](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L32)_ +_Defined in [transaction.ts:33](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L33)_ --- @@ -195,7 +196,7 @@ _Defined in [transaction.ts:32](https://github.com/alcuadrado/ethereumjs-tx/blob _Inherited from [Transaction](transaction.md).[to](transaction.md#to)_ -_Defined in [transaction.ts:27](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L27)_ +_Defined in [transaction.ts:28](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L28)_ --- @@ -207,7 +208,7 @@ _Defined in [transaction.ts:27](https://github.com/alcuadrado/ethereumjs-tx/blob _Inherited from [Transaction](transaction.md).[v](transaction.md#v)_ -_Defined in [transaction.ts:30](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L30)_ +_Defined in [transaction.ts:31](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L31)_ --- @@ -219,7 +220,7 @@ _Defined in [transaction.ts:30](https://github.com/alcuadrado/ethereumjs-tx/blob _Inherited from [Transaction](transaction.md).[value](transaction.md#value)_ -_Defined in [transaction.ts:28](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L28)_ +_Defined in [transaction.ts:29](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L29)_ --- @@ -233,7 +234,7 @@ _Defined in [transaction.ts:28](https://github.com/alcuadrado/ethereumjs-tx/blob _Inherited from [Transaction](transaction.md).[getBaseFee](transaction.md#getbasefee)_ -_Defined in [transaction.ts:314](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L314)_ +_Defined in [transaction.ts:296](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L296)_ the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) @@ -249,7 +250,7 @@ the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) _Inherited from [Transaction](transaction.md).[getChainId](transaction.md#getchainid)_ -_Defined in [transaction.ts:228](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L228)_ +_Defined in [transaction.ts:202](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L202)_ returns chain ID @@ -265,7 +266,7 @@ returns chain ID _Inherited from [Transaction](transaction.md).[getDataFee](transaction.md#getdatafee)_ -_Defined in [transaction.ts:300](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L300)_ +_Defined in [transaction.ts:282](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L282)_ The amount of gas paid for the data in this tx @@ -281,7 +282,7 @@ The amount of gas paid for the data in this tx _Inherited from [Transaction](transaction.md).[getSenderAddress](transaction.md#getsenderaddress)_ -_Defined in [transaction.ts:235](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L235)_ +_Defined in [transaction.ts:209](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L209)_ returns the sender's address @@ -297,7 +298,7 @@ returns the sender's address _Inherited from [Transaction](transaction.md).[getSenderPublicKey](transaction.md#getsenderpublickey)_ -_Defined in [transaction.ts:247](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L247)_ +_Defined in [transaction.ts:221](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L221)_ returns the public key of the sender @@ -313,7 +314,7 @@ returns the public key of the sender _Inherited from [Transaction](transaction.md).[getUpfrontCost](transaction.md#getupfrontcost)_ -_Defined in [transaction.ts:325](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L325)_ +_Defined in [transaction.ts:307](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L307)_ the up front amount that an account must have for this transaction to be valid @@ -329,7 +330,7 @@ the up front amount that an account must have for this transaction to be valid _Overrides [Transaction](transaction.md).[hash](transaction.md#hash)_ -_Defined in [fake.ts:54](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/fake.ts#L54)_ +_Defined in [fake.ts:53](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/fake.ts#L53)_ Computes a sha3-256 hash of the serialized tx, using the sender address to generate a fake signature. @@ -351,7 +352,7 @@ Computes a sha3-256 hash of the serialized tx, using the sender address to gener _Inherited from [Transaction](transaction.md).[serialize](transaction.md#serialize)_ -_Defined in [transaction.ts:355](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L355)_ +_Defined in [transaction.ts:337](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L337)_ Returns the rlp encoding of the transaction @@ -367,7 +368,7 @@ Returns the rlp encoding of the transaction _Inherited from [Transaction](transaction.md).[sign](transaction.md#sign)_ -_Defined in [transaction.ts:288](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L288)_ +_Defined in [transaction.ts:262](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L262)_ sign a transaction with a given private key @@ -389,7 +390,7 @@ sign a transaction with a given private key _Inherited from [Transaction](transaction.md).[toCreationAddress](transaction.md#tocreationaddress)_ -_Defined in [transaction.ts:181](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L181)_ +_Defined in [transaction.ts:169](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L169)_ If the tx's `to` is to the creation address @@ -397,6 +398,30 @@ If the tx's `to` is to the creation address --- + + +### toJSON + +▸ **toJSON**(labels?: _`boolean`_): `object` \| `string`[] + +_Inherited from [Transaction](transaction.md).[toJSON](transaction.md#tojson)_ + +_Defined in [transaction.ts:346](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L346)_ + +Returns the transaction in JSON format + +_**see**_: [ethereumjs-util](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties) + +**Parameters:** + +| Name | Type | Default value | +| ---------------------- | --------- | ------------- | +| `Default value` labels | `boolean` | false | + +**Returns:** `object` \| `string`[] + +--- + ### validate @@ -409,7 +434,7 @@ If the tx's `to` is to the creation address _Inherited from [Transaction](transaction.md).[validate](transaction.md#validate)_ -_Defined in [transaction.ts:332](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L332)_ +_Defined in [transaction.ts:314](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L314)_ Validates the signature and checks to see if it has enough gas. @@ -417,7 +442,7 @@ Validates the signature and checks to see if it has enough gas. _Inherited from [Transaction](transaction.md).[validate](transaction.md#validate)_ -_Defined in [transaction.ts:333](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L333)_ +_Defined in [transaction.ts:315](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L315)_ **Parameters:** @@ -429,7 +454,7 @@ _Defined in [transaction.ts:333](https://github.com/alcuadrado/ethereumjs-tx/blo _Inherited from [Transaction](transaction.md).[validate](transaction.md#validate)_ -_Defined in [transaction.ts:334](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L334)_ +_Defined in [transaction.ts:316](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L316)_ **Parameters:** @@ -449,7 +474,7 @@ _Defined in [transaction.ts:334](https://github.com/alcuadrado/ethereumjs-tx/blo _Inherited from [Transaction](transaction.md).[verifySignature](transaction.md#verifysignature)_ -_Defined in [transaction.ts:259](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L259)_ +_Defined in [transaction.ts:233](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L233)_ Determines if the signature is valid diff --git a/docs/classes/transaction.md b/docs/classes/transaction.md index 1b70de0..2734cdb 100644 --- a/docs/classes/transaction.md +++ b/docs/classes/transaction.md @@ -18,7 +18,6 @@ An Ethereum transaction. ### Properties -- [\_chainId](transaction.md#_chainid) - [\_common](transaction.md#_common) - [\_from](transaction.md#_from) - [\_senderPubKey](transaction.md#_senderpubkey) @@ -35,6 +34,10 @@ An Ethereum transaction. ### Methods +- [\_implementsEIP155](transaction.md#_implementseip155) +- [\_isSigned](transaction.md#_issigned) +- [\_overrideVSetterWithValidation](transaction.md#_overridevsetterwithvalidation) +- [\_validateV](transaction.md#_validatev) - [getBaseFee](transaction.md#getbasefee) - [getChainId](transaction.md#getchainid) - [getDataFee](transaction.md#getdatafee) @@ -45,6 +48,7 @@ An Ethereum transaction. - [serialize](transaction.md#serialize) - [sign](transaction.md#sign) - [toCreationAddress](transaction.md#tocreationaddress) +- [toJSON](transaction.md#tojson) - [validate](transaction.md#validate) - [verifySignature](transaction.md#verifysignature) @@ -58,10 +62,12 @@ An Ethereum transaction. ⊕ **new Transaction**(data?: _`Buffer` \| [PrefixedHexString](../#prefixedhexstring) \| [BufferLike](../#bufferlike)[] \| [TxData](../interfaces/txdata.md)_, opts?: _[TransactionOptions](../interfaces/transactionoptions.md)_): [Transaction](transaction.md) -_Defined in [transaction.ts:37](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L37)_ +_Defined in [transaction.ts:37](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L37)_ Creates a new transaction from an object with its fields' values. +_**note**_: Transaction objects implement EIP155 by default. To disable it, use the constructor's second parameter to set a chain and hardfork before EIP155 activation (i.e. before Spurious Dragon.) + _**example**_: ```js @@ -81,10 +87,10 @@ const tx = new Transaction(txData) **Parameters:** -| Name | Type | Default value | Description | -| -------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Default value` data | `Buffer` \| [PrefixedHexString](../#prefixedhexstring) \| [BufferLike](../#bufferlike)[] \| [TxData](../interfaces/txdata.md) | {} | A transaction can be initialized with its rlp representation, an array containing the value of its fields in order, or an object containing them by name. If the latter is used, a \`chainId\` can also be provided. | -| `Default value` opts | [TransactionOptions](../interfaces/transactionoptions.md) | {} | The transaction's options, used to indicate the chain and hardfork the transactions belongs to. | +| Name | Type | Default value | Description | +| -------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Default value` data | `Buffer` \| [PrefixedHexString](../#prefixedhexstring) \| [BufferLike](../#bufferlike)[] \| [TxData](../interfaces/txdata.md) | {} | A transaction can be initialized with its rlp representation, an array containing the value of its fields in order, or an object containing them by name. | +| `Default value` opts | [TransactionOptions](../interfaces/transactionoptions.md) | {} | The transaction's options, used to indicate the chain and hardfork the transactions belongs to. | **Returns:** [Transaction](transaction.md) @@ -92,23 +98,13 @@ const tx = new Transaction(txData) ## Properties - - -### `` \_chainId - -**● \_chainId**: _`number`_ - -_Defined in [transaction.ts:35](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L35)_ - ---- - ### `` \_common **● \_common**: _`Common`_ -_Defined in [transaction.ts:34](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L34)_ +_Defined in [transaction.ts:35](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L35)_ --- @@ -118,7 +114,7 @@ _Defined in [transaction.ts:34](https://github.com/alcuadrado/ethereumjs-tx/blob **● \_from**: _`Buffer`_ -_Defined in [transaction.ts:37](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L37)_ +_Defined in [transaction.ts:37](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L37)_ --- @@ -128,7 +124,7 @@ _Defined in [transaction.ts:37](https://github.com/alcuadrado/ethereumjs-tx/blob **● \_senderPubKey**: _`Buffer`_ -_Defined in [transaction.ts:36](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L36)_ +_Defined in [transaction.ts:36](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L36)_ --- @@ -138,7 +134,7 @@ _Defined in [transaction.ts:36](https://github.com/alcuadrado/ethereumjs-tx/blob **● data**: _`Buffer`_ -_Defined in [transaction.ts:29](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L29)_ +_Defined in [transaction.ts:30](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L30)_ --- @@ -148,7 +144,7 @@ _Defined in [transaction.ts:29](https://github.com/alcuadrado/ethereumjs-tx/blob **● gasLimit**: _`Buffer`_ -_Defined in [transaction.ts:25](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L25)_ +_Defined in [transaction.ts:26](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L26)_ --- @@ -158,7 +154,7 @@ _Defined in [transaction.ts:25](https://github.com/alcuadrado/ethereumjs-tx/blob **● gasPrice**: _`Buffer`_ -_Defined in [transaction.ts:26](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L26)_ +_Defined in [transaction.ts:27](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L27)_ --- @@ -168,7 +164,7 @@ _Defined in [transaction.ts:26](https://github.com/alcuadrado/ethereumjs-tx/blob **● nonce**: _`Buffer`_ -_Defined in [transaction.ts:24](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L24)_ +_Defined in [transaction.ts:25](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L25)_ --- @@ -178,7 +174,7 @@ _Defined in [transaction.ts:24](https://github.com/alcuadrado/ethereumjs-tx/blob **● r**: _`Buffer`_ -_Defined in [transaction.ts:31](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L31)_ +_Defined in [transaction.ts:32](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L32)_ --- @@ -188,7 +184,7 @@ _Defined in [transaction.ts:31](https://github.com/alcuadrado/ethereumjs-tx/blob **● raw**: _`Buffer`[]_ -_Defined in [transaction.ts:23](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L23)_ +_Defined in [transaction.ts:24](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L24)_ --- @@ -198,7 +194,7 @@ _Defined in [transaction.ts:23](https://github.com/alcuadrado/ethereumjs-tx/blob **● s**: _`Buffer`_ -_Defined in [transaction.ts:32](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L32)_ +_Defined in [transaction.ts:33](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L33)_ --- @@ -208,7 +204,7 @@ _Defined in [transaction.ts:32](https://github.com/alcuadrado/ethereumjs-tx/blob **● to**: _`Buffer`_ -_Defined in [transaction.ts:27](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L27)_ +_Defined in [transaction.ts:28](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L28)_ --- @@ -218,7 +214,7 @@ _Defined in [transaction.ts:27](https://github.com/alcuadrado/ethereumjs-tx/blob **● v**: _`Buffer`_ -_Defined in [transaction.ts:30](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L30)_ +_Defined in [transaction.ts:31](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L31)_ --- @@ -228,19 +224,73 @@ _Defined in [transaction.ts:30](https://github.com/alcuadrado/ethereumjs-tx/blob **● value**: _`Buffer`_ -_Defined in [transaction.ts:28](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L28)_ +_Defined in [transaction.ts:29](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L29)_ --- ## Methods + + +### `` \_implementsEIP155 + +▸ **\_implementsEIP155**(): `boolean` + +_Defined in [transaction.ts:395](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L395)_ + +**Returns:** `boolean` + +--- + + + +### `` \_isSigned + +▸ **\_isSigned**(): `boolean` + +_Defined in [transaction.ts:376](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L376)_ + +**Returns:** `boolean` + +--- + + + +### `` \_overrideVSetterWithValidation + +▸ **\_overrideVSetterWithValidation**(): `void` + +_Defined in [transaction.ts:380](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L380)_ + +**Returns:** `void` + +--- + + + +### `` \_validateV + +▸ **\_validateV**(v?: _`Buffer`_): `void` + +_Defined in [transaction.ts:351](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L351)_ + +**Parameters:** + +| Name | Type | +| ------------ | -------- | +| `Optional` v | `Buffer` | + +**Returns:** `void` + +--- + ### getBaseFee ▸ **getBaseFee**(): `BN` -_Defined in [transaction.ts:314](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L314)_ +_Defined in [transaction.ts:296](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L296)_ the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) @@ -254,7 +304,7 @@ the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) ▸ **getChainId**(): `number` -_Defined in [transaction.ts:228](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L228)_ +_Defined in [transaction.ts:202](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L202)_ returns chain ID @@ -268,7 +318,7 @@ returns chain ID ▸ **getDataFee**(): `BN` -_Defined in [transaction.ts:300](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L300)_ +_Defined in [transaction.ts:282](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L282)_ The amount of gas paid for the data in this tx @@ -282,7 +332,7 @@ The amount of gas paid for the data in this tx ▸ **getSenderAddress**(): `Buffer` -_Defined in [transaction.ts:235](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L235)_ +_Defined in [transaction.ts:209](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L209)_ returns the sender's address @@ -296,7 +346,7 @@ returns the sender's address ▸ **getSenderPublicKey**(): `Buffer` -_Defined in [transaction.ts:247](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L247)_ +_Defined in [transaction.ts:221](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L221)_ returns the public key of the sender @@ -310,7 +360,7 @@ returns the public key of the sender ▸ **getUpfrontCost**(): `BN` -_Defined in [transaction.ts:325](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L325)_ +_Defined in [transaction.ts:307](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L307)_ the up front amount that an account must have for this transaction to be valid @@ -324,7 +374,7 @@ the up front amount that an account must have for this transaction to be valid ▸ **hash**(includeSignature?: _`boolean`_): `Buffer` -_Defined in [transaction.ts:189](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L189)_ +_Defined in [transaction.ts:177](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L177)_ Computes a sha3-256 hash of the serialized tx @@ -344,7 +394,7 @@ Computes a sha3-256 hash of the serialized tx ▸ **serialize**(): `Buffer` -_Defined in [transaction.ts:355](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L355)_ +_Defined in [transaction.ts:337](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L337)_ Returns the rlp encoding of the transaction @@ -358,7 +408,7 @@ Returns the rlp encoding of the transaction ▸ **sign**(privateKey: _`Buffer`_): `void` -_Defined in [transaction.ts:288](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L288)_ +_Defined in [transaction.ts:262](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L262)_ sign a transaction with a given private key @@ -378,7 +428,7 @@ sign a transaction with a given private key ▸ **toCreationAddress**(): `boolean` -_Defined in [transaction.ts:181](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L181)_ +_Defined in [transaction.ts:169](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L169)_ If the tx's `to` is to the creation address @@ -386,6 +436,28 @@ If the tx's `to` is to the creation address --- + + +### toJSON + +▸ **toJSON**(labels?: _`boolean`_): `object` \| `string`[] + +_Defined in [transaction.ts:346](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L346)_ + +Returns the transaction in JSON format + +_**see**_: [ethereumjs-util](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties) + +**Parameters:** + +| Name | Type | Default value | +| ---------------------- | --------- | ------------- | +| `Default value` labels | `boolean` | false | + +**Returns:** `object` \| `string`[] + +--- + ### validate @@ -396,13 +468,13 @@ If the tx's `to` is to the creation address ▸ **validate**(stringError: _`true`_): `string` -_Defined in [transaction.ts:332](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L332)_ +_Defined in [transaction.ts:314](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L314)_ Validates the signature and checks to see if it has enough gas. **Returns:** `boolean` -_Defined in [transaction.ts:333](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L333)_ +_Defined in [transaction.ts:315](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L315)_ **Parameters:** @@ -412,7 +484,7 @@ _Defined in [transaction.ts:333](https://github.com/alcuadrado/ethereumjs-tx/blo **Returns:** `boolean` -_Defined in [transaction.ts:334](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L334)_ +_Defined in [transaction.ts:316](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L316)_ **Parameters:** @@ -430,7 +502,7 @@ _Defined in [transaction.ts:334](https://github.com/alcuadrado/ethereumjs-tx/blo ▸ **verifySignature**(): `boolean` -_Defined in [transaction.ts:259](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/transaction.ts#L259)_ +_Defined in [transaction.ts:233](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/transaction.ts#L233)_ Determines if the signature is valid diff --git a/docs/interfaces/faketxdata.md b/docs/interfaces/faketxdata.md index 7e1983e..eace22d 100644 --- a/docs/interfaces/faketxdata.md +++ b/docs/interfaces/faketxdata.md @@ -14,7 +14,6 @@ The data of a fake (self-signing) transaction. ### Properties -- [chainId](faketxdata.md#chainid) - [data](faketxdata.md#data) - [from](faketxdata.md#from) - [gasLimit](faketxdata.md#gaslimit) @@ -30,20 +29,6 @@ The data of a fake (self-signing) transaction. ## Properties - - -### `` chainId - -**● chainId**: _`undefined` \| `number`_ - -_Inherited from [TxData](txdata.md).[chainId](txdata.md#chainid)_ - -_Defined in [types.ts:28](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L28)_ - -EIP 155 chainId - mainnet: 1, ropsten: 3 - ---- - ### `` data @@ -52,7 +37,7 @@ EIP 155 chainId - mainnet: 1, ropsten: 3 _Inherited from [TxData](txdata.md).[data](txdata.md#data)_ -_Defined in [types.ts:53](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L53)_ +_Defined in [types.ts:48](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L48)_ This will contain the data of the message or the init of a contract @@ -64,7 +49,7 @@ This will contain the data of the message or the init of a contract **● from**: _[BufferLike](../#bufferlike)_ -_Defined in [types.ts:83](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L83)_ +_Defined in [types.ts:78](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L78)_ The sender of the Tx. @@ -78,7 +63,7 @@ The sender of the Tx. _Inherited from [TxData](txdata.md).[gasLimit](txdata.md#gaslimit)_ -_Defined in [types.ts:33](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L33)_ +_Defined in [types.ts:28](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L28)_ The transaction's gas limit. @@ -92,7 +77,7 @@ The transaction's gas limit. _Inherited from [TxData](txdata.md).[gasPrice](txdata.md#gasprice)_ -_Defined in [types.ts:38](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L38)_ +_Defined in [types.ts:33](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L33)_ The transaction's gas price. @@ -106,7 +91,7 @@ The transaction's gas price. _Inherited from [TxData](txdata.md).[nonce](txdata.md#nonce)_ -_Defined in [types.ts:48](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L48)_ +_Defined in [types.ts:43](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L43)_ The transaction's nonce. @@ -120,7 +105,7 @@ The transaction's nonce. _Inherited from [TxData](txdata.md).[r](txdata.md#r)_ -_Defined in [types.ts:63](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L63)_ +_Defined in [types.ts:58](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L58)_ EC signature parameter. @@ -134,7 +119,7 @@ EC signature parameter. _Inherited from [TxData](txdata.md).[s](txdata.md#s)_ -_Defined in [types.ts:68](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L68)_ +_Defined in [types.ts:63](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L63)_ EC signature parameter. @@ -148,7 +133,7 @@ EC signature parameter. _Inherited from [TxData](txdata.md).[to](txdata.md#to)_ -_Defined in [types.ts:43](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L43)_ +_Defined in [types.ts:38](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L38)_ The transaction's the address is sent to. @@ -162,7 +147,7 @@ The transaction's the address is sent to. _Inherited from [TxData](txdata.md).[v](txdata.md#v)_ -_Defined in [types.ts:58](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L58)_ +_Defined in [types.ts:53](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L53)_ EC recovery ID. @@ -176,7 +161,7 @@ EC recovery ID. _Inherited from [TxData](txdata.md).[value](txdata.md#value)_ -_Defined in [types.ts:73](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L73)_ +_Defined in [types.ts:68](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L68)_ The amount of Ether sent. diff --git a/docs/interfaces/transactionoptions.md b/docs/interfaces/transactionoptions.md index 8278f58..3a6fce8 100644 --- a/docs/interfaces/transactionoptions.md +++ b/docs/interfaces/transactionoptions.md @@ -26,9 +26,9 @@ The transaction's options. This could be specified using a Common object, or `ch **● chain**: _`number` \| `string`_ -_Defined in [types.ts:99](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L99)_ +_Defined in [types.ts:94](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L94)_ -The chain of the transaction. +The chain of the transaction, default: 'mainnet' --- @@ -38,7 +38,7 @@ The chain of the transaction. **● common**: _`Common`_ -_Defined in [types.ts:94](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L94)_ +_Defined in [types.ts:89](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L89)_ A Common object defining the chain and the hardfork a transaction belongs to. @@ -50,8 +50,8 @@ A Common object defining the chain and the hardfork a transaction belongs to. **● hardfork**: _`undefined` \| `string`_ -_Defined in [types.ts:104](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L104)_ +_Defined in [types.ts:99](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L99)_ -The hardfork of the transaction. +The hardfork of the transaction, default: 'petersburg' --- diff --git a/docs/interfaces/transformabletobuffer.md b/docs/interfaces/transformabletobuffer.md index 443ba8e..7b9c0c8 100644 --- a/docs/interfaces/transformabletobuffer.md +++ b/docs/interfaces/transformabletobuffer.md @@ -24,7 +24,7 @@ Any object that can be transformed into a `Buffer` ▸ **toBuffer**(): `Buffer` -_Defined in [types.ts:8](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L8)_ +_Defined in [types.ts:8](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L8)_ **Returns:** `Buffer` diff --git a/docs/interfaces/txdata.md b/docs/interfaces/txdata.md index b8bea7f..f952c2d 100644 --- a/docs/interfaces/txdata.md +++ b/docs/interfaces/txdata.md @@ -14,7 +14,6 @@ A transaction's data. ### Properties -- [chainId](txdata.md#chainid) - [data](txdata.md#data) - [gasLimit](txdata.md#gaslimit) - [gasPrice](txdata.md#gasprice) @@ -29,25 +28,13 @@ A transaction's data. ## Properties - - -### `` chainId - -**● chainId**: _`undefined` \| `number`_ - -_Defined in [types.ts:28](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L28)_ - -EIP 155 chainId - mainnet: 1, ropsten: 3 - ---- - ### `` data **● data**: _[BufferLike](../#bufferlike)_ -_Defined in [types.ts:53](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L53)_ +_Defined in [types.ts:48](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L48)_ This will contain the data of the message or the init of a contract @@ -59,7 +46,7 @@ This will contain the data of the message or the init of a contract **● gasLimit**: _[BufferLike](../#bufferlike)_ -_Defined in [types.ts:33](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L33)_ +_Defined in [types.ts:28](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L28)_ The transaction's gas limit. @@ -71,7 +58,7 @@ The transaction's gas limit. **● gasPrice**: _[BufferLike](../#bufferlike)_ -_Defined in [types.ts:38](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L38)_ +_Defined in [types.ts:33](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L33)_ The transaction's gas price. @@ -83,7 +70,7 @@ The transaction's gas price. **● nonce**: _[BufferLike](../#bufferlike)_ -_Defined in [types.ts:48](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L48)_ +_Defined in [types.ts:43](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L43)_ The transaction's nonce. @@ -95,7 +82,7 @@ The transaction's nonce. **● r**: _[BufferLike](../#bufferlike)_ -_Defined in [types.ts:63](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L63)_ +_Defined in [types.ts:58](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L58)_ EC signature parameter. @@ -107,7 +94,7 @@ EC signature parameter. **● s**: _[BufferLike](../#bufferlike)_ -_Defined in [types.ts:68](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L68)_ +_Defined in [types.ts:63](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L63)_ EC signature parameter. @@ -119,7 +106,7 @@ EC signature parameter. **● to**: _[BufferLike](../#bufferlike)_ -_Defined in [types.ts:43](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L43)_ +_Defined in [types.ts:38](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L38)_ The transaction's the address is sent to. @@ -131,7 +118,7 @@ The transaction's the address is sent to. **● v**: _[BufferLike](../#bufferlike)_ -_Defined in [types.ts:58](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L58)_ +_Defined in [types.ts:53](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L53)_ EC recovery ID. @@ -143,7 +130,7 @@ EC recovery ID. **● value**: _[BufferLike](../#bufferlike)_ -_Defined in [types.ts:73](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L73)_ +_Defined in [types.ts:68](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L68)_ The amount of Ether sent. diff --git a/package.json b/package.json index 77c8778..ff1e70a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ethereumjs-tx", - "version": "1.3.7", + "version": "2.0.0", "description": "An simple module for creating, manipulating and signing ethereum transactions", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/types.ts b/src/types.ts index af8e2e2..8b3a689 100644 --- a/src/types.ts +++ b/src/types.ts @@ -89,12 +89,12 @@ export interface TransactionOptions { common?: Common /** - * The chain of the transaction. + * The chain of the transaction, default: 'mainnet' */ chain?: number | string /** - * The hardfork of the transaction. + * The hardfork of the transaction, default: 'petersburg' */ hardfork?: string }