From 0d5313a39119249771ad8215b3ab42679af8686b Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Tue, 18 Jun 2019 18:20:37 -0300 Subject: [PATCH 1/3] Regenerate docs --- docs/README.md | 32 ++-- docs/classes/common.md | 212 +++++++++++++++------------ docs/interfaces/bootstrapnode.md | 93 ++++++++++++ docs/interfaces/chain.md | 104 +++++++++++++ docs/interfaces/chainstype.md | 4 +- docs/interfaces/genesisblock.md | 93 ++++++++++++ docs/interfaces/genesisstatestype.md | 2 +- docs/interfaces/hardfork.md | 60 ++++++++ docs/interfaces/hardforkoptions.md | 8 +- 9 files changed, 493 insertions(+), 115 deletions(-) create mode 100644 docs/interfaces/bootstrapnode.md create mode 100644 docs/interfaces/chain.md create mode 100644 docs/interfaces/genesisblock.md create mode 100644 docs/interfaces/hardfork.md diff --git a/docs/README.md b/docs/README.md index 6331aab..52512cc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,6 +8,10 @@ ### Interfaces +- [BootstrapNode](interfaces/bootstrapnode.md) +- [Chain](interfaces/chain.md) +- [GenesisBlock](interfaces/genesisblock.md) +- [Hardfork](interfaces/hardfork.md) - [chainsType](interfaces/chainstype.md) - [genesisStatesType](interfaces/genesisstatestype.md) - [hardforkOptions](interfaces/hardforkoptions.md) @@ -31,7 +35,7 @@ ▸ **genesisStateById**(id: _`number`_): `any` -_Defined in [genesisStates/index.ts:23](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L23)_ +_Defined in [genesisStates/index.ts:23](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L23)_ Returns the genesis state by network ID @@ -52,7 +56,7 @@ Dictionary with genesis accounts ▸ **genesisStateByName**(name: _`string`_): `any` -_Defined in [genesisStates/index.ts:32](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L32)_ +_Defined in [genesisStates/index.ts:32](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L32)_ Returns the genesis state by network name @@ -75,7 +79,7 @@ Dictionary with genesis accounts **genesisStates**: _`object`_ -_Defined in [genesisStates/index.ts:3](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L3)_ +_Defined in [genesisStates/index.ts:3](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L3)_ @@ -83,7 +87,7 @@ _Defined in [genesisStates/index.ts:3](https://github.com/ethereumjs/ethereumjs- **● goerli**: _`any`_ = require('./goerli.json') -_Defined in [genesisStates/index.ts:15](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L15)_ +_Defined in [genesisStates/index.ts:15](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L15)_ --- @@ -93,7 +97,7 @@ _Defined in [genesisStates/index.ts:15](https://github.com/ethereumjs/ethereumjs **● kovan**: _`any`_ = require('./kovan.json') -_Defined in [genesisStates/index.ts:14](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L14)_ +_Defined in [genesisStates/index.ts:14](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L14)_ --- @@ -103,7 +107,7 @@ _Defined in [genesisStates/index.ts:14](https://github.com/ethereumjs/ethereumjs **● mainnet**: _`any`_ = require('./mainnet.json') -_Defined in [genesisStates/index.ts:11](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L11)_ +_Defined in [genesisStates/index.ts:11](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L11)_ --- @@ -113,7 +117,7 @@ _Defined in [genesisStates/index.ts:11](https://github.com/ethereumjs/ethereumjs **● rinkeby**: _`any`_ = require('./rinkeby.json') -_Defined in [genesisStates/index.ts:13](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L13)_ +_Defined in [genesisStates/index.ts:13](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L13)_ --- @@ -123,7 +127,7 @@ _Defined in [genesisStates/index.ts:13](https://github.com/ethereumjs/ethereumjs **● ropsten**: _`any`_ = require('./ropsten.json') -_Defined in [genesisStates/index.ts:12](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L12)_ +_Defined in [genesisStates/index.ts:12](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L12)_ --- @@ -133,7 +137,7 @@ _Defined in [genesisStates/index.ts:12](https://github.com/ethereumjs/ethereumjs **names**: _`object`_ -_Defined in [genesisStates/index.ts:4](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L4)_ +_Defined in [genesisStates/index.ts:4](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L4)_ @@ -141,7 +145,7 @@ _Defined in [genesisStates/index.ts:4](https://github.com/ethereumjs/ethereumjs- **● 1**: _`string`_ = "mainnet" -_Defined in [genesisStates/index.ts:5](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L5)_ +_Defined in [genesisStates/index.ts:5](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L5)_ --- @@ -151,7 +155,7 @@ _Defined in [genesisStates/index.ts:5](https://github.com/ethereumjs/ethereumjs- **● 3**: _`string`_ = "ropsten" -_Defined in [genesisStates/index.ts:6](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L6)_ +_Defined in [genesisStates/index.ts:6](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L6)_ --- @@ -161,7 +165,7 @@ _Defined in [genesisStates/index.ts:6](https://github.com/ethereumjs/ethereumjs- **● 4**: _`string`_ = "rinkeby" -_Defined in [genesisStates/index.ts:7](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L7)_ +_Defined in [genesisStates/index.ts:7](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L7)_ --- @@ -171,7 +175,7 @@ _Defined in [genesisStates/index.ts:7](https://github.com/ethereumjs/ethereumjs- **● 42**: _`string`_ = "kovan" -_Defined in [genesisStates/index.ts:8](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L8)_ +_Defined in [genesisStates/index.ts:8](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L8)_ --- @@ -181,7 +185,7 @@ _Defined in [genesisStates/index.ts:8](https://github.com/ethereumjs/ethereumjs- **● 6284**: _`string`_ = "goerli" -_Defined in [genesisStates/index.ts:9](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/genesisStates/index.ts#L9)_ +_Defined in [genesisStates/index.ts:9](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/genesisStates/index.ts#L9)_ --- diff --git a/docs/classes/common.md b/docs/classes/common.md index 27da011..aa8dcf5 100644 --- a/docs/classes/common.md +++ b/docs/classes/common.md @@ -41,6 +41,7 @@ Common class to access chain and hardfork parameters - [paramByBlock](common.md#parambyblock) - [setChain](common.md#setchain) - [setHardfork](common.md#sethardfork) +- [forCustomChain](common.md#forcustomchain) --- @@ -50,19 +51,19 @@ Common class to access chain and hardfork parameters ### constructor -⊕ **new Common**(chain: _`string` | `number` | `object`_, hardfork?: _`string` | `null`_, supportedHardforks?: _`Array`<`string`>_): [Common](common.md) +⊕ **new Common**(chain: _`string` \| `number` \| `object`_, hardfork?: _`string` \| `null`_, supportedHardforks?: _`Array`<`string`>_): [Common](common.md) -_Defined in [index.ts:17](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L17)_ +_Defined in [index.ts:62](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L62)_ _**constructor**_: **Parameters:** -| Name | Type | Description | -| ----------------------------- | ----------------- | --------------------------------------------------------- | -| chain | `string` | `number` | `object` | String ('mainnet') or Number (1) chain | -| `Optional` hardfork | `string` | `null` | String identifier ('byzantium') for hardfork (optional) | -| `Optional` supportedHardforks | `Array`<`string`> | Limit parameter returns to the given hardforks (optional) | +| Name | Type | Description | +| ----------------------------- | -------------------------------- | --------------------------------------------------------- | +| chain | `string` \| `number` \| `object` | String ('mainnet') or Number (1) chain | +| `Optional` hardfork | `string` \| `null` | String identifier ('byzantium') for hardfork (optional) | +| `Optional` supportedHardforks | `Array`<`string`> | Limit parameter returns to the given hardforks (optional) | **Returns:** [Common](common.md) @@ -74,18 +75,18 @@ _**constructor**_: ### \_chooseHardfork -▸ **\_chooseHardfork**(hardfork?: _`string` | `null`_, onlySupported?: _`undefined` | `false` | `true`_): `string` +▸ **\_chooseHardfork**(hardfork?: _`string` \| `null`_, onlySupported?: _`undefined` \| `false` \| `true`_): `string` -_Defined in [index.ts:96](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L96)_ +_Defined in [index.ts:131](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L131)_ Internal helper function to choose between hardfork set and hardfork provided as param **Parameters:** -| Name | Type | Description | -| ------------------------ | ----------- | ----------- | -| `Optional` hardfork | `string` | `null` | Hardfork given to function as a parameter | -| `Optional` onlySupported | `undefined` | `false` | `true` | +| Name | Type | Description | +| ------------------------ | -------------------------------- | ----------------------------------------- | +| `Optional` hardfork | `string` \| `null` | Hardfork given to function as a parameter | +| `Optional` onlySupported | `undefined` \| `false` \| `true` | **Returns:** `string` Hardfork chosen to be used @@ -98,7 +99,7 @@ Hardfork chosen to be used ▸ **\_getHardfork**(hardfork: _`string`_): `any` -_Defined in [index.ts:115](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L115)_ +_Defined in [index.ts:150](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L150)_ Internal helper function, returns the params for the given hardfork for the chain set @@ -117,17 +118,17 @@ Dictionary with hardfork params ### \_isSupportedHardfork -▸ **\_isSupportedHardfork**(hardfork: _`string` | `null`_): `boolean` +▸ **\_isSupportedHardfork**(hardfork: _`string` \| `null`_): `boolean` -_Defined in [index.ts:128](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L128)_ +_Defined in [index.ts:163](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L163)_ Internal helper function to check if a hardfork is set to be supported by the library **Parameters:** -| Name | Type | Description | -| -------- | -------- | ----------- | -| hardfork | `string` | `null` | Hardfork name | +| Name | Type | Description | +| -------- | ------------------ | ------------- | +| hardfork | `string` \| `null` | Hardfork name | **Returns:** `boolean` True if hardfork is supported @@ -138,18 +139,18 @@ True if hardfork is supported ### activeHardfork -▸ **activeHardfork**(blockNumber?: _`number` | `null`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `string` +▸ **activeHardfork**(blockNumber?: _`number` \| `null`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `string` -_Defined in [index.ts:292](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L292)_ +_Defined in [index.ts:327](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L327)_ Returns the latest active hardfork name for chain or block or throws if unavailable **Parameters:** -| Name | Type | Description | -| ---------------------- | --------------------------------------------------- | ------------------------------------ | -| `Optional` blockNumber | `number` | `null` | up to block if provided, otherwise for the whole chain | -| `Optional` opts | [hardforkOptions](../interfaces/hardforkoptions.md) | Hardfork options (onlyActive unused) | +| Name | Type | Description | +| ---------------------- | --------------------------------------------------- | ------------------------------------------------------ | +| `Optional` blockNumber | `number` \| `null` | up to block if provided, otherwise for the whole chain | +| `Optional` opts | [hardforkOptions](../interfaces/hardforkoptions.md) | Hardfork options (onlyActive unused) | **Returns:** `string` Hardfork name @@ -160,18 +161,18 @@ Hardfork name ### activeHardforks -▸ **activeHardforks**(blockNumber?: _`number` | `null`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `Array`<`any`> +▸ **activeHardforks**(blockNumber?: _`number` \| `null`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `Array`<`any`> -_Defined in [index.ts:272](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L272)_ +_Defined in [index.ts:307](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L307)_ Returns the active hardfork switches for the current chain **Parameters:** -| Name | Type | Description | -| ---------------------- | --------------------------------------------------- | ------------------------------------ | -| `Optional` blockNumber | `number` | `null` | up to block if provided, otherwise for the whole chain | -| `Optional` opts | [hardforkOptions](../interfaces/hardforkoptions.md) | Hardfork options (onlyActive unused) | +| Name | Type | Description | +| ---------------------- | --------------------------------------------------- | ------------------------------------------------------ | +| `Optional` blockNumber | `number` \| `null` | up to block if provided, otherwise for the whole chain | +| `Optional` opts | [hardforkOptions](../interfaces/hardforkoptions.md) | Hardfork options (onlyActive unused) | **Returns:** `Array`<`any`> Array with hardfork arrays @@ -184,7 +185,7 @@ Array with hardfork arrays ▸ **activeOnBlock**(blockNumber: _`number`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `boolean` -_Defined in [index.ts:202](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L202)_ +_Defined in [index.ts:237](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L237)_ Alias to hardforkIsActiveOnBlock when hardfork is set @@ -206,7 +207,7 @@ True if HF is active on block number ▸ **bootstrapNodes**(): `any` -_Defined in [index.ts:367](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L367)_ +_Defined in [index.ts:402](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L402)_ Returns bootstrap nodes for the current chain @@ -221,7 +222,7 @@ Dict with bootstrap nodes ▸ **chainId**(): `number` -_Defined in [index.ts:383](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L383)_ +_Defined in [index.ts:418](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L418)_ Returns the Id of current chain @@ -236,7 +237,7 @@ chain Id ▸ **chainName**(): `string` -_Defined in [index.ts:391](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L391)_ +_Defined in [index.ts:426](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L426)_ Returns the name of current chain @@ -249,17 +250,17 @@ chain name (lower case) ### consensus -▸ **consensus**(hardfork?: _`undefined` | `string`_): `string` +▸ **consensus**(hardfork?: _`undefined` \| `string`_): `string` -_Defined in [index.ts:332](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L332)_ +_Defined in [index.ts:367](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L367)_ Provide the consensus type for the hardfork set or provided as param **Parameters:** -| Name | Type | Description | -| ------------------- | ----------- | ----------- | -| `Optional` hardfork | `undefined` | `string` | Hardfork name, optional if hardfork set | +| Name | Type | Description | +| ------------------- | ----------------------- | --------------------------------------- | +| `Optional` hardfork | `undefined` \| `string` | Hardfork name, optional if hardfork set | **Returns:** `string` Consensus type (e.g. 'pow', 'poa') @@ -270,17 +271,17 @@ Consensus type (e.g. 'pow', 'poa') ### finality -▸ **finality**(hardfork?: _`undefined` | `string`_): `string` +▸ **finality**(hardfork?: _`undefined` \| `string`_): `string` -_Defined in [index.ts:342](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L342)_ +_Defined in [index.ts:377](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L377)_ Provide the finality type for the hardfork set or provided as param **Parameters:** -| Name | Type | Description | -| ------------------- | ----------- | ----------- | -| `Optional` hardfork | `undefined` | `string` | Hardfork name, optional if hardfork set | +| Name | Type | Description | +| ------------------- | ----------------------- | --------------------------------------- | +| `Optional` hardfork | `undefined` \| `string` | Hardfork name, optional if hardfork set | **Returns:** `string` Finality type (e.g. 'pos', null of no finality) @@ -293,7 +294,7 @@ Finality type (e.g. 'pos', null of no finality) ▸ **genesis**(): `any` -_Defined in [index.ts:351](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L351)_ +_Defined in [index.ts:386](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L386)_ Returns the Genesis parameters of current chain @@ -308,7 +309,7 @@ Genesis dictionary ▸ **gteHardfork**(hardfork: _`string`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `boolean` -_Defined in [index.ts:246](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L246)_ +_Defined in [index.ts:281](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L281)_ Alias to hardforkGteHardfork when hardfork is set @@ -328,13 +329,13 @@ True if hardfork set is greater than hardfork provided ### hardfork -▸ **hardfork**(): `string` | `null` +▸ **hardfork**(): `string` \| `null` -_Defined in [index.ts:375](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L375)_ +_Defined in [index.ts:410](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L410)_ Returns the hardfork set -**Returns:** `string` | `null` +**Returns:** `string` \| `null` Hardfork name --- @@ -343,17 +344,17 @@ Hardfork name ### hardforkBlock -▸ **hardforkBlock**(hardfork?: _`undefined` | `string`_): `number` +▸ **hardforkBlock**(hardfork?: _`undefined` \| `string`_): `number` -_Defined in [index.ts:307](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L307)_ +_Defined in [index.ts:342](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L342)_ Returns the hardfork change block for hardfork provided or set **Parameters:** -| Name | Type | Description | -| ------------------- | ----------- | ----------- | -| `Optional` hardfork | `undefined` | `string` | Hardfork name, optional if HF set | +| Name | Type | Description | +| ------------------- | ----------------------- | --------------------------------- | +| `Optional` hardfork | `undefined` \| `string` | Hardfork name, optional if HF set | **Returns:** `number` Block number @@ -364,19 +365,19 @@ Block number ### hardforkGteHardfork -▸ **hardforkGteHardfork**(hardfork1: _`string` | `null`_, hardfork2: _`string`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `boolean` +▸ **hardforkGteHardfork**(hardfork1: _`string` \| `null`_, hardfork2: _`string`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `boolean` -_Defined in [index.ts:213](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L213)_ +_Defined in [index.ts:248](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L248)_ Sequence based check if given or set HF1 is greater than or equal HF2 **Parameters:** -| Name | Type | Description | -| --------------- | --------------------------------------------------- | ---------------- | -| hardfork1 | `string` | `null` | Hardfork name or null (if set) | -| hardfork2 | `string` | Hardfork name | -| `Optional` opts | [hardforkOptions](../interfaces/hardforkoptions.md) | Hardfork options | +| Name | Type | Description | +| --------------- | --------------------------------------------------- | ------------------------------ | +| hardfork1 | `string` \| `null` | Hardfork name or null (if set) | +| hardfork2 | `string` | Hardfork name | +| `Optional` opts | [hardforkOptions](../interfaces/hardforkoptions.md) | Hardfork options | **Returns:** `boolean` True if HF1 gte HF2 @@ -387,9 +388,9 @@ True if HF1 gte HF2 ### hardforkIsActiveOnBlock -▸ **hardforkIsActiveOnBlock**(hardfork: _`string` | `null`_, blockNumber: _`number`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `boolean` +▸ **hardforkIsActiveOnBlock**(hardfork: _`string` \| `null`_, blockNumber: _`number`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `boolean` -_Defined in [index.ts:183](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L183)_ +_Defined in [index.ts:218](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L218)_ Checks if set or provided hardfork is active on block number @@ -397,7 +398,7 @@ Checks if set or provided hardfork is active on block number | Name | Type | Description | | --------------- | --------------------------------------------------- | ------------------------------------ | -| hardfork | `string` | `null` | Hardfork name or null (for HF set) | +| hardfork | `string` \| `null` | Hardfork name or null (for HF set) | | blockNumber | `number` | \- | | `Optional` opts | [hardforkOptions](../interfaces/hardforkoptions.md) | Hardfork options (onlyActive unused) | @@ -410,9 +411,9 @@ True if HF is active on block number ### hardforkIsActiveOnChain -▸ **hardforkIsActiveOnChain**(hardfork?: _`string` | `null`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `boolean` +▸ **hardforkIsActiveOnChain**(hardfork?: _`string` \| `null`_, opts?: _[hardforkOptions](../interfaces/hardforkoptions.md)_): `boolean` -_Defined in [index.ts:256](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L256)_ +_Defined in [index.ts:291](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L291)_ Checks if given or set hardfork is active on the chain @@ -420,7 +421,7 @@ Checks if given or set hardfork is active on the chain | Name | Type | Description | | ------------------- | --------------------------------------------------- | ------------------------------------ | -| `Optional` hardfork | `string` | `null` | Hardfork name, optional if HF set | +| `Optional` hardfork | `string` \| `null` | Hardfork name, optional if HF set | | `Optional` opts | [hardforkOptions](../interfaces/hardforkoptions.md) | Hardfork options (onlyActive unused) | **Returns:** `boolean` @@ -434,7 +435,7 @@ True if hardfork is active on the chain ▸ **hardforks**(): `any` -_Defined in [index.ts:359](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L359)_ +_Defined in [index.ts:394](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L394)_ Returns the hardforks for current chain @@ -447,18 +448,18 @@ Array with arrays of hardforks ### isHardforkBlock -▸ **isHardforkBlock**(blockNumber: _`number`_, hardfork?: _`undefined` | `string`_): `boolean` +▸ **isHardforkBlock**(blockNumber: _`number`_, hardfork?: _`undefined` \| `string`_): `boolean` -_Defined in [index.ts:318](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L318)_ +_Defined in [index.ts:353](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L353)_ True if block number provided is the hardfork (given or set) change block of the current chain **Parameters:** -| Name | Type | Description | -| ------------------- | ----------- | ---------------------------- | -| blockNumber | `number` | Number of the block to check | -| `Optional` hardfork | `undefined` | `string` | Hardfork name, optional if HF set | +| Name | Type | Description | +| ------------------- | ----------------------- | --------------------------------- | +| blockNumber | `number` | Number of the block to check | +| `Optional` hardfork | `undefined` \| `string` | Hardfork name, optional if HF set | **Returns:** `boolean` True if blockNumber is HF block @@ -471,7 +472,7 @@ True if blockNumber is HF block ▸ **networkId**(): `number` -_Defined in [index.ts:399](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L399)_ +_Defined in [index.ts:434](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L434)_ Returns the Id of current network @@ -484,19 +485,19 @@ network Id ### param -▸ **param**(topic: _`string`_, name: _`string`_, hardfork?: _`undefined` | `string`_): `any` +▸ **param**(topic: _`string`_, name: _`string`_, hardfork?: _`undefined` \| `string`_): `any` -_Defined in [index.ts:145](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L145)_ +_Defined in [index.ts:180](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L180)_ Returns the parameter corresponding to a hardfork **Parameters:** -| Name | Type | Description | -| ------------------- | ----------- | ----------------------------------------------------------------------------- | -| topic | `string` | Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow', 'casper', 'sharding') | -| name | `string` | Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) | -| `Optional` hardfork | `undefined` | `string` | Hardfork name, optional if hardfork set | +| Name | Type | Description | +| ------------------- | ----------------------- | ----------------------------------------------------------------------------- | +| topic | `string` | Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow', 'casper', 'sharding') | +| name | `string` | Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) | +| `Optional` hardfork | `undefined` \| `string` | Hardfork name, optional if hardfork set | **Returns:** `any` @@ -508,7 +509,7 @@ Returns the parameter corresponding to a hardfork ▸ **paramByBlock**(topic: _`string`_, name: _`string`_, blockNumber: _`number`_): `any` -_Defined in [index.ts:170](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L170)_ +_Defined in [index.ts:205](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L205)_ Returns a parameter for the hardfork active on block number @@ -528,17 +529,17 @@ Returns a parameter for the hardfork active on block number ### setChain -▸ **setChain**(chain: _`string` | `number` | `object`_): `any` +▸ **setChain**(chain: _`string` \| `number` \| `object`_): `any` -_Defined in [index.ts:44](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L44)_ +_Defined in [index.ts:89](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L89)_ Sets the chain **Parameters:** -| Name | Type | Description | -| ----- | -------- | ----------- | -| chain | `string` | `number` | `object` | String ('mainnet') or Number (1) chain representation. Or, a Dictionary of chain parameters for a private network. | +| Name | Type | Description | +| ----- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| chain | `string` \| `number` \| `object` | String ('mainnet') or Number (1) chain representation. Or, a Dictionary of chain parameters for a private network. | **Returns:** `any` The dictionary with parameters set as chain @@ -549,18 +550,41 @@ The dictionary with parameters set as chain ### setHardfork -▸ **setHardfork**(hardfork: _`string` | `null`_): `void` +▸ **setHardfork**(hardfork: _`string` \| `null`_): `void` -_Defined in [index.ts:75](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L75)_ +_Defined in [index.ts:110](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L110)_ Sets the hardfork to get params for **Parameters:** -| Name | Type | Description | -| -------- | -------- | ----------- | -| hardfork | `string` | `null` | String identifier ('byzantium') | +| Name | Type | Description | +| -------- | ------------------ | ------------------------------- | +| hardfork | `string` \| `null` | String identifier ('byzantium') | **Returns:** `void` --- + + + +### `` forCustomChain + +▸ **forCustomChain**(baseChain: _`string` \| `number`_, customChainParams: _`Partial`<[Chain](../interfaces/chain.md)>_, hardfork?: _`string` \| `null`_, supportedHardforks?: _`Array`<`string`>_): [Common](common.md) + +_Defined in [index.ts:30](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L30)_ + +Creates a Common object for a custom chain, based on a standard one. It uses all the [Chain](../interfaces/chain.md) params from \[\[baseChain\]\] except the ones overridden in \[\[customChainParams\]\]. + +**Parameters:** + +| Name | Type | Description | +| ----------------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------- | +| baseChain | `string` \| `number` | The name (\`mainnet\`) or id (\`1\`) of a standard chain used to base the custom chain params on. | +| customChainParams | `Partial`<[Chain](../interfaces/chain.md)> | The custom parameters of the chain. | +| `Optional` hardfork | `string` \| `null` | String identifier ('byzantium') for hardfork (optional) | +| `Optional` supportedHardforks | `Array`<`string`> | Limit parameter returns to the given hardforks (optional) | + +**Returns:** [Common](common.md) + +--- diff --git a/docs/interfaces/bootstrapnode.md b/docs/interfaces/bootstrapnode.md new file mode 100644 index 0000000..e3297df --- /dev/null +++ b/docs/interfaces/bootstrapnode.md @@ -0,0 +1,93 @@ +[ethereumjs-common](../README.md) > [BootstrapNode](../interfaces/bootstrapnode.md) + +# Interface: BootstrapNode + +## Hierarchy + +**BootstrapNode** + +## Index + +### Properties + +- [chainId](bootstrapnode.md#chainid) +- [comment](bootstrapnode.md#comment) +- [id](bootstrapnode.md#id) +- [ip](bootstrapnode.md#ip) +- [location](bootstrapnode.md#location) +- [network](bootstrapnode.md#network) +- [port](bootstrapnode.md#port) + +--- + +## Properties + + + +### `` chainId + +**● chainId**: _`undefined` \| `number`_ + +_Defined in [types.ts:47](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L47)_ + +--- + + + +### comment + +**● comment**: _`string`_ + +_Defined in [types.ts:50](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L50)_ + +--- + + + +### id + +**● id**: _`string`_ + +_Defined in [types.ts:48](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L48)_ + +--- + + + +### ip + +**● ip**: _`string`_ + +_Defined in [types.ts:44](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L44)_ + +--- + + + +### location + +**● location**: _`string`_ + +_Defined in [types.ts:49](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L49)_ + +--- + + + +### `` network + +**● network**: _`undefined` \| `string`_ + +_Defined in [types.ts:46](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L46)_ + +--- + + + +### port + +**● port**: _`number` \| `string`_ + +_Defined in [types.ts:45](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L45)_ + +--- diff --git a/docs/interfaces/chain.md b/docs/interfaces/chain.md new file mode 100644 index 0000000..46b2c3b --- /dev/null +++ b/docs/interfaces/chain.md @@ -0,0 +1,104 @@ +[ethereumjs-common](../README.md) > [Chain](../interfaces/chain.md) + +# Interface: Chain + +## Hierarchy + +**Chain** + +## Index + +### Properties + +- [bootstrapNodes](chain.md#bootstrapnodes) +- [chainId](chain.md#chainid) +- [comment](chain.md#comment) +- [genesis](chain.md#genesis) +- [hardforks](chain.md#hardforks) +- [name](chain.md#name) +- [networkId](chain.md#networkid) +- [url](chain.md#url) + +--- + +## Properties + + + +### bootstrapNodes + +**● bootstrapNodes**: _[BootstrapNode](bootstrapnode.md)[]_ + +_Defined in [types.ts:23](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L23)_ + +--- + + + +### chainId + +**● chainId**: _`number`_ + +_Defined in [types.ts:17](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L17)_ + +--- + + + +### comment + +**● comment**: _`string`_ + +_Defined in [types.ts:19](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L19)_ + +--- + + + +### genesis + +**● genesis**: _[GenesisBlock](genesisblock.md)_ + +_Defined in [types.ts:21](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L21)_ + +--- + + + +### hardforks + +**● hardforks**: _[Hardfork](hardfork.md)[]_ + +_Defined in [types.ts:22](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L22)_ + +--- + + + +### name + +**● name**: _`string`_ + +_Defined in [types.ts:16](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L16)_ + +--- + + + +### networkId + +**● networkId**: _`number`_ + +_Defined in [types.ts:18](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L18)_ + +--- + + + +### url + +**● url**: _`string`_ + +_Defined in [types.ts:20](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L20)_ + +--- diff --git a/docs/interfaces/chainstype.md b/docs/interfaces/chainstype.md index b8bfdf3..c07b438 100644 --- a/docs/interfaces/chainstype.md +++ b/docs/interfaces/chainstype.md @@ -8,7 +8,7 @@ ## Indexable -\[key: `string`\]: `__type` +\[key: `string`\]: `any` ## Index @@ -26,7 +26,7 @@ **● names**: _`object`_ -_Defined in [types.ts:9](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/types.ts#L9)_ +_Defined in [types.ts:9](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L9)_ #### Type declaration diff --git a/docs/interfaces/genesisblock.md b/docs/interfaces/genesisblock.md new file mode 100644 index 0000000..75d351b --- /dev/null +++ b/docs/interfaces/genesisblock.md @@ -0,0 +1,93 @@ +[ethereumjs-common](../README.md) > [GenesisBlock](../interfaces/genesisblock.md) + +# Interface: GenesisBlock + +## Hierarchy + +**GenesisBlock** + +## Index + +### Properties + +- [difficulty](genesisblock.md#difficulty) +- [extraData](genesisblock.md#extradata) +- [gasLimit](genesisblock.md#gaslimit) +- [hash](genesisblock.md#hash) +- [nonce](genesisblock.md#nonce) +- [stateRoot](genesisblock.md#stateroot) +- [timestamp](genesisblock.md#timestamp) + +--- + +## Properties + + + +### difficulty + +**● difficulty**: _`number`_ + +_Defined in [types.ts:30](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L30)_ + +--- + + + +### extraData + +**● extraData**: _`string`_ + +_Defined in [types.ts:32](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L32)_ + +--- + + + +### gasLimit + +**● gasLimit**: _`number`_ + +_Defined in [types.ts:29](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L29)_ + +--- + + + +### hash + +**● hash**: _`string`_ + +_Defined in [types.ts:27](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L27)_ + +--- + + + +### nonce + +**● nonce**: _`string`_ + +_Defined in [types.ts:31](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L31)_ + +--- + + + +### stateRoot + +**● stateRoot**: _`string`_ + +_Defined in [types.ts:33](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L33)_ + +--- + + + +### timestamp + +**● timestamp**: _`string` \| `null`_ + +_Defined in [types.ts:28](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L28)_ + +--- diff --git a/docs/interfaces/genesisstatestype.md b/docs/interfaces/genesisstatestype.md index 37d31c8..9f4f3b6 100644 --- a/docs/interfaces/genesisstatestype.md +++ b/docs/interfaces/genesisstatestype.md @@ -26,7 +26,7 @@ **● names**: _`object`_ -_Defined in [types.ts:2](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/types.ts#L2)_ +_Defined in [types.ts:2](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L2)_ #### Type declaration diff --git a/docs/interfaces/hardfork.md b/docs/interfaces/hardfork.md new file mode 100644 index 0000000..91ab8c4 --- /dev/null +++ b/docs/interfaces/hardfork.md @@ -0,0 +1,60 @@ +[ethereumjs-common](../README.md) > [Hardfork](../interfaces/hardfork.md) + +# Interface: Hardfork + +## Hierarchy + +**Hardfork** + +## Index + +### Properties + +- [block](hardfork.md#block) +- [consensus](hardfork.md#consensus) +- [finality](hardfork.md#finality) +- [name](hardfork.md#name) + +--- + +## Properties + + + +### block + +**● block**: _`number` \| `null`_ + +_Defined in [types.ts:38](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L38)_ + +--- + + + +### consensus + +**● consensus**: _`string`_ + +_Defined in [types.ts:39](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L39)_ + +--- + + + +### finality + +**● finality**: _`any`_ + +_Defined in [types.ts:40](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L40)_ + +--- + + + +### name + +**● name**: _`string`_ + +_Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/types.ts#L37)_ + +--- diff --git a/docs/interfaces/hardforkoptions.md b/docs/interfaces/hardforkoptions.md index 937f0d5..5387fb6 100644 --- a/docs/interfaces/hardforkoptions.md +++ b/docs/interfaces/hardforkoptions.md @@ -21,9 +21,9 @@ ### `` onlyActive -**● onlyActive**: _`undefined` | `false` | `true`_ +**● onlyActive**: _`undefined` \| `false` \| `true`_ -_Defined in [index.ts:8](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L8)_ +_Defined in [index.ts:9](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L9)_ optional, only active HFs (default: false) @@ -33,9 +33,9 @@ optional, only active HFs (default: false) ### `` onlySupported -**● onlySupported**: _`undefined` | `false` | `true`_ +**● onlySupported**: _`undefined` \| `false` \| `true`_ -_Defined in [index.ts:6](https://github.com/ethereumjs/ethereumjs-common/blob/c779647/src/index.ts#L6)_ +_Defined in [index.ts:7](https://github.com/ethereumjs/ethereumjs-common/blob/30c4186/src/index.ts#L7)_ optional, only allow supported HFs (default: false) From 79e34724d9c4985908759fa720221fd6925c8bfc Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Tue, 18 Jun 2019 18:21:03 -0300 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c932ad9..76ce3df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ 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). +## [1.3.0] - 2019-06-18 + +- Add a static factory method `Custom.forCustomChain` to make working with + custom/private chains easier. + +[1.3.0]: https://github.com/ethereumjs/ethereumjs-common/compare/v1.2.1...v1.3.0 + ## [1.2.1] - 2019-06-03 - Added `Istanbul` HF candidate [EIP-1108](https://eips.ethereum.org/EIPS/eip-1108) From e1e701c47775864b9768e4cc9699cbac39acb4cf Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Tue, 18 Jun 2019 18:21:17 -0300 Subject: [PATCH 3/3] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 93c4746..2fd731b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ethereumjs-common", - "version": "1.2.1", + "version": "1.3.0", "description": "Resources common to all Ethereum implementations", "main": "./dist/index.js", "types": "./dist/index.d.ts",