diff --git a/README.md b/README.md index 77620d9822..c42ecf871f 100644 --- a/README.md +++ b/README.md @@ -40,12 +40,10 @@ Below you can find a list of the packages included in this repository. The following are our currently active branches: -| Branch | Release Series | Status |  Description | -| --------------------------------------------------------------------------------------- | -------------- | ------------- | ------------------------------------------------------------------------------------------------------------- | -| [master](https://github.com/ethereumjs/ethereumjs-monorepo) | v7 | `Active` | Upcoming v7 release branch (see Issue [#2561](https://github.com/ethereumjs/ethereumjs-monorepo/issues/2561)) | -| [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6) | v6 | `Maintenance` | Maintenance for v6 releases (current) | - -**Note:** For this last weeks before our upcoming v7 breaking release series (~July 2023) we use our `master` branch for final v7 development and have side-pushed current release series (v6) maintenance to a separate `maintenance-v6` branch. +| Branch | Release Series | Status |  Description | +| --------------------------------------------------------------------------------------- | -------------- | ------------- | ---------------------------------- | +| [master](https://github.com/ethereumjs/ethereumjs-monorepo) | v7 | `Active` | Current release and working branch | +| [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6) | v6 | `Maintenance` | Maintenance for v6 releases | Breaking releases are done in sync for all libraries, and release cycles are named after the `@ethereumjs/vm` version. In most cases PRs should be opened towards the current working branch. diff --git a/package-lock.json b/package-lock.json index dfb971ed2c..e36b8ebe57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15347,14 +15347,14 @@ }, "packages/block": { "name": "@ethereumjs/block", - "version": "5.0.0-rc.1", + "version": "5.0.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/trie": "6.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/trie": "^6.0.0", + "@ethereumjs/tx": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "ethereum-cryptography": "^2.1.2" }, "devDependencies": { @@ -15366,16 +15366,16 @@ }, "packages/blockchain": { "name": "@ethereumjs/blockchain", - "version": "7.0.0-rc.1", + "version": "7.0.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/ethash": "3.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/trie": "6.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/block": "^5.0.0", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/ethash": "^3.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/trie": "^6.0.0", + "@ethereumjs/tx": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2", "lru-cache": "^10.0.0" @@ -15395,23 +15395,23 @@ }, "packages/client": { "name": "@ethereumjs/client", - "version": "0.8.0", + "version": "0.8.1", "hasInstallScript": true, "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/blockchain": "7.0.0-rc.1", - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/devp2p": "6.0.0-rc.1", - "@ethereumjs/ethash": "3.0.0-rc.1", - "@ethereumjs/evm": "2.0.0-rc.2", - "@ethereumjs/genesis": "0.1.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/statemanager": "2.0.0-rc.1", - "@ethereumjs/trie": "6.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", - "@ethereumjs/vm": "7.0.0-rc.1", + "@ethereumjs/block": "5.0.0", + "@ethereumjs/blockchain": "7.0.0", + "@ethereumjs/common": "4.0.0", + "@ethereumjs/devp2p": "6.0.0", + "@ethereumjs/ethash": "3.0.0", + "@ethereumjs/evm": "2.0.0", + "@ethereumjs/genesis": "0.1.0", + "@ethereumjs/rlp": "5.0.0", + "@ethereumjs/statemanager": "2.0.0", + "@ethereumjs/trie": "6.0.0", + "@ethereumjs/tx": "5.0.0", + "@ethereumjs/util": "9.0.0", + "@ethereumjs/vm": "7.0.0", "abstract-level": "^1.0.3", "body-parser": "^1.19.2", "c-kzg": "^2.1.0", @@ -15529,21 +15529,21 @@ }, "packages/common": { "name": "@ethereumjs/common", - "version": "4.0.0-rc.1", + "version": "4.0.0", "license": "MIT", "dependencies": { - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/util": "^9.0.0", "crc": "^4.3.2" } }, "packages/devp2p": { "name": "@ethereumjs/devp2p", - "version": "6.0.0-rc.1", + "version": "6.0.0", "license": "MIT", "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "@scure/base": "1.1.1", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2", @@ -15553,8 +15553,8 @@ "snappyjs": "^0.6.1" }, "devDependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", + "@ethereumjs/block": "^5.0.0", + "@ethereumjs/tx": "^5.0.0", "@types/debug": "^4.1.4", "@types/k-bucket": "^5.0.0", "chalk": "^2.4.2", @@ -15637,17 +15637,17 @@ }, "packages/ethash": { "name": "@ethereumjs/ethash", - "version": "3.0.0-rc.1", + "version": "3.0.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/block": "^5.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "bigint-crypto-utils": "^3.2.2", "ethereum-cryptography": "^2.1.2" }, "devDependencies": { - "@ethereumjs/common": "4.0.0-rc.1" + "@ethereumjs/common": "^4.0.0" }, "engines": { "node": ">=18" @@ -15655,13 +15655,13 @@ }, "packages/evm": { "name": "@ethereumjs/evm", - "version": "2.0.0-rc.2", + "version": "2.0.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/statemanager": "2.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/statemanager": "^2.0.0", + "@ethereumjs/tx": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2", "rustbn-wasm": "^0.2.0" @@ -15686,11 +15686,11 @@ }, "packages/genesis": { "name": "@ethereumjs/genesis", - "version": "0.1.0-rc.1", + "version": "0.1.0", "license": "MIT", "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1" + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/util": "^9.0.0" }, "engines": { "node": ">=18" @@ -15698,7 +15698,7 @@ }, "packages/rlp": { "name": "@ethereumjs/rlp", - "version": "5.0.0-rc.1", + "version": "5.0.0", "license": "MPL-2.0", "bin": { "rlp": "bin/rlp" @@ -15709,11 +15709,11 @@ }, "packages/statemanager": { "name": "@ethereumjs/statemanager", - "version": "2.0.0-rc.1", + "version": "2.0.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/rlp": "^5.0.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2", "ethers": "^6.4.0", @@ -15721,10 +15721,10 @@ "lru-cache": "^10.0.0" }, "devDependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/genesis": "0.1.0-rc.1", - "@ethereumjs/trie": "6.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/block": "^5.0.0", + "@ethereumjs/genesis": "^0.1.0", + "@ethereumjs/trie": "^6.0.0", + "@ethereumjs/util": "^9.0.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2" } @@ -15739,18 +15739,18 @@ }, "packages/trie": { "name": "@ethereumjs/trie", - "version": "6.0.0-rc.1", + "version": "6.0.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "@types/readable-stream": "^2.3.13", "ethereum-cryptography": "^2.1.2", "lru-cache": "^10.0.0", "readable-stream": "^3.6.0" }, "devDependencies": { - "@ethereumjs/genesis": "0.1.0-rc.1", + "@ethereumjs/genesis": "^0.1.0", "@types/benchmark": "^1.0.33", "abstract-level": "^1.0.3", "level": "^8.0.0", @@ -15775,12 +15775,12 @@ }, "packages/tx": { "name": "@ethereumjs/tx", - "version": "5.0.0-rc.1", + "version": "5.0.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "ethereum-cryptography": "^2.1.2" }, "devDependencies": { @@ -15803,10 +15803,10 @@ }, "packages/util": { "name": "@ethereumjs/util", - "version": "9.0.0-rc.1", + "version": "9.0.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/rlp": "5.0.0-rc.1", + "@ethereumjs/rlp": "^5.0.0", "ethereum-cryptography": "^2.1.2" }, "devDependencies": {}, @@ -15824,18 +15824,18 @@ }, "packages/vm": { "name": "@ethereumjs/vm", - "version": "7.0.0-rc.1", + "version": "7.0.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/blockchain": "7.0.0-rc.1", - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/evm": "2.0.0-rc.2", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/statemanager": "2.0.0-rc.1", - "@ethereumjs/trie": "6.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/block": "^5.0.0", + "@ethereumjs/blockchain": "^7.0.0", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/evm": "^2.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/statemanager": "^2.0.0", + "@ethereumjs/trie": "^6.0.0", + "@ethereumjs/tx": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2" }, @@ -15859,10 +15859,10 @@ }, "packages/wallet": { "name": "@ethereumjs/wallet", - "version": "2.0.0-rc.1", + "version": "2.0.0", "license": "MIT", "dependencies": { - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/util": "^9.0.0", "@scure/base": "^1.1.1", "ethereum-cryptography": "^2.1.2", "js-md5": "^0.7.3", diff --git a/packages/block/CHANGELOG.md b/packages/block/CHANGELOG.md index a62365c9c8..af46672cb2 100644 --- a/packages/block/CHANGELOG.md +++ b/packages/block/CHANGELOG.md @@ -6,6 +6,16 @@ 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). +## 5.0.0 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Fblock%405.0.0-rc.1) for the main change description. + +Following additional changes since RC1: + +- 4844: Rename `dataGas` to `blobGas` (see EIP-4844 PR [#7354](https://github.com/ethereum/EIPs/pull/7354)), PR [#2919](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2919) + ## 5.0.0-rc.1 - 2023-07-18 This is the release candidate (RC1) for the upcoming breaking releases on the various EthereumJS libraries. The associated release notes below are the main source of information on the changeset, also for the upcoming final releases, where we'll just provide change addition summaries + references to these RC1 notes. diff --git a/packages/block/README.md b/packages/block/README.md index b61594b1f2..ae8cef5afb 100644 --- a/packages/block/README.md +++ b/packages/block/README.md @@ -6,8 +6,6 @@ [![Code Coverage][block-coverage-badge]][block-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | Implements schema and functions related to Ethereum's block. | | ------------------------------------------------------------ | diff --git a/packages/block/docs/README.md b/packages/block/docs/README.md index 428fe99880..e96fd37b93 100644 --- a/packages/block/docs/README.md +++ b/packages/block/docs/README.md @@ -70,10 +70,10 @@ ___ | Name | Type | | :------ | :------ | | `baseFeePerGas` | `PrefixedHexString` | +| `blobGasUsed?` | `PrefixedHexString` | | `blockHash` | `PrefixedHexString` | | `blockNumber` | `PrefixedHexString` | -| `dataGasUsed?` | `PrefixedHexString` | -| `excessDataGas?` | `PrefixedHexString` | +| `excessBlobGas?` | `PrefixedHexString` | | `extraData` | `PrefixedHexString` | | `feeRecipient` | `PrefixedHexString` | | `gasLimit` | `PrefixedHexString` | diff --git a/packages/block/docs/classes/Block.md b/packages/block/docs/classes/Block.md index c455eb4ede..ce2e631017 100644 --- a/packages/block/docs/classes/Block.md +++ b/packages/block/docs/classes/Block.md @@ -345,7 +345,7 @@ ___ ▸ **validateBlobTransactions**(`parentHeader`): `void` Validates that blob gas fee for each transaction is greater than or equal to the -dataGasPrice for the block and that total blob gas in block is less than maximum +blobGasPrice for the block and that total blob gas in block is less than maximum blob gas per block #### Parameters diff --git a/packages/block/docs/classes/BlockHeader.md b/packages/block/docs/classes/BlockHeader.md index c915e88cd5..42fe23d234 100644 --- a/packages/block/docs/classes/BlockHeader.md +++ b/packages/block/docs/classes/BlockHeader.md @@ -13,11 +13,11 @@ An object that represents the block header. ### Properties - [baseFeePerGas](BlockHeader.md#basefeepergas) +- [blobGasUsed](BlockHeader.md#blobgasused) - [coinbase](BlockHeader.md#coinbase) - [common](BlockHeader.md#common) -- [dataGasUsed](BlockHeader.md#datagasused) - [difficulty](BlockHeader.md#difficulty) -- [excessDataGas](BlockHeader.md#excessdatagas) +- [excessBlobGas](BlockHeader.md#excessblobgas) - [extraData](BlockHeader.md#extradata) - [gasLimit](BlockHeader.md#gaslimit) - [gasUsed](BlockHeader.md#gasused) @@ -42,7 +42,7 @@ An object that represents the block header. - [calcDataFee](BlockHeader.md#calcdatafee) - [calcNextBaseFee](BlockHeader.md#calcnextbasefee) -- [calcNextExcessDataGas](BlockHeader.md#calcnextexcessdatagas) +- [calcNextExcessBlobGas](BlockHeader.md#calcnextexcessblobgas) - [cliqueEpochTransitionSigners](BlockHeader.md#cliqueepochtransitionsigners) - [cliqueExtraSeal](BlockHeader.md#cliqueextraseal) - [cliqueExtraVanity](BlockHeader.md#cliqueextravanity) @@ -52,7 +52,7 @@ An object that represents the block header. - [cliqueVerifySignature](BlockHeader.md#cliqueverifysignature) - [errorStr](BlockHeader.md#errorstr) - [ethashCanonicalDifficulty](BlockHeader.md#ethashcanonicaldifficulty) -- [getDataGasPrice](BlockHeader.md#getdatagasprice) +- [getBlobGasPrice](BlockHeader.md#getblobgasprice) - [hash](BlockHeader.md#hash) - [isGenesis](BlockHeader.md#isgenesis) - [raw](BlockHeader.md#raw) @@ -99,33 +99,33 @@ varying data types. For a default empty header, use [fromHeaderData](BlockHeader ___ -### coinbase +### blobGasUsed -• `Readonly` **coinbase**: `Address` +• `Optional` `Readonly` **blobGasUsed**: `bigint` #### Defined in -[header.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L42) +[header.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L57) ___ -### common +### coinbase -• `Readonly` **common**: `Common` +• `Readonly` **coinbase**: `Address` #### Defined in -[header.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L61) +[header.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L42) ___ -### dataGasUsed +### common -• `Optional` `Readonly` **dataGasUsed**: `bigint` +• `Readonly` **common**: `Common` #### Defined in -[header.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L57) +[header.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/header.ts#L61) ___ @@ -139,9 +139,9 @@ ___ ___ -### excessDataGas +### excessBlobGas -• `Optional` `Readonly` **excessDataGas**: `bigint` +• `Optional` `Readonly` **excessBlobGas**: `bigint` #### Defined in @@ -355,9 +355,9 @@ Calculates the base fee for a potential next block ___ -### calcNextExcessDataGas +### calcNextExcessBlobGas -▸ **calcNextExcessDataGas**(): `bigint` +▸ **calcNextExcessBlobGas**(): `bigint` Calculates the excess blob gas for next (hopefully) post EIP 4844 block. @@ -538,9 +538,9 @@ Returns the canonical difficulty for this block. ___ -### getDataGasPrice +### getBlobGasPrice -▸ **getDataGasPrice**(): `bigint` +▸ **getBlobGasPrice**(): `bigint` Returns the price per unit of blob gas for a blob transaction in the current/pending block diff --git a/packages/block/docs/interfaces/HeaderData.md b/packages/block/docs/interfaces/HeaderData.md index 875e03b20a..2468291a28 100644 --- a/packages/block/docs/interfaces/HeaderData.md +++ b/packages/block/docs/interfaces/HeaderData.md @@ -9,10 +9,10 @@ A block header's data. ### Properties - [baseFeePerGas](HeaderData.md#basefeepergas) +- [blobGasUsed](HeaderData.md#blobgasused) - [coinbase](HeaderData.md#coinbase) -- [dataGasUsed](HeaderData.md#datagasused) - [difficulty](HeaderData.md#difficulty) -- [excessDataGas](HeaderData.md#excessdatagas) +- [excessBlobGas](HeaderData.md#excessblobgas) - [extraData](HeaderData.md#extradata) - [gasLimit](HeaderData.md#gaslimit) - [gasUsed](HeaderData.md#gasused) @@ -41,23 +41,23 @@ A block header's data. ___ -### coinbase +### blobGasUsed -• `Optional` **coinbase**: `AddressLike` +• `Optional` **blobGasUsed**: `BigIntLike` #### Defined in -[types.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L80) +[types.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L95) ___ -### dataGasUsed +### coinbase -• `Optional` **dataGasUsed**: `BigIntLike` +• `Optional` **coinbase**: `AddressLike` #### Defined in -[types.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L95) +[types.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L80) ___ @@ -71,9 +71,9 @@ ___ ___ -### excessDataGas +### excessBlobGas -• `Optional` **excessDataGas**: `BigIntLike` +• `Optional` **excessBlobGas**: `BigIntLike` #### Defined in diff --git a/packages/block/docs/interfaces/JsonHeader.md b/packages/block/docs/interfaces/JsonHeader.md index f450c9b18e..1d7a002530 100644 --- a/packages/block/docs/interfaces/JsonHeader.md +++ b/packages/block/docs/interfaces/JsonHeader.md @@ -9,10 +9,10 @@ An object with the block header's data represented as strings. ### Properties - [baseFeePerGas](JsonHeader.md#basefeepergas) +- [blobGasUsed](JsonHeader.md#blobgasused) - [coinbase](JsonHeader.md#coinbase) -- [dataGasUsed](JsonHeader.md#datagasused) - [difficulty](JsonHeader.md#difficulty) -- [excessDataGas](JsonHeader.md#excessdatagas) +- [excessBlobGas](JsonHeader.md#excessblobgas) - [extraData](JsonHeader.md#extradata) - [gasLimit](JsonHeader.md#gaslimit) - [gasUsed](JsonHeader.md#gasused) @@ -41,23 +41,23 @@ An object with the block header's data represented as strings. ___ -### coinbase +### blobGasUsed -• `Optional` **coinbase**: `string` +• `Optional` **blobGasUsed**: `string` #### Defined in -[types.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L145) +[types.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L160) ___ -### dataGasUsed +### coinbase -• `Optional` **dataGasUsed**: `string` +• `Optional` **coinbase**: `string` #### Defined in -[types.ts:160](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L160) +[types.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/types.ts#L145) ___ @@ -71,9 +71,9 @@ ___ ___ -### excessDataGas +### excessBlobGas -• `Optional` **excessDataGas**: `string` +• `Optional` **excessBlobGas**: `string` #### Defined in diff --git a/packages/block/docs/interfaces/JsonRpcBlock.md b/packages/block/docs/interfaces/JsonRpcBlock.md index 24ff5cd178..bfbe6e2f15 100644 --- a/packages/block/docs/interfaces/JsonRpcBlock.md +++ b/packages/block/docs/interfaces/JsonRpcBlock.md @@ -7,9 +7,9 @@ ### Properties - [baseFeePerGas](JsonRpcBlock.md#basefeepergas) -- [dataGasUsed](JsonRpcBlock.md#datagasused) +- [blobGasUsed](JsonRpcBlock.md#blobgasused) - [difficulty](JsonRpcBlock.md#difficulty) -- [excessDataGas](JsonRpcBlock.md#excessdatagas) +- [excessBlobGas](JsonRpcBlock.md#excessblobgas) - [extraData](JsonRpcBlock.md#extradata) - [gasLimit](JsonRpcBlock.md#gaslimit) - [gasUsed](JsonRpcBlock.md#gasused) @@ -45,9 +45,9 @@ ___ -### dataGasUsed +### blobGasUsed -• `Optional` **dataGasUsed**: `string` +• `Optional` **blobGasUsed**: `string` #### Defined in @@ -65,9 +65,9 @@ ___ ___ -### excessDataGas +### excessBlobGas -• `Optional` **excessDataGas**: `string` +• `Optional` **excessBlobGas**: `string` #### Defined in diff --git a/packages/block/package.json b/packages/block/package.json index f517347514..33cf294407 100644 --- a/packages/block/package.json +++ b/packages/block/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/block", - "version": "5.0.0-rc.1", + "version": "5.0.0", "description": "Provides Block serialization and help functions", "keywords": [ "ethereum", @@ -45,11 +45,11 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/trie": "6.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/trie": "^6.0.0", + "@ethereumjs/tx": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "ethereum-cryptography": "^2.1.2" }, "devDependencies": { diff --git a/packages/blockchain/CHANGELOG.md b/packages/blockchain/CHANGELOG.md index ac960a94f5..cb6aa475ef 100644 --- a/packages/blockchain/CHANGELOG.md +++ b/packages/blockchain/CHANGELOG.md @@ -6,6 +6,16 @@ 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). +## 7.0.0 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Fblockchain%407.0.0-rc.1) for the main change description. + +Following additional changes since RC1: + +- 4844: Rename `dataGas` to `blobGas` (see EIP-4844 PR [#7354](https://github.com/ethereum/EIPs/pull/7354)), PR [#2919](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2919) + ## 7.0.0-rc.1 - 2023-07-18 This is the release candidate (RC1) for the upcoming breaking releases on the various EthereumJS libraries. The associated release notes below are the main source of information on the changeset, also for the upcoming final releases, where we'll just provide change addition summaries + references to these RC1 notes. diff --git a/packages/blockchain/README.md b/packages/blockchain/README.md index 9694564a1d..ae8e023b70 100644 --- a/packages/blockchain/README.md +++ b/packages/blockchain/README.md @@ -6,8 +6,6 @@ [![Code Coverage][blockchain-coverage-badge]][blockchain-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | A module to store and interact with blocks. | | ------------------------------------------- | diff --git a/packages/blockchain/package.json b/packages/blockchain/package.json index f97494226b..fe19ff30c5 100644 --- a/packages/blockchain/package.json +++ b/packages/blockchain/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/blockchain", - "version": "7.0.0-rc.1", + "version": "7.0.0", "description": "A module to store and interact with blocks", "keywords": [ "ethereum", @@ -45,13 +45,13 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/ethash": "3.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/trie": "6.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/block": "^5.0.0", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/ethash": "^3.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/trie": "^6.0.0", + "@ethereumjs/tx": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2", "lru-cache": "^10.0.0" diff --git a/packages/client/CHANGELOG.md b/packages/client/CHANGELOG.md index e836e038e4..83ed1611c1 100644 --- a/packages/client/CHANGELOG.md +++ b/packages/client/CHANGELOG.md @@ -6,6 +6,30 @@ 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). +## 0.8.1 - 2023-08-09 + +Note: this release is not yet fully ready for `4844-devnet-8` (launch in August 2023). + +### EIP-4844 / devnet-8 Updates + +- 4844: Rename `dataGas` to `blobGas` (see EIP-4844 PR [#7354](https://github.com/ethereum/EIPs/pull/7354)), PR [#2919](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2919) +- Engine api changes for devnet 8, PR [#2896](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2896) + - forkChoiceUpdated v3 + - change validations of newPayload v3, make them 1-1 + +### Features + +- Add `debug_traceCall` RPC method, PR [#2913](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2913) +- Add `debug_storageRangeAt` RPC method, PR [#2922](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2922) +- Handle SIGTERM kernel signal, PR [#2921](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2921) + +### Bugfixes / Maintenance + +- Broadcast the contents of the transaction pool to newly connected peers, PR [#2935](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2935) +- Add support for multiple same-type messages over devp2p, PR [#2940](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2940) +- Fix RPC server custom address/port bugs, PR [#2930](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2930) +- Address security vulnerabilities, PR [#2912](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2912) + ## 0.8.0 - 2023-07-11 ### Permanent Account, Storage and Trie Node Caches diff --git a/packages/client/README.md b/packages/client/README.md index 8f6abf0960..ea1e01dab0 100644 --- a/packages/client/README.md +++ b/packages/client/README.md @@ -6,8 +6,6 @@ [![Code Coverage][client-coverage-badge]][client-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | Ethereum Execution (Eth 1.0) Client built in TypeScript/JavaScript. | | ------------------------------------------------------------------- | diff --git a/packages/client/archive/libp2p/net/package.json.browser.deps b/packages/client/archive/libp2p/net/package.json.browser.deps index edf6e74ecd..cd671351f0 100644 --- a/packages/client/archive/libp2p/net/package.json.browser.deps +++ b/packages/client/archive/libp2p/net/package.json.browser.deps @@ -57,18 +57,18 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/blockchain": "7.0.0-rc.1", - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/devp2p": "6.0.0-rc.1", - "@ethereumjs/ethash": "3.0.0-rc.1", - "@ethereumjs/evm": "2.0.0-rc.2", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/statemanager": "2.0.0-rc.1", - "@ethereumjs/trie": "6.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", - "@ethereumjs/vm": "7.0.0-rc.1", + "@ethereumjs/block": "5.0.0", + "@ethereumjs/blockchain": "7.0.0", + "@ethereumjs/common": "4.0.0", + "@ethereumjs/devp2p": "6.0.0", + "@ethereumjs/ethash": "3.0.0", + "@ethereumjs/evm": "2.0.0", + "@ethereumjs/rlp": "5.0.0", + "@ethereumjs/statemanager": "2.0.0", + "@ethereumjs/trie": "6.0.0", + "@ethereumjs/tx": "5.0.0", + "@ethereumjs/util": "9.0.0", + "@ethereumjs/vm": "7.0.0", "abstract-level": "^1.0.3", "body-parser": "^1.19.2", "c-kzg": "^2.1.0", diff --git a/packages/client/package.json b/packages/client/package.json index 368a94341e..6e7ba92045 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/client", - "version": "0.8.0", + "version": "0.8.1", "description": "EthereumJS client implementation", "keywords": [ "ethereum", @@ -56,19 +56,19 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/blockchain": "7.0.0-rc.1", - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/devp2p": "6.0.0-rc.1", - "@ethereumjs/ethash": "3.0.0-rc.1", - "@ethereumjs/evm": "2.0.0-rc.2", - "@ethereumjs/genesis": "0.1.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/statemanager": "2.0.0-rc.1", - "@ethereumjs/trie": "6.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", - "@ethereumjs/vm": "7.0.0-rc.1", + "@ethereumjs/block": "5.0.0", + "@ethereumjs/blockchain": "7.0.0", + "@ethereumjs/common": "4.0.0", + "@ethereumjs/devp2p": "6.0.0", + "@ethereumjs/ethash": "3.0.0", + "@ethereumjs/evm": "2.0.0", + "@ethereumjs/genesis": "0.1.0", + "@ethereumjs/rlp": "5.0.0", + "@ethereumjs/statemanager": "2.0.0", + "@ethereumjs/trie": "6.0.0", + "@ethereumjs/tx": "5.0.0", + "@ethereumjs/util": "9.0.0", + "@ethereumjs/vm": "7.0.0", "abstract-level": "^1.0.3", "body-parser": "^1.19.2", "c-kzg": "^2.1.0", diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index c03915c59f..528e802f44 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -6,6 +6,28 @@ 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). +## 4.0.0 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Fcommon%404.0.0-rc.1) for the main change description. + +Following additional changes since RC1: + +### JSON -> JS for Hardfork, EIP and Chain Configs + +We have switched hardfork, EIP and chain configurations in the `Common` library from `JSON` to `JavaScript` (`TypeScript`). This leads to better typing (and therefore less configuration errors) for (custom) configuration files and avoids `JSON` type assertion related problems for ESM builds, see PR [#2911](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2911). + +Following changes: + +- `src/chains/[CHAIN_FILE].json` -> `src/chains.ts` +- `src/eips/[EIP_FILE].json` -> `src/eips.ts` +- `src/hardforks/[HARDFORK_FILE].json` -> `src/hardforks.ts` + +### Other Changes + +- 4844: Rename `dataGas` to `blobGas` (see EIP-4844 PR [#7354](https://github.com/ethereum/EIPs/pull/7354)), PR [#2919](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2919) + ## 4.0.0-rc.1 - 2023-07-18 This is the release candidate (RC1) for the upcoming breaking releases on the various EthereumJS libraries. The associated release notes below are the main source of information on the changeset, also for the upcoming final releases, where we'll just provide change addition summaries + references to these RC1 notes. diff --git a/packages/common/README.md b/packages/common/README.md index 45ef4f1299..0fa2b57e8b 100644 --- a/packages/common/README.md +++ b/packages/common/README.md @@ -6,8 +6,6 @@ [![Code Coverage][common-coverage-badge]][common-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | Resources common to all EthereumJS implementations. | | --------------------------------------------------- | @@ -156,8 +154,8 @@ The following chain-specific parameters are provided: - `bootstrapNodes` list - `dnsNetworks` list ([EIP-1459](https://eips.ethereum.org/EIPS/eip-1459)-compliant list of DNS networks for peer discovery) -To get an overview of the different parameters have a look at one of the chain-specific -files like `mainnet.json` in the `chains` directory, or to the `Chain` type in [./src/types.ts](./src/types.ts). +To get an overview of the different parameters have a look at one of the chain configurations in the `chains.ts` configuration +file, or to the `Chain` type in [./src/types.ts](./src/types.ts). ### Working with private/custom chains @@ -195,7 +193,7 @@ you can pass a dictionary - conforming to the parameter format described above - values to the constructor using the `chain` parameter or the `setChain()` method, here is some example: ```typescript -import myCustomChain from './[PATH]/myCustomChain.json' +import myCustomChain from './[PATH]/myCustomChain.js' const common = new Common({ chain: myCustomChain }) ``` @@ -209,8 +207,8 @@ use the `chain` option to activate one of the custom chains passed or activate a (e.g. `mainnet`) and switch to other chains - including the custom ones - by using `Common.setChain()`. ```typescript -import myCustomChain1 from './[PATH]/myCustomChain1.json' -import myCustomChain2 from './[PATH]/myCustomChain2.json' +import myCustomChain1 from './[PATH]/myCustomChain1.js' +import myCustomChain2 from './[PATH]/myCustomChain2.js' // Add two custom chains, initial mainnet activation const common1 = new Common({ chain: 'mainnet', customChains: [myCustomChain1, myCustomChain2] }) // Somewhat later down the road... @@ -286,11 +284,11 @@ you can use the following `topics`: - `pow` - `sharding` -See one of the hardfork files like `byzantium.json` in the `hardforks` directory +See one of the hardfork configurations in the `hardforks.ts` file for an overview. For consistency, the chain start (`chainstart`) is considered an own hardfork. -The hardfork-specific json files only contain the deltas from `chainstart` and +The hardfork configurations above `chainstart` only contain the deltas from `chainstart` and shouldn't be accessed directly until you have a specific reason for it. ### EIPs diff --git a/packages/common/docs/README.md b/packages/common/docs/README.md index cc538f9344..bf12ca39d9 100644 --- a/packages/common/docs/README.md +++ b/packages/common/docs/README.md @@ -28,7 +28,7 @@ - [GenesisBlockConfig](interfaces/GenesisBlockConfig.md) - [GethConfigOpts](interfaces/GethConfigOpts.md) - [HardforkByOpts](interfaces/HardforkByOpts.md) -- [HardforkConfig](interfaces/HardforkConfig.md) +- [HardforkTransitionConfig](interfaces/HardforkTransitionConfig.md) - [StateManagerInterface](interfaces/StateManagerInterface.md) - [StorageDump](interfaces/StorageDump.md) @@ -41,7 +41,9 @@ - [AccountFields](README.md#accountfields) - [CasperConfig](README.md#casperconfig) - [CliqueConfig](README.md#cliqueconfig) +- [EIPConfig](README.md#eipconfig) - [EthashConfig](README.md#ethashconfig) +- [HardforkConfig](README.md#hardforkconfig) - [Proof](README.md#proof) - [StorageProof](README.md#storageproof) @@ -61,7 +63,7 @@ #### Defined in -[interfaces.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L39) +[interfaces.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L43) ___ @@ -71,7 +73,7 @@ ___ #### Defined in -[interfaces.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L38) +[interfaces.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L42) ___ @@ -81,7 +83,7 @@ ___ #### Defined in -[interfaces.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L37) +[interfaces.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L41) ___ @@ -98,7 +100,7 @@ ___ #### Defined in -[interfaces.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L29) +[interfaces.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L33) ___ @@ -108,7 +110,7 @@ ___ #### Defined in -[interfaces.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L7) +[interfaces.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L11) ___ @@ -139,6 +141,16 @@ ___ ___ +### EIPConfig + +Ƭ **EIPConfig**: { `minimumHardfork`: [`Hardfork`](enums/Hardfork.md) ; `requiredEIPs`: `number`[] } & `EIPOrHFConfig` + +#### Defined in + +[types.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L157) + +___ + ### EthashConfig Ƭ **EthashConfig**: `Object` @@ -149,6 +161,16 @@ ___ ___ +### HardforkConfig + +Ƭ **HardforkConfig**: { `consensus?`: `ConsensusConfig` ; `eips?`: `number`[] ; `name`: `string` } & `EIPOrHFConfig` + +#### Defined in + +[types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L162) + +___ + ### Proof Ƭ **Proof**: `Object` @@ -167,7 +189,7 @@ ___ #### Defined in -[interfaces.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L15) +[interfaces.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L19) ___ @@ -185,7 +207,7 @@ ___ #### Defined in -[interfaces.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L9) +[interfaces.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L13) ## Variables @@ -226,11 +248,11 @@ parsed params | `bootstrapNodes` | `never`[] | | `chainId` | `number` | | `consensus` | { `algorithm`: `string` = 'clique'; `clique`: { `epoch`: `any` ; `period`: `any` } ; `ethash`: `undefined` = {}; `type`: `string` = 'poa' } \| { `algorithm`: `string` = 'ethash'; `clique`: `undefined` ; `ethash`: {} = {}; `type`: `string` = 'pow' } | -| `genesis` | { `baseFeePerGas`: `string` ; `coinbase`: `string` ; `difficulty`: `string` ; `excessDataGas`: `string` ; `extraData`: `string` ; `gasLimit`: `string` ; `mixHash`: `string` ; `nonce`: `string` ; `timestamp`: `string` } | +| `genesis` | { `baseFeePerGas`: `string` ; `coinbase`: `string` ; `difficulty`: `string` ; `excessBlobGas`: `string` ; `extraData`: `string` ; `gasLimit`: `string` ; `mixHash`: `string` ; `nonce`: `string` ; `timestamp`: `string` } | | `genesis.baseFeePerGas` | `string` | | `genesis.coinbase` | `string` | | `genesis.difficulty` | `string` | -| `genesis.excessDataGas` | `string` | +| `genesis.excessBlobGas` | `string` | | `genesis.extraData` | `string` | | `genesis.gasLimit` | `string` | | `genesis.mixHash` | `string` | diff --git a/packages/common/docs/classes/Common.md b/packages/common/docs/classes/Common.md index 82080b5dc7..13ed2fe046 100644 --- a/packages/common/docs/classes/Common.md +++ b/packages/common/docs/classes/Common.md @@ -76,7 +76,7 @@ can be created via the main constructor and the [customChains](../interfaces/Com #### Defined in -[common.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L225) +[common.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L223) ## Properties @@ -86,7 +86,7 @@ can be created via the main constructor and the [customChains](../interfaces/Com #### Defined in -[common.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L49) +[common.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L47) ___ @@ -96,7 +96,7 @@ ___ #### Defined in -[common.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L58) +[common.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L56) ## Methods @@ -120,7 +120,7 @@ True if HF is active on block number #### Defined in -[common.ts:611](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L611) +[common.ts:613](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L613) ___ @@ -138,7 +138,7 @@ Dict with bootstrap nodes #### Defined in -[common.ts:861](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L861) +[common.ts:863](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L863) ___ @@ -156,7 +156,7 @@ chain Id #### Defined in -[common.ts:885](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L885) +[common.ts:887](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L887) ___ @@ -174,7 +174,7 @@ chain name (lower case) #### Defined in -[common.ts:893](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L893) +[common.ts:895](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L895) ___ @@ -196,7 +196,7 @@ Note: This value can update along a Hardfork. #### Defined in -[common.ts:941](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L941) +[common.ts:943](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L943) ___ @@ -222,7 +222,7 @@ Note: This value can update along a Hardfork. #### Defined in -[common.ts:967](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L967) +[common.ts:969](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L969) ___ @@ -241,7 +241,7 @@ Note: This value can update along a Hardfork. #### Defined in -[common.ts:919](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L919) +[common.ts:921](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L921) ___ @@ -257,7 +257,7 @@ Returns a deep copy of this [Common](Common.md) instance. #### Defined in -[common.ts:986](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L986) +[common.ts:990](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L990) ___ @@ -275,7 +275,7 @@ Array of DNS ENR urls #### Defined in -[common.ts:869](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L869) +[common.ts:871](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L871) ___ @@ -299,7 +299,7 @@ Block number or null if unscheduled #### Defined in -[common.ts:674](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L674) +[common.ts:676](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L676) ___ @@ -317,7 +317,7 @@ List of EIPs #### Defined in -[common.ts:909](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L909) +[common.ts:911](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L911) ___ @@ -340,7 +340,7 @@ Returns an eth/64 compliant fork hash (EIP-2124) #### Defined in -[common.ts:795](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L795) +[common.ts:797](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L797) ___ @@ -358,7 +358,7 @@ Genesis dictionary #### Defined in -[common.ts:845](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L845) +[common.ts:847](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L847) ___ @@ -387,7 +387,7 @@ The name of the HF #### Defined in -[common.ts:309](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L309) +[common.ts:307](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L307) ___ @@ -411,7 +411,7 @@ True if hardfork set is greater than hardfork provided #### Defined in -[common.ts:642](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L642) +[common.ts:644](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L644) ___ @@ -429,7 +429,7 @@ Hardfork name #### Defined in -[common.ts:877](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L877) +[common.ts:879](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L879) ___ @@ -453,13 +453,13 @@ Block number or null if unscheduled #### Defined in -[common.ts:651](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L651) +[common.ts:653](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L653) ___ ### hardforkForForkHash -▸ **hardforkForForkHash**(`forkHash`): ``null`` \| [`HardforkConfig`](../interfaces/HardforkConfig.md) +▸ **hardforkForForkHash**(`forkHash`): ``null`` \| [`HardforkTransitionConfig`](../interfaces/HardforkTransitionConfig.md) #### Parameters @@ -469,13 +469,13 @@ ___ #### Returns -``null`` \| [`HardforkConfig`](../interfaces/HardforkConfig.md) +``null`` \| [`HardforkTransitionConfig`](../interfaces/HardforkTransitionConfig.md) Array with hardfork data (name, block, forkHash) #### Defined in -[common.ts:817](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L817) +[common.ts:819](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L819) ___ @@ -500,7 +500,7 @@ True if HF1 gte HF2 #### Defined in -[common.ts:622](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L622) +[common.ts:624](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L624) ___ @@ -525,7 +525,7 @@ True if HF is active on block number #### Defined in -[common.ts:596](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L596) +[common.ts:598](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L598) ___ @@ -549,7 +549,7 @@ Total difficulty or null if no set #### Defined in -[common.ts:692](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L692) +[common.ts:694](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L694) ___ @@ -569,25 +569,25 @@ ___ #### Defined in -[common.ts:660](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L660) +[common.ts:662](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L662) ___ ### hardforks -▸ **hardforks**(): [`HardforkConfig`](../interfaces/HardforkConfig.md)[] +▸ **hardforks**(): [`HardforkTransitionConfig`](../interfaces/HardforkTransitionConfig.md)[] Returns the hardforks for current chain #### Returns -[`HardforkConfig`](../interfaces/HardforkConfig.md)[] +[`HardforkTransitionConfig`](../interfaces/HardforkTransitionConfig.md)[] Array with arrays of hardforks #### Defined in -[common.ts:853](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L853) +[common.ts:855](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L855) ___ @@ -614,7 +614,7 @@ by the [eips](../interfaces/CommonOpts.md#eips) constructor option #### Defined in -[common.ts:575](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L575) +[common.ts:577](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L577) ___ @@ -632,7 +632,7 @@ network Id #### Defined in -[common.ts:901](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L901) +[common.ts:903](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L903) ___ @@ -656,7 +656,7 @@ Block timestamp, number or null if not available #### Defined in -[common.ts:706](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L706) +[common.ts:708](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L708) ___ @@ -685,7 +685,7 @@ The value requested or `BigInt(0)` if not found #### Defined in -[common.ts:481](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L481) +[common.ts:483](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L483) ___ @@ -714,7 +714,7 @@ The value requested or `BigInt(0)` if not found #### Defined in -[common.ts:555](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L555) +[common.ts:557](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L557) ___ @@ -740,7 +740,7 @@ The value requested or `undefined` if not found #### Defined in -[common.ts:530](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L530) +[common.ts:532](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L532) ___ @@ -766,7 +766,7 @@ The value requested or `BigInt(0)` if not found #### Defined in -[common.ts:499](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L499) +[common.ts:501](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L501) ___ @@ -790,7 +790,7 @@ The dictionary with parameters set as chain #### Defined in -[common.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L251) +[common.ts:249](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L249) ___ @@ -812,7 +812,7 @@ Sets the active EIPs #### Defined in -[common.ts:448](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L448) +[common.ts:450](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L450) ___ @@ -834,7 +834,7 @@ Sets any missing forkHashes on the passed-in [Common](Common.md) instance #### Defined in -[common.ts:829](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L829) +[common.ts:831](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L831) ___ @@ -856,7 +856,7 @@ Sets the hardfork to get params for #### Defined in -[common.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L282) +[common.ts:280](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L280) ___ @@ -885,7 +885,7 @@ The name of the HF set #### Defined in -[common.ts:425](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L425) +[common.ts:427](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L427) ___ @@ -926,7 +926,7 @@ the `@ethereumjs/tx` library to a Layer-2 chain). #### Defined in -[common.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L84) +[common.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L82) ___ @@ -951,7 +951,7 @@ Common #### Defined in -[common.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L175) +[common.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L173) ___ @@ -971,7 +971,7 @@ ___ #### Defined in -[common.ts:992](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L992) +[common.ts:996](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L996) ___ @@ -995,4 +995,4 @@ boolean #### Defined in -[common.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L197) +[common.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/common.ts#L195) diff --git a/packages/common/docs/interfaces/BootstrapNodeConfig.md b/packages/common/docs/interfaces/BootstrapNodeConfig.md index 86616aba33..ef04d8708d 100644 --- a/packages/common/docs/interfaces/BootstrapNodeConfig.md +++ b/packages/common/docs/interfaces/BootstrapNodeConfig.md @@ -22,7 +22,7 @@ #### Defined in -[types.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L61) +[types.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L64) ___ @@ -32,7 +32,7 @@ ___ #### Defined in -[types.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L64) +[types.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L67) ___ @@ -42,7 +42,7 @@ ___ #### Defined in -[types.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L62) +[types.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L65) ___ @@ -52,7 +52,7 @@ ___ #### Defined in -[types.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L58) +[types.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L61) ___ @@ -62,7 +62,7 @@ ___ #### Defined in -[types.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L63) +[types.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L66) ___ @@ -72,7 +72,7 @@ ___ #### Defined in -[types.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L60) +[types.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L63) ___ @@ -82,4 +82,4 @@ ___ #### Defined in -[types.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L59) +[types.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L62) diff --git a/packages/common/docs/interfaces/ChainConfig.md b/packages/common/docs/interfaces/ChainConfig.md index 884dd36514..4c368ddbe7 100644 --- a/packages/common/docs/interfaces/ChainConfig.md +++ b/packages/common/docs/interfaces/ChainConfig.md @@ -26,7 +26,7 @@ #### Defined in -[types.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L28) +[types.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L37) ___ @@ -36,7 +36,7 @@ ___ #### Defined in -[types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L21) +[types.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L30) ___ @@ -46,27 +46,17 @@ ___ #### Defined in -[types.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L24) +[types.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L33) ___ ### consensus -• **consensus**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `algorithm` | `string` | -| `casper?` | [`CasperConfig`](../README.md#casperconfig) | -| `clique?` | [`CliqueConfig`](../README.md#cliqueconfig) | -| `ethash?` | [`EthashConfig`](../README.md#ethashconfig) | -| `type` | `string` | +• **consensus**: `ConsensusConfig` #### Defined in -[types.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L30) +[types.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L39) ___ @@ -76,7 +66,7 @@ ___ #### Defined in -[types.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L23) +[types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L32) ___ @@ -86,7 +76,7 @@ ___ #### Defined in -[types.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L29) +[types.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L38) ___ @@ -96,17 +86,17 @@ ___ #### Defined in -[types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L26) +[types.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L35) ___ ### hardforks -• **hardforks**: [`HardforkConfig`](HardforkConfig.md)[] +• **hardforks**: [`HardforkTransitionConfig`](HardforkTransitionConfig.md)[] #### Defined in -[types.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L27) +[types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L36) ___ @@ -116,7 +106,7 @@ ___ #### Defined in -[types.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L20) +[types.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L29) ___ @@ -126,7 +116,7 @@ ___ #### Defined in -[types.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L22) +[types.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L31) ___ @@ -136,4 +126,4 @@ ___ #### Defined in -[types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L25) +[types.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L34) diff --git a/packages/common/docs/interfaces/CommonOpts.md b/packages/common/docs/interfaces/CommonOpts.md index 0ff3056ed4..0639d08ad0 100644 --- a/packages/common/docs/interfaces/CommonOpts.md +++ b/packages/common/docs/interfaces/CommonOpts.md @@ -31,7 +31,7 @@ passed in via [customChains](CommonOpts.md#customchains). #### Defined in -[types.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L90) +[types.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L93) ___ @@ -51,7 +51,7 @@ const common = new Common({ chain: 'myCustomChain1', customChains: [ myCustomCha #### Defined in -[types.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L102) +[types.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L105) ___ @@ -68,7 +68,7 @@ BaseOpts.eips #### Defined in -[types.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L78) +[types.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L81) ___ @@ -86,4 +86,4 @@ BaseOpts.hardfork #### Defined in -[types.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L73) +[types.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L76) diff --git a/packages/common/docs/interfaces/CustomCommonOpts.md b/packages/common/docs/interfaces/CustomCommonOpts.md index 531fec7d9c..f260784631 100644 --- a/packages/common/docs/interfaces/CustomCommonOpts.md +++ b/packages/common/docs/interfaces/CustomCommonOpts.md @@ -29,7 +29,7 @@ a standard chain used to base the custom chain params on. #### Defined in -[types.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L113) +[types.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L116) ___ @@ -46,7 +46,7 @@ BaseOpts.eips #### Defined in -[types.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L78) +[types.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L81) ___ @@ -64,4 +64,4 @@ BaseOpts.hardfork #### Defined in -[types.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L73) +[types.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L76) diff --git a/packages/common/docs/interfaces/EVMStateManagerInterface.md b/packages/common/docs/interfaces/EVMStateManagerInterface.md index 212f5efca2..9388add533 100644 --- a/packages/common/docs/interfaces/EVMStateManagerInterface.md +++ b/packages/common/docs/interfaces/EVMStateManagerInterface.md @@ -51,7 +51,7 @@ #### Defined in -[interfaces.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L62) +[interfaces.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L66) ## Methods @@ -69,7 +69,7 @@ #### Defined in -[interfaces.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L51) +[interfaces.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L55) ___ @@ -93,7 +93,7 @@ ___ #### Defined in -[interfaces.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L50) +[interfaces.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L54) ___ @@ -111,7 +111,7 @@ ___ #### Defined in -[interfaces.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L52) +[interfaces.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L56) ___ @@ -135,7 +135,7 @@ ___ #### Defined in -[interfaces.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L44) +[interfaces.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L48) ___ @@ -155,7 +155,7 @@ ___ #### Defined in -[interfaces.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L67) +[interfaces.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L71) ___ @@ -175,7 +175,7 @@ ___ #### Defined in -[interfaces.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L68) +[interfaces.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L72) ___ @@ -199,7 +199,7 @@ ___ #### Defined in -[interfaces.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L42) +[interfaces.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L46) ___ @@ -223,7 +223,7 @@ ___ #### Defined in -[interfaces.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L47) +[interfaces.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L51) ___ @@ -248,7 +248,7 @@ ___ #### Defined in -[interfaces.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L48) +[interfaces.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L52) ___ @@ -273,7 +273,7 @@ ___ #### Defined in -[interfaces.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L69) +[interfaces.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L73) ___ @@ -291,7 +291,7 @@ ___ #### Defined in -[interfaces.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L54) +[interfaces.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L58) ___ @@ -315,7 +315,7 @@ ___ #### Defined in -[interfaces.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L57) +[interfaces.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L61) ___ @@ -340,7 +340,7 @@ ___ #### Defined in -[interfaces.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L45) +[interfaces.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L49) ___ @@ -365,7 +365,7 @@ ___ #### Defined in -[interfaces.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L43) +[interfaces.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L47) ___ @@ -390,7 +390,7 @@ ___ #### Defined in -[interfaces.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L46) +[interfaces.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L50) ___ @@ -416,7 +416,7 @@ ___ #### Defined in -[interfaces.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L49) +[interfaces.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L53) ___ @@ -434,7 +434,7 @@ ___ #### Defined in -[interfaces.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L53) +[interfaces.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L57) ___ @@ -459,7 +459,7 @@ ___ #### Defined in -[interfaces.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L55) +[interfaces.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L59) ___ @@ -477,4 +477,4 @@ ___ #### Defined in -[interfaces.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L71) +[interfaces.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L75) diff --git a/packages/common/docs/interfaces/GenesisBlockConfig.md b/packages/common/docs/interfaces/GenesisBlockConfig.md index d6b5aa3c59..2c5705c7d0 100644 --- a/packages/common/docs/interfaces/GenesisBlockConfig.md +++ b/packages/common/docs/interfaces/GenesisBlockConfig.md @@ -8,7 +8,7 @@ - [baseFeePerGas](GenesisBlockConfig.md#basefeepergas) - [difficulty](GenesisBlockConfig.md#difficulty) -- [excessDataGas](GenesisBlockConfig.md#excessdatagas) +- [excessBlobGas](GenesisBlockConfig.md#excessblobgas) - [extraData](GenesisBlockConfig.md#extradata) - [gasLimit](GenesisBlockConfig.md#gaslimit) - [nonce](GenesisBlockConfig.md#nonce) @@ -22,7 +22,7 @@ #### Defined in -[types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L45) +[types.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L48) ___ @@ -32,17 +32,17 @@ ___ #### Defined in -[types.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L42) +[types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L45) ___ -### excessDataGas +### excessBlobGas -• `Optional` **excessDataGas**: `string` +• `Optional` **excessBlobGas**: `string` #### Defined in -[types.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L46) +[types.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L49) ___ @@ -52,7 +52,7 @@ ___ #### Defined in -[types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L44) +[types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L47) ___ @@ -62,7 +62,7 @@ ___ #### Defined in -[types.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L41) +[types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L44) ___ @@ -72,7 +72,7 @@ ___ #### Defined in -[types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L43) +[types.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L46) ___ @@ -82,4 +82,4 @@ ___ #### Defined in -[types.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L40) +[types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L43) diff --git a/packages/common/docs/interfaces/GethConfigOpts.md b/packages/common/docs/interfaces/GethConfigOpts.md index 0066ce8c8e..c40b966e95 100644 --- a/packages/common/docs/interfaces/GethConfigOpts.md +++ b/packages/common/docs/interfaces/GethConfigOpts.md @@ -26,7 +26,7 @@ #### Defined in -[types.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L117) +[types.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L120) ___ @@ -43,7 +43,7 @@ BaseOpts.eips #### Defined in -[types.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L78) +[types.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L81) ___ @@ -53,7 +53,7 @@ ___ #### Defined in -[types.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L118) +[types.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L121) ___ @@ -71,7 +71,7 @@ BaseOpts.hardfork #### Defined in -[types.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L73) +[types.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L76) ___ @@ -81,4 +81,4 @@ ___ #### Defined in -[types.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L119) +[types.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L122) diff --git a/packages/common/docs/interfaces/HardforkByOpts.md b/packages/common/docs/interfaces/HardforkByOpts.md index 1d520cf211..b1c1c11717 100644 --- a/packages/common/docs/interfaces/HardforkByOpts.md +++ b/packages/common/docs/interfaces/HardforkByOpts.md @@ -18,7 +18,7 @@ #### Defined in -[types.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L123) +[types.ts:126](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L126) ___ @@ -28,7 +28,7 @@ ___ #### Defined in -[types.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L125) +[types.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L128) ___ @@ -38,4 +38,4 @@ ___ #### Defined in -[types.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L124) +[types.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L127) diff --git a/packages/common/docs/interfaces/HardforkConfig.md b/packages/common/docs/interfaces/HardforkConfig.md deleted file mode 100644 index cb3f74548f..0000000000 --- a/packages/common/docs/interfaces/HardforkConfig.md +++ /dev/null @@ -1,63 +0,0 @@ -[@ethereumjs/common](../README.md) / HardforkConfig - -# Interface: HardforkConfig - -## Table of contents - -### Properties - -- [block](HardforkConfig.md#block) -- [forkHash](HardforkConfig.md#forkhash) -- [name](HardforkConfig.md#name) -- [timestamp](HardforkConfig.md#timestamp) -- [ttd](HardforkConfig.md#ttd) - -## Properties - -### block - -• **block**: ``null`` \| `number` - -#### Defined in - -[types.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L51) - -___ - -### forkHash - -• `Optional` **forkHash**: ``null`` \| `string` - -#### Defined in - -[types.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L54) - -___ - -### name - -• **name**: `string` - -#### Defined in - -[types.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L50) - -___ - -### timestamp - -• `Optional` **timestamp**: `string` \| `number` - -#### Defined in - -[types.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L53) - -___ - -### ttd - -• `Optional` **ttd**: `string` \| `bigint` - -#### Defined in - -[types.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L52) diff --git a/packages/common/docs/interfaces/HardforkTransitionConfig.md b/packages/common/docs/interfaces/HardforkTransitionConfig.md new file mode 100644 index 0000000000..283cc98037 --- /dev/null +++ b/packages/common/docs/interfaces/HardforkTransitionConfig.md @@ -0,0 +1,63 @@ +[@ethereumjs/common](../README.md) / HardforkTransitionConfig + +# Interface: HardforkTransitionConfig + +## Table of contents + +### Properties + +- [block](HardforkTransitionConfig.md#block) +- [forkHash](HardforkTransitionConfig.md#forkhash) +- [name](HardforkTransitionConfig.md#name) +- [timestamp](HardforkTransitionConfig.md#timestamp) +- [ttd](HardforkTransitionConfig.md#ttd) + +## Properties + +### block + +• **block**: ``null`` \| `number` + +#### Defined in + +[types.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L54) + +___ + +### forkHash + +• `Optional` **forkHash**: ``null`` \| `string` + +#### Defined in + +[types.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L57) + +___ + +### name + +• **name**: `string` + +#### Defined in + +[types.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L53) + +___ + +### timestamp + +• `Optional` **timestamp**: `string` \| `number` + +#### Defined in + +[types.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L56) + +___ + +### ttd + +• `Optional` **ttd**: `string` \| `bigint` + +#### Defined in + +[types.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/types.ts#L55) diff --git a/packages/common/docs/interfaces/StateManagerInterface.md b/packages/common/docs/interfaces/StateManagerInterface.md index 579e03fa1c..e827c5ee53 100644 --- a/packages/common/docs/interfaces/StateManagerInterface.md +++ b/packages/common/docs/interfaces/StateManagerInterface.md @@ -42,7 +42,7 @@ #### Defined in -[interfaces.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L51) +[interfaces.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L55) ___ @@ -62,7 +62,7 @@ ___ #### Defined in -[interfaces.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L50) +[interfaces.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L54) ___ @@ -76,7 +76,7 @@ ___ #### Defined in -[interfaces.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L52) +[interfaces.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L56) ___ @@ -96,7 +96,7 @@ ___ #### Defined in -[interfaces.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L44) +[interfaces.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L48) ___ @@ -116,7 +116,7 @@ ___ #### Defined in -[interfaces.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L42) +[interfaces.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L46) ___ @@ -136,7 +136,7 @@ ___ #### Defined in -[interfaces.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L47) +[interfaces.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L51) ___ @@ -157,7 +157,7 @@ ___ #### Defined in -[interfaces.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L48) +[interfaces.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L52) ___ @@ -178,7 +178,7 @@ ___ #### Defined in -[interfaces.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L56) +[interfaces.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L60) ___ @@ -192,7 +192,7 @@ ___ #### Defined in -[interfaces.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L54) +[interfaces.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L58) ___ @@ -212,7 +212,7 @@ ___ #### Defined in -[interfaces.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L57) +[interfaces.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L61) ___ @@ -233,7 +233,7 @@ ___ #### Defined in -[interfaces.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L45) +[interfaces.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L49) ___ @@ -254,7 +254,7 @@ ___ #### Defined in -[interfaces.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L43) +[interfaces.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L47) ___ @@ -275,7 +275,7 @@ ___ #### Defined in -[interfaces.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L46) +[interfaces.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L50) ___ @@ -297,7 +297,7 @@ ___ #### Defined in -[interfaces.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L49) +[interfaces.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L53) ___ @@ -311,7 +311,7 @@ ___ #### Defined in -[interfaces.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L53) +[interfaces.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L57) ___ @@ -332,7 +332,7 @@ ___ #### Defined in -[interfaces.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L55) +[interfaces.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L59) ___ @@ -346,4 +346,4 @@ ___ #### Defined in -[interfaces.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L58) +[interfaces.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/common/src/interfaces.ts#L62) diff --git a/packages/common/package.json b/packages/common/package.json index 40122ed304..0876eb5444 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/common", - "version": "4.0.0-rc.1", + "version": "4.0.0", "description": "Resources common to all Ethereum implementations", "keywords": [ "ethereum", @@ -55,7 +55,7 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/util": "^9.0.0", "crc": "^4.3.2" } } diff --git a/packages/devp2p/CHANGELOG.md b/packages/devp2p/CHANGELOG.md index 3e9f664b83..69781584d2 100644 --- a/packages/devp2p/CHANGELOG.md +++ b/packages/devp2p/CHANGELOG.md @@ -6,6 +6,42 @@ 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). +## 6.0.0 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Fdevp2p%406.0.0-rc.1) for the main change description. + +Following additional changes since RC1: + +### Event Emitter Refactor + +We have reworked the `EventEmitter` integration for the library and switched away from the structure where all central classes (like e.g. `RLPx`) directly inherit from `EventEmitter`. Instead, we now have the `EventEmitter` in a dedicated `events` property associated with the respective class, see PR [#2893](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2893). This aligns with how event emitters are implemented in other libraries (e.g. the VM or the client), leads to a cleaner API usage (autocomplete in an IDE now only shows the relevant methods) and allows for an easier customization of the library. + +Event usage has to be adopted as follows: + +```typescript +rlpx.on('peer:added', (peer) => { // old + // Do something +} + +rlpx.events.on('peer:added', (peer) => { // new + // Do something +} +``` + +Event emitter logic in the following components from the public API has been reworked: + +- `DPT` +- `RLPx` +- `ETH` +- `LES` +- `SNAP` (in development) + +### Other Changes + +- Address security vulnerabilities, PR [#2912](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2912) + ## 6.0.0-rc.1 - 2023-07-18 This is the release candidate (RC1) for the upcoming breaking releases on the various EthereumJS libraries. The associated release notes below are the main source of information on the changeset, also for the upcoming final releases, where we'll just provide change addition summaries + references to these RC1 notes. diff --git a/packages/devp2p/README.md b/packages/devp2p/README.md index 2afcb5010a..bd81568069 100644 --- a/packages/devp2p/README.md +++ b/packages/devp2p/README.md @@ -6,8 +6,6 @@ [![Coverage Status][devp2p-coverage-badge]][devp2p-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - ## Introduction This library bundles different components for lower-level peer-to-peer connection and message exchange: @@ -19,13 +17,13 @@ This library bundles different components for lower-level peer-to-peer connectio ## Usage -All components of this library are implemented as Node `EventEmitter` objects +All components of this library have a public `events` property containing a Node.js `EventEmitter` object and make heavy use of the Node.js network stack. You can react on events from the network like this: ```typescript -dpt.on('peer:added', (peer) => { +dpt.events.on('peer:added', (peer) => { // Do something... }) ``` @@ -219,7 +217,7 @@ Send the initial status message with `sendStatus()`, then wait for the correspon to arrive to start the communication. ```typescript -eth.once('status', () => { +eth.events.once('status', () => { // Send an initial message eth.sendMessage() }) @@ -228,7 +226,7 @@ eth.once('status', () => { Wait for follow-up messages to arrive, send your responses. ```typescript -eth.on('message', async (code, payload) => { +eth.events.on('message', async (code, payload) => { if (code === devp2p.ETH.MESSAGE_CODES.NEW_BLOCK_HASHES) { // Do something with your new block hashes :-) } @@ -288,7 +286,7 @@ Send the initial status message with `sendStatus()`, then wait for the correspon to arrive to start the communication. ```typescript -les.once('status', () => { +les.events.once('status', () => { // Send an initial message les.sendMessage() }) @@ -297,7 +295,7 @@ les.once('status', () => { Wait for follow-up messages to arrive, send your responses. ```typescript -les.on('message', async (code, payload) => { +les.events.on('message', async (code, payload) => { if (code === devp2p.LES.MESSAGE_CODES.BLOCK_HEADERS) { // Do something with your new block headers :-) } diff --git a/packages/devp2p/docs/README.md b/packages/devp2p/docs/README.md index 2e2ce59c44..04fc64681d 100644 --- a/packages/devp2p/docs/README.md +++ b/packages/devp2p/docs/README.md @@ -12,8 +12,8 @@ ### Enumerations -- [DISCONNECT\_REASONS](enums/DISCONNECT_REASONS.md) -- [PREFIXES](enums/PREFIXES.md) +- [DISCONNECT\_REASON](enums/DISCONNECT_REASON.md) +- [ProtocolType](enums/ProtocolType.md) ### Classes @@ -35,32 +35,26 @@ ### Interfaces - [Capabilities](interfaces/Capabilities.md) -- [CustomContact](interfaces/CustomContact.md) +- [Contact](interfaces/Contact.md) - [DPTOptions](interfaces/DPTOptions.md) - [DPTServerOptions](interfaces/DPTServerOptions.md) -- [Hello](interfaces/Hello.md) +- [KBucketOptions](interfaces/KBucketOptions.md) - [PeerInfo](interfaces/PeerInfo.md) -- [ProtocolConstructor](interfaces/ProtocolConstructor.md) -- [ProtocolDescriptor](interfaces/ProtocolDescriptor.md) +- [PeerOptions](interfaces/PeerOptions.md) - [RLPxOptions](interfaces/RLPxOptions.md) ### Type Aliases - [DNSOptions](README.md#dnsoptions) -- [Hash](README.md#hash) -- [HelloMsg](README.md#hellomsg) +- [SendMethod](README.md#sendmethod) ### Variables -- [BASE\_PROTOCOL\_LENGTH](README.md#base_protocol_length) -- [BASE\_PROTOCOL\_VERSION](README.md#base_protocol_version) - [DEFAULT\_ANNOUNCE\_TYPE](README.md#default_announce_type) -- [PING\_INTERVAL](README.md#ping_interval) ### Functions - [assertEq](README.md#asserteq) -- [buffer2int](README.md#buffer2int) - [createDeferred](README.md#createdeferred) - [decode](README.md#decode) - [devp2pDebug](README.md#devp2pdebug) @@ -69,7 +63,10 @@ - [formatLogId](README.md#formatlogid) - [genPrivateKey](README.md#genprivatekey) - [id2pk](README.md#id2pk) -- [int2buffer](README.md#int2buffer) +- [ipToBytes](README.md#iptobytes) +- [ipToString](README.md#iptostring) +- [isV4Format](README.md#isv4format) +- [isV6Format](README.md#isv6format) - [keccak256](README.md#keccak256) - [pk2id](README.md#pk2id) - [toNewUint8Array](README.md#tonewuint8array) @@ -91,60 +88,34 @@ #### Defined in -[packages/devp2p/src/dns/dns.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L22) +[packages/devp2p/src/types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L32) ___ -### Hash +### SendMethod -Ƭ **Hash**: `ReturnType` +Ƭ **SendMethod**: (`code`: `number`, `data`: `Uint8Array`) => `any` -#### Defined in - -[packages/devp2p/src/rlpx/mac.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L6) - -___ - -### HelloMsg +#### Type declaration -Ƭ **HelloMsg**: `Object` +▸ (`code`, `data`): `any` -#### Type declaration +##### Parameters | Name | Type | | :------ | :------ | -| `0` | `Buffer` | -| `1` | `Buffer` | -| `2` | `Buffer`[][] | -| `3` | `Buffer` | -| `4` | `Buffer` | -| `length` | ``5`` | - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L49) - -## Variables - -### BASE\_PROTOCOL\_LENGTH +| `code` | `number` | +| `data` | `Uint8Array` | -• `Const` **BASE\_PROTOCOL\_LENGTH**: ``16`` +##### Returns -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L22) - -___ - -### BASE\_PROTOCOL\_VERSION - -• `Const` **BASE\_PROTOCOL\_VERSION**: ``5`` +`any` #### Defined in -[packages/devp2p/src/rlpx/peer.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L21) +[packages/devp2p/src/types.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L212) -___ +## Variables ### DEFAULT\_ANNOUNCE\_TYPE @@ -152,17 +123,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L14) - -___ - -### PING\_INTERVAL - -• `Const` **PING\_INTERVAL**: `number` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L24) +[packages/devp2p/src/protocol/les.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L21) ## Functions @@ -186,27 +147,7 @@ ___ #### Defined in -[packages/devp2p/src/util.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L67) - -___ - -### buffer2int - -▸ **buffer2int**(`buffer`): `number` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `buffer` | `Buffer` | - -#### Returns - -`number` - -#### Defined in - -[packages/devp2p/src/util.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L43) +[packages/devp2p/src/util.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L51) ___ @@ -226,19 +167,19 @@ ___ #### Defined in -[packages/devp2p/src/util.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L127) +[packages/devp2p/src/util.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L112) ___ ### decode -▸ **decode**(`buffer`): `Object` +▸ **decode**(`bytes`): `Object` #### Parameters | Name | Type | | :------ | :------ | -| `buffer` | `Buffer` | +| `bytes` | `Uint8Array` | #### Returns @@ -247,12 +188,12 @@ ___ | Name | Type | | :------ | :------ | | `data` | `any` | -| `publicKey` | `Buffer` | +| `publicKey` | `Uint8Array` | | `typename` | `string` \| `number` | #### Defined in -[packages/devp2p/src/dpt/message.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/message.ts#L187) +[packages/devp2p/src/dpt/message.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/message.ts#L190) ___ @@ -273,13 +214,13 @@ ___ #### Defined in -node_modules/@types/debug/index.d.ts:44 +node_modules/@types/debug/index.d.ts:51 ___ ### encode -▸ **encode**<`T`\>(`typename`, `data`, `privateKey`): `Buffer` +▸ **encode**<`T`\>(`typename`, `data`, `privateKey`): `Uint8Array` #### Type parameters @@ -293,15 +234,15 @@ ___ | :------ | :------ | | `typename` | `string` | | `data` | `T` | -| `privateKey` | `Buffer` | +| `privateKey` | `Uint8Array` | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/devp2p/src/dpt/message.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/message.ts#L171) +[packages/devp2p/src/dpt/message.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/message.ts#L177) ___ @@ -322,7 +263,7 @@ ___ #### Defined in -[packages/devp2p/src/util.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L106) +[packages/devp2p/src/util.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L91) ___ @@ -343,101 +284,167 @@ ___ #### Defined in -[packages/devp2p/src/util.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L97) +[packages/devp2p/src/util.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L82) ___ ### genPrivateKey -▸ **genPrivateKey**(): `Buffer` +▸ **genPrivateKey**(): `Uint8Array` #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/devp2p/src/util.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L18) +[packages/devp2p/src/util.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L19) ___ ### id2pk -▸ **id2pk**(`id`): `Buffer` +▸ **id2pk**(`id`): `Uint8Array` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `id` | `Uint8Array` | + +#### Returns + +`Uint8Array` + +#### Defined in + +[packages/devp2p/src/util.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L31) + +___ + +### ipToBytes + +▸ **ipToBytes**(`ip`, `bytes?`, `offset?`): `Uint8Array` + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `ip` | `string` | `undefined` | +| `bytes?` | `Uint8Array` | `undefined` | +| `offset` | `number` | `0` | + +#### Returns + +`Uint8Array` + +#### Defined in + +[packages/devp2p/src/util.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L167) + +___ + +### ipToString + +▸ **ipToString**(`bytes`, `offset?`, `length?`): `string` + +************************* *********************************************************** #### Parameters | Name | Type | | :------ | :------ | -| `id` | `Buffer` | +| `bytes` | `Uint8Array` | +| `offset?` | `number` | +| `length?` | `number` | #### Returns -`Buffer` +`string` #### Defined in -[packages/devp2p/src/util.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L30) +[packages/devp2p/src/util.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L131) ___ -### int2buffer +### isV4Format -▸ **int2buffer**(`v`): `Buffer` +▸ **isV4Format**(`ip`): `boolean` #### Parameters | Name | Type | | :------ | :------ | -| `v` | ``null`` \| `number` | +| `ip` | `string` | #### Returns -`Buffer` +`boolean` #### Defined in -[packages/devp2p/src/util.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L34) +[packages/devp2p/src/util.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L159) + +___ + +### isV6Format + +▸ **isV6Format**(`ip`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `ip` | `string` | + +#### Returns + +`boolean` + +#### Defined in + +[packages/devp2p/src/util.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L163) ___ ### keccak256 -▸ **keccak256**(...`buffers`): `Buffer` +▸ **keccak256**(...`bytes`): `Uint8Array` #### Parameters | Name | Type | | :------ | :------ | -| `...buffers` | `Buffer`[] | +| `...bytes` | `Uint8Array`[] | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/devp2p/src/util.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L13) +[packages/devp2p/src/util.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L14) ___ ### pk2id -▸ **pk2id**(`pk`): `Buffer` +▸ **pk2id**(`pk`): `Uint8Array` #### Parameters | Name | Type | | :------ | :------ | -| `pk` | `Buffer` | +| `pk` | `Uint8Array` | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/devp2p/src/util.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L23) +[packages/devp2p/src/util.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L24) ___ @@ -457,67 +464,67 @@ ___ #### Defined in -[packages/devp2p/src/util.ts:138](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L138) +[packages/devp2p/src/util.ts:123](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L123) ___ ### unstrictDecode -▸ **unstrictDecode**(`value`): `Buffer` \| `NestedBufferArray` +▸ **unstrictDecode**(`value`): `Uint8Array` \| `NestedUint8Array` #### Parameters | Name | Type | | :------ | :------ | -| `value` | `Buffer` | +| `value` | `Uint8Array` | #### Returns -`Buffer` \| `NestedBufferArray` +`Uint8Array` \| `NestedUint8Array` #### Defined in -[packages/devp2p/src/util.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L131) +[packages/devp2p/src/util.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L116) ___ ### xor -▸ **xor**(`a`, `b`): `Buffer` +▸ **xor**(`a`, `b`): `Uint8Array` #### Parameters | Name | Type | | :------ | :------ | -| `a` | `Buffer` | +| `a` | `Uint8Array` | | `b` | `any` | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/devp2p/src/util.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L58) +[packages/devp2p/src/util.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L42) ___ ### zfill -▸ **zfill**(`buffer`, `size`, `leftpad?`): `Buffer` +▸ **zfill**(`bytes`, `size`, `leftpad?`): `Uint8Array` #### Parameters | Name | Type | Default value | | :------ | :------ | :------ | -| `buffer` | `Buffer` | `undefined` | +| `bytes` | `Uint8Array` | `undefined` | | `size` | `number` | `undefined` | | `leftpad` | `boolean` | `true` | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/devp2p/src/util.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L51) +[packages/devp2p/src/util.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L35) diff --git a/packages/devp2p/docs/classes/BanList.md b/packages/devp2p/docs/classes/BanList.md index 74696cf1ec..1ae15e0be4 100644 --- a/packages/devp2p/docs/classes/BanList.md +++ b/packages/devp2p/docs/classes/BanList.md @@ -21,7 +21,7 @@ #### Defined in -[packages/devp2p/src/dpt/ban-list.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L15) +[packages/devp2p/src/dpt/ban-list.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L18) ## Methods @@ -33,7 +33,7 @@ | Name | Type | | :------ | :------ | -| `obj` | `string` \| `Buffer` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | | `maxAge?` | `number` | #### Returns @@ -42,7 +42,7 @@ #### Defined in -[packages/devp2p/src/dpt/ban-list.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L19) +[packages/devp2p/src/dpt/ban-list.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L22) ___ @@ -54,7 +54,7 @@ ___ | Name | Type | | :------ | :------ | -| `obj` | `string` \| `Buffer` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | #### Returns @@ -62,4 +62,4 @@ ___ #### Defined in -[packages/devp2p/src/dpt/ban-list.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L26) +[packages/devp2p/src/dpt/ban-list.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/ban-list.ts#L29) diff --git a/packages/devp2p/docs/classes/DNS.md b/packages/devp2p/docs/classes/DNS.md index 0715e5244d..dee6a834f6 100644 --- a/packages/devp2p/docs/classes/DNS.md +++ b/packages/devp2p/docs/classes/DNS.md @@ -27,7 +27,7 @@ #### Defined in -[packages/devp2p/src/dns/dns.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L36) +[packages/devp2p/src/dns/dns.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L27) ## Methods @@ -50,7 +50,7 @@ TestDouble mocking of the native `dns` module. #### Defined in -[packages/devp2p/src/dns/dns.ts:216](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L216) +[packages/devp2p/src/dns/dns.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L208) ___ @@ -68,7 +68,7 @@ search exceeds `maxQuantity` plus the `errorTolerance` factor. | Name | Type | Description | | :------ | :------ | :------ | | `maxQuantity` | `number` | max number to get | -| `dnsNetworks` | `string`[] | - | +| `dnsNetworks` | `string`[] | enrTree strings (See EIP-1459 for format) | #### Returns @@ -76,4 +76,4 @@ search exceeds `maxQuantity` plus the `errorTolerance` factor. #### Defined in -[packages/devp2p/src/dns/dns.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L54) +[packages/devp2p/src/dns/dns.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/dns.ts#L45) diff --git a/packages/devp2p/docs/classes/DPT.md b/packages/devp2p/docs/classes/DPT.md index 8b93f00b7f..986e44b072 100644 --- a/packages/devp2p/docs/classes/DPT.md +++ b/packages/devp2p/docs/classes/DPT.md @@ -2,12 +2,6 @@ # Class: DPT -## Hierarchy - -- `EventEmitter` - - ↳ **`DPT`** - ## Table of contents ### Constructors @@ -16,50 +10,24 @@ ### Properties -- [\_debug](DPT.md#_debug) -- [banlist](DPT.md#banlist) -- [dns](DPT.md#dns) -- [privateKey](DPT.md#privatekey) -- [captureRejectionSymbol](DPT.md#capturerejectionsymbol) -- [captureRejections](DPT.md#capturerejections) -- [defaultMaxListeners](DPT.md#defaultmaxlisteners) -- [errorMonitor](DPT.md#errormonitor) +- [events](DPT.md#events) +- [id](DPT.md#id) ### Methods - [\_addPeerBatch](DPT.md#_addpeerbatch) - [\_onKBucketPing](DPT.md#_onkbucketping) -- [addListener](DPT.md#addlistener) - [addPeer](DPT.md#addpeer) - [banPeer](DPT.md#banpeer) - [bind](DPT.md#bind) - [bootstrap](DPT.md#bootstrap) - [destroy](DPT.md#destroy) -- [emit](DPT.md#emit) -- [eventNames](DPT.md#eventnames) - [getClosestPeers](DPT.md#getclosestpeers) - [getDnsPeers](DPT.md#getdnspeers) -- [getMaxListeners](DPT.md#getmaxlisteners) - [getPeer](DPT.md#getpeer) - [getPeers](DPT.md#getpeers) -- [listenerCount](DPT.md#listenercount) -- [listeners](DPT.md#listeners) -- [off](DPT.md#off) -- [on](DPT.md#on) -- [once](DPT.md#once) -- [prependListener](DPT.md#prependlistener) -- [prependOnceListener](DPT.md#prependoncelistener) -- [rawListeners](DPT.md#rawlisteners) - [refresh](DPT.md#refresh) -- [removeAllListeners](DPT.md#removealllisteners) -- [removeListener](DPT.md#removelistener) - [removePeer](DPT.md#removepeer) -- [setMaxListeners](DPT.md#setmaxlisteners) -- [getEventListeners](DPT.md#geteventlisteners) -- [listenerCount](DPT.md#listenercount-1) -- [on](DPT.md#on-1) -- [once](DPT.md#once-1) -- [setMaxListeners](DPT.md#setmaxlisteners-1) ## Constructors @@ -71,122 +39,32 @@ | Name | Type | | :------ | :------ | -| `privateKey` | `Buffer` | +| `privateKey` | `Uint8Array` | | `options` | [`DPTOptions`](../interfaces/DPTOptions.md) | -#### Overrides - -EventEmitter.constructor - #### Defined in -[packages/devp2p/src/dpt/dpt.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L106) +[packages/devp2p/src/dpt/dpt.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L35) ## Properties -### \_debug - -• **\_debug**: `Debugger` - -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L93) - -___ - -### banlist - -• **banlist**: [`BanList`](BanList.md) - -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L91) - -___ - -### dns - -• **dns**: [`DNS`](DNS.md) - -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L92) - -___ - -### privateKey - -• **privateKey**: `Buffer` - -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L90) - -___ - -### captureRejectionSymbol - -▪ `Static` `Readonly` **captureRejectionSymbol**: typeof [`captureRejectionSymbol`](DPT.md#capturerejectionsymbol) - -#### Inherited from - -EventEmitter.captureRejectionSymbol - -#### Defined in - -node_modules/@types/node/events.d.ts:291 - -___ - -### captureRejections - -▪ `Static` **captureRejections**: `boolean` - -Sets or gets the default captureRejection value for all emitters. - -#### Inherited from - -EventEmitter.captureRejections - -#### Defined in - -node_modules/@types/node/events.d.ts:296 - -___ - -### defaultMaxListeners +### events -▪ `Static` **defaultMaxListeners**: `number` - -#### Inherited from - -EventEmitter.defaultMaxListeners +• **events**: `EventEmitter` #### Defined in -node_modules/@types/node/events.d.ts:297 +[packages/devp2p/src/dpt/dpt.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L18) ___ -### errorMonitor - -▪ `Static` `Readonly` **errorMonitor**: typeof [`errorMonitor`](DPT.md#errormonitor) - -This symbol shall be used to install a listener for only monitoring `'error'` -events. Listeners installed using this symbol are called before the regular -`'error'` listeners are called. +### id -Installing a listener using this symbol does not change the behavior once an -`'error'` event is emitted, therefore the process will still crash if no -regular `'error'` listener is installed. - -#### Inherited from - -EventEmitter.errorMonitor +• `Readonly` **id**: `undefined` \| `Uint8Array` #### Defined in -node_modules/@types/node/events.d.ts:290 +[packages/devp2p/src/dpt/dpt.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L24) ## Methods @@ -206,7 +84,7 @@ node_modules/@types/node/events.d.ts:290 #### Defined in -[packages/devp2p/src/dpt/dpt.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L177) +[packages/devp2p/src/dpt/dpt.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L105) ___ @@ -227,44 +105,13 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L156) - -___ - -### addListener - -▸ **addListener**(`eventName`, `listener`): [`DPT`](DPT.md) - -Alias for `emitter.on(eventName, listener)`. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`DPT`](DPT.md) - -#### Inherited from - -EventEmitter.addListener - -#### Defined in - -node_modules/@types/node/events.d.ts:317 +[packages/devp2p/src/dpt/dpt.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L84) ___ ### addPeer -▸ **addPeer**(`obj`): `Promise`<`any`\> +▸ **addPeer**(`obj`): `Promise`<[`PeerInfo`](../interfaces/PeerInfo.md)\> #### Parameters @@ -274,11 +121,11 @@ ___ #### Returns -`Promise`<`any`\> +`Promise`<[`PeerInfo`](../interfaces/PeerInfo.md)\> #### Defined in -[packages/devp2p/src/dpt/dpt.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L203) +[packages/devp2p/src/dpt/dpt.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L131) ___ @@ -290,7 +137,7 @@ ___ | Name | Type | | :------ | :------ | -| `obj` | `string` \| `Buffer` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | | `maxAge?` | `number` | #### Returns @@ -299,7 +146,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:239](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L239) +[packages/devp2p/src/dpt/dpt.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L167) ___ @@ -319,7 +166,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L147) +[packages/devp2p/src/dpt/dpt.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L75) ___ @@ -339,7 +186,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L190) +[packages/devp2p/src/dpt/dpt.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L118) ___ @@ -359,112 +206,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L151) - -___ - -### emit - -▸ **emit**(`eventName`, ...`args`): `boolean` - -Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments -to each. - -Returns `true` if the event had listeners, `false` otherwise. - -```js -const EventEmitter = require('events'); -const myEmitter = new EventEmitter(); - -// First listener -myEmitter.on('event', function firstListener() { - console.log('Helloooo! first listener'); -}); -// Second listener -myEmitter.on('event', function secondListener(arg1, arg2) { - console.log(`event with parameters ${arg1}, ${arg2} in second listener`); -}); -// Third listener -myEmitter.on('event', function thirdListener(...args) { - const parameters = args.join(', '); - console.log(`event with parameters ${parameters} in third listener`); -}); - -console.log(myEmitter.listeners('event')); - -myEmitter.emit('event', 1, 2, 3, 4, 5); - -// Prints: -// [ -// [Function: firstListener], -// [Function: secondListener], -// [Function: thirdListener] -// ] -// Helloooo! first listener -// event with parameters 1, 2 in second listener -// event with parameters 1, 2, 3, 4, 5 in third listener -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `...args` | `any`[] | - -#### Returns - -`boolean` - -#### Inherited from - -EventEmitter.emit - -#### Defined in - -node_modules/@types/node/events.d.ts:573 - -___ - -### eventNames - -▸ **eventNames**(): (`string` \| `symbol`)[] - -Returns an array listing the events for which the emitter has registered -listeners. The values in the array are strings or `Symbol`s. - -```js -const EventEmitter = require('events'); -const myEE = new EventEmitter(); -myEE.on('foo', () => {}); -myEE.on('bar', () => {}); - -const sym = Symbol('symbol'); -myEE.on(sym, () => {}); - -console.log(myEE.eventNames()); -// Prints: [ 'foo', 'bar', Symbol(symbol) ] -``` - -**`Since`** - -v6.0.0 - -#### Returns - -(`string` \| `symbol`)[] - -#### Inherited from - -EventEmitter.eventNames - -#### Defined in - -node_modules/@types/node/events.d.ts:632 +[packages/devp2p/src/dpt/dpt.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L79) ___ @@ -476,7 +218,7 @@ ___ | Name | Type | | :------ | :------ | -| `id` | `string` | +| `id` | `Uint8Array` | #### Returns @@ -484,7 +226,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:231](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L231) +[packages/devp2p/src/dpt/dpt.ts:159](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L159) ___ @@ -498,32 +240,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:244](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L244) - -___ - -### getMaxListeners - -▸ **getMaxListeners**(): `number` - -Returns the current max listener value for the `EventEmitter` which is either -set by `emitter.setMaxListeners(n)` or defaults to [defaultMaxListeners](DPT.md#defaultmaxlisteners). - -**`Since`** - -v1.0.0 - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.getMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:489 +[packages/devp2p/src/dpt/dpt.ts:172](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L172) ___ @@ -535,7 +252,7 @@ ___ | Name | Type | | :------ | :------ | -| `obj` | `string` \| `Buffer` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | #### Returns @@ -543,7 +260,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L223) +[packages/devp2p/src/dpt/dpt.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L151) ___ @@ -557,519 +274,33 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:227](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L227) - -___ - -### listenerCount - -▸ **listenerCount**(`eventName`): `number` - -Returns the number of listeners listening to the event named `eventName`. - -**`Since`** - -v3.2.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event being listened for | - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:579 +[packages/devp2p/src/dpt/dpt.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L155) ___ -### listeners - -▸ **listeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -console.log(util.inspect(server.listeners('connection'))); -// Prints: [ [Function] ] -``` - -**`Since`** - -v0.1.26 - -#### Parameters +### refresh -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | +▸ **refresh**(): `Promise`<`void`\> #### Returns -`Function`[] - -#### Inherited from - -EventEmitter.listeners +`Promise`<`void`\> #### Defined in -node_modules/@types/node/events.d.ts:502 +[packages/devp2p/src/dpt/dpt.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L176) ___ -### off - -▸ **off**(`eventName`, `listener`): [`DPT`](DPT.md) - -Alias for `emitter.removeListener()`. - -**`Since`** +### removePeer -v10.0.0 +▸ **removePeer**(`obj`): `void` #### Parameters | Name | Type | | :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`DPT`](DPT.md) - -#### Inherited from - -EventEmitter.off - -#### Defined in - -node_modules/@types/node/events.d.ts:462 - -___ - -### on - -▸ **on**(`eventName`, `listener`): [`DPT`](DPT.md) - -Adds the `listener` function to the end of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.on('foo', () => console.log('a')); -myEE.prependListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.1.101 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`DPT`](DPT.md) - -#### Inherited from - -EventEmitter.on - -#### Defined in - -node_modules/@types/node/events.d.ts:348 - -___ - -### once - -▸ **once**(`eventName`, `listener`): [`DPT`](DPT.md) - -Adds a **one-time**`listener` function for the event named `eventName`. The -next time `eventName` is triggered, this listener is removed and then invoked. - -```js -server.once('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.once('foo', () => console.log('a')); -myEE.prependOnceListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.3.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`DPT`](DPT.md) - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:377 - -___ - -### prependListener - -▸ **prependListener**(`eventName`, `listener`): [`DPT`](DPT.md) - -Adds the `listener` function to the _beginning_ of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.prependListener('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`DPT`](DPT.md) - -#### Inherited from - -EventEmitter.prependListener - -#### Defined in - -node_modules/@types/node/events.d.ts:597 - -___ - -### prependOnceListener - -▸ **prependOnceListener**(`eventName`, `listener`): [`DPT`](DPT.md) - -Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this -listener is removed, and then invoked. - -```js -server.prependOnceListener('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`DPT`](DPT.md) - -#### Inherited from - -EventEmitter.prependOnceListener - -#### Defined in - -node_modules/@types/node/events.d.ts:613 - -___ - -### rawListeners - -▸ **rawListeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`, -including any wrappers (such as those created by `.once()`). - -```js -const emitter = new EventEmitter(); -emitter.once('log', () => console.log('log once')); - -// Returns a new Array with a function `onceWrapper` which has a property -// `listener` which contains the original listener bound above -const listeners = emitter.rawListeners('log'); -const logFnWrapper = listeners[0]; - -// Logs "log once" to the console and does not unbind the `once` event -logFnWrapper.listener(); - -// Logs "log once" to the console and removes the listener -logFnWrapper(); - -emitter.on('log', () => console.log('log persistently')); -// Will return a new Array with a single function bound by `.on()` above -const newListeners = emitter.rawListeners('log'); - -// Logs "log persistently" twice -newListeners[0](); -emitter.emit('log'); -``` - -**`Since`** - -v9.4.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.rawListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:532 - -___ - -### refresh - -▸ **refresh**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:248](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L248) - -___ - -### removeAllListeners - -▸ **removeAllListeners**(`event?`): [`DPT`](DPT.md) - -Removes all listeners, or those of the specified `eventName`. - -It is bad practice to remove listeners added elsewhere in the code, -particularly when the `EventEmitter` instance was created by some other -component or module (e.g. sockets or file streams). - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event?` | `string` \| `symbol` | - -#### Returns - -[`DPT`](DPT.md) - -#### Inherited from - -EventEmitter.removeAllListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:473 - -___ - -### removeListener - -▸ **removeListener**(`eventName`, `listener`): [`DPT`](DPT.md) - -Removes the specified `listener` from the listener array for the event named`eventName`. - -```js -const callback = (stream) => { - console.log('someone connected!'); -}; -server.on('connection', callback); -// ... -server.removeListener('connection', callback); -``` - -`removeListener()` will remove, at most, one instance of a listener from the -listener array. If any single listener has been added multiple times to the -listener array for the specified `eventName`, then `removeListener()` must be -called multiple times to remove each instance. - -Once an event is emitted, all listeners attached to it at the -time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will -not remove them from`emit()` in progress. Subsequent events behave as expected. - -```js -const myEmitter = new MyEmitter(); - -const callbackA = () => { - console.log('A'); - myEmitter.removeListener('event', callbackB); -}; - -const callbackB = () => { - console.log('B'); -}; - -myEmitter.on('event', callbackA); - -myEmitter.on('event', callbackB); - -// callbackA removes listener callbackB but it will still be called. -// Internal listener array at time of emit [callbackA, callbackB] -myEmitter.emit('event'); -// Prints: -// A -// B - -// callbackB is now removed. -// Internal listener array [callbackA] -myEmitter.emit('event'); -// Prints: -// A -``` - -Because listeners are managed using an internal array, calling this will -change the position indices of any listener registered _after_ the listener -being removed. This will not impact the order in which listeners are called, -but it means that any copies of the listener array as returned by -the `emitter.listeners()` method will need to be recreated. - -When a single function has been added as a handler multiple times for a single -event (as in the example below), `removeListener()` will remove the most -recently added instance. In the example the `once('ping')`listener is removed: - -```js -const ee = new EventEmitter(); - -function pong() { - console.log('pong'); -} - -ee.on('ping', pong); -ee.once('ping', pong); -ee.removeListener('ping', pong); - -ee.emit('ping'); -ee.emit('ping'); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`DPT`](DPT.md) - -#### Inherited from - -EventEmitter.removeListener - -#### Defined in - -node_modules/@types/node/events.d.ts:457 - -___ - -### removePeer - -▸ **removePeer**(`obj`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `obj` | `any` | +| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | #### Returns @@ -1077,396 +308,4 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:235](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L235) - -___ - -### setMaxListeners - -▸ **setMaxListeners**(`n`): [`DPT`](DPT.md) - -By default `EventEmitter`s will print a warning if more than `10` listeners are -added for a particular event. This is a useful default that helps finding -memory leaks. The `emitter.setMaxListeners()` method allows the limit to be -modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.3.5 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `n` | `number` | - -#### Returns - -[`DPT`](DPT.md) - -#### Inherited from - -EventEmitter.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:483 - -___ - -### getEventListeners - -▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -For `EventEmitter`s this behaves exactly the same as calling `.listeners` on -the emitter. - -For `EventTarget`s this is the only way to get the event listeners for the -event target. This is useful for debugging and diagnostic purposes. - -```js -const { getEventListeners, EventEmitter } = require('events'); - -{ - const ee = new EventEmitter(); - const listener = () => console.log('Events are fun'); - ee.on('foo', listener); - getEventListeners(ee, 'foo'); // [listener] -} -{ - const et = new EventTarget(); - const listener = () => console.log('Events are fun'); - et.addEventListener('foo', listener); - getEventListeners(et, 'foo'); // [listener] -} -``` - -**`Since`** - -v15.2.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `EventEmitter` \| `DOMEventTarget` | -| `name` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.getEventListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:262 - -___ - -### listenerCount - -▸ `Static` **listenerCount**(`emitter`, `eventName`): `number` - -A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. - -```js -const { EventEmitter, listenerCount } = require('events'); -const myEmitter = new EventEmitter(); -myEmitter.on('event', () => {}); -myEmitter.on('event', () => {}); -console.log(listenerCount(myEmitter, 'event')); -// Prints: 2 -``` - -**`Since`** - -v0.9.12 - -**`Deprecated`** - -Since v3.2.0 - Use `listenerCount` instead. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | The emitter to query | -| `eventName` | `string` \| `symbol` | The event name | - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:234 - -___ - -### on - -▸ `Static` **on**(`emitter`, `eventName`, `options?`): `AsyncIterableIterator`<`any`\> - -```js -const { on, EventEmitter } = require('events'); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo')) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); -``` - -Returns an `AsyncIterator` that iterates `eventName` events. It will throw -if the `EventEmitter` emits `'error'`. It removes all listeners when -exiting the loop. The `value` returned by each iteration is an array -composed of the emitted event arguments. - -An `AbortSignal` can be used to cancel waiting on events: - -```js -const { on, EventEmitter } = require('events'); -const ac = new AbortController(); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo', { signal: ac.signal })) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); - -process.nextTick(() => ac.abort()); -``` - -**`Since`** - -v13.6.0, v12.16.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | - | -| `eventName` | `string` | The name of the event being listened for | -| `options?` | `StaticEventEmitterOptions` | - | - -#### Returns - -`AsyncIterableIterator`<`any`\> - -that iterates `eventName` events emitted by the `emitter` - -#### Inherited from - -EventEmitter.on - -#### Defined in - -node_modules/@types/node/events.d.ts:217 - -___ - -### once - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given -event or that is rejected if the `EventEmitter` emits `'error'` while waiting. -The `Promise` will resolve with an array of all the arguments emitted to the -given event. - -This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event -semantics and does not listen to the `'error'` event. - -```js -const { once, EventEmitter } = require('events'); - -async function run() { - const ee = new EventEmitter(); - - process.nextTick(() => { - ee.emit('myevent', 42); - }); - - const [value] = await once(ee, 'myevent'); - console.log(value); - - const err = new Error('kaboom'); - process.nextTick(() => { - ee.emit('error', err); - }); - - try { - await once(ee, 'myevent'); - } catch (err) { - console.log('error happened', err); - } -} - -run(); -``` - -The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the -'`error'` event itself, then it is treated as any other kind of event without -special handling: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); - -once(ee, 'error') - .then(([err]) => console.log('ok', err.message)) - .catch((err) => console.log('error', err.message)); - -ee.emit('error', new Error('boom')); - -// Prints: ok boom -``` - -An `AbortSignal` can be used to cancel waiting for the event: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); -const ac = new AbortController(); - -async function foo(emitter, event, signal) { - try { - await once(emitter, event, { signal }); - console.log('event emitted!'); - } catch (error) { - if (error.name === 'AbortError') { - console.error('Waiting for the event was canceled!'); - } else { - console.error('There was an error', error.message); - } - } -} - -foo(ee, 'foo', ac.signal); -ac.abort(); // Abort waiting for the event -ee.emit('foo'); // Prints: Waiting for the event was canceled! -``` - -**`Since`** - -v11.13.0, v10.16.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `NodeEventTarget` | -| `eventName` | `string` \| `symbol` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:157 - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `DOMEventTarget` | -| `eventName` | `string` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:158 - -___ - -### setMaxListeners - -▸ `Static` **setMaxListeners**(`n?`, ...`eventTargets`): `void` - -```js -const { - setMaxListeners, - EventEmitter -} = require('events'); - -const target = new EventTarget(); -const emitter = new EventEmitter(); - -setMaxListeners(5, target, emitter); -``` - -**`Since`** - -v15.4.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `n?` | `number` | A non-negative number. The maximum number of listeners per `EventTarget` event. | -| `...eventTargets` | (`EventEmitter` \| `DOMEventTarget`)[] | - | - -#### Returns - -`void` - -#### Inherited from - -EventEmitter.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:280 +[packages/devp2p/src/dpt/dpt.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L163) diff --git a/packages/devp2p/docs/classes/Deferred.md b/packages/devp2p/docs/classes/Deferred.md index 2aacf158df..f9c880472a 100644 --- a/packages/devp2p/docs/classes/Deferred.md +++ b/packages/devp2p/docs/classes/Deferred.md @@ -34,7 +34,7 @@ #### Defined in -[packages/devp2p/src/util.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L119) +[packages/devp2p/src/util.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L104) ## Properties @@ -44,7 +44,7 @@ #### Defined in -[packages/devp2p/src/util.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L116) +[packages/devp2p/src/util.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L101) ___ @@ -68,7 +68,7 @@ ___ #### Defined in -[packages/devp2p/src/util.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L118) +[packages/devp2p/src/util.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L103) ___ @@ -92,4 +92,4 @@ ___ #### Defined in -[packages/devp2p/src/util.ts:117](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L117) +[packages/devp2p/src/util.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/util.ts#L102) diff --git a/packages/devp2p/docs/classes/ECIES.md b/packages/devp2p/docs/classes/ECIES.md index 63701a4fcf..991d4c3378 100644 --- a/packages/devp2p/docs/classes/ECIES.md +++ b/packages/devp2p/docs/classes/ECIES.md @@ -8,27 +8,6 @@ - [constructor](ECIES.md#constructor) -### Properties - -- [\_bodySize](ECIES.md#_bodysize) -- [\_egressAes](ECIES.md#_egressaes) -- [\_egressMac](ECIES.md#_egressmac) -- [\_ephemeralPrivateKey](ECIES.md#_ephemeralprivatekey) -- [\_ephemeralPublicKey](ECIES.md#_ephemeralpublickey) -- [\_ephemeralSharedSecret](ECIES.md#_ephemeralsharedsecret) -- [\_gotEIP8Ack](ECIES.md#_goteip8ack) -- [\_gotEIP8Auth](ECIES.md#_goteip8auth) -- [\_ingressAes](ECIES.md#_ingressaes) -- [\_ingressMac](ECIES.md#_ingressmac) -- [\_initMsg](ECIES.md#_initmsg) -- [\_nonce](ECIES.md#_nonce) -- [\_privateKey](ECIES.md#_privatekey) -- [\_publicKey](ECIES.md#_publickey) -- [\_remoteEphemeralPublicKey](ECIES.md#_remoteephemeralpublickey) -- [\_remoteInitMsg](ECIES.md#_remoteinitmsg) -- [\_remoteNonce](ECIES.md#_remotenonce) -- [\_remotePublicKey](ECIES.md#_remotepublickey) - ### Methods - [\_decryptMessage](ECIES.md#_decryptmessage) @@ -57,235 +36,55 @@ | Name | Type | | :------ | :------ | -| `privateKey` | `Buffer` | -| `id` | `Buffer` | -| `remoteId` | `Buffer` | - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L78) - -## Properties - -### \_bodySize - -• **\_bodySize**: ``null`` \| `number` = `null` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L76) - -___ - -### \_egressAes - -• **\_egressAes**: ``null`` \| `Decipher` = `null` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L69) - -___ - -### \_egressMac - -• **\_egressMac**: ``null`` \| [`MAC`](MAC.md) = `null` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L71) - -___ - -### \_ephemeralPrivateKey - -• **\_ephemeralPrivateKey**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L72) - -___ - -### \_ephemeralPublicKey - -• **\_ephemeralPublicKey**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L73) - -___ - -### \_ephemeralSharedSecret - -• **\_ephemeralSharedSecret**: ``null`` \| `Buffer` = `null` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L75) - -___ - -### \_gotEIP8Ack - -• **\_gotEIP8Ack**: `boolean` = `false` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L67) - -___ - -### \_gotEIP8Auth - -• **\_gotEIP8Auth**: `boolean` = `false` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L66) - -___ - -### \_ingressAes - -• **\_ingressAes**: ``null`` \| `Decipher` = `null` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L68) - -___ - -### \_ingressMac - -• **\_ingressMac**: ``null`` \| [`MAC`](MAC.md) = `null` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L70) - -___ - -### \_initMsg - -• **\_initMsg**: `undefined` \| ``null`` \| `Buffer` = `null` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L64) - -___ - -### \_nonce - -• **\_nonce**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L62) - -___ - -### \_privateKey - -• **\_privateKey**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L59) - -___ - -### \_publicKey - -• **\_publicKey**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L60) - -___ - -### \_remoteEphemeralPublicKey - -• **\_remoteEphemeralPublicKey**: ``null`` \| `Buffer` = `null` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L74) - -___ - -### \_remoteInitMsg - -• **\_remoteInitMsg**: ``null`` \| `Buffer` = `null` +| `privateKey` | `Uint8Array` | +| `id` | `Uint8Array` | +| `remoteId` | `Uint8Array` | #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L65) - -___ - -### \_remoteNonce - -• **\_remoteNonce**: ``null`` \| `Buffer` = `null` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L63) - -___ - -### \_remotePublicKey - -• **\_remotePublicKey**: ``null`` \| `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/ecies.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L61) +[packages/devp2p/src/rlpx/ecies.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L80) ## Methods ### \_decryptMessage -▸ **_decryptMessage**(`data`, `sharedMacData?`): `Buffer` +▸ **_decryptMessage**(`data`, `sharedMacData?`): `Uint8Array` #### Parameters | Name | Type | Default value | | :------ | :------ | :------ | -| `data` | `Buffer` | `undefined` | -| `sharedMacData` | ``null`` \| `Buffer` | `null` | +| `data` | `Uint8Array` | `undefined` | +| `sharedMacData` | ``null`` \| `Uint8Array` | `null` | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L115) +[packages/devp2p/src/rlpx/ecies.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L119) ___ ### \_encryptMessage -▸ **_encryptMessage**(`data`, `sharedMacData?`): `undefined` \| `Buffer` +▸ **_encryptMessage**(`data`, `sharedMacData?`): `undefined` \| `Uint8Array` #### Parameters | Name | Type | Default value | | :------ | :------ | :------ | -| `data` | `Buffer` | `undefined` | -| `sharedMacData` | ``null`` \| `Buffer` | `null` | +| `data` | `Uint8Array` | `undefined` | +| `sharedMacData` | ``null`` \| `Uint8Array` | `null` | #### Returns -`undefined` \| `Buffer` +`undefined` \| `Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L88) +[packages/devp2p/src/rlpx/ecies.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L90) ___ @@ -297,7 +96,7 @@ ___ | Name | Type | | :------ | :------ | -| `remoteData` | `Buffer` | +| `remoteData` | `Uint8Array` | | `incoming` | `boolean` | #### Returns @@ -306,89 +105,89 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L150) +[packages/devp2p/src/rlpx/ecies.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L154) ___ ### createAckEIP8 -▸ **createAckEIP8**(): `undefined` \| `Buffer` +▸ **createAckEIP8**(): `undefined` \| `Uint8Array` #### Returns -`undefined` \| `Buffer` +`undefined` \| `Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:274](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L274) +[packages/devp2p/src/rlpx/ecies.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L284) ___ ### createAckOld -▸ **createAckOld**(): `undefined` \| `Buffer` +▸ **createAckOld**(): `undefined` \| `Uint8Array` #### Returns -`undefined` \| `Buffer` +`undefined` \| `Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:291](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L291) +[packages/devp2p/src/rlpx/ecies.ts:301](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L301) ___ ### createAuthEIP8 -▸ **createAuthEIP8**(): `undefined` \| `Buffer` +▸ **createAuthEIP8**(): `undefined` \| `Uint8Array` #### Returns -`undefined` \| `Buffer` +`undefined` \| `Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L174) +[packages/devp2p/src/rlpx/ecies.ts:178](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L178) ___ ### createAuthNonEIP8 -▸ **createAuthNonEIP8**(): `undefined` \| `Buffer` +▸ **createAuthNonEIP8**(): `undefined` \| `Uint8Array` #### Returns -`undefined` \| `Buffer` +`undefined` \| `Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L197) +[packages/devp2p/src/rlpx/ecies.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L201) ___ ### createBody -▸ **createBody**(`data`): `undefined` \| `Buffer` +▸ **createBody**(`data`): `undefined` \| `Uint8Array` #### Parameters | Name | Type | | :------ | :------ | -| `data` | `Buffer` | +| `data` | `Uint8Array` | #### Returns -`undefined` \| `Buffer` +`undefined` \| `Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:368](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L368) +[packages/devp2p/src/rlpx/ecies.ts:378](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L378) ___ ### createHeader -▸ **createHeader**(`size`): `undefined` \| `Buffer` +▸ **createHeader**(`size`): `undefined` \| `Uint8Array` #### Parameters @@ -398,11 +197,11 @@ ___ #### Returns -`undefined` \| `Buffer` +`undefined` \| `Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:337](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L337) +[packages/devp2p/src/rlpx/ecies.ts:347](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L347) ___ @@ -414,7 +213,7 @@ ___ | Name | Type | | :------ | :------ | -| `data` | `Buffer` | +| `data` | `Uint8Array` | #### Returns @@ -422,7 +221,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:331](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L331) +[packages/devp2p/src/rlpx/ecies.ts:341](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L341) ___ @@ -434,8 +233,8 @@ ___ | Name | Type | Default value | | :------ | :------ | :------ | -| `data` | `Buffer` | `undefined` | -| `sharedMacData` | ``null`` \| `Buffer` | `null` | +| `data` | `Uint8Array` | `undefined` | +| `sharedMacData` | ``null`` \| `Uint8Array` | `null` | #### Returns @@ -443,7 +242,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:301](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L301) +[packages/devp2p/src/rlpx/ecies.ts:311](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L311) ___ @@ -455,7 +254,7 @@ ___ | Name | Type | | :------ | :------ | -| `data` | `Buffer` | +| `data` | `Uint8Array` | #### Returns @@ -463,48 +262,48 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:268](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L268) +[packages/devp2p/src/rlpx/ecies.ts:278](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L278) ___ ### parseAuthPlain -▸ **parseAuthPlain**(`data`, `sharedMacData?`): `undefined` \| `Buffer` +▸ **parseAuthPlain**(`data`, `sharedMacData?`): `undefined` \| `Uint8Array` #### Parameters | Name | Type | Default value | | :------ | :------ | :------ | -| `data` | `Buffer` | `undefined` | -| `sharedMacData` | ``null`` \| `Buffer` | `null` | +| `data` | `Uint8Array` | `undefined` | +| `sharedMacData` | ``null`` \| `Uint8Array` | `null` | #### Returns -`undefined` \| `Buffer` +`undefined` \| `Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:214](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L214) +[packages/devp2p/src/rlpx/ecies.ts:218](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L218) ___ ### parseBody -▸ **parseBody**(`data`): `undefined` \| `Buffer` +▸ **parseBody**(`data`): `undefined` \| `Uint8Array` #### Parameters | Name | Type | | :------ | :------ | -| `data` | `Buffer` | +| `data` | `Uint8Array` | #### Returns -`undefined` \| `Buffer` +`undefined` \| `Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:379](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L379) +[packages/devp2p/src/rlpx/ecies.ts:389](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L389) ___ @@ -516,7 +315,7 @@ ___ | Name | Type | | :------ | :------ | -| `data` | `Buffer` | +| `data` | `Uint8Array` | #### Returns @@ -524,4 +323,4 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/ecies.ts:352](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L352) +[packages/devp2p/src/rlpx/ecies.ts:362](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/ecies.ts#L362) diff --git a/packages/devp2p/docs/classes/ENR.md b/packages/devp2p/docs/classes/ENR.md index f6f20b1665..1481be9d6d 100644 --- a/packages/devp2p/docs/classes/ENR.md +++ b/packages/devp2p/docs/classes/ENR.md @@ -37,7 +37,7 @@ #### Defined in -[packages/devp2p/src/dns/enr.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L35) +[packages/devp2p/src/dns/enr.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L34) ___ @@ -47,7 +47,7 @@ ___ #### Defined in -[packages/devp2p/src/dns/enr.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L33) +[packages/devp2p/src/dns/enr.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L32) ___ @@ -57,7 +57,7 @@ ___ #### Defined in -[packages/devp2p/src/dns/enr.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L36) +[packages/devp2p/src/dns/enr.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L35) ___ @@ -67,7 +67,7 @@ ___ #### Defined in -[packages/devp2p/src/dns/enr.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L34) +[packages/devp2p/src/dns/enr.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L33) ## Methods @@ -81,7 +81,7 @@ Gets relevant multiaddr conversion codes for ipv4, ipv6 and tcp, udp formats | Name | Type | | :------ | :------ | -| `protocolId` | `Buffer` | +| `protocolId` | `Uint8Array` | #### Returns @@ -89,7 +89,7 @@ Gets relevant multiaddr conversion codes for ipv4, ipv6 and tcp, udp formats #### Defined in -[packages/devp2p/src/dns/enr.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L176) +[packages/devp2p/src/dns/enr.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L182) ___ @@ -118,7 +118,7 @@ The record components are: #### Defined in -[packages/devp2p/src/dns/enr.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L51) +[packages/devp2p/src/dns/enr.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L50) ___ @@ -145,7 +145,7 @@ subdomain subdomain to retrieve branch records from. #### Defined in -[packages/devp2p/src/dns/enr.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L95) +[packages/devp2p/src/dns/enr.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L101) ___ @@ -168,7 +168,7 @@ either further branch entries or ENR records. #### Defined in -[packages/devp2p/src/dns/enr.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L164) +[packages/devp2p/src/dns/enr.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L170) ___ @@ -192,4 +192,4 @@ and the public key is used to verify the root entry record #### Defined in -[packages/devp2p/src/dns/enr.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L141) +[packages/devp2p/src/dns/enr.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dns/enr.ts#L147) diff --git a/packages/devp2p/docs/classes/ETH-1.md b/packages/devp2p/docs/classes/ETH-1.md index bbf49fb13a..a636ab6f90 100644 --- a/packages/devp2p/docs/classes/ETH-1.md +++ b/packages/devp2p/docs/classes/ETH-1.md @@ -16,22 +16,13 @@ ### Properties -- [DEBUG](ETH-1.md#debug) -- [\_forkHash](ETH-1.md#_forkhash) -- [\_hardfork](ETH-1.md#_hardfork) -- [\_latestBlock](ETH-1.md#_latestblock) -- [\_nextForkBlock](ETH-1.md#_nextforkblock) -- [\_peerStatus](ETH-1.md#_peerstatus) -- [\_status](ETH-1.md#_status) -- [captureRejectionSymbol](ETH-1.md#capturerejectionsymbol) -- [captureRejections](ETH-1.md#capturerejections) -- [defaultMaxListeners](ETH-1.md#defaultmaxlisteners) -- [errorMonitor](ETH-1.md#errormonitor) - [eth62](ETH-1.md#eth62) - [eth63](ETH-1.md#eth63) - [eth64](ETH-1.md#eth64) - [eth65](ETH-1.md#eth65) - [eth66](ETH-1.md#eth66) +- [eth67](ETH-1.md#eth67) +- [eth68](ETH-1.md#eth68) ### Methods @@ -41,30 +32,10 @@ - [\_handleStatus](ETH-1.md#_handlestatus) - [\_nextForkFromForkId](ETH-1.md#_nextforkfromforkid) - [\_validateForkId](ETH-1.md#_validateforkid) -- [addListener](ETH-1.md#addlistener) -- [emit](ETH-1.md#emit) -- [eventNames](ETH-1.md#eventnames) -- [getMaxListeners](ETH-1.md#getmaxlisteners) - [getMsgPrefix](ETH-1.md#getmsgprefix) - [getVersion](ETH-1.md#getversion) -- [listenerCount](ETH-1.md#listenercount) -- [listeners](ETH-1.md#listeners) -- [off](ETH-1.md#off) -- [on](ETH-1.md#on) -- [once](ETH-1.md#once) -- [prependListener](ETH-1.md#prependlistener) -- [prependOnceListener](ETH-1.md#prependoncelistener) -- [rawListeners](ETH-1.md#rawlisteners) -- [removeAllListeners](ETH-1.md#removealllisteners) -- [removeListener](ETH-1.md#removelistener) - [sendMessage](ETH-1.md#sendmessage) - [sendStatus](ETH-1.md#sendstatus) -- [setMaxListeners](ETH-1.md#setmaxlisteners) -- [getEventListeners](ETH-1.md#geteventlisteners) -- [listenerCount](ETH-1.md#listenercount-1) -- [on](ETH-1.md#on-1) -- [once](ETH-1.md#once-1) -- [setMaxListeners](ETH-1.md#setmaxlisteners-1) ## Constructors @@ -78,7 +49,7 @@ | :------ | :------ | | `version` | `number` | | `peer` | [`Peer`](Peer.md) | -| `send` | `SendMethod` | +| `send` | [`SendMethod`](../README.md#sendmethod) | #### Overrides @@ -86,149 +57,51 @@ Protocol.constructor #### Defined in -[packages/devp2p/src/protocol/eth.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L29) +[packages/devp2p/src/protocol/eth.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L33) ## Properties -### DEBUG - -• **DEBUG**: `boolean` = `false` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L21) - -___ - -### \_forkHash - -• **\_forkHash**: `string` = `''` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L26) - -___ - -### \_hardfork - -• **\_hardfork**: `string` = `'chainstart'` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L24) - -___ - -### \_latestBlock - -• **\_latestBlock**: `bigint` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L25) - -___ - -### \_nextForkBlock - -• **\_nextForkBlock**: `bigint` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L27) - -___ - -### \_peerStatus - -• **\_peerStatus**: ``null`` \| [`StatusMsg`](../interfaces/ETH.StatusMsg.md) = `null` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L20) - -___ - -### \_status - -• **\_status**: ``null`` \| [`StatusMsg`](../interfaces/ETH.StatusMsg.md) = `null` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L19) - -___ - -### captureRejectionSymbol - -▪ `Static` `Readonly` **captureRejectionSymbol**: typeof [`captureRejectionSymbol`](DPT.md#capturerejectionsymbol) - -#### Inherited from - -Protocol.captureRejectionSymbol - -#### Defined in - -node_modules/@types/node/events.d.ts:291 - -___ - -### captureRejections - -▪ `Static` **captureRejections**: `boolean` - -Sets or gets the default captureRejection value for all emitters. - -#### Inherited from - -Protocol.captureRejections - -#### Defined in - -node_modules/@types/node/events.d.ts:296 - -___ - -### defaultMaxListeners +### eth62 -▪ `Static` **defaultMaxListeners**: `number` +▪ `Static` **eth62**: `Object` -#### Inherited from +#### Type declaration -Protocol.defaultMaxListeners +| Name | Type | +| :------ | :------ | +| `constructor` | typeof [`ETH`](ETH-1.md) | +| `length` | `number` | +| `name` | `string` | +| `version` | `number` | #### Defined in -node_modules/@types/node/events.d.ts:297 +[packages/devp2p/src/protocol/eth.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L52) ___ -### errorMonitor - -▪ `Static` `Readonly` **errorMonitor**: typeof [`errorMonitor`](DPT.md#errormonitor) - -This symbol shall be used to install a listener for only monitoring `'error'` -events. Listeners installed using this symbol are called before the regular -`'error'` listeners are called. +### eth63 -Installing a listener using this symbol does not change the behavior once an -`'error'` event is emitted, therefore the process will still crash if no -regular `'error'` listener is installed. +▪ `Static` **eth63**: `Object` -#### Inherited from +#### Type declaration -Protocol.errorMonitor +| Name | Type | +| :------ | :------ | +| `constructor` | typeof [`ETH`](ETH-1.md) | +| `length` | `number` | +| `name` | `string` | +| `version` | `number` | #### Defined in -node_modules/@types/node/events.d.ts:290 +[packages/devp2p/src/protocol/eth.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L53) ___ -### eth62 +### eth64 -▪ `Static` **eth62**: `Object` +▪ `Static` **eth64**: `Object` #### Type declaration @@ -241,13 +114,13 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L48) +[packages/devp2p/src/protocol/eth.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L54) ___ -### eth63 +### eth65 -▪ `Static` **eth63**: `Object` +▪ `Static` **eth65**: `Object` #### Type declaration @@ -260,13 +133,13 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L49) +[packages/devp2p/src/protocol/eth.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L55) ___ -### eth64 +### eth66 -▪ `Static` **eth64**: `Object` +▪ `Static` **eth66**: `Object` #### Type declaration @@ -279,13 +152,13 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L50) +[packages/devp2p/src/protocol/eth.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L56) ___ -### eth65 +### eth67 -▪ `Static` **eth65**: `Object` +▪ `Static` **eth67**: `Object` #### Type declaration @@ -298,13 +171,13 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L51) +[packages/devp2p/src/protocol/eth.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L57) ___ -### eth66 +### eth68 -▪ `Static` **eth66**: `Object` +▪ `Static` **eth68**: `Object` #### Type declaration @@ -317,7 +190,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L52) +[packages/devp2p/src/protocol/eth.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L58) ## Methods @@ -329,7 +202,7 @@ ___ | Name | Type | | :------ | :------ | -| `forkId` | `Buffer` | +| `forkId` | `Uint8Array` | #### Returns @@ -337,7 +210,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L217) +[packages/devp2p/src/protocol/eth.ts:236](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L236) ___ @@ -357,7 +230,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:225](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L225) +[packages/devp2p/src/protocol/eth.ts:244](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L244) ___ @@ -370,15 +243,19 @@ ___ | Name | Type | | :------ | :------ | | `code` | [`MESSAGE_CODES`](../enums/ETH.MESSAGE_CODES.md) | -| `data` | `any` | +| `data` | `Uint8Array` | #### Returns `void` +#### Overrides + +Protocol.\_handleMessage + #### Defined in -[packages/devp2p/src/protocol/eth.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L54) +[packages/devp2p/src/protocol/eth.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L60) ___ @@ -392,7 +269,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L162) +[packages/devp2p/src/protocol/eth.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L174) ___ @@ -404,7 +281,7 @@ ___ | Name | Type | | :------ | :------ | -| `forkId` | `Buffer` | +| `forkId` | `Uint8Array` | #### Returns @@ -412,7 +289,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:221](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L221) +[packages/devp2p/src/protocol/eth.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L240) ___ @@ -426,7 +303,7 @@ Eth 64 Fork ID validation (EIP-2124) | Name | Type | Description | | :------ | :------ | :------ | -| `forkId` | `Buffer`[] | Remote fork ID | +| `forkId` | `Uint8Array`[] | Remote fork ID | #### Returns @@ -434,168 +311,7 @@ Eth 64 Fork ID validation (EIP-2124) #### Defined in -[packages/devp2p/src/protocol/eth.ts:119](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L119) - -___ - -### addListener - -▸ **addListener**(`eventName`, `listener`): [`ETH`](ETH-1.md) - -Alias for `emitter.on(eventName, listener)`. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`ETH`](ETH-1.md) - -#### Inherited from - -Protocol.addListener - -#### Defined in - -node_modules/@types/node/events.d.ts:317 - -___ - -### emit - -▸ **emit**(`eventName`, ...`args`): `boolean` - -Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments -to each. - -Returns `true` if the event had listeners, `false` otherwise. - -```js -const EventEmitter = require('events'); -const myEmitter = new EventEmitter(); - -// First listener -myEmitter.on('event', function firstListener() { - console.log('Helloooo! first listener'); -}); -// Second listener -myEmitter.on('event', function secondListener(arg1, arg2) { - console.log(`event with parameters ${arg1}, ${arg2} in second listener`); -}); -// Third listener -myEmitter.on('event', function thirdListener(...args) { - const parameters = args.join(', '); - console.log(`event with parameters ${parameters} in third listener`); -}); - -console.log(myEmitter.listeners('event')); - -myEmitter.emit('event', 1, 2, 3, 4, 5); - -// Prints: -// [ -// [Function: firstListener], -// [Function: secondListener], -// [Function: thirdListener] -// ] -// Helloooo! first listener -// event with parameters 1, 2 in second listener -// event with parameters 1, 2, 3, 4, 5 in third listener -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `...args` | `any`[] | - -#### Returns - -`boolean` - -#### Inherited from - -Protocol.emit - -#### Defined in - -node_modules/@types/node/events.d.ts:573 - -___ - -### eventNames - -▸ **eventNames**(): (`string` \| `symbol`)[] - -Returns an array listing the events for which the emitter has registered -listeners. The values in the array are strings or `Symbol`s. - -```js -const EventEmitter = require('events'); -const myEE = new EventEmitter(); -myEE.on('foo', () => {}); -myEE.on('bar', () => {}); - -const sym = Symbol('symbol'); -myEE.on(sym, () => {}); - -console.log(myEE.eventNames()); -// Prints: [ 'foo', 'bar', Symbol(symbol) ] -``` - -**`Since`** - -v6.0.0 - -#### Returns - -(`string` \| `symbol`)[] - -#### Inherited from - -Protocol.eventNames - -#### Defined in - -node_modules/@types/node/events.d.ts:632 - -___ - -### getMaxListeners - -▸ **getMaxListeners**(): `number` - -Returns the current max listener value for the `EventEmitter` which is either -set by `emitter.setMaxListeners(n)` or defaults to [defaultMaxListeners](ETH-1.md#defaultmaxlisteners). - -**`Since`** - -v1.0.0 - -#### Returns - -`number` - -#### Inherited from - -Protocol.getMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:489 +[packages/devp2p/src/protocol/eth.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L131) ___ @@ -615,7 +331,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:347](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L347) +[packages/devp2p/src/protocol/eth.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L370) ___ @@ -629,923 +345,45 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L213) - -___ - -### listenerCount - -▸ **listenerCount**(`eventName`): `number` - -Returns the number of listeners listening to the event named `eventName`. - -**`Since`** - -v3.2.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event being listened for | - -#### Returns - -`number` - -#### Inherited from - -Protocol.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:579 +[packages/devp2p/src/protocol/eth.ts:232](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L232) ___ -### listeners - -▸ **listeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -console.log(util.inspect(server.listeners('connection'))); -// Prints: [ [Function] ] -``` - -**`Since`** +### sendMessage -v0.1.26 +▸ **sendMessage**(`code`, `payload`): `void` #### Parameters | Name | Type | | :------ | :------ | -| `eventName` | `string` \| `symbol` | +| `code` | [`MESSAGE_CODES`](../enums/ETH.MESSAGE_CODES.md) | +| `payload` | `Input` | #### Returns -`Function`[] - -#### Inherited from - -Protocol.listeners +`void` #### Defined in -node_modules/@types/node/events.d.ts:502 +[packages/devp2p/src/protocol/eth.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L315) ___ -### off - -▸ **off**(`eventName`, `listener`): [`ETH`](ETH-1.md) - -Alias for `emitter.removeListener()`. - -**`Since`** +### sendStatus -v10.0.0 +▸ **sendStatus**(`status`): `void` #### Parameters | Name | Type | | :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`ETH`](ETH-1.md) - -#### Inherited from - -Protocol.off - -#### Defined in - -node_modules/@types/node/events.d.ts:462 - -___ - -### on - -▸ **on**(`eventName`, `listener`): [`ETH`](ETH-1.md) - -Adds the `listener` function to the end of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.on('foo', () => console.log('a')); -myEE.prependListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.1.101 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`ETH`](ETH-1.md) - -#### Inherited from - -Protocol.on - -#### Defined in - -node_modules/@types/node/events.d.ts:348 - -___ - -### once - -▸ **once**(`eventName`, `listener`): [`ETH`](ETH-1.md) - -Adds a **one-time**`listener` function for the event named `eventName`. The -next time `eventName` is triggered, this listener is removed and then invoked. - -```js -server.once('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.once('foo', () => console.log('a')); -myEE.prependOnceListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.3.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`ETH`](ETH-1.md) - -#### Inherited from - -Protocol.once - -#### Defined in - -node_modules/@types/node/events.d.ts:377 - -___ - -### prependListener - -▸ **prependListener**(`eventName`, `listener`): [`ETH`](ETH-1.md) - -Adds the `listener` function to the _beginning_ of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.prependListener('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`ETH`](ETH-1.md) - -#### Inherited from - -Protocol.prependListener - -#### Defined in - -node_modules/@types/node/events.d.ts:597 - -___ - -### prependOnceListener - -▸ **prependOnceListener**(`eventName`, `listener`): [`ETH`](ETH-1.md) - -Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this -listener is removed, and then invoked. - -```js -server.prependOnceListener('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`ETH`](ETH-1.md) - -#### Inherited from - -Protocol.prependOnceListener - -#### Defined in - -node_modules/@types/node/events.d.ts:613 - -___ - -### rawListeners - -▸ **rawListeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`, -including any wrappers (such as those created by `.once()`). - -```js -const emitter = new EventEmitter(); -emitter.once('log', () => console.log('log once')); - -// Returns a new Array with a function `onceWrapper` which has a property -// `listener` which contains the original listener bound above -const listeners = emitter.rawListeners('log'); -const logFnWrapper = listeners[0]; - -// Logs "log once" to the console and does not unbind the `once` event -logFnWrapper.listener(); - -// Logs "log once" to the console and removes the listener -logFnWrapper(); - -emitter.on('log', () => console.log('log persistently')); -// Will return a new Array with a single function bound by `.on()` above -const newListeners = emitter.rawListeners('log'); - -// Logs "log persistently" twice -newListeners[0](); -emitter.emit('log'); -``` - -**`Since`** - -v9.4.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -Protocol.rawListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:532 - -___ - -### removeAllListeners - -▸ **removeAllListeners**(`event?`): [`ETH`](ETH-1.md) - -Removes all listeners, or those of the specified `eventName`. - -It is bad practice to remove listeners added elsewhere in the code, -particularly when the `EventEmitter` instance was created by some other -component or module (e.g. sockets or file streams). - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event?` | `string` \| `symbol` | - -#### Returns - -[`ETH`](ETH-1.md) - -#### Inherited from - -Protocol.removeAllListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:473 - -___ - -### removeListener - -▸ **removeListener**(`eventName`, `listener`): [`ETH`](ETH-1.md) - -Removes the specified `listener` from the listener array for the event named`eventName`. - -```js -const callback = (stream) => { - console.log('someone connected!'); -}; -server.on('connection', callback); -// ... -server.removeListener('connection', callback); -``` - -`removeListener()` will remove, at most, one instance of a listener from the -listener array. If any single listener has been added multiple times to the -listener array for the specified `eventName`, then `removeListener()` must be -called multiple times to remove each instance. - -Once an event is emitted, all listeners attached to it at the -time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will -not remove them from`emit()` in progress. Subsequent events behave as expected. - -```js -const myEmitter = new MyEmitter(); - -const callbackA = () => { - console.log('A'); - myEmitter.removeListener('event', callbackB); -}; - -const callbackB = () => { - console.log('B'); -}; - -myEmitter.on('event', callbackA); - -myEmitter.on('event', callbackB); - -// callbackA removes listener callbackB but it will still be called. -// Internal listener array at time of emit [callbackA, callbackB] -myEmitter.emit('event'); -// Prints: -// A -// B - -// callbackB is now removed. -// Internal listener array [callbackA] -myEmitter.emit('event'); -// Prints: -// A -``` - -Because listeners are managed using an internal array, calling this will -change the position indices of any listener registered _after_ the listener -being removed. This will not impact the order in which listeners are called, -but it means that any copies of the listener array as returned by -the `emitter.listeners()` method will need to be recreated. - -When a single function has been added as a handler multiple times for a single -event (as in the example below), `removeListener()` will remove the most -recently added instance. In the example the `once('ping')`listener is removed: - -```js -const ee = new EventEmitter(); - -function pong() { - console.log('pong'); -} - -ee.on('ping', pong); -ee.once('ping', pong); -ee.removeListener('ping', pong); - -ee.emit('ping'); -ee.emit('ping'); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`ETH`](ETH-1.md) - -#### Inherited from - -Protocol.removeListener - -#### Defined in - -node_modules/@types/node/events.d.ts:457 - -___ - -### sendMessage - -▸ **sendMessage**(`code`, `payload`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `code` | [`MESSAGE_CODES`](../enums/ETH.MESSAGE_CODES.md) | -| `payload` | `any` | - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:294](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L294) - -___ - -### sendStatus - -▸ **sendStatus**(`status`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `status` | [`StatusOpts`](../modules/ETH.md#statusopts) | - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/eth.ts:245](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L245) - -___ - -### setMaxListeners - -▸ **setMaxListeners**(`n`): [`ETH`](ETH-1.md) - -By default `EventEmitter`s will print a warning if more than `10` listeners are -added for a particular event. This is a useful default that helps finding -memory leaks. The `emitter.setMaxListeners()` method allows the limit to be -modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.3.5 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `n` | `number` | - -#### Returns - -[`ETH`](ETH-1.md) - -#### Inherited from - -Protocol.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:483 - -___ - -### getEventListeners - -▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -For `EventEmitter`s this behaves exactly the same as calling `.listeners` on -the emitter. - -For `EventTarget`s this is the only way to get the event listeners for the -event target. This is useful for debugging and diagnostic purposes. - -```js -const { getEventListeners, EventEmitter } = require('events'); - -{ - const ee = new EventEmitter(); - const listener = () => console.log('Events are fun'); - ee.on('foo', listener); - getEventListeners(ee, 'foo'); // [listener] -} -{ - const et = new EventTarget(); - const listener = () => console.log('Events are fun'); - et.addEventListener('foo', listener); - getEventListeners(et, 'foo'); // [listener] -} -``` - -**`Since`** - -v15.2.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `EventEmitter` \| `DOMEventTarget` | -| `name` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -Protocol.getEventListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:262 - -___ - -### listenerCount - -▸ `Static` **listenerCount**(`emitter`, `eventName`): `number` - -A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. - -```js -const { EventEmitter, listenerCount } = require('events'); -const myEmitter = new EventEmitter(); -myEmitter.on('event', () => {}); -myEmitter.on('event', () => {}); -console.log(listenerCount(myEmitter, 'event')); -// Prints: 2 -``` - -**`Since`** - -v0.9.12 - -**`Deprecated`** - -Since v3.2.0 - Use `listenerCount` instead. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | The emitter to query | -| `eventName` | `string` \| `symbol` | The event name | - -#### Returns - -`number` - -#### Inherited from - -Protocol.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:234 - -___ - -### on - -▸ `Static` **on**(`emitter`, `eventName`, `options?`): `AsyncIterableIterator`<`any`\> - -```js -const { on, EventEmitter } = require('events'); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo')) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); -``` - -Returns an `AsyncIterator` that iterates `eventName` events. It will throw -if the `EventEmitter` emits `'error'`. It removes all listeners when -exiting the loop. The `value` returned by each iteration is an array -composed of the emitted event arguments. - -An `AbortSignal` can be used to cancel waiting on events: - -```js -const { on, EventEmitter } = require('events'); -const ac = new AbortController(); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo', { signal: ac.signal })) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); - -process.nextTick(() => ac.abort()); -``` - -**`Since`** - -v13.6.0, v12.16.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | - | -| `eventName` | `string` | The name of the event being listened for | -| `options?` | `StaticEventEmitterOptions` | - | - -#### Returns - -`AsyncIterableIterator`<`any`\> - -that iterates `eventName` events emitted by the `emitter` - -#### Inherited from - -Protocol.on - -#### Defined in - -node_modules/@types/node/events.d.ts:217 - -___ - -### once - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given -event or that is rejected if the `EventEmitter` emits `'error'` while waiting. -The `Promise` will resolve with an array of all the arguments emitted to the -given event. - -This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event -semantics and does not listen to the `'error'` event. - -```js -const { once, EventEmitter } = require('events'); - -async function run() { - const ee = new EventEmitter(); - - process.nextTick(() => { - ee.emit('myevent', 42); - }); - - const [value] = await once(ee, 'myevent'); - console.log(value); - - const err = new Error('kaboom'); - process.nextTick(() => { - ee.emit('error', err); - }); - - try { - await once(ee, 'myevent'); - } catch (err) { - console.log('error happened', err); - } -} - -run(); -``` - -The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the -'`error'` event itself, then it is treated as any other kind of event without -special handling: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); - -once(ee, 'error') - .then(([err]) => console.log('ok', err.message)) - .catch((err) => console.log('error', err.message)); - -ee.emit('error', new Error('boom')); - -// Prints: ok boom -``` - -An `AbortSignal` can be used to cancel waiting for the event: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); -const ac = new AbortController(); - -async function foo(emitter, event, signal) { - try { - await once(emitter, event, { signal }); - console.log('event emitted!'); - } catch (error) { - if (error.name === 'AbortError') { - console.error('Waiting for the event was canceled!'); - } else { - console.error('There was an error', error.message); - } - } -} - -foo(ee, 'foo', ac.signal); -ac.abort(); // Abort waiting for the event -ee.emit('foo'); // Prints: Waiting for the event was canceled! -``` - -**`Since`** - -v11.13.0, v10.16.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `NodeEventTarget` | -| `eventName` | `string` \| `symbol` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -Protocol.once - -#### Defined in - -node_modules/@types/node/events.d.ts:157 - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `DOMEventTarget` | -| `eventName` | `string` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -Protocol.once - -#### Defined in - -node_modules/@types/node/events.d.ts:158 - -___ - -### setMaxListeners - -▸ `Static` **setMaxListeners**(`n?`, ...`eventTargets`): `void` - -```js -const { - setMaxListeners, - EventEmitter -} = require('events'); - -const target = new EventTarget(); -const emitter = new EventEmitter(); - -setMaxListeners(5, target, emitter); -``` - -**`Since`** - -v15.4.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `n?` | `number` | A non-negative number. The maximum number of listeners per `EventTarget` event. | -| `...eventTargets` | (`EventEmitter` \| `DOMEventTarget`)[] | - | +| `status` | [`StatusOpts`](../modules/ETH.md#statusopts) | #### Returns `void` -#### Inherited from - -Protocol.setMaxListeners - #### Defined in -node_modules/@types/node/events.d.ts:280 +[packages/devp2p/src/protocol/eth.ts:264](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L264) diff --git a/packages/devp2p/docs/classes/KBucket.md b/packages/devp2p/docs/classes/KBucket.md index fdea94de9f..883972d4b9 100644 --- a/packages/devp2p/docs/classes/KBucket.md +++ b/packages/devp2p/docs/classes/KBucket.md @@ -2,12 +2,6 @@ # Class: KBucket -## Hierarchy - -- `EventEmitter` - - ↳ **`KBucket`** - ## Table of contents ### Constructors @@ -16,41 +10,16 @@ ### Properties -- [\_kbucket](KBucket.md#_kbucket) -- [\_peers](KBucket.md#_peers) -- [captureRejectionSymbol](KBucket.md#capturerejectionsymbol) -- [captureRejections](KBucket.md#capturerejections) -- [defaultMaxListeners](KBucket.md#defaultmaxlisteners) -- [errorMonitor](KBucket.md#errormonitor) +- [events](KBucket.md#events) ### Methods - [add](KBucket.md#add) -- [addListener](KBucket.md#addlistener) - [closest](KBucket.md#closest) -- [emit](KBucket.md#emit) -- [eventNames](KBucket.md#eventnames) - [get](KBucket.md#get) - [getAll](KBucket.md#getall) -- [getMaxListeners](KBucket.md#getmaxlisteners) -- [listenerCount](KBucket.md#listenercount) -- [listeners](KBucket.md#listeners) -- [off](KBucket.md#off) -- [on](KBucket.md#on) -- [once](KBucket.md#once) -- [prependListener](KBucket.md#prependlistener) -- [prependOnceListener](KBucket.md#prependoncelistener) -- [rawListeners](KBucket.md#rawlisteners) - [remove](KBucket.md#remove) -- [removeAllListeners](KBucket.md#removealllisteners) -- [removeListener](KBucket.md#removelistener) -- [setMaxListeners](KBucket.md#setmaxlisteners) -- [getEventListeners](KBucket.md#geteventlisteners) - [getKeys](KBucket.md#getkeys) -- [listenerCount](KBucket.md#listenercount-1) -- [on](KBucket.md#on-1) -- [once](KBucket.md#once-1) -- [setMaxListeners](KBucket.md#setmaxlisteners-1) ## Constructors @@ -62,107 +31,27 @@ | Name | Type | | :------ | :------ | -| `localNodeId` | `Buffer` | - -#### Overrides - -EventEmitter.constructor - -#### Defined in - -[packages/devp2p/src/dpt/kbucket.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L17) - -## Properties - -### \_kbucket - -• **\_kbucket**: `KBucket`<`Contact`\> - -#### Defined in - -[packages/devp2p/src/dpt/kbucket.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L16) - -___ - -### \_peers - -• **\_peers**: `Map`<`string`, [`PeerInfo`](../interfaces/PeerInfo.md)\> +| `localNodeId` | `Uint8Array` | #### Defined in [packages/devp2p/src/dpt/kbucket.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L15) -___ - -### captureRejectionSymbol - -▪ `Static` `Readonly` **captureRejectionSymbol**: typeof [`captureRejectionSymbol`](DPT.md#capturerejectionsymbol) - -#### Inherited from - -EventEmitter.captureRejectionSymbol - -#### Defined in - -node_modules/@types/node/events.d.ts:291 - -___ - -### captureRejections - -▪ `Static` **captureRejections**: `boolean` - -Sets or gets the default captureRejection value for all emitters. - -#### Inherited from - -EventEmitter.captureRejections - -#### Defined in - -node_modules/@types/node/events.d.ts:296 - -___ - -### defaultMaxListeners - -▪ `Static` **defaultMaxListeners**: `number` - -#### Inherited from - -EventEmitter.defaultMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:297 - -___ - -### errorMonitor - -▪ `Static` `Readonly` **errorMonitor**: typeof [`errorMonitor`](DPT.md#errormonitor) - -This symbol shall be used to install a listener for only monitoring `'error'` -events. Listeners installed using this symbol are called before the regular -`'error'` listeners are called. - -Installing a listener using this symbol does not change the behavior once an -`'error'` event is emitted, therefore the process will still crash if no -regular `'error'` listener is installed. +## Properties -#### Inherited from +### events -EventEmitter.errorMonitor +• **events**: `EventEmitter` #### Defined in -node_modules/@types/node/events.d.ts:290 +[packages/devp2p/src/dpt/kbucket.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L12) ## Methods ### add -▸ **add**(`peer`): `void` +▸ **add**(`peer`): `void` \| `KBucket` #### Parameters @@ -172,42 +61,11 @@ node_modules/@types/node/events.d.ts:290 #### Returns -`void` - -#### Defined in - -[packages/devp2p/src/dpt/kbucket.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L56) - -___ - -### addListener - -▸ **addListener**(`eventName`, `listener`): [`KBucket`](KBucket.md) - -Alias for `emitter.on(eventName, listener)`. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`KBucket`](KBucket.md) - -#### Inherited from - -EventEmitter.addListener +`void` \| `KBucket` #### Defined in -node_modules/@types/node/events.d.ts:317 +[packages/devp2p/src/dpt/kbucket.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L53) ___ @@ -219,7 +77,7 @@ ___ | Name | Type | | :------ | :------ | -| `id` | `string` | +| `id` | `Uint8Array` | #### Returns @@ -227,112 +85,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/kbucket.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L74) - -___ - -### emit - -▸ **emit**(`eventName`, ...`args`): `boolean` - -Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments -to each. - -Returns `true` if the event had listeners, `false` otherwise. - -```js -const EventEmitter = require('events'); -const myEmitter = new EventEmitter(); - -// First listener -myEmitter.on('event', function firstListener() { - console.log('Helloooo! first listener'); -}); -// Second listener -myEmitter.on('event', function secondListener(arg1, arg2) { - console.log(`event with parameters ${arg1}, ${arg2} in second listener`); -}); -// Third listener -myEmitter.on('event', function thirdListener(...args) { - const parameters = args.join(', '); - console.log(`event with parameters ${parameters} in third listener`); -}); - -console.log(myEmitter.listeners('event')); - -myEmitter.emit('event', 1, 2, 3, 4, 5); - -// Prints: -// [ -// [Function: firstListener], -// [Function: secondListener], -// [Function: thirdListener] -// ] -// Helloooo! first listener -// event with parameters 1, 2 in second listener -// event with parameters 1, 2, 3, 4, 5 in third listener -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `...args` | `any`[] | - -#### Returns - -`boolean` - -#### Inherited from - -EventEmitter.emit - -#### Defined in - -node_modules/@types/node/events.d.ts:573 - -___ - -### eventNames - -▸ **eventNames**(): (`string` \| `symbol`)[] - -Returns an array listing the events for which the emitter has registered -listeners. The values in the array are strings or `Symbol`s. - -```js -const EventEmitter = require('events'); -const myEE = new EventEmitter(); -myEE.on('foo', () => {}); -myEE.on('bar', () => {}); - -const sym = Symbol('symbol'); -myEE.on(sym, () => {}); - -console.log(myEE.eventNames()); -// Prints: [ 'foo', 'bar', Symbol(symbol) ] -``` - -**`Since`** - -v6.0.0 - -#### Returns - -(`string` \| `symbol`)[] - -#### Inherited from - -EventEmitter.eventNames - -#### Defined in - -node_modules/@types/node/events.d.ts:632 +[packages/devp2p/src/dpt/kbucket.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L71) ___ @@ -344,7 +97,7 @@ ___ | Name | Type | | :------ | :------ | -| `obj` | `string` \| `Buffer` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | #### Returns @@ -352,7 +105,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/kbucket.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L61) +[packages/devp2p/src/dpt/kbucket.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L58) ___ @@ -366,639 +119,39 @@ ___ #### Defined in -[packages/devp2p/src/dpt/kbucket.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L70) - -___ - -### getMaxListeners - -▸ **getMaxListeners**(): `number` - -Returns the current max listener value for the `EventEmitter` which is either -set by `emitter.setMaxListeners(n)` or defaults to [defaultMaxListeners](KBucket.md#defaultmaxlisteners). - -**`Since`** - -v1.0.0 - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.getMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:489 - -___ - -### listenerCount - -▸ **listenerCount**(`eventName`): `number` - -Returns the number of listeners listening to the event named `eventName`. - -**`Since`** - -v3.2.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event being listened for | - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:579 +[packages/devp2p/src/dpt/kbucket.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L67) ___ -### listeners - -▸ **listeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -console.log(util.inspect(server.listeners('connection'))); -// Prints: [ [Function] ] -``` - -**`Since`** +### remove -v0.1.26 +▸ **remove**(`obj`): `void` #### Parameters | Name | Type | | :------ | :------ | -| `eventName` | `string` \| `symbol` | +| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | #### Returns -`Function`[] - -#### Inherited from - -EventEmitter.listeners +`void` #### Defined in -node_modules/@types/node/events.d.ts:502 +[packages/devp2p/src/dpt/kbucket.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L75) ___ -### off - -▸ **off**(`eventName`, `listener`): [`KBucket`](KBucket.md) - -Alias for `emitter.removeListener()`. - -**`Since`** +### getKeys -v10.0.0 +▸ `Static` **getKeys**(`obj`): `string`[] #### Parameters | Name | Type | | :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`KBucket`](KBucket.md) - -#### Inherited from - -EventEmitter.off - -#### Defined in - -node_modules/@types/node/events.d.ts:462 - -___ - -### on - -▸ **on**(`eventName`, `listener`): [`KBucket`](KBucket.md) - -Adds the `listener` function to the end of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.on('foo', () => console.log('a')); -myEE.prependListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.1.101 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`KBucket`](KBucket.md) - -#### Inherited from - -EventEmitter.on - -#### Defined in - -node_modules/@types/node/events.d.ts:348 - -___ - -### once - -▸ **once**(`eventName`, `listener`): [`KBucket`](KBucket.md) - -Adds a **one-time**`listener` function for the event named `eventName`. The -next time `eventName` is triggered, this listener is removed and then invoked. - -```js -server.once('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.once('foo', () => console.log('a')); -myEE.prependOnceListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.3.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`KBucket`](KBucket.md) - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:377 - -___ - -### prependListener - -▸ **prependListener**(`eventName`, `listener`): [`KBucket`](KBucket.md) - -Adds the `listener` function to the _beginning_ of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.prependListener('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`KBucket`](KBucket.md) - -#### Inherited from - -EventEmitter.prependListener - -#### Defined in - -node_modules/@types/node/events.d.ts:597 - -___ - -### prependOnceListener - -▸ **prependOnceListener**(`eventName`, `listener`): [`KBucket`](KBucket.md) - -Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this -listener is removed, and then invoked. - -```js -server.prependOnceListener('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`KBucket`](KBucket.md) - -#### Inherited from - -EventEmitter.prependOnceListener - -#### Defined in - -node_modules/@types/node/events.d.ts:613 - -___ - -### rawListeners - -▸ **rawListeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`, -including any wrappers (such as those created by `.once()`). - -```js -const emitter = new EventEmitter(); -emitter.once('log', () => console.log('log once')); - -// Returns a new Array with a function `onceWrapper` which has a property -// `listener` which contains the original listener bound above -const listeners = emitter.rawListeners('log'); -const logFnWrapper = listeners[0]; - -// Logs "log once" to the console and does not unbind the `once` event -logFnWrapper.listener(); - -// Logs "log once" to the console and removes the listener -logFnWrapper(); - -emitter.on('log', () => console.log('log persistently')); -// Will return a new Array with a single function bound by `.on()` above -const newListeners = emitter.rawListeners('log'); - -// Logs "log persistently" twice -newListeners[0](); -emitter.emit('log'); -``` - -**`Since`** - -v9.4.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.rawListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:532 - -___ - -### remove - -▸ **remove**(`obj`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `obj` | `string` \| `Buffer` \| [`PeerInfo`](../interfaces/PeerInfo.md) | - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/dpt/kbucket.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L78) - -___ - -### removeAllListeners - -▸ **removeAllListeners**(`event?`): [`KBucket`](KBucket.md) - -Removes all listeners, or those of the specified `eventName`. - -It is bad practice to remove listeners added elsewhere in the code, -particularly when the `EventEmitter` instance was created by some other -component or module (e.g. sockets or file streams). - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event?` | `string` \| `symbol` | - -#### Returns - -[`KBucket`](KBucket.md) - -#### Inherited from - -EventEmitter.removeAllListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:473 - -___ - -### removeListener - -▸ **removeListener**(`eventName`, `listener`): [`KBucket`](KBucket.md) - -Removes the specified `listener` from the listener array for the event named`eventName`. - -```js -const callback = (stream) => { - console.log('someone connected!'); -}; -server.on('connection', callback); -// ... -server.removeListener('connection', callback); -``` - -`removeListener()` will remove, at most, one instance of a listener from the -listener array. If any single listener has been added multiple times to the -listener array for the specified `eventName`, then `removeListener()` must be -called multiple times to remove each instance. - -Once an event is emitted, all listeners attached to it at the -time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will -not remove them from`emit()` in progress. Subsequent events behave as expected. - -```js -const myEmitter = new MyEmitter(); - -const callbackA = () => { - console.log('A'); - myEmitter.removeListener('event', callbackB); -}; - -const callbackB = () => { - console.log('B'); -}; - -myEmitter.on('event', callbackA); - -myEmitter.on('event', callbackB); - -// callbackA removes listener callbackB but it will still be called. -// Internal listener array at time of emit [callbackA, callbackB] -myEmitter.emit('event'); -// Prints: -// A -// B - -// callbackB is now removed. -// Internal listener array [callbackA] -myEmitter.emit('event'); -// Prints: -// A -``` - -Because listeners are managed using an internal array, calling this will -change the position indices of any listener registered _after_ the listener -being removed. This will not impact the order in which listeners are called, -but it means that any copies of the listener array as returned by -the `emitter.listeners()` method will need to be recreated. - -When a single function has been added as a handler multiple times for a single -event (as in the example below), `removeListener()` will remove the most -recently added instance. In the example the `once('ping')`listener is removed: - -```js -const ee = new EventEmitter(); - -function pong() { - console.log('pong'); -} - -ee.on('ping', pong); -ee.once('ping', pong); -ee.removeListener('ping', pong); - -ee.emit('ping'); -ee.emit('ping'); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`KBucket`](KBucket.md) - -#### Inherited from - -EventEmitter.removeListener - -#### Defined in - -node_modules/@types/node/events.d.ts:457 - -___ - -### setMaxListeners - -▸ **setMaxListeners**(`n`): [`KBucket`](KBucket.md) - -By default `EventEmitter`s will print a warning if more than `10` listeners are -added for a particular event. This is a useful default that helps finding -memory leaks. The `emitter.setMaxListeners()` method allows the limit to be -modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.3.5 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `n` | `number` | - -#### Returns - -[`KBucket`](KBucket.md) - -#### Inherited from - -EventEmitter.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:483 - -___ - -### getEventListeners - -▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -For `EventEmitter`s this behaves exactly the same as calling `.listeners` on -the emitter. - -For `EventTarget`s this is the only way to get the event listeners for the -event target. This is useful for debugging and diagnostic purposes. - -```js -const { getEventListeners, EventEmitter } = require('events'); - -{ - const ee = new EventEmitter(); - const listener = () => console.log('Events are fun'); - ee.on('foo', listener); - getEventListeners(ee, 'foo'); // [listener] -} -{ - const et = new EventTarget(); - const listener = () => console.log('Events are fun'); - et.addEventListener('foo', listener); - getEventListeners(et, 'foo'); // [listener] -} -``` - -**`Since`** - -v15.2.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `EventEmitter` \| `DOMEventTarget` | -| `name` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.getEventListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:262 - -___ - -### getKeys - -▸ `Static` **getKeys**(`obj`): `string`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `obj` | `string` \| `Buffer` \| [`PeerInfo`](../interfaces/PeerInfo.md) | +| `obj` | `string` \| `Uint8Array` \| [`PeerInfo`](../interfaces/PeerInfo.md) | #### Returns @@ -1006,307 +159,4 @@ ___ #### Defined in -[packages/devp2p/src/dpt/kbucket.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L45) - -___ - -### listenerCount - -▸ `Static` **listenerCount**(`emitter`, `eventName`): `number` - -A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. - -```js -const { EventEmitter, listenerCount } = require('events'); -const myEmitter = new EventEmitter(); -myEmitter.on('event', () => {}); -myEmitter.on('event', () => {}); -console.log(listenerCount(myEmitter, 'event')); -// Prints: 2 -``` - -**`Since`** - -v0.9.12 - -**`Deprecated`** - -Since v3.2.0 - Use `listenerCount` instead. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | The emitter to query | -| `eventName` | `string` \| `symbol` | The event name | - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:234 - -___ - -### on - -▸ `Static` **on**(`emitter`, `eventName`, `options?`): `AsyncIterableIterator`<`any`\> - -```js -const { on, EventEmitter } = require('events'); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo')) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); -``` - -Returns an `AsyncIterator` that iterates `eventName` events. It will throw -if the `EventEmitter` emits `'error'`. It removes all listeners when -exiting the loop. The `value` returned by each iteration is an array -composed of the emitted event arguments. - -An `AbortSignal` can be used to cancel waiting on events: - -```js -const { on, EventEmitter } = require('events'); -const ac = new AbortController(); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo', { signal: ac.signal })) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); - -process.nextTick(() => ac.abort()); -``` - -**`Since`** - -v13.6.0, v12.16.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | - | -| `eventName` | `string` | The name of the event being listened for | -| `options?` | `StaticEventEmitterOptions` | - | - -#### Returns - -`AsyncIterableIterator`<`any`\> - -that iterates `eventName` events emitted by the `emitter` - -#### Inherited from - -EventEmitter.on - -#### Defined in - -node_modules/@types/node/events.d.ts:217 - -___ - -### once - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given -event or that is rejected if the `EventEmitter` emits `'error'` while waiting. -The `Promise` will resolve with an array of all the arguments emitted to the -given event. - -This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event -semantics and does not listen to the `'error'` event. - -```js -const { once, EventEmitter } = require('events'); - -async function run() { - const ee = new EventEmitter(); - - process.nextTick(() => { - ee.emit('myevent', 42); - }); - - const [value] = await once(ee, 'myevent'); - console.log(value); - - const err = new Error('kaboom'); - process.nextTick(() => { - ee.emit('error', err); - }); - - try { - await once(ee, 'myevent'); - } catch (err) { - console.log('error happened', err); - } -} - -run(); -``` - -The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the -'`error'` event itself, then it is treated as any other kind of event without -special handling: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); - -once(ee, 'error') - .then(([err]) => console.log('ok', err.message)) - .catch((err) => console.log('error', err.message)); - -ee.emit('error', new Error('boom')); - -// Prints: ok boom -``` - -An `AbortSignal` can be used to cancel waiting for the event: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); -const ac = new AbortController(); - -async function foo(emitter, event, signal) { - try { - await once(emitter, event, { signal }); - console.log('event emitted!'); - } catch (error) { - if (error.name === 'AbortError') { - console.error('Waiting for the event was canceled!'); - } else { - console.error('There was an error', error.message); - } - } -} - -foo(ee, 'foo', ac.signal); -ac.abort(); // Abort waiting for the event -ee.emit('foo'); // Prints: Waiting for the event was canceled! -``` - -**`Since`** - -v11.13.0, v10.16.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `NodeEventTarget` | -| `eventName` | `string` \| `symbol` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:157 - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `DOMEventTarget` | -| `eventName` | `string` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:158 - -___ - -### setMaxListeners - -▸ `Static` **setMaxListeners**(`n?`, ...`eventTargets`): `void` - -```js -const { - setMaxListeners, - EventEmitter -} = require('events'); - -const target = new EventTarget(); -const emitter = new EventEmitter(); - -setMaxListeners(5, target, emitter); -``` - -**`Since`** - -v15.4.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `n?` | `number` | A non-negative number. The maximum number of listeners per `EventTarget` event. | -| `...eventTargets` | (`EventEmitter` \| `DOMEventTarget`)[] | - | - -#### Returns - -`void` - -#### Inherited from - -EventEmitter.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:280 +[packages/devp2p/src/dpt/kbucket.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L42) diff --git a/packages/devp2p/docs/classes/LES-1.md b/packages/devp2p/docs/classes/LES-1.md index 66a8432187..8894d687e9 100644 --- a/packages/devp2p/docs/classes/LES-1.md +++ b/packages/devp2p/docs/classes/LES-1.md @@ -16,12 +16,6 @@ ### Properties -- [\_peerStatus](LES-1.md#_peerstatus) -- [\_status](LES-1.md#_status) -- [captureRejectionSymbol](LES-1.md#capturerejectionsymbol) -- [captureRejections](LES-1.md#capturerejections) -- [defaultMaxListeners](LES-1.md#defaultmaxlisteners) -- [errorMonitor](LES-1.md#errormonitor) - [les2](LES-1.md#les2) - [les3](LES-1.md#les3) - [les4](LES-1.md#les4) @@ -31,30 +25,10 @@ - [\_getStatusString](LES-1.md#_getstatusstring) - [\_handleMessage](LES-1.md#_handlemessage) - [\_handleStatus](LES-1.md#_handlestatus) -- [addListener](LES-1.md#addlistener) -- [emit](LES-1.md#emit) -- [eventNames](LES-1.md#eventnames) -- [getMaxListeners](LES-1.md#getmaxlisteners) - [getMsgPrefix](LES-1.md#getmsgprefix) - [getVersion](LES-1.md#getversion) -- [listenerCount](LES-1.md#listenercount) -- [listeners](LES-1.md#listeners) -- [off](LES-1.md#off) -- [on](LES-1.md#on) -- [once](LES-1.md#once) -- [prependListener](LES-1.md#prependlistener) -- [prependOnceListener](LES-1.md#prependoncelistener) -- [rawListeners](LES-1.md#rawlisteners) -- [removeAllListeners](LES-1.md#removealllisteners) -- [removeListener](LES-1.md#removelistener) - [sendMessage](LES-1.md#sendmessage) - [sendStatus](LES-1.md#sendstatus) -- [setMaxListeners](LES-1.md#setmaxlisteners) -- [getEventListeners](LES-1.md#geteventlisteners) -- [listenerCount](LES-1.md#listenercount-1) -- [on](LES-1.md#on-1) -- [once](LES-1.md#once-1) -- [setMaxListeners](LES-1.md#setmaxlisteners-1) ## Constructors @@ -68,7 +42,7 @@ | :------ | :------ | | `version` | `number` | | `peer` | [`Peer`](Peer.md) | -| `send` | `SendMethod` | +| `send` | [`SendMethod`](../README.md#sendmethod) | #### Overrides @@ -76,96 +50,10 @@ Protocol.constructor #### Defined in -[packages/devp2p/src/protocol/les.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L20) +[packages/devp2p/src/protocol/les.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L27) ## Properties -### \_peerStatus - -• **\_peerStatus**: ``null`` \| [`Status`](../interfaces/LES.Status.md) = `null` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L18) - -___ - -### \_status - -• **\_status**: ``null`` \| [`Status`](../interfaces/LES.Status.md) = `null` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L17) - -___ - -### captureRejectionSymbol - -▪ `Static` `Readonly` **captureRejectionSymbol**: typeof [`captureRejectionSymbol`](DPT.md#capturerejectionsymbol) - -#### Inherited from - -Protocol.captureRejectionSymbol - -#### Defined in - -node_modules/@types/node/events.d.ts:291 - -___ - -### captureRejections - -▪ `Static` **captureRejections**: `boolean` - -Sets or gets the default captureRejection value for all emitters. - -#### Inherited from - -Protocol.captureRejections - -#### Defined in - -node_modules/@types/node/events.d.ts:296 - -___ - -### defaultMaxListeners - -▪ `Static` **defaultMaxListeners**: `number` - -#### Inherited from - -Protocol.defaultMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:297 - -___ - -### errorMonitor - -▪ `Static` `Readonly` **errorMonitor**: typeof [`errorMonitor`](DPT.md#errormonitor) - -This symbol shall be used to install a listener for only monitoring `'error'` -events. Listeners installed using this symbol are called before the regular -`'error'` listeners are called. - -Installing a listener using this symbol does not change the behavior once an -`'error'` event is emitted, therefore the process will still crash if no -regular `'error'` listener is installed. - -#### Inherited from - -Protocol.errorMonitor - -#### Defined in - -node_modules/@types/node/events.d.ts:290 - -___ - ### les2 ▪ `Static` **les2**: `Object` @@ -181,7 +69,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L28) +[packages/devp2p/src/protocol/les.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L35) ___ @@ -200,7 +88,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L29) +[packages/devp2p/src/protocol/les.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L36) ___ @@ -219,7 +107,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L30) +[packages/devp2p/src/protocol/les.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L37) ## Methods @@ -239,7 +127,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L132) +[packages/devp2p/src/protocol/les.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L149) ___ @@ -252,15 +140,19 @@ ___ | Name | Type | | :------ | :------ | | `code` | [`MESSAGE_CODES`](../enums/LES.MESSAGE_CODES.md) | -| `data` | `any` | +| `data` | `Uint8Array` | #### Returns `void` +#### Overrides + +Protocol.\_handleMessage + #### Defined in -[packages/devp2p/src/protocol/les.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L32) +[packages/devp2p/src/protocol/les.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L39) ___ @@ -274,168 +166,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L97) - -___ - -### addListener - -▸ **addListener**(`eventName`, `listener`): [`LES`](LES-1.md) - -Alias for `emitter.on(eventName, listener)`. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`LES`](LES-1.md) - -#### Inherited from - -Protocol.addListener - -#### Defined in - -node_modules/@types/node/events.d.ts:317 - -___ - -### emit - -▸ **emit**(`eventName`, ...`args`): `boolean` - -Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments -to each. - -Returns `true` if the event had listeners, `false` otherwise. - -```js -const EventEmitter = require('events'); -const myEmitter = new EventEmitter(); - -// First listener -myEmitter.on('event', function firstListener() { - console.log('Helloooo! first listener'); -}); -// Second listener -myEmitter.on('event', function secondListener(arg1, arg2) { - console.log(`event with parameters ${arg1}, ${arg2} in second listener`); -}); -// Third listener -myEmitter.on('event', function thirdListener(...args) { - const parameters = args.join(', '); - console.log(`event with parameters ${parameters} in third listener`); -}); - -console.log(myEmitter.listeners('event')); - -myEmitter.emit('event', 1, 2, 3, 4, 5); - -// Prints: -// [ -// [Function: firstListener], -// [Function: secondListener], -// [Function: thirdListener] -// ] -// Helloooo! first listener -// event with parameters 1, 2 in second listener -// event with parameters 1, 2, 3, 4, 5 in third listener -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `...args` | `any`[] | - -#### Returns - -`boolean` - -#### Inherited from - -Protocol.emit - -#### Defined in - -node_modules/@types/node/events.d.ts:573 - -___ - -### eventNames - -▸ **eventNames**(): (`string` \| `symbol`)[] - -Returns an array listing the events for which the emitter has registered -listeners. The values in the array are strings or `Symbol`s. - -```js -const EventEmitter = require('events'); -const myEE = new EventEmitter(); -myEE.on('foo', () => {}); -myEE.on('bar', () => {}); - -const sym = Symbol('symbol'); -myEE.on(sym, () => {}); - -console.log(myEE.eventNames()); -// Prints: [ 'foo', 'bar', Symbol(symbol) ] -``` - -**`Since`** - -v6.0.0 - -#### Returns - -(`string` \| `symbol`)[] - -#### Inherited from - -Protocol.eventNames - -#### Defined in - -node_modules/@types/node/events.d.ts:632 - -___ - -### getMaxListeners - -▸ **getMaxListeners**(): `number` - -Returns the current max listener value for the `EventEmitter` which is either -set by `emitter.setMaxListeners(n)` or defaults to [defaultMaxListeners](LES-1.md#defaultmaxlisteners). - -**`Since`** - -v1.0.0 - -#### Returns - -`number` - -#### Inherited from - -Protocol.getMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:489 +[packages/devp2p/src/protocol/les.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L114) ___ @@ -455,7 +186,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:254](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L254) +[packages/devp2p/src/protocol/les.ts:275](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L275) ___ @@ -469,506 +200,40 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L128) +[packages/devp2p/src/protocol/les.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L145) ___ -### listenerCount - -▸ **listenerCount**(`eventName`): `number` - -Returns the number of listeners listening to the event named `eventName`. - -**`Since`** +### sendMessage -v3.2.0 +▸ **sendMessage**(`code`, `payload`): `void` #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event being listened for | - -#### Returns - -`number` - -#### Inherited from - -Protocol.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:579 - -___ - -### listeners - -▸ **listeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -console.log(util.inspect(server.listeners('connection'))); -// Prints: [ [Function] ] -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | +| `code` | [`MESSAGE_CODES`](../enums/LES.MESSAGE_CODES.md) | Message code | +| `payload` | `Input` | Payload (including reqId, e.g. `[1, [437000, 1, 0, 0]]`) | #### Returns -`Function`[] - -#### Inherited from - -Protocol.listeners +`void` #### Defined in -node_modules/@types/node/events.d.ts:502 +[packages/devp2p/src/protocol/les.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L217) ___ -### off - -▸ **off**(`eventName`, `listener`): [`LES`](LES-1.md) - -Alias for `emitter.removeListener()`. - -**`Since`** +### sendStatus -v10.0.0 +▸ **sendStatus**(`status`): `void` #### Parameters | Name | Type | | :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`LES`](LES-1.md) - -#### Inherited from - -Protocol.off - -#### Defined in - -node_modules/@types/node/events.d.ts:462 - -___ - -### on - -▸ **on**(`eventName`, `listener`): [`LES`](LES-1.md) - -Adds the `listener` function to the end of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.on('foo', () => console.log('a')); -myEE.prependListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.1.101 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`LES`](LES-1.md) - -#### Inherited from - -Protocol.on - -#### Defined in - -node_modules/@types/node/events.d.ts:348 - -___ - -### once - -▸ **once**(`eventName`, `listener`): [`LES`](LES-1.md) - -Adds a **one-time**`listener` function for the event named `eventName`. The -next time `eventName` is triggered, this listener is removed and then invoked. - -```js -server.once('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.once('foo', () => console.log('a')); -myEE.prependOnceListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.3.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`LES`](LES-1.md) - -#### Inherited from - -Protocol.once - -#### Defined in - -node_modules/@types/node/events.d.ts:377 - -___ - -### prependListener - -▸ **prependListener**(`eventName`, `listener`): [`LES`](LES-1.md) - -Adds the `listener` function to the _beginning_ of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.prependListener('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`LES`](LES-1.md) - -#### Inherited from - -Protocol.prependListener - -#### Defined in - -node_modules/@types/node/events.d.ts:597 - -___ - -### prependOnceListener - -▸ **prependOnceListener**(`eventName`, `listener`): [`LES`](LES-1.md) - -Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this -listener is removed, and then invoked. - -```js -server.prependOnceListener('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`LES`](LES-1.md) - -#### Inherited from - -Protocol.prependOnceListener - -#### Defined in - -node_modules/@types/node/events.d.ts:613 - -___ - -### rawListeners - -▸ **rawListeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`, -including any wrappers (such as those created by `.once()`). - -```js -const emitter = new EventEmitter(); -emitter.once('log', () => console.log('log once')); - -// Returns a new Array with a function `onceWrapper` which has a property -// `listener` which contains the original listener bound above -const listeners = emitter.rawListeners('log'); -const logFnWrapper = listeners[0]; - -// Logs "log once" to the console and does not unbind the `once` event -logFnWrapper.listener(); - -// Logs "log once" to the console and removes the listener -logFnWrapper(); - -emitter.on('log', () => console.log('log persistently')); -// Will return a new Array with a single function bound by `.on()` above -const newListeners = emitter.rawListeners('log'); - -// Logs "log persistently" twice -newListeners[0](); -emitter.emit('log'); -``` - -**`Since`** - -v9.4.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -Protocol.rawListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:532 - -___ - -### removeAllListeners - -▸ **removeAllListeners**(`event?`): [`LES`](LES-1.md) - -Removes all listeners, or those of the specified `eventName`. - -It is bad practice to remove listeners added elsewhere in the code, -particularly when the `EventEmitter` instance was created by some other -component or module (e.g. sockets or file streams). - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event?` | `string` \| `symbol` | - -#### Returns - -[`LES`](LES-1.md) - -#### Inherited from - -Protocol.removeAllListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:473 - -___ - -### removeListener - -▸ **removeListener**(`eventName`, `listener`): [`LES`](LES-1.md) - -Removes the specified `listener` from the listener array for the event named`eventName`. - -```js -const callback = (stream) => { - console.log('someone connected!'); -}; -server.on('connection', callback); -// ... -server.removeListener('connection', callback); -``` - -`removeListener()` will remove, at most, one instance of a listener from the -listener array. If any single listener has been added multiple times to the -listener array for the specified `eventName`, then `removeListener()` must be -called multiple times to remove each instance. - -Once an event is emitted, all listeners attached to it at the -time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will -not remove them from`emit()` in progress. Subsequent events behave as expected. - -```js -const myEmitter = new MyEmitter(); - -const callbackA = () => { - console.log('A'); - myEmitter.removeListener('event', callbackB); -}; - -const callbackB = () => { - console.log('B'); -}; - -myEmitter.on('event', callbackA); - -myEmitter.on('event', callbackB); - -// callbackA removes listener callbackB but it will still be called. -// Internal listener array at time of emit [callbackA, callbackB] -myEmitter.emit('event'); -// Prints: -// A -// B - -// callbackB is now removed. -// Internal listener array [callbackA] -myEmitter.emit('event'); -// Prints: -// A -``` - -Because listeners are managed using an internal array, calling this will -change the position indices of any listener registered _after_ the listener -being removed. This will not impact the order in which listeners are called, -but it means that any copies of the listener array as returned by -the `emitter.listeners()` method will need to be recreated. - -When a single function has been added as a handler multiple times for a single -event (as in the example below), `removeListener()` will remove the most -recently added instance. In the example the `once('ping')`listener is removed: - -```js -const ee = new EventEmitter(); - -function pong() { - console.log('pong'); -} - -ee.on('ping', pong); -ee.once('ping', pong); -ee.removeListener('ping', pong); - -ee.emit('ping'); -ee.emit('ping'); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`LES`](LES-1.md) - -#### Inherited from - -Protocol.removeListener - -#### Defined in - -node_modules/@types/node/events.d.ts:457 - -___ - -### sendMessage - -▸ **sendMessage**(`code`, `payload`): `void` - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `code` | [`MESSAGE_CODES`](../enums/LES.MESSAGE_CODES.md) | Message code | -| `payload` | `any` | Payload (including reqId, e.g. `[1, [437000, 1, 0, 0]]`) | +| `status` | [`Status`](../interfaces/LES.Status.md) | #### Returns @@ -976,416 +241,4 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L197) - -___ - -### sendStatus - -▸ **sendStatus**(`status`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `status` | [`Status`](../interfaces/LES.Status.md) | - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/les.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L158) - -___ - -### setMaxListeners - -▸ **setMaxListeners**(`n`): [`LES`](LES-1.md) - -By default `EventEmitter`s will print a warning if more than `10` listeners are -added for a particular event. This is a useful default that helps finding -memory leaks. The `emitter.setMaxListeners()` method allows the limit to be -modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.3.5 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `n` | `number` | - -#### Returns - -[`LES`](LES-1.md) - -#### Inherited from - -Protocol.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:483 - -___ - -### getEventListeners - -▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -For `EventEmitter`s this behaves exactly the same as calling `.listeners` on -the emitter. - -For `EventTarget`s this is the only way to get the event listeners for the -event target. This is useful for debugging and diagnostic purposes. - -```js -const { getEventListeners, EventEmitter } = require('events'); - -{ - const ee = new EventEmitter(); - const listener = () => console.log('Events are fun'); - ee.on('foo', listener); - getEventListeners(ee, 'foo'); // [listener] -} -{ - const et = new EventTarget(); - const listener = () => console.log('Events are fun'); - et.addEventListener('foo', listener); - getEventListeners(et, 'foo'); // [listener] -} -``` - -**`Since`** - -v15.2.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `EventEmitter` \| `DOMEventTarget` | -| `name` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -Protocol.getEventListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:262 - -___ - -### listenerCount - -▸ `Static` **listenerCount**(`emitter`, `eventName`): `number` - -A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. - -```js -const { EventEmitter, listenerCount } = require('events'); -const myEmitter = new EventEmitter(); -myEmitter.on('event', () => {}); -myEmitter.on('event', () => {}); -console.log(listenerCount(myEmitter, 'event')); -// Prints: 2 -``` - -**`Since`** - -v0.9.12 - -**`Deprecated`** - -Since v3.2.0 - Use `listenerCount` instead. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | The emitter to query | -| `eventName` | `string` \| `symbol` | The event name | - -#### Returns - -`number` - -#### Inherited from - -Protocol.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:234 - -___ - -### on - -▸ `Static` **on**(`emitter`, `eventName`, `options?`): `AsyncIterableIterator`<`any`\> - -```js -const { on, EventEmitter } = require('events'); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo')) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); -``` - -Returns an `AsyncIterator` that iterates `eventName` events. It will throw -if the `EventEmitter` emits `'error'`. It removes all listeners when -exiting the loop. The `value` returned by each iteration is an array -composed of the emitted event arguments. - -An `AbortSignal` can be used to cancel waiting on events: - -```js -const { on, EventEmitter } = require('events'); -const ac = new AbortController(); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo', { signal: ac.signal })) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); - -process.nextTick(() => ac.abort()); -``` - -**`Since`** - -v13.6.0, v12.16.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | - | -| `eventName` | `string` | The name of the event being listened for | -| `options?` | `StaticEventEmitterOptions` | - | - -#### Returns - -`AsyncIterableIterator`<`any`\> - -that iterates `eventName` events emitted by the `emitter` - -#### Inherited from - -Protocol.on - -#### Defined in - -node_modules/@types/node/events.d.ts:217 - -___ - -### once - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given -event or that is rejected if the `EventEmitter` emits `'error'` while waiting. -The `Promise` will resolve with an array of all the arguments emitted to the -given event. - -This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event -semantics and does not listen to the `'error'` event. - -```js -const { once, EventEmitter } = require('events'); - -async function run() { - const ee = new EventEmitter(); - - process.nextTick(() => { - ee.emit('myevent', 42); - }); - - const [value] = await once(ee, 'myevent'); - console.log(value); - - const err = new Error('kaboom'); - process.nextTick(() => { - ee.emit('error', err); - }); - - try { - await once(ee, 'myevent'); - } catch (err) { - console.log('error happened', err); - } -} - -run(); -``` - -The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the -'`error'` event itself, then it is treated as any other kind of event without -special handling: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); - -once(ee, 'error') - .then(([err]) => console.log('ok', err.message)) - .catch((err) => console.log('error', err.message)); - -ee.emit('error', new Error('boom')); - -// Prints: ok boom -``` - -An `AbortSignal` can be used to cancel waiting for the event: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); -const ac = new AbortController(); - -async function foo(emitter, event, signal) { - try { - await once(emitter, event, { signal }); - console.log('event emitted!'); - } catch (error) { - if (error.name === 'AbortError') { - console.error('Waiting for the event was canceled!'); - } else { - console.error('There was an error', error.message); - } - } -} - -foo(ee, 'foo', ac.signal); -ac.abort(); // Abort waiting for the event -ee.emit('foo'); // Prints: Waiting for the event was canceled! -``` - -**`Since`** - -v11.13.0, v10.16.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `NodeEventTarget` | -| `eventName` | `string` \| `symbol` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -Protocol.once - -#### Defined in - -node_modules/@types/node/events.d.ts:157 - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `DOMEventTarget` | -| `eventName` | `string` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -Protocol.once - -#### Defined in - -node_modules/@types/node/events.d.ts:158 - -___ - -### setMaxListeners - -▸ `Static` **setMaxListeners**(`n?`, ...`eventTargets`): `void` - -```js -const { - setMaxListeners, - EventEmitter -} = require('events'); - -const target = new EventTarget(); -const emitter = new EventEmitter(); - -setMaxListeners(5, target, emitter); -``` - -**`Since`** - -v15.4.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `n?` | `number` | A non-negative number. The maximum number of listeners per `EventTarget` event. | -| `...eventTargets` | (`EventEmitter` \| `DOMEventTarget`)[] | - | - -#### Returns - -`void` - -#### Inherited from - -Protocol.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:280 +[packages/devp2p/src/protocol/les.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L175) diff --git a/packages/devp2p/docs/classes/MAC.md b/packages/devp2p/docs/classes/MAC.md index abd6848635..35c98512d7 100644 --- a/packages/devp2p/docs/classes/MAC.md +++ b/packages/devp2p/docs/classes/MAC.md @@ -8,11 +8,6 @@ - [constructor](MAC.md#constructor) -### Properties - -- [\_hash](MAC.md#_hash) -- [\_secret](MAC.md#_secret) - ### Methods - [digest](MAC.md#digest) @@ -30,41 +25,21 @@ | Name | Type | | :------ | :------ | -| `secret` | `Buffer` | +| `secret` | `Uint8Array` | #### Defined in [packages/devp2p/src/rlpx/mac.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L11) -## Properties - -### \_hash - -• **\_hash**: `Hash`<`Keccak`\> - -#### Defined in - -[packages/devp2p/src/rlpx/mac.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L9) - -___ - -### \_secret - -• **\_secret**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/mac.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/mac.ts#L10) - ## Methods ### digest -▸ **digest**(): `Buffer` +▸ **digest**(): `Uint8Array` #### Returns -`Buffer` +`Uint8Array` #### Defined in @@ -80,7 +55,7 @@ ___ | Name | Type | | :------ | :------ | -| `data` | `string` \| `Buffer` | +| `data` | `string` \| `Uint8Array` | #### Returns @@ -100,7 +75,7 @@ ___ | Name | Type | | :------ | :------ | -| `data` | `string` \| `Buffer` | +| `data` | `string` \| `Uint8Array` | #### Returns @@ -120,7 +95,7 @@ ___ | Name | Type | | :------ | :------ | -| `data` | `string` \| `Buffer` | +| `data` | `string` \| `Uint8Array` | #### Returns diff --git a/packages/devp2p/docs/classes/Peer.md b/packages/devp2p/docs/classes/Peer.md index 4118fa0fbc..4c1899a7ec 100644 --- a/packages/devp2p/docs/classes/Peer.md +++ b/packages/devp2p/docs/classes/Peer.md @@ -2,12 +2,6 @@ # Class: Peer -## Hierarchy - -- `EventEmitter` - - ↳ **`Peer`** - ## Table of contents ### Constructors @@ -16,34 +10,11 @@ ### Properties -- [\_EIP8](Peer.md#_eip8) -- [\_capabilities](Peer.md#_capabilities) -- [\_clientId](Peer.md#_clientid) -- [\_closed](Peer.md#_closed) -- [\_common](Peer.md#_common) -- [\_connected](Peer.md#_connected) -- [\_disconnectReason](Peer.md#_disconnectreason) -- [\_disconnectWe](Peer.md#_disconnectwe) -- [\_eciesSession](Peer.md#_eciessession) -- [\_hello](Peer.md#_hello) -- [\_id](Peer.md#_id) -- [\_logger](Peer.md#_logger) -- [\_nextPacketSize](Peer.md#_nextpacketsize) -- [\_pingIntervalId](Peer.md#_pingintervalid) -- [\_pingTimeout](Peer.md#_pingtimeout) -- [\_pingTimeoutId](Peer.md#_pingtimeoutid) -- [\_port](Peer.md#_port) - [\_protocols](Peer.md#_protocols) -- [\_remoteClientIdFilter](Peer.md#_remoteclientidfilter) -- [\_remoteId](Peer.md#_remoteid) -- [\_socket](Peer.md#_socket) -- [\_socketData](Peer.md#_socketdata) -- [\_state](Peer.md#_state) -- [\_weHello](Peer.md#_wehello) -- [captureRejectionSymbol](Peer.md#capturerejectionsymbol) -- [captureRejections](Peer.md#capturerejections) -- [defaultMaxListeners](Peer.md#defaultmaxlisteners) -- [errorMonitor](Peer.md#errormonitor) +- [clientId](Peer.md#clientid) +- [common](Peer.md#common) +- [events](Peer.md#events) +- [id](Peer.md#id) ### Methods @@ -67,32 +38,12 @@ - [\_sendMessage](Peer.md#_sendmessage) - [\_sendPing](Peer.md#_sendping) - [\_sendPong](Peer.md#_sendpong) -- [addListener](Peer.md#addlistener) - [disconnect](Peer.md#disconnect) -- [emit](Peer.md#emit) -- [eventNames](Peer.md#eventnames) - [getDisconnectPrefix](Peer.md#getdisconnectprefix) - [getHelloMessage](Peer.md#gethellomessage) - [getId](Peer.md#getid) -- [getMaxListeners](Peer.md#getmaxlisteners) - [getMsgPrefix](Peer.md#getmsgprefix) - [getProtocols](Peer.md#getprotocols) -- [listenerCount](Peer.md#listenercount) -- [listeners](Peer.md#listeners) -- [off](Peer.md#off) -- [on](Peer.md#on) -- [once](Peer.md#once) -- [prependListener](Peer.md#prependlistener) -- [prependOnceListener](Peer.md#prependoncelistener) -- [rawListeners](Peer.md#rawlisteners) -- [removeAllListeners](Peer.md#removealllisteners) -- [removeListener](Peer.md#removelistener) -- [setMaxListeners](Peer.md#setmaxlisteners) -- [getEventListeners](Peer.md#geteventlisteners) -- [listenerCount](Peer.md#listenercount-1) -- [on](Peer.md#on-1) -- [once](Peer.md#once-1) -- [setMaxListeners](Peer.md#setmaxlisteners-1) ## Constructors @@ -104,324 +55,64 @@ | Name | Type | | :------ | :------ | -| `options` | `any` | - -#### Overrides - -EventEmitter.constructor +| `options` | [`PeerOptions`](../interfaces/PeerOptions.md) | #### Defined in -[packages/devp2p/src/rlpx/peer.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L114) +[packages/devp2p/src/rlpx/peer.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L98) ## Properties -### \_EIP8 - -• **\_EIP8**: `boolean` \| `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L91) - -___ - -### \_capabilities - -• `Optional` **\_capabilities**: [`Capabilities`](../interfaces/Capabilities.md)[] - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L85) - -___ - -### \_clientId - -• **\_clientId**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L84) - -___ - -### \_closed - -• **\_closed**: `boolean` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L101) - -___ - -### \_common - -• **\_common**: `Common` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L86) - -___ - -### \_connected - -• **\_connected**: `boolean` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L102) - -___ - -### \_disconnectReason - -• `Optional` **\_disconnectReason**: [`DISCONNECT_REASONS`](../enums/DISCONNECT_REASONS.md) - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L103) - -___ - -### \_disconnectWe - -• **\_disconnectWe**: ``null`` \| `boolean` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L104) - -___ - -### \_eciesSession - -• **\_eciesSession**: [`ECIES`](ECIES.md) - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L92) - -___ - -### \_hello - -• **\_hello**: ``null`` \| [`Hello`](../interfaces/Hello.md) - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L95) - -___ - -### \_id - -• **\_id**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L88) - -___ - -### \_logger - -• **\_logger**: `Debugger` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L106) - -___ - -### \_nextPacketSize - -• **\_nextPacketSize**: `number` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L96) - -___ - -### \_pingIntervalId - -• **\_pingIntervalId**: ``null`` \| `Timeout` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L99) - -___ - -### \_pingTimeout - -• **\_pingTimeout**: `number` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L105) - -___ - -### \_pingTimeoutId - -• **\_pingTimeoutId**: ``null`` \| `Timeout` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L100) - -___ - -### \_port - -• **\_port**: `number` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L87) - -___ - ### \_protocols -• **\_protocols**: [`ProtocolDescriptor`](../interfaces/ProtocolDescriptor.md)[] +• **\_protocols**: `ProtocolDescriptor`[] Subprotocols (e.g. `ETH`) derived from the exchange on capabilities #### Defined in -[packages/devp2p/src/rlpx/peer.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L112) - -___ - -### \_remoteClientIdFilter - -• **\_remoteClientIdFilter**: `any` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L89) - -___ - -### \_remoteId - -• **\_remoteId**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L90) - -___ - -### \_socket - -• **\_socket**: `Socket` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L97) - -___ - -### \_socketData - -• **\_socketData**: `BufferList` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L98) - -___ - -### \_state - -• **\_state**: `string` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L93) - -___ - -### \_weHello - -• **\_weHello**: ``null`` \| [`HelloMsg`](../README.md#hellomsg) - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L94) +[packages/devp2p/src/rlpx/peer.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L96) ___ -### captureRejectionSymbol - -▪ `Static` `Readonly` **captureRejectionSymbol**: typeof [`captureRejectionSymbol`](DPT.md#capturerejectionsymbol) - -#### Inherited from +### clientId -EventEmitter.captureRejectionSymbol +• `Readonly` **clientId**: `Uint8Array` #### Defined in -node_modules/@types/node/events.d.ts:291 +[packages/devp2p/src/rlpx/peer.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L68) ___ -### captureRejections +### common -▪ `Static` **captureRejections**: `boolean` - -Sets or gets the default captureRejection value for all emitters. - -#### Inherited from - -EventEmitter.captureRejections +• **common**: `Common` #### Defined in -node_modules/@types/node/events.d.ts:296 +[packages/devp2p/src/rlpx/peer.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L70) ___ -### defaultMaxListeners - -▪ `Static` **defaultMaxListeners**: `number` +### events -#### Inherited from - -EventEmitter.defaultMaxListeners +• **events**: `EventEmitter` #### Defined in -node_modules/@types/node/events.d.ts:297 +[packages/devp2p/src/rlpx/peer.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L67) ___ -### errorMonitor - -▪ `Static` `Readonly` **errorMonitor**: typeof [`errorMonitor`](DPT.md#errormonitor) - -This symbol shall be used to install a listener for only monitoring `'error'` -events. Listeners installed using this symbol are called before the regular -`'error'` listeners are called. - -Installing a listener using this symbol does not change the behavior once an -`'error'` event is emitted, therefore the process will still crash if no -regular `'error'` listener is installed. +### id -#### Inherited from - -EventEmitter.errorMonitor +• `Readonly` **id**: `Uint8Array` #### Defined in -node_modules/@types/node/events.d.ts:290 +[packages/devp2p/src/rlpx/peer.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L72) ## Methods @@ -440,13 +131,13 @@ Can be used together with the `devp2p:FIRST_PEER` debugger. #### Defined in -[packages/devp2p/src/rlpx/peer.ts:692](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L692) +[packages/devp2p/src/rlpx/peer.ts:689](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L689) ___ ### \_getProtocol -▸ **_getProtocol**(`code`): `undefined` \| [`ProtocolDescriptor`](../interfaces/ProtocolDescriptor.md) +▸ **_getProtocol**(`code`): `undefined` \| `ProtocolDescriptor` Returns either a protocol object with a `protocol` parameter reference to this Peer instance or to a subprotocol instance (e.g. `ETH`) @@ -460,11 +151,11 @@ reference to this Peer instance or to a subprotocol instance (e.g. `ETH`) #### Returns -`undefined` \| [`ProtocolDescriptor`](../interfaces/ProtocolDescriptor.md) +`undefined` \| `ProtocolDescriptor` #### Defined in -[packages/devp2p/src/rlpx/peer.ts:654](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L654) +[packages/devp2p/src/rlpx/peer.ts:651](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L651) ___ @@ -480,7 +171,7 @@ ACK message received #### Defined in -[packages/devp2p/src/rlpx/peer.ts:340](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L340) +[packages/devp2p/src/rlpx/peer.ts:328](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L328) ___ @@ -496,7 +187,7 @@ AUTH message received #### Defined in -[packages/devp2p/src/rlpx/peer.ts:317](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L317) +[packages/devp2p/src/rlpx/peer.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L303) ___ @@ -512,7 +203,7 @@ Handle message body #### Defined in -[packages/devp2p/src/rlpx/peer.ts:519](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L519) +[packages/devp2p/src/rlpx/peer.ts:516](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L516) ___ @@ -534,7 +225,7 @@ DISCONNECT message received #### Defined in -[packages/devp2p/src/rlpx/peer.ts:448](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L448) +[packages/devp2p/src/rlpx/peer.ts:440](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L440) ___ @@ -550,7 +241,7 @@ Handle message header #### Defined in -[packages/devp2p/src/rlpx/peer.ts:500](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L500) +[packages/devp2p/src/rlpx/peer.ts:497](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L497) ___ @@ -572,7 +263,7 @@ HELLO message received #### Defined in -[packages/devp2p/src/rlpx/peer.ts:369](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L369) +[packages/devp2p/src/rlpx/peer.ts:359](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L359) ___ @@ -586,8 +277,8 @@ Message handling, called from a SubProtocol context | Name | Type | | :------ | :------ | -| `code` | [`PREFIXES`](../enums/PREFIXES.md) | -| `msg` | `Buffer` | +| `code` | `PREFIXES` | +| `msg` | `Uint8Array` | #### Returns @@ -595,7 +286,7 @@ Message handling, called from a SubProtocol context #### Defined in -[packages/devp2p/src/rlpx/peer.ts:480](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L480) +[packages/devp2p/src/rlpx/peer.ts:477](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L477) ___ @@ -611,7 +302,7 @@ PING message received #### Defined in -[packages/devp2p/src/rlpx/peer.ts:464](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L464) +[packages/devp2p/src/rlpx/peer.ts:461](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L461) ___ @@ -627,7 +318,7 @@ PONG message received #### Defined in -[packages/devp2p/src/rlpx/peer.ts:471](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L471) +[packages/devp2p/src/rlpx/peer.ts:468](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L468) ___ @@ -643,7 +334,7 @@ React to socket being closed #### Defined in -[packages/devp2p/src/rlpx/peer.ts:641](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L641) +[packages/devp2p/src/rlpx/peer.ts:638](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L638) ___ @@ -657,7 +348,7 @@ Process socket data | Name | Type | | :------ | :------ | -| `data` | `Buffer` | +| `data` | `Uint8Array` | #### Returns @@ -665,7 +356,7 @@ Process socket data #### Defined in -[packages/devp2p/src/rlpx/peer.ts:611](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L611) +[packages/devp2p/src/rlpx/peer.ts:608](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L608) ___ @@ -681,7 +372,7 @@ Send ACK message #### Defined in -[packages/devp2p/src/rlpx/peer.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L186) +[packages/devp2p/src/rlpx/peer.ts:170](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L170) ___ @@ -697,7 +388,7 @@ Send AUTH message #### Defined in -[packages/devp2p/src/rlpx/peer.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L165) +[packages/devp2p/src/rlpx/peer.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L149) ___ @@ -711,7 +402,7 @@ Send DISCONNECT message | Name | Type | | :------ | :------ | -| `reason` | [`DISCONNECT_REASONS`](../enums/DISCONNECT_REASONS.md) | +| `reason` | [`DISCONNECT_REASON`](../enums/DISCONNECT_REASON.md) | #### Returns @@ -719,7 +410,7 @@ Send DISCONNECT message #### Defined in -[packages/devp2p/src/rlpx/peer.ts:268](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L268) +[packages/devp2p/src/rlpx/peer.ts:253](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L253) ___ @@ -735,7 +426,7 @@ Send HELLO message #### Defined in -[packages/devp2p/src/rlpx/peer.ts:231](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L231) +[packages/devp2p/src/rlpx/peer.ts:217](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L217) ___ @@ -751,7 +442,7 @@ Also called from SubProtocol context | Name | Type | | :------ | :------ | | `code` | `number` | -| `data` | `Buffer` | +| `data` | `Uint8Array` | #### Returns @@ -759,7 +450,7 @@ Also called from SubProtocol context #### Defined in -[packages/devp2p/src/rlpx/peer.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L211) +[packages/devp2p/src/rlpx/peer.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L197) ___ @@ -775,7 +466,7 @@ Send PING message #### Defined in -[packages/devp2p/src/rlpx/peer.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L284) +[packages/devp2p/src/rlpx/peer.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L272) ___ @@ -791,38 +482,7 @@ Send PONG message #### Defined in -[packages/devp2p/src/rlpx/peer.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L303) - -___ - -### addListener - -▸ **addListener**(`eventName`, `listener`): [`Peer`](Peer.md) - -Alias for `emitter.on(eventName, listener)`. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`Peer`](Peer.md) - -#### Inherited from - -EventEmitter.addListener - -#### Defined in - -node_modules/@types/node/events.d.ts:317 +[packages/devp2p/src/rlpx/peer.ts:290](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L290) ___ @@ -834,7 +494,7 @@ ___ | Name | Type | Default value | | :------ | :------ | :------ | -| `reason` | [`DISCONNECT_REASONS`](../enums/DISCONNECT_REASONS.md) | `DISCONNECT_REASONS.DISCONNECT_REQUESTED` | +| `reason` | [`DISCONNECT_REASON`](../enums/DISCONNECT_REASON.md) | `DISCONNECT_REASON.DISCONNECT_REQUESTED` | #### Returns @@ -842,112 +502,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/peer.ts:682](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L682) - -___ - -### emit - -▸ **emit**(`eventName`, ...`args`): `boolean` - -Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments -to each. - -Returns `true` if the event had listeners, `false` otherwise. - -```js -const EventEmitter = require('events'); -const myEmitter = new EventEmitter(); - -// First listener -myEmitter.on('event', function firstListener() { - console.log('Helloooo! first listener'); -}); -// Second listener -myEmitter.on('event', function secondListener(arg1, arg2) { - console.log(`event with parameters ${arg1}, ${arg2} in second listener`); -}); -// Third listener -myEmitter.on('event', function thirdListener(...args) { - const parameters = args.join(', '); - console.log(`event with parameters ${parameters} in third listener`); -}); - -console.log(myEmitter.listeners('event')); - -myEmitter.emit('event', 1, 2, 3, 4, 5); - -// Prints: -// [ -// [Function: firstListener], -// [Function: secondListener], -// [Function: thirdListener] -// ] -// Helloooo! first listener -// event with parameters 1, 2 in second listener -// event with parameters 1, 2, 3, 4, 5 in third listener -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `...args` | `any`[] | - -#### Returns - -`boolean` - -#### Inherited from - -EventEmitter.emit - -#### Defined in - -node_modules/@types/node/events.d.ts:573 - -___ - -### eventNames - -▸ **eventNames**(): (`string` \| `symbol`)[] - -Returns an array listing the events for which the emitter has registered -listeners. The values in the array are strings or `Symbol`s. - -```js -const EventEmitter = require('events'); -const myEE = new EventEmitter(); -myEE.on('foo', () => {}); -myEE.on('bar', () => {}); - -const sym = Symbol('symbol'); -myEE.on(sym, () => {}); - -console.log(myEE.eventNames()); -// Prints: [ 'foo', 'bar', Symbol(symbol) ] -``` - -**`Since`** - -v6.0.0 - -#### Returns - -(`string` \| `symbol`)[] - -#### Inherited from - -EventEmitter.eventNames - -#### Defined in - -node_modules/@types/node/events.d.ts:632 +[packages/devp2p/src/rlpx/peer.ts:679](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L679) ___ @@ -959,7 +514,7 @@ ___ | Name | Type | | :------ | :------ | -| `code` | [`DISCONNECT_REASONS`](../enums/DISCONNECT_REASONS.md) | +| `code` | [`DISCONNECT_REASON`](../enums/DISCONNECT_REASON.md) | #### Returns @@ -967,975 +522,66 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/peer.ts:678](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L678) +[packages/devp2p/src/rlpx/peer.ts:675](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L675) ___ ### getHelloMessage -▸ **getHelloMessage**(): ``null`` \| [`Hello`](../interfaces/Hello.md) +▸ **getHelloMessage**(): ``null`` \| `Hello` #### Returns -``null`` \| [`Hello`](../interfaces/Hello.md) +``null`` \| `Hello` #### Defined in -[packages/devp2p/src/rlpx/peer.ts:666](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L666) +[packages/devp2p/src/rlpx/peer.ts:663](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L663) ___ ### getId -▸ **getId**(): ``null`` \| `Buffer` +▸ **getId**(): ``null`` \| `Uint8Array` #### Returns -``null`` \| `Buffer` +``null`` \| `Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/peer.ts:661](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L661) +[packages/devp2p/src/rlpx/peer.ts:658](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L658) ___ -### getMaxListeners - -▸ **getMaxListeners**(): `number` +### getMsgPrefix -Returns the current max listener value for the `EventEmitter` which is either -set by `emitter.setMaxListeners(n)` or defaults to [defaultMaxListeners](Peer.md#defaultmaxlisteners). +▸ **getMsgPrefix**(`code`): `string` -**`Since`** +#### Parameters -v1.0.0 +| Name | Type | +| :------ | :------ | +| `code` | `PREFIXES` | #### Returns -`number` - -#### Inherited from - -EventEmitter.getMaxListeners +`string` #### Defined in -node_modules/@types/node/events.d.ts:489 - -___ - -### getMsgPrefix - -▸ **getMsgPrefix**(`code`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `code` | [`PREFIXES`](../enums/PREFIXES.md) | - -#### Returns - -`string` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:674](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L674) +[packages/devp2p/src/rlpx/peer.ts:671](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L671) ___ ### getProtocols -▸ **getProtocols**<`T`\>(): `T`[] - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends [`ETH`](ETH-1.md) \| [`LES`](LES-1.md) | - -#### Returns - -`T`[] - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:670](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L670) - -___ - -### listenerCount - -▸ **listenerCount**(`eventName`): `number` - -Returns the number of listeners listening to the event named `eventName`. - -**`Since`** - -v3.2.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event being listened for | - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:579 - -___ - -### listeners - -▸ **listeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -console.log(util.inspect(server.listeners('connection'))); -// Prints: [ [Function] ] -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.listeners - -#### Defined in - -node_modules/@types/node/events.d.ts:502 - -___ - -### off - -▸ **off**(`eventName`, `listener`): [`Peer`](Peer.md) - -Alias for `emitter.removeListener()`. - -**`Since`** - -v10.0.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`Peer`](Peer.md) - -#### Inherited from - -EventEmitter.off - -#### Defined in - -node_modules/@types/node/events.d.ts:462 - -___ - -### on - -▸ **on**(`eventName`, `listener`): [`Peer`](Peer.md) - -Adds the `listener` function to the end of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.on('foo', () => console.log('a')); -myEE.prependListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.1.101 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`Peer`](Peer.md) - -#### Inherited from - -EventEmitter.on - -#### Defined in - -node_modules/@types/node/events.d.ts:348 - -___ - -### once - -▸ **once**(`eventName`, `listener`): [`Peer`](Peer.md) - -Adds a **one-time**`listener` function for the event named `eventName`. The -next time `eventName` is triggered, this listener is removed and then invoked. - -```js -server.once('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.once('foo', () => console.log('a')); -myEE.prependOnceListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.3.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`Peer`](Peer.md) - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:377 - -___ - -### prependListener - -▸ **prependListener**(`eventName`, `listener`): [`Peer`](Peer.md) - -Adds the `listener` function to the _beginning_ of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.prependListener('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | +▸ **getProtocols**(): `Protocol`[] #### Returns -[`Peer`](Peer.md) - -#### Inherited from - -EventEmitter.prependListener - -#### Defined in - -node_modules/@types/node/events.d.ts:597 - -___ - -### prependOnceListener - -▸ **prependOnceListener**(`eventName`, `listener`): [`Peer`](Peer.md) - -Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this -listener is removed, and then invoked. - -```js -server.prependOnceListener('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`Peer`](Peer.md) - -#### Inherited from - -EventEmitter.prependOnceListener - -#### Defined in - -node_modules/@types/node/events.d.ts:613 - -___ - -### rawListeners - -▸ **rawListeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`, -including any wrappers (such as those created by `.once()`). - -```js -const emitter = new EventEmitter(); -emitter.once('log', () => console.log('log once')); - -// Returns a new Array with a function `onceWrapper` which has a property -// `listener` which contains the original listener bound above -const listeners = emitter.rawListeners('log'); -const logFnWrapper = listeners[0]; - -// Logs "log once" to the console and does not unbind the `once` event -logFnWrapper.listener(); - -// Logs "log once" to the console and removes the listener -logFnWrapper(); - -emitter.on('log', () => console.log('log persistently')); -// Will return a new Array with a single function bound by `.on()` above -const newListeners = emitter.rawListeners('log'); - -// Logs "log persistently" twice -newListeners[0](); -emitter.emit('log'); -``` - -**`Since`** - -v9.4.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.rawListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:532 - -___ - -### removeAllListeners - -▸ **removeAllListeners**(`event?`): [`Peer`](Peer.md) - -Removes all listeners, or those of the specified `eventName`. - -It is bad practice to remove listeners added elsewhere in the code, -particularly when the `EventEmitter` instance was created by some other -component or module (e.g. sockets or file streams). - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event?` | `string` \| `symbol` | - -#### Returns - -[`Peer`](Peer.md) - -#### Inherited from - -EventEmitter.removeAllListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:473 - -___ - -### removeListener - -▸ **removeListener**(`eventName`, `listener`): [`Peer`](Peer.md) - -Removes the specified `listener` from the listener array for the event named`eventName`. - -```js -const callback = (stream) => { - console.log('someone connected!'); -}; -server.on('connection', callback); -// ... -server.removeListener('connection', callback); -``` - -`removeListener()` will remove, at most, one instance of a listener from the -listener array. If any single listener has been added multiple times to the -listener array for the specified `eventName`, then `removeListener()` must be -called multiple times to remove each instance. - -Once an event is emitted, all listeners attached to it at the -time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will -not remove them from`emit()` in progress. Subsequent events behave as expected. - -```js -const myEmitter = new MyEmitter(); - -const callbackA = () => { - console.log('A'); - myEmitter.removeListener('event', callbackB); -}; - -const callbackB = () => { - console.log('B'); -}; - -myEmitter.on('event', callbackA); - -myEmitter.on('event', callbackB); - -// callbackA removes listener callbackB but it will still be called. -// Internal listener array at time of emit [callbackA, callbackB] -myEmitter.emit('event'); -// Prints: -// A -// B - -// callbackB is now removed. -// Internal listener array [callbackA] -myEmitter.emit('event'); -// Prints: -// A -``` - -Because listeners are managed using an internal array, calling this will -change the position indices of any listener registered _after_ the listener -being removed. This will not impact the order in which listeners are called, -but it means that any copies of the listener array as returned by -the `emitter.listeners()` method will need to be recreated. - -When a single function has been added as a handler multiple times for a single -event (as in the example below), `removeListener()` will remove the most -recently added instance. In the example the `once('ping')`listener is removed: - -```js -const ee = new EventEmitter(); - -function pong() { - console.log('pong'); -} - -ee.on('ping', pong); -ee.once('ping', pong); -ee.removeListener('ping', pong); - -ee.emit('ping'); -ee.emit('ping'); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`Peer`](Peer.md) - -#### Inherited from - -EventEmitter.removeListener - -#### Defined in - -node_modules/@types/node/events.d.ts:457 - -___ - -### setMaxListeners - -▸ **setMaxListeners**(`n`): [`Peer`](Peer.md) - -By default `EventEmitter`s will print a warning if more than `10` listeners are -added for a particular event. This is a useful default that helps finding -memory leaks. The `emitter.setMaxListeners()` method allows the limit to be -modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.3.5 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `n` | `number` | - -#### Returns - -[`Peer`](Peer.md) - -#### Inherited from - -EventEmitter.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:483 - -___ - -### getEventListeners - -▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -For `EventEmitter`s this behaves exactly the same as calling `.listeners` on -the emitter. - -For `EventTarget`s this is the only way to get the event listeners for the -event target. This is useful for debugging and diagnostic purposes. - -```js -const { getEventListeners, EventEmitter } = require('events'); - -{ - const ee = new EventEmitter(); - const listener = () => console.log('Events are fun'); - ee.on('foo', listener); - getEventListeners(ee, 'foo'); // [listener] -} -{ - const et = new EventTarget(); - const listener = () => console.log('Events are fun'); - et.addEventListener('foo', listener); - getEventListeners(et, 'foo'); // [listener] -} -``` - -**`Since`** - -v15.2.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `EventEmitter` \| `DOMEventTarget` | -| `name` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.getEventListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:262 - -___ - -### listenerCount - -▸ `Static` **listenerCount**(`emitter`, `eventName`): `number` - -A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. - -```js -const { EventEmitter, listenerCount } = require('events'); -const myEmitter = new EventEmitter(); -myEmitter.on('event', () => {}); -myEmitter.on('event', () => {}); -console.log(listenerCount(myEmitter, 'event')); -// Prints: 2 -``` - -**`Since`** - -v0.9.12 - -**`Deprecated`** - -Since v3.2.0 - Use `listenerCount` instead. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | The emitter to query | -| `eventName` | `string` \| `symbol` | The event name | - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:234 - -___ - -### on - -▸ `Static` **on**(`emitter`, `eventName`, `options?`): `AsyncIterableIterator`<`any`\> - -```js -const { on, EventEmitter } = require('events'); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo')) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); -``` - -Returns an `AsyncIterator` that iterates `eventName` events. It will throw -if the `EventEmitter` emits `'error'`. It removes all listeners when -exiting the loop. The `value` returned by each iteration is an array -composed of the emitted event arguments. - -An `AbortSignal` can be used to cancel waiting on events: - -```js -const { on, EventEmitter } = require('events'); -const ac = new AbortController(); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo', { signal: ac.signal })) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); - -process.nextTick(() => ac.abort()); -``` - -**`Since`** - -v13.6.0, v12.16.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | - | -| `eventName` | `string` | The name of the event being listened for | -| `options?` | `StaticEventEmitterOptions` | - | - -#### Returns - -`AsyncIterableIterator`<`any`\> - -that iterates `eventName` events emitted by the `emitter` - -#### Inherited from - -EventEmitter.on - -#### Defined in - -node_modules/@types/node/events.d.ts:217 - -___ - -### once - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given -event or that is rejected if the `EventEmitter` emits `'error'` while waiting. -The `Promise` will resolve with an array of all the arguments emitted to the -given event. - -This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event -semantics and does not listen to the `'error'` event. - -```js -const { once, EventEmitter } = require('events'); - -async function run() { - const ee = new EventEmitter(); - - process.nextTick(() => { - ee.emit('myevent', 42); - }); - - const [value] = await once(ee, 'myevent'); - console.log(value); - - const err = new Error('kaboom'); - process.nextTick(() => { - ee.emit('error', err); - }); - - try { - await once(ee, 'myevent'); - } catch (err) { - console.log('error happened', err); - } -} - -run(); -``` - -The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the -'`error'` event itself, then it is treated as any other kind of event without -special handling: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); - -once(ee, 'error') - .then(([err]) => console.log('ok', err.message)) - .catch((err) => console.log('error', err.message)); - -ee.emit('error', new Error('boom')); - -// Prints: ok boom -``` - -An `AbortSignal` can be used to cancel waiting for the event: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); -const ac = new AbortController(); - -async function foo(emitter, event, signal) { - try { - await once(emitter, event, { signal }); - console.log('event emitted!'); - } catch (error) { - if (error.name === 'AbortError') { - console.error('Waiting for the event was canceled!'); - } else { - console.error('There was an error', error.message); - } - } -} - -foo(ee, 'foo', ac.signal); -ac.abort(); // Abort waiting for the event -ee.emit('foo'); // Prints: Waiting for the event was canceled! -``` - -**`Since`** - -v11.13.0, v10.16.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `NodeEventTarget` | -| `eventName` | `string` \| `symbol` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:157 - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `DOMEventTarget` | -| `eventName` | `string` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:158 - -___ - -### setMaxListeners - -▸ `Static` **setMaxListeners**(`n?`, ...`eventTargets`): `void` - -```js -const { - setMaxListeners, - EventEmitter -} = require('events'); - -const target = new EventTarget(); -const emitter = new EventEmitter(); - -setMaxListeners(5, target, emitter); -``` - -**`Since`** - -v15.4.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `n?` | `number` | A non-negative number. The maximum number of listeners per `EventTarget` event. | -| `...eventTargets` | (`EventEmitter` \| `DOMEventTarget`)[] | - | - -#### Returns - -`void` - -#### Inherited from - -EventEmitter.setMaxListeners +`Protocol`[] #### Defined in -node_modules/@types/node/events.d.ts:280 +[packages/devp2p/src/rlpx/peer.ts:667](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L667) diff --git a/packages/devp2p/docs/classes/RLPx.md b/packages/devp2p/docs/classes/RLPx.md index 0a0bd76607..ac6f3c34e0 100644 --- a/packages/devp2p/docs/classes/RLPx.md +++ b/packages/devp2p/docs/classes/RLPx.md @@ -2,12 +2,6 @@ # Class: RLPx -## Hierarchy - -- `EventEmitter` - - ↳ **`RLPx`** - ## Table of contents ### Constructors @@ -16,27 +10,9 @@ ### Properties -- [\_capabilities](RLPx.md#_capabilities) -- [\_clientId](RLPx.md#_clientid) -- [\_common](RLPx.md#_common) -- [\_debug](RLPx.md#_debug) -- [\_dpt](RLPx.md#_dpt) -- [\_id](RLPx.md#_id) -- [\_listenPort](RLPx.md#_listenport) -- [\_maxPeers](RLPx.md#_maxpeers) -- [\_peers](RLPx.md#_peers) -- [\_peersLRU](RLPx.md#_peerslru) -- [\_peersQueue](RLPx.md#_peersqueue) -- [\_privateKey](RLPx.md#_privatekey) -- [\_refillIntervalId](RLPx.md#_refillintervalid) -- [\_refillIntervalSelectionCounter](RLPx.md#_refillintervalselectioncounter) -- [\_remoteClientIdFilter](RLPx.md#_remoteclientidfilter) -- [\_server](RLPx.md#_server) -- [\_timeout](RLPx.md#_timeout) -- [captureRejectionSymbol](RLPx.md#capturerejectionsymbol) -- [captureRejections](RLPx.md#capturerejections) -- [defaultMaxListeners](RLPx.md#defaultmaxlisteners) -- [errorMonitor](RLPx.md#errormonitor) +- [clientId](RLPx.md#clientid) +- [events](RLPx.md#events) +- [id](RLPx.md#id) ### Methods @@ -47,31 +23,11 @@ - [\_isAliveCheck](RLPx.md#_isalivecheck) - [\_onConnect](RLPx.md#_onconnect) - [\_refillConnections](RLPx.md#_refillconnections) -- [addListener](RLPx.md#addlistener) - [connect](RLPx.md#connect) - [destroy](RLPx.md#destroy) - [disconnect](RLPx.md#disconnect) -- [emit](RLPx.md#emit) -- [eventNames](RLPx.md#eventnames) -- [getMaxListeners](RLPx.md#getmaxlisteners) - [getPeers](RLPx.md#getpeers) - [listen](RLPx.md#listen) -- [listenerCount](RLPx.md#listenercount) -- [listeners](RLPx.md#listeners) -- [off](RLPx.md#off) -- [on](RLPx.md#on) -- [once](RLPx.md#once) -- [prependListener](RLPx.md#prependlistener) -- [prependOnceListener](RLPx.md#prependoncelistener) -- [rawListeners](RLPx.md#rawlisteners) -- [removeAllListeners](RLPx.md#removealllisteners) -- [removeListener](RLPx.md#removelistener) -- [setMaxListeners](RLPx.md#setmaxlisteners) -- [getEventListeners](RLPx.md#geteventlisteners) -- [listenerCount](RLPx.md#listenercount-1) -- [on](RLPx.md#on-1) -- [once](RLPx.md#once-1) -- [setMaxListeners](RLPx.md#setmaxlisteners-1) ## Constructors @@ -83,52 +39,18 @@ | Name | Type | | :------ | :------ | -| `privateKey` | `Buffer` | +| `privateKey` | `Uint8Array` | | `options` | [`RLPxOptions`](../interfaces/RLPxOptions.md) | -#### Overrides - -EventEmitter.constructor - #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L58) +[packages/devp2p/src/rlpx/rlpx.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L55) ## Properties -### \_capabilities - -• **\_capabilities**: [`Capabilities`](../interfaces/Capabilities.md)[] - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L45) - -___ - -### \_clientId - -• **\_clientId**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L43) - -___ - -### \_common - -• **\_common**: `Common` - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L46) +### clientId -___ - -### \_debug - -• **\_debug**: `Debugger` +• `Readonly` **clientId**: `Uint8Array` #### Defined in @@ -136,199 +58,23 @@ ___ ___ -### \_dpt - -• **\_dpt**: ``null`` \| [`DPT`](DPT.md) - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L48) - -___ - -### \_id - -• **\_id**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L39) - -___ - -### \_listenPort - -• **\_listenPort**: ``null`` \| `number` - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L47) - -___ - -### \_maxPeers - -• **\_maxPeers**: `number` - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L42) - -___ - -### \_peers - -• **\_peers**: `Map`<`string`, `Socket` \| [`Peer`](Peer.md)\> - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L53) - -___ - -### \_peersLRU - -• **\_peersLRU**: `LRUCache`<`string`, `boolean`\> - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L50) - -___ - -### \_peersQueue - -• **\_peersQueue**: { `peer`: [`PeerInfo`](../interfaces/PeerInfo.md) ; `ts`: `number` }[] - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L51) - -___ - -### \_privateKey - -• **\_privateKey**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L38) - -___ - -### \_refillIntervalId - -• **\_refillIntervalId**: `Timeout` - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L55) - -___ - -### \_refillIntervalSelectionCounter - -• **\_refillIntervalSelectionCounter**: `number` = `0` - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L56) - -___ - -### \_remoteClientIdFilter - -• `Optional` **\_remoteClientIdFilter**: `string`[] - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L44) - -___ - -### \_server - -• **\_server**: ``null`` \| `Server` - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L52) - -___ - -### \_timeout - -• **\_timeout**: `number` - -#### Defined in - -[packages/devp2p/src/rlpx/rlpx.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L41) - -___ - -### captureRejectionSymbol - -▪ `Static` `Readonly` **captureRejectionSymbol**: typeof [`captureRejectionSymbol`](DPT.md#capturerejectionsymbol) - -#### Inherited from - -EventEmitter.captureRejectionSymbol - -#### Defined in - -node_modules/@types/node/events.d.ts:291 - -___ - -### captureRejections +### events -▪ `Static` **captureRejections**: `boolean` - -Sets or gets the default captureRejection value for all emitters. - -#### Inherited from - -EventEmitter.captureRejections - -#### Defined in - -node_modules/@types/node/events.d.ts:296 - -___ - -### defaultMaxListeners - -▪ `Static` **defaultMaxListeners**: `number` - -#### Inherited from - -EventEmitter.defaultMaxListeners +• **events**: `EventEmitter` #### Defined in -node_modules/@types/node/events.d.ts:297 +[packages/devp2p/src/rlpx/rlpx.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L34) ___ -### errorMonitor - -▪ `Static` `Readonly` **errorMonitor**: typeof [`errorMonitor`](DPT.md#errormonitor) - -This symbol shall be used to install a listener for only monitoring `'error'` -events. Listeners installed using this symbol are called before the regular -`'error'` listeners are called. - -Installing a listener using this symbol does not change the behavior once an -`'error'` event is emitted, therefore the process will still crash if no -regular `'error'` listener is installed. - -#### Inherited from +### id -EventEmitter.errorMonitor +• `Readonly` **id**: `Uint8Array` #### Defined in -node_modules/@types/node/events.d.ts:290 +[packages/devp2p/src/rlpx/rlpx.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L36) ## Methods @@ -348,7 +94,7 @@ node_modules/@types/node/events.d.ts:290 #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L194) +[packages/devp2p/src/rlpx/rlpx.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L192) ___ @@ -362,7 +108,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L190) +[packages/devp2p/src/rlpx/rlpx.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L188) ___ @@ -376,7 +122,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L186) +[packages/devp2p/src/rlpx/rlpx.ts:184](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L184) ___ @@ -390,7 +136,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:178](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L178) +[packages/devp2p/src/rlpx/rlpx.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L176) ___ @@ -404,7 +150,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L182) +[packages/devp2p/src/rlpx/rlpx.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L180) ___ @@ -417,7 +163,7 @@ ___ | Name | Type | | :------ | :------ | | `socket` | `Socket` | -| `peerId` | ``null`` \| `Buffer` | +| `peerId` | ``null`` \| `Uint8Array` | #### Returns @@ -425,7 +171,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L203) +[packages/devp2p/src/rlpx/rlpx.ts:201](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L201) ___ @@ -439,38 +185,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L282) - -___ - -### addListener - -▸ **addListener**(`eventName`, `listener`): [`RLPx`](RLPx.md) - -Alias for `emitter.on(eventName, listener)`. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`RLPx`](RLPx.md) - -#### Inherited from - -EventEmitter.addListener - -#### Defined in - -node_modules/@types/node/events.d.ts:317 +[packages/devp2p/src/rlpx/rlpx.ts:286](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L286) ___ @@ -490,7 +205,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L141) +[packages/devp2p/src/rlpx/rlpx.ts:137](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L137) ___ @@ -510,7 +225,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:129](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L129) +[packages/devp2p/src/rlpx/rlpx.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L125) ___ @@ -522,7 +237,7 @@ ___ | Name | Type | | :------ | :------ | -| `id` | `Buffer` | +| `id` | `Uint8Array` | #### Returns @@ -530,137 +245,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L173) - -___ - -### emit - -▸ **emit**(`eventName`, ...`args`): `boolean` - -Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments -to each. - -Returns `true` if the event had listeners, `false` otherwise. - -```js -const EventEmitter = require('events'); -const myEmitter = new EventEmitter(); - -// First listener -myEmitter.on('event', function firstListener() { - console.log('Helloooo! first listener'); -}); -// Second listener -myEmitter.on('event', function secondListener(arg1, arg2) { - console.log(`event with parameters ${arg1}, ${arg2} in second listener`); -}); -// Third listener -myEmitter.on('event', function thirdListener(...args) { - const parameters = args.join(', '); - console.log(`event with parameters ${parameters} in third listener`); -}); - -console.log(myEmitter.listeners('event')); - -myEmitter.emit('event', 1, 2, 3, 4, 5); - -// Prints: -// [ -// [Function: firstListener], -// [Function: secondListener], -// [Function: thirdListener] -// ] -// Helloooo! first listener -// event with parameters 1, 2 in second listener -// event with parameters 1, 2, 3, 4, 5 in third listener -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `...args` | `any`[] | - -#### Returns - -`boolean` - -#### Inherited from - -EventEmitter.emit - -#### Defined in - -node_modules/@types/node/events.d.ts:573 - -___ - -### eventNames - -▸ **eventNames**(): (`string` \| `symbol`)[] - -Returns an array listing the events for which the emitter has registered -listeners. The values in the array are strings or `Symbol`s. - -```js -const EventEmitter = require('events'); -const myEE = new EventEmitter(); -myEE.on('foo', () => {}); -myEE.on('bar', () => {}); - -const sym = Symbol('symbol'); -myEE.on(sym, () => {}); - -console.log(myEE.eventNames()); -// Prints: [ 'foo', 'bar', Symbol(symbol) ] -``` - -**`Since`** - -v6.0.0 - -#### Returns - -(`string` \| `symbol`)[] - -#### Inherited from - -EventEmitter.eventNames - -#### Defined in - -node_modules/@types/node/events.d.ts:632 - -___ - -### getMaxListeners - -▸ **getMaxListeners**(): `number` - -Returns the current max listener value for the `EventEmitter` which is either -set by `emitter.setMaxListeners(n)` or defaults to [defaultMaxListeners](RLPx.md#defaultmaxlisteners). - -**`Since`** - -v1.0.0 - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.getMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:489 +[packages/devp2p/src/rlpx/rlpx.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L169) ___ @@ -674,7 +259,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L169) +[packages/devp2p/src/rlpx/rlpx.ts:165](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L165) ___ @@ -694,882 +279,4 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L122) - -___ - -### listenerCount - -▸ **listenerCount**(`eventName`): `number` - -Returns the number of listeners listening to the event named `eventName`. - -**`Since`** - -v3.2.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event being listened for | - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:579 - -___ - -### listeners - -▸ **listeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -console.log(util.inspect(server.listeners('connection'))); -// Prints: [ [Function] ] -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.listeners - -#### Defined in - -node_modules/@types/node/events.d.ts:502 - -___ - -### off - -▸ **off**(`eventName`, `listener`): [`RLPx`](RLPx.md) - -Alias for `emitter.removeListener()`. - -**`Since`** - -v10.0.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`RLPx`](RLPx.md) - -#### Inherited from - -EventEmitter.off - -#### Defined in - -node_modules/@types/node/events.d.ts:462 - -___ - -### on - -▸ **on**(`eventName`, `listener`): [`RLPx`](RLPx.md) - -Adds the `listener` function to the end of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.on('foo', () => console.log('a')); -myEE.prependListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.1.101 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`RLPx`](RLPx.md) - -#### Inherited from - -EventEmitter.on - -#### Defined in - -node_modules/@types/node/events.d.ts:348 - -___ - -### once - -▸ **once**(`eventName`, `listener`): [`RLPx`](RLPx.md) - -Adds a **one-time**`listener` function for the event named `eventName`. The -next time `eventName` is triggered, this listener is removed and then invoked. - -```js -server.once('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.once('foo', () => console.log('a')); -myEE.prependOnceListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.3.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`RLPx`](RLPx.md) - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:377 - -___ - -### prependListener - -▸ **prependListener**(`eventName`, `listener`): [`RLPx`](RLPx.md) - -Adds the `listener` function to the _beginning_ of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.prependListener('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`RLPx`](RLPx.md) - -#### Inherited from - -EventEmitter.prependListener - -#### Defined in - -node_modules/@types/node/events.d.ts:597 - -___ - -### prependOnceListener - -▸ **prependOnceListener**(`eventName`, `listener`): [`RLPx`](RLPx.md) - -Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this -listener is removed, and then invoked. - -```js -server.prependOnceListener('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`RLPx`](RLPx.md) - -#### Inherited from - -EventEmitter.prependOnceListener - -#### Defined in - -node_modules/@types/node/events.d.ts:613 - -___ - -### rawListeners - -▸ **rawListeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`, -including any wrappers (such as those created by `.once()`). - -```js -const emitter = new EventEmitter(); -emitter.once('log', () => console.log('log once')); - -// Returns a new Array with a function `onceWrapper` which has a property -// `listener` which contains the original listener bound above -const listeners = emitter.rawListeners('log'); -const logFnWrapper = listeners[0]; - -// Logs "log once" to the console and does not unbind the `once` event -logFnWrapper.listener(); - -// Logs "log once" to the console and removes the listener -logFnWrapper(); - -emitter.on('log', () => console.log('log persistently')); -// Will return a new Array with a single function bound by `.on()` above -const newListeners = emitter.rawListeners('log'); - -// Logs "log persistently" twice -newListeners[0](); -emitter.emit('log'); -``` - -**`Since`** - -v9.4.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.rawListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:532 - -___ - -### removeAllListeners - -▸ **removeAllListeners**(`event?`): [`RLPx`](RLPx.md) - -Removes all listeners, or those of the specified `eventName`. - -It is bad practice to remove listeners added elsewhere in the code, -particularly when the `EventEmitter` instance was created by some other -component or module (e.g. sockets or file streams). - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event?` | `string` \| `symbol` | - -#### Returns - -[`RLPx`](RLPx.md) - -#### Inherited from - -EventEmitter.removeAllListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:473 - -___ - -### removeListener - -▸ **removeListener**(`eventName`, `listener`): [`RLPx`](RLPx.md) - -Removes the specified `listener` from the listener array for the event named`eventName`. - -```js -const callback = (stream) => { - console.log('someone connected!'); -}; -server.on('connection', callback); -// ... -server.removeListener('connection', callback); -``` - -`removeListener()` will remove, at most, one instance of a listener from the -listener array. If any single listener has been added multiple times to the -listener array for the specified `eventName`, then `removeListener()` must be -called multiple times to remove each instance. - -Once an event is emitted, all listeners attached to it at the -time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will -not remove them from`emit()` in progress. Subsequent events behave as expected. - -```js -const myEmitter = new MyEmitter(); - -const callbackA = () => { - console.log('A'); - myEmitter.removeListener('event', callbackB); -}; - -const callbackB = () => { - console.log('B'); -}; - -myEmitter.on('event', callbackA); - -myEmitter.on('event', callbackB); - -// callbackA removes listener callbackB but it will still be called. -// Internal listener array at time of emit [callbackA, callbackB] -myEmitter.emit('event'); -// Prints: -// A -// B - -// callbackB is now removed. -// Internal listener array [callbackA] -myEmitter.emit('event'); -// Prints: -// A -``` - -Because listeners are managed using an internal array, calling this will -change the position indices of any listener registered _after_ the listener -being removed. This will not impact the order in which listeners are called, -but it means that any copies of the listener array as returned by -the `emitter.listeners()` method will need to be recreated. - -When a single function has been added as a handler multiple times for a single -event (as in the example below), `removeListener()` will remove the most -recently added instance. In the example the `once('ping')`listener is removed: - -```js -const ee = new EventEmitter(); - -function pong() { - console.log('pong'); -} - -ee.on('ping', pong); -ee.once('ping', pong); -ee.removeListener('ping', pong); - -ee.emit('ping'); -ee.emit('ping'); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`RLPx`](RLPx.md) - -#### Inherited from - -EventEmitter.removeListener - -#### Defined in - -node_modules/@types/node/events.d.ts:457 - -___ - -### setMaxListeners - -▸ **setMaxListeners**(`n`): [`RLPx`](RLPx.md) - -By default `EventEmitter`s will print a warning if more than `10` listeners are -added for a particular event. This is a useful default that helps finding -memory leaks. The `emitter.setMaxListeners()` method allows the limit to be -modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.3.5 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `n` | `number` | - -#### Returns - -[`RLPx`](RLPx.md) - -#### Inherited from - -EventEmitter.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:483 - -___ - -### getEventListeners - -▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -For `EventEmitter`s this behaves exactly the same as calling `.listeners` on -the emitter. - -For `EventTarget`s this is the only way to get the event listeners for the -event target. This is useful for debugging and diagnostic purposes. - -```js -const { getEventListeners, EventEmitter } = require('events'); - -{ - const ee = new EventEmitter(); - const listener = () => console.log('Events are fun'); - ee.on('foo', listener); - getEventListeners(ee, 'foo'); // [listener] -} -{ - const et = new EventTarget(); - const listener = () => console.log('Events are fun'); - et.addEventListener('foo', listener); - getEventListeners(et, 'foo'); // [listener] -} -``` - -**`Since`** - -v15.2.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `EventEmitter` \| `DOMEventTarget` | -| `name` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.getEventListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:262 - -___ - -### listenerCount - -▸ `Static` **listenerCount**(`emitter`, `eventName`): `number` - -A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. - -```js -const { EventEmitter, listenerCount } = require('events'); -const myEmitter = new EventEmitter(); -myEmitter.on('event', () => {}); -myEmitter.on('event', () => {}); -console.log(listenerCount(myEmitter, 'event')); -// Prints: 2 -``` - -**`Since`** - -v0.9.12 - -**`Deprecated`** - -Since v3.2.0 - Use `listenerCount` instead. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | The emitter to query | -| `eventName` | `string` \| `symbol` | The event name | - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:234 - -___ - -### on - -▸ `Static` **on**(`emitter`, `eventName`, `options?`): `AsyncIterableIterator`<`any`\> - -```js -const { on, EventEmitter } = require('events'); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo')) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); -``` - -Returns an `AsyncIterator` that iterates `eventName` events. It will throw -if the `EventEmitter` emits `'error'`. It removes all listeners when -exiting the loop. The `value` returned by each iteration is an array -composed of the emitted event arguments. - -An `AbortSignal` can be used to cancel waiting on events: - -```js -const { on, EventEmitter } = require('events'); -const ac = new AbortController(); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo', { signal: ac.signal })) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); - -process.nextTick(() => ac.abort()); -``` - -**`Since`** - -v13.6.0, v12.16.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | - | -| `eventName` | `string` | The name of the event being listened for | -| `options?` | `StaticEventEmitterOptions` | - | - -#### Returns - -`AsyncIterableIterator`<`any`\> - -that iterates `eventName` events emitted by the `emitter` - -#### Inherited from - -EventEmitter.on - -#### Defined in - -node_modules/@types/node/events.d.ts:217 - -___ - -### once - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given -event or that is rejected if the `EventEmitter` emits `'error'` while waiting. -The `Promise` will resolve with an array of all the arguments emitted to the -given event. - -This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event -semantics and does not listen to the `'error'` event. - -```js -const { once, EventEmitter } = require('events'); - -async function run() { - const ee = new EventEmitter(); - - process.nextTick(() => { - ee.emit('myevent', 42); - }); - - const [value] = await once(ee, 'myevent'); - console.log(value); - - const err = new Error('kaboom'); - process.nextTick(() => { - ee.emit('error', err); - }); - - try { - await once(ee, 'myevent'); - } catch (err) { - console.log('error happened', err); - } -} - -run(); -``` - -The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the -'`error'` event itself, then it is treated as any other kind of event without -special handling: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); - -once(ee, 'error') - .then(([err]) => console.log('ok', err.message)) - .catch((err) => console.log('error', err.message)); - -ee.emit('error', new Error('boom')); - -// Prints: ok boom -``` - -An `AbortSignal` can be used to cancel waiting for the event: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); -const ac = new AbortController(); - -async function foo(emitter, event, signal) { - try { - await once(emitter, event, { signal }); - console.log('event emitted!'); - } catch (error) { - if (error.name === 'AbortError') { - console.error('Waiting for the event was canceled!'); - } else { - console.error('There was an error', error.message); - } - } -} - -foo(ee, 'foo', ac.signal); -ac.abort(); // Abort waiting for the event -ee.emit('foo'); // Prints: Waiting for the event was canceled! -``` - -**`Since`** - -v11.13.0, v10.16.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `NodeEventTarget` | -| `eventName` | `string` \| `symbol` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:157 - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `DOMEventTarget` | -| `eventName` | `string` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:158 - -___ - -### setMaxListeners - -▸ `Static` **setMaxListeners**(`n?`, ...`eventTargets`): `void` - -```js -const { - setMaxListeners, - EventEmitter -} = require('events'); - -const target = new EventTarget(); -const emitter = new EventEmitter(); - -setMaxListeners(5, target, emitter); -``` - -**`Since`** - -v15.4.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `n?` | `number` | A non-negative number. The maximum number of listeners per `EventTarget` event. | -| `...eventTargets` | (`EventEmitter` \| `DOMEventTarget`)[] | - | - -#### Returns - -`void` - -#### Inherited from - -EventEmitter.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:280 +[packages/devp2p/src/rlpx/rlpx.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L118) diff --git a/packages/devp2p/docs/classes/SNAP-1.md b/packages/devp2p/docs/classes/SNAP-1.md index b4c1c4f005..bb87f706f3 100644 --- a/packages/devp2p/docs/classes/SNAP-1.md +++ b/packages/devp2p/docs/classes/SNAP-1.md @@ -16,39 +16,15 @@ ### Properties -- [captureRejectionSymbol](SNAP-1.md#capturerejectionsymbol) -- [captureRejections](SNAP-1.md#capturerejections) -- [defaultMaxListeners](SNAP-1.md#defaultmaxlisteners) -- [errorMonitor](SNAP-1.md#errormonitor) - [snap](SNAP-1.md#snap) ### Methods - [\_handleMessage](SNAP-1.md#_handlemessage) -- [addListener](SNAP-1.md#addlistener) -- [emit](SNAP-1.md#emit) -- [eventNames](SNAP-1.md#eventnames) -- [getMaxListeners](SNAP-1.md#getmaxlisteners) - [getMsgPrefix](SNAP-1.md#getmsgprefix) - [getVersion](SNAP-1.md#getversion) -- [listenerCount](SNAP-1.md#listenercount) -- [listeners](SNAP-1.md#listeners) -- [off](SNAP-1.md#off) -- [on](SNAP-1.md#on) -- [once](SNAP-1.md#once) -- [prependListener](SNAP-1.md#prependlistener) -- [prependOnceListener](SNAP-1.md#prependoncelistener) -- [rawListeners](SNAP-1.md#rawlisteners) -- [removeAllListeners](SNAP-1.md#removealllisteners) -- [removeListener](SNAP-1.md#removelistener) - [sendMessage](SNAP-1.md#sendmessage) - [sendStatus](SNAP-1.md#sendstatus) -- [setMaxListeners](SNAP-1.md#setmaxlisteners) -- [getEventListeners](SNAP-1.md#geteventlisteners) -- [listenerCount](SNAP-1.md#listenercount-1) -- [on](SNAP-1.md#on-1) -- [once](SNAP-1.md#once-1) -- [setMaxListeners](SNAP-1.md#setmaxlisteners-1) ## Constructors @@ -62,7 +38,7 @@ | :------ | :------ | | `version` | `number` | | `peer` | [`Peer`](Peer.md) | -| `send` | `SendMethod` | +| `send` | [`SendMethod`](../README.md#sendmethod) | #### Overrides @@ -70,76 +46,10 @@ Protocol.constructor #### Defined in -[packages/devp2p/src/protocol/snap.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L12) +[packages/devp2p/src/protocol/snap.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L14) ## Properties -### captureRejectionSymbol - -▪ `Static` `Readonly` **captureRejectionSymbol**: typeof [`captureRejectionSymbol`](DPT.md#capturerejectionsymbol) - -#### Inherited from - -Protocol.captureRejectionSymbol - -#### Defined in - -node_modules/@types/node/events.d.ts:291 - -___ - -### captureRejections - -▪ `Static` **captureRejections**: `boolean` - -Sets or gets the default captureRejection value for all emitters. - -#### Inherited from - -Protocol.captureRejections - -#### Defined in - -node_modules/@types/node/events.d.ts:296 - -___ - -### defaultMaxListeners - -▪ `Static` **defaultMaxListeners**: `number` - -#### Inherited from - -Protocol.defaultMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:297 - -___ - -### errorMonitor - -▪ `Static` `Readonly` **errorMonitor**: typeof [`errorMonitor`](DPT.md#errormonitor) - -This symbol shall be used to install a listener for only monitoring `'error'` -events. Listeners installed using this symbol are called before the regular -`'error'` listeners are called. - -Installing a listener using this symbol does not change the behavior once an -`'error'` event is emitted, therefore the process will still crash if no -regular `'error'` listener is installed. - -#### Inherited from - -Protocol.errorMonitor - -#### Defined in - -node_modules/@types/node/events.d.ts:290 - -___ - ### snap ▪ `Static` **snap**: `Object` @@ -155,7 +65,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/snap.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L16) +[packages/devp2p/src/protocol/snap.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L18) ## Methods @@ -168,176 +78,19 @@ ___ | Name | Type | | :------ | :------ | | `code` | [`MESSAGE_CODES`](../enums/SNAP.MESSAGE_CODES.md) | -| `data` | `any` | +| `data` | `Uint8Array` | #### Returns `void` -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L18) - -___ - -### addListener - -▸ **addListener**(`eventName`, `listener`): [`SNAP`](SNAP-1.md) - -Alias for `emitter.on(eventName, listener)`. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`SNAP`](SNAP-1.md) - -#### Inherited from - -Protocol.addListener - -#### Defined in - -node_modules/@types/node/events.d.ts:317 - -___ - -### emit - -▸ **emit**(`eventName`, ...`args`): `boolean` - -Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments -to each. - -Returns `true` if the event had listeners, `false` otherwise. - -```js -const EventEmitter = require('events'); -const myEmitter = new EventEmitter(); - -// First listener -myEmitter.on('event', function firstListener() { - console.log('Helloooo! first listener'); -}); -// Second listener -myEmitter.on('event', function secondListener(arg1, arg2) { - console.log(`event with parameters ${arg1}, ${arg2} in second listener`); -}); -// Third listener -myEmitter.on('event', function thirdListener(...args) { - const parameters = args.join(', '); - console.log(`event with parameters ${parameters} in third listener`); -}); - -console.log(myEmitter.listeners('event')); - -myEmitter.emit('event', 1, 2, 3, 4, 5); - -// Prints: -// [ -// [Function: firstListener], -// [Function: secondListener], -// [Function: thirdListener] -// ] -// Helloooo! first listener -// event with parameters 1, 2 in second listener -// event with parameters 1, 2, 3, 4, 5 in third listener -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `...args` | `any`[] | - -#### Returns - -`boolean` - -#### Inherited from - -Protocol.emit - -#### Defined in - -node_modules/@types/node/events.d.ts:573 - -___ - -### eventNames - -▸ **eventNames**(): (`string` \| `symbol`)[] - -Returns an array listing the events for which the emitter has registered -listeners. The values in the array are strings or `Symbol`s. - -```js -const EventEmitter = require('events'); -const myEE = new EventEmitter(); -myEE.on('foo', () => {}); -myEE.on('bar', () => {}); - -const sym = Symbol('symbol'); -myEE.on(sym, () => {}); - -console.log(myEE.eventNames()); -// Prints: [ 'foo', 'bar', Symbol(symbol) ] -``` - -**`Since`** - -v6.0.0 - -#### Returns - -(`string` \| `symbol`)[] - -#### Inherited from - -Protocol.eventNames - -#### Defined in - -node_modules/@types/node/events.d.ts:632 - -___ - -### getMaxListeners - -▸ **getMaxListeners**(): `number` - -Returns the current max listener value for the `EventEmitter` which is either -set by `emitter.setMaxListeners(n)` or defaults to [defaultMaxListeners](SNAP-1.md#defaultmaxlisteners). - -**`Since`** - -v1.0.0 - -#### Returns - -`number` - -#### Inherited from +#### Overrides -Protocol.getMaxListeners +Protocol.\_handleMessage #### Defined in -node_modules/@types/node/events.d.ts:489 +[packages/devp2p/src/protocol/snap.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L20) ___ @@ -357,7 +110,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/snap.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L85) +[packages/devp2p/src/protocol/snap.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L95) ___ @@ -371,506 +124,34 @@ ___ #### Defined in -[packages/devp2p/src/protocol/snap.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L89) - -___ - -### listenerCount - -▸ **listenerCount**(`eventName`): `number` - -Returns the number of listeners listening to the event named `eventName`. - -**`Since`** - -v3.2.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event being listened for | - -#### Returns - -`number` - -#### Inherited from - -Protocol.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:579 - -___ - -### listeners - -▸ **listeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -console.log(util.inspect(server.listeners('connection'))); -// Prints: [ [Function] ] -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -Protocol.listeners - -#### Defined in - -node_modules/@types/node/events.d.ts:502 - -___ - -### off - -▸ **off**(`eventName`, `listener`): [`SNAP`](SNAP-1.md) - -Alias for `emitter.removeListener()`. - -**`Since`** - -v10.0.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`SNAP`](SNAP-1.md) - -#### Inherited from - -Protocol.off - -#### Defined in - -node_modules/@types/node/events.d.ts:462 - -___ - -### on - -▸ **on**(`eventName`, `listener`): [`SNAP`](SNAP-1.md) - -Adds the `listener` function to the end of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.on('foo', () => console.log('a')); -myEE.prependListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.1.101 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`SNAP`](SNAP-1.md) - -#### Inherited from - -Protocol.on - -#### Defined in - -node_modules/@types/node/events.d.ts:348 - -___ - -### once - -▸ **once**(`eventName`, `listener`): [`SNAP`](SNAP-1.md) - -Adds a **one-time**`listener` function for the event named `eventName`. The -next time `eventName` is triggered, this listener is removed and then invoked. - -```js -server.once('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.once('foo', () => console.log('a')); -myEE.prependOnceListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.3.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`SNAP`](SNAP-1.md) - -#### Inherited from - -Protocol.once - -#### Defined in - -node_modules/@types/node/events.d.ts:377 +[packages/devp2p/src/protocol/snap.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L99) ___ -### prependListener - -▸ **prependListener**(`eventName`, `listener`): [`SNAP`](SNAP-1.md) - -Adds the `listener` function to the _beginning_ of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.prependListener('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** +### sendMessage -v6.0.0 +▸ **sendMessage**(`code`, `payload`): `void` #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | +| `code` | [`MESSAGE_CODES`](../enums/SNAP.MESSAGE_CODES.md) | Message code | +| `payload` | `any` | Payload (including reqId, e.g. `[1, [437000, 1, 0, 0]]`) | #### Returns -[`SNAP`](SNAP-1.md) - -#### Inherited from - -Protocol.prependListener +`void` #### Defined in -node_modules/@types/node/events.d.ts:597 +[packages/devp2p/src/protocol/snap.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L59) ___ -### prependOnceListener - -▸ **prependOnceListener**(`eventName`, `listener`): [`SNAP`](SNAP-1.md) - -Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this -listener is removed, and then invoked. - -```js -server.prependOnceListener('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters +### sendStatus -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`SNAP`](SNAP-1.md) - -#### Inherited from - -Protocol.prependOnceListener - -#### Defined in - -node_modules/@types/node/events.d.ts:613 - -___ - -### rawListeners - -▸ **rawListeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`, -including any wrappers (such as those created by `.once()`). - -```js -const emitter = new EventEmitter(); -emitter.once('log', () => console.log('log once')); - -// Returns a new Array with a function `onceWrapper` which has a property -// `listener` which contains the original listener bound above -const listeners = emitter.rawListeners('log'); -const logFnWrapper = listeners[0]; - -// Logs "log once" to the console and does not unbind the `once` event -logFnWrapper.listener(); - -// Logs "log once" to the console and removes the listener -logFnWrapper(); - -emitter.on('log', () => console.log('log persistently')); -// Will return a new Array with a single function bound by `.on()` above -const newListeners = emitter.rawListeners('log'); - -// Logs "log persistently" twice -newListeners[0](); -emitter.emit('log'); -``` - -**`Since`** - -v9.4.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -Protocol.rawListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:532 - -___ - -### removeAllListeners - -▸ **removeAllListeners**(`event?`): [`SNAP`](SNAP-1.md) - -Removes all listeners, or those of the specified `eventName`. - -It is bad practice to remove listeners added elsewhere in the code, -particularly when the `EventEmitter` instance was created by some other -component or module (e.g. sockets or file streams). - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event?` | `string` \| `symbol` | - -#### Returns - -[`SNAP`](SNAP-1.md) - -#### Inherited from - -Protocol.removeAllListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:473 - -___ - -### removeListener - -▸ **removeListener**(`eventName`, `listener`): [`SNAP`](SNAP-1.md) - -Removes the specified `listener` from the listener array for the event named`eventName`. - -```js -const callback = (stream) => { - console.log('someone connected!'); -}; -server.on('connection', callback); -// ... -server.removeListener('connection', callback); -``` - -`removeListener()` will remove, at most, one instance of a listener from the -listener array. If any single listener has been added multiple times to the -listener array for the specified `eventName`, then `removeListener()` must be -called multiple times to remove each instance. - -Once an event is emitted, all listeners attached to it at the -time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will -not remove them from`emit()` in progress. Subsequent events behave as expected. - -```js -const myEmitter = new MyEmitter(); - -const callbackA = () => { - console.log('A'); - myEmitter.removeListener('event', callbackB); -}; - -const callbackB = () => { - console.log('B'); -}; - -myEmitter.on('event', callbackA); - -myEmitter.on('event', callbackB); - -// callbackA removes listener callbackB but it will still be called. -// Internal listener array at time of emit [callbackA, callbackB] -myEmitter.emit('event'); -// Prints: -// A -// B - -// callbackB is now removed. -// Internal listener array [callbackA] -myEmitter.emit('event'); -// Prints: -// A -``` - -Because listeners are managed using an internal array, calling this will -change the position indices of any listener registered _after_ the listener -being removed. This will not impact the order in which listeners are called, -but it means that any copies of the listener array as returned by -the `emitter.listeners()` method will need to be recreated. - -When a single function has been added as a handler multiple times for a single -event (as in the example below), `removeListener()` will remove the most -recently added instance. In the example the `once('ping')`listener is removed: - -```js -const ee = new EventEmitter(); - -function pong() { - console.log('pong'); -} - -ee.on('ping', pong); -ee.once('ping', pong); -ee.removeListener('ping', pong); - -ee.emit('ping'); -ee.emit('ping'); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`SNAP`](SNAP-1.md) - -#### Inherited from - -Protocol.removeListener - -#### Defined in - -node_modules/@types/node/events.d.ts:457 - -___ - -### sendMessage - -▸ **sendMessage**(`code`, `payload`): `void` - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `code` | [`MESSAGE_CODES`](../enums/SNAP.MESSAGE_CODES.md) | Message code | -| `payload` | `any` | Payload (including reqId, e.g. `[1, [437000, 1, 0, 0]]`) | +▸ **sendStatus**(): `void` #### Returns @@ -878,410 +159,4 @@ ___ #### Defined in -[packages/devp2p/src/protocol/snap.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L53) - -___ - -### sendStatus - -▸ **sendStatus**(): `void` - -#### Returns - -`void` - -#### Defined in - -[packages/devp2p/src/protocol/snap.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L44) - -___ - -### setMaxListeners - -▸ **setMaxListeners**(`n`): [`SNAP`](SNAP-1.md) - -By default `EventEmitter`s will print a warning if more than `10` listeners are -added for a particular event. This is a useful default that helps finding -memory leaks. The `emitter.setMaxListeners()` method allows the limit to be -modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.3.5 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `n` | `number` | - -#### Returns - -[`SNAP`](SNAP-1.md) - -#### Inherited from - -Protocol.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:483 - -___ - -### getEventListeners - -▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -For `EventEmitter`s this behaves exactly the same as calling `.listeners` on -the emitter. - -For `EventTarget`s this is the only way to get the event listeners for the -event target. This is useful for debugging and diagnostic purposes. - -```js -const { getEventListeners, EventEmitter } = require('events'); - -{ - const ee = new EventEmitter(); - const listener = () => console.log('Events are fun'); - ee.on('foo', listener); - getEventListeners(ee, 'foo'); // [listener] -} -{ - const et = new EventTarget(); - const listener = () => console.log('Events are fun'); - et.addEventListener('foo', listener); - getEventListeners(et, 'foo'); // [listener] -} -``` - -**`Since`** - -v15.2.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `EventEmitter` \| `DOMEventTarget` | -| `name` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -Protocol.getEventListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:262 - -___ - -### listenerCount - -▸ `Static` **listenerCount**(`emitter`, `eventName`): `number` - -A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. - -```js -const { EventEmitter, listenerCount } = require('events'); -const myEmitter = new EventEmitter(); -myEmitter.on('event', () => {}); -myEmitter.on('event', () => {}); -console.log(listenerCount(myEmitter, 'event')); -// Prints: 2 -``` - -**`Since`** - -v0.9.12 - -**`Deprecated`** - -Since v3.2.0 - Use `listenerCount` instead. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | The emitter to query | -| `eventName` | `string` \| `symbol` | The event name | - -#### Returns - -`number` - -#### Inherited from - -Protocol.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:234 - -___ - -### on - -▸ `Static` **on**(`emitter`, `eventName`, `options?`): `AsyncIterableIterator`<`any`\> - -```js -const { on, EventEmitter } = require('events'); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo')) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); -``` - -Returns an `AsyncIterator` that iterates `eventName` events. It will throw -if the `EventEmitter` emits `'error'`. It removes all listeners when -exiting the loop. The `value` returned by each iteration is an array -composed of the emitted event arguments. - -An `AbortSignal` can be used to cancel waiting on events: - -```js -const { on, EventEmitter } = require('events'); -const ac = new AbortController(); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo', { signal: ac.signal })) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); - -process.nextTick(() => ac.abort()); -``` - -**`Since`** - -v13.6.0, v12.16.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | - | -| `eventName` | `string` | The name of the event being listened for | -| `options?` | `StaticEventEmitterOptions` | - | - -#### Returns - -`AsyncIterableIterator`<`any`\> - -that iterates `eventName` events emitted by the `emitter` - -#### Inherited from - -Protocol.on - -#### Defined in - -node_modules/@types/node/events.d.ts:217 - -___ - -### once - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given -event or that is rejected if the `EventEmitter` emits `'error'` while waiting. -The `Promise` will resolve with an array of all the arguments emitted to the -given event. - -This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event -semantics and does not listen to the `'error'` event. - -```js -const { once, EventEmitter } = require('events'); - -async function run() { - const ee = new EventEmitter(); - - process.nextTick(() => { - ee.emit('myevent', 42); - }); - - const [value] = await once(ee, 'myevent'); - console.log(value); - - const err = new Error('kaboom'); - process.nextTick(() => { - ee.emit('error', err); - }); - - try { - await once(ee, 'myevent'); - } catch (err) { - console.log('error happened', err); - } -} - -run(); -``` - -The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the -'`error'` event itself, then it is treated as any other kind of event without -special handling: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); - -once(ee, 'error') - .then(([err]) => console.log('ok', err.message)) - .catch((err) => console.log('error', err.message)); - -ee.emit('error', new Error('boom')); - -// Prints: ok boom -``` - -An `AbortSignal` can be used to cancel waiting for the event: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); -const ac = new AbortController(); - -async function foo(emitter, event, signal) { - try { - await once(emitter, event, { signal }); - console.log('event emitted!'); - } catch (error) { - if (error.name === 'AbortError') { - console.error('Waiting for the event was canceled!'); - } else { - console.error('There was an error', error.message); - } - } -} - -foo(ee, 'foo', ac.signal); -ac.abort(); // Abort waiting for the event -ee.emit('foo'); // Prints: Waiting for the event was canceled! -``` - -**`Since`** - -v11.13.0, v10.16.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `NodeEventTarget` | -| `eventName` | `string` \| `symbol` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -Protocol.once - -#### Defined in - -node_modules/@types/node/events.d.ts:157 - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `DOMEventTarget` | -| `eventName` | `string` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -Protocol.once - -#### Defined in - -node_modules/@types/node/events.d.ts:158 - -___ - -### setMaxListeners - -▸ `Static` **setMaxListeners**(`n?`, ...`eventTargets`): `void` - -```js -const { - setMaxListeners, - EventEmitter -} = require('events'); - -const target = new EventTarget(); -const emitter = new EventEmitter(); - -setMaxListeners(5, target, emitter); -``` - -**`Since`** - -v15.4.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `n?` | `number` | A non-negative number. The maximum number of listeners per `EventTarget` event. | -| `...eventTargets` | (`EventEmitter` \| `DOMEventTarget`)[] | - | - -#### Returns - -`void` - -#### Inherited from - -Protocol.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:280 +[packages/devp2p/src/protocol/snap.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L50) diff --git a/packages/devp2p/docs/classes/Server.md b/packages/devp2p/docs/classes/Server.md index 20b7907c6c..d258c97ed7 100644 --- a/packages/devp2p/docs/classes/Server.md +++ b/packages/devp2p/docs/classes/Server.md @@ -2,12 +2,6 @@ # Class: Server -## Hierarchy - -- `EventEmitter` - - ↳ **`Server`** - ## Table of contents ### Constructors @@ -16,49 +10,17 @@ ### Properties -- [\_debug](Server.md#_debug) -- [\_dpt](Server.md#_dpt) -- [\_endpoint](Server.md#_endpoint) -- [\_parityRequestMap](Server.md#_parityrequestmap) -- [\_privateKey](Server.md#_privatekey) -- [\_requests](Server.md#_requests) -- [\_requestsCache](Server.md#_requestscache) -- [\_socket](Server.md#_socket) -- [\_timeout](Server.md#_timeout) -- [captureRejectionSymbol](Server.md#capturerejectionsymbol) -- [captureRejections](Server.md#capturerejections) -- [defaultMaxListeners](Server.md#defaultmaxlisteners) -- [errorMonitor](Server.md#errormonitor) +- [events](Server.md#events) ### Methods - [\_handler](Server.md#_handler) - [\_isAliveCheck](Server.md#_isalivecheck) - [\_send](Server.md#_send) -- [addListener](Server.md#addlistener) - [bind](Server.md#bind) - [destroy](Server.md#destroy) -- [emit](Server.md#emit) -- [eventNames](Server.md#eventnames) - [findneighbours](Server.md#findneighbours) -- [getMaxListeners](Server.md#getmaxlisteners) -- [listenerCount](Server.md#listenercount) -- [listeners](Server.md#listeners) -- [off](Server.md#off) -- [on](Server.md#on) -- [once](Server.md#once) - [ping](Server.md#ping) -- [prependListener](Server.md#prependlistener) -- [prependOnceListener](Server.md#prependoncelistener) -- [rawListeners](Server.md#rawlisteners) -- [removeAllListeners](Server.md#removealllisteners) -- [removeListener](Server.md#removelistener) -- [setMaxListeners](Server.md#setmaxlisteners) -- [getEventListeners](Server.md#geteventlisteners) -- [listenerCount](Server.md#listenercount-1) -- [on](Server.md#on-1) -- [once](Server.md#once-1) -- [setMaxListeners](Server.md#setmaxlisteners-1) ## Constructors @@ -71,172 +33,22 @@ | Name | Type | | :------ | :------ | | `dpt` | [`DPT`](DPT.md) | -| `privateKey` | `Buffer` | +| `privateKey` | `Uint8Array` | | `options` | [`DPTServerOptions`](../interfaces/DPTServerOptions.md) | -#### Overrides - -EventEmitter.constructor - #### Defined in -[packages/devp2p/src/dpt/server.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L54) +[packages/devp2p/src/dpt/server.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L35) ## Properties -### \_debug - -• **\_debug**: `Debugger` - -#### Defined in - -[packages/devp2p/src/dpt/server.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L52) - -___ - -### \_dpt - -• **\_dpt**: [`DPT`](DPT.md) - -#### Defined in - -[packages/devp2p/src/dpt/server.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L44) - -___ - -### \_endpoint - -• **\_endpoint**: [`PeerInfo`](../interfaces/PeerInfo.md) - -#### Defined in - -[packages/devp2p/src/dpt/server.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L47) - -___ - -### \_parityRequestMap - -• **\_parityRequestMap**: `Map`<`string`, `string`\> - -#### Defined in - -[packages/devp2p/src/dpt/server.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L49) - -___ - -### \_privateKey - -• **\_privateKey**: `Buffer` - -#### Defined in - -[packages/devp2p/src/dpt/server.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L45) - -___ - -### \_requests - -• **\_requests**: `Map`<`string`, `any`\> - -#### Defined in - -[packages/devp2p/src/dpt/server.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L48) - -___ - -### \_requestsCache - -• **\_requestsCache**: `LRUCache`<`string`, `Promise`<`any`\>\> - -#### Defined in - -[packages/devp2p/src/dpt/server.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L50) - -___ - -### \_socket - -• **\_socket**: ``null`` \| `Socket` - -#### Defined in - -[packages/devp2p/src/dpt/server.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L51) - -___ - -### \_timeout - -• **\_timeout**: `number` - -#### Defined in - -[packages/devp2p/src/dpt/server.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L46) - -___ - -### captureRejectionSymbol - -▪ `Static` `Readonly` **captureRejectionSymbol**: typeof [`captureRejectionSymbol`](DPT.md#capturerejectionsymbol) - -#### Inherited from - -EventEmitter.captureRejectionSymbol - -#### Defined in - -node_modules/@types/node/events.d.ts:291 - -___ - -### captureRejections - -▪ `Static` **captureRejections**: `boolean` - -Sets or gets the default captureRejection value for all emitters. - -#### Inherited from - -EventEmitter.captureRejections - -#### Defined in - -node_modules/@types/node/events.d.ts:296 - -___ - -### defaultMaxListeners - -▪ `Static` **defaultMaxListeners**: `number` - -#### Inherited from - -EventEmitter.defaultMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:297 - -___ - -### errorMonitor +### events -▪ `Static` `Readonly` **errorMonitor**: typeof [`errorMonitor`](DPT.md#errormonitor) - -This symbol shall be used to install a listener for only monitoring `'error'` -events. Listeners installed using this symbol are called before the regular -`'error'` listeners are called. - -Installing a listener using this symbol does not change the behavior once an -`'error'` event is emitted, therefore the process will still crash if no -regular `'error'` listener is installed. - -#### Inherited from - -EventEmitter.errorMonitor +• **events**: `EventEmitter` #### Defined in -node_modules/@types/node/events.d.ts:290 +[packages/devp2p/src/dpt/server.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L25) ## Methods @@ -248,7 +60,7 @@ node_modules/@types/node/events.d.ts:290 | Name | Type | | :------ | :------ | -| `msg` | `Buffer` | +| `msg` | `Uint8Array` | | `rinfo` | `RemoteInfo` | #### Returns @@ -257,7 +69,7 @@ node_modules/@types/node/events.d.ts:290 #### Defined in -[packages/devp2p/src/dpt/server.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L171) +[packages/devp2p/src/dpt/server.ts:139](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L139) ___ @@ -271,13 +83,13 @@ ___ #### Defined in -[packages/devp2p/src/dpt/server.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L141) +[packages/devp2p/src/dpt/server.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L120) ___ ### \_send -▸ **_send**(`peer`, `typename`, `data`): `Buffer` +▸ **_send**(`peer`, `typename`, `data`): `Uint8Array` #### Parameters @@ -289,42 +101,11 @@ ___ #### Returns -`Buffer` - -#### Defined in - -[packages/devp2p/src/dpt/server.ts:145](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L145) - -___ - -### addListener - -▸ **addListener**(`eventName`, `listener`): [`Server`](Server.md) - -Alias for `emitter.on(eventName, listener)`. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`Server`](Server.md) - -#### Inherited from - -EventEmitter.addListener +`Uint8Array` #### Defined in -node_modules/@types/node/events.d.ts:317 +[packages/devp2p/src/dpt/server.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L124) ___ @@ -344,7 +125,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/server.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L83) +[packages/devp2p/src/dpt/server.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L62) ___ @@ -364,112 +145,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/server.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L90) - -___ - -### emit - -▸ **emit**(`eventName`, ...`args`): `boolean` - -Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments -to each. - -Returns `true` if the event had listeners, `false` otherwise. - -```js -const EventEmitter = require('events'); -const myEmitter = new EventEmitter(); - -// First listener -myEmitter.on('event', function firstListener() { - console.log('Helloooo! first listener'); -}); -// Second listener -myEmitter.on('event', function secondListener(arg1, arg2) { - console.log(`event with parameters ${arg1}, ${arg2} in second listener`); -}); -// Third listener -myEmitter.on('event', function thirdListener(...args) { - const parameters = args.join(', '); - console.log(`event with parameters ${parameters} in third listener`); -}); - -console.log(myEmitter.listeners('event')); - -myEmitter.emit('event', 1, 2, 3, 4, 5); - -// Prints: -// [ -// [Function: firstListener], -// [Function: secondListener], -// [Function: thirdListener] -// ] -// Helloooo! first listener -// event with parameters 1, 2 in second listener -// event with parameters 1, 2, 3, 4, 5 in third listener -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `...args` | `any`[] | - -#### Returns - -`boolean` - -#### Inherited from - -EventEmitter.emit - -#### Defined in - -node_modules/@types/node/events.d.ts:573 - -___ - -### eventNames - -▸ **eventNames**(): (`string` \| `symbol`)[] - -Returns an array listing the events for which the emitter has registered -listeners. The values in the array are strings or `Symbol`s. - -```js -const EventEmitter = require('events'); -const myEE = new EventEmitter(); -myEE.on('foo', () => {}); -myEE.on('bar', () => {}); - -const sym = Symbol('symbol'); -myEE.on(sym, () => {}); - -console.log(myEE.eventNames()); -// Prints: [ 'foo', 'bar', Symbol(symbol) ] -``` - -**`Since`** - -v6.0.0 - -#### Returns - -(`string` \| `symbol`)[] - -#### Inherited from - -EventEmitter.eventNames - -#### Defined in - -node_modules/@types/node/events.d.ts:632 +[packages/devp2p/src/dpt/server.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L69) ___ @@ -482,7 +158,7 @@ ___ | Name | Type | | :------ | :------ | | `peer` | [`PeerInfo`](../interfaces/PeerInfo.md) | -| `id` | `Buffer` | +| `id` | `Uint8Array` | #### Returns @@ -490,251 +166,19 @@ ___ #### Defined in -[packages/devp2p/src/dpt/server.ts:136](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L136) - -___ - -### getMaxListeners - -▸ **getMaxListeners**(): `number` - -Returns the current max listener value for the `EventEmitter` which is either -set by `emitter.setMaxListeners(n)` or defaults to [defaultMaxListeners](Server.md#defaultmaxlisteners). - -**`Since`** - -v1.0.0 - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.getMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:489 - -___ - -### listenerCount - -▸ **listenerCount**(`eventName`): `number` - -Returns the number of listeners listening to the event named `eventName`. - -**`Since`** - -v3.2.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event being listened for | - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:579 - -___ - -### listeners - -▸ **listeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -console.log(util.inspect(server.listeners('connection'))); -// Prints: [ [Function] ] -``` - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.listeners - -#### Defined in - -node_modules/@types/node/events.d.ts:502 +[packages/devp2p/src/dpt/server.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L115) ___ -### off - -▸ **off**(`eventName`, `listener`): [`Server`](Server.md) - -Alias for `emitter.removeListener()`. - -**`Since`** +### ping -v10.0.0 +▸ **ping**(`peer`): `Promise`<`any`\> #### Parameters | Name | Type | | :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`Server`](Server.md) - -#### Inherited from - -EventEmitter.off - -#### Defined in - -node_modules/@types/node/events.d.ts:462 - -___ - -### on - -▸ **on**(`eventName`, `listener`): [`Server`](Server.md) - -Adds the `listener` function to the end of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.on('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.on('foo', () => console.log('a')); -myEE.prependListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.1.101 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`Server`](Server.md) - -#### Inherited from - -EventEmitter.on - -#### Defined in - -node_modules/@types/node/events.d.ts:348 - -___ - -### once - -▸ **once**(`eventName`, `listener`): [`Server`](Server.md) - -Adds a **one-time**`listener` function for the event named `eventName`. The -next time `eventName` is triggered, this listener is removed and then invoked. - -```js -server.once('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the -event listener to the beginning of the listeners array. - -```js -const myEE = new EventEmitter(); -myEE.once('foo', () => console.log('a')); -myEE.prependOnceListener('foo', () => console.log('b')); -myEE.emit('foo'); -// Prints: -// b -// a -``` - -**`Since`** - -v0.3.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`Server`](Server.md) - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:377 - -___ - -### ping - -▸ **ping**(`peer`): `Promise`<`any`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `peer` | [`PeerInfo`](../interfaces/PeerInfo.md) | +| `peer` | [`PeerInfo`](../interfaces/PeerInfo.md) | #### Returns @@ -742,675 +186,4 @@ ___ #### Defined in -[packages/devp2p/src/dpt/server.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L100) - -___ - -### prependListener - -▸ **prependListener**(`eventName`, `listener`): [`Server`](Server.md) - -Adds the `listener` function to the _beginning_ of the listeners array for the -event named `eventName`. No checks are made to see if the `listener` has -already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple -times. - -```js -server.prependListener('connection', (stream) => { - console.log('someone connected!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`Server`](Server.md) - -#### Inherited from - -EventEmitter.prependListener - -#### Defined in - -node_modules/@types/node/events.d.ts:597 - -___ - -### prependOnceListener - -▸ **prependOnceListener**(`eventName`, `listener`): [`Server`](Server.md) - -Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this -listener is removed, and then invoked. - -```js -server.prependOnceListener('connection', (stream) => { - console.log('Ah, we have our first user!'); -}); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v6.0.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `eventName` | `string` \| `symbol` | The name of the event. | -| `listener` | (...`args`: `any`[]) => `void` | The callback function | - -#### Returns - -[`Server`](Server.md) - -#### Inherited from - -EventEmitter.prependOnceListener - -#### Defined in - -node_modules/@types/node/events.d.ts:613 - -___ - -### rawListeners - -▸ **rawListeners**(`eventName`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`, -including any wrappers (such as those created by `.once()`). - -```js -const emitter = new EventEmitter(); -emitter.once('log', () => console.log('log once')); - -// Returns a new Array with a function `onceWrapper` which has a property -// `listener` which contains the original listener bound above -const listeners = emitter.rawListeners('log'); -const logFnWrapper = listeners[0]; - -// Logs "log once" to the console and does not unbind the `once` event -logFnWrapper.listener(); - -// Logs "log once" to the console and removes the listener -logFnWrapper(); - -emitter.on('log', () => console.log('log persistently')); -// Will return a new Array with a single function bound by `.on()` above -const newListeners = emitter.rawListeners('log'); - -// Logs "log persistently" twice -newListeners[0](); -emitter.emit('log'); -``` - -**`Since`** - -v9.4.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.rawListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:532 - -___ - -### removeAllListeners - -▸ **removeAllListeners**(`event?`): [`Server`](Server.md) - -Removes all listeners, or those of the specified `eventName`. - -It is bad practice to remove listeners added elsewhere in the code, -particularly when the `EventEmitter` instance was created by some other -component or module (e.g. sockets or file streams). - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `event?` | `string` \| `symbol` | - -#### Returns - -[`Server`](Server.md) - -#### Inherited from - -EventEmitter.removeAllListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:473 - -___ - -### removeListener - -▸ **removeListener**(`eventName`, `listener`): [`Server`](Server.md) - -Removes the specified `listener` from the listener array for the event named`eventName`. - -```js -const callback = (stream) => { - console.log('someone connected!'); -}; -server.on('connection', callback); -// ... -server.removeListener('connection', callback); -``` - -`removeListener()` will remove, at most, one instance of a listener from the -listener array. If any single listener has been added multiple times to the -listener array for the specified `eventName`, then `removeListener()` must be -called multiple times to remove each instance. - -Once an event is emitted, all listeners attached to it at the -time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will -not remove them from`emit()` in progress. Subsequent events behave as expected. - -```js -const myEmitter = new MyEmitter(); - -const callbackA = () => { - console.log('A'); - myEmitter.removeListener('event', callbackB); -}; - -const callbackB = () => { - console.log('B'); -}; - -myEmitter.on('event', callbackA); - -myEmitter.on('event', callbackB); - -// callbackA removes listener callbackB but it will still be called. -// Internal listener array at time of emit [callbackA, callbackB] -myEmitter.emit('event'); -// Prints: -// A -// B - -// callbackB is now removed. -// Internal listener array [callbackA] -myEmitter.emit('event'); -// Prints: -// A -``` - -Because listeners are managed using an internal array, calling this will -change the position indices of any listener registered _after_ the listener -being removed. This will not impact the order in which listeners are called, -but it means that any copies of the listener array as returned by -the `emitter.listeners()` method will need to be recreated. - -When a single function has been added as a handler multiple times for a single -event (as in the example below), `removeListener()` will remove the most -recently added instance. In the example the `once('ping')`listener is removed: - -```js -const ee = new EventEmitter(); - -function pong() { - console.log('pong'); -} - -ee.on('ping', pong); -ee.once('ping', pong); -ee.removeListener('ping', pong); - -ee.emit('ping'); -ee.emit('ping'); -``` - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.1.26 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `eventName` | `string` \| `symbol` | -| `listener` | (...`args`: `any`[]) => `void` | - -#### Returns - -[`Server`](Server.md) - -#### Inherited from - -EventEmitter.removeListener - -#### Defined in - -node_modules/@types/node/events.d.ts:457 - -___ - -### setMaxListeners - -▸ **setMaxListeners**(`n`): [`Server`](Server.md) - -By default `EventEmitter`s will print a warning if more than `10` listeners are -added for a particular event. This is a useful default that helps finding -memory leaks. The `emitter.setMaxListeners()` method allows the limit to be -modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. - -Returns a reference to the `EventEmitter`, so that calls can be chained. - -**`Since`** - -v0.3.5 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `n` | `number` | - -#### Returns - -[`Server`](Server.md) - -#### Inherited from - -EventEmitter.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:483 - -___ - -### getEventListeners - -▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[] - -Returns a copy of the array of listeners for the event named `eventName`. - -For `EventEmitter`s this behaves exactly the same as calling `.listeners` on -the emitter. - -For `EventTarget`s this is the only way to get the event listeners for the -event target. This is useful for debugging and diagnostic purposes. - -```js -const { getEventListeners, EventEmitter } = require('events'); - -{ - const ee = new EventEmitter(); - const listener = () => console.log('Events are fun'); - ee.on('foo', listener); - getEventListeners(ee, 'foo'); // [listener] -} -{ - const et = new EventTarget(); - const listener = () => console.log('Events are fun'); - et.addEventListener('foo', listener); - getEventListeners(et, 'foo'); // [listener] -} -``` - -**`Since`** - -v15.2.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `EventEmitter` \| `DOMEventTarget` | -| `name` | `string` \| `symbol` | - -#### Returns - -`Function`[] - -#### Inherited from - -EventEmitter.getEventListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:262 - -___ - -### listenerCount - -▸ `Static` **listenerCount**(`emitter`, `eventName`): `number` - -A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. - -```js -const { EventEmitter, listenerCount } = require('events'); -const myEmitter = new EventEmitter(); -myEmitter.on('event', () => {}); -myEmitter.on('event', () => {}); -console.log(listenerCount(myEmitter, 'event')); -// Prints: 2 -``` - -**`Since`** - -v0.9.12 - -**`Deprecated`** - -Since v3.2.0 - Use `listenerCount` instead. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | The emitter to query | -| `eventName` | `string` \| `symbol` | The event name | - -#### Returns - -`number` - -#### Inherited from - -EventEmitter.listenerCount - -#### Defined in - -node_modules/@types/node/events.d.ts:234 - -___ - -### on - -▸ `Static` **on**(`emitter`, `eventName`, `options?`): `AsyncIterableIterator`<`any`\> - -```js -const { on, EventEmitter } = require('events'); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo')) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); -``` - -Returns an `AsyncIterator` that iterates `eventName` events. It will throw -if the `EventEmitter` emits `'error'`. It removes all listeners when -exiting the loop. The `value` returned by each iteration is an array -composed of the emitted event arguments. - -An `AbortSignal` can be used to cancel waiting on events: - -```js -const { on, EventEmitter } = require('events'); -const ac = new AbortController(); - -(async () => { - const ee = new EventEmitter(); - - // Emit later on - process.nextTick(() => { - ee.emit('foo', 'bar'); - ee.emit('foo', 42); - }); - - for await (const event of on(ee, 'foo', { signal: ac.signal })) { - // The execution of this inner block is synchronous and it - // processes one event at a time (even with await). Do not use - // if concurrent execution is required. - console.log(event); // prints ['bar'] [42] - } - // Unreachable here -})(); - -process.nextTick(() => ac.abort()); -``` - -**`Since`** - -v13.6.0, v12.16.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `emitter` | `EventEmitter` | - | -| `eventName` | `string` | The name of the event being listened for | -| `options?` | `StaticEventEmitterOptions` | - | - -#### Returns - -`AsyncIterableIterator`<`any`\> - -that iterates `eventName` events emitted by the `emitter` - -#### Inherited from - -EventEmitter.on - -#### Defined in - -node_modules/@types/node/events.d.ts:217 - -___ - -### once - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given -event or that is rejected if the `EventEmitter` emits `'error'` while waiting. -The `Promise` will resolve with an array of all the arguments emitted to the -given event. - -This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event -semantics and does not listen to the `'error'` event. - -```js -const { once, EventEmitter } = require('events'); - -async function run() { - const ee = new EventEmitter(); - - process.nextTick(() => { - ee.emit('myevent', 42); - }); - - const [value] = await once(ee, 'myevent'); - console.log(value); - - const err = new Error('kaboom'); - process.nextTick(() => { - ee.emit('error', err); - }); - - try { - await once(ee, 'myevent'); - } catch (err) { - console.log('error happened', err); - } -} - -run(); -``` - -The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the -'`error'` event itself, then it is treated as any other kind of event without -special handling: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); - -once(ee, 'error') - .then(([err]) => console.log('ok', err.message)) - .catch((err) => console.log('error', err.message)); - -ee.emit('error', new Error('boom')); - -// Prints: ok boom -``` - -An `AbortSignal` can be used to cancel waiting for the event: - -```js -const { EventEmitter, once } = require('events'); - -const ee = new EventEmitter(); -const ac = new AbortController(); - -async function foo(emitter, event, signal) { - try { - await once(emitter, event, { signal }); - console.log('event emitted!'); - } catch (error) { - if (error.name === 'AbortError') { - console.error('Waiting for the event was canceled!'); - } else { - console.error('There was an error', error.message); - } - } -} - -foo(ee, 'foo', ac.signal); -ac.abort(); // Abort waiting for the event -ee.emit('foo'); // Prints: Waiting for the event was canceled! -``` - -**`Since`** - -v11.13.0, v10.16.0 - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `NodeEventTarget` | -| `eventName` | `string` \| `symbol` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:157 - -▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `emitter` | `DOMEventTarget` | -| `eventName` | `string` | -| `options?` | `StaticEventEmitterOptions` | - -#### Returns - -`Promise`<`any`[]\> - -#### Inherited from - -EventEmitter.once - -#### Defined in - -node_modules/@types/node/events.d.ts:158 - -___ - -### setMaxListeners - -▸ `Static` **setMaxListeners**(`n?`, ...`eventTargets`): `void` - -```js -const { - setMaxListeners, - EventEmitter -} = require('events'); - -const target = new EventTarget(); -const emitter = new EventEmitter(); - -setMaxListeners(5, target, emitter); -``` - -**`Since`** - -v15.4.0 - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `n?` | `number` | A non-negative number. The maximum number of listeners per `EventTarget` event. | -| `...eventTargets` | (`EventEmitter` \| `DOMEventTarget`)[] | - | - -#### Returns - -`void` - -#### Inherited from - -EventEmitter.setMaxListeners - -#### Defined in - -node_modules/@types/node/events.d.ts:280 +[packages/devp2p/src/dpt/server.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L79) diff --git a/packages/devp2p/docs/enums/DISCONNECT_REASON.md b/packages/devp2p/docs/enums/DISCONNECT_REASON.md new file mode 100644 index 0000000000..291554602e --- /dev/null +++ b/packages/devp2p/docs/enums/DISCONNECT_REASON.md @@ -0,0 +1,151 @@ +[@ethereumjs/devp2p](../README.md) / DISCONNECT\_REASON + +# Enumeration: DISCONNECT\_REASON + +## Table of contents + +### Enumeration Members + +- [ALREADY\_CONNECTED](DISCONNECT_REASON.md#already_connected) +- [CLIENT\_QUITTING](DISCONNECT_REASON.md#client_quitting) +- [DISCONNECT\_REQUESTED](DISCONNECT_REASON.md#disconnect_requested) +- [INCOMPATIBLE\_VERSION](DISCONNECT_REASON.md#incompatible_version) +- [INVALID\_IDENTITY](DISCONNECT_REASON.md#invalid_identity) +- [NETWORK\_ERROR](DISCONNECT_REASON.md#network_error) +- [PROTOCOL\_ERROR](DISCONNECT_REASON.md#protocol_error) +- [SAME\_IDENTITY](DISCONNECT_REASON.md#same_identity) +- [SUBPROTOCOL\_ERROR](DISCONNECT_REASON.md#subprotocol_error) +- [TIMEOUT](DISCONNECT_REASON.md#timeout) +- [TOO\_MANY\_PEERS](DISCONNECT_REASON.md#too_many_peers) +- [UNEXPECTED\_IDENTITY](DISCONNECT_REASON.md#unexpected_identity) +- [USELESS\_PEER](DISCONNECT_REASON.md#useless_peer) + +## Enumeration Members + +### ALREADY\_CONNECTED + +• **ALREADY\_CONNECTED** = ``5`` + +#### Defined in + +[packages/devp2p/src/types.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L23) + +___ + +### CLIENT\_QUITTING + +• **CLIENT\_QUITTING** = ``8`` + +#### Defined in + +[packages/devp2p/src/types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L26) + +___ + +### DISCONNECT\_REQUESTED + +• **DISCONNECT\_REQUESTED** = ``0`` + +#### Defined in + +[packages/devp2p/src/types.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L18) + +___ + +### INCOMPATIBLE\_VERSION + +• **INCOMPATIBLE\_VERSION** = ``6`` + +#### Defined in + +[packages/devp2p/src/types.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L24) + +___ + +### INVALID\_IDENTITY + +• **INVALID\_IDENTITY** = ``7`` + +#### Defined in + +[packages/devp2p/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L25) + +___ + +### NETWORK\_ERROR + +• **NETWORK\_ERROR** = ``1`` + +#### Defined in + +[packages/devp2p/src/types.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L19) + +___ + +### PROTOCOL\_ERROR + +• **PROTOCOL\_ERROR** = ``2`` + +#### Defined in + +[packages/devp2p/src/types.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L20) + +___ + +### SAME\_IDENTITY + +• **SAME\_IDENTITY** = ``10`` + +#### Defined in + +[packages/devp2p/src/types.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L28) + +___ + +### SUBPROTOCOL\_ERROR + +• **SUBPROTOCOL\_ERROR** = ``16`` + +#### Defined in + +[packages/devp2p/src/types.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L30) + +___ + +### TIMEOUT + +• **TIMEOUT** = ``11`` + +#### Defined in + +[packages/devp2p/src/types.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L29) + +___ + +### TOO\_MANY\_PEERS + +• **TOO\_MANY\_PEERS** = ``4`` + +#### Defined in + +[packages/devp2p/src/types.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L22) + +___ + +### UNEXPECTED\_IDENTITY + +• **UNEXPECTED\_IDENTITY** = ``9`` + +#### Defined in + +[packages/devp2p/src/types.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L27) + +___ + +### USELESS\_PEER + +• **USELESS\_PEER** = ``3`` + +#### Defined in + +[packages/devp2p/src/types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L21) diff --git a/packages/devp2p/docs/enums/DISCONNECT_REASONS.md b/packages/devp2p/docs/enums/DISCONNECT_REASONS.md deleted file mode 100644 index 4f653e90e5..0000000000 --- a/packages/devp2p/docs/enums/DISCONNECT_REASONS.md +++ /dev/null @@ -1,151 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / DISCONNECT\_REASONS - -# Enumeration: DISCONNECT\_REASONS - -## Table of contents - -### Enumeration Members - -- [ALREADY\_CONNECTED](DISCONNECT_REASONS.md#already_connected) -- [CLIENT\_QUITTING](DISCONNECT_REASONS.md#client_quitting) -- [DISCONNECT\_REQUESTED](DISCONNECT_REASONS.md#disconnect_requested) -- [INCOMPATIBLE\_VERSION](DISCONNECT_REASONS.md#incompatible_version) -- [INVALID\_IDENTITY](DISCONNECT_REASONS.md#invalid_identity) -- [NETWORK\_ERROR](DISCONNECT_REASONS.md#network_error) -- [PROTOCOL\_ERROR](DISCONNECT_REASONS.md#protocol_error) -- [SAME\_IDENTITY](DISCONNECT_REASONS.md#same_identity) -- [SUBPROTOCOL\_ERROR](DISCONNECT_REASONS.md#subprotocol_error) -- [TIMEOUT](DISCONNECT_REASONS.md#timeout) -- [TOO\_MANY\_PEERS](DISCONNECT_REASONS.md#too_many_peers) -- [UNEXPECTED\_IDENTITY](DISCONNECT_REASONS.md#unexpected_identity) -- [USELESS\_PEER](DISCONNECT_REASONS.md#useless_peer) - -## Enumeration Members - -### ALREADY\_CONNECTED - -• **ALREADY\_CONNECTED** = ``5`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L39) - -___ - -### CLIENT\_QUITTING - -• **CLIENT\_QUITTING** = ``8`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L42) - -___ - -### DISCONNECT\_REQUESTED - -• **DISCONNECT\_REQUESTED** = ``0`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L34) - -___ - -### INCOMPATIBLE\_VERSION - -• **INCOMPATIBLE\_VERSION** = ``6`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L40) - -___ - -### INVALID\_IDENTITY - -• **INVALID\_IDENTITY** = ``7`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L41) - -___ - -### NETWORK\_ERROR - -• **NETWORK\_ERROR** = ``1`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L35) - -___ - -### PROTOCOL\_ERROR - -• **PROTOCOL\_ERROR** = ``2`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L36) - -___ - -### SAME\_IDENTITY - -• **SAME\_IDENTITY** = ``10`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L44) - -___ - -### SUBPROTOCOL\_ERROR - -• **SUBPROTOCOL\_ERROR** = ``16`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L46) - -___ - -### TIMEOUT - -• **TIMEOUT** = ``11`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L45) - -___ - -### TOO\_MANY\_PEERS - -• **TOO\_MANY\_PEERS** = ``4`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L38) - -___ - -### UNEXPECTED\_IDENTITY - -• **UNEXPECTED\_IDENTITY** = ``9`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L43) - -___ - -### USELESS\_PEER - -• **USELESS\_PEER** = ``3`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L37) diff --git a/packages/devp2p/docs/enums/ETH.MESSAGE_CODES.md b/packages/devp2p/docs/enums/ETH.MESSAGE_CODES.md index 7ce52bc754..db593f4dc0 100644 --- a/packages/devp2p/docs/enums/ETH.MESSAGE_CODES.md +++ b/packages/devp2p/docs/enums/ETH.MESSAGE_CODES.md @@ -32,7 +32,7 @@ #### Defined in -[packages/devp2p/src/protocol/eth.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L370) +[packages/devp2p/src/protocol/eth.ts:393](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L393) ___ @@ -42,7 +42,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:368](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L368) +[packages/devp2p/src/protocol/eth.ts:391](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L391) ___ @@ -52,7 +52,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:369](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L369) +[packages/devp2p/src/protocol/eth.ts:392](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L392) ___ @@ -62,7 +62,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:367](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L367) +[packages/devp2p/src/protocol/eth.ts:390](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L390) ___ @@ -72,7 +72,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:374](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L374) +[packages/devp2p/src/protocol/eth.ts:397](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L397) ___ @@ -82,7 +82,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:381](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L381) +[packages/devp2p/src/protocol/eth.ts:404](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L404) ___ @@ -92,7 +92,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:376](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L376) +[packages/devp2p/src/protocol/eth.ts:399](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L399) ___ @@ -102,7 +102,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:371](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L371) +[packages/devp2p/src/protocol/eth.ts:394](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L394) ___ @@ -112,7 +112,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:365](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L365) +[packages/devp2p/src/protocol/eth.ts:388](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L388) ___ @@ -122,7 +122,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:380](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L380) +[packages/devp2p/src/protocol/eth.ts:403](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L403) ___ @@ -132,7 +132,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:375](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L375) +[packages/devp2p/src/protocol/eth.ts:398](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L398) ___ @@ -142,7 +142,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:382](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L382) +[packages/devp2p/src/protocol/eth.ts:405](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L405) ___ @@ -152,7 +152,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:377](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L377) +[packages/devp2p/src/protocol/eth.ts:400](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L400) ___ @@ -162,7 +162,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:364](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L364) +[packages/devp2p/src/protocol/eth.ts:387](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L387) ___ @@ -172,4 +172,4 @@ ___ #### Defined in -[packages/devp2p/src/protocol/eth.ts:366](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L366) +[packages/devp2p/src/protocol/eth.ts:389](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L389) diff --git a/packages/devp2p/docs/enums/LES.MESSAGE_CODES.md b/packages/devp2p/docs/enums/LES.MESSAGE_CODES.md index 8be034bfcc..4903e8a946 100644 --- a/packages/devp2p/docs/enums/LES.MESSAGE_CODES.md +++ b/packages/devp2p/docs/enums/LES.MESSAGE_CODES.md @@ -41,7 +41,7 @@ #### Defined in -[packages/devp2p/src/protocol/les.ts:283](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L283) +[packages/devp2p/src/protocol/les.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L304) ___ @@ -51,7 +51,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:287](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L287) +[packages/devp2p/src/protocol/les.ts:308](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L308) ___ @@ -61,7 +61,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L285) +[packages/devp2p/src/protocol/les.ts:306](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L306) ___ @@ -71,7 +71,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:293](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L293) +[packages/devp2p/src/protocol/les.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L314) ___ @@ -81,7 +81,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:286](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L286) +[packages/devp2p/src/protocol/les.ts:307](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L307) ___ @@ -91,7 +91,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L284) +[packages/devp2p/src/protocol/les.ts:305](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L305) ___ @@ -101,7 +101,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L292) +[packages/devp2p/src/protocol/les.ts:313](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L313) ___ @@ -111,7 +111,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:294](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L294) +[packages/devp2p/src/protocol/les.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L315) ___ @@ -121,7 +121,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:301](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L301) +[packages/devp2p/src/protocol/les.ts:322](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L322) ___ @@ -131,7 +131,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:290](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L290) +[packages/devp2p/src/protocol/les.ts:311](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L311) ___ @@ -141,7 +141,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:299](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L299) +[packages/devp2p/src/protocol/les.ts:320](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L320) ___ @@ -151,7 +151,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:288](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L288) +[packages/devp2p/src/protocol/les.ts:309](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L309) ___ @@ -161,7 +161,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:304](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L304) +[packages/devp2p/src/protocol/les.ts:325](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L325) ___ @@ -171,7 +171,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:295](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L295) +[packages/devp2p/src/protocol/les.ts:316](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L316) ___ @@ -181,7 +181,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:302](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L302) +[packages/devp2p/src/protocol/les.ts:323](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L323) ___ @@ -191,7 +191,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:291](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L291) +[packages/devp2p/src/protocol/les.ts:312](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L312) ___ @@ -201,7 +201,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:300](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L300) +[packages/devp2p/src/protocol/les.ts:321](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L321) ___ @@ -211,7 +211,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L289) +[packages/devp2p/src/protocol/les.ts:310](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L310) ___ @@ -221,7 +221,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:309](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L309) +[packages/devp2p/src/protocol/les.ts:330](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L330) ___ @@ -231,7 +231,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:296](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L296) +[packages/devp2p/src/protocol/les.ts:317](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L317) ___ @@ -241,7 +241,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L303) +[packages/devp2p/src/protocol/les.ts:324](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L324) ___ @@ -251,7 +251,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L282) +[packages/devp2p/src/protocol/les.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L303) ___ @@ -261,7 +261,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:308](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L308) +[packages/devp2p/src/protocol/les.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L329) ___ @@ -271,4 +271,4 @@ ___ #### Defined in -[packages/devp2p/src/protocol/les.ts:305](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L305) +[packages/devp2p/src/protocol/les.ts:326](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L326) diff --git a/packages/devp2p/docs/enums/PREFIXES.md b/packages/devp2p/docs/enums/PREFIXES.md deleted file mode 100644 index 5f1af856b4..0000000000 --- a/packages/devp2p/docs/enums/PREFIXES.md +++ /dev/null @@ -1,52 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / PREFIXES - -# Enumeration: PREFIXES - -## Table of contents - -### Enumeration Members - -- [DISCONNECT](PREFIXES.md#disconnect) -- [HELLO](PREFIXES.md#hello) -- [PING](PREFIXES.md#ping) -- [PONG](PREFIXES.md#pong) - -## Enumeration Members - -### DISCONNECT - -• **DISCONNECT** = ``1`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L28) - -___ - -### HELLO - -• **HELLO** = ``0`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L27) - -___ - -### PING - -• **PING** = ``2`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L29) - -___ - -### PONG - -• **PONG** = ``3`` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L30) diff --git a/packages/devp2p/docs/enums/ProtocolType.md b/packages/devp2p/docs/enums/ProtocolType.md new file mode 100644 index 0000000000..ac5c7d5a44 --- /dev/null +++ b/packages/devp2p/docs/enums/ProtocolType.md @@ -0,0 +1,41 @@ +[@ethereumjs/devp2p](../README.md) / ProtocolType + +# Enumeration: ProtocolType + +## Table of contents + +### Enumeration Members + +- [ETH](ProtocolType.md#eth) +- [LES](ProtocolType.md#les) +- [SNAP](ProtocolType.md#snap) + +## Enumeration Members + +### ETH + +• **ETH** = ``"eth"`` + +#### Defined in + +[packages/devp2p/src/types.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L131) + +___ + +### LES + +• **LES** = ``"les"`` + +#### Defined in + +[packages/devp2p/src/types.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L132) + +___ + +### SNAP + +• **SNAP** = ``"snap"`` + +#### Defined in + +[packages/devp2p/src/types.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L133) diff --git a/packages/devp2p/docs/enums/SNAP.MESSAGE_CODES.md b/packages/devp2p/docs/enums/SNAP.MESSAGE_CODES.md index 32962e8f77..41049cbe35 100644 --- a/packages/devp2p/docs/enums/SNAP.MESSAGE_CODES.md +++ b/packages/devp2p/docs/enums/SNAP.MESSAGE_CODES.md @@ -25,7 +25,7 @@ #### Defined in -[packages/devp2p/src/protocol/snap.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L98) +[packages/devp2p/src/protocol/snap.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L108) ___ @@ -35,7 +35,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/snap.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L102) +[packages/devp2p/src/protocol/snap.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L112) ___ @@ -45,7 +45,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/snap.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L97) +[packages/devp2p/src/protocol/snap.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L107) ___ @@ -55,7 +55,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/snap.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L101) +[packages/devp2p/src/protocol/snap.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L111) ___ @@ -65,7 +65,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/snap.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L99) +[packages/devp2p/src/protocol/snap.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L109) ___ @@ -75,7 +75,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/snap.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L103) +[packages/devp2p/src/protocol/snap.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L113) ___ @@ -85,7 +85,7 @@ ___ #### Defined in -[packages/devp2p/src/protocol/snap.ts:100](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L100) +[packages/devp2p/src/protocol/snap.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L110) ___ @@ -95,4 +95,4 @@ ___ #### Defined in -[packages/devp2p/src/protocol/snap.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L104) +[packages/devp2p/src/protocol/snap.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/snap.ts#L114) diff --git a/packages/devp2p/docs/interfaces/Capabilities.md b/packages/devp2p/docs/interfaces/Capabilities.md index 599369c5aa..dffac336c9 100644 --- a/packages/devp2p/docs/interfaces/Capabilities.md +++ b/packages/devp2p/docs/interfaces/Capabilities.md @@ -15,11 +15,11 @@ ### constructor -• **constructor**: [`ProtocolConstructor`](ProtocolConstructor.md) +• **constructor**: `ProtocolConstructor` #### Defined in -[packages/devp2p/src/rlpx/peer.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L72) +[packages/devp2p/src/types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L14) ___ @@ -29,7 +29,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/peer.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L71) +[packages/devp2p/src/types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L13) ___ @@ -39,7 +39,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/peer.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L69) +[packages/devp2p/src/types.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L11) ___ @@ -49,4 +49,4 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/peer.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L70) +[packages/devp2p/src/types.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L12) diff --git a/packages/devp2p/docs/interfaces/Contact.md b/packages/devp2p/docs/interfaces/Contact.md new file mode 100644 index 0000000000..a18e387e22 --- /dev/null +++ b/packages/devp2p/docs/interfaces/Contact.md @@ -0,0 +1,89 @@ +[@ethereumjs/devp2p](../README.md) / Contact + +# Interface: Contact + +## Hierarchy + +- [`PeerInfo`](PeerInfo.md) + + ↳ **`Contact`** + +## Table of contents + +### Properties + +- [address](Contact.md#address) +- [id](Contact.md#id) +- [tcpPort](Contact.md#tcpport) +- [udpPort](Contact.md#udpport) +- [vectorClock](Contact.md#vectorclock) + +## Properties + +### address + +• `Optional` **address**: `string` + +#### Inherited from + +[PeerInfo](PeerInfo.md).[address](PeerInfo.md#address) + +#### Defined in + +[packages/devp2p/src/types.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L174) + +___ + +### id + +• **id**: `Uint8Array` + +#### Overrides + +[PeerInfo](PeerInfo.md).[id](PeerInfo.md#id) + +#### Defined in + +[packages/devp2p/src/types.ts:181](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L181) + +___ + +### tcpPort + +• `Optional` **tcpPort**: ``null`` \| `number` + +#### Inherited from + +[PeerInfo](PeerInfo.md).[tcpPort](PeerInfo.md#tcpport) + +#### Defined in + +[packages/devp2p/src/types.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L176) + +___ + +### udpPort + +• `Optional` **udpPort**: ``null`` \| `number` + +#### Inherited from + +[PeerInfo](PeerInfo.md).[udpPort](PeerInfo.md#udpport) + +#### Defined in + +[packages/devp2p/src/types.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L175) + +___ + +### vectorClock + +• **vectorClock**: `number` + +#### Overrides + +[PeerInfo](PeerInfo.md).[vectorClock](PeerInfo.md#vectorclock) + +#### Defined in + +[packages/devp2p/src/types.ts:182](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L182) diff --git a/packages/devp2p/docs/interfaces/CustomContact.md b/packages/devp2p/docs/interfaces/CustomContact.md deleted file mode 100644 index 89cc17cf9e..0000000000 --- a/packages/devp2p/docs/interfaces/CustomContact.md +++ /dev/null @@ -1,85 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / CustomContact - -# Interface: CustomContact - -## Hierarchy - -- [`PeerInfo`](PeerInfo.md) - - ↳ **`CustomContact`** - -## Table of contents - -### Properties - -- [address](CustomContact.md#address) -- [id](CustomContact.md#id) -- [tcpPort](CustomContact.md#tcpport) -- [udpPort](CustomContact.md#udpport) -- [vectorClock](CustomContact.md#vectorclock) - -## Properties - -### address - -• `Optional` **address**: `string` - -#### Inherited from - -[PeerInfo](PeerInfo.md).[address](PeerInfo.md#address) - -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L19) - -___ - -### id - -• **id**: `Uint8Array` \| `Buffer` - -#### Overrides - -[PeerInfo](PeerInfo.md).[id](PeerInfo.md#id) - -#### Defined in - -[packages/devp2p/src/dpt/kbucket.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L10) - -___ - -### tcpPort - -• `Optional` **tcpPort**: ``null`` \| `number` - -#### Inherited from - -[PeerInfo](PeerInfo.md).[tcpPort](PeerInfo.md#tcpport) - -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L21) - -___ - -### udpPort - -• `Optional` **udpPort**: ``null`` \| `number` - -#### Inherited from - -[PeerInfo](PeerInfo.md).[udpPort](PeerInfo.md#udpport) - -#### Defined in - -[packages/devp2p/src/dpt/dpt.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L20) - -___ - -### vectorClock - -• **vectorClock**: `number` - -#### Defined in - -[packages/devp2p/src/dpt/kbucket.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/kbucket.ts#L11) diff --git a/packages/devp2p/docs/interfaces/DPTOptions.md b/packages/devp2p/docs/interfaces/DPTOptions.md index b9f74fa10e..27e19bb424 100644 --- a/packages/devp2p/docs/interfaces/DPTOptions.md +++ b/packages/devp2p/docs/interfaces/DPTOptions.md @@ -28,7 +28,7 @@ Default: dgram-created socket #### Defined in -[packages/devp2p/src/dpt/dpt.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L44) +[packages/devp2p/src/types.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L62) ___ @@ -40,7 +40,7 @@ DNS server to query DNS TXT records from for peer discovery #### Defined in -[packages/devp2p/src/dpt/dpt.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L86) +[packages/devp2p/src/types.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L104) ___ @@ -54,7 +54,7 @@ Default: (network dependent) #### Defined in -[packages/devp2p/src/dpt/dpt.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L81) +[packages/devp2p/src/types.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L99) ___ @@ -69,7 +69,7 @@ Default: 25 #### Defined in -[packages/devp2p/src/dpt/dpt.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L74) +[packages/devp2p/src/types.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L92) ___ @@ -83,7 +83,7 @@ Default: 0.0.0.0, no UDP or TCP port provided #### Defined in -[packages/devp2p/src/dpt/dpt.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L37) +[packages/devp2p/src/types.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L55) ___ @@ -97,7 +97,7 @@ Default: 60s #### Defined in -[packages/devp2p/src/dpt/dpt.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L51) +[packages/devp2p/src/types.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L69) ___ @@ -112,7 +112,7 @@ Default: true #### Defined in -[packages/devp2p/src/dpt/dpt.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L59) +[packages/devp2p/src/types.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L77) ___ @@ -126,7 +126,7 @@ Default: false #### Defined in -[packages/devp2p/src/dpt/dpt.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L66) +[packages/devp2p/src/types.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L84) ___ @@ -140,4 +140,4 @@ Default: 10s #### Defined in -[packages/devp2p/src/dpt/dpt.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L30) +[packages/devp2p/src/types.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L48) diff --git a/packages/devp2p/docs/interfaces/DPTServerOptions.md b/packages/devp2p/docs/interfaces/DPTServerOptions.md index 9a299dba3e..0975b398e4 100644 --- a/packages/devp2p/docs/interfaces/DPTServerOptions.md +++ b/packages/devp2p/docs/interfaces/DPTServerOptions.md @@ -22,7 +22,7 @@ Default: dgram-created socket #### Defined in -[packages/devp2p/src/dpt/server.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L40) +[packages/devp2p/src/types.ts:127](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L127) ___ @@ -36,7 +36,7 @@ Default: 0.0.0.0, no UDP or TCP port provided #### Defined in -[packages/devp2p/src/dpt/server.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L33) +[packages/devp2p/src/types.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L120) ___ @@ -50,4 +50,4 @@ Default: 10s #### Defined in -[packages/devp2p/src/dpt/server.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/server.ts#L26) +[packages/devp2p/src/types.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L113) diff --git a/packages/devp2p/docs/interfaces/ETH.StatusMsg.md b/packages/devp2p/docs/interfaces/ETH.StatusMsg.md index 39cd8944a0..472f8d5234 100644 --- a/packages/devp2p/docs/interfaces/ETH.StatusMsg.md +++ b/packages/devp2p/docs/interfaces/ETH.StatusMsg.md @@ -6,7 +6,7 @@ ## Hierarchy -- `Array`<`Buffer` \| `Buffer`[]\> +- `Array`<`Uint8Array` \| `Uint8Array`[]\> ↳ **`StatusMsg`** @@ -73,17 +73,17 @@ node_modules/typescript/lib/lib.es5.d.ts:1279 ### [iterator] -▸ **[iterator]**(): `IterableIterator`<`Buffer` \| `Buffer`[]\> +▸ **[iterator]**(): `IterableIterator`<`Uint8Array` \| `Uint8Array`[]\> Iterator #### Returns -`IterableIterator`<`Buffer` \| `Buffer`[]\> +`IterableIterator`<`Uint8Array` \| `Uint8Array`[]\> #### Inherited from -Array.\_\_@iterator@89 +Array.\_\_@iterator@111 #### Defined in @@ -114,7 +114,7 @@ when they will be absent when used in a 'with' statement. #### Inherited from -Array.\_\_@unscopables@91 +Array.\_\_@unscopables@113 #### Defined in @@ -124,7 +124,7 @@ ___ ### at -▸ **at**(`index`): `undefined` \| `Buffer` \| `Buffer`[] +▸ **at**(`index`): `undefined` \| `Uint8Array` \| `Uint8Array`[] Takes an integer value and returns the item at that index, allowing for positive and negative integers. @@ -138,7 +138,7 @@ Negative integers count back from the last item in the array. #### Returns -`undefined` \| `Buffer` \| `Buffer`[] +`undefined` \| `Uint8Array` \| `Uint8Array`[] #### Inherited from @@ -146,13 +146,13 @@ Array.at #### Defined in -node_modules/@types/node/globals.d.ts:86 +node_modules/@types/node/ts4.8/globals.d.ts:86 ___ ### concat -▸ **concat**(...`items`): (`Buffer` \| `Buffer`[])[] +▸ **concat**(...`items`): (`Uint8Array` \| `Uint8Array`[])[] Combines two or more arrays. This method returns a new array without modifying any existing arrays. @@ -161,11 +161,11 @@ This method returns a new array without modifying any existing arrays. | Name | Type | Description | | :------ | :------ | :------ | -| `...items` | `ConcatArray`<`Buffer` \| `Buffer`[]\>[] | Additional arrays and/or items to add to the end of the array. | +| `...items` | `ConcatArray`<`Uint8Array` \| `Uint8Array`[]\>[] | Additional arrays and/or items to add to the end of the array. | #### Returns -(`Buffer` \| `Buffer`[])[] +(`Uint8Array` \| `Uint8Array`[])[] #### Inherited from @@ -175,7 +175,7 @@ Array.concat node_modules/typescript/lib/lib.es5.d.ts:1303 -▸ **concat**(...`items`): (`Buffer` \| `Buffer`[])[] +▸ **concat**(...`items`): (`Uint8Array` \| `Uint8Array`[])[] Combines two or more arrays. This method returns a new array without modifying any existing arrays. @@ -184,11 +184,11 @@ This method returns a new array without modifying any existing arrays. | Name | Type | Description | | :------ | :------ | :------ | -| `...items` | (`Buffer` \| `Buffer`[] \| `ConcatArray`<`Buffer` \| `Buffer`[]\>)[] | Additional arrays and/or items to add to the end of the array. | +| `...items` | (`Uint8Array` \| `Uint8Array`[] \| `ConcatArray`<`Uint8Array` \| `Uint8Array`[]\>)[] | Additional arrays and/or items to add to the end of the array. | #### Returns -(`Buffer` \| `Buffer`[])[] +(`Uint8Array` \| `Uint8Array`[])[] #### Inherited from @@ -231,13 +231,13 @@ ___ ### entries -▸ **entries**(): `IterableIterator`<[`number`, `Buffer` \| `Buffer`[]]\> +▸ **entries**(): `IterableIterator`<[`number`, `Uint8Array` \| `Uint8Array`[]]\> Returns an iterable of key, value pairs for every entry in the array #### Returns -`IterableIterator`<[`number`, `Buffer` \| `Buffer`[]]\> +`IterableIterator`<[`number`, `Uint8Array` \| `Uint8Array`[]]\> #### Inherited from @@ -259,13 +259,13 @@ Determines whether all the members of an array satisfy the specified test. | Name | Type | | :------ | :------ | -| `S` | extends `Buffer` \| `Buffer`[] | +| `S` | extends `Uint8Array` \| `Uint8Array`[] | #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `predicate` | (`value`: `Buffer` \| `Buffer`[], `index`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => value is S | A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array. | +| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => value is S | A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array. | | `thisArg?` | `any` | An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. | #### Returns @@ -288,7 +288,7 @@ Determines whether all the members of an array satisfy the specified test. | Name | Type | Description | | :------ | :------ | :------ | -| `predicate` | (`value`: `Buffer` \| `Buffer`[], `index`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `unknown` | A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array. | +| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `unknown` | A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array. | | `thisArg?` | `any` | An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. | #### Returns @@ -315,7 +315,7 @@ Changes all array elements from `start` to `end` index to a static `value` and r | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `Buffer` \| `Buffer`[] | value to fill array section with | +| `value` | `Uint8Array` \| `Uint8Array`[] | value to fill array section with | | `start?` | `number` | index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array. | | `end?` | `number` | index to stop filling the array at. If end is negative, it is treated as length+end. | @@ -343,13 +343,13 @@ Returns the elements of an array that meet the condition specified in a callback | Name | Type | | :------ | :------ | -| `S` | extends `Buffer` \| `Buffer`[] | +| `S` | extends `Uint8Array` \| `Uint8Array`[] | #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `predicate` | (`value`: `Buffer` \| `Buffer`[], `index`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => value is S | A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. | +| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => value is S | A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. | | `thisArg?` | `any` | An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. | #### Returns @@ -364,7 +364,7 @@ Array.filter node_modules/typescript/lib/lib.es5.d.ts:1422 -▸ **filter**(`predicate`, `thisArg?`): (`Buffer` \| `Buffer`[])[] +▸ **filter**(`predicate`, `thisArg?`): (`Uint8Array` \| `Uint8Array`[])[] Returns the elements of an array that meet the condition specified in a callback function. @@ -372,12 +372,12 @@ Returns the elements of an array that meet the condition specified in a callback | Name | Type | Description | | :------ | :------ | :------ | -| `predicate` | (`value`: `Buffer` \| `Buffer`[], `index`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `unknown` | A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. | +| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `unknown` | A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. | | `thisArg?` | `any` | An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. | #### Returns -(`Buffer` \| `Buffer`[])[] +(`Uint8Array` \| `Uint8Array`[])[] #### Inherited from @@ -400,13 +400,13 @@ otherwise. | Name | Type | | :------ | :------ | -| `S` | extends `Buffer` \| `Buffer`[] | +| `S` | extends `Uint8Array` \| `Uint8Array`[] | #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `predicate` | (`this`: `void`, `value`: `Buffer` \| `Buffer`[], `index`: `number`, `obj`: (`Buffer` \| `Buffer`[])[]) => value is S | find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined. | +| `predicate` | (`this`: `void`, `value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `obj`: (`Uint8Array` \| `Uint8Array`[])[]) => value is S | find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined. | | `thisArg?` | `any` | If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. | #### Returns @@ -421,18 +421,18 @@ Array.find node_modules/typescript/lib/lib.es2015.core.d.ts:31 -▸ **find**(`predicate`, `thisArg?`): `undefined` \| `Buffer` \| `Buffer`[] +▸ **find**(`predicate`, `thisArg?`): `undefined` \| `Uint8Array` \| `Uint8Array`[] #### Parameters | Name | Type | | :------ | :------ | -| `predicate` | (`value`: `Buffer` \| `Buffer`[], `index`: `number`, `obj`: (`Buffer` \| `Buffer`[])[]) => `unknown` | +| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `obj`: (`Uint8Array` \| `Uint8Array`[])[]) => `unknown` | | `thisArg?` | `any` | #### Returns -`undefined` \| `Buffer` \| `Buffer`[] +`undefined` \| `Uint8Array` \| `Uint8Array`[] #### Inherited from @@ -455,7 +455,7 @@ otherwise. | Name | Type | Description | | :------ | :------ | :------ | -| `predicate` | (`value`: `Buffer` \| `Buffer`[], `index`: `number`, `obj`: (`Buffer` \| `Buffer`[])[]) => `unknown` | find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1. | +| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `obj`: (`Uint8Array` \| `Uint8Array`[])[]) => `unknown` | find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1. | | `thisArg?` | `any` | If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. | #### Returns @@ -526,7 +526,7 @@ This is identical to a map followed by flat with depth 1. | Name | Type | Description | | :------ | :------ | :------ | -| `callback` | (`this`: `This`, `value`: `Buffer` \| `Buffer`[], `index`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `U` \| readonly `U`[] | A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array. | +| `callback` | (`this`: `This`, `value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `U` \| readonly `U`[] | A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array. | | `thisArg?` | `This` | An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value. | #### Returns @@ -553,7 +553,7 @@ Performs the specified action for each element in an array. | Name | Type | Description | | :------ | :------ | :------ | -| `callbackfn` | (`value`: `Buffer` \| `Buffer`[], `index`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `void` | A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. | +| `callbackfn` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `void` | A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. | | `thisArg?` | `any` | An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. | #### Returns @@ -580,7 +580,7 @@ Determines whether an array includes a certain element, returning true or false | Name | Type | Description | | :------ | :------ | :------ | -| `searchElement` | `Buffer` \| `Buffer`[] | The element to search for. | +| `searchElement` | `Uint8Array` \| `Uint8Array`[] | The element to search for. | | `fromIndex?` | `number` | The position in this array at which to begin searching for searchElement. | #### Returns @@ -607,7 +607,7 @@ Returns the index of the first occurrence of a value in an array, or -1 if it is | Name | Type | Description | | :------ | :------ | :------ | -| `searchElement` | `Buffer` \| `Buffer`[] | The value to locate in the array. | +| `searchElement` | `Uint8Array` \| `Uint8Array`[] | The value to locate in the array. | | `fromIndex?` | `number` | The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. | #### Returns @@ -680,7 +680,7 @@ Returns the index of the last occurrence of a specified value in an array, or -1 | Name | Type | Description | | :------ | :------ | :------ | -| `searchElement` | `Buffer` \| `Buffer`[] | The value to locate in the array. | +| `searchElement` | `Uint8Array` \| `Uint8Array`[] | The value to locate in the array. | | `fromIndex?` | `number` | The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. | #### Returns @@ -713,7 +713,7 @@ Calls a defined callback function on each element of an array, and returns an ar | Name | Type | Description | | :------ | :------ | :------ | -| `callbackfn` | (`value`: `Buffer` \| `Buffer`[], `index`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `U` | A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. | +| `callbackfn` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `U` | A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. | | `thisArg?` | `any` | An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. | #### Returns @@ -732,14 +732,14 @@ ___ ### pop -▸ **pop**(): `undefined` \| `Buffer` \| `Buffer`[] +▸ **pop**(): `undefined` \| `Uint8Array` \| `Uint8Array`[] Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified. #### Returns -`undefined` \| `Buffer` \| `Buffer`[] +`undefined` \| `Uint8Array` \| `Uint8Array`[] #### Inherited from @@ -761,7 +761,7 @@ Appends new elements to the end of an array, and returns the new length of the a | Name | Type | Description | | :------ | :------ | :------ | -| `...items` | (`Buffer` \| `Buffer`[])[] | New elements to add to the array. | +| `...items` | (`Uint8Array` \| `Uint8Array`[])[] | New elements to add to the array. | #### Returns @@ -779,7 +779,7 @@ ___ ### reduce -▸ **reduce**(`callbackfn`): `Buffer` \| `Buffer`[] +▸ **reduce**(`callbackfn`): `Uint8Array` \| `Uint8Array`[] Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. @@ -787,11 +787,11 @@ Calls the specified callback function for all the elements in an array. The retu | Name | Type | Description | | :------ | :------ | :------ | -| `callbackfn` | (`previousValue`: `Buffer` \| `Buffer`[], `currentValue`: `Buffer` \| `Buffer`[], `currentIndex`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `Buffer` \| `Buffer`[] | A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. | +| `callbackfn` | (`previousValue`: `Uint8Array` \| `Uint8Array`[], `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `Uint8Array` \| `Uint8Array`[] | A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. | #### Returns -`Buffer` \| `Buffer`[] +`Uint8Array` \| `Uint8Array`[] #### Inherited from @@ -801,18 +801,18 @@ Array.reduce node_modules/typescript/lib/lib.es5.d.ts:1434 -▸ **reduce**(`callbackfn`, `initialValue`): `Buffer` \| `Buffer`[] +▸ **reduce**(`callbackfn`, `initialValue`): `Uint8Array` \| `Uint8Array`[] #### Parameters | Name | Type | | :------ | :------ | -| `callbackfn` | (`previousValue`: `Buffer` \| `Buffer`[], `currentValue`: `Buffer` \| `Buffer`[], `currentIndex`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `Buffer` \| `Buffer`[] | -| `initialValue` | `Buffer` \| `Buffer`[] | +| `callbackfn` | (`previousValue`: `Uint8Array` \| `Uint8Array`[], `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `Uint8Array` \| `Uint8Array`[] | +| `initialValue` | `Uint8Array` \| `Uint8Array`[] | #### Returns -`Buffer` \| `Buffer`[] +`Uint8Array` \| `Uint8Array`[] #### Inherited from @@ -836,7 +836,7 @@ Calls the specified callback function for all the elements in an array. The retu | Name | Type | Description | | :------ | :------ | :------ | -| `callbackfn` | (`previousValue`: `U`, `currentValue`: `Buffer` \| `Buffer`[], `currentIndex`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `U` | A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. | +| `callbackfn` | (`previousValue`: `U`, `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `U` | A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. | | `initialValue` | `U` | If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. | #### Returns @@ -855,7 +855,7 @@ ___ ### reduceRight -▸ **reduceRight**(`callbackfn`): `Buffer` \| `Buffer`[] +▸ **reduceRight**(`callbackfn`): `Uint8Array` \| `Uint8Array`[] Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. @@ -863,11 +863,11 @@ Calls the specified callback function for all the elements in an array, in desce | Name | Type | Description | | :------ | :------ | :------ | -| `callbackfn` | (`previousValue`: `Buffer` \| `Buffer`[], `currentValue`: `Buffer` \| `Buffer`[], `currentIndex`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `Buffer` \| `Buffer`[] | A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. | +| `callbackfn` | (`previousValue`: `Uint8Array` \| `Uint8Array`[], `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `Uint8Array` \| `Uint8Array`[] | A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. | #### Returns -`Buffer` \| `Buffer`[] +`Uint8Array` \| `Uint8Array`[] #### Inherited from @@ -877,18 +877,18 @@ Array.reduceRight node_modules/typescript/lib/lib.es5.d.ts:1447 -▸ **reduceRight**(`callbackfn`, `initialValue`): `Buffer` \| `Buffer`[] +▸ **reduceRight**(`callbackfn`, `initialValue`): `Uint8Array` \| `Uint8Array`[] #### Parameters | Name | Type | | :------ | :------ | -| `callbackfn` | (`previousValue`: `Buffer` \| `Buffer`[], `currentValue`: `Buffer` \| `Buffer`[], `currentIndex`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `Buffer` \| `Buffer`[] | -| `initialValue` | `Buffer` \| `Buffer`[] | +| `callbackfn` | (`previousValue`: `Uint8Array` \| `Uint8Array`[], `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `Uint8Array` \| `Uint8Array`[] | +| `initialValue` | `Uint8Array` \| `Uint8Array`[] | #### Returns -`Buffer` \| `Buffer`[] +`Uint8Array` \| `Uint8Array`[] #### Inherited from @@ -912,7 +912,7 @@ Calls the specified callback function for all the elements in an array, in desce | Name | Type | Description | | :------ | :------ | :------ | -| `callbackfn` | (`previousValue`: `U`, `currentValue`: `Buffer` \| `Buffer`[], `currentIndex`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `U` | A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. | +| `callbackfn` | (`previousValue`: `U`, `currentValue`: `Uint8Array` \| `Uint8Array`[], `currentIndex`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `U` | A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. | | `initialValue` | `U` | If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. | #### Returns @@ -931,14 +931,14 @@ ___ ### reverse -▸ **reverse**(): (`Buffer` \| `Buffer`[])[] +▸ **reverse**(): (`Uint8Array` \| `Uint8Array`[])[] Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array. #### Returns -(`Buffer` \| `Buffer`[])[] +(`Uint8Array` \| `Uint8Array`[])[] #### Inherited from @@ -952,14 +952,14 @@ ___ ### shift -▸ **shift**(): `undefined` \| `Buffer` \| `Buffer`[] +▸ **shift**(): `undefined` \| `Uint8Array` \| `Uint8Array`[] Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified. #### Returns -`undefined` \| `Buffer` \| `Buffer`[] +`undefined` \| `Uint8Array` \| `Uint8Array`[] #### Inherited from @@ -973,7 +973,7 @@ ___ ### slice -▸ **slice**(`start?`, `end?`): (`Buffer` \| `Buffer`[])[] +▸ **slice**(`start?`, `end?`): (`Uint8Array` \| `Uint8Array`[])[] Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. @@ -988,7 +988,7 @@ For example, -2 refers to the second to last element of the array. #### Returns -(`Buffer` \| `Buffer`[])[] +(`Uint8Array` \| `Uint8Array`[])[] #### Inherited from @@ -1010,7 +1010,7 @@ Determines whether the specified callback function returns true for any element | Name | Type | Description | | :------ | :------ | :------ | -| `predicate` | (`value`: `Buffer` \| `Buffer`[], `index`: `number`, `array`: (`Buffer` \| `Buffer`[])[]) => `unknown` | A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array. | +| `predicate` | (`value`: `Uint8Array` \| `Uint8Array`[], `index`: `number`, `array`: (`Uint8Array` \| `Uint8Array`[])[]) => `unknown` | A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array. | | `thisArg?` | `any` | An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. | #### Returns @@ -1038,7 +1038,7 @@ This method mutates the array and returns a reference to the same array. | Name | Type | Description | | :------ | :------ | :------ | -| `compareFn?` | (`a`: `Buffer` \| `Buffer`[], `b`: `Buffer` \| `Buffer`[]) => `number` | Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. ```ts [11,2,22,1].sort((a, b) => a - b) ``` | +| `compareFn?` | (`a`: `Uint8Array` \| `Uint8Array`[], `b`: `Uint8Array` \| `Uint8Array`[]) => `number` | Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. ```ts [11,2,22,1].sort((a, b) => a - b) ``` | #### Returns @@ -1056,7 +1056,7 @@ ___ ### splice -▸ **splice**(`start`, `deleteCount?`): (`Buffer` \| `Buffer`[])[] +▸ **splice**(`start`, `deleteCount?`): (`Uint8Array` \| `Uint8Array`[])[] Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. @@ -1069,7 +1069,7 @@ Removes elements from an array and, if necessary, inserts new elements in their #### Returns -(`Buffer` \| `Buffer`[])[] +(`Uint8Array` \| `Uint8Array`[])[] An array containing the elements that were deleted. @@ -1081,7 +1081,7 @@ Array.splice node_modules/typescript/lib/lib.es5.d.ts:1352 -▸ **splice**(`start`, `deleteCount`, ...`items`): (`Buffer` \| `Buffer`[])[] +▸ **splice**(`start`, `deleteCount`, ...`items`): (`Uint8Array` \| `Uint8Array`[])[] Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. @@ -1091,11 +1091,11 @@ Removes elements from an array and, if necessary, inserts new elements in their | :------ | :------ | :------ | | `start` | `number` | The zero-based location in the array from which to start removing elements. | | `deleteCount` | `number` | The number of elements to remove. | -| `...items` | (`Buffer` \| `Buffer`[])[] | Elements to insert into the array in place of the deleted elements. | +| `...items` | (`Uint8Array` \| `Uint8Array`[])[] | Elements to insert into the array in place of the deleted elements. | #### Returns -(`Buffer` \| `Buffer`[])[] +(`Uint8Array` \| `Uint8Array`[])[] An array containing the elements that were deleted. @@ -1159,7 +1159,7 @@ Inserts new elements at the start of an array, and returns the new length of the | Name | Type | Description | | :------ | :------ | :------ | -| `...items` | (`Buffer` \| `Buffer`[])[] | Elements to insert at the start of the array. | +| `...items` | (`Uint8Array` \| `Uint8Array`[])[] | Elements to insert at the start of the array. | #### Returns @@ -1177,13 +1177,13 @@ ___ ### values -▸ **values**(): `IterableIterator`<`Buffer` \| `Buffer`[]\> +▸ **values**(): `IterableIterator`<`Uint8Array` \| `Uint8Array`[]\> Returns an iterable of values in the array #### Returns -`IterableIterator`<`Buffer` \| `Buffer`[]\> +`IterableIterator`<`Uint8Array` \| `Uint8Array`[]\> #### Inherited from diff --git a/packages/devp2p/docs/interfaces/Hello.md b/packages/devp2p/docs/interfaces/Hello.md deleted file mode 100644 index 05cbfa4869..0000000000 --- a/packages/devp2p/docs/interfaces/Hello.md +++ /dev/null @@ -1,63 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / Hello - -# Interface: Hello - -## Table of contents - -### Properties - -- [capabilities](Hello.md#capabilities) -- [clientId](Hello.md#clientid) -- [id](Hello.md#id) -- [port](Hello.md#port) -- [protocolVersion](Hello.md#protocolversion) - -## Properties - -### capabilities - -• **capabilities**: [`Capabilities`](Capabilities.md)[] - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L78) - -___ - -### clientId - -• **clientId**: `string` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L77) - -___ - -### id - -• **id**: `Buffer` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L80) - -___ - -### port - -• **port**: `number` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:79](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L79) - -___ - -### protocolVersion - -• **protocolVersion**: `number` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L76) diff --git a/packages/devp2p/docs/interfaces/KBucketOptions.md b/packages/devp2p/docs/interfaces/KBucketOptions.md new file mode 100644 index 0000000000..a3b2d3f79d --- /dev/null +++ b/packages/devp2p/docs/interfaces/KBucketOptions.md @@ -0,0 +1,125 @@ +[@ethereumjs/devp2p](../README.md) / KBucketOptions + +# Interface: KBucketOptions + +## Table of contents + +### Properties + +- [arbiter](KBucketOptions.md#arbiter) +- [distance](KBucketOptions.md#distance) +- [localNodeId](KBucketOptions.md#localnodeid) +- [metadata](KBucketOptions.md#metadata) +- [numberOfNodesPerKBucket](KBucketOptions.md#numberofnodesperkbucket) +- [numberOfNodesToPing](KBucketOptions.md#numberofnodestoping) + +## Properties + +### arbiter + +• `Optional` **arbiter**: (`incumbent`: [`Contact`](Contact.md), `candidate`: [`Contact`](Contact.md)) => [`Contact`](Contact.md) + +#### Type declaration + +▸ (`incumbent`, `candidate`): [`Contact`](Contact.md) + +An optional arbiter function that given two `contact` objects with the same `id`, +returns the desired object to be used for updating the k-bucket. +Defaults to vectorClock arbiter function. + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `incumbent` | [`Contact`](Contact.md) | +| `candidate` | [`Contact`](Contact.md) | + +##### Returns + +[`Contact`](Contact.md) + +#### Defined in + +[packages/devp2p/src/types.ts:162](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L162) + +___ + +### distance + +• `Optional` **distance**: (`firstId`: `Uint8Array`, `secondId`: `Uint8Array`) => `number` + +#### Type declaration + +▸ (`firstId`, `secondId`): `number` + +An optional distance function that gets two id Uint8Arrays and return distance between them as a number. + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `firstId` | `Uint8Array` | +| `secondId` | `Uint8Array` | + +##### Returns + +`number` + +#### Defined in + +[packages/devp2p/src/types.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L156) + +___ + +### localNodeId + +• `Optional` **localNodeId**: `Uint8Array` + +An optional Uint8Array representing the local node id. +If not provided, a local node id will be created via `randomBytes(20)`. + +#### Defined in + +[packages/devp2p/src/types.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L141) + +___ + +### metadata + +• `Optional` **metadata**: `object` + +Optional satellite data to include +with the k-bucket. `metadata` property is guaranteed not be altered by, +it is provided as an explicit container for users of k-bucket to store +implementation-specific data. + +#### Defined in + +[packages/devp2p/src/types.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L169) + +___ + +### numberOfNodesPerKBucket + +• `Optional` **numberOfNodesPerKBucket**: `number` + +The number of nodes that a k-bucket can contain before being full or split. +Defaults to 20. + +#### Defined in + +[packages/devp2p/src/types.ts:146](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L146) + +___ + +### numberOfNodesToPing + +• `Optional` **numberOfNodesToPing**: `number` + +The number of nodes to ping when a bucket that should not be split becomes full. +KBucket will emit a `ping` event that contains `numberOfNodesToPing` nodes that have not been contacted the longest. +Defaults to 3. + +#### Defined in + +[packages/devp2p/src/types.ts:152](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L152) diff --git a/packages/devp2p/docs/interfaces/LES.Status.md b/packages/devp2p/docs/interfaces/LES.Status.md index 5498413d93..fff4cf9e95 100644 --- a/packages/devp2p/docs/interfaces/LES.Status.md +++ b/packages/devp2p/docs/interfaces/LES.Status.md @@ -33,158 +33,158 @@ ### announceType -• **announceType**: `Buffer` +• **announceType**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:275](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L275) +[packages/devp2p/src/protocol/les.ts:296](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L296) ___ ### flowControl/BL -• **flowControl/BL**: `Buffer` +• **flowControl/BL**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L272) +[packages/devp2p/src/protocol/les.ts:293](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L293) ___ ### flowControl/MRC -• **flowControl/MRC**: `Buffer` +• **flowControl/MRC**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:274](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L274) +[packages/devp2p/src/protocol/les.ts:295](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L295) ___ ### flowControl/MRR -• **flowControl/MRR**: `Buffer` +• **flowControl/MRR**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:273](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L273) +[packages/devp2p/src/protocol/les.ts:294](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L294) ___ ### forkID -• **forkID**: [`Buffer`, `Buffer`] +• **forkID**: [`Uint8Array`, `Uint8Array`] #### Defined in -[packages/devp2p/src/protocol/les.ts:276](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L276) +[packages/devp2p/src/protocol/les.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L297) ___ ### genesisHash -• **genesisHash**: `Buffer` +• **genesisHash**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:267](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L267) +[packages/devp2p/src/protocol/les.ts:288](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L288) ___ ### headHash -• **headHash**: `Buffer` +• **headHash**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:265](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L265) +[packages/devp2p/src/protocol/les.ts:286](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L286) ___ ### headNum -• **headNum**: `Buffer` +• **headNum**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L266) +[packages/devp2p/src/protocol/les.ts:287](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L287) ___ ### headTd -• **headTd**: `Buffer` +• **headTd**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:264](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L264) +[packages/devp2p/src/protocol/les.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L285) ___ ### networkId -• **networkId**: `Buffer` +• **networkId**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:263](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L263) +[packages/devp2p/src/protocol/les.ts:284](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L284) ___ ### protocolVersion -• **protocolVersion**: `Buffer` +• **protocolVersion**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:262](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L262) +[packages/devp2p/src/protocol/les.ts:283](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L283) ___ ### recentTxLookup -• **recentTxLookup**: `Buffer` +• **recentTxLookup**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L277) +[packages/devp2p/src/protocol/les.ts:298](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L298) ___ ### serveChainSince -• **serveChainSince**: `Buffer` +• **serveChainSince**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L269) +[packages/devp2p/src/protocol/les.ts:290](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L290) ___ ### serveHeaders -• **serveHeaders**: `Buffer` +• **serveHeaders**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:268](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L268) +[packages/devp2p/src/protocol/les.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L289) ___ ### serveStateSince -• **serveStateSince**: `Buffer` +• **serveStateSince**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:270](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L270) +[packages/devp2p/src/protocol/les.ts:291](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L291) ___ ### txRelay -• **txRelay**: `Buffer` +• **txRelay**: `Uint8Array` #### Defined in -[packages/devp2p/src/protocol/les.ts:271](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L271) +[packages/devp2p/src/protocol/les.ts:292](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/les.ts#L292) diff --git a/packages/devp2p/docs/interfaces/PeerInfo.md b/packages/devp2p/docs/interfaces/PeerInfo.md index bf06503765..0552ad8422 100644 --- a/packages/devp2p/docs/interfaces/PeerInfo.md +++ b/packages/devp2p/docs/interfaces/PeerInfo.md @@ -6,7 +6,7 @@ - **`PeerInfo`** - ↳ [`CustomContact`](CustomContact.md) + ↳ [`Contact`](Contact.md) ## Table of contents @@ -16,6 +16,7 @@ - [id](PeerInfo.md#id) - [tcpPort](PeerInfo.md#tcpport) - [udpPort](PeerInfo.md#udpport) +- [vectorClock](PeerInfo.md#vectorclock) ## Properties @@ -25,17 +26,17 @@ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L19) +[packages/devp2p/src/types.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L174) ___ ### id -• `Optional` **id**: `Uint8Array` \| `Buffer` +• `Optional` **id**: `Uint8Array` #### Defined in -[packages/devp2p/src/dpt/dpt.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L18) +[packages/devp2p/src/types.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L173) ___ @@ -45,7 +46,7 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L21) +[packages/devp2p/src/types.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L176) ___ @@ -55,4 +56,14 @@ ___ #### Defined in -[packages/devp2p/src/dpt/dpt.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/dpt/dpt.ts#L20) +[packages/devp2p/src/types.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L175) + +___ + +### vectorClock + +• `Optional` **vectorClock**: `number` + +#### Defined in + +[packages/devp2p/src/types.ts:177](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L177) diff --git a/packages/devp2p/docs/interfaces/PeerOptions.md b/packages/devp2p/docs/interfaces/PeerOptions.md new file mode 100644 index 0000000000..aafb7e8352 --- /dev/null +++ b/packages/devp2p/docs/interfaces/PeerOptions.md @@ -0,0 +1,129 @@ +[@ethereumjs/devp2p](../README.md) / PeerOptions + +# Interface: PeerOptions + +## Table of contents + +### Properties + +- [EIP8](PeerOptions.md#eip8) +- [capabilities](PeerOptions.md#capabilities) +- [clientId](PeerOptions.md#clientid) +- [common](PeerOptions.md#common) +- [id](PeerOptions.md#id) +- [port](PeerOptions.md#port) +- [privateKey](PeerOptions.md#privatekey) +- [remoteClientIdFilter](PeerOptions.md#remoteclientidfilter) +- [remoteId](PeerOptions.md#remoteid) +- [socket](PeerOptions.md#socket) +- [timeout](PeerOptions.md#timeout) + +## Properties + +### EIP8 + +• `Optional` **EIP8**: `boolean` \| `Uint8Array` + +#### Defined in + +[packages/devp2p/src/types.ts:193](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L193) + +___ + +### capabilities + +• `Optional` **capabilities**: [`Capabilities`](Capabilities.md)[] + +#### Defined in + +[packages/devp2p/src/types.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L187) + +___ + +### clientId + +• **clientId**: `Uint8Array` + +#### Defined in + +[packages/devp2p/src/types.ts:186](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L186) + +___ + +### common + +• **common**: `Common` + +#### Defined in + +[packages/devp2p/src/types.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L188) + +___ + +### id + +• **id**: `Uint8Array` + +#### Defined in + +[packages/devp2p/src/types.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L190) + +___ + +### port + +• **port**: `number` + +#### Defined in + +[packages/devp2p/src/types.ts:189](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L189) + +___ + +### privateKey + +• **privateKey**: `Uint8Array` + +#### Defined in + +[packages/devp2p/src/types.ts:194](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L194) + +___ + +### remoteClientIdFilter + +• `Optional` **remoteClientIdFilter**: `string`[] + +#### Defined in + +[packages/devp2p/src/types.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L191) + +___ + +### remoteId + +• **remoteId**: `Uint8Array` + +#### Defined in + +[packages/devp2p/src/types.ts:192](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L192) + +___ + +### socket + +• **socket**: `Socket` + +#### Defined in + +[packages/devp2p/src/types.ts:195](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L195) + +___ + +### timeout + +• **timeout**: `number` + +#### Defined in + +[packages/devp2p/src/types.ts:196](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L196) diff --git a/packages/devp2p/docs/interfaces/ProtocolConstructor.md b/packages/devp2p/docs/interfaces/ProtocolConstructor.md deleted file mode 100644 index 3ea08de986..0000000000 --- a/packages/devp2p/docs/interfaces/ProtocolConstructor.md +++ /dev/null @@ -1,25 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / ProtocolConstructor - -# Interface: ProtocolConstructor - -## Table of contents - -### Constructors - -- [constructor](ProtocolConstructor.md#constructor) - -## Constructors - -### constructor - -• **new ProtocolConstructor**(...`args`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `...args` | `any`[] | - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L65) diff --git a/packages/devp2p/docs/interfaces/ProtocolDescriptor.md b/packages/devp2p/docs/interfaces/ProtocolDescriptor.md deleted file mode 100644 index 0c906e668a..0000000000 --- a/packages/devp2p/docs/interfaces/ProtocolDescriptor.md +++ /dev/null @@ -1,41 +0,0 @@ -[@ethereumjs/devp2p](../README.md) / ProtocolDescriptor - -# Interface: ProtocolDescriptor - -## Table of contents - -### Properties - -- [length](ProtocolDescriptor.md#length) -- [offset](ProtocolDescriptor.md#offset) -- [protocol](ProtocolDescriptor.md#protocol) - -## Properties - -### length - -• `Optional` **length**: `number` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L61) - -___ - -### offset - -• **offset**: `number` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L60) - -___ - -### protocol - -• **protocol**: `any` - -#### Defined in - -[packages/devp2p/src/rlpx/peer.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/peer.ts#L59) diff --git a/packages/devp2p/docs/interfaces/RLPxOptions.md b/packages/devp2p/docs/interfaces/RLPxOptions.md index 8ef59c9736..e4d66eb4cc 100644 --- a/packages/devp2p/docs/interfaces/RLPxOptions.md +++ b/packages/devp2p/docs/interfaces/RLPxOptions.md @@ -23,17 +23,17 @@ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L32) +[packages/devp2p/src/types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L207) ___ ### clientId -• `Optional` **clientId**: `Buffer` +• `Optional` **clientId**: `Uint8Array` #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L25) +[packages/devp2p/src/types.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L200) ___ @@ -43,7 +43,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L33) +[packages/devp2p/src/types.ts:208](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L208) ___ @@ -53,7 +53,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L28) +[packages/devp2p/src/types.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L203) ___ @@ -63,7 +63,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L34) +[packages/devp2p/src/types.ts:209](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L209) ___ @@ -73,7 +73,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L30) +[packages/devp2p/src/types.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L205) ___ @@ -83,7 +83,7 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L31) +[packages/devp2p/src/types.ts:206](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L206) ___ @@ -93,4 +93,4 @@ ___ #### Defined in -[packages/devp2p/src/rlpx/rlpx.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/rlpx/rlpx.ts#L27) +[packages/devp2p/src/types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/types.ts#L202) diff --git a/packages/devp2p/docs/modules/eth.md b/packages/devp2p/docs/modules/eth.md index 0549241e20..1ce05fdaee 100644 --- a/packages/devp2p/docs/modules/eth.md +++ b/packages/devp2p/docs/modules/eth.md @@ -26,11 +26,11 @@ | Name | Type | | :------ | :------ | -| `bestHash` | `Buffer` | -| `genesisHash` | `Buffer` | -| `latestBlock?` | `Buffer` | -| `td` | `Buffer` | +| `bestHash` | `Uint8Array` | +| `genesisHash` | `Uint8Array` | +| `latestBlock?` | `Uint8Array` | +| `td` | `Uint8Array` | #### Defined in -[packages/devp2p/src/protocol/eth.ts:355](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L355) +[packages/devp2p/src/protocol/eth.ts:378](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/devp2p/src/protocol/eth.ts#L378) diff --git a/packages/devp2p/package.json b/packages/devp2p/package.json index 75b7fe7f86..8c0ff8cc4a 100644 --- a/packages/devp2p/package.json +++ b/packages/devp2p/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/devp2p", - "version": "6.0.0-rc.1", + "version": "6.0.0", "description": "A JavaScript implementation of ÐΞVp2p", "keywords": [ "ethereum", @@ -56,9 +56,9 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "@scure/base": "1.1.1", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2", @@ -68,8 +68,8 @@ "snappyjs": "^0.6.1" }, "devDependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", + "@ethereumjs/block": "^5.0.0", + "@ethereumjs/tx": "^5.0.0", "@types/debug": "^4.1.4", "@types/k-bucket": "^5.0.0", "chalk": "^2.4.2", diff --git a/packages/ethash/CHANGELOG.md b/packages/ethash/CHANGELOG.md index 2a5180fa09..907917391e 100644 --- a/packages/ethash/CHANGELOG.md +++ b/packages/ethash/CHANGELOG.md @@ -6,6 +6,12 @@ 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). +## 3.0.0 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Fethash%403.0.0-rc.1) for the main change description. + ## 3.0.0-rc.1 - 2023-07-18 This is the release candidate (RC1) for the upcoming breaking releases on the various EthereumJS libraries. The associated release notes below are the main source of information on the changeset, also for the upcoming final releases, where we'll just provide change addition summaries + references to these RC1 notes. diff --git a/packages/ethash/README.md b/packages/ethash/README.md index b0ec1ab9ed..4b89e9e4c9 100644 --- a/packages/ethash/README.md +++ b/packages/ethash/README.md @@ -6,8 +6,6 @@ [![Code Coverage][ethash-coverage-badge]][ethash-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | [Ethash](https://github.com/ethereum/wiki/wiki/Ethash) implementation in TypeScript. | | ------------------------------------------------------------------------------------ | diff --git a/packages/ethash/package.json b/packages/ethash/package.json index d6d63c0a5b..25c9f18fdb 100644 --- a/packages/ethash/package.json +++ b/packages/ethash/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/ethash", - "version": "3.0.0-rc.1", + "version": "3.0.0", "description": "An implementation of the Ethash consensus algorithm in JavaScript", "keywords": [ "ethash", @@ -44,14 +44,14 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/block": "^5.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "bigint-crypto-utils": "^3.2.2", "ethereum-cryptography": "^2.1.2" }, "devDependencies": { - "@ethereumjs/common": "4.0.0-rc.1" + "@ethereumjs/common": "^4.0.0" }, "engines": { "node": ">=18" diff --git a/packages/evm/CHANGELOG.md b/packages/evm/CHANGELOG.md index 05cc402b1e..1ac6f739bd 100644 --- a/packages/evm/CHANGELOG.md +++ b/packages/evm/CHANGELOG.md @@ -6,6 +6,17 @@ 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 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Fevm%402.0.0-rc.1) for the main change description. + +Following additional changes since RC1/RC2: + +- 4844: Rename `dataGas` to `blobGas` (see EIP-4844 PR [#7354](https://github.com/ethereum/EIPs/pull/7354)), PR [#2919](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2919) +- Fix some remaining type issues, PR [#2918](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2918) + ## 2.0.0-rc.2 - 2023-07-18 - Add missing `@ethereumjs/statemanager` dependency diff --git a/packages/evm/README.md b/packages/evm/README.md index 2d235d7b90..0b02f6cdee 100644 --- a/packages/evm/README.md +++ b/packages/evm/README.md @@ -6,8 +6,6 @@ [![Code Coverage][evm-coverage-badge]][evm-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | TypeScript implementation of the Ethereum EVM. | | ---------------------------------------------- | diff --git a/packages/evm/docs/README.md b/packages/evm/docs/README.md index 4d35123ccf..2bdb8c53c1 100644 --- a/packages/evm/docs/README.md +++ b/packages/evm/docs/README.md @@ -6,7 +6,7 @@ ### Enumerations -- [EvmErrorMessage](enums/EvmErrorMessage.md) +- [EVMErrorMessage](enums/EVMErrorMessage.md) ### Classes @@ -15,17 +15,20 @@ ### Interfaces -- [EEIInterface](interfaces/EEIInterface.md) - [EVMInterface](interfaces/EVMInterface.md) - [EVMResult](interfaces/EVMResult.md) -- [EVMStateAccess](interfaces/EVMStateAccess.md) - [ExecResult](interfaces/ExecResult.md) - [InterpreterStep](interfaces/InterpreterStep.md) +- [PrecompileInput](interfaces/PrecompileInput.md) ### Type Aliases - [Log](README.md#log) +### Variables + +- [EOF](README.md#eof) + ### Functions - [getActivePrecompiles](README.md#getactiveprecompiles) @@ -34,13 +37,33 @@ ### Log -Ƭ **Log**: [address: Buffer, topics: Buffer[], data: Buffer] +Ƭ **Log**: [address: Uint8Array, topics: Uint8Array[], data: Uint8Array] Log that the contract emits. #### Defined in -[types.ts:234](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L234) +[types.ts:319](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L319) + +## Variables + +### EOF + +• `Const` **EOF**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `FORMAT` | `number` | +| `MAGIC` | `number` | +| `VERSION` | `number` | +| `codeAnalysis` | (`container`: `Uint8Array`) => `undefined` \| { `code`: `number` = 0; `data`: `number` = 0 } | +| `validOpcodes` | (`code`: `Uint8Array`) => `boolean` | + +#### Defined in + +[eof.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/eof.ts#L105) ## Functions @@ -61,4 +84,4 @@ Log that the contract emits. #### Defined in -[precompiles/index.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/index.ts#L183) +[precompiles/index.ts:166](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/index.ts#L166) diff --git a/packages/evm/docs/classes/EvmError.md b/packages/evm/docs/classes/EvmError.md index 501541d162..9156ea38d6 100644 --- a/packages/evm/docs/classes/EvmError.md +++ b/packages/evm/docs/classes/EvmError.md @@ -23,21 +23,21 @@ | Name | Type | | :------ | :------ | -| `error` | [`EvmErrorMessage`](../enums/EvmErrorMessage.md) | +| `error` | [`EVMErrorMessage`](../enums/EVMErrorMessage.md) | #### Defined in -[exceptions.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L44) +[exceptions.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L46) ## Properties ### error -• **error**: [`EvmErrorMessage`](../enums/EvmErrorMessage.md) +• **error**: [`EVMErrorMessage`](../enums/EVMErrorMessage.md) #### Defined in -[exceptions.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L41) +[exceptions.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L43) ___ @@ -47,4 +47,4 @@ ___ #### Defined in -[exceptions.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L42) +[exceptions.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L44) diff --git a/packages/evm/docs/classes/Message.md b/packages/evm/docs/classes/Message.md index ab4e8f6f77..fee647a6bd 100644 --- a/packages/evm/docs/classes/Message.md +++ b/packages/evm/docs/classes/Message.md @@ -15,6 +15,7 @@ - [caller](Message.md#caller) - [code](Message.md#code) - [containerCode](Message.md#containercode) +- [createdAddresses](Message.md#createdaddresses) - [data](Message.md#data) - [delegatecall](Message.md#delegatecall) - [depth](Message.md#depth) @@ -46,7 +47,7 @@ #### Defined in -[message.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L68) +[message.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L75) ## Properties @@ -56,7 +57,7 @@ #### Defined in -[message.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L46) +[message.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L50) ___ @@ -69,7 +70,7 @@ the purpose is to figure out where `value` should be taken from (not from `calle #### Defined in -[message.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L61) +[message.ts:68](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L68) ___ @@ -79,37 +80,49 @@ ___ #### Defined in -[message.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L41) +[message.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L45) ___ ### code -• `Optional` **code**: `Buffer` \| `PrecompileFunc` +• `Optional` **code**: `Uint8Array` \| `PrecompileFunc` #### Defined in -[message.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L45) +[message.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L49) ___ ### containerCode -• `Optional` **containerCode**: `Buffer` +• `Optional` **containerCode**: `Uint8Array` #### Defined in -[message.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L50) +[message.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L54) + +___ + +### createdAddresses + +• `Optional` **createdAddresses**: `Set`<`string`\> + +Map of addresses which were created (used in EIP 6780) + +#### Defined in + +[message.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L62) ___ ### data -• **data**: `Buffer` +• **data**: `Uint8Array` #### Defined in -[message.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L43) +[message.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L47) ___ @@ -119,7 +132,7 @@ ___ #### Defined in -[message.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L56) +[message.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L63) ___ @@ -129,7 +142,7 @@ ___ #### Defined in -[message.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L44) +[message.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L48) ___ @@ -139,7 +152,7 @@ ___ #### Defined in -[message.ts:42](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L42) +[message.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L46) ___ @@ -149,7 +162,7 @@ ___ #### Defined in -[message.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L62) +[message.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L69) ___ @@ -159,7 +172,7 @@ ___ #### Defined in -[message.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L48) +[message.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L52) ___ @@ -169,30 +182,29 @@ ___ #### Defined in -[message.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L47) +[message.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L51) ___ ### salt -• `Optional` **salt**: `Buffer` +• `Optional` **salt**: `Uint8Array` #### Defined in -[message.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L49) +[message.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L53) ___ ### selfdestruct -• `Optional` **selfdestruct**: { `[key: string]`: `boolean`; } \| { `[key: string]`: `Buffer`; } +• `Optional` **selfdestruct**: `Set`<`string`\> -Map of addresses to selfdestruct. Key is the unprefixed address. -Value is a boolean when marked for destruction and replaced with a Buffer containing the address where the remaining funds are sent. +Set of addresses to selfdestruct. Key is the unprefixed address. #### Defined in -[message.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L55) +[message.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L58) ___ @@ -202,7 +214,7 @@ ___ #### Defined in -[message.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L39) +[message.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L43) ___ @@ -212,19 +224,19 @@ ___ #### Defined in -[message.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L40) +[message.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L44) ___ ### versionedHashes -• `Optional` **versionedHashes**: `Buffer`[] +• `Optional` **versionedHashes**: `Uint8Array`[] List of versioned hashes if message is a blob transaction in the outer VM #### Defined in -[message.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L66) +[message.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L73) ## Accessors @@ -240,4 +252,4 @@ Note: should only be called in instances where `_codeAddress` or `to` is defined #### Defined in -[message.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L93) +[message.ts:101](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/message.ts#L101) diff --git a/packages/evm/docs/enums/EvmErrorMessage.md b/packages/evm/docs/enums/EvmErrorMessage.md index 10ed4a6b68..b94326ceec 100644 --- a/packages/evm/docs/enums/EvmErrorMessage.md +++ b/packages/evm/docs/enums/EvmErrorMessage.md @@ -1,42 +1,44 @@ -[@ethereumjs/evm](../README.md) / EvmErrorMessage +[@ethereumjs/evm](../README.md) / EVMErrorMessage -# Enumeration: EvmErrorMessage +# Enumeration: EVMErrorMessage ## Table of contents ### Enumeration Members -- [AUTHCALL\_NONZERO\_VALUEEXT](EvmErrorMessage.md#authcall_nonzero_valueext) -- [AUTHCALL\_UNSET](EvmErrorMessage.md#authcall_unset) -- [AUTH\_INVALID\_S](EvmErrorMessage.md#auth_invalid_s) -- [BLS\_12\_381\_FP\_NOT\_IN\_FIELD](EvmErrorMessage.md#bls_12_381_fp_not_in_field) -- [BLS\_12\_381\_INPUT\_EMPTY](EvmErrorMessage.md#bls_12_381_input_empty) -- [BLS\_12\_381\_INVALID\_INPUT\_LENGTH](EvmErrorMessage.md#bls_12_381_invalid_input_length) -- [BLS\_12\_381\_POINT\_NOT\_ON\_CURVE](EvmErrorMessage.md#bls_12_381_point_not_on_curve) -- [CODESIZE\_EXCEEDS\_MAXIMUM](EvmErrorMessage.md#codesize_exceeds_maximum) -- [CODESTORE\_OUT\_OF\_GAS](EvmErrorMessage.md#codestore_out_of_gas) -- [CREATE\_COLLISION](EvmErrorMessage.md#create_collision) -- [INITCODE\_SIZE\_VIOLATION](EvmErrorMessage.md#initcode_size_violation) -- [INSUFFICIENT\_BALANCE](EvmErrorMessage.md#insufficient_balance) -- [INTERNAL\_ERROR](EvmErrorMessage.md#internal_error) -- [INVALID\_BEGINSUB](EvmErrorMessage.md#invalid_beginsub) -- [INVALID\_BYTECODE\_RESULT](EvmErrorMessage.md#invalid_bytecode_result) -- [INVALID\_COMMITMENT](EvmErrorMessage.md#invalid_commitment) -- [INVALID\_EOF\_FORMAT](EvmErrorMessage.md#invalid_eof_format) -- [INVALID\_JUMP](EvmErrorMessage.md#invalid_jump) -- [INVALID\_JUMPSUB](EvmErrorMessage.md#invalid_jumpsub) -- [INVALID\_OPCODE](EvmErrorMessage.md#invalid_opcode) -- [INVALID\_RETURNSUB](EvmErrorMessage.md#invalid_returnsub) -- [OUT\_OF\_GAS](EvmErrorMessage.md#out_of_gas) -- [OUT\_OF\_RANGE](EvmErrorMessage.md#out_of_range) -- [POINT\_GREATER\_THAN\_BLS\_MODULUS](EvmErrorMessage.md#point_greater_than_bls_modulus) -- [REFUND\_EXHAUSTED](EvmErrorMessage.md#refund_exhausted) -- [REVERT](EvmErrorMessage.md#revert) -- [STACK\_OVERFLOW](EvmErrorMessage.md#stack_overflow) -- [STACK\_UNDERFLOW](EvmErrorMessage.md#stack_underflow) -- [STATIC\_STATE\_CHANGE](EvmErrorMessage.md#static_state_change) -- [STOP](EvmErrorMessage.md#stop) -- [VALUE\_OVERFLOW](EvmErrorMessage.md#value_overflow) +- [AUTHCALL\_NONZERO\_VALUEEXT](EVMErrorMessage.md#authcall_nonzero_valueext) +- [AUTHCALL\_UNSET](EVMErrorMessage.md#authcall_unset) +- [AUTH\_INVALID\_S](EVMErrorMessage.md#auth_invalid_s) +- [BLS\_12\_381\_FP\_NOT\_IN\_FIELD](EVMErrorMessage.md#bls_12_381_fp_not_in_field) +- [BLS\_12\_381\_INPUT\_EMPTY](EVMErrorMessage.md#bls_12_381_input_empty) +- [BLS\_12\_381\_INVALID\_INPUT\_LENGTH](EVMErrorMessage.md#bls_12_381_invalid_input_length) +- [BLS\_12\_381\_POINT\_NOT\_ON\_CURVE](EVMErrorMessage.md#bls_12_381_point_not_on_curve) +- [CODESIZE\_EXCEEDS\_MAXIMUM](EVMErrorMessage.md#codesize_exceeds_maximum) +- [CODESTORE\_OUT\_OF\_GAS](EVMErrorMessage.md#codestore_out_of_gas) +- [CREATE\_COLLISION](EVMErrorMessage.md#create_collision) +- [INITCODE\_SIZE\_VIOLATION](EVMErrorMessage.md#initcode_size_violation) +- [INSUFFICIENT\_BALANCE](EVMErrorMessage.md#insufficient_balance) +- [INTERNAL\_ERROR](EVMErrorMessage.md#internal_error) +- [INVALID\_BEGINSUB](EVMErrorMessage.md#invalid_beginsub) +- [INVALID\_BYTECODE\_RESULT](EVMErrorMessage.md#invalid_bytecode_result) +- [INVALID\_COMMITMENT](EVMErrorMessage.md#invalid_commitment) +- [INVALID\_EOF\_FORMAT](EVMErrorMessage.md#invalid_eof_format) +- [INVALID\_INPUTS](EVMErrorMessage.md#invalid_inputs) +- [INVALID\_INPUT\_LENGTH](EVMErrorMessage.md#invalid_input_length) +- [INVALID\_JUMP](EVMErrorMessage.md#invalid_jump) +- [INVALID\_JUMPSUB](EVMErrorMessage.md#invalid_jumpsub) +- [INVALID\_OPCODE](EVMErrorMessage.md#invalid_opcode) +- [INVALID\_PROOF](EVMErrorMessage.md#invalid_proof) +- [INVALID\_RETURNSUB](EVMErrorMessage.md#invalid_returnsub) +- [OUT\_OF\_GAS](EVMErrorMessage.md#out_of_gas) +- [OUT\_OF\_RANGE](EVMErrorMessage.md#out_of_range) +- [REFUND\_EXHAUSTED](EVMErrorMessage.md#refund_exhausted) +- [REVERT](EVMErrorMessage.md#revert) +- [STACK\_OVERFLOW](EVMErrorMessage.md#stack_overflow) +- [STACK\_UNDERFLOW](EVMErrorMessage.md#stack_underflow) +- [STATIC\_STATE\_CHANGE](EVMErrorMessage.md#static_state_change) +- [STOP](EVMErrorMessage.md#stop) +- [VALUE\_OVERFLOW](EVMErrorMessage.md#value_overflow) ## Enumeration Members @@ -46,7 +48,7 @@ #### Defined in -[exceptions.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L26) +[exceptions.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L27) ___ @@ -56,7 +58,7 @@ ___ #### Defined in -[exceptions.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L25) +[exceptions.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L26) ___ @@ -66,7 +68,7 @@ ___ #### Defined in -[exceptions.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L27) +[exceptions.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L28) ___ @@ -76,7 +78,7 @@ ___ #### Defined in -[exceptions.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L33) +[exceptions.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L34) ___ @@ -86,7 +88,7 @@ ___ #### Defined in -[exceptions.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L32) +[exceptions.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L33) ___ @@ -96,7 +98,7 @@ ___ #### Defined in -[exceptions.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L30) +[exceptions.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L31) ___ @@ -106,7 +108,7 @@ ___ #### Defined in -[exceptions.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L31) +[exceptions.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L32) ___ @@ -210,6 +212,26 @@ ___ ___ +### INVALID\_INPUTS + +• **INVALID\_INPUTS** = ``"kzg inputs invalid"`` + +#### Defined in + +[exceptions.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L38) + +___ + +### INVALID\_INPUT\_LENGTH + +• **INVALID\_INPUT\_LENGTH** = ``"invalid input length"`` + +#### Defined in + +[exceptions.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L24) + +___ + ### INVALID\_JUMP • **INVALID\_JUMP** = ``"invalid JUMP"`` @@ -240,6 +262,16 @@ ___ ___ +### INVALID\_PROOF + +• **INVALID\_PROOF** = ``"kzg proof invalid"`` + +#### Defined in + +[exceptions.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L39) + +___ + ### INVALID\_RETURNSUB • **INVALID\_RETURNSUB** = ``"invalid RETURNSUB"`` @@ -270,16 +302,6 @@ ___ ___ -### POINT\_GREATER\_THAN\_BLS\_MODULUS - -• **POINT\_GREATER\_THAN\_BLS\_MODULUS** = ``"point greater than BLS modulus"`` - -#### Defined in - -[exceptions.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/exceptions.ts#L36) - -___ - ### REFUND\_EXHAUSTED • **REFUND\_EXHAUSTED** = ``"refund exhausted"`` diff --git a/packages/evm/docs/interfaces/EEIInterface.md b/packages/evm/docs/interfaces/EEIInterface.md deleted file mode 100644 index 9856ff2b2c..0000000000 --- a/packages/evm/docs/interfaces/EEIInterface.md +++ /dev/null @@ -1,771 +0,0 @@ -[@ethereumjs/evm](../README.md) / EEIInterface - -# Interface: EEIInterface - -API for an EEI (Ethereum Environment Interface) implementation - -This can be used to connect the EVM to different (chain) environments. -An implementation for an EEI to connect to an Ethereum execution chain -environment (`mainnet`, `sepolia`,...) can be found in the -`@ethereumjs/vm` package. - -## Hierarchy - -- [`EVMStateAccess`](EVMStateAccess.md) - - ↳ **`EEIInterface`** - -## Table of contents - -### Methods - -- [accountExists](EEIInterface.md#accountexists) -- [accountIsEmpty](EEIInterface.md#accountisempty) -- [addWarmedAddress](EEIInterface.md#addwarmedaddress) -- [addWarmedStorage](EEIInterface.md#addwarmedstorage) -- [checkpoint](EEIInterface.md#checkpoint) -- [cleanupTouchedAccounts](EEIInterface.md#cleanuptouchedaccounts) -- [clearContractStorage](EEIInterface.md#clearcontractstorage) -- [clearOriginalStorageCache](EEIInterface.md#clearoriginalstoragecache) -- [clearWarmedAccounts](EEIInterface.md#clearwarmedaccounts) -- [commit](EEIInterface.md#commit) -- [copy](EEIInterface.md#copy) -- [deleteAccount](EEIInterface.md#deleteaccount) -- [generateAccessList](EEIInterface.md#generateaccesslist) -- [generateCanonicalGenesis](EEIInterface.md#generatecanonicalgenesis) -- [getAccount](EEIInterface.md#getaccount) -- [getBlockHash](EEIInterface.md#getblockhash) -- [getContractCode](EEIInterface.md#getcontractcode) -- [getContractStorage](EEIInterface.md#getcontractstorage) -- [getProof](EEIInterface.md#getproof) -- [getStateRoot](EEIInterface.md#getstateroot) -- [hasStateRoot](EEIInterface.md#hasstateroot) -- [isWarmedAddress](EEIInterface.md#iswarmedaddress) -- [isWarmedStorage](EEIInterface.md#iswarmedstorage) -- [modifyAccountFields](EEIInterface.md#modifyaccountfields) -- [putAccount](EEIInterface.md#putaccount) -- [putContractCode](EEIInterface.md#putcontractcode) -- [putContractStorage](EEIInterface.md#putcontractstorage) -- [revert](EEIInterface.md#revert) -- [setStateRoot](EEIInterface.md#setstateroot) -- [storageLoad](EEIInterface.md#storageload) -- [storageStore](EEIInterface.md#storagestore) -- [verifyProof](EEIInterface.md#verifyproof) - -## Methods - -### accountExists - -▸ **accountExists**(`address`): `Promise`<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`boolean`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[accountExists](EVMStateAccess.md#accountexists) - -#### Defined in - -[types.ts:261](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L261) - -___ - -### accountIsEmpty - -▸ **accountIsEmpty**(`address`): `Promise`<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`boolean`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[accountIsEmpty](EVMStateAccess.md#accountisempty) - -#### Defined in - -[types.ts:264](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L264) - -___ - -### addWarmedAddress - -▸ **addWarmedAddress**(`address`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Buffer` | - -#### Returns - -`void` - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[addWarmedAddress](EVMStateAccess.md#addwarmedaddress) - -#### Defined in - -[types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L44) - -___ - -### addWarmedStorage - -▸ **addWarmedStorage**(`address`, `slot`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Buffer` | -| `slot` | `Buffer` | - -#### Returns - -`void` - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[addWarmedStorage](EVMStateAccess.md#addwarmedstorage) - -#### Defined in - -[types.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L46) - -___ - -### checkpoint - -▸ **checkpoint**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[checkpoint](EVMStateAccess.md#checkpoint) - -#### Defined in - -[types.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L272) - -___ - -### cleanupTouchedAccounts - -▸ **cleanupTouchedAccounts**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[cleanupTouchedAccounts](EVMStateAccess.md#cleanuptouchedaccounts) - -#### Defined in - -[types.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L51) - -___ - -### clearContractStorage - -▸ **clearContractStorage**(`address`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[clearContractStorage](EVMStateAccess.md#clearcontractstorage) - -#### Defined in - -[types.ts:271](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L271) - -___ - -### clearOriginalStorageCache - -▸ **clearOriginalStorageCache**(): `void` - -#### Returns - -`void` - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[clearOriginalStorageCache](EVMStateAccess.md#clearoriginalstoragecache) - -#### Defined in - -[types.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L50) - -___ - -### clearWarmedAccounts - -▸ **clearWarmedAccounts**(): `void` - -#### Returns - -`void` - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[clearWarmedAccounts](EVMStateAccess.md#clearwarmedaccounts) - -#### Defined in - -[types.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L48) - -___ - -### commit - -▸ **commit**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[commit](EVMStateAccess.md#commit) - -#### Defined in - -[types.ts:273](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L273) - -___ - -### shallowCopy - -▸ **shallowCopy**(): [`EEIInterface`](EEIInterface.md) - -#### Returns - -[`EEIInterface`](EEIInterface.md) - -#### Defined in - -[types.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L33) - -___ - -### deleteAccount - -▸ **deleteAccount**(`address`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[deleteAccount](EVMStateAccess.md#deleteaccount) - -#### Defined in - -[types.ts:265](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L265) - -___ - -### generateAccessList - -▸ `Optional` **generateAccessList**(`addressesRemoved`, `addressesOnlyStorage`): `AccessList` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `addressesRemoved` | `Address`[] | -| `addressesOnlyStorage` | `Address`[] | - -#### Returns - -`AccessList` - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[generateAccessList](EVMStateAccess.md#generateaccesslist) - -#### Defined in - -[types.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L49) - -___ - -### generateCanonicalGenesis - -▸ **generateCanonicalGenesis**(`initState`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `initState` | `any` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[generateCanonicalGenesis](EVMStateAccess.md#generatecanonicalgenesis) - -#### Defined in - -[types.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L52) - -___ - -### getAccount - -▸ **getAccount**(`address`): `Promise`<`Account`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`Account`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[getAccount](EVMStateAccess.md#getaccount) - -#### Defined in - -[types.ts:262](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L262) - -___ - -### getBlockHash - -▸ **getBlockHash**(`num`): `Promise`<`bigint`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `num` | `bigint` | - -#### Returns - -`Promise`<`bigint`\> - -#### Defined in - -[types.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L30) - -___ - -### getContractCode - -▸ **getContractCode**(`address`): `Promise`<`Buffer`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`Buffer`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[getContractCode](EVMStateAccess.md#getcontractcode) - -#### Defined in - -[types.ts:268](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L268) - -___ - -### getContractStorage - -▸ **getContractStorage**(`address`, `key`): `Promise`<`Buffer`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Buffer` | - -#### Returns - -`Promise`<`Buffer`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[getContractStorage](EVMStateAccess.md#getcontractstorage) - -#### Defined in - -[types.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L269) - -___ - -### getProof - -▸ `Optional` **getProof**(`address`, `storageSlots`): `Promise`<`Proof`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `storageSlots` | `Buffer`[] | - -#### Returns - -`Promise`<`Proof`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[getProof](EVMStateAccess.md#getproof) - -#### Defined in - -[types.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L277) - -___ - -### getStateRoot - -▸ **getStateRoot**(): `Promise`<`Buffer`\> - -#### Returns - -`Promise`<`Buffer`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[getStateRoot](EVMStateAccess.md#getstateroot) - -#### Defined in - -[types.ts:275](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L275) - -___ - -### hasStateRoot - -▸ **hasStateRoot**(`root`): `Promise`<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `root` | `Buffer` | - -#### Returns - -`Promise`<`boolean`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[hasStateRoot](EVMStateAccess.md#hasstateroot) - -#### Defined in - -[types.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L279) - -___ - -### isWarmedAddress - -▸ **isWarmedAddress**(`address`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Buffer` | - -#### Returns - -`boolean` - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[isWarmedAddress](EVMStateAccess.md#iswarmedaddress) - -#### Defined in - -[types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L45) - -___ - -### isWarmedStorage - -▸ **isWarmedStorage**(`address`, `slot`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Buffer` | -| `slot` | `Buffer` | - -#### Returns - -`boolean` - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[isWarmedStorage](EVMStateAccess.md#iswarmedstorage) - -#### Defined in - -[types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L47) - -___ - -### modifyAccountFields - -▸ **modifyAccountFields**(`address`, `accountFields`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `accountFields` | `Partial`<`Pick`<`Account`, ``"nonce"`` \| ``"balance"`` \| ``"storageRoot"`` \| ``"codeHash"``\>\> | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[modifyAccountFields](EVMStateAccess.md#modifyaccountfields) - -#### Defined in - -[types.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L266) - -___ - -### putAccount - -▸ **putAccount**(`address`, `account`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `account` | `Account` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[putAccount](EVMStateAccess.md#putaccount) - -#### Defined in - -[types.ts:263](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L263) - -___ - -### putContractCode - -▸ **putContractCode**(`address`, `value`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `value` | `Buffer` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[putContractCode](EVMStateAccess.md#putcontractcode) - -#### Defined in - -[types.ts:267](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L267) - -___ - -### putContractStorage - -▸ **putContractStorage**(`address`, `key`, `value`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Buffer` | -| `value` | `Buffer` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[putContractStorage](EVMStateAccess.md#putcontractstorage) - -#### Defined in - -[types.ts:270](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L270) - -___ - -### revert - -▸ **revert**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[revert](EVMStateAccess.md#revert) - -#### Defined in - -[types.ts:274](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L274) - -___ - -### setStateRoot - -▸ **setStateRoot**(`stateRoot`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `stateRoot` | `Buffer` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[setStateRoot](EVMStateAccess.md#setstateroot) - -#### Defined in - -[types.ts:276](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L276) - -___ - -### storageLoad - -▸ **storageLoad**(`address`, `key`, `original`): `Promise`<`Buffer`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Buffer` | -| `original` | `boolean` | - -#### Returns - -`Promise`<`Buffer`\> - -#### Defined in - -[types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L32) - -___ - -### storageStore - -▸ **storageStore**(`address`, `key`, `value`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Buffer` | -| `value` | `Buffer` | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[types.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L31) - -___ - -### verifyProof - -▸ `Optional` **verifyProof**(`proof`): `Promise`<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `proof` | `Proof` | - -#### Returns - -`Promise`<`boolean`\> - -#### Inherited from - -[EVMStateAccess](EVMStateAccess.md).[verifyProof](EVMStateAccess.md#verifyproof) - -#### Defined in - -[types.ts:278](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L278) diff --git a/packages/evm/docs/interfaces/EVMInterface.md b/packages/evm/docs/interfaces/EVMInterface.md index 247c518291..d24d598f33 100644 --- a/packages/evm/docs/interfaces/EVMInterface.md +++ b/packages/evm/docs/interfaces/EVMInterface.md @@ -2,82 +2,77 @@ # Interface: EVMInterface -API of the EVM - ## Table of contents ### Properties -- [eei](EVMInterface.md#eei) - [events](EVMInterface.md#events) +- [journal](EVMInterface.md#journal) - [precompiles](EVMInterface.md#precompiles) +- [stateManager](EVMInterface.md#statemanager) ### Methods -- [copy](EVMInterface.md#copy) -- [getActiveOpcodes](EVMInterface.md#getactiveopcodes) - [runCall](EVMInterface.md#runcall) - [runCode](EVMInterface.md#runcode) ## Properties -### eei - -• **eei**: [`EEIInterface`](EEIInterface.md) - -#### Defined in - -[types.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L17) - -___ - ### events • `Optional` **events**: `AsyncEventEmitter`<`EVMEvents`\> #### Defined in -[types.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L18) +[types.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L158) ___ -### precompiles +### journal -• **precompiles**: `Map`<`string`, `any`\> +• **journal**: `Object` -#### Defined in +#### Type declaration -[types.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L15) +| Name | Type | +| :------ | :------ | +| `accessList?` | `Map`<`string`, `Set`<`string`\>\> | +| `addAlwaysWarmAddress` | (`address`: `string`, `addToAccessList?`: `boolean`) => `void` | +| `addAlwaysWarmSlot` | (`address`: `string`, `slot`: `string`, `addToAccessList?`: `boolean`) => `void` | +| `checkpoint` | () => `Promise`<`void`\> | +| `cleanJournal` | () => `void` | +| `cleanup` | () => `Promise`<`void`\> | +| `commit` | () => `Promise`<`void`\> | +| `deleteAccount` | (`address`: `Address`) => `Promise`<`void`\> | +| `putAccount` | (`address`: `Address`, `account`: `Account`) => `Promise`<`void`\> | +| `revert` | () => `Promise`<`void`\> | +| `startReportingAccessList` | () => `void` | -## Methods +#### Defined in -### shallowCopy +[types.ts:141](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L141) -▸ **shallowCopy**(): [`EVMInterface`](EVMInterface.md) +___ -#### Returns +### precompiles -[`EVMInterface`](EVMInterface.md) +• **precompiles**: `Map`<`string`, `PrecompileFunc`\> #### Defined in -[types.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L16) +[types.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L155) ___ -### getActiveOpcodes +### stateManager -▸ `Optional` **getActiveOpcodes**(): `OpcodeList` - -#### Returns - -`OpcodeList` +• **stateManager**: `EVMStateManagerInterface` #### Defined in -[types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L14) +[types.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L154) -___ +## Methods ### runCall @@ -95,13 +90,13 @@ ___ #### Defined in -[types.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L12) +[types.ts:156](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L156) ___ ### runCode -▸ `Optional` **runCode**(`opts`): `Promise`<[`ExecResult`](ExecResult.md)\> +▸ **runCode**(`opts`): `Promise`<[`ExecResult`](ExecResult.md)\> #### Parameters @@ -115,4 +110,4 @@ ___ #### Defined in -[types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L13) +[types.ts:157](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L157) diff --git a/packages/evm/docs/interfaces/EVMResult.md b/packages/evm/docs/interfaces/EVMResult.md index 3e01acfba2..a51b656b58 100644 --- a/packages/evm/docs/interfaces/EVMResult.md +++ b/packages/evm/docs/interfaces/EVMResult.md @@ -21,7 +21,7 @@ Address of created account during transaction, if any #### Defined in -[evm.ts:971](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/evm.ts#L971) +[types.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L266) ___ @@ -33,4 +33,4 @@ Contains the results from running the code, if any, as described in runCode #### Defined in -[evm.ts:975](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/evm.ts#L975) +[types.ts:270](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L270) diff --git a/packages/evm/docs/interfaces/EVMStateAccess.md b/packages/evm/docs/interfaces/EVMStateAccess.md deleted file mode 100644 index 410af022b8..0000000000 --- a/packages/evm/docs/interfaces/EVMStateAccess.md +++ /dev/null @@ -1,654 +0,0 @@ -[@ethereumjs/evm](../README.md) / EVMStateAccess - -# Interface: EVMStateAccess - -API for EVM state access, this extends the base interface from -the `@ethereumjs/statemanager` package and is part of the broader -EEI (see EEI interface). - -An implementation of this can be found in the `@ethereumjs/vm` package. - -## Hierarchy - -- `StateAccess` - - ↳ **`EVMStateAccess`** - - ↳↳ [`EEIInterface`](EEIInterface.md) - -## Table of contents - -### Methods - -- [accountExists](EVMStateAccess.md#accountexists) -- [accountIsEmpty](EVMStateAccess.md#accountisempty) -- [addWarmedAddress](EVMStateAccess.md#addwarmedaddress) -- [addWarmedStorage](EVMStateAccess.md#addwarmedstorage) -- [checkpoint](EVMStateAccess.md#checkpoint) -- [cleanupTouchedAccounts](EVMStateAccess.md#cleanuptouchedaccounts) -- [clearContractStorage](EVMStateAccess.md#clearcontractstorage) -- [clearOriginalStorageCache](EVMStateAccess.md#clearoriginalstoragecache) -- [clearWarmedAccounts](EVMStateAccess.md#clearwarmedaccounts) -- [commit](EVMStateAccess.md#commit) -- [deleteAccount](EVMStateAccess.md#deleteaccount) -- [generateAccessList](EVMStateAccess.md#generateaccesslist) -- [generateCanonicalGenesis](EVMStateAccess.md#generatecanonicalgenesis) -- [getAccount](EVMStateAccess.md#getaccount) -- [getContractCode](EVMStateAccess.md#getcontractcode) -- [getContractStorage](EVMStateAccess.md#getcontractstorage) -- [getProof](EVMStateAccess.md#getproof) -- [getStateRoot](EVMStateAccess.md#getstateroot) -- [hasStateRoot](EVMStateAccess.md#hasstateroot) -- [isWarmedAddress](EVMStateAccess.md#iswarmedaddress) -- [isWarmedStorage](EVMStateAccess.md#iswarmedstorage) -- [modifyAccountFields](EVMStateAccess.md#modifyaccountfields) -- [putAccount](EVMStateAccess.md#putaccount) -- [putContractCode](EVMStateAccess.md#putcontractcode) -- [putContractStorage](EVMStateAccess.md#putcontractstorage) -- [revert](EVMStateAccess.md#revert) -- [setStateRoot](EVMStateAccess.md#setstateroot) -- [verifyProof](EVMStateAccess.md#verifyproof) - -## Methods - -### accountExists - -▸ **accountExists**(`address`): `Promise`<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`boolean`\> - -#### Inherited from - -StateAccess.accountExists - -#### Defined in - -[types.ts:261](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L261) - -___ - -### accountIsEmpty - -▸ **accountIsEmpty**(`address`): `Promise`<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`boolean`\> - -#### Inherited from - -StateAccess.accountIsEmpty - -#### Defined in - -[types.ts:264](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L264) - -___ - -### addWarmedAddress - -▸ **addWarmedAddress**(`address`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Buffer` | - -#### Returns - -`void` - -#### Defined in - -[types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L44) - -___ - -### addWarmedStorage - -▸ **addWarmedStorage**(`address`, `slot`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Buffer` | -| `slot` | `Buffer` | - -#### Returns - -`void` - -#### Defined in - -[types.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L46) - -___ - -### checkpoint - -▸ **checkpoint**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -StateAccess.checkpoint - -#### Defined in - -[types.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L272) - -___ - -### cleanupTouchedAccounts - -▸ **cleanupTouchedAccounts**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[types.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L51) - -___ - -### clearContractStorage - -▸ **clearContractStorage**(`address`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -StateAccess.clearContractStorage - -#### Defined in - -[types.ts:271](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L271) - -___ - -### clearOriginalStorageCache - -▸ **clearOriginalStorageCache**(): `void` - -#### Returns - -`void` - -#### Defined in - -[types.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L50) - -___ - -### clearWarmedAccounts - -▸ **clearWarmedAccounts**(): `void` - -#### Returns - -`void` - -#### Defined in - -[types.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L48) - -___ - -### commit - -▸ **commit**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -StateAccess.commit - -#### Defined in - -[types.ts:273](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L273) - -___ - -### deleteAccount - -▸ **deleteAccount**(`address`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -StateAccess.deleteAccount - -#### Defined in - -[types.ts:265](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L265) - -___ - -### generateAccessList - -▸ `Optional` **generateAccessList**(`addressesRemoved`, `addressesOnlyStorage`): `AccessList` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `addressesRemoved` | `Address`[] | -| `addressesOnlyStorage` | `Address`[] | - -#### Returns - -`AccessList` - -#### Defined in - -[types.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L49) - -___ - -### generateCanonicalGenesis - -▸ **generateCanonicalGenesis**(`initState`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `initState` | `any` | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[types.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L52) - -___ - -### getAccount - -▸ **getAccount**(`address`): `Promise`<`Account`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`Account`\> - -#### Inherited from - -StateAccess.getAccount - -#### Defined in - -[types.ts:262](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L262) - -___ - -### getContractCode - -▸ **getContractCode**(`address`): `Promise`<`Buffer`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | - -#### Returns - -`Promise`<`Buffer`\> - -#### Inherited from - -StateAccess.getContractCode - -#### Defined in - -[types.ts:268](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L268) - -___ - -### getContractStorage - -▸ **getContractStorage**(`address`, `key`): `Promise`<`Buffer`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Buffer` | - -#### Returns - -`Promise`<`Buffer`\> - -#### Inherited from - -StateAccess.getContractStorage - -#### Defined in - -[types.ts:269](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L269) - -___ - -### getProof - -▸ `Optional` **getProof**(`address`, `storageSlots`): `Promise`<`Proof`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `storageSlots` | `Buffer`[] | - -#### Returns - -`Promise`<`Proof`\> - -#### Inherited from - -StateAccess.getProof - -#### Defined in - -[types.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L277) - -___ - -### getStateRoot - -▸ **getStateRoot**(): `Promise`<`Buffer`\> - -#### Returns - -`Promise`<`Buffer`\> - -#### Inherited from - -StateAccess.getStateRoot - -#### Defined in - -[types.ts:275](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L275) - -___ - -### hasStateRoot - -▸ **hasStateRoot**(`root`): `Promise`<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `root` | `Buffer` | - -#### Returns - -`Promise`<`boolean`\> - -#### Inherited from - -StateAccess.hasStateRoot - -#### Defined in - -[types.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L279) - -___ - -### isWarmedAddress - -▸ **isWarmedAddress**(`address`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Buffer` | - -#### Returns - -`boolean` - -#### Defined in - -[types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L45) - -___ - -### isWarmedStorage - -▸ **isWarmedStorage**(`address`, `slot`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Buffer` | -| `slot` | `Buffer` | - -#### Returns - -`boolean` - -#### Defined in - -[types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L47) - -___ - -### modifyAccountFields - -▸ **modifyAccountFields**(`address`, `accountFields`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `accountFields` | `Partial`<`Pick`<`Account`, ``"nonce"`` \| ``"balance"`` \| ``"storageRoot"`` \| ``"codeHash"``\>\> | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -StateAccess.modifyAccountFields - -#### Defined in - -[types.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L266) - -___ - -### putAccount - -▸ **putAccount**(`address`, `account`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `account` | `Account` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -StateAccess.putAccount - -#### Defined in - -[types.ts:263](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L263) - -___ - -### putContractCode - -▸ **putContractCode**(`address`, `value`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `value` | `Buffer` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -StateAccess.putContractCode - -#### Defined in - -[types.ts:267](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L267) - -___ - -### putContractStorage - -▸ **putContractStorage**(`address`, `key`, `value`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `Address` | -| `key` | `Buffer` | -| `value` | `Buffer` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -StateAccess.putContractStorage - -#### Defined in - -[types.ts:270](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L270) - -___ - -### revert - -▸ **revert**(): `Promise`<`void`\> - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -StateAccess.revert - -#### Defined in - -[types.ts:274](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L274) - -___ - -### setStateRoot - -▸ **setStateRoot**(`stateRoot`): `Promise`<`void`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `stateRoot` | `Buffer` | - -#### Returns - -`Promise`<`void`\> - -#### Inherited from - -StateAccess.setStateRoot - -#### Defined in - -[types.ts:276](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L276) - -___ - -### verifyProof - -▸ `Optional` **verifyProof**(`proof`): `Promise`<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `proof` | `Proof` | - -#### Returns - -`Promise`<`boolean`\> - -#### Inherited from - -StateAccess.verifyProof - -#### Defined in - -[types.ts:278](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L278) diff --git a/packages/evm/docs/interfaces/ExecResult.md b/packages/evm/docs/interfaces/ExecResult.md index 88250ee1ff..4e910878b8 100644 --- a/packages/evm/docs/interfaces/ExecResult.md +++ b/packages/evm/docs/interfaces/ExecResult.md @@ -8,6 +8,8 @@ Result of executing a call via the EVM. ### Properties +- [blobGasUsed](ExecResult.md#blobgasused) +- [createdAddresses](ExecResult.md#createdaddresses) - [exceptionError](ExecResult.md#exceptionerror) - [executionGasUsed](ExecResult.md#executiongasused) - [gas](ExecResult.md#gas) @@ -19,6 +21,30 @@ Result of executing a call via the EVM. ## Properties +### blobGasUsed + +• `Optional` **blobGasUsed**: `bigint` + +Amount of blob gas consumed by the transaction + +#### Defined in + +[types.ts:313](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L313) + +___ + +### createdAddresses + +• `Optional` **createdAddresses**: `Set`<`string`\> + +Map of addresses which were created (used in EIP 6780) + +#### Defined in + +[types.ts:305](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L305) + +___ + ### exceptionError • `Optional` **exceptionError**: [`EvmError`](../classes/EvmError.md) @@ -27,7 +53,7 @@ Description of the exception, if any occurred #### Defined in -[evm.ts:986](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/evm.ts#L986) +[types.ts:281](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L281) ___ @@ -39,7 +65,7 @@ Amount of gas the code used to run #### Defined in -[evm.ts:994](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/evm.ts#L994) +[types.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L289) ___ @@ -51,7 +77,7 @@ Amount of gas left #### Defined in -[evm.ts:990](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/evm.ts#L990) +[types.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L285) ___ @@ -63,7 +89,7 @@ The gas refund counter #### Defined in -[evm.ts:1010](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/evm.ts#L1010) +[types.ts:309](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L309) ___ @@ -75,19 +101,19 @@ Array of logs that the contract emitted #### Defined in -[evm.ts:1002](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/evm.ts#L1002) +[types.ts:297](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L297) ___ ### returnValue -• **returnValue**: `Buffer` +• **returnValue**: `Uint8Array` Return value from the contract #### Defined in -[evm.ts:998](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/evm.ts#L998) +[types.ts:293](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L293) ___ @@ -97,20 +123,16 @@ ___ #### Defined in -[evm.ts:982](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/evm.ts#L982) +[types.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L277) ___ ### selfdestruct -• `Optional` **selfdestruct**: `Object` - -A map from the accounts that have self-destructed to the addresses to send their funds to - -#### Index signature +• `Optional` **selfdestruct**: `Set`<`string`\> -▪ [k: `string`]: `Buffer` +A set of accounts to selfdestruct #### Defined in -[evm.ts:1006](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/evm.ts#L1006) +[types.ts:301](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/types.ts#L301) diff --git a/packages/evm/docs/interfaces/InterpreterStep.md b/packages/evm/docs/interfaces/InterpreterStep.md index da17c42779..d80038b37b 100644 --- a/packages/evm/docs/interfaces/InterpreterStep.md +++ b/packages/evm/docs/interfaces/InterpreterStep.md @@ -10,7 +10,6 @@ - [address](InterpreterStep.md#address) - [codeAddress](InterpreterStep.md#codeaddress) - [depth](InterpreterStep.md#depth) -- [eei](InterpreterStep.md#eei) - [gasLeft](InterpreterStep.md#gasleft) - [gasRefund](InterpreterStep.md#gasrefund) - [memory](InterpreterStep.md#memory) @@ -19,6 +18,7 @@ - [pc](InterpreterStep.md#pc) - [returnStack](InterpreterStep.md#returnstack) - [stack](InterpreterStep.md#stack) +- [stateManager](InterpreterStep.md#statemanager) ## Properties @@ -28,7 +28,7 @@ #### Defined in -[interpreter.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L94) +[interpreter.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L102) ___ @@ -38,7 +38,7 @@ ___ #### Defined in -[interpreter.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L95) +[interpreter.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L103) ___ @@ -48,7 +48,7 @@ ___ #### Defined in -[interpreter.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L98) +[interpreter.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L106) ___ @@ -58,17 +58,7 @@ ___ #### Defined in -[interpreter.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L87) - -___ - -### eei - -• **eei**: [`EEIInterface`](EEIInterface.md) - -#### Defined in - -[interpreter.ts:83](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L83) +[interpreter.ts:95](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L95) ___ @@ -78,7 +68,7 @@ ___ #### Defined in -[interpreter.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L81) +[interpreter.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L89) ___ @@ -88,17 +78,17 @@ ___ #### Defined in -[interpreter.ts:82](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L82) +[interpreter.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L90) ___ ### memory -• **memory**: `Buffer` +• **memory**: `Uint8Array` #### Defined in -[interpreter.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L96) +[interpreter.ts:104](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L104) ___ @@ -108,7 +98,7 @@ ___ #### Defined in -[interpreter.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L97) +[interpreter.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L105) ___ @@ -127,7 +117,7 @@ ___ #### Defined in -[interpreter.ts:88](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L88) +[interpreter.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L96) ___ @@ -137,7 +127,7 @@ ___ #### Defined in -[interpreter.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L86) +[interpreter.ts:94](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L94) ___ @@ -147,7 +137,7 @@ ___ #### Defined in -[interpreter.ts:85](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L85) +[interpreter.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L93) ___ @@ -157,4 +147,14 @@ ___ #### Defined in -[interpreter.ts:84](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L84) +[interpreter.ts:92](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L92) + +___ + +### stateManager + +• **stateManager**: `EVMStateManagerInterface` + +#### Defined in + +[interpreter.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/interpreter.ts#L91) diff --git a/packages/evm/docs/interfaces/PrecompileInput.md b/packages/evm/docs/interfaces/PrecompileInput.md new file mode 100644 index 0000000000..53c76263d9 --- /dev/null +++ b/packages/evm/docs/interfaces/PrecompileInput.md @@ -0,0 +1,63 @@ +[@ethereumjs/evm](../README.md) / PrecompileInput + +# Interface: PrecompileInput + +## Table of contents + +### Properties + +- [\_EVM](PrecompileInput.md#_evm) +- [\_debug](PrecompileInput.md#_debug) +- [common](PrecompileInput.md#common) +- [data](PrecompileInput.md#data) +- [gasLimit](PrecompileInput.md#gaslimit) + +## Properties + +### \_EVM + +• **\_EVM**: [`EVMInterface`](EVMInterface.md) + +#### Defined in + +[precompiles/types.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L13) + +___ + +### \_debug + +• `Optional` **\_debug**: `Debugger` + +#### Defined in + +[precompiles/types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L14) + +___ + +### common + +• **common**: `Common` + +#### Defined in + +[precompiles/types.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L12) + +___ + +### data + +• **data**: `Uint8Array` + +#### Defined in + +[precompiles/types.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L10) + +___ + +### gasLimit + +• **gasLimit**: `bigint` + +#### Defined in + +[precompiles/types.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/evm/src/precompiles/types.ts#L11) diff --git a/packages/evm/package.json b/packages/evm/package.json index 36d217ebe3..ca35ed20d5 100644 --- a/packages/evm/package.json +++ b/packages/evm/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/evm", - "version": "2.0.0-rc.2", + "version": "2.0.0", "description": "JavaScript Ethereum Virtual Machine (EVM) implementation", "keywords": [ "ethereum", @@ -52,10 +52,10 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/statemanager": "2.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/statemanager": "^2.0.0", + "@ethereumjs/tx": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2", "rustbn-wasm": "^0.2.0" diff --git a/packages/genesis/CHANGELOG.md b/packages/genesis/CHANGELOG.md index 08036e8f67..5d963e38bf 100644 --- a/packages/genesis/CHANGELOG.md +++ b/packages/genesis/CHANGELOG.md @@ -6,6 +6,12 @@ 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). +## 0.1.0 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Fgenesis%400.1.0-rc.1) for the main change description. + ## 0.1.0-rc.1 - 2023-07-18 Initial release. diff --git a/packages/genesis/README.md b/packages/genesis/README.md index 5a9dd312c0..ec74f625e5 100644 --- a/packages/genesis/README.md +++ b/packages/genesis/README.md @@ -6,8 +6,6 @@ [![Code Coverage][genesis-coverage-badge]][genesis-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | A module to provide genesis states of well known networks. | | ---------------------------------------------------------- | diff --git a/packages/genesis/package.json b/packages/genesis/package.json index 9d229d42b4..722ab5a35d 100644 --- a/packages/genesis/package.json +++ b/packages/genesis/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/genesis", - "version": "0.1.0-rc.1", + "version": "0.1.0", "description": "A module to provide genesis states of well known networks", "keywords": [ "ethereum", @@ -56,8 +56,8 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1" + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/util": "^9.0.0" }, "engines": { "node": ">=18" diff --git a/packages/rlp/CHANGELOG.md b/packages/rlp/CHANGELOG.md index 03ae11e115..3d03022242 100644 --- a/packages/rlp/CHANGELOG.md +++ b/packages/rlp/CHANGELOG.md @@ -6,6 +6,12 @@ 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). +## 5.0.0 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Frlp%405.0.0-rc.1) for the main change description. + ## 5.0.0-rc.1 - 2023-07-18 ### Hybrid CJS/ESM Build diff --git a/packages/rlp/README.md b/packages/rlp/README.md index 1b33001573..bed2fbd362 100644 --- a/packages/rlp/README.md +++ b/packages/rlp/README.md @@ -6,8 +6,6 @@ [![Code Coverage][rlp-coverage-badge]][rlp-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | [Recursive Length Prefix](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp) encoding for Node.js and the browser. | | ----------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/packages/rlp/package.json b/packages/rlp/package.json index 1ed17f108f..b0aae51fed 100644 --- a/packages/rlp/package.json +++ b/packages/rlp/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/rlp", - "version": "5.0.0-rc.1", + "version": "5.0.0", "description": "Recursive Length Prefix Encoding Module", "keywords": [ "rlp", diff --git a/packages/statemanager/CHANGELOG.md b/packages/statemanager/CHANGELOG.md index 2858e36efa..78abf80dd3 100644 --- a/packages/statemanager/CHANGELOG.md +++ b/packages/statemanager/CHANGELOG.md @@ -6,6 +6,16 @@ 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 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Fstatemanager%402.0.0-rc.1) for the main change description. + +Following additional changes since RC1: + +- `Breaking`: new `dumpStorageRangeAt()` implementation + EVMStateManager interface addition (in @ethereumjs/common), PR [#2922](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2922) + ## 2.0.0-rc.1 - 2023-07-18 This is the release candidate (RC1) for the upcoming breaking releases on the various EthereumJS libraries. The associated release notes below are the main source of information on the changeset, also for the upcoming final releases, where we'll just provide change addition summaries + references to these RC1 notes. diff --git a/packages/statemanager/README.md b/packages/statemanager/README.md index 520c90b56d..43a29a8d3f 100644 --- a/packages/statemanager/README.md +++ b/packages/statemanager/README.md @@ -6,8 +6,6 @@ [![Code Coverage][statemanager-coverage-badge]][statemanager-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | Library to provide high level access to Ethereum State | | ------------------------------------------------------ | diff --git a/packages/statemanager/docs/classes/DefaultStateManager.md b/packages/statemanager/docs/classes/DefaultStateManager.md index 063a4556ec..d02c155e18 100644 --- a/packages/statemanager/docs/classes/DefaultStateManager.md +++ b/packages/statemanager/docs/classes/DefaultStateManager.md @@ -67,7 +67,7 @@ Instantiate the StateManager interface. #### Defined in -[stateManager.ts:172](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L172) +[stateManager.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L174) ## Properties @@ -113,7 +113,7 @@ EVMStateManagerInterface.checkpoint #### Defined in -[stateManager.ts:524](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L524) +[stateManager.ts:528](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L528) ___ @@ -155,7 +155,7 @@ EVMStateManagerInterface.clearContractStorage #### Defined in -[stateManager.ts:507](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L507) +[stateManager.ts:511](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L511) ___ @@ -176,7 +176,7 @@ EVMStateManagerInterface.commit #### Defined in -[stateManager.ts:535](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L535) +[stateManager.ts:539](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L539) ___ @@ -202,7 +202,7 @@ EVMStateManagerInterface.deleteAccount #### Defined in -[stateManager.ts:295](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L295) +[stateManager.ts:299](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L299) ___ @@ -248,7 +248,7 @@ Writes all cache items to the trie #### Defined in -[stateManager.ts:575](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L575) +[stateManager.ts:579](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L579) ___ @@ -301,7 +301,7 @@ EVMStateManagerInterface.getAccount #### Defined in -[stateManager.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L222) +[stateManager.ts:226](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L226) ___ @@ -330,7 +330,7 @@ EVMStateManagerInterface.getContractCode #### Defined in -[stateManager.ts:343](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L343) +[stateManager.ts:347](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L347) ___ @@ -362,7 +362,7 @@ EVMStateManagerInterface.getContractStorage #### Defined in -[stateManager.ts:393](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L393) +[stateManager.ts:397](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L397) ___ @@ -389,7 +389,7 @@ EVMStateManagerInterface.getProof #### Defined in -[stateManager.ts:613](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L613) +[stateManager.ts:617](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L617) ___ @@ -468,7 +468,7 @@ EVMStateManagerInterface.modifyAccountFields #### Defined in -[stateManager.ts:279](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L279) +[stateManager.ts:283](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L283) ___ @@ -495,7 +495,7 @@ EVMStateManagerInterface.putAccount #### Defined in -[stateManager.ts:246](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L246) +[stateManager.ts:250](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L250) ___ @@ -523,7 +523,7 @@ EVMStateManagerInterface.putContractCode #### Defined in -[stateManager.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L315) +[stateManager.ts:319](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L319) ___ @@ -552,7 +552,7 @@ EVMStateManagerInterface.putContractStorage #### Defined in -[stateManager.ts:480](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L480) +[stateManager.ts:484](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L484) ___ @@ -573,7 +573,7 @@ EVMStateManagerInterface.revert #### Defined in -[stateManager.ts:556](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L556) +[stateManager.ts:560](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L560) ___ @@ -655,4 +655,4 @@ Verify an EIP-1186 proof. Throws if proof is invalid, otherwise returns true. #### Defined in -[stateManager.ts:661](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L661) +[stateManager.ts:665](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/statemanager/src/stateManager.ts#L665) diff --git a/packages/statemanager/package.json b/packages/statemanager/package.json index bcdcc8e8d9..f74d27fed6 100644 --- a/packages/statemanager/package.json +++ b/packages/statemanager/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/statemanager", - "version": "2.0.0-rc.1", + "version": "2.0.0", "description": "An Ethereum statemanager implementation", "keywords": [ "ethereum", @@ -48,8 +48,8 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/rlp": "^5.0.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2", "ethers": "^6.4.0", @@ -57,10 +57,10 @@ "lru-cache": "^10.0.0" }, "devDependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/genesis": "0.1.0-rc.1", - "@ethereumjs/trie": "6.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/block": "^5.0.0", + "@ethereumjs/genesis": "^0.1.0", + "@ethereumjs/trie": "^6.0.0", + "@ethereumjs/util": "^9.0.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2" } diff --git a/packages/trie/CHANGELOG.md b/packages/trie/CHANGELOG.md index 027f2549af..449a3813b0 100644 --- a/packages/trie/CHANGELOG.md +++ b/packages/trie/CHANGELOG.md @@ -6,6 +6,31 @@ 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). +## 6.0.0 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Ftrie%406.0.0-rc.1) for the main change description. + +Following additional changes since RC1: + +## New API for walking a (sparse) Trie + +Starting with this release there is a new API for walking and iterating a trie by using an async walk generator, which now enables to walk tries without altering the walk controller and also now enables to walk a sparse (not completely filled) trie, see PR [#2904](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2904). + +The new walk functionality can be used like the following: + +```typescript +import { Trie } from '@ethereumjs/trie' + +const trie = await Trie.create() +const walk = trie.walkTrieIterable(trie.root()) + +for await (const { node, currentKey } of walk) { + // ... do something i.e. console.log( { node, currentKey } ) +} +``` + ## 6.0.0-rc.1 - 2023-07-18 This is the release candidate (RC1) for the upcoming breaking releases on the various EthereumJS libraries. The associated release notes below are the main source of information on the changeset, also for the upcoming final releases, where we'll just provide change addition summaries + references to these RC1 notes. diff --git a/packages/trie/README.md b/packages/trie/README.md index 78cf78cc8f..1865368aa9 100644 --- a/packages/trie/README.md +++ b/packages/trie/README.md @@ -6,8 +6,6 @@ [![Code Coverage][trie-coverage-badge]][trie-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | Implementation of the [Modified Merkle Patricia Trie](https://ethereum.org/en/developers/docs/data-structures-and-encoding/patricia-merkle-trie/) as specified in the [Ethereum Yellow Paper](http://gavwood.com/Paper.pdf) | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -65,6 +63,23 @@ test() When the static `Trie.create` constructor is used without any options, the `trie` object is instantiated with defaults configured to match the Etheruem production spec (i.e. keys are hashed using SHA256). It also persists the state root of the tree on each write operation, ensuring that your trie remains in the state you left it when you start your application the next time. +### Walking a Trie + +Starting with the v6 release there is a new API for walking and iterating a trie by using an async walk generator, which now enables to walk tries without altering the walk controller and also now enables to walk a sparse (not completely filled) trie. + +The new walk functionality can be used like the following: + +```typescript +import { Trie } from '@ethereumjs/trie' + +const trie = await Trie.create() +const walk = trie.walkTrieIterable(trie.root()) + +for await (const { node, currentKey } of walk) { + // ... do something i.e. console.log( { node, currentKey } ) +} +``` + ### `Trie` Configuration Options #### Database Options diff --git a/packages/trie/docs/README.md b/packages/trie/docs/README.md index 53043c61e9..532b5fe1bb 100644 --- a/packages/trie/docs/README.md +++ b/packages/trie/docs/README.md @@ -37,10 +37,21 @@ ### Functions +- [byteTypeToNibbleType](README.md#bytetypetonibbletype) +- [bytesToNibbles](README.md#bytestonibbles) +- [compactBytesToNibbles](README.md#compactbytestonibbles) - [decodeNode](README.md#decodenode) - [decodeRawNode](README.md#decoderawnode) - [genesisStateRoot](README.md#genesisstateroot) +- [hasTerminator](README.md#hasterminator) +- [hexToKeybytes](README.md#hextokeybytes) - [isRawNode](README.md#israwnode) +- [mergeAndFormatKeyPaths](README.md#mergeandformatkeypaths) +- [nibbleTypeToByteType](README.md#nibbletypetobytetype) +- [nibbleTypeToPackedBytes](README.md#nibbletypetopackedbytes) +- [nibblesToBytes](README.md#nibblestobytes) +- [nibblesToCompactBytes](README.md#nibblestocompactbytes) +- [pathToHexKey](README.md#pathtohexkey) - [verifyRangeProof](README.md#verifyrangeproof) ## Type Aliases @@ -173,6 +184,70 @@ ___ ## Functions +### byteTypeToNibbleType + +▸ **byteTypeToNibbleType**(`key`): [`Nibbles`](README.md#nibbles) + +Turns each byte into a single nibble, only extracting the lower nibble of each byte + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `key` | `Uint8Array` | Uint8Array typed byte array | + +#### Returns + +[`Nibbles`](README.md#nibbles) + +Nibble typed nibble array + +#### Defined in + +[packages/trie/src/util/encoding.ts:144](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L144) + +___ + +### bytesToNibbles + +▸ **bytesToNibbles**(`str`): `Uint8Array` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `str` | `Uint8Array` | + +#### Returns + +`Uint8Array` + +#### Defined in + +[packages/trie/src/util/encoding.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L77) + +___ + +### compactBytesToNibbles + +▸ **compactBytesToNibbles**(`compact`): `Uint8Array` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `compact` | `Uint8Array` | + +#### Returns + +`Uint8Array` + +#### Defined in + +[packages/trie/src/util/encoding.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L91) + +___ + ### decodeNode ▸ **decodeNode**(`raw`): [`BranchNode`](classes/BranchNode.md) \| [`ExtensionNode`](classes/ExtensionNode.md) \| [`LeafNode`](classes/LeafNode.md) @@ -235,6 +310,49 @@ Derives the stateRoot of the genesis block based on genesis allocations ___ +### hasTerminator + +▸ **hasTerminator**(`nibbles`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `nibbles` | `Uint8Array` | + +#### Returns + +`boolean` + +boolean indicating if input hex nibble sequence has terminator indicating leaf-node + terminator is represented with 16 because a nibble ranges from 0 - 15(f) + +#### Defined in + +[packages/trie/src/util/encoding.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L31) + +___ + +### hexToKeybytes + +▸ **hexToKeybytes**(`hex`): `Uint8Array` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `hex` | `Uint8Array` | + +#### Returns + +`Uint8Array` + +#### Defined in + +[packages/trie/src/util/encoding.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L41) + +___ + ### isRawNode ▸ **isRawNode**(`n`): `boolean` @@ -255,6 +373,141 @@ ___ ___ +### mergeAndFormatKeyPaths + +▸ **mergeAndFormatKeyPaths**(`pathStrings`): `Uint8Array`[][] + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `pathStrings` | `string`[] | + +#### Returns + +`Uint8Array`[][] + +#### Defined in + +[packages/trie/src/util/encoding.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L175) + +___ + +### nibbleTypeToByteType + +▸ **nibbleTypeToByteType**(`arr`): `Uint8Array` + +Converts each nibble into a single byte + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `arr` | [`Nibbles`](README.md#nibbles) | Nibble typed nibble array | + +#### Returns + +`Uint8Array` + +Uint8Array typed byte array + +#### Defined in + +[packages/trie/src/util/encoding.ts:128](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L128) + +___ + +### nibbleTypeToPackedBytes + +▸ **nibbleTypeToPackedBytes**(`arr`): `Uint8Array` + +Packs every two nibbles into a single byte + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `arr` | [`Nibbles`](README.md#nibbles) | Nibble typed nibble array | + +#### Returns + +`Uint8Array` + +Uint8Array typed byte array + +#### Defined in + +[packages/trie/src/util/encoding.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L112) + +___ + +### nibblesToBytes + +▸ **nibblesToBytes**(`nibbles`, `bytes`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `nibbles` | `Uint8Array` | +| `bytes` | `Uint8Array` | + +#### Returns + +`void` + +#### Defined in + +[packages/trie/src/util/encoding.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L35) + +___ + +### nibblesToCompactBytes + +▸ **nibblesToCompactBytes**(`nibbles`): `Uint8Array` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `nibbles` | `Uint8Array` | + +#### Returns + +`Uint8Array` + +#### Defined in + +[packages/trie/src/util/encoding.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L55) + +___ + +### pathToHexKey + +▸ **pathToHexKey**(`path`, `extension`, `retType`): `Uint8Array` + +Takes a string path and extends it by the given extension nibbles + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | String node path | +| `extension` | [`Nibbles`](README.md#nibbles) | nibbles to extend by | +| `retType` | `string` | string indicating whether to return the key in "keybyte" or "hex" encoding | + +#### Returns + +`Uint8Array` + +hex-encoded key + +#### Defined in + +[packages/trie/src/util/encoding.ts:164](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/util/encoding.ts#L164) + +___ + ### verifyRangeProof ▸ **verifyRangeProof**(`rootHash`, `firstKey`, `lastKey`, `keys`, `values`, `proof`, `useKeyHashingFunction`): `Promise`<`boolean`\> diff --git a/packages/trie/docs/classes/Trie.md b/packages/trie/docs/classes/Trie.md index 06a611bdf8..2aa22c7cc9 100644 --- a/packages/trie/docs/classes/Trie.md +++ b/packages/trie/docs/classes/Trie.md @@ -13,6 +13,7 @@ The basic trie interface, use with `import { Trie } from '@ethereumjs/trie'`. ### Properties - [EMPTY\_TRIE\_ROOT](Trie.md#empty_trie_root) +- [walkTrieIterable](Trie.md#walktrieiterable) ### Methods @@ -39,6 +40,8 @@ The basic trie interface, use with `import { Trie } from '@ethereumjs/trie'`. - [verifyProof](Trie.md#verifyproof) - [verifyPrunedIntegrity](Trie.md#verifyprunedintegrity) - [verifyRangeProof](Trie.md#verifyrangeproof) +- [walkAllNodes](Trie.md#walkallnodes) +- [walkAllValueNodes](Trie.md#walkallvaluenodes) - [walkTrie](Trie.md#walktrie) - [create](Trie.md#create) @@ -58,7 +61,7 @@ Creates a new trie. #### Defined in -[packages/trie/src/trie.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L73) +[packages/trie/src/trie.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L75) ## Properties @@ -70,7 +73,31 @@ The root for an empty trie #### Defined in -[packages/trie/src/trie.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L59) +[packages/trie/src/trie.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L61) + +___ + +### walkTrieIterable + +• **walkTrieIterable**: (...`args`: [nodeHash: Uint8Array, currentKey: number[], onFound: OnFound, filter: NodeFilter, visited: Set]) => `AsyncIterable`<{ `currentKey`: `number`[] ; `node`: [`TrieNode`](../README.md#trienode) }\> + +#### Type declaration + +▸ (...`args`): `AsyncIterable`<{ `currentKey`: `number`[] ; `node`: [`TrieNode`](../README.md#trienode) }\> + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `...args` | [nodeHash: Uint8Array, currentKey: number[], onFound: OnFound, filter: NodeFilter, visited: Set] | + +##### Returns + +`AsyncIterable`<{ `currentKey`: `number`[] ; `node`: [`TrieNode`](../README.md#trienode) }\> + +#### Defined in + +[packages/trie/src/trie.ts:355](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L355) ## Methods @@ -106,7 +133,7 @@ await trie.batch(ops) #### Defined in -[packages/trie/src/trie.ts:722](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L722) +[packages/trie/src/trie.ts:755](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L755) ___ @@ -128,7 +155,7 @@ Checks if a given root exists. #### Defined in -[packages/trie/src/trie.ts:148](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L148) +[packages/trie/src/trie.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L150) ___ @@ -145,7 +172,7 @@ After this is called, all changes can be reverted until `commit` is called. #### Defined in -[packages/trie/src/trie.ts:968](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L968) +[packages/trie/src/trie.ts:1001](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1001) ___ @@ -166,7 +193,7 @@ If not during a checkpoint phase #### Defined in -[packages/trie/src/trie.ts:977](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L977) +[packages/trie/src/trie.ts:1010](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1010) ___ @@ -188,7 +215,7 @@ Creates a proof from a trie and key that can be verified using [verifyProof](Tri #### Defined in -[packages/trie/src/trie.ts:762](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L762) +[packages/trie/src/trie.ts:795](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L795) ___ @@ -206,7 +233,7 @@ Returns a [stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#str #### Defined in -[packages/trie/src/trie.ts:884](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L884) +[packages/trie/src/trie.ts:917](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L917) ___ @@ -226,7 +253,7 @@ ___ #### Defined in -[packages/trie/src/trie.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L114) +[packages/trie/src/trie.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L116) ___ @@ -251,7 +278,7 @@ A Promise that resolves once value is deleted. #### Defined in -[packages/trie/src/trie.ts:240](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L240) +[packages/trie/src/trie.ts:242](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L242) ___ @@ -275,7 +302,7 @@ It returns a `stack` of nodes to the closest node. #### Defined in -[packages/trie/src/trie.ts:278](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L278) +[packages/trie/src/trie.ts:280](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L280) ___ @@ -291,7 +318,7 @@ Flushes all checkpoints, restoring the initial checkpoint state. #### Defined in -[packages/trie/src/trie.ts:1007](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1007) +[packages/trie/src/trie.ts:1040](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1040) ___ @@ -313,7 +340,7 @@ Saves the nodes from a proof into the trie. #### Defined in -[packages/trie/src/trie.ts:740](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L740) +[packages/trie/src/trie.ts:773](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L773) ___ @@ -338,7 +365,7 @@ A Promise that resolves to `Uint8Array` if a value was found or `null` if no val #### Defined in -[packages/trie/src/trie.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L167) +[packages/trie/src/trie.ts:169](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L169) ___ @@ -354,7 +381,7 @@ Is the trie during a checkpoint phase? #### Defined in -[packages/trie/src/trie.ts:960](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L960) +[packages/trie/src/trie.ts:993](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L993) ___ @@ -376,7 +403,7 @@ Retrieves a node from db by hash. #### Defined in -[packages/trie/src/trie.ts:369](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L369) +[packages/trie/src/trie.ts:402](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L402) ___ @@ -392,7 +419,7 @@ Persists the root hash in the underlying database #### Defined in -[packages/trie/src/trie.ts:916](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L916) +[packages/trie/src/trie.ts:949](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L949) ___ @@ -418,7 +445,7 @@ A Promise that resolves once value is stored. #### Defined in -[packages/trie/src/trie.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L183) +[packages/trie/src/trie.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L185) ___ @@ -436,7 +463,7 @@ parent checkpoint as current. #### Defined in -[packages/trie/src/trie.ts:993](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L993) +[packages/trie/src/trie.ts:1026](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L1026) ___ @@ -458,7 +485,7 @@ Gets and/or Sets the current root of the `trie` #### Defined in -[packages/trie/src/trie.ts:129](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L129) +[packages/trie/src/trie.ts:131](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L131) ___ @@ -482,7 +509,7 @@ Saves a stack of nodes to the database. #### Defined in -[packages/trie/src/trie.ts:637](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L637) +[packages/trie/src/trie.ts:670](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L670) ___ @@ -511,7 +538,7 @@ being deactivated. #### Defined in -[packages/trie/src/trie.ts:900](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L900) +[packages/trie/src/trie.ts:933](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L933) ___ @@ -541,7 +568,7 @@ The value from the key, or null if valid proof of non-existence. #### Defined in -[packages/trie/src/trie.ts:778](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L778) +[packages/trie/src/trie.ts:811](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L811) ___ @@ -555,7 +582,7 @@ ___ #### Defined in -[packages/trie/src/trie.ts:830](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L830) +[packages/trie/src/trie.ts:863](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L863) ___ @@ -582,7 +609,55 @@ ___ #### Defined in -[packages/trie/src/trie.ts:807](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L807) +[packages/trie/src/trie.ts:840](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L840) + +___ + +### walkAllNodes + +▸ **walkAllNodes**(`onFound`): `Promise`<`void`\> + +Executes a callback for each node in the trie. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `onFound` | `OnFound` | callback to call when a node is found. | + +#### Returns + +`Promise`<`void`\> + +Resolves when finished walking trie. + +#### Defined in + +[packages/trie/src/trie.ts:362](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L362) + +___ + +### walkAllValueNodes + +▸ **walkAllValueNodes**(`onFound`): `Promise`<`void`\> + +Executes a callback for each value node in the trie. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `onFound` | `OnFound` | callback to call when a node is found. | + +#### Returns + +`Promise`<`void`\> + +Resolves when finished walking trie. + +#### Defined in + +[packages/trie/src/trie.ts:373](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L373) ___ @@ -607,7 +682,7 @@ Resolves when finished walking trie. #### Defined in -[packages/trie/src/trie.ts:349](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L349) +[packages/trie/src/trie.ts:351](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L351) ___ @@ -627,4 +702,4 @@ ___ #### Defined in -[packages/trie/src/trie.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L89) +[packages/trie/src/trie.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/trie.ts#L91) diff --git a/packages/trie/docs/classes/TrieReadStream.md b/packages/trie/docs/classes/TrieReadStream.md index 6279016fb2..2a570cc500 100644 --- a/packages/trie/docs/classes/TrieReadStream.md +++ b/packages/trie/docs/classes/TrieReadStream.md @@ -277,7 +277,7 @@ node_modules/@types/readable-stream/index.d.ts:296 #### Inherited from -Readable.\_\_@asyncIterator@21534 +Readable.\_\_@asyncIterator@21529 #### Defined in diff --git a/packages/trie/package.json b/packages/trie/package.json index a171149894..2bd4076d8f 100644 --- a/packages/trie/package.json +++ b/packages/trie/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/trie", - "version": "6.0.0-rc.1", + "version": "6.0.0", "description": "Implementation of the modified merkle patricia tree as specified in Ethereum's yellow paper.", "keywords": [ "merkle", @@ -52,15 +52,15 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "@types/readable-stream": "^2.3.13", "lru-cache": "^10.0.0", "ethereum-cryptography": "^2.1.2", "readable-stream": "^3.6.0" }, "devDependencies": { - "@ethereumjs/genesis": "0.1.0-rc.1", + "@ethereumjs/genesis": "^0.1.0", "@types/benchmark": "^1.0.33", "abstract-level": "^1.0.3", "level": "^8.0.0", diff --git a/packages/tx/CHANGELOG.md b/packages/tx/CHANGELOG.md index fb64ac916b..08e84a86a8 100644 --- a/packages/tx/CHANGELOG.md +++ b/packages/tx/CHANGELOG.md @@ -6,6 +6,16 @@ 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). +## 5.0.0 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Ftx%405.0.0-rc.1) for the main change description. + +Following additional changes since RC1: + +- 4844: Rename `dataGas` to `blobGas` (see EIP-4844 PR [#7354](https://github.com/ethereum/EIPs/pull/7354)), PR [#2919](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2919) + ## 5.0.0-rc.1 - 2023-07-18 This is the release candidate (RC1) for the upcoming breaking releases on the various EthereumJS libraries. The associated release notes below are the main source of information on the changeset, also for the upcoming final releases, where we'll just provide change addition summaries + references to these RC1 notes. diff --git a/packages/tx/README.md b/packages/tx/README.md index 4966dee062..a942d7bdea 100644 --- a/packages/tx/README.md +++ b/packages/tx/README.md @@ -6,8 +6,6 @@ [![Code Coverage][tx-coverage-badge]][tx-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | Implements schema and functions related to Ethereum's transaction. | | ------------------------------------------------------------------ | diff --git a/packages/tx/docs/README.md b/packages/tx/docs/README.md index 0250040025..7ee5dcce4b 100644 --- a/packages/tx/docs/README.md +++ b/packages/tx/docs/README.md @@ -62,7 +62,7 @@ #### Defined in -common/dist/cjs/interfaces.d.ts:26 +common/dist/cjs/interfaces.d.ts:29 ___ @@ -72,7 +72,7 @@ ___ #### Defined in -common/dist/cjs/interfaces.d.ts:25 +common/dist/cjs/interfaces.d.ts:28 ___ @@ -82,7 +82,7 @@ ___ #### Defined in -common/dist/cjs/interfaces.d.ts:24 +common/dist/cjs/interfaces.d.ts:27 ___ @@ -99,7 +99,7 @@ ___ #### Defined in -common/dist/cjs/interfaces.d.ts:20 +common/dist/cjs/interfaces.d.ts:23 ___ diff --git a/packages/tx/docs/classes/BlobEIP4844Transaction.md b/packages/tx/docs/classes/BlobEIP4844Transaction.md index 3f855111a2..ecdc1c7f69 100644 --- a/packages/tx/docs/classes/BlobEIP4844Transaction.md +++ b/packages/tx/docs/classes/BlobEIP4844Transaction.md @@ -30,8 +30,8 @@ Typed transaction with a new gas fee market mechanism for transactions that incl - [gasLimit](BlobEIP4844Transaction.md#gaslimit) - [kzgCommitments](BlobEIP4844Transaction.md#kzgcommitments) - [kzgProofs](BlobEIP4844Transaction.md#kzgproofs) -- [maxFeePerDataGas](BlobEIP4844Transaction.md#maxfeeperdatagas) - [maxFeePerGas](BlobEIP4844Transaction.md#maxfeepergas) +- [maxFeePerblobGas](BlobEIP4844Transaction.md#maxfeeperblobgas) - [maxPriorityFeePerGas](BlobEIP4844Transaction.md#maxpriorityfeepergas) - [nonce](BlobEIP4844Transaction.md#nonce) - [r](BlobEIP4844Transaction.md#r) @@ -206,23 +206,23 @@ ___ ___ -### maxFeePerDataGas +### maxFeePerGas -• `Readonly` **maxFeePerDataGas**: `bigint` +• `Readonly` **maxFeePerGas**: `bigint` #### Defined in -[tx/src/eip4844Transaction.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L90) +[tx/src/eip4844Transaction.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L89) ___ -### maxFeePerGas +### maxFeePerblobGas -• `Readonly` **maxFeePerGas**: `bigint` +• `Readonly` **maxFeePerblobGas**: `bigint` #### Defined in -[tx/src/eip4844Transaction.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L89) +[tx/src/eip4844Transaction.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/eip4844Transaction.ts#L90) ___ diff --git a/packages/tx/docs/interfaces/BlobEIP4844TxData.md b/packages/tx/docs/interfaces/BlobEIP4844TxData.md index 899dc6b552..5e702c00da 100644 --- a/packages/tx/docs/interfaces/BlobEIP4844TxData.md +++ b/packages/tx/docs/interfaces/BlobEIP4844TxData.md @@ -23,8 +23,8 @@ - [gasPrice](BlobEIP4844TxData.md#gasprice) - [kzgCommitments](BlobEIP4844TxData.md#kzgcommitments) - [kzgProofs](BlobEIP4844TxData.md#kzgproofs) -- [maxFeePerDataGas](BlobEIP4844TxData.md#maxfeeperdatagas) - [maxFeePerGas](BlobEIP4844TxData.md#maxfeepergas) +- [maxFeePerblobGas](BlobEIP4844TxData.md#maxfeeperblobgas) - [maxPriorityFeePerGas](BlobEIP4844TxData.md#maxpriorityfeepergas) - [nonce](BlobEIP4844TxData.md#nonce) - [r](BlobEIP4844TxData.md#r) @@ -166,18 +166,6 @@ The KZG proofs associated with the transaction ___ -### maxFeePerDataGas - -• `Optional` **maxFeePerDataGas**: `BigIntLike` - -The maximum fee per blob gas paid for the transaction - -#### Defined in - -[tx/src/types.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L285) - -___ - ### maxFeePerGas • `Optional` **maxFeePerGas**: `BigIntLike` @@ -194,6 +182,18 @@ The maximum total fee ___ +### maxFeePerblobGas + +• `Optional` **maxFeePerblobGas**: `BigIntLike` + +The maximum fee per blob gas paid for the transaction + +#### Defined in + +[tx/src/types.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L285) + +___ + ### maxPriorityFeePerGas • `Optional` **maxPriorityFeePerGas**: `BigIntLike` diff --git a/packages/tx/docs/interfaces/JsonRpcTx.md b/packages/tx/docs/interfaces/JsonRpcTx.md index 8338ddba78..3b86d8170f 100644 --- a/packages/tx/docs/interfaces/JsonRpcTx.md +++ b/packages/tx/docs/interfaces/JsonRpcTx.md @@ -15,8 +15,8 @@ - [gasPrice](JsonRpcTx.md#gasprice) - [hash](JsonRpcTx.md#hash) - [input](JsonRpcTx.md#input) -- [maxFeePerDataGas](JsonRpcTx.md#maxfeeperdatagas) - [maxFeePerGas](JsonRpcTx.md#maxfeepergas) +- [maxFeePerblobGas](JsonRpcTx.md#maxfeeperblobgas) - [maxPriorityFeePerGas](JsonRpcTx.md#maxpriorityfeepergas) - [nonce](JsonRpcTx.md#nonce) - [r](JsonRpcTx.md#r) @@ -120,23 +120,23 @@ ___ ___ -### maxFeePerDataGas +### maxFeePerGas -• `Optional` **maxFeePerDataGas**: `string` +• `Optional` **maxFeePerGas**: `string` #### Defined in -[tx/src/types.ts:430](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L430) +[tx/src/types.ts:416](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L416) ___ -### maxFeePerGas +### maxFeePerblobGas -• `Optional` **maxFeePerGas**: `string` +• `Optional` **maxFeePerblobGas**: `string` #### Defined in -[tx/src/types.ts:416](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L416) +[tx/src/types.ts:430](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L430) ___ diff --git a/packages/tx/docs/interfaces/JsonTx.md b/packages/tx/docs/interfaces/JsonTx.md index 90689feb6e..a64e4e88de 100644 --- a/packages/tx/docs/interfaces/JsonTx.md +++ b/packages/tx/docs/interfaces/JsonTx.md @@ -18,8 +18,8 @@ and not all the values are present on all tx types - [data](JsonTx.md#data) - [gasLimit](JsonTx.md#gaslimit) - [gasPrice](JsonTx.md#gasprice) -- [maxFeePerDataGas](JsonTx.md#maxfeeperdatagas) - [maxFeePerGas](JsonTx.md#maxfeepergas) +- [maxFeePerblobGas](JsonTx.md#maxfeeperblobgas) - [maxPriorityFeePerGas](JsonTx.md#maxpriorityfeepergas) - [nonce](JsonTx.md#nonce) - [r](JsonTx.md#r) @@ -82,23 +82,23 @@ ___ ___ -### maxFeePerDataGas +### maxFeePerGas -• `Optional` **maxFeePerDataGas**: `string` +• `Optional` **maxFeePerGas**: `string` #### Defined in -[tx/src/types.ts:403](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L403) +[tx/src/types.ts:402](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L402) ___ -### maxFeePerGas +### maxFeePerblobGas -• `Optional` **maxFeePerGas**: `string` +• `Optional` **maxFeePerblobGas**: `string` #### Defined in -[tx/src/types.ts:402](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L402) +[tx/src/types.ts:403](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/src/types.ts#L403) ___ diff --git a/packages/tx/package.json b/packages/tx/package.json index e09bc67f3e..ffc235d8ef 100644 --- a/packages/tx/package.json +++ b/packages/tx/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/tx", - "version": "5.0.0-rc.1", + "version": "5.0.0", "description": "Implementation of the various Ethereum Transaction Types", "keywords": [ "ethereum", @@ -56,9 +56,9 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "ethereum-cryptography": "^2.1.2" }, "peerDependencies": { diff --git a/packages/util/CHANGELOG.md b/packages/util/CHANGELOG.md index 320315beb9..422f425dd8 100644 --- a/packages/util/CHANGELOG.md +++ b/packages/util/CHANGELOG.md @@ -6,6 +6,12 @@ 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). +## 9.0.0 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Futil%409.0.0-rc.1) for the main change description. + ## 9.0.0-rc.1 - 2023-07-18 This is the release candidate (RC1) for the upcoming breaking releases on the various EthereumJS libraries. The associated release notes below are the main source of information on the changeset, also for the upcoming final releases, where we'll just provide change addition summaries + references to these RC1 notes. diff --git a/packages/util/README.md b/packages/util/README.md index 4ef5e8dc17..cefb7c17cc 100644 --- a/packages/util/README.md +++ b/packages/util/README.md @@ -6,8 +6,6 @@ [![Code Coverage][util-coverage-badge]][util-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | A collection of utility functions for Ethereum. | | ----------------------------------------------- | diff --git a/packages/util/docs/README.md b/packages/util/docs/README.md index fe14f33209..953bda072c 100644 --- a/packages/util/docs/README.md +++ b/packages/util/docs/README.md @@ -4,13 +4,11 @@ ## Table of contents -### Namespaces - -- [ssz](modules/ssz.md) - ### Enumerations +- [KeyEncoding](enums/KeyEncoding.md) - [TypeOutput](enums/TypeOutput.md) +- [ValueEncoding](enums/ValueEncoding.md) ### Classes @@ -18,29 +16,39 @@ - [Address](classes/Address.md) - [AsyncEventEmitter](classes/AsyncEventEmitter.md) - [Lock](classes/Lock.md) +- [MapDB](classes/MapDB.md) - [Withdrawal](classes/Withdrawal.md) ### Interfaces - [AccountData](interfaces/AccountData.md) +- [DB](interfaces/DB.md) +- [DelBatch](interfaces/DelBatch.md) - [ECDSASignature](interfaces/ECDSASignature.md) +- [EthersProvider](interfaces/EthersProvider.md) - [EventMap](interfaces/EventMap.md) +- [GenesisState](interfaces/GenesisState.md) - [JsonRpcWithdrawal](interfaces/JsonRpcWithdrawal.md) -- [TransformableToArray](interfaces/TransformableToArray.md) -- [TransformableToBuffer](interfaces/TransformableToBuffer.md) +- [Kzg](interfaces/Kzg.md) +- [PutBatch](interfaces/PutBatch.md) +- [TransformabletoBytes](interfaces/TransformabletoBytes.md) ### Type Aliases -- [AccountBodyBuffer](README.md#accountbodybuffer) +- [AccountBodyBytes](README.md#accountbodybytes) +- [AccountState](README.md#accountstate) - [AddressLike](README.md#addresslike) +- [BatchDBOp](README.md#batchdbop) - [BigIntLike](README.md#bigintlike) -- [BufferLike](README.md#bufferlike) -- [NestedBufferArray](README.md#nestedbufferarray) +- [BytesLike](README.md#byteslike) +- [DBObject](README.md#dbobject) +- [EncodingOpts](README.md#encodingopts) - [NestedUint8Array](README.md#nesteduint8array) - [PrefixedHexString](README.md#prefixedhexstring) -- [ToBufferInputTypes](README.md#tobufferinputtypes) +- [StoragePair](README.md#storagepair) +- [ToBytesInputTypes](README.md#tobytesinputtypes) - [TypeOutputReturnType](README.md#typeoutputreturntype) -- [WithdrawalBuffer](README.md#withdrawalbuffer) +- [WithdrawalBytes](README.md#withdrawalbytes) - [WithdrawalData](README.md#withdrawaldata) ### Variables @@ -56,10 +64,12 @@ - [MAX\_INTEGER\_BIGINT](README.md#max_integer_bigint) - [MAX\_UINT64](README.md#max_uint64) - [MAX\_WITHDRAWALS\_PER\_PAYLOAD](README.md#max_withdrawals_per_payload) +- [RIPEMD160\_ADDRESS\_STRING](README.md#ripemd160_address_string) - [RLP\_EMPTY\_STRING](README.md#rlp_empty_string) - [SECP256K1\_ORDER](README.md#secp256k1_order) - [SECP256K1\_ORDER\_DIV\_2](README.md#secp256k1_order_div_2) - [TWO\_POW256](README.md#two_pow256) +- [kzg](README.md#kzg) ### Functions @@ -67,20 +77,24 @@ - [accountBodyToRLP](README.md#accountbodytorlp) - [accountBodyToSlim](README.md#accountbodytoslim) - [addHexPrefix](README.md#addhexprefix) -- [arrToBufArr](README.md#arrtobufarr) - [arrayContainsArray](README.md#arraycontainsarray) -- [baToJSON](README.md#batojson) -- [bigIntToBuffer](README.md#biginttobuffer) +- [bigIntToBytes](README.md#biginttobytes) - [bigIntToHex](README.md#biginttohex) -- [bigIntToUnpaddedBuffer](README.md#biginttounpaddedbuffer) -- [bufArrToArr](README.md#bufarrtoarr) -- [bufferToBigInt](README.md#buffertobigint) -- [bufferToHex](README.md#buffertohex) -- [bufferToInt](README.md#buffertoint) -- [bytesToNibbles](README.md#bytestonibbles) -- [compactBytesToNibbles](README.md#compactbytestonibbles) +- [bigIntToUnpaddedBytes](README.md#biginttounpaddedbytes) +- [blobsToCommitments](README.md#blobstocommitments) +- [blobsToProofs](README.md#blobstoproofs) +- [bytesToBigInt](README.md#bytestobigint) +- [bytesToHex](README.md#bytestohex) +- [bytesToInt](README.md#bytestoint) +- [bytesToUnprefixedHex](README.md#bytestounprefixedhex) +- [bytesToUtf8](README.md#bytestoutf8) +- [commitmentsToVersionedHashes](README.md#commitmentstoversionedhashes) +- [compareBytes](README.md#comparebytes) +- [computeVersionedHash](README.md#computeversionedhash) +- [concatBytes](README.md#concatbytes) - [ecrecover](README.md#ecrecover) - [ecsign](README.md#ecsign) +- [equalsBytes](README.md#equalsbytes) - [fetchFromProvider](README.md#fetchfromprovider) - [fromAscii](README.md#fromascii) - [fromRpcSig](README.md#fromrpcsig) @@ -89,14 +103,16 @@ - [generateAddress](README.md#generateaddress) - [generateAddress2](README.md#generateaddress2) - [getBinarySize](README.md#getbinarysize) +- [getBlobs](README.md#getblobs) - [getKeys](README.md#getkeys) - [getProvider](README.md#getprovider) -- [hasTerminator](README.md#hasterminator) - [hashPersonalMessage](README.md#hashpersonalmessage) +- [hexToBytes](README.md#hextobytes) - [importPublic](README.md#importpublic) -- [intToBuffer](README.md#inttobuffer) -- [intToPrefixedHexString](README.md#inttohex) -- [intToUnpaddedBuffer](README.md#inttounpaddedbuffer) +- [initKZG](README.md#initkzg) +- [intToBytes](README.md#inttobytes) +- [intToHex](README.md#inttohex) +- [intToUnpaddedBytes](README.md#inttounpaddedbytes) - [isHexPrefixed](README.md#ishexprefixed) - [isHexString](README.md#ishexstring) - [isValidAddress](README.md#isvalidaddress) @@ -105,59 +121,87 @@ - [isValidPublic](README.md#isvalidpublic) - [isValidSignature](README.md#isvalidsignature) - [isZeroAddress](README.md#iszeroaddress) -- [nibblesToBytes](README.md#nibblestobytes) -- [nibblesToCompactBytes](README.md#nibblestocompactbytes) - [padToEven](README.md#padtoeven) +- [parseGethGenesisState](README.md#parsegethgenesisstate) - [privateToAddress](README.md#privatetoaddress) - [privateToPublic](README.md#privatetopublic) - [pubToAddress](README.md#pubtoaddress) - [publicToAddress](README.md#publictoaddress) +- [randomBytes](README.md#randombytes) - [setLengthLeft](README.md#setlengthleft) - [setLengthRight](README.md#setlengthright) - [short](README.md#short) - [stripHexPrefix](README.md#striphexprefix) - [toAscii](README.md#toascii) -- [toBuffer](README.md#tobuffer) +- [toBytes](README.md#tobytes) - [toChecksumAddress](README.md#tochecksumaddress) - [toCompactSig](README.md#tocompactsig) - [toRpcSig](README.md#torpcsig) - [toType](README.md#totype) - [toUnsigned](README.md#tounsigned) -- [toUtf8](README.md#toutf8) - [unpadArray](README.md#unpadarray) -- [unpadBuffer](README.md#unpadbuffer) -- [unpadHexString](README.md#unpadhexstring) +- [unpadBytes](README.md#unpadbytes) +- [unpadHex](README.md#unpadhex) +- [unprefixedHexToBytes](README.md#unprefixedhextobytes) +- [utf8ToBytes](README.md#utf8tobytes) - [validateNoLeadingZeroes](README.md#validatenoleadingzeroes) - [zeroAddress](README.md#zeroaddress) - [zeros](README.md#zeros) ## Type Aliases -### AccountBodyBuffer +### AccountBodyBytes + +Ƭ **AccountBodyBytes**: [`Uint8Array`, `Uint8Array`, `Uint8Array`, `Uint8Array`] + +#### Defined in + +[packages/util/src/account.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L31) -Ƭ **AccountBodyBuffer**: [`Buffer`, `Buffer`, `Buffer` \| `Uint8Array`, `Buffer` \| `Uint8Array`] +___ + +### AccountState + +Ƭ **AccountState**: [balance: PrefixedHexString, code: PrefixedHexString, storage: StoragePair[], nonce: PrefixedHexString] #### Defined in -[packages/util/src/account.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L30) +[packages/util/src/genesis.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/genesis.ts#L8) ___ ### AddressLike -Ƭ **AddressLike**: [`Address`](classes/Address.md) \| `Buffer` \| [`PrefixedHexString`](README.md#prefixedhexstring) +Ƭ **AddressLike**: [`Address`](classes/Address.md) \| `Uint8Array` \| [`PrefixedHexString`](README.md#prefixedhexstring) A type that represents an input that can be converted to an Address. #### Defined in -[packages/util/src/types.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L32) +[packages/util/src/types.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L31) + +___ + +### BatchDBOp + +Ƭ **BatchDBOp**<`TKey`, `TValue`\>: [`PutBatch`](interfaces/PutBatch.md)<`TKey`, `TValue`\> \| [`DelBatch`](interfaces/DelBatch.md)<`TKey`\> + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `TKey` | extends `Uint8Array` \| `string` \| `number` = `Uint8Array` | +| `TValue` | extends `Uint8Array` \| `string` \| [`DBObject`](README.md#dbobject) = `Uint8Array` | + +#### Defined in + +[packages/util/src/db.ts:4](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L4) ___ ### BigIntLike -Ƭ **BigIntLike**: `bigint` \| [`PrefixedHexString`](README.md#prefixedhexstring) \| `number` \| `Buffer` +Ƭ **BigIntLike**: `bigint` \| [`PrefixedHexString`](README.md#prefixedhexstring) \| `number` \| `Uint8Array` #### Defined in @@ -165,9 +209,9 @@ ___ ___ -### BufferLike +### BytesLike -Ƭ **BufferLike**: `Buffer` \| `Uint8Array` \| `number`[] \| `number` \| `bigint` \| [`TransformableToBuffer`](interfaces/TransformableToBuffer.md) \| [`PrefixedHexString`](README.md#prefixedhexstring) +Ƭ **BytesLike**: `Uint8Array` \| `number`[] \| `number` \| `bigint` \| [`TransformabletoBytes`](interfaces/TransformabletoBytes.md) \| [`PrefixedHexString`](README.md#prefixedhexstring) #### Defined in @@ -175,13 +219,34 @@ ___ ___ -### NestedBufferArray +### DBObject + +Ƭ **DBObject**: `Object` + +#### Index signature + +▪ [key: `string`]: `string` \| `string`[] \| `number` + +#### Defined in + +[packages/util/src/db.ts:1](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L1) + +___ + +### EncodingOpts + +Ƭ **EncodingOpts**: `Object` + +#### Type declaration -Ƭ **NestedBufferArray**: (`Buffer` \| [`NestedBufferArray`](README.md#nestedbufferarray))[] +| Name | Type | +| :------ | :------ | +| `keyEncoding?` | [`KeyEncoding`](enums/KeyEncoding.md) | +| `valueEncoding?` | [`ValueEncoding`](enums/ValueEncoding.md) | #### Defined in -[packages/util/src/types.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L51) +[packages/util/src/db.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L21) ___ @@ -191,7 +256,7 @@ ___ #### Defined in -[packages/util/src/types.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L50) +[packages/util/src/types.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L37) ___ @@ -201,17 +266,27 @@ ___ #### Defined in -[packages/util/src/types.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L27) +[packages/util/src/types.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L26) ___ -### ToBufferInputTypes +### StoragePair -Ƭ **ToBufferInputTypes**: [`PrefixedHexString`](README.md#prefixedhexstring) \| `number` \| `bigint` \| `Buffer` \| `Uint8Array` \| `number`[] \| [`TransformableToArray`](interfaces/TransformableToArray.md) \| [`TransformableToBuffer`](interfaces/TransformableToBuffer.md) \| ``null`` \| `undefined` +Ƭ **StoragePair**: [key: PrefixedHexString, value: PrefixedHexString] #### Defined in -[packages/util/src/bytes.ts:136](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L136) +[packages/util/src/genesis.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/genesis.ts#L6) + +___ + +### ToBytesInputTypes + +Ƭ **ToBytesInputTypes**: [`PrefixedHexString`](README.md#prefixedhexstring) \| `number` \| `bigint` \| `Uint8Array` \| `number`[] \| [`TransformabletoBytes`](interfaces/TransformabletoBytes.md) \| ``null`` \| `undefined` + +#### Defined in + +[packages/util/src/bytes.ts:229](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L229) ___ @@ -225,18 +300,18 @@ ___ | :------ | :------ | | `0` | `number` | | `1` | `bigint` | -| `2` | `Buffer` | +| `2` | `Uint8Array` | | `3` | [`PrefixedHexString`](README.md#prefixedhexstring) | #### Defined in -[packages/util/src/types.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L63) +[packages/util/src/types.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L49) ___ -### WithdrawalBuffer +### WithdrawalBytes -Ƭ **WithdrawalBuffer**: [`Buffer`, `Buffer`, `Buffer`, `Buffer`] +Ƭ **WithdrawalBytes**: [`Uint8Array`, `Uint8Array`, `Uint8Array`, `Uint8Array`] #### Defined in @@ -280,73 +355,73 @@ ___ ### KECCAK256\_NULL -• `Const` **KECCAK256\_NULL**: `Buffer` +• `Const` **KECCAK256\_NULL**: `Uint8Array` Keccak-256 hash of null #### Defined in -[packages/util/src/constants.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L43) +[packages/util/src/constants.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L44) ___ ### KECCAK256\_NULL\_S -• `Const` **KECCAK256\_NULL\_S**: ``"c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"`` +• `Const` **KECCAK256\_NULL\_S**: ``"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"`` Keccak-256 hash of null #### Defined in -[packages/util/src/constants.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L38) +[packages/util/src/constants.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L39) ___ ### KECCAK256\_RLP -• `Const` **KECCAK256\_RLP**: `Buffer` +• `Const` **KECCAK256\_RLP**: `Uint8Array` Keccak-256 hash of the RLP of null #### Defined in -[packages/util/src/constants.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L64) +[packages/util/src/constants.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L65) ___ ### KECCAK256\_RLP\_ARRAY -• `Const` **KECCAK256\_RLP\_ARRAY**: `Buffer` +• `Const` **KECCAK256\_RLP\_ARRAY**: `Uint8Array` Keccak-256 of an RLP of an empty array #### Defined in -[packages/util/src/constants.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L54) +[packages/util/src/constants.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L55) ___ ### KECCAK256\_RLP\_ARRAY\_S -• `Const` **KECCAK256\_RLP\_ARRAY\_S**: ``"1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"`` +• `Const` **KECCAK256\_RLP\_ARRAY\_S**: ``"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"`` Keccak-256 of an RLP of an empty array #### Defined in -[packages/util/src/constants.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L48) +[packages/util/src/constants.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L49) ___ ### KECCAK256\_RLP\_S -• `Const` **KECCAK256\_RLP\_S**: ``"56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"`` +• `Const` **KECCAK256\_RLP\_S**: ``"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"`` Keccak-256 hash of the RLP of null #### Defined in -[packages/util/src/constants.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L59) +[packages/util/src/constants.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L60) ___ @@ -358,7 +433,7 @@ The max integer that the evm can handle (2^256-1) #### Defined in -[packages/util/src/constants.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L12) +[packages/util/src/constants.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L13) ___ @@ -372,7 +447,7 @@ We use literal value instead of calculated value for compatibility issue. #### Defined in -[packages/util/src/constants.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L21) +[packages/util/src/constants.ts:22](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L22) ___ @@ -384,7 +459,7 @@ ___ #### Defined in -[packages/util/src/constants.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L7) +[packages/util/src/constants.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L8) ___ @@ -394,19 +469,29 @@ ___ #### Defined in -[packages/util/src/constants.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L71) +[packages/util/src/constants.ts:72](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L72) + +___ + +### RIPEMD160\_ADDRESS\_STRING + +• `Const` **RIPEMD160\_ADDRESS\_STRING**: ``"0000000000000000000000000000000000000003"`` + +#### Defined in + +[packages/util/src/constants.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L74) ___ ### RLP\_EMPTY\_STRING -• `Const` **RLP\_EMPTY\_STRING**: `Buffer` +• `Const` **RLP\_EMPTY\_STRING**: `Uint8Array` RLP encoded empty string #### Defined in -[packages/util/src/constants.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L69) +[packages/util/src/constants.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L70) ___ @@ -416,7 +501,7 @@ ___ #### Defined in -[packages/util/src/constants.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L25) +[packages/util/src/constants.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L26) ___ @@ -426,7 +511,7 @@ ___ #### Defined in -[packages/util/src/constants.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L26) +[packages/util/src/constants.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L27) ___ @@ -438,33 +523,43 @@ ___ #### Defined in -[packages/util/src/constants.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L31) +[packages/util/src/constants.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/constants.ts#L32) + +___ + +### kzg + +• **kzg**: [`Kzg`](interfaces/Kzg.md) + +#### Defined in + +[packages/util/src/kzg.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L26) ## Functions ### accountBodyFromSlim -▸ **accountBodyFromSlim**(`body`): (`Uint8Array` \| `Buffer`)[] +▸ **accountBodyFromSlim**(`body`): `Uint8Array`[] #### Parameters | Name | Type | | :------ | :------ | -| `body` | [`AccountBodyBuffer`](README.md#accountbodybuffer) | +| `body` | [`AccountBodyBytes`](README.md#accountbodybytes) | #### Returns -(`Uint8Array` \| `Buffer`)[] +`Uint8Array`[] #### Defined in -[packages/util/src/account.ts:349](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L349) +[packages/util/src/account.ts:350](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L350) ___ ### accountBodyToRLP -▸ **accountBodyToRLP**(`body`, `couldBeSlim?`): `Buffer` +▸ **accountBodyToRLP**(`body`, `couldBeSlim?`): `Uint8Array` Converts a slim account (per snap protocol spec) to the RLP encoded version of the account @@ -472,38 +567,38 @@ Converts a slim account (per snap protocol spec) to the RLP encoded version of t | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `body` | [`AccountBodyBuffer`](README.md#accountbodybuffer) | `undefined` | Array of 4 Buffer-like items to represent the account | +| `body` | [`AccountBodyBytes`](README.md#accountbodybytes) | `undefined` | Array of 4 Uint8Array-like items to represent the account | | `couldBeSlim` | `boolean` | `true` | - | #### Returns -`Buffer` +`Uint8Array` RLP encoded version of the account #### Defined in -[packages/util/src/account.ts:375](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L375) +[packages/util/src/account.ts:376](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L376) ___ ### accountBodyToSlim -▸ **accountBodyToSlim**(`body`): (`Uint8Array` \| `Buffer`)[] +▸ **accountBodyToSlim**(`body`): `Uint8Array`[] #### Parameters | Name | Type | | :------ | :------ | -| `body` | [`AccountBodyBuffer`](README.md#accountbodybuffer) | +| `body` | [`AccountBodyBytes`](README.md#accountbodybytes) | #### Returns -(`Uint8Array` \| `Buffer`)[] +`Uint8Array`[] #### Defined in -[packages/util/src/account.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L360) +[packages/util/src/account.ts:361](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L361) ___ @@ -511,7 +606,7 @@ ___ ▸ **addHexPrefix**(`str`): `string` -Adds "0x" to a given `String` if it does not already start with "0x". +Adds "0x" to a given `string` if it does not already start with "0x". #### Parameters @@ -525,347 +620,367 @@ Adds "0x" to a given `String` if it does not already start with "0x". #### Defined in -[packages/util/src/bytes.ts:258](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L258) +[packages/util/src/bytes.ts:309](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L309) ___ -### arrToBufArr +### arrayContainsArray -▸ **arrToBufArr**(`arr`): `Buffer` +▸ **arrayContainsArray**(`superset`, `subset`, `some?`): `boolean` -Converts a Uint8Array or [NestedUint8Array](README.md#nesteduint8array) to Buffer or [NestedBufferArray](README.md#nestedbufferarray) +Returns TRUE if the first specified array contains all elements +from the second one. FALSE otherwise. #### Parameters | Name | Type | | :------ | :------ | -| `arr` | `Uint8Array` | +| `superset` | `unknown`[] | +| `subset` | `unknown`[] | +| `some?` | `boolean` | #### Returns -`Buffer` +`boolean` #### Defined in -[packages/util/src/bytes.ts:351](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L351) - -▸ **arrToBufArr**(`arr`): [`NestedBufferArray`](README.md#nestedbufferarray) +[packages/util/src/internal.ts:91](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L91) -#### Parameters - -| Name | Type | -| :------ | :------ | -| `arr` | [`NestedUint8Array`](README.md#nesteduint8array) | - -#### Returns - -[`NestedBufferArray`](README.md#nestedbufferarray) +___ -#### Defined in +### bigIntToBytes -[packages/util/src/bytes.ts:352](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L352) +▸ **bigIntToBytes**(`num`): `Uint8Array` -▸ **arrToBufArr**(`arr`): `Buffer` \| [`NestedBufferArray`](README.md#nestedbufferarray) +Converts a bigint to a Uint8Array + * #### Parameters -| Name | Type | -| :------ | :------ | -| `arr` | `Uint8Array` \| [`NestedUint8Array`](README.md#nesteduint8array) | +| Name | Type | Description | +| :------ | :------ | :------ | +| `num` | `bigint` | the bigint to convert | #### Returns -`Buffer` \| [`NestedBufferArray`](README.md#nestedbufferarray) +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:353](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L353) +[packages/util/src/bytes.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L120) ___ -### arrayContainsArray +### bigIntToHex -▸ **arrayContainsArray**(`superset`, `subset`, `some?`): `boolean` +▸ **bigIntToHex**(`num`): `string` -Returns TRUE if the first specified array contains all elements -from the second one. FALSE otherwise. +Converts a bigint to a `0x` prefixed hex string #### Parameters -| Name | Type | -| :------ | :------ | -| `superset` | `unknown`[] | -| `subset` | `unknown`[] | -| `some?` | `boolean` | +| Name | Type | Description | +| :------ | :------ | :------ | +| `num` | `bigint` | the bigint to convert | #### Returns -`boolean` +`string` #### Defined in -[packages/util/src/internal.ts:89](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L89) +[packages/util/src/bytes.ts:363](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L363) ___ -### baToJSON +### bigIntToUnpaddedBytes -▸ **baToJSON**(`ba`): `any` +▸ **bigIntToUnpaddedBytes**(`value`): `Uint8Array` -Converts a `Buffer` or `Array` to JSON. +Convert value from bigint to an unpadded Uint8Array +(useful for RLP transport) #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `ba` | `any` | (Buffer\|Array) | +| `value` | `bigint` | the bigint to convert | #### Returns -`any` - -(Array|String|null) +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:315](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L315) +[packages/util/src/bytes.ts:373](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L373) ___ -### bigIntToBuffer - -▸ **bigIntToBuffer**(`num`): `Buffer` +### blobsToCommitments -Converts a bigint to a Buffer +▸ **blobsToCommitments**(`blobs`): `Uint8Array`[] #### Parameters | Name | Type | | :------ | :------ | -| `num` | `bigint` | +| `blobs` | `Uint8Array`[] | #### Returns -`Buffer` +`Uint8Array`[] #### Defined in -[packages/util/src/bytes.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L224) +[packages/util/src/blobs.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L58) ___ -### bigIntToHex - -▸ **bigIntToHex**(`num`): `string` +### blobsToProofs -Converts a bigint to a `0x` prefixed hex string +▸ **blobsToProofs**(`blobs`, `commitments`): `Uint8Array`[] #### Parameters | Name | Type | | :------ | :------ | -| `num` | `bigint` | +| `blobs` | `Uint8Array`[] | +| `commitments` | `Uint8Array`[] | #### Returns -`string` +`Uint8Array`[] #### Defined in -[packages/util/src/bytes.ts:377](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L377) +[packages/util/src/blobs.ts:66](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L66) ___ -### bigIntToUnpaddedBuffer +### bytesToBigInt -▸ **bigIntToUnpaddedBuffer**(`value`): `Buffer` +▸ **bytesToBigInt**(`bytes`): `bigint` -Convert value from bigint to an unpadded Buffer -(useful for RLP transport) +Converts a Uint8Array to a bigint #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `bigint` | value to convert | +| `bytes` | `Uint8Array` | the bytes to convert | #### Returns -`Buffer` +`bigint` #### Defined in -[packages/util/src/bytes.ts:386](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L386) +[packages/util/src/bytes.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L47) ___ -### bufArrToArr +### bytesToHex -▸ **bufArrToArr**(`arr`): `Uint8Array` - -Converts a Buffer or [NestedBufferArray](README.md#nestedbufferarray) to Uint8Array or [NestedUint8Array](README.md#nesteduint8array) +▸ **bytesToHex**(`bytes`): `string` #### Parameters | Name | Type | | :------ | :------ | -| `arr` | `Buffer` | +| `bytes` | `Uint8Array` | #### Returns -`Uint8Array` +`string` #### Defined in -[packages/util/src/bytes.ts:364](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L364) +[packages/util/src/bytes.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L33) + +___ + +### bytesToInt + +▸ **bytesToInt**(`bytes`): `number` -▸ **bufArrToArr**(`arr`): [`NestedUint8Array`](README.md#nesteduint8array) +Converts a Uint8Array to a number. + +**`Throws`** + +If the input number exceeds 53 bits. #### Parameters -| Name | Type | -| :------ | :------ | -| `arr` | [`NestedBufferArray`](README.md#nestedbufferarray) | +| Name | Type | Description | +| :------ | :------ | :------ | +| `bytes` | `Uint8Array` | the bytes to convert | #### Returns -[`NestedUint8Array`](README.md#nesteduint8array) +`number` #### Defined in -[packages/util/src/bytes.ts:365](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L365) +[packages/util/src/bytes.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L61) + +___ + +### bytesToUnprefixedHex -▸ **bufArrToArr**(`arr`): `Uint8Array` \| [`NestedUint8Array`](README.md#nesteduint8array) +▸ **bytesToUnprefixedHex**(`bytes`): `string` + +**`Example`** + +```ts +bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' +``` #### Parameters | Name | Type | | :------ | :------ | -| `arr` | `Buffer` \| [`NestedBufferArray`](README.md#nestedbufferarray) | +| `bytes` | `Uint8Array` | #### Returns -`Uint8Array` \| [`NestedUint8Array`](README.md#nesteduint8array) +`string` #### Defined in -[packages/util/src/bytes.ts:366](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L366) +node_modules/@noble/hashes/utils.d.ts:11 ___ -### bufferToBigInt +### bytesToUtf8 -▸ **bufferToBigInt**(`buf`): `bigint` - -Converts a Buffer to a bigint +▸ **bytesToUtf8**(`data`): `string` #### Parameters | Name | Type | | :------ | :------ | -| `buf` | `Buffer` | +| `data` | `Uint8Array` | #### Returns -`bigint` +`string` #### Defined in -[packages/util/src/bytes.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L213) +node_modules/ethereum-cryptography/utils.d.ts:5 ___ -### bufferToHex +### commitmentsToVersionedHashes -▸ **bufferToHex**(`buf`): `string` +▸ **commitmentsToVersionedHashes**(`commitments`): `Uint8Array`[] -Converts a `Buffer` into a `0x`-prefixed hex `String`. +Generate an array of versioned hashes from corresponding kzg commitments #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `buf` | `Buffer` | `Buffer` object to convert | +| `commitments` | `Uint8Array`[] | array of kzg commitments | #### Returns -`string` +`Uint8Array`[] + +array of versioned hashes +Note: assumes KZG commitments (version 1 version hashes) #### Defined in -[packages/util/src/bytes.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L205) +[packages/util/src/blobs.ts:93](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L93) ___ -### bufferToInt +### compareBytes -▸ **bufferToInt**(`buf`): `number` +▸ **compareBytes**(`value1`, `value2`): `number` -Converts a `Buffer` to a `Number`. - -**`Throws`** - -If the input number exceeds 53 bits. +Compares two Uint8Arrays and returns a number indicating their order in a sorted array. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `buf` | `Buffer` | `Buffer` object to convert | +| `value1` | `Uint8Array` | The first Uint8Array to compare. | +| `value2` | `Uint8Array` | The second Uint8Array to compare. | #### Returns `number` +A positive number if value1 is larger than value2, + A negative number if value1 is smaller than value2, + or 0 if value1 and value2 are equal. + #### Defined in -[packages/util/src/bytes.ts:233](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L233) +[packages/util/src/bytes.ts:396](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L396) ___ -### bytesToNibbles +### computeVersionedHash + +▸ **computeVersionedHash**(`commitment`, `blobCommitmentVersion`): `Uint8Array` -▸ **bytesToNibbles**(`str`): `Uint8Array` +Converts a vector commitment for a given data blob to its versioned hash. For 4844, this version +number will be 0x01 for KZG vector commitments but could be different if future vector commitment +types are introduced #### Parameters -| Name | Type | -| :------ | :------ | -| `str` | `Uint8Array` | +| Name | Type | Description | +| :------ | :------ | :------ | +| `commitment` | `Uint8Array` | a vector commitment to a blob | +| `blobCommitmentVersion` | `number` | the version number corresponding to the type of vector commitment | #### Returns `Uint8Array` +a versioned hash corresponding to a given blob vector commitment + #### Defined in -[packages/util/src/encoding.ts:40](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/encoding.ts#L40) +[packages/util/src/blobs.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L80) ___ -### compactBytesToNibbles +### concatBytes + +▸ **concatBytes**(...`arrays`): `Uint8Array` -▸ **compactBytesToNibbles**(`compact`): `Uint8Array` +This mirrors the functionality of the `ethereum-cryptography` export except +it skips the check to validate that every element of `arrays` is indead a `uint8Array` +Can give small performance gains on large arrays #### Parameters -| Name | Type | -| :------ | :------ | -| `compact` | `Uint8Array` | +| Name | Type | Description | +| :------ | :------ | :------ | +| `...arrays` | `Uint8Array`[] | an array of Uint8Arrays | #### Returns `Uint8Array` +one Uint8Array with all the elements of the original set +works like `Buffer.concat` + #### Defined in -[packages/util/src/encoding.ts:54](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/encoding.ts#L54) +[packages/util/src/bytes.ts:420](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L420) ___ ### ecrecover -▸ **ecrecover**(`msgHash`, `v`, `r`, `s`, `chainId?`): `Buffer` +▸ **ecrecover**(`msgHash`, `v`, `r`, `s`, `chainId?`): `Uint8Array` ECDSA public key recovery from signature. NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions @@ -874,21 +989,21 @@ NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions | Name | Type | | :------ | :------ | -| `msgHash` | `Buffer` | +| `msgHash` | `Uint8Array` | | `v` | `bigint` | -| `r` | `Buffer` | -| `s` | `Buffer` | +| `r` | `Uint8Array` | +| `s` | `Uint8Array` | | `chainId?` | `bigint` | #### Returns -`Buffer` +`Uint8Array` Recovered public key #### Defined in -[packages/util/src/signature.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L52) +[packages/util/src/signature.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L64) ___ @@ -905,8 +1020,8 @@ accordingly, otherwise return a "static" `v` just derived from the `recovery` bi | Name | Type | | :------ | :------ | -| `msgHash` | `Buffer` | -| `privateKey` | `Buffer` | +| `msgHash` | `Uint8Array` | +| `privateKey` | `Uint8Array` | | `chainId?` | `bigint` | #### Returns @@ -915,28 +1030,54 @@ accordingly, otherwise return a "static" `v` just derived from the `recovery` bi #### Defined in -[packages/util/src/signature.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L20) +[packages/util/src/signature.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L28) ___ -### fetchFromProvider +### equalsBytes -▸ **fetchFromProvider**(`url`, `params`): `Promise`<`any`\> +▸ **equalsBytes**(`a`, `b`): `boolean` #### Parameters | Name | Type | | :------ | :------ | -| `url` | `string` | -| `params` | `rpcParams` | +| `a` | `Uint8Array` | +| `b` | `Uint8Array` | + +#### Returns + +`boolean` + +#### Defined in + +node_modules/ethereum-cryptography/utils.d.ts:7 + +___ + +### fetchFromProvider + +▸ **fetchFromProvider**(`url`, `params`): `Promise`<`any`\> + +Makes a simple RPC call to a remote Ethereum JSON-RPC provider and passes through the response. +No parameter or response validation is done. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `url` | `string` | the URL for the JSON RPC provider | +| `params` | `rpcParams` | the parameters for the JSON-RPC method - refer to https://ethereum.org/en/developers/docs/apis/json-rpc/ for details on RPC methods | #### Returns `Promise`<`any`\> +the `result` field from the JSON-RPC response + #### Defined in -[packages/util/src/provider.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L7) +[packages/util/src/provider.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L15) ___ @@ -960,7 +1101,7 @@ hex representation of input string #### Defined in -[packages/util/src/internal.ts:149](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L149) +[packages/util/src/internal.ts:151](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L151) ___ @@ -987,7 +1128,7 @@ it's a signed message (EIP-191 or EIP-712) adding `27` at the end. Remove if nee #### Defined in -[packages/util/src/signature.ts:113](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L113) +[packages/util/src/signature.ts:135](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L135) ___ @@ -995,13 +1136,13 @@ ___ ▸ **fromSigned**(`num`): `bigint` -Interprets a `Buffer` as a signed integer and returns a `BigInt`. Assumes 256-bit numbers. +Interprets a `Uint8Array` as a signed integer and returns a `BigInt`. Assumes 256-bit numbers. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `num` | `Buffer` | Signed integer value | +| `num` | `Uint8Array` | Signed integer value | #### Returns @@ -1009,7 +1150,7 @@ Interprets a `Buffer` as a signed integer and returns a `BigInt`. Assumes 256-bi #### Defined in -[packages/util/src/bytes.ts:243](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L243) +[packages/util/src/bytes.ts:291](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L291) ___ @@ -1033,13 +1174,13 @@ hex representation of input string #### Defined in -[packages/util/src/internal.ts:136](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L136) +[packages/util/src/internal.ts:138](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L138) ___ ### generateAddress -▸ **generateAddress**(`from`, `nonce`): `Buffer` +▸ **generateAddress**(`from`, `nonce`): `Uint8Array` Generates an address of a newly created contract. @@ -1047,22 +1188,22 @@ Generates an address of a newly created contract. | Name | Type | Description | | :------ | :------ | :------ | -| `from` | `Buffer` | The address which is creating this new address | -| `nonce` | `Buffer` | The nonce of the from account | +| `from` | `Uint8Array` | The address which is creating this new address | +| `nonce` | `Uint8Array` | The nonce of the from account | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/account.ts:199](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L199) +[packages/util/src/account.ts:200](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L200) ___ ### generateAddress2 -▸ **generateAddress2**(`from`, `salt`, `initCode`): `Buffer` +▸ **generateAddress2**(`from`, `salt`, `initCode`): `Uint8Array` Generates an address for a contract created using CREATE2. @@ -1070,17 +1211,17 @@ Generates an address for a contract created using CREATE2. | Name | Type | Description | | :------ | :------ | :------ | -| `from` | `Buffer` | The address which is creating this new address | -| `salt` | `Buffer` | A salt | -| `initCode` | `Buffer` | The init code of the contract being created | +| `from` | `Uint8Array` | The address which is creating this new address | +| `salt` | `Uint8Array` | A salt | +| `initCode` | `Uint8Array` | The init code of the contract being created | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/account.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L219) +[packages/util/src/account.ts:220](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L220) ___ @@ -1104,7 +1245,27 @@ the number of bytes contained within the string #### Defined in -[packages/util/src/internal.ts:73](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L73) +[packages/util/src/internal.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L75) + +___ + +### getBlobs + +▸ **getBlobs**(`input`): `Uint8Array`[] + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `input` | `string` | + +#### Returns + +`Uint8Array`[] + +#### Defined in + +[packages/util/src/blobs.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/blobs.ts#L34) ___ @@ -1138,81 +1299,80 @@ getKeys([{a: '1', b: '2'}, {a: '3', b: '4'}], 'a') => ['1', '3'] #### Defined in -[packages/util/src/internal.ts:171](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L171) +[packages/util/src/internal.ts:173](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L173) ___ ### getProvider -▸ **getProvider**(`provider`): `any` +▸ **getProvider**(`provider`): `string` #### Parameters -| Name | Type | -| :------ | :------ | -| `provider` | `any` | +| Name | Type | Description | +| :------ | :------ | :------ | +| `provider` | `string` \| [`EthersProvider`](interfaces/EthersProvider.md) | a URL string or [EthersProvider](interfaces/EthersProvider.md) | #### Returns -`any` +`string` + +the extracted URL string for the JSON-RPC Provider #### Defined in -[packages/util/src/provider.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L24) +[packages/util/src/provider.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L39) ___ -### hasTerminator +### hashPersonalMessage + +▸ **hashPersonalMessage**(`message`): `Uint8Array` -▸ **hasTerminator**(`nibbles`): `boolean` +Returns the keccak-256 hash of `message`, prefixed with the header used by the `eth_sign` RPC call. +The output of this function can be fed into `ecsign` to produce the same signature as the `eth_sign` +call for a given `message`, or fed to `ecrecover` along with a signature to recover the public key +used to produce the signature. #### Parameters | Name | Type | | :------ | :------ | -| `nibbles` | `Uint8Array` | +| `message` | `Uint8Array` | #### Returns -`boolean` - -boolean indicating if input hex nibble sequence has terminator indicating leaf-node - terminator is represented with 16 because a nibble ranges from 0 - 15(f) +`Uint8Array` #### Defined in -[packages/util/src/encoding.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/encoding.ts#L8) +[packages/util/src/signature.ts:212](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L212) ___ -### hashPersonalMessage +### hexToBytes -▸ **hashPersonalMessage**(`message`): `Buffer` - -Returns the keccak-256 hash of `message`, prefixed with the header used by the `eth_sign` RPC call. -The output of this function can be fed into `ecsign` to produce the same signature as the `eth_sign` -call for a given `message`, or fed to `ecrecover` along with a signature to recover the public key -used to produce the signature. +▸ **hexToBytes**(`hex`): `Uint8Array` #### Parameters | Name | Type | | :------ | :------ | -| `message` | `Buffer` | +| `hex` | `string` | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/signature.ts:190](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L190) +[packages/util/src/bytes.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L67) ___ ### importPublic -▸ **importPublic**(`publicKey`): `Buffer` +▸ **importPublic**(`publicKey`): `Uint8Array` Converts a public key to the Ethereum format. @@ -1220,23 +1380,44 @@ Converts a public key to the Ethereum format. | Name | Type | | :------ | :------ | -| `publicKey` | `Buffer` | +| `publicKey` | `Uint8Array` | + +#### Returns + +`Uint8Array` + +#### Defined in + +[packages/util/src/account.ts:319](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L319) + +___ + +### initKZG + +▸ **initKZG**(`kzgLib`, `trustedSetupPath`): `void` + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `kzgLib` | [`Kzg`](interfaces/Kzg.md) | a KZG implementation (defaults to c-kzg) | +| `trustedSetupPath` | `string` | the full path (e.g. "/home/linux/devnet4.txt") to a kzg trusted setup text file | #### Returns -`Buffer` +`void` #### Defined in -[packages/util/src/account.ts:318](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L318) +[packages/util/src/kzg.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L38) ___ -### intToBuffer +### intToBytes -▸ **intToBuffer**(`i`): `Buffer` +▸ **intToBytes**(`i`): `Uint8Array` -Converts an `Number` to a `Buffer` +Converts an number to a Uint8Array #### Parameters @@ -1246,19 +1427,19 @@ Converts an `Number` to a `Buffer` #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L29) +[packages/util/src/bytes.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L110) ___ -### intToPrefixedHexString +### intToHex -▸ **intToPrefixedHexString**(`i`): `string` +▸ **intToHex**(`i`): `string` -Converts a `Number` into a hex `String` +Converts a number into a [PrefixedHexString](README.md#prefixedhexstring) #### Parameters @@ -1272,27 +1453,30 @@ Converts a `Number` into a hex `String` #### Defined in -[packages/util/src/bytes.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L17) +[packages/util/src/bytes.ts:98](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L98) ___ -### intToUnpaddedBuffer +### intToUnpaddedBytes + +▸ **intToUnpaddedBytes**(`value`): `Uint8Array` -▸ **intToUnpaddedBuffer**(`value`): `Buffer` +Convert value from number to an unpadded Uint8Array +(useful for RLP transport) #### Parameters -| Name | Type | -| :------ | :------ | -| `value` | `number` | +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `number` | the bigint to convert | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:390](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L390) +[packages/util/src/bytes.ts:383](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L383) ___ @@ -1320,7 +1504,7 @@ a boolean if it is or is not hex prefixed #### Defined in -[packages/util/src/internal.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L31) +[packages/util/src/internal.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L33) ___ @@ -1345,7 +1529,7 @@ output the string is a hex string #### Defined in -[packages/util/src/internal.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L203) +[packages/util/src/internal.ts:205](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L205) ___ @@ -1367,7 +1551,7 @@ Checks if the address is a valid. Accepts checksummed addresses too. #### Defined in -[packages/util/src/account.ts:132](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L132) +[packages/util/src/account.ts:133](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L133) ___ @@ -1392,7 +1576,7 @@ See toChecksumAddress' documentation for details about the eip1191ChainId parame #### Defined in -[packages/util/src/account.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L187) +[packages/util/src/account.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L188) ___ @@ -1406,7 +1590,7 @@ Checks if the private key satisfies the rules of the curve secp256k1. | Name | Type | | :------ | :------ | -| `privateKey` | `Buffer` | +| `privateKey` | `Uint8Array` | #### Returns @@ -1414,7 +1598,7 @@ Checks if the private key satisfies the rules of the curve secp256k1. #### Defined in -[packages/util/src/account.ts:241](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L241) +[packages/util/src/account.ts:244](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L244) ___ @@ -1429,7 +1613,7 @@ and the requirements of Ethereum. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `publicKey` | `Buffer` | `undefined` | The two points of an uncompressed key, unless sanitize is enabled | +| `publicKey` | `Uint8Array` | `undefined` | The two points of an uncompressed key, unless sanitize is enabled | | `sanitize` | `boolean` | `false` | Accept public keys in other formats | #### Returns @@ -1438,7 +1622,7 @@ and the requirements of Ethereum. #### Defined in -[packages/util/src/account.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L251) +[packages/util/src/account.ts:254](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L254) ___ @@ -1454,8 +1638,8 @@ NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | `v` | `bigint` | `undefined` | - | -| `r` | `Buffer` | `undefined` | - | -| `s` | `Buffer` | `undefined` | - | +| `r` | `Uint8Array` | `undefined` | - | +| `s` | `Uint8Array` | `undefined` | - | | `homesteadOrLater` | `boolean` | `true` | Indicates whether this is being used on either the homestead hardfork or a later one | | `chainId?` | `bigint` | `undefined` | - | @@ -1465,7 +1649,7 @@ NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions #### Defined in -[packages/util/src/signature.ts:150](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L150) +[packages/util/src/signature.ts:172](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L172) ___ @@ -1487,78 +1671,59 @@ Checks if a given address is the zero address. #### Defined in -[packages/util/src/account.ts:338](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L338) +[packages/util/src/account.ts:339](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L339) ___ -### nibblesToBytes - -▸ **nibblesToBytes**(`nibbles`, `bytes`): `void` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `nibbles` | `Uint8Array` | -| `bytes` | `Uint8Array` | - -#### Returns - -`void` - -#### Defined in - -[packages/util/src/encoding.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/encoding.ts#L12) - -___ +### padToEven -### nibblesToCompactBytes +▸ **padToEven**(`value`): `string` -▸ **nibblesToCompactBytes**(`nibbles`): `Uint8Array` +Pads a `String` to have an even length #### Parameters | Name | Type | | :------ | :------ | -| `nibbles` | `Uint8Array` | +| `value` | `string` | #### Returns -`Uint8Array` +`string` + +output #### Defined in -[packages/util/src/encoding.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/encoding.ts#L18) +[packages/util/src/internal.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L58) ___ -### padToEven +### parseGethGenesisState -▸ **padToEven**(`value`): `string` +▸ **parseGethGenesisState**(`json`): [`GenesisState`](interfaces/GenesisState.md) -Pads a `String` to have an even length +Parses the geth genesis state into Blockchain [GenesisState](interfaces/GenesisState.md) #### Parameters -| Name | Type | -| :------ | :------ | -| `value` | `string` | +| Name | Type | Description | +| :------ | :------ | :------ | +| `json` | `any` | representing the `alloc` key in a Geth genesis file | #### Returns -`string` - -output +[`GenesisState`](interfaces/GenesisState.md) #### Defined in -[packages/util/src/internal.ts:56](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L56) +[packages/util/src/genesis.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/genesis.ts#L47) ___ ### privateToAddress -▸ **privateToAddress**(`privateKey`): `Buffer` +▸ **privateToAddress**(`privateKey`): `Uint8Array` Returns the ethereum address of a given private key. @@ -1566,21 +1731,21 @@ Returns the ethereum address of a given private key. | Name | Type | Description | | :------ | :------ | :------ | -| `privateKey` | `Buffer` | A private key must be 256 bits wide | +| `privateKey` | `Uint8Array` | A private key must be 256 bits wide | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/account.ts:311](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L311) +[packages/util/src/account.ts:312](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L312) ___ ### privateToPublic -▸ **privateToPublic**(`privateKey`): `Buffer` +▸ **privateToPublic**(`privateKey`): `Uint8Array` Returns the ethereum public key of a given private key. @@ -1588,21 +1753,21 @@ Returns the ethereum public key of a given private key. | Name | Type | Description | | :------ | :------ | :------ | -| `privateKey` | `Buffer` | A private key must be 256 bits wide | +| `privateKey` | `Uint8Array` | A private key must be 256 bits wide | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/account.ts:299](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L299) +[packages/util/src/account.ts:302](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L302) ___ ### pubToAddress -▸ **pubToAddress**(`pubKey`, `sanitize?`): `Buffer` +▸ **pubToAddress**(`pubKey`, `sanitize?`): `Uint8Array` Returns the ethereum address of a given public key. Accepts "Ethereum public keys" and SEC1 encoded keys. @@ -1611,22 +1776,22 @@ Accepts "Ethereum public keys" and SEC1 encoded keys. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pubKey` | `Buffer` | `undefined` | The two points of an uncompressed key, unless sanitize is enabled | +| `pubKey` | `Uint8Array` | `undefined` | The two points of an uncompressed key, unless sanitize is enabled | | `sanitize` | `boolean` | `false` | Accept public keys in other formats | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/account.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L282) +[packages/util/src/account.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L285) ___ ### publicToAddress -▸ **publicToAddress**(`pubKey`, `sanitize?`): `Buffer` +▸ **publicToAddress**(`pubKey`, `sanitize?`): `Uint8Array` Returns the ethereum address of a given public key. Accepts "Ethereum public keys" and SEC1 encoded keys. @@ -1635,76 +1800,96 @@ Accepts "Ethereum public keys" and SEC1 encoded keys. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `pubKey` | `Buffer` | `undefined` | The two points of an uncompressed key, unless sanitize is enabled | +| `pubKey` | `Uint8Array` | `undefined` | The two points of an uncompressed key, unless sanitize is enabled | | `sanitize` | `boolean` | `false` | Accept public keys in other formats | #### Returns -`Buffer` +`Uint8Array` + +#### Defined in + +[packages/util/src/account.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L285) + +___ + +### randomBytes + +▸ **randomBytes**(`length`): `Uint8Array` + +Generates a Uint8Array of random bytes of specified length. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `length` | `number` | The length of the Uint8Array. | + +#### Returns + +`Uint8Array` + +A Uint8Array of random bytes of specified length. #### Defined in -[packages/util/src/account.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L282) +[packages/util/src/bytes.ts:408](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L408) ___ ### setLengthLeft -▸ **setLengthLeft**(`msg`, `length`): `Buffer` +▸ **setLengthLeft**(`msg`, `length`): `Uint8Array` -Left Pads a `Buffer` with leading zeros till it has `length` bytes. +Left Pads a `Uint8Array` with leading zeros till it has `length` bytes. Or it truncates the beginning if it exceeds. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `msg` | `Buffer` | the value to pad (Buffer) | +| `msg` | `Uint8Array` | the value to pad | | `length` | `number` | the number of bytes the output should be | #### Returns -`Buffer` - -(Buffer) +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:74](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L74) +[packages/util/src/bytes.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L163) ___ ### setLengthRight -▸ **setLengthRight**(`msg`, `length`): `Buffer` +▸ **setLengthRight**(`msg`, `length`): `Uint8Array` -Right Pads a `Buffer` with trailing zeros till it has `length` bytes. +Right Pads a `Uint8Array` with trailing zeros till it has `length` bytes. it truncates the end if it exceeds. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `msg` | `Buffer` | the value to pad (Buffer) | +| `msg` | `Uint8Array` | the value to pad | | `length` | `number` | the number of bytes the output should be | #### Returns -`Buffer` - -(Buffer) +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:86](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L86) +[packages/util/src/bytes.ts:175](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L175) ___ ### short -▸ **short**(`buffer`, `maxLength?`): `string` +▸ **short**(`bytes`, `maxLength?`): `string` -Shortens a string or buffer's hex string representation to maxLength (default 50). +Shortens a string or Uint8Array's hex string representation to maxLength (default 50). Examples: @@ -1715,7 +1900,7 @@ Output: '657468657265756d0000000000000000000000000000000000…' | Name | Type | Default value | | :------ | :------ | :------ | -| `buffer` | `string` \| `Buffer` | `undefined` | +| `bytes` | `string` \| `Uint8Array` | `undefined` | | `maxLength` | `number` | `50` | #### Returns @@ -1724,7 +1909,7 @@ Output: '657468657265756d0000000000000000000000000000000000…' #### Defined in -[packages/util/src/bytes.ts:274](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L274) +[packages/util/src/bytes.ts:328](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L328) ___ @@ -1748,7 +1933,7 @@ the string without 0x prefix #### Defined in -[packages/util/src/internal.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L44) +[packages/util/src/internal.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L46) ___ @@ -1772,31 +1957,31 @@ ascii string representation of hex value #### Defined in -[packages/util/src/internal.ts:114](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L114) +[packages/util/src/internal.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/internal.ts#L116) ___ -### toBuffer +### toBytes -▸ **toBuffer**(`v`): `Buffer` +▸ **toBytes**(`v`): `Uint8Array` -Attempts to turn a value into a `Buffer`. -Inputs supported: `Buffer`, `String` (hex-prefixed), `Number`, null/undefined, `BigInt` and other objects -with a `toArray()` or `toBuffer()` method. +Attempts to turn a value into a `Uint8Array`. +Inputs supported: `Buffer`, `Uint8Array`, `String` (hex-prefixed), `Number`, null/undefined, `BigInt` and other objects +with a `toArray()` or `toBytes()` method. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `v` | [`ToBufferInputTypes`](README.md#tobufferinputtypes) | the value | +| `v` | [`ToBytesInputTypes`](README.md#tobytesinputtypes) | the value | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L154) +[packages/util/src/bytes.ts:247](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L247) ___ @@ -1828,7 +2013,7 @@ Usage of this EIP is therefore discouraged unless you have a very targeted use c #### Defined in -[packages/util/src/account.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L154) +[packages/util/src/account.ts:155](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L155) ___ @@ -1844,8 +2029,8 @@ NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions | Name | Type | | :------ | :------ | | `v` | `bigint` | -| `r` | `Buffer` | -| `s` | `Buffer` | +| `r` | `Uint8Array` | +| `s` | `Uint8Array` | | `chainId?` | `bigint` | #### Returns @@ -1856,7 +2041,7 @@ Signature #### Defined in -[packages/util/src/signature.ts:90](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L90) +[packages/util/src/signature.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L108) ___ @@ -1872,8 +2057,8 @@ NOTE: Accepts `v === 0 | v === 1` for EIP1559 transactions | Name | Type | | :------ | :------ | | `v` | `bigint` | -| `r` | `Buffer` | -| `s` | `Buffer` | +| `r` | `Uint8Array` | +| `s` | `Uint8Array` | | `chainId?` | `bigint` | #### Returns @@ -1884,7 +2069,7 @@ Signature #### Defined in -[packages/util/src/signature.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L75) +[packages/util/src/signature.ts:87](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L87) ___ @@ -1914,7 +2099,7 @@ Input of null/undefined returns null/undefined regardless of the output type. #### Defined in -[packages/util/src/types.ts:76](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L76) +[packages/util/src/types.ts:62](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L62) ▸ **toType**<`T`\>(`input`, `outputType`): `undefined` @@ -1937,7 +2122,7 @@ Input of null/undefined returns null/undefined regardless of the output type. #### Defined in -[packages/util/src/types.ts:77](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L77) +[packages/util/src/types.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L63) ▸ **toType**<`T`\>(`input`, `outputType`): [`TypeOutputReturnType`](README.md#typeoutputreturntype)[`T`] @@ -1951,7 +2136,7 @@ Input of null/undefined returns null/undefined regardless of the output type. | Name | Type | | :------ | :------ | -| `input` | [`ToBufferInputTypes`](README.md#tobufferinputtypes) | +| `input` | [`ToBytesInputTypes`](README.md#tobytesinputtypes) | | `outputType` | `T` | #### Returns @@ -1960,15 +2145,15 @@ Input of null/undefined returns null/undefined regardless of the output type. #### Defined in -[packages/util/src/types.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L78) +[packages/util/src/types.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L64) ___ ### toUnsigned -▸ **toUnsigned**(`num`): `Buffer` +▸ **toUnsigned**(`num`): `Uint8Array` -Converts a `BigInt` to an unsigned integer and returns it as a `Buffer`. Assumes 256-bit numbers. +Converts a `BigInt` to an unsigned integer and returns it as a `Uint8Array`. Assumes 256-bit numbers. #### Parameters @@ -1978,118 +2163,125 @@ Converts a `BigInt` to an unsigned integer and returns it as a `Buffer`. Assumes #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:251](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L251) +[packages/util/src/bytes.ts:300](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L300) ___ -### toUtf8 +### unpadArray -▸ **toUtf8**(`hex`): `string` +▸ **unpadArray**(`a`): `number`[] -Returns the utf8 string representation from a hex string. +Trims leading zeros from an `Array` (of numbers). -Examples: +#### Parameters -Input 1: '657468657265756d000000000000000000000000000000000000000000000000' -Input 2: '657468657265756d' -Input 3: '000000000000000000000000000000000000000000000000657468657265756d' +| Name | Type | +| :------ | :------ | +| `a` | `number`[] | -Output (all 3 input variants): 'ethereum' +#### Returns -Note that this method is not intended to be used with hex strings -representing quantities in both big endian or little endian notation. +`number`[] + +#### Defined in + +[packages/util/src/bytes.ts:213](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L213) + +___ + +### unpadBytes + +▸ **unpadBytes**(`a`): `Uint8Array` + +Trims leading zeros from a `Uint8Array`. #### Parameters | Name | Type | | :------ | :------ | -| `hex` | `string` | +| `a` | `Uint8Array` | #### Returns -`string` - -Utf8 string +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:299](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L299) +[packages/util/src/bytes.ts:203](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L203) ___ -### unpadArray +### unpadHex -▸ **unpadArray**(`a`): `number`[] +▸ **unpadHex**(`a`): `string` -Trims leading zeros from an `Array` (of numbers). +Trims leading zeros from a `PrefixedHexString`. #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `a` | `number`[] | (number[]) | +| Name | Type | +| :------ | :------ | +| `a` | `string` | #### Returns -`number`[] - -(number[]) +`string` #### Defined in -[packages/util/src/bytes.ts:120](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L120) +[packages/util/src/bytes.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L223) ___ -### unpadBuffer +### unprefixedHexToBytes -▸ **unpadBuffer**(`a`): `Buffer` +▸ **unprefixedHexToBytes**(`inp`): `Uint8Array` -Trims leading zeros from a `Buffer`. +**`Deprecated`** #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `a` | `Buffer` | (Buffer) | +| Name | Type | +| :------ | :------ | +| `inp` | `string` | #### Returns -`Buffer` - -(Buffer) +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L110) +[packages/util/src/bytes.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L21) ___ -### unpadHexString +### utf8ToBytes -▸ **unpadHexString**(`a`): `string` +▸ **utf8ToBytes**(`str`): `Uint8Array` + +**`Example`** -Trims leading zeros from a hex-prefixed `String`. +```ts +utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) +``` #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `a` | `string` | (String) | +| Name | Type | +| :------ | :------ | +| `str` | `string` | #### Returns -`string` - -(String) +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:130](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L130) +node_modules/@noble/hashes/utils.d.ts:21 ___ @@ -2097,7 +2289,7 @@ ___ ▸ **validateNoLeadingZeroes**(`values`): `void` -Checks provided Buffers for leading zeroes and throws if found. +Checks provided Uint8Array for leading zeroes and throws if found. Examples: @@ -2115,7 +2307,7 @@ if any provided value is found to have leading zero bytes | Name | Type | Description | | :------ | :------ | :------ | -| `values` | `Object` | An object containing string keys and Buffer values | +| `values` | `Object` | An object containing string keys and Uint8Array values | #### Returns @@ -2123,7 +2315,7 @@ if any provided value is found to have leading zero bytes #### Defined in -[packages/util/src/bytes.ts:340](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L340) +[packages/util/src/bytes.ts:350](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L350) ___ @@ -2139,26 +2331,26 @@ Returns the zero address. #### Defined in -[packages/util/src/account.ts:329](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L329) +[packages/util/src/account.ts:330](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L330) ___ ### zeros -▸ **zeros**(`bytes`): `Buffer` +▸ **zeros**(`bytes`): `Uint8Array` -Returns a buffer filled with 0s. +Returns a Uint8Array filled with 0s. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `bytes` | `number` | the number of bytes the buffer should be | +| `bytes` | `number` | the number of bytes of the Uint8Array | #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/bytes.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L38) +[packages/util/src/bytes.ts:130](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/bytes.ts#L130) diff --git a/packages/util/docs/classes/Account.md b/packages/util/docs/classes/Account.md index f7dda72ccf..3148aea150 100644 --- a/packages/util/docs/classes/Account.md +++ b/packages/util/docs/classes/Account.md @@ -40,12 +40,12 @@ Use the static factory methods to assist in creating an Account from varying dat | :------ | :------ | :------ | | `nonce` | `bigint` | `_0n` | | `balance` | `bigint` | `_0n` | -| `storageRoot` | `Buffer` | `KECCAK256_RLP` | -| `codeHash` | `Buffer` | `KECCAK256_NULL` | +| `storageRoot` | `Uint8Array` | `KECCAK256_RLP` | +| `codeHash` | `Uint8Array` | `KECCAK256_NULL` | #### Defined in -[packages/util/src/account.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L69) +[packages/util/src/account.ts:70](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L70) ## Properties @@ -55,17 +55,17 @@ Use the static factory methods to assist in creating an Account from varying dat #### Defined in -[packages/util/src/account.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L34) +[packages/util/src/account.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L35) ___ ### codeHash -• **codeHash**: `Buffer` +• **codeHash**: `Uint8Array` #### Defined in -[packages/util/src/account.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L36) +[packages/util/src/account.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L37) ___ @@ -75,17 +75,17 @@ ___ #### Defined in -[packages/util/src/account.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L33) +[packages/util/src/account.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L34) ___ ### storageRoot -• **storageRoot**: `Buffer` +• **storageRoot**: `Uint8Array` #### Defined in -[packages/util/src/account.ts:35](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L35) +[packages/util/src/account.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L36) ## Methods @@ -101,7 +101,7 @@ Returns a `Boolean` determining if the account is a contract. #### Defined in -[packages/util/src/account.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L115) +[packages/util/src/account.ts:116](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L116) ___ @@ -119,39 +119,39 @@ account emptiness in [EIP-161](https://eips.ethereum.org/EIPS/eip-161): #### Defined in -[packages/util/src/account.ts:124](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L124) +[packages/util/src/account.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L125) ___ ### raw -▸ **raw**(): `Buffer`[] +▸ **raw**(): `Uint8Array`[] -Returns a Buffer Array of the raw Buffers for the account, in order. +Returns an array of Uint8Arrays of the raw bytes for the account, in order. #### Returns -`Buffer`[] +`Uint8Array`[] #### Defined in -[packages/util/src/account.ts:96](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L96) +[packages/util/src/account.ts:97](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L97) ___ ### serialize -▸ **serialize**(): `Buffer` +▸ **serialize**(): `Uint8Array` -Returns the RLP serialization of the account as a `Buffer`. +Returns the RLP serialization of the account as a `Uint8Array`. #### Returns -`Buffer` +`Uint8Array` #### Defined in -[packages/util/src/account.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L108) +[packages/util/src/account.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L109) ___ @@ -171,7 +171,7 @@ ___ #### Defined in -[packages/util/src/account.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L38) +[packages/util/src/account.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L39) ___ @@ -183,7 +183,7 @@ ___ | Name | Type | | :------ | :------ | -| `serialized` | `Buffer` | +| `serialized` | `Uint8Array` | #### Returns @@ -191,7 +191,7 @@ ___ #### Defined in -[packages/util/src/account.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L49) +[packages/util/src/account.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L50) ___ @@ -203,7 +203,7 @@ ___ | Name | Type | | :------ | :------ | -| `values` | `Buffer`[] | +| `values` | `Uint8Array`[] | #### Returns @@ -211,4 +211,4 @@ ___ #### Defined in -[packages/util/src/account.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L59) +[packages/util/src/account.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L60) diff --git a/packages/util/docs/classes/Address.md b/packages/util/docs/classes/Address.md index d9363d9dc0..ca78f9957a 100644 --- a/packages/util/docs/classes/Address.md +++ b/packages/util/docs/classes/Address.md @@ -12,14 +12,14 @@ Handling and generating Ethereum addresses ### Properties -- [buf](Address.md#buf) +- [bytes](Address.md#bytes) ### Methods - [equals](Address.md#equals) - [isPrecompileOrSystemAddress](Address.md#isprecompileorsystemaddress) - [isZero](Address.md#iszero) -- [toBuffer](Address.md#tobuffer) +- [toBytes](Address.md#tobytes) - [toString](Address.md#tostring) - [fromPrivateKey](Address.md#fromprivatekey) - [fromPublicKey](Address.md#frompublickey) @@ -32,13 +32,13 @@ Handling and generating Ethereum addresses ### constructor -• **new Address**(`buf`) +• **new Address**(`bytes`) #### Parameters | Name | Type | | :------ | :------ | -| `buf` | `Buffer` | +| `bytes` | `Uint8Array` | #### Defined in @@ -46,9 +46,9 @@ Handling and generating Ethereum addresses ## Properties -### buf +### bytes -• `Readonly` **buf**: `Buffer` +• `Readonly` **bytes**: `Uint8Array` #### Defined in @@ -111,15 +111,15 @@ Is address zero. ___ -### toBuffer +### toBytes -▸ **toBuffer**(): `Buffer` +▸ **toBytes**(): `Uint8Array` -Returns Buffer representation of address. +Returns a new Uint8Array representation of address. #### Returns -`Buffer` +`Uint8Array` #### Defined in @@ -153,7 +153,7 @@ Returns an address for a given private key. | Name | Type | Description | | :------ | :------ | :------ | -| `privateKey` | `Buffer` | A private key must be 256 bits wide | +| `privateKey` | `Uint8Array` | A private key must be 256 bits wide | #### Returns @@ -175,7 +175,7 @@ Returns an address for a given public key. | Name | Type | Description | | :------ | :------ | :------ | -| `pubKey` | `Buffer` | The two points of an uncompressed key | +| `pubKey` | `Uint8Array` | The two points of an uncompressed key | #### Returns @@ -243,8 +243,8 @@ Generates an address for a contract created using CREATE2. | Name | Type | Description | | :------ | :------ | :------ | | `from` | [`Address`](Address.md) | The address which is creating this new address | -| `salt` | `Buffer` | A salt | -| `initCode` | `Buffer` | The init code of the contract being created | +| `salt` | `Uint8Array` | A salt | +| `initCode` | `Uint8Array` | The init code of the contract being created | #### Returns diff --git a/packages/util/docs/classes/AsyncEventEmitter.md b/packages/util/docs/classes/AsyncEventEmitter.md index 7c7310c7e5..90cf0f5723 100644 --- a/packages/util/docs/classes/AsyncEventEmitter.md +++ b/packages/util/docs/classes/AsyncEventEmitter.md @@ -77,7 +77,7 @@ EventEmitter.constructor #### Defined in -node_modules/@types/node/events.d.ts:74 +node_modules/@types/node/ts4.8/events.d.ts:111 ## Properties @@ -91,7 +91,7 @@ EventEmitter.captureRejectionSymbol #### Defined in -node_modules/@types/node/events.d.ts:291 +node_modules/@types/node/ts4.8/events.d.ts:328 ___ @@ -107,7 +107,7 @@ EventEmitter.captureRejections #### Defined in -node_modules/@types/node/events.d.ts:296 +node_modules/@types/node/ts4.8/events.d.ts:333 ___ @@ -121,7 +121,7 @@ EventEmitter.defaultMaxListeners #### Defined in -node_modules/@types/node/events.d.ts:297 +node_modules/@types/node/ts4.8/events.d.ts:334 ___ @@ -143,7 +143,7 @@ EventEmitter.errorMonitor #### Defined in -node_modules/@types/node/events.d.ts:290 +node_modules/@types/node/ts4.8/events.d.ts:327 ## Methods @@ -409,7 +409,7 @@ EventEmitter.off #### Defined in -node_modules/@types/node/events.d.ts:462 +node_modules/@types/node/ts4.8/events.d.ts:499 ___ @@ -588,7 +588,7 @@ EventEmitter.rawListeners #### Defined in -node_modules/@types/node/events.d.ts:532 +node_modules/@types/node/ts4.8/events.d.ts:569 ___ @@ -702,13 +702,13 @@ const { getEventListeners, EventEmitter } = require('events'); **`Since`** -v15.2.0 +v15.2.0, v14.17.0 #### Parameters | Name | Type | | :------ | :------ | -| `emitter` | `EventEmitter` \| `DOMEventTarget` | +| `emitter` | `EventEmitter` \| `_DOMEventTarget` | | `name` | `string` \| `symbol` | #### Returns @@ -721,7 +721,7 @@ EventEmitter.getEventListeners #### Defined in -node_modules/@types/node/events.d.ts:262 +node_modules/@types/node/ts4.8/events.d.ts:299 ___ @@ -765,7 +765,7 @@ EventEmitter.listenerCount #### Defined in -node_modules/@types/node/events.d.ts:234 +node_modules/@types/node/ts4.8/events.d.ts:271 ___ @@ -851,7 +851,7 @@ EventEmitter.on #### Defined in -node_modules/@types/node/events.d.ts:217 +node_modules/@types/node/ts4.8/events.d.ts:254 ___ @@ -947,7 +947,7 @@ v11.13.0, v10.16.0 | Name | Type | | :------ | :------ | -| `emitter` | `NodeEventTarget` | +| `emitter` | `_NodeEventTarget` | | `eventName` | `string` \| `symbol` | | `options?` | `StaticEventEmitterOptions` | @@ -961,7 +961,7 @@ EventEmitter.once #### Defined in -node_modules/@types/node/events.d.ts:157 +node_modules/@types/node/ts4.8/events.d.ts:194 ▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> @@ -969,7 +969,7 @@ node_modules/@types/node/events.d.ts:157 | Name | Type | | :------ | :------ | -| `emitter` | `DOMEventTarget` | +| `emitter` | `_DOMEventTarget` | | `eventName` | `string` | | `options?` | `StaticEventEmitterOptions` | @@ -983,7 +983,7 @@ EventEmitter.once #### Defined in -node_modules/@types/node/events.d.ts:158 +node_modules/@types/node/ts4.8/events.d.ts:195 ___ @@ -1012,7 +1012,7 @@ v15.4.0 | Name | Type | Description | | :------ | :------ | :------ | | `n?` | `number` | A non-negative number. The maximum number of listeners per `EventTarget` event. | -| `...eventTargets` | (`EventEmitter` \| `DOMEventTarget`)[] | - | +| `...eventTargets` | (`EventEmitter` \| `_DOMEventTarget`)[] | - | #### Returns @@ -1024,4 +1024,4 @@ EventEmitter.setMaxListeners #### Defined in -node_modules/@types/node/events.d.ts:280 +node_modules/@types/node/ts4.8/events.d.ts:317 diff --git a/packages/util/docs/classes/MapDB.md b/packages/util/docs/classes/MapDB.md new file mode 100644 index 0000000000..3fcfac4362 --- /dev/null +++ b/packages/util/docs/classes/MapDB.md @@ -0,0 +1,215 @@ +[@ethereumjs/util](../README.md) / MapDB + +# Class: MapDB + +## Type parameters + +| Name | Type | +| :------ | :------ | +| `TKey` | extends `Uint8Array` \| `string` \| `number` | +| `TValue` | extends `Uint8Array` \| `string` \| [`DBObject`](../README.md#dbobject) | + +## Implements + +- [`DB`](../interfaces/DB.md)<`TKey`, `TValue`\> + +## Table of contents + +### Constructors + +- [constructor](MapDB.md#constructor) + +### Properties + +- [\_database](MapDB.md#_database) + +### Methods + +- [batch](MapDB.md#batch) +- [del](MapDB.md#del) +- [get](MapDB.md#get) +- [open](MapDB.md#open) +- [put](MapDB.md#put) +- [shallowCopy](MapDB.md#shallowcopy) + +## Constructors + +### constructor + +• **new MapDB**<`TKey`, `TValue`\>(`database?`) + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `TKey` | extends `string` \| `number` \| `Uint8Array` | +| `TValue` | extends `string` \| `Uint8Array` \| [`DBObject`](../README.md#dbobject) | + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `database?` | `Map`<`TKey`, `TValue`\> | + +#### Defined in + +[packages/util/src/mapDB.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L12) + +## Properties + +### \_database + +• **\_database**: `Map`<`TKey`, `TValue`\> + +#### Defined in + +[packages/util/src/mapDB.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L10) + +## Methods + +### batch + +▸ **batch**(`opStack`): `Promise`<`void`\> + +Performs a batch operation on db. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `opStack` | [`BatchDBOp`](../README.md#batchdbop)<`TKey`, `TValue`\>[] | A stack of levelup operations | + +#### Returns + +`Promise`<`void`\> + +#### Implementation of + +[DB](../interfaces/DB.md).[batch](../interfaces/DB.md#batch) + +#### Defined in + +[packages/util/src/mapDB.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L31) + +___ + +### del + +▸ **del**(`key`): `Promise`<`void`\> + +Removes a raw value in the underlying db. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `key` | `TKey` | + +#### Returns + +`Promise`<`void`\> + +#### Implementation of + +[DB](../interfaces/DB.md).[del](../interfaces/DB.md#del) + +#### Defined in + +[packages/util/src/mapDB.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L26) + +___ + +### get + +▸ **get**(`key`): `Promise`<`undefined` \| `TValue`\> + +Retrieves a raw value from db. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `key` | `TKey` | + +#### Returns + +`Promise`<`undefined` \| `TValue`\> + +A Promise that resolves to `Uint8Array` if a value is found or `undefined` if no value is found. + +#### Implementation of + +[DB](../interfaces/DB.md).[get](../interfaces/DB.md#get) + +#### Defined in + +[packages/util/src/mapDB.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L16) + +___ + +### open + +▸ **open**(): `Promise`<`void`\> + +Opens the database -- if applicable + +#### Returns + +`Promise`<`void`\> + +#### Implementation of + +[DB](../interfaces/DB.md).[open](../interfaces/DB.md#open) + +#### Defined in + +[packages/util/src/mapDB.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L52) + +___ + +### put + +▸ **put**(`key`, `val`): `Promise`<`void`\> + +Writes a value directly to db. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `key` | `TKey` | The key as a `TValue` | +| `val` | `TValue` | - | + +#### Returns + +`Promise`<`void`\> + +#### Implementation of + +[DB](../interfaces/DB.md).[put](../interfaces/DB.md#put) + +#### Defined in + +[packages/util/src/mapDB.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L21) + +___ + +### shallowCopy + +▸ **shallowCopy**(): [`DB`](../interfaces/DB.md)<`TKey`, `TValue`\> + +Note that the returned shallow copy will share the underlying database with the original + +#### Returns + +[`DB`](../interfaces/DB.md)<`TKey`, `TValue`\> + +DB + +#### Implementation of + +[DB](../interfaces/DB.md).[shallowCopy](../interfaces/DB.md#shallowcopy) + +#### Defined in + +[packages/util/src/mapDB.ts:48](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/mapDB.ts#L48) diff --git a/packages/util/docs/classes/Withdrawal.md b/packages/util/docs/classes/Withdrawal.md index 9eaff667ea..f5df9ea9ee 100644 --- a/packages/util/docs/classes/Withdrawal.md +++ b/packages/util/docs/classes/Withdrawal.md @@ -24,7 +24,7 @@ Representation of EIP-4895 withdrawal data - [toValue](Withdrawal.md#tovalue) - [fromValuesArray](Withdrawal.md#fromvaluesarray) - [fromWithdrawalData](Withdrawal.md#fromwithdrawaldata) -- [toBufferArray](Withdrawal.md#tobufferarray) +- [toBytesArray](Withdrawal.md#tobytesarray) ## Constructors @@ -95,15 +95,15 @@ ___ ### raw -▸ **raw**(): [`WithdrawalBuffer`](../README.md#withdrawalbuffer) +▸ **raw**(): [`WithdrawalBytes`](../README.md#withdrawalbytes) #### Returns -[`WithdrawalBuffer`](../README.md#withdrawalbuffer) +[`WithdrawalBytes`](../README.md#withdrawalbytes) #### Defined in -[packages/util/src/withdrawal.ts:102](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L102) +[packages/util/src/withdrawal.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L99) ___ @@ -124,7 +124,7 @@ ___ #### Defined in -[packages/util/src/withdrawal.ts:115](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L115) +[packages/util/src/withdrawal.ts:112](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L112) ___ @@ -138,14 +138,14 @@ ___ | Name | Type | | :------ | :------ | -| `address` | `Buffer` | +| `address` | `Uint8Array` | | `amount` | `bigint` | | `index` | `bigint` | | `validatorIndex` | `bigint` | #### Defined in -[packages/util/src/withdrawal.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L106) +[packages/util/src/withdrawal.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/withdrawal.ts#L103) ___ @@ -157,7 +157,7 @@ ___ | Name | Type | | :------ | :------ | -| `withdrawalArray` | [`WithdrawalBuffer`](../README.md#withdrawalbuffer) | +| `withdrawalArray` | [`WithdrawalBytes`](../README.md#withdrawalbytes) | #### Returns @@ -189,9 +189,9 @@ ___ ___ -### toBufferArray +### toBytesArray -▸ `Static` **toBufferArray**(`withdrawal`): [`WithdrawalBuffer`](../README.md#withdrawalbuffer) +▸ `Static` **toBytesArray**(`withdrawal`): [`WithdrawalBytes`](../README.md#withdrawalbytes) Convert a withdrawal to a buffer array @@ -203,7 +203,7 @@ Convert a withdrawal to a buffer array #### Returns -[`WithdrawalBuffer`](../README.md#withdrawalbuffer) +[`WithdrawalBytes`](../README.md#withdrawalbytes) buffer array of the withdrawal diff --git a/packages/util/docs/enums/KeyEncoding.md b/packages/util/docs/enums/KeyEncoding.md new file mode 100644 index 0000000000..e8656cfe80 --- /dev/null +++ b/packages/util/docs/enums/KeyEncoding.md @@ -0,0 +1,41 @@ +[@ethereumjs/util](../README.md) / KeyEncoding + +# Enumeration: KeyEncoding + +## Table of contents + +### Enumeration Members + +- [Bytes](KeyEncoding.md#bytes) +- [Number](KeyEncoding.md#number) +- [String](KeyEncoding.md#string) + +## Enumeration Members + +### Bytes + +• **Bytes** = ``"view"`` + +#### Defined in + +[packages/util/src/db.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L11) + +___ + +### Number + +• **Number** = ``"number"`` + +#### Defined in + +[packages/util/src/db.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L12) + +___ + +### String + +• **String** = ``"string"`` + +#### Defined in + +[packages/util/src/db.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L10) diff --git a/packages/util/docs/enums/TypeOutput.md b/packages/util/docs/enums/TypeOutput.md index ee1234f8e8..445a1e4d57 100644 --- a/packages/util/docs/enums/TypeOutput.md +++ b/packages/util/docs/enums/TypeOutput.md @@ -9,9 +9,9 @@ Type output options ### Enumeration Members - [BigInt](TypeOutput.md#bigint) -- [Buffer](TypeOutput.md#buffer) - [Number](TypeOutput.md#number) - [PrefixedHexString](TypeOutput.md#prefixedhexstring) +- [Uint8Array](TypeOutput.md#uint8array) ## Enumeration Members @@ -21,34 +21,34 @@ Type output options #### Defined in -[packages/util/src/types.ts:58](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L58) +[packages/util/src/types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L44) ___ -### Buffer +### Number -• **Buffer** = ``2`` +• **Number** = ``0`` #### Defined in -[packages/util/src/types.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L59) +[packages/util/src/types.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L43) ___ -### Number +### PrefixedHexString -• **Number** = ``0`` +• **PrefixedHexString** = ``3`` #### Defined in -[packages/util/src/types.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L57) +[packages/util/src/types.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L46) ___ -### PrefixedHexString +### Uint8Array -• **PrefixedHexString** = ``3`` +• **Uint8Array** = ``2`` #### Defined in -[packages/util/src/types.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L60) +[packages/util/src/types.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L45) diff --git a/packages/util/docs/enums/ValueEncoding.md b/packages/util/docs/enums/ValueEncoding.md new file mode 100644 index 0000000000..15456584d7 --- /dev/null +++ b/packages/util/docs/enums/ValueEncoding.md @@ -0,0 +1,41 @@ +[@ethereumjs/util](../README.md) / ValueEncoding + +# Enumeration: ValueEncoding + +## Table of contents + +### Enumeration Members + +- [Bytes](ValueEncoding.md#bytes) +- [JSON](ValueEncoding.md#json) +- [String](ValueEncoding.md#string) + +## Enumeration Members + +### Bytes + +• **Bytes** = ``"view"`` + +#### Defined in + +[packages/util/src/db.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L17) + +___ + +### JSON + +• **JSON** = ``"json"`` + +#### Defined in + +[packages/util/src/db.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L18) + +___ + +### String + +• **String** = ``"string"`` + +#### Defined in + +[packages/util/src/db.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L16) diff --git a/packages/util/docs/interfaces/AccountData.md b/packages/util/docs/interfaces/AccountData.md index 3fd4cae41e..1aff89cef0 100644 --- a/packages/util/docs/interfaces/AccountData.md +++ b/packages/util/docs/interfaces/AccountData.md @@ -19,17 +19,17 @@ #### Defined in -[packages/util/src/account.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L25) +[packages/util/src/account.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L26) ___ ### codeHash -• `Optional` **codeHash**: [`BufferLike`](../README.md#bufferlike) +• `Optional` **codeHash**: [`BytesLike`](../README.md#byteslike) #### Defined in -[packages/util/src/account.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L27) +[packages/util/src/account.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L28) ___ @@ -39,14 +39,14 @@ ___ #### Defined in -[packages/util/src/account.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L24) +[packages/util/src/account.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L25) ___ ### storageRoot -• `Optional` **storageRoot**: [`BufferLike`](../README.md#bufferlike) +• `Optional` **storageRoot**: [`BytesLike`](../README.md#byteslike) #### Defined in -[packages/util/src/account.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L26) +[packages/util/src/account.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/account.ts#L27) diff --git a/packages/util/docs/interfaces/DB.md b/packages/util/docs/interfaces/DB.md new file mode 100644 index 0000000000..bec4a1348b --- /dev/null +++ b/packages/util/docs/interfaces/DB.md @@ -0,0 +1,152 @@ +[@ethereumjs/util](../README.md) / DB + +# Interface: DB + +## Type parameters + +| Name | Type | +| :------ | :------ | +| `TKey` | extends `Uint8Array` \| `string` \| `number` = `Uint8Array` | +| `TValue` | extends `Uint8Array` \| `string` \| [`DBObject`](../README.md#dbobject) = `Uint8Array` | + +## Implemented by + +- [`MapDB`](../classes/MapDB.md) + +## Table of contents + +### Methods + +- [batch](DB.md#batch) +- [del](DB.md#del) +- [get](DB.md#get) +- [open](DB.md#open) +- [put](DB.md#put) +- [shallowCopy](DB.md#shallowcopy) + +## Methods + +### batch + +▸ **batch**(`opStack`): `Promise`<`void`\> + +Performs a batch operation on db. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `opStack` | [`BatchDBOp`](../README.md#batchdbop)<`TKey`, `TValue`\>[] | A stack of levelup operations | + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[packages/util/src/db.ts:69](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L69) + +___ + +### del + +▸ **del**(`key`, `opts?`): `Promise`<`void`\> + +Removes a raw value in the underlying db. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `key` | `TKey` | +| `opts?` | [`EncodingOpts`](../README.md#encodingopts) | + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[packages/util/src/db.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L63) + +___ + +### get + +▸ **get**(`key`, `opts?`): `Promise`<`undefined` \| `TValue`\> + +Retrieves a raw value from db. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `key` | `TKey` | +| `opts?` | [`EncodingOpts`](../README.md#encodingopts) | + +#### Returns + +`Promise`<`undefined` \| `TValue`\> + +A Promise that resolves to `Uint8Array` if a value is found or `undefined` if no value is found. + +#### Defined in + +[packages/util/src/db.ts:50](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L50) + +___ + +### open + +▸ **open**(): `Promise`<`void`\> + +Opens the database -- if applicable + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[packages/util/src/db.ts:80](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L80) + +___ + +### put + +▸ **put**(`key`, `val`, `opts?`): `Promise`<`void`\> + +Writes a value directly to db. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `key` | `TKey` | The key as a `TValue` | +| `val` | `TValue` | - | +| `opts?` | [`EncodingOpts`](../README.md#encodingopts) | - | + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[packages/util/src/db.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L57) + +___ + +### shallowCopy + +▸ **shallowCopy**(): [`DB`](DB.md)<`TKey`, `TValue`\> + +Returns a copy of the DB instance, with a reference +to the **same** underlying db instance. + +#### Returns + +[`DB`](DB.md)<`TKey`, `TValue`\> + +#### Defined in + +[packages/util/src/db.ts:75](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L75) diff --git a/packages/util/docs/interfaces/DelBatch.md b/packages/util/docs/interfaces/DelBatch.md new file mode 100644 index 0000000000..2a2ee2e113 --- /dev/null +++ b/packages/util/docs/interfaces/DelBatch.md @@ -0,0 +1,47 @@ +[@ethereumjs/util](../README.md) / DelBatch + +# Interface: DelBatch + +## Type parameters + +| Name | Type | +| :------ | :------ | +| `TKey` | extends `Uint8Array` \| `string` \| `number` = `Uint8Array` | + +## Table of contents + +### Properties + +- [key](DelBatch.md#key) +- [opts](DelBatch.md#opts) +- [type](DelBatch.md#type) + +## Properties + +### key + +• **key**: `TKey` + +#### Defined in + +[packages/util/src/db.ts:37](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L37) + +___ + +### opts + +• `Optional` **opts**: [`EncodingOpts`](../README.md#encodingopts) + +#### Defined in + +[packages/util/src/db.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L38) + +___ + +### type + +• **type**: ``"del"`` + +#### Defined in + +[packages/util/src/db.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L36) diff --git a/packages/util/docs/interfaces/ECDSASignature.md b/packages/util/docs/interfaces/ECDSASignature.md index cdb6a82fb9..c032be7f89 100644 --- a/packages/util/docs/interfaces/ECDSASignature.md +++ b/packages/util/docs/interfaces/ECDSASignature.md @@ -14,21 +14,21 @@ ### r -• **r**: `Buffer` +• **r**: `Uint8Array` #### Defined in -[packages/util/src/signature.ts:10](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L10) +[packages/util/src/signature.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L18) ___ ### s -• **s**: `Buffer` +• **s**: `Uint8Array` #### Defined in -[packages/util/src/signature.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L11) +[packages/util/src/signature.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L19) ___ @@ -38,4 +38,4 @@ ___ #### Defined in -[packages/util/src/signature.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L9) +[packages/util/src/signature.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L17) diff --git a/packages/util/docs/interfaces/EthersProvider.md b/packages/util/docs/interfaces/EthersProvider.md new file mode 100644 index 0000000000..d6ac44c6d3 --- /dev/null +++ b/packages/util/docs/interfaces/EthersProvider.md @@ -0,0 +1,35 @@ +[@ethereumjs/util](../README.md) / EthersProvider + +# Interface: EthersProvider + +A partial interface for an `ethers` `JsonRpcProvider` +We only use the url string since we do raw `fetch` calls to +retrieve the necessary data + +## Table of contents + +### Properties + +- [\_getConnection](EthersProvider.md#_getconnection) + +## Properties + +### \_getConnection + +• **\_getConnection**: () => { `url`: `string` } + +#### Type declaration + +▸ (): `Object` + +##### Returns + +`Object` + +| Name | Type | +| :------ | :------ | +| `url` | `string` | + +#### Defined in + +[packages/util/src/provider.ts:55](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/provider.ts#L55) diff --git a/packages/util/docs/interfaces/GenesisState.md b/packages/util/docs/interfaces/GenesisState.md new file mode 100644 index 0000000000..ca3ec85eaf --- /dev/null +++ b/packages/util/docs/interfaces/GenesisState.md @@ -0,0 +1,30 @@ +[@ethereumjs/util](../README.md) / GenesisState + +# Interface: GenesisState + +If you are using a custom chain Common, pass the genesis state. + +Pattern 1 (with genesis state see [GenesisState](GenesisState.md) for format): + +```javascript +{ + '0x0...01': '0x100', // For EoA +} +``` + +Pattern 2 (with complex genesis state, containing contract accounts and storage). +Note that in [AccountState](../README.md#accountstate) there are two +accepted types. This allows to easily insert accounts in the genesis state: + +A complex genesis state with Contract and EoA states would have the following format: + +```javascript +{ + '0x0...01': '0x100', // For EoA + '0x0...02': ['0x1', '0xRUNTIME_BYTECODE', [[storageKey1, storageValue1], [storageKey2, storageValue2]]] // For contracts +} +``` + +## Indexable + +▪ [key: [`PrefixedHexString`](../README.md#prefixedhexstring)]: [`PrefixedHexString`](../README.md#prefixedhexstring) \| [`AccountState`](../README.md#accountstate) diff --git a/packages/util/docs/interfaces/Kzg.md b/packages/util/docs/interfaces/Kzg.md new file mode 100644 index 0000000000..61308665c9 --- /dev/null +++ b/packages/util/docs/interfaces/Kzg.md @@ -0,0 +1,121 @@ +[@ethereumjs/util](../README.md) / Kzg + +# Interface: Kzg + +Interface for an externally provided kzg library used when creating blob transactions + +## Table of contents + +### Methods + +- [blobToKzgCommitment](Kzg.md#blobtokzgcommitment) +- [computeBlobKzgProof](Kzg.md#computeblobkzgproof) +- [loadTrustedSetup](Kzg.md#loadtrustedsetup) +- [verifyBlobKzgProofBatch](Kzg.md#verifyblobkzgproofbatch) +- [verifyKzgProof](Kzg.md#verifykzgproof) + +## Methods + +### blobToKzgCommitment + +▸ **blobToKzgCommitment**(`blob`): `Uint8Array` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `blob` | `Uint8Array` | + +#### Returns + +`Uint8Array` + +#### Defined in + +[packages/util/src/kzg.ts:6](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L6) + +___ + +### computeBlobKzgProof + +▸ **computeBlobKzgProof**(`blob`, `commitment`): `Uint8Array` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `blob` | `Uint8Array` | +| `commitment` | `Uint8Array` | + +#### Returns + +`Uint8Array` + +#### Defined in + +[packages/util/src/kzg.ts:7](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L7) + +___ + +### loadTrustedSetup + +▸ **loadTrustedSetup**(`filePath`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `filePath` | `string` | + +#### Returns + +`void` + +#### Defined in + +[packages/util/src/kzg.ts:5](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L5) + +___ + +### verifyBlobKzgProofBatch + +▸ **verifyBlobKzgProofBatch**(`blobs`, `expectedKzgCommitments`, `kzgProofs`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `blobs` | `Uint8Array`[] | +| `expectedKzgCommitments` | `Uint8Array`[] | +| `kzgProofs` | `Uint8Array`[] | + +#### Returns + +`boolean` + +#### Defined in + +[packages/util/src/kzg.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L14) + +___ + +### verifyKzgProof + +▸ **verifyKzgProof**(`polynomialKzg`, `z`, `y`, `kzgProof`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `polynomialKzg` | `Uint8Array` | +| `z` | `Uint8Array` | +| `y` | `Uint8Array` | +| `kzgProof` | `Uint8Array` | + +#### Returns + +`boolean` + +#### Defined in + +[packages/util/src/kzg.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/kzg.ts#L8) diff --git a/packages/util/docs/interfaces/PutBatch.md b/packages/util/docs/interfaces/PutBatch.md new file mode 100644 index 0000000000..d96b5e54c7 --- /dev/null +++ b/packages/util/docs/interfaces/PutBatch.md @@ -0,0 +1,59 @@ +[@ethereumjs/util](../README.md) / PutBatch + +# Interface: PutBatch + +## Type parameters + +| Name | Type | +| :------ | :------ | +| `TKey` | extends `Uint8Array` \| `string` \| `number` = `Uint8Array` | +| `TValue` | extends `Uint8Array` \| `string` \| [`DBObject`](../README.md#dbobject) = `Uint8Array` | + +## Table of contents + +### Properties + +- [key](PutBatch.md#key) +- [opts](PutBatch.md#opts) +- [type](PutBatch.md#type) +- [value](PutBatch.md#value) + +## Properties + +### key + +• **key**: `TKey` + +#### Defined in + +[packages/util/src/db.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L30) + +___ + +### opts + +• `Optional` **opts**: [`EncodingOpts`](../README.md#encodingopts) + +#### Defined in + +[packages/util/src/db.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L32) + +___ + +### type + +• **type**: ``"put"`` + +#### Defined in + +[packages/util/src/db.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L29) + +___ + +### value + +• **value**: `TValue` + +#### Defined in + +[packages/util/src/db.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/db.ts#L31) diff --git a/packages/util/docs/interfaces/TransformableToArray.md b/packages/util/docs/interfaces/TransformableToArray.md deleted file mode 100644 index 4aa72b0a9c..0000000000 --- a/packages/util/docs/interfaces/TransformableToArray.md +++ /dev/null @@ -1,38 +0,0 @@ -[@ethereumjs/util](../README.md) / TransformableToArray - -# Interface: TransformableToArray - -## Table of contents - -### Methods - -- [toArray](TransformableToArray.md#toarray) -- [toBuffer](TransformableToArray.md#tobuffer) - -## Methods - -### toArray - -▸ **toArray**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/types.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L38) - -___ - -### toBuffer - -▸ `Optional` **toBuffer**(): `Buffer` - -#### Returns - -`Buffer` - -#### Defined in - -[packages/util/src/types.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L39) diff --git a/packages/util/docs/interfaces/TransformableToBuffer.md b/packages/util/docs/interfaces/TransformableToBuffer.md deleted file mode 100644 index 4172cd4712..0000000000 --- a/packages/util/docs/interfaces/TransformableToBuffer.md +++ /dev/null @@ -1,38 +0,0 @@ -[@ethereumjs/util](../README.md) / TransformableToBuffer - -# Interface: TransformableToBuffer - -## Table of contents - -### Methods - -- [toArray](TransformableToBuffer.md#toarray) -- [toBuffer](TransformableToBuffer.md#tobuffer) - -## Methods - -### toArray - -▸ `Optional` **toArray**(): `Uint8Array` - -#### Returns - -`Uint8Array` - -#### Defined in - -[packages/util/src/types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L47) - -___ - -### toBuffer - -▸ **toBuffer**(): `Buffer` - -#### Returns - -`Buffer` - -#### Defined in - -[packages/util/src/types.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L46) diff --git a/packages/util/docs/interfaces/TransformabletoBytes.md b/packages/util/docs/interfaces/TransformabletoBytes.md new file mode 100644 index 0000000000..c38940714b --- /dev/null +++ b/packages/util/docs/interfaces/TransformabletoBytes.md @@ -0,0 +1,23 @@ +[@ethereumjs/util](../README.md) / TransformabletoBytes + +# Interface: TransformabletoBytes + +## Table of contents + +### Methods + +- [toBytes](TransformabletoBytes.md#tobytes) + +## Methods + +### toBytes + +▸ `Optional` **toBytes**(): `Uint8Array` + +#### Returns + +`Uint8Array` + +#### Defined in + +[packages/util/src/types.ts:34](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/types.ts#L34) diff --git a/packages/util/docs/modules/ssz.md b/packages/util/docs/modules/ssz.md deleted file mode 100644 index 4c6c89fa8e..0000000000 --- a/packages/util/docs/modules/ssz.md +++ /dev/null @@ -1,65 +0,0 @@ -[@ethereumjs/util](../README.md) / ssz - -# Namespace: ssz - -SSZ containers - -## Table of contents - -### Variables - -- [Bytes20](ssz.md#bytes20) -- [UintBigInt64](ssz.md#uintbigint64) -- [UintNum64](ssz.md#uintnum64) -- [Withdrawal](ssz.md#withdrawal) -- [Withdrawals](ssz.md#withdrawals) - -## Variables - -### Bytes20 - -• `Const` **Bytes20**: `ByteVectorType` - -#### Defined in - -[packages/util/src/ssz.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/ssz.ts#L13) - -___ - -### UintBigInt64 - -• `Const` **UintBigInt64**: `UintBigintType` - -#### Defined in - -[packages/util/src/ssz.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/ssz.ts#L12) - -___ - -### UintNum64 - -• `Const` **UintNum64**: `UintNumberType` - -#### Defined in - -[packages/util/src/ssz.ts:11](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/ssz.ts#L11) - -___ - -### Withdrawal - -• `Const` **Withdrawal**: `ContainerType`<{ `address`: `ByteVectorType` = Bytes20; `amount`: `UintBigintType` = UintBigInt64; `index`: `UintBigintType` = UintBigInt64; `validatorIndex`: `UintBigintType` = UintBigInt64 }\> - -#### Defined in - -[packages/util/src/ssz.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/ssz.ts#L15) - -___ - -### Withdrawals - -• `Const` **Withdrawals**: `ListCompositeType`<`ContainerType`<{ `address`: `ByteVectorType` = Bytes20; `amount`: `UintBigintType` = UintBigInt64; `index`: `UintBigintType` = UintBigInt64; `validatorIndex`: `UintBigintType` = UintBigInt64 }\>\> - -#### Defined in - -[packages/util/src/ssz.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/ssz.ts#L24) diff --git a/packages/util/package.json b/packages/util/package.json index c5f697b2e4..c46fa1c98c 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/util", - "version": "9.0.0-rc.1", + "version": "9.0.0", "description": "A collection of utility functions for Ethereum", "keywords": [ "ethereum", @@ -90,7 +90,7 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/rlp": "5.0.0-rc.1", + "@ethereumjs/rlp": "^5.0.0", "ethereum-cryptography": "^2.1.2" }, "devDependencies": {}, diff --git a/packages/vm/CHANGELOG.md b/packages/vm/CHANGELOG.md index abeb90c240..422631defa 100644 --- a/packages/vm/CHANGELOG.md +++ b/packages/vm/CHANGELOG.md @@ -6,6 +6,16 @@ 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). +## 7.0.0 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Fvm%407.0.0-rc.1) for the main change description. + +Following additional changes since RC1: + +- 4844: Rename `dataGas` to `blobGas` (see EIP-4844 PR [#7354](https://github.com/ethereum/EIPs/pull/7354)), PR [#2919](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2919) + ## 7.0.0-rc.1 - 2023-07-18 This is the release candidate (RC1) for the upcoming breaking releases on the various EthereumJS libraries. The associated release notes below are the main source of information on the changeset, also for the upcoming final releases, where we'll just provide change addition summaries + references to these RC1 notes. diff --git a/packages/vm/README.md b/packages/vm/README.md index e008fa5624..960eab1122 100644 --- a/packages/vm/README.md +++ b/packages/vm/README.md @@ -6,8 +6,6 @@ [![Code Coverage][vm-coverage-badge]][vm-coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - | Execution Context for the Ethereum EVM Implementation. | | ------------------------------------------------------ | diff --git a/packages/vm/docs/README.md b/packages/vm/docs/README.md index dca5b2b1b6..1213253435 100644 --- a/packages/vm/docs/README.md +++ b/packages/vm/docs/README.md @@ -4,207 +4,89 @@ ## Table of contents +### Enumerations + +- [BuildStatus](enums/BuildStatus.md) + ### Classes -- [EEI](undefined) -- [VM](undefined) +- [BlockBuilder](classes/BlockBuilder.md) +- [VM](classes/VM.md) ### Interfaces -- [AfterBlockEvent](undefined) -- [AfterTxEvent](undefined) -- [BaseTxReceipt](undefined) -- [BuildBlockOpts](undefined) -- [BuilderOpts](undefined) -- [PostByzantiumTxReceipt](undefined) -- [PreByzantiumTxReceipt](undefined) -- [RunBlockOpts](undefined) -- [RunBlockResult](undefined) -- [RunTxOpts](undefined) -- [RunTxResult](undefined) -- [SealBlockOpts](undefined) -- [VMOpts](undefined) +- [AfterBlockEvent](interfaces/AfterBlockEvent.md) +- [AfterTxEvent](interfaces/AfterTxEvent.md) +- [BaseTxReceipt](interfaces/BaseTxReceipt.md) +- [BuildBlockOpts](interfaces/BuildBlockOpts.md) +- [BuilderOpts](interfaces/BuilderOpts.md) +- [EIP4844BlobTxReceipt](interfaces/EIP4844BlobTxReceipt.md) +- [PostByzantiumTxReceipt](interfaces/PostByzantiumTxReceipt.md) +- [PreByzantiumTxReceipt](interfaces/PreByzantiumTxReceipt.md) +- [RunBlockOpts](interfaces/RunBlockOpts.md) +- [RunBlockResult](interfaces/RunBlockResult.md) +- [RunTxOpts](interfaces/RunTxOpts.md) +- [RunTxResult](interfaces/RunTxResult.md) +- [SealBlockOpts](interfaces/SealBlockOpts.md) +- [VMOpts](interfaces/VMOpts.md) ### Type Aliases -- [TxReceipt](undefined) -- [VMEvents](undefined) - -## Classes - -### EEI - -• **EEI**: Class EEI - -#### Defined in - -[vm/src/eei/eei.ts:27](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/eei/eei.ts#L27) - -___ - -### VM - -• **VM**: Class VM - -#### Defined in - -[vm/src/vm.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L33) - -## Interfaces - -### AfterBlockEvent - -• **AfterBlockEvent**: Interface AfterBlockEvent - -#### Defined in - -[vm/src/types.ts:281](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L281) - -___ - -### AfterTxEvent - -• **AfterTxEvent**: Interface AfterTxEvent - -#### Defined in - -[vm/src/types.ts:380](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L380) - -___ - -### BaseTxReceipt - -• **BaseTxReceipt**: Interface BaseTxReceipt - -#### Defined in - -[vm/src/types.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L14) - -___ - -### BuildBlockOpts - -• **BuildBlockOpts**: Interface BuildBlockOpts - -#### Defined in - -[vm/src/types.ts:163](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L163) - -___ - -### BuilderOpts - -• **BuilderOpts**: Interface BuilderOpts - -#### Defined in - -[vm/src/types.ts:147](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L147) - -___ - -### PostByzantiumTxReceipt - -• **PostByzantiumTxReceipt**: Interface PostByzantiumTxReceipt - -#### Defined in - -[vm/src/types.ts:44](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L44) - -___ - -### PreByzantiumTxReceipt - -• **PreByzantiumTxReceipt**: Interface PreByzantiumTxReceipt - -#### Defined in - -[vm/src/types.ts:33](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L33) - -___ - -### RunBlockOpts - -• **RunBlockOpts**: Interface RunBlockOpts - -#### Defined in - -[vm/src/types.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L202) - -___ - -### RunBlockResult - -• **RunBlockResult**: Interface RunBlockResult - -#### Defined in - -[vm/src/types.ts:254](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L254) - -___ - -### RunTxOpts - -• **RunTxOpts**: Interface RunTxOpts +- [TxReceipt](README.md#txreceipt) +- [VMEvents](README.md#vmevents) -#### Defined in +### Functions -[vm/src/types.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L289) +- [encodeReceipt](README.md#encodereceipt) -___ +## Type Aliases -### RunTxResult +### TxReceipt -• **RunTxResult**: Interface RunTxResult +Ƭ **TxReceipt**: [`PreByzantiumTxReceipt`](interfaces/PreByzantiumTxReceipt.md) \| [`PostByzantiumTxReceipt`](interfaces/PostByzantiumTxReceipt.md) \| [`EIP4844BlobTxReceipt`](interfaces/EIP4844BlobTxReceipt.md) #### Defined in -[vm/src/types.ts:341](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L341) +[vm/src/types.ts:8](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L8) ___ -### SealBlockOpts - -• **SealBlockOpts**: Interface SealBlockOpts - -#### Defined in - -[vm/src/types.ts:185](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L185) +### VMEvents -___ +Ƭ **VMEvents**: `Object` -### VMOpts +#### Type declaration -• **VMOpts**: Interface VMOpts +| Name | Type | +| :------ | :------ | +| `afterBlock` | (`data`: [`AfterBlockEvent`](interfaces/AfterBlockEvent.md), `resolve?`: (`result?`: `any`) => `void`) => `void` | +| `afterTx` | (`data`: [`AfterTxEvent`](interfaces/AfterTxEvent.md), `resolve?`: (`result?`: `any`) => `void`) => `void` | +| `beforeBlock` | (`data`: `Block`, `resolve?`: (`result?`: `any`) => `void`) => `void` | +| `beforeTx` | (`data`: `TypedTransaction`, `resolve?`: (`result?`: `any`) => `void`) => `void` | #### Defined in -[vm/src/types.ts:61](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L61) +[vm/src/types.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L67) -## Type Aliases - -### TxReceipt +## Functions -Ƭ **TxReceipt**: PreByzantiumTxReceipt \| PostByzantiumTxReceipt +### encodeReceipt -#### Defined in +▸ **encodeReceipt**(`receipt`, `txType`): `Uint8Array` -[vm/src/types.ts:9](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L9) +Returns the encoded tx receipt. -___ - -### VMEvents - -Ƭ **VMEvents**: `Object` - -#### Type declaration +#### Parameters | Name | Type | | :------ | :------ | -| `afterBlock` | Method afterBlock | -| `afterTx` | Method afterTx | -| `beforeBlock` | Method beforeBlock | -| `beforeTx` | Method beforeTx | +| `receipt` | [`TxReceipt`](README.md#txreceipt) | +| `txType` | `TransactionType` | + +#### Returns + +`Uint8Array` #### Defined in -[vm/src/types.ts:51](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L51) +[vm/src/runBlock.ts:468](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/runBlock.ts#L468) diff --git a/packages/vm/docs/classes/BlockBuilder.md b/packages/vm/docs/classes/BlockBuilder.md new file mode 100644 index 0000000000..a1d24a50ea --- /dev/null +++ b/packages/vm/docs/classes/BlockBuilder.md @@ -0,0 +1,248 @@ +[@ethereumjs/vm](../README.md) / BlockBuilder + +# Class: BlockBuilder + +## Table of contents + +### Constructors + +- [constructor](BlockBuilder.md#constructor) + +### Properties + +- [blobGasUsed](BlockBuilder.md#blobgasused) +- [gasUsed](BlockBuilder.md#gasused) + +### Accessors + +- [minerValue](BlockBuilder.md#minervalue) +- [transactionReceipts](BlockBuilder.md#transactionreceipts) + +### Methods + +- [addTransaction](BlockBuilder.md#addtransaction) +- [build](BlockBuilder.md#build) +- [getStatus](BlockBuilder.md#getstatus) +- [initState](BlockBuilder.md#initstate) +- [logsBloom](BlockBuilder.md#logsbloom) +- [receiptTrie](BlockBuilder.md#receipttrie) +- [revert](BlockBuilder.md#revert) +- [transactionsTrie](BlockBuilder.md#transactionstrie) + +## Constructors + +### constructor + +• **new BlockBuilder**(`vm`, `opts`) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `vm` | [`VM`](VM.md) | +| `opts` | [`BuildBlockOpts`](../interfaces/BuildBlockOpts.md) | + +#### Defined in + +[vm/src/buildBlock.ts:71](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L71) + +## Properties + +### blobGasUsed + +• **blobGasUsed**: `bigint` + +The cumulative blob gas used by the blobs in a block + +#### Defined in + +[vm/src/buildBlock.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L47) + +___ + +### gasUsed + +• **gasUsed**: `bigint` + +The cumulative gas used by the transactions added to the block. + +#### Defined in + +[vm/src/buildBlock.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L43) + +## Accessors + +### minerValue + +• `get` **minerValue**(): `bigint` + +#### Returns + +`bigint` + +#### Defined in + +[vm/src/buildBlock.ts:67](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L67) + +___ + +### transactionReceipts + +• `get` **transactionReceipts**(): [`TxReceipt`](../README.md#txreceipt)[] + +#### Returns + +[`TxReceipt`](../README.md#txreceipt)[] + +#### Defined in + +[vm/src/buildBlock.ts:63](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L63) + +## Methods + +### addTransaction + +▸ **addTransaction**(`tx`, `__namedParameters?`): `Promise`<[`RunTxResult`](../interfaces/RunTxResult.md)\> + +Run and add a transaction to the block being built. +Please note that this modifies the state of the VM. +Throws if the transaction's gasLimit is greater than +the remaining gas in the block. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | `TypedTransaction` | +| `__namedParameters` | `Object` | +| `__namedParameters.skipHardForkValidation?` | `boolean` | + +#### Returns + +`Promise`<[`RunTxResult`](../interfaces/RunTxResult.md)\> + +#### Defined in + +[vm/src/buildBlock.ts:183](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L183) + +___ + +### build + +▸ **build**(`sealOpts?`): `Promise`<`Block`\> + +This method returns the finalized block. +It also: + - Assigns the reward for miner (PoW) + - Commits the checkpoint on the StateManager + - Sets the tip of the VM's blockchain to this block +For PoW, optionally seals the block with params `nonce` and `mixHash`, +which is validated along with the block number and difficulty by ethash. +For PoA, please pass `blockOption.cliqueSigner` into the buildBlock constructor, +as the signer will be awarded the txs amount spent on gas as they are added. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `sealOpts?` | [`SealBlockOpts`](../interfaces/SealBlockOpts.md) | + +#### Returns + +`Promise`<`Block`\> + +#### Defined in + +[vm/src/buildBlock.ts:273](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L273) + +___ + +### getStatus + +▸ **getStatus**(): `BlockStatus` + +#### Returns + +`BlockStatus` + +#### Defined in + +[vm/src/buildBlock.ts:111](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L111) + +___ + +### initState + +▸ **initState**(): `Promise`<`void`\> + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[vm/src/buildBlock.ts:337](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L337) + +___ + +### logsBloom + +▸ **logsBloom**(): `Uint8Array` + +Calculates and returns the logs bloom for the block. + +#### Returns + +`Uint8Array` + +#### Defined in + +[vm/src/buildBlock.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L125) + +___ + +### receiptTrie + +▸ **receiptTrie**(): `Promise`<`Uint8Array`\> + +Calculates and returns the receiptTrie for the block. + +#### Returns + +`Promise`<`Uint8Array`\> + +#### Defined in + +[vm/src/buildBlock.ts:137](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L137) + +___ + +### revert + +▸ **revert**(): `Promise`<`void`\> + +Reverts the checkpoint on the StateManager to reset the state from any transactions that have been run. + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[vm/src/buildBlock.ts:254](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L254) + +___ + +### transactionsTrie + +▸ **transactionsTrie**(): `Promise`<`Uint8Array`\> + +Calculates and returns the transactionsTrie for the block. + +#### Returns + +`Promise`<`Uint8Array`\> + +#### Defined in + +[vm/src/buildBlock.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L118) diff --git a/packages/vm/docs/classes/VM.md b/packages/vm/docs/classes/VM.md new file mode 100644 index 0000000000..48182ee1bd --- /dev/null +++ b/packages/vm/docs/classes/VM.md @@ -0,0 +1,245 @@ +[@ethereumjs/vm](../README.md) / VM + +# Class: VM + +Execution engine which can be used to run a blockchain, individual +blocks, individual transactions, or snippets of EVM bytecode. + +This class is an AsyncEventEmitter, please consult the README to learn how to use it. + +## Table of contents + +### Properties + +- [blockchain](VM.md#blockchain) +- [common](VM.md#common) +- [events](VM.md#events) +- [evm](VM.md#evm) +- [stateManager](VM.md#statemanager) + +### Methods + +- [buildBlock](VM.md#buildblock) +- [errorStr](VM.md#errorstr) +- [init](VM.md#init) +- [runBlock](VM.md#runblock) +- [runTx](VM.md#runtx) +- [shallowCopy](VM.md#shallowcopy) +- [create](VM.md#create) + +## Properties + +### blockchain + +• `Readonly` **blockchain**: `BlockchainInterface` + +The blockchain the VM operates on + +#### Defined in + +[vm/src/vm.ts:41](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L41) + +___ + +### common + +• `Readonly` **common**: `Common` + +#### Defined in + +[vm/src/vm.ts:43](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L43) + +___ + +### events + +• `Readonly` **events**: `AsyncEventEmitter`<[`VMEvents`](../README.md#vmevents)\> + +#### Defined in + +[vm/src/vm.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L45) + +___ + +### evm + +• `Readonly` **evm**: `EVMInterface` + +The EVM used for bytecode execution + +#### Defined in + +[vm/src/vm.ts:49](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L49) + +___ + +### stateManager + +• `Readonly` **stateManager**: `EVMStateManagerInterface` + +The StateManager used by the VM + +#### Defined in + +[vm/src/vm.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L36) + +## Methods + +### buildBlock + +▸ **buildBlock**(`opts`): `Promise`<[`BlockBuilder`](BlockBuilder.md)\> + +Build a block on top of the current state +by adding one transaction at a time. + +Creates a checkpoint on the StateManager and modifies the state +as transactions are run. The checkpoint is committed on [build](BlockBuilder.md#build) +or discarded with [revert](BlockBuilder.md#revert). + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`BuildBlockOpts`](../interfaces/BuildBlockOpts.md) | + +#### Returns + +`Promise`<[`BlockBuilder`](BlockBuilder.md)\> + +An instance of [BlockBuilder](BlockBuilder.md) with methods: +- [addTransaction](BlockBuilder.md#addtransaction) +- [build](BlockBuilder.md#build) +- [revert](BlockBuilder.md#revert) + +#### Defined in + +[vm/src/vm.ts:215](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L215) + +___ + +### errorStr + +▸ **errorStr**(): `string` + +Return a compact error string representation of the object + +#### Returns + +`string` + +#### Defined in + +[vm/src/vm.ts:248](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L248) + +___ + +### init + +▸ **init**(`__namedParameters?`): `Promise`<`void`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `__namedParameters` | `Object` | +| `__namedParameters.genesisState?` | `GenesisState` | + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[vm/src/vm.ts:139](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L139) + +___ + +### runBlock + +▸ **runBlock**(`opts`): `Promise`<[`RunBlockResult`](../interfaces/RunBlockResult.md)\> + +Processes the `block` running all of the transactions it contains and updating the miner's account + +This method modifies the state. If `generate` is `true`, the state modifications will be +reverted if an exception is raised. If it's `false`, it won't revert if the block's header is +invalid. If an error is thrown from an event handler, the state may or may not be reverted. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `opts` | [`RunBlockOpts`](../interfaces/RunBlockOpts.md) | Default values for options: - `generate`: false | + +#### Returns + +`Promise`<[`RunBlockResult`](../interfaces/RunBlockResult.md)\> + +#### Defined in + +[vm/src/vm.ts:184](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L184) + +___ + +### runTx + +▸ **runTx**(`opts`): `Promise`<[`RunTxResult`](../interfaces/RunTxResult.md)\> + +Process a transaction. Run the vm. Transfers eth. Checks balances. + +This method modifies the state. If an error is thrown, the modifications are reverted, except +when the error is thrown from an event handler. In the latter case the state may or may not be +reverted. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `opts` | [`RunTxOpts`](../interfaces/RunTxOpts.md) | + +#### Returns + +`Promise`<[`RunTxResult`](../interfaces/RunTxResult.md)\> + +#### Defined in + +[vm/src/vm.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L197) + +___ + +### shallowCopy + +▸ **shallowCopy**(): `Promise`<[`VM`](VM.md)\> + +Returns a copy of the [VM](VM.md) instance. + +Note that the returned copy will share the same db as the original for the blockchain and the statemanager + +#### Returns + +`Promise`<[`VM`](VM.md)\> + +#### Defined in + +[vm/src/vm.ts:224](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L224) + +___ + +### create + +▸ `Static` **create**(`opts?`): `Promise`<[`VM`](VM.md)\> + +VM async constructor. Creates engine instance and initializes it. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `opts` | [`VMOpts`](../interfaces/VMOpts.md) | VM engine constructor options | + +#### Returns + +`Promise`<[`VM`](VM.md)\> + +#### Defined in + +[vm/src/vm.ts:78](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/vm.ts#L78) diff --git a/packages/vm/docs/enums/BuildStatus.md b/packages/vm/docs/enums/BuildStatus.md new file mode 100644 index 0000000000..1aa5016ad2 --- /dev/null +++ b/packages/vm/docs/enums/BuildStatus.md @@ -0,0 +1,41 @@ +[@ethereumjs/vm](../README.md) / BuildStatus + +# Enumeration: BuildStatus + +## Table of contents + +### Enumeration Members + +- [Build](BuildStatus.md#build) +- [Pending](BuildStatus.md#pending) +- [Reverted](BuildStatus.md#reverted) + +## Enumeration Members + +### Build + +• **Build** = ``"build"`` + +#### Defined in + +[vm/src/buildBlock.ts:31](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L31) + +___ + +### Pending + +• **Pending** = ``"pending"`` + +#### Defined in + +[vm/src/buildBlock.ts:32](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L32) + +___ + +### Reverted + +• **Reverted** = ``"reverted"`` + +#### Defined in + +[vm/src/buildBlock.ts:30](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/buildBlock.ts#L30) diff --git a/packages/vm/docs/interfaces/AfterBlockEvent.md b/packages/vm/docs/interfaces/AfterBlockEvent.md new file mode 100644 index 0000000000..e543d57c07 --- /dev/null +++ b/packages/vm/docs/interfaces/AfterBlockEvent.md @@ -0,0 +1,129 @@ +[@ethereumjs/vm](../README.md) / AfterBlockEvent + +# Interface: AfterBlockEvent + +Result of runBlock + +## Hierarchy + +- [`RunBlockResult`](RunBlockResult.md) + + ↳ **`AfterBlockEvent`** + +## Table of contents + +### Properties + +- [block](AfterBlockEvent.md#block) +- [gasUsed](AfterBlockEvent.md#gasused) +- [logsBloom](AfterBlockEvent.md#logsbloom) +- [receipts](AfterBlockEvent.md#receipts) +- [receiptsRoot](AfterBlockEvent.md#receiptsroot) +- [results](AfterBlockEvent.md#results) +- [stateRoot](AfterBlockEvent.md#stateroot) + +## Properties + +### block + +• **block**: `Block` + +#### Defined in + +[vm/src/types.ts:298](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L298) + +___ + +### gasUsed + +• **gasUsed**: `bigint` + +The gas used after executing the block + +#### Inherited from + +[RunBlockResult](RunBlockResult.md).[gasUsed](RunBlockResult.md#gasused) + +#### Defined in + +[vm/src/types.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L285) + +___ + +### logsBloom + +• **logsBloom**: `Uint8Array` + +The bloom filter of the LOGs (events) after executing the block + +#### Inherited from + +[RunBlockResult](RunBlockResult.md).[logsBloom](RunBlockResult.md#logsbloom) + +#### Defined in + +[vm/src/types.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L289) + +___ + +### receipts + +• **receipts**: [`TxReceipt`](../README.md#txreceipt)[] + +Receipts generated for transactions in the block + +#### Inherited from + +[RunBlockResult](RunBlockResult.md).[receipts](RunBlockResult.md#receipts) + +#### Defined in + +[vm/src/types.ts:273](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L273) + +___ + +### receiptsRoot + +• **receiptsRoot**: `Uint8Array` + +The receipt root after executing the block + +#### Inherited from + +[RunBlockResult](RunBlockResult.md).[receiptsRoot](RunBlockResult.md#receiptsroot) + +#### Defined in + +[vm/src/types.ts:293](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L293) + +___ + +### results + +• **results**: [`RunTxResult`](RunTxResult.md)[] + +Results of executing the transactions in the block + +#### Inherited from + +[RunBlockResult](RunBlockResult.md).[results](RunBlockResult.md#results) + +#### Defined in + +[vm/src/types.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L277) + +___ + +### stateRoot + +• **stateRoot**: `Uint8Array` + +The stateRoot after executing the block + +#### Inherited from + +[RunBlockResult](RunBlockResult.md).[stateRoot](RunBlockResult.md#stateroot) + +#### Defined in + +[vm/src/types.ts:281](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L281) diff --git a/packages/vm/docs/interfaces/AfterTxEvent.md b/packages/vm/docs/interfaces/AfterTxEvent.md new file mode 100644 index 0000000000..608a9847a5 --- /dev/null +++ b/packages/vm/docs/interfaces/AfterTxEvent.md @@ -0,0 +1,201 @@ +[@ethereumjs/vm](../README.md) / AfterTxEvent + +# Interface: AfterTxEvent + +Execution result of a transaction + +## Hierarchy + +- [`RunTxResult`](RunTxResult.md) + + ↳ **`AfterTxEvent`** + +## Table of contents + +### Properties + +- [accessList](AfterTxEvent.md#accesslist) +- [amountSpent](AfterTxEvent.md#amountspent) +- [blobGasUsed](AfterTxEvent.md#blobgasused) +- [bloom](AfterTxEvent.md#bloom) +- [createdAddress](AfterTxEvent.md#createdaddress) +- [execResult](AfterTxEvent.md#execresult) +- [gasRefund](AfterTxEvent.md#gasrefund) +- [minerValue](AfterTxEvent.md#minervalue) +- [receipt](AfterTxEvent.md#receipt) +- [totalGasSpent](AfterTxEvent.md#totalgasspent) +- [transaction](AfterTxEvent.md#transaction) + +## Properties + +### accessList + +• `Optional` **accessList**: `AccessList` + +EIP-2930 access list generated for the tx (see `reportAccessList` option) + +#### Inherited from + +[RunTxResult](RunTxResult.md).[accessList](RunTxResult.md#accesslist) + +#### Defined in + +[vm/src/types.ts:387](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L387) + +___ + +### amountSpent + +• **amountSpent**: `bigint` + +The amount of ether used by this transaction + +#### Inherited from + +[RunTxResult](RunTxResult.md).[amountSpent](RunTxResult.md#amountspent) + +#### Defined in + +[vm/src/types.ts:365](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L365) + +___ + +### blobGasUsed + +• `Optional` **blobGasUsed**: `bigint` + +This is the blob gas units times the fee per blob gas for 4844 transactions + +#### Inherited from + +[RunTxResult](RunTxResult.md).[blobGasUsed](RunTxResult.md#blobgasused) + +#### Defined in + +[vm/src/types.ts:397](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L397) + +___ + +### bloom + +• **bloom**: `Bloom` + +Bloom filter resulted from transaction + +#### Inherited from + +[RunTxResult](RunTxResult.md).[bloom](RunTxResult.md#bloom) + +#### Defined in + +[vm/src/types.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L360) + +___ + +### createdAddress + +• `Optional` **createdAddress**: `Address` + +Address of created account during transaction, if any + +#### Inherited from + +[RunTxResult](RunTxResult.md).[createdAddress](RunTxResult.md#createdaddress) + +#### Defined in + +evm/dist/cjs/types.d.ts:234 + +___ + +### execResult + +• **execResult**: `ExecResult` + +Contains the results from running the code, if any, as described in runCode + +#### Inherited from + +[RunTxResult](RunTxResult.md).[execResult](RunTxResult.md#execresult) + +#### Defined in + +evm/dist/cjs/types.d.ts:238 + +___ + +### gasRefund + +• **gasRefund**: `bigint` + +The amount of gas as that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) + +#### Inherited from + +[RunTxResult](RunTxResult.md).[gasRefund](RunTxResult.md#gasrefund) + +#### Defined in + +[vm/src/types.ts:382](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L382) + +___ + +### minerValue + +• **minerValue**: `bigint` + +The value that accrues to the miner by this transaction + +#### Inherited from + +[RunTxResult](RunTxResult.md).[minerValue](RunTxResult.md#minervalue) + +#### Defined in + +[vm/src/types.ts:392](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L392) + +___ + +### receipt + +• **receipt**: [`TxReceipt`](../README.md#txreceipt) + +The tx receipt + +#### Inherited from + +[RunTxResult](RunTxResult.md).[receipt](RunTxResult.md#receipt) + +#### Defined in + +[vm/src/types.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L370) + +___ + +### totalGasSpent + +• **totalGasSpent**: `bigint` + +The amount of gas used in this transaction, which is paid for +This contains the gas units that have been used on execution, plus the upfront cost, +which consists of calldata cost, intrinsic cost and optionally the access list costs + +#### Inherited from + +[RunTxResult](RunTxResult.md).[totalGasSpent](RunTxResult.md#totalgasspent) + +#### Defined in + +[vm/src/types.ts:377](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L377) + +___ + +### transaction + +• **transaction**: `TypedTransaction` + +The transaction which just got finished + +#### Defined in + +[vm/src/types.ts:404](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L404) diff --git a/packages/vm/docs/interfaces/BaseTxReceipt.md b/packages/vm/docs/interfaces/BaseTxReceipt.md new file mode 100644 index 0000000000..12c8b63a5f --- /dev/null +++ b/packages/vm/docs/interfaces/BaseTxReceipt.md @@ -0,0 +1,57 @@ +[@ethereumjs/vm](../README.md) / BaseTxReceipt + +# Interface: BaseTxReceipt + +Abstract interface with common transaction receipt fields + +## Hierarchy + +- **`BaseTxReceipt`** + + ↳ [`PreByzantiumTxReceipt`](PreByzantiumTxReceipt.md) + + ↳ [`PostByzantiumTxReceipt`](PostByzantiumTxReceipt.md) + +## Table of contents + +### Properties + +- [bitvector](BaseTxReceipt.md#bitvector) +- [cumulativeBlockGasUsed](BaseTxReceipt.md#cumulativeblockgasused) +- [logs](BaseTxReceipt.md#logs) + +## Properties + +### bitvector + +• **bitvector**: `Uint8Array` + +Bloom bitvector + +#### Defined in + +[vm/src/types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L21) + +___ + +### cumulativeBlockGasUsed + +• **cumulativeBlockGasUsed**: `bigint` + +Cumulative gas used in the block including this tx + +#### Defined in + +[vm/src/types.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L17) + +___ + +### logs + +• **logs**: `Log`[] + +Logs emitted + +#### Defined in + +[vm/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L25) diff --git a/packages/vm/docs/interfaces/BuildBlockOpts.md b/packages/vm/docs/interfaces/BuildBlockOpts.md new file mode 100644 index 0000000000..4ff98e8a63 --- /dev/null +++ b/packages/vm/docs/interfaces/BuildBlockOpts.md @@ -0,0 +1,61 @@ +[@ethereumjs/vm](../README.md) / BuildBlockOpts + +# Interface: BuildBlockOpts + +Options for building a block. + +## Table of contents + +### Properties + +- [blockOpts](BuildBlockOpts.md#blockopts) +- [headerData](BuildBlockOpts.md#headerdata) +- [parentBlock](BuildBlockOpts.md#parentblock) +- [withdrawals](BuildBlockOpts.md#withdrawals) + +## Properties + +### blockOpts + +• `Optional` **blockOpts**: [`BuilderOpts`](BuilderOpts.md) + +The block and builder options to use. + +#### Defined in + +[vm/src/types.ts:180](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L180) + +___ + +### headerData + +• `Optional` **headerData**: `HeaderData` + +The block header data to use. +Defaults used for any values not provided. + +#### Defined in + +[vm/src/types.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L174) + +___ + +### parentBlock + +• **parentBlock**: `Block` + +The parent block + +#### Defined in + +[vm/src/types.ts:168](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L168) + +___ + +### withdrawals + +• `Optional` **withdrawals**: `WithdrawalData`[] + +#### Defined in + +[vm/src/types.ts:176](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L176) diff --git a/packages/vm/docs/interfaces/BuilderOpts.md b/packages/vm/docs/interfaces/BuilderOpts.md new file mode 100644 index 0000000000..a860c472d4 --- /dev/null +++ b/packages/vm/docs/interfaces/BuilderOpts.md @@ -0,0 +1,165 @@ +[@ethereumjs/vm](../README.md) / BuilderOpts + +# Interface: BuilderOpts + +Options for the block builder. + +## Hierarchy + +- `BlockOptions` + + ↳ **`BuilderOpts`** + +## Table of contents + +### Properties + +- [calcDifficultyFromHeader](BuilderOpts.md#calcdifficultyfromheader) +- [cliqueSigner](BuilderOpts.md#cliquesigner) +- [common](BuilderOpts.md#common) +- [freeze](BuilderOpts.md#freeze) +- [putBlockIntoBlockchain](BuilderOpts.md#putblockintoblockchain) +- [setHardfork](BuilderOpts.md#sethardfork) +- [skipConsensusFormatValidation](BuilderOpts.md#skipconsensusformatvalidation) + +## Properties + +### calcDifficultyFromHeader + +• `Optional` **calcDifficultyFromHeader**: `BlockHeader` + +If a preceding BlockHeader (usually the parent header) is given the preceding +header will be used to calculate the difficulty for this block and the calculated +difficulty takes precedence over a provided static `difficulty` value. + +Note that this option has no effect on networks other than PoW/Ethash networks +(respectively also deactivates on the Merge HF switching to PoS/Casper). + +#### Inherited from + +BlockOptions.calcDifficultyFromHeader + +#### Defined in + +block/dist/cjs/types.d.ts:41 + +___ + +### cliqueSigner + +• `Optional` **cliqueSigner**: `Uint8Array` + +Provide a clique signer's privateKey to seal this block. +Will throw if provided on a non-PoA chain. + +#### Inherited from + +BlockOptions.cliqueSigner + +#### Defined in + +block/dist/cjs/types.d.ts:58 + +___ + +### common + +• `Optional` **common**: `Common` + +A Common object defining the chain and the hardfork a block/block header belongs to. + +Object will be internally copied so that tx behavior don't incidentally +change on future HF changes. + +Default: Common object set to `mainnet` and the HF currently defined as the default +hardfork in the Common class. + +Current default hardfork: `merge` + +#### Inherited from + +BlockOptions.common + +#### Defined in + +block/dist/cjs/types.d.ts:22 + +___ + +### freeze + +• `Optional` **freeze**: `boolean` + +A block object by default gets frozen along initialization. This gives you +strong additional security guarantees on the consistency of the block parameters. +It also enables block hash caching when the `hash()` method is called multiple times. + +If you need to deactivate the block freeze - e.g. because you want to subclass block and +add additional properties - it is strongly encouraged that you do the freeze yourself +within your code instead. + +Default: true + +#### Inherited from + +BlockOptions.freeze + +#### Defined in + +block/dist/cjs/types.d.ts:53 + +___ + +### putBlockIntoBlockchain + +• `Optional` **putBlockIntoBlockchain**: `boolean` + +Whether to put the block into the vm's blockchain after building it. +This is useful for completing a full cycle when building a block so +the only next step is to build again, however it may not be desired +if the block is being emulated or may be discarded as to not affect +the underlying blockchain. + +Default: true + +#### Defined in + +[vm/src/types.ts:158](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L158) + +___ + +### setHardfork + +• `Optional` **setHardfork**: `boolean` \| `BigIntLike` + +Set the hardfork either by timestamp (for HFs from Shanghai onwards) or by block number +for older Hfs. + +Additionally it is possible to pass in a specific TD value to support live-Merge-HF +transitions. Note that this should only be needed in very rare and specific scenarios. + +Default: `false` (HF is set to whatever default HF is set by the Common instance) + +#### Inherited from + +BlockOptions.setHardfork + +#### Defined in + +block/dist/cjs/types.d.ts:32 + +___ + +### skipConsensusFormatValidation + +• `Optional` **skipConsensusFormatValidation**: `boolean` + +Skip consensus format validation checks on header if set. Defaults to false. + +#### Inherited from + +BlockOptions.skipConsensusFormatValidation + +#### Defined in + +block/dist/cjs/types.d.ts:62 diff --git a/packages/vm/docs/interfaces/EIP4844BlobTxReceipt.md b/packages/vm/docs/interfaces/EIP4844BlobTxReceipt.md new file mode 100644 index 0000000000..35b1b96ecc --- /dev/null +++ b/packages/vm/docs/interfaces/EIP4844BlobTxReceipt.md @@ -0,0 +1,117 @@ +[@ethereumjs/vm](../README.md) / EIP4844BlobTxReceipt + +# Interface: EIP4844BlobTxReceipt + +Receipt type for Byzantium and beyond replacing the intermediary +state root field with a status code field (EIP-658) + +## Hierarchy + +- [`PostByzantiumTxReceipt`](PostByzantiumTxReceipt.md) + + ↳ **`EIP4844BlobTxReceipt`** + +## Table of contents + +### Properties + +- [bitvector](EIP4844BlobTxReceipt.md#bitvector) +- [blobGasPrice](EIP4844BlobTxReceipt.md#blobgasprice) +- [blobGasUsed](EIP4844BlobTxReceipt.md#blobgasused) +- [cumulativeBlockGasUsed](EIP4844BlobTxReceipt.md#cumulativeblockgasused) +- [logs](EIP4844BlobTxReceipt.md#logs) +- [status](EIP4844BlobTxReceipt.md#status) + +## Properties + +### bitvector + +• **bitvector**: `Uint8Array` + +Bloom bitvector + +#### Inherited from + +[PostByzantiumTxReceipt](PostByzantiumTxReceipt.md).[bitvector](PostByzantiumTxReceipt.md#bitvector) + +#### Defined in + +[vm/src/types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L21) + +___ + +### blobGasPrice + +• **blobGasPrice**: `bigint` + +blob gas price for block transaction was included in + +Note: This valus is not included in the `receiptRLP` used for encoding the `receiptsRoot` in a block +and is only provided as part of receipt metadata. + +#### Defined in + +[vm/src/types.ts:64](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L64) + +___ + +### blobGasUsed + +• **blobGasUsed**: `bigint` + +blob gas consumed by a transaction + +Note: This value is not included in the receiptRLP used for encoding the receiptsRoot in a block +and is only provided as part of receipt metadata. + +#### Defined in + +[vm/src/types.ts:57](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L57) + +___ + +### cumulativeBlockGasUsed + +• **cumulativeBlockGasUsed**: `bigint` + +Cumulative gas used in the block including this tx + +#### Inherited from + +[PostByzantiumTxReceipt](PostByzantiumTxReceipt.md).[cumulativeBlockGasUsed](PostByzantiumTxReceipt.md#cumulativeblockgasused) + +#### Defined in + +[vm/src/types.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L17) + +___ + +### logs + +• **logs**: `Log`[] + +Logs emitted + +#### Inherited from + +[PostByzantiumTxReceipt](PostByzantiumTxReceipt.md).[logs](PostByzantiumTxReceipt.md#logs) + +#### Defined in + +[vm/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L25) + +___ + +### status + +• **status**: ``0`` \| ``1`` + +Status of transaction, `1` if successful, `0` if an exception occurred + +#### Inherited from + +[PostByzantiumTxReceipt](PostByzantiumTxReceipt.md).[status](PostByzantiumTxReceipt.md#status) + +#### Defined in + +[vm/src/types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L47) diff --git a/packages/vm/docs/interfaces/PostByzantiumTxReceipt.md b/packages/vm/docs/interfaces/PostByzantiumTxReceipt.md new file mode 100644 index 0000000000..74ff1b97f2 --- /dev/null +++ b/packages/vm/docs/interfaces/PostByzantiumTxReceipt.md @@ -0,0 +1,83 @@ +[@ethereumjs/vm](../README.md) / PostByzantiumTxReceipt + +# Interface: PostByzantiumTxReceipt + +Receipt type for Byzantium and beyond replacing the intermediary +state root field with a status code field (EIP-658) + +## Hierarchy + +- [`BaseTxReceipt`](BaseTxReceipt.md) + + ↳ **`PostByzantiumTxReceipt`** + + ↳↳ [`EIP4844BlobTxReceipt`](EIP4844BlobTxReceipt.md) + +## Table of contents + +### Properties + +- [bitvector](PostByzantiumTxReceipt.md#bitvector) +- [cumulativeBlockGasUsed](PostByzantiumTxReceipt.md#cumulativeblockgasused) +- [logs](PostByzantiumTxReceipt.md#logs) +- [status](PostByzantiumTxReceipt.md#status) + +## Properties + +### bitvector + +• **bitvector**: `Uint8Array` + +Bloom bitvector + +#### Inherited from + +[BaseTxReceipt](BaseTxReceipt.md).[bitvector](BaseTxReceipt.md#bitvector) + +#### Defined in + +[vm/src/types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L21) + +___ + +### cumulativeBlockGasUsed + +• **cumulativeBlockGasUsed**: `bigint` + +Cumulative gas used in the block including this tx + +#### Inherited from + +[BaseTxReceipt](BaseTxReceipt.md).[cumulativeBlockGasUsed](BaseTxReceipt.md#cumulativeblockgasused) + +#### Defined in + +[vm/src/types.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L17) + +___ + +### logs + +• **logs**: `Log`[] + +Logs emitted + +#### Inherited from + +[BaseTxReceipt](BaseTxReceipt.md).[logs](BaseTxReceipt.md#logs) + +#### Defined in + +[vm/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L25) + +___ + +### status + +• **status**: ``0`` \| ``1`` + +Status of transaction, `1` if successful, `0` if an exception occurred + +#### Defined in + +[vm/src/types.ts:47](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L47) diff --git a/packages/vm/docs/interfaces/PreByzantiumTxReceipt.md b/packages/vm/docs/interfaces/PreByzantiumTxReceipt.md new file mode 100644 index 0000000000..094c7b8f07 --- /dev/null +++ b/packages/vm/docs/interfaces/PreByzantiumTxReceipt.md @@ -0,0 +1,81 @@ +[@ethereumjs/vm](../README.md) / PreByzantiumTxReceipt + +# Interface: PreByzantiumTxReceipt + +Pre-Byzantium receipt type with a field +for the intermediary state root + +## Hierarchy + +- [`BaseTxReceipt`](BaseTxReceipt.md) + + ↳ **`PreByzantiumTxReceipt`** + +## Table of contents + +### Properties + +- [bitvector](PreByzantiumTxReceipt.md#bitvector) +- [cumulativeBlockGasUsed](PreByzantiumTxReceipt.md#cumulativeblockgasused) +- [logs](PreByzantiumTxReceipt.md#logs) +- [stateRoot](PreByzantiumTxReceipt.md#stateroot) + +## Properties + +### bitvector + +• **bitvector**: `Uint8Array` + +Bloom bitvector + +#### Inherited from + +[BaseTxReceipt](BaseTxReceipt.md).[bitvector](BaseTxReceipt.md#bitvector) + +#### Defined in + +[vm/src/types.ts:21](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L21) + +___ + +### cumulativeBlockGasUsed + +• **cumulativeBlockGasUsed**: `bigint` + +Cumulative gas used in the block including this tx + +#### Inherited from + +[BaseTxReceipt](BaseTxReceipt.md).[cumulativeBlockGasUsed](BaseTxReceipt.md#cumulativeblockgasused) + +#### Defined in + +[vm/src/types.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L17) + +___ + +### logs + +• **logs**: `Log`[] + +Logs emitted + +#### Inherited from + +[BaseTxReceipt](BaseTxReceipt.md).[logs](BaseTxReceipt.md#logs) + +#### Defined in + +[vm/src/types.ts:25](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L25) + +___ + +### stateRoot + +• **stateRoot**: `Uint8Array` + +Intermediary state root + +#### Defined in + +[vm/src/types.ts:36](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L36) diff --git a/packages/vm/docs/interfaces/RunBlockOpts.md b/packages/vm/docs/interfaces/RunBlockOpts.md new file mode 100644 index 0000000000..0bfa8747a4 --- /dev/null +++ b/packages/vm/docs/interfaces/RunBlockOpts.md @@ -0,0 +1,160 @@ +[@ethereumjs/vm](../README.md) / RunBlockOpts + +# Interface: RunBlockOpts + +Options for running a block. + +## Table of contents + +### Properties + +- [block](RunBlockOpts.md#block) +- [clearCache](RunBlockOpts.md#clearcache) +- [generate](RunBlockOpts.md#generate) +- [root](RunBlockOpts.md#root) +- [setHardfork](RunBlockOpts.md#sethardfork) +- [skipBalance](RunBlockOpts.md#skipbalance) +- [skipBlockValidation](RunBlockOpts.md#skipblockvalidation) +- [skipHardForkValidation](RunBlockOpts.md#skiphardforkvalidation) +- [skipHeaderValidation](RunBlockOpts.md#skipheadervalidation) +- [skipNonce](RunBlockOpts.md#skipnonce) + +## Properties + +### block + +• **block**: `Block` + +The @ethereumjs/block to process + +#### Defined in + +[vm/src/types.ts:207](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L207) + +___ + +### clearCache + +• `Optional` **clearCache**: `boolean` + +Clearing the StateManager cache. + +If state root is not reset for whatever reason this can be set to `false` for better performance. + +Default: true + +#### Defined in + +[vm/src/types.ts:219](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L219) + +___ + +### generate + +• `Optional` **generate**: `boolean` + +Whether to generate the stateRoot and other related fields. +If `true`, `runBlock` will set the fields `stateRoot`, `receiptTrie`, `gasUsed`, and `bloom` (logs bloom) after running the block. +If `false`, `runBlock` throws if any fields do not match. +Defaults to `false`. + +#### Defined in + +[vm/src/types.ts:226](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L226) + +___ + +### root + +• `Optional` **root**: `Uint8Array` + +Root of the state trie + +#### Defined in + +[vm/src/types.ts:211](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L211) + +___ + +### setHardfork + +• `Optional` **setHardfork**: `boolean` \| `BigIntLike` + +Set the hardfork either by timestamp (for HFs from Shanghai onwards) or by block number +for older Hfs. + +Additionally it is possible to pass in a specific TD value to support live-Merge-HF +transitions. Note that this should only be needed in very rare and specific scenarios. + +Default: `false` (HF is set to whatever default HF is set by the Common instance) + +#### Defined in + +[vm/src/types.ts:263](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L263) + +___ + +### skipBalance + +• `Optional` **skipBalance**: `boolean` + +If true, checks the balance of the `from` account for the transaction and sets its +balance equal equal to the upfront cost (gas limit * gas price + transaction value) + +#### Defined in + +[vm/src/types.ts:253](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L253) + +___ + +### skipBlockValidation + +• `Optional` **skipBlockValidation**: `boolean` + +If true, will skip "Block validation": +Block validation validates the header (with respect to the blockchain), +the transactions, the transaction trie and the uncle hash. + +#### Defined in + +[vm/src/types.ts:232](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L232) + +___ + +### skipHardForkValidation + +• `Optional` **skipHardForkValidation**: `boolean` + +If true, skips the hardfork validation of vm, block +and tx + +#### Defined in + +[vm/src/types.ts:237](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L237) + +___ + +### skipHeaderValidation + +• `Optional` **skipHeaderValidation**: `boolean` + +if true, will skip "Header validation" +If the block has been picked from the blockchain to be executed, +header has already been validated, and can be skipped especially when +consensus of the chain has moved ahead. + +#### Defined in + +[vm/src/types.ts:244](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L244) + +___ + +### skipNonce + +• `Optional` **skipNonce**: `boolean` + +If true, skips the nonce check + +#### Defined in + +[vm/src/types.ts:248](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L248) diff --git a/packages/vm/docs/interfaces/RunBlockResult.md b/packages/vm/docs/interfaces/RunBlockResult.md new file mode 100644 index 0000000000..b6386c406d --- /dev/null +++ b/packages/vm/docs/interfaces/RunBlockResult.md @@ -0,0 +1,94 @@ +[@ethereumjs/vm](../README.md) / RunBlockResult + +# Interface: RunBlockResult + +Result of runBlock + +## Hierarchy + +- **`RunBlockResult`** + + ↳ [`AfterBlockEvent`](AfterBlockEvent.md) + +## Table of contents + +### Properties + +- [gasUsed](RunBlockResult.md#gasused) +- [logsBloom](RunBlockResult.md#logsbloom) +- [receipts](RunBlockResult.md#receipts) +- [receiptsRoot](RunBlockResult.md#receiptsroot) +- [results](RunBlockResult.md#results) +- [stateRoot](RunBlockResult.md#stateroot) + +## Properties + +### gasUsed + +• **gasUsed**: `bigint` + +The gas used after executing the block + +#### Defined in + +[vm/src/types.ts:285](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L285) + +___ + +### logsBloom + +• **logsBloom**: `Uint8Array` + +The bloom filter of the LOGs (events) after executing the block + +#### Defined in + +[vm/src/types.ts:289](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L289) + +___ + +### receipts + +• **receipts**: [`TxReceipt`](../README.md#txreceipt)[] + +Receipts generated for transactions in the block + +#### Defined in + +[vm/src/types.ts:273](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L273) + +___ + +### receiptsRoot + +• **receiptsRoot**: `Uint8Array` + +The receipt root after executing the block + +#### Defined in + +[vm/src/types.ts:293](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L293) + +___ + +### results + +• **results**: [`RunTxResult`](RunTxResult.md)[] + +Results of executing the transactions in the block + +#### Defined in + +[vm/src/types.ts:277](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L277) + +___ + +### stateRoot + +• **stateRoot**: `Uint8Array` + +The stateRoot after executing the block + +#### Defined in + +[vm/src/types.ts:281](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L281) diff --git a/packages/vm/docs/interfaces/RunTxOpts.md b/packages/vm/docs/interfaces/RunTxOpts.md new file mode 100644 index 0000000000..ae817aba4a --- /dev/null +++ b/packages/vm/docs/interfaces/RunTxOpts.md @@ -0,0 +1,124 @@ +[@ethereumjs/vm](../README.md) / RunTxOpts + +# Interface: RunTxOpts + +Options for the `runTx` method. + +## Table of contents + +### Properties + +- [block](RunTxOpts.md#block) +- [blockGasUsed](RunTxOpts.md#blockgasused) +- [reportAccessList](RunTxOpts.md#reportaccesslist) +- [skipBalance](RunTxOpts.md#skipbalance) +- [skipBlockGasLimitValidation](RunTxOpts.md#skipblockgaslimitvalidation) +- [skipHardForkValidation](RunTxOpts.md#skiphardforkvalidation) +- [skipNonce](RunTxOpts.md#skipnonce) +- [tx](RunTxOpts.md#tx) + +## Properties + +### block + +• `Optional` **block**: `Block` + +The `@ethereumjs/block` the `tx` belongs to. +If omitted, a default blank block will be used. + +#### Defined in + +[vm/src/types.ts:309](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L309) + +___ + +### blockGasUsed + +• `Optional` **blockGasUsed**: `bigint` + +To obtain an accurate tx receipt input the block gas used up until this tx. + +#### Defined in + +[vm/src/types.ts:350](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L350) + +___ + +### reportAccessList + +• `Optional` **reportAccessList**: `boolean` + +If true, adds a generated EIP-2930 access list +to the `RunTxResult` returned. + +Option works with all tx types. EIP-2929 needs to +be activated (included in `berlin` HF). + +Note: if this option is used with a custom StateManager implementation +StateManager.generateAccessList must be implemented. + +#### Defined in + +[vm/src/types.ts:345](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L345) + +___ + +### skipBalance + +• `Optional` **skipBalance**: `boolean` + +Skip balance checks if true. Adds transaction cost to balance to ensure execution doesn't fail. + +#### Defined in + +[vm/src/types.ts:321](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L321) + +___ + +### skipBlockGasLimitValidation + +• `Optional` **skipBlockGasLimitValidation**: `boolean` + +If true, skips the validation of the tx's gas limit +against the block's gas limit. + +#### Defined in + +[vm/src/types.ts:327](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L327) + +___ + +### skipHardForkValidation + +• `Optional` **skipHardForkValidation**: `boolean` + +If true, skips the hardfork validation of vm, block +and tx + +#### Defined in + +[vm/src/types.ts:333](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L333) + +___ + +### skipNonce + +• `Optional` **skipNonce**: `boolean` + +If true, skips the nonce check + +#### Defined in + +[vm/src/types.ts:317](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L317) + +___ + +### tx + +• **tx**: `TypedTransaction` + +An `@ethereumjs/tx` to run + +#### Defined in + +[vm/src/types.ts:313](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L313) diff --git a/packages/vm/docs/interfaces/RunTxResult.md b/packages/vm/docs/interfaces/RunTxResult.md new file mode 100644 index 0000000000..28822b2b07 --- /dev/null +++ b/packages/vm/docs/interfaces/RunTxResult.md @@ -0,0 +1,158 @@ +[@ethereumjs/vm](../README.md) / RunTxResult + +# Interface: RunTxResult + +Execution result of a transaction + +## Hierarchy + +- `EVMResult` + + ↳ **`RunTxResult`** + + ↳↳ [`AfterTxEvent`](AfterTxEvent.md) + +## Table of contents + +### Properties + +- [accessList](RunTxResult.md#accesslist) +- [amountSpent](RunTxResult.md#amountspent) +- [blobGasUsed](RunTxResult.md#blobgasused) +- [bloom](RunTxResult.md#bloom) +- [createdAddress](RunTxResult.md#createdaddress) +- [execResult](RunTxResult.md#execresult) +- [gasRefund](RunTxResult.md#gasrefund) +- [minerValue](RunTxResult.md#minervalue) +- [receipt](RunTxResult.md#receipt) +- [totalGasSpent](RunTxResult.md#totalgasspent) + +## Properties + +### accessList + +• `Optional` **accessList**: `AccessList` + +EIP-2930 access list generated for the tx (see `reportAccessList` option) + +#### Defined in + +[vm/src/types.ts:387](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L387) + +___ + +### amountSpent + +• **amountSpent**: `bigint` + +The amount of ether used by this transaction + +#### Defined in + +[vm/src/types.ts:365](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L365) + +___ + +### blobGasUsed + +• `Optional` **blobGasUsed**: `bigint` + +This is the blob gas units times the fee per blob gas for 4844 transactions + +#### Defined in + +[vm/src/types.ts:397](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L397) + +___ + +### bloom + +• **bloom**: `Bloom` + +Bloom filter resulted from transaction + +#### Defined in + +[vm/src/types.ts:360](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L360) + +___ + +### createdAddress + +• `Optional` **createdAddress**: `Address` + +Address of created account during transaction, if any + +#### Inherited from + +EVMResult.createdAddress + +#### Defined in + +evm/dist/cjs/types.d.ts:234 + +___ + +### execResult + +• **execResult**: `ExecResult` + +Contains the results from running the code, if any, as described in runCode + +#### Inherited from + +EVMResult.execResult + +#### Defined in + +evm/dist/cjs/types.d.ts:238 + +___ + +### gasRefund + +• **gasRefund**: `bigint` + +The amount of gas as that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) + +#### Defined in + +[vm/src/types.ts:382](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L382) + +___ + +### minerValue + +• **minerValue**: `bigint` + +The value that accrues to the miner by this transaction + +#### Defined in + +[vm/src/types.ts:392](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L392) + +___ + +### receipt + +• **receipt**: [`TxReceipt`](../README.md#txreceipt) + +The tx receipt + +#### Defined in + +[vm/src/types.ts:370](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L370) + +___ + +### totalGasSpent + +• **totalGasSpent**: `bigint` + +The amount of gas used in this transaction, which is paid for +This contains the gas units that have been used on execution, plus the upfront cost, +which consists of calldata cost, intrinsic cost and optionally the access list costs + +#### Defined in + +[vm/src/types.ts:377](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L377) diff --git a/packages/vm/docs/interfaces/SealBlockOpts.md b/packages/vm/docs/interfaces/SealBlockOpts.md new file mode 100644 index 0000000000..d2c3eb59fd --- /dev/null +++ b/packages/vm/docs/interfaces/SealBlockOpts.md @@ -0,0 +1,38 @@ +[@ethereumjs/vm](../README.md) / SealBlockOpts + +# Interface: SealBlockOpts + +Options for sealing a block. + +## Table of contents + +### Properties + +- [mixHash](SealBlockOpts.md#mixhash) +- [nonce](SealBlockOpts.md#nonce) + +## Properties + +### mixHash + +• `Optional` **mixHash**: `Uint8Array` + +For PoW, the mixHash. +Overrides the value passed in the constructor. + +#### Defined in + +[vm/src/types.ts:197](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L197) + +___ + +### nonce + +• `Optional` **nonce**: `Uint8Array` + +For PoW, the nonce. +Overrides the value passed in the constructor. + +#### Defined in + +[vm/src/types.ts:191](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L191) diff --git a/packages/vm/docs/interfaces/VMOpts.md b/packages/vm/docs/interfaces/VMOpts.md new file mode 100644 index 0000000000..a75f3e8ec4 --- /dev/null +++ b/packages/vm/docs/interfaces/VMOpts.md @@ -0,0 +1,136 @@ +[@ethereumjs/vm](../README.md) / VMOpts + +# Interface: VMOpts + +Options for instantiating a [VM](../classes/VM.md). + +## Table of contents + +### Properties + +- [activatePrecompiles](VMOpts.md#activateprecompiles) +- [blockchain](VMOpts.md#blockchain) +- [common](VMOpts.md#common) +- [evm](VMOpts.md#evm) +- [genesisState](VMOpts.md#genesisstate) +- [setHardfork](VMOpts.md#sethardfork) +- [stateManager](VMOpts.md#statemanager) + +## Properties + +### activatePrecompiles + +• `Optional` **activatePrecompiles**: `boolean` + +If true, create entries in the state tree for the precompiled contracts, saving some gas the +first time each of them is called. + +If this parameter is false, each call to each of them has to pay an extra 25000 gas +for creating the account. If the account is still empty after this call, it will be deleted, +such that this extra cost has to be paid again. + +Setting this to true has the effect of precompiled contracts' gas costs matching mainnet's from +the very first call, which is intended for testing networks. + +Default: `false` + +#### Defined in + +[vm/src/types.ts:121](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L121) + +___ + +### blockchain + +• `Optional` **blockchain**: `BlockchainInterface` + +A Blockchain object for storing/retrieving blocks + +#### Defined in + +[vm/src/types.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L107) + +___ + +### common + +• `Optional` **common**: `Common` + +Use a Common instance +if you want to change the chain setup. + +### Possible Values + +- `chain`: all chains supported by `Common` or a custom chain +- `hardfork`: `mainnet` hardforks up to the `Paris` hardfork +- `eips`: `1559` (usage e.g. `eips: [ 1559, ]`) + +Note: check the associated `@ethereumjs/evm` instance options +documentation for supported EIPs. + +### Default Setup + +Default setup if no `Common` instance is provided: + +- `chain`: `mainnet` +- `hardfork`: `paris` +- `eips`: `[]` + +#### Defined in + +[vm/src/types.ts:99](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L99) + +___ + +### evm + +• `Optional` **evm**: `EVMInterface` + +Use a custom EVM to run Messages on. If this is not present, use the default EVM. + +#### Defined in + +[vm/src/types.ts:142](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L142) + +___ + +### genesisState + +• `Optional` **genesisState**: `GenesisState` + +A genesisState to generate canonical genesis for the "in-house" created stateManager if external +stateManager not provided for the VM, defaults to an empty state + +#### Defined in + +[vm/src/types.ts:126](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L126) + +___ + +### setHardfork + +• `Optional` **setHardfork**: `boolean` \| `BigIntLike` + +Set the hardfork either by timestamp (for HFs from Shanghai onwards) or by block number +for older Hfs. + +Additionally it is possible to pass in a specific TD value to support live-Merge-HF +transitions. Note that this should only be needed in very rare and specific scenarios. + +Default: `false` (HF is set to whatever default HF is set by the Common instance) + +#### Defined in + +[vm/src/types.ts:137](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L137) + +___ + +### stateManager + +• `Optional` **stateManager**: `EVMStateManagerInterface` + +A StateManager instance to use as the state store + +#### Defined in + +[vm/src/types.ts:103](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/src/types.ts#L103) diff --git a/packages/vm/package.json b/packages/vm/package.json index e7159665de..0460f8010a 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/vm", - "version": "7.0.0-rc.1", + "version": "7.0.0", "description": "An Ethereum VM implementation", "keywords": [ "ethereum", @@ -62,15 +62,15 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "5.0.0-rc.1", - "@ethereumjs/blockchain": "7.0.0-rc.1", - "@ethereumjs/common": "4.0.0-rc.1", - "@ethereumjs/evm": "2.0.0-rc.2", - "@ethereumjs/rlp": "5.0.0-rc.1", - "@ethereumjs/statemanager": "2.0.0-rc.1", - "@ethereumjs/trie": "6.0.0-rc.1", - "@ethereumjs/tx": "5.0.0-rc.1", - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/block": "^5.0.0", + "@ethereumjs/blockchain": "^7.0.0", + "@ethereumjs/common": "^4.0.0", + "@ethereumjs/evm": "^2.0.0", + "@ethereumjs/rlp": "^5.0.0", + "@ethereumjs/statemanager": "^2.0.0", + "@ethereumjs/trie": "^6.0.0", + "@ethereumjs/tx": "^5.0.0", + "@ethereumjs/util": "^9.0.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.1.2" }, diff --git a/packages/wallet/CHANGELOG.md b/packages/wallet/CHANGELOG.md index f35e767915..86a42df486 100644 --- a/packages/wallet/CHANGELOG.md +++ b/packages/wallet/CHANGELOG.md @@ -6,6 +6,12 @@ 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 - 2023-08-09 + +Final release version from the breaking release round from Summer 2023 on the EthereumJS libraries, thanks to the whole team for this amazing accomplishment! ❤️ 🥳 + +See [RC1 release notes](https://github.com/ethereumjs/ethereumjs-monorepo/releases/tag/%40ethereumjs%2Fwallet%402.0.0-rc.1) for the main change description. + ## 2.0.0-rc.1 - 2023-07-18 ### New Package Name and General Library Update diff --git a/packages/wallet/README.md b/packages/wallet/README.md index 4324544050..5a08384247 100644 --- a/packages/wallet/README.md +++ b/packages/wallet/README.md @@ -5,8 +5,6 @@ [![Coverage Status][coverage-badge]][coverage-link] [![Discord][discord-badge]][discord-link] -Note: this README has been updated containing the changes from our next breaking release round [UNRELEASED] targeted for Summer 2023. See the README files from the [maintenance-v6](https://github.com/ethereumjs/ethereumjs-monorepo/tree/maintenance-v6/) branch for documentation matching our latest releases. - A lightweight wallet implementation. At the moment it supports key creation and conversion between various formats. It is complemented by the following packages: diff --git a/packages/wallet/docs/README.md b/packages/wallet/docs/README.md index 79a4ba48e7..3a6171194f 100644 --- a/packages/wallet/docs/README.md +++ b/packages/wallet/docs/README.md @@ -4,29 +4,11 @@ ## Table of contents -### Classes - -- [Wallet](classes/Wallet.md) -- [hdkey](classes/hdkey.md) - -### Variables - -- [thirdparty](README.md#thirdparty) - -## Variables +### Namespaces -### thirdparty +- [hdkey](modules/hdkey.md) +- [thirdparty](modules/thirdparty.md) -• `Const` **thirdparty**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `fromEtherCamp` | (`passphrase`: `string`) => [`Wallet`](classes/Wallet.md) | -| `fromEtherWallet` | (`input`: `string` \| `EtherWalletOptions`, `password`: `string`) => `Promise`<[`Wallet`](classes/Wallet.md)\> | -| `fromQuorumWallet` | (`passphrase`: `string`, `userid`: `string`) => [`Wallet`](classes/Wallet.md) | - -#### Defined in +### Classes -[thirdparty.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L187) +- [Wallet](classes/Wallet.md) diff --git a/packages/wallet/docs/classes/Wallet.md b/packages/wallet/docs/classes/Wallet.md index 71b687dcb5..3f06b5dae9 100644 --- a/packages/wallet/docs/classes/Wallet.md +++ b/packages/wallet/docs/classes/Wallet.md @@ -41,28 +41,28 @@ | Name | Type | Default value | | :------ | :------ | :------ | -| `privateKey?` | `Buffer` | `undefined` | -| `publicKey` | `undefined` \| `Buffer` | `undefined` | +| `privateKey?` | `Uint8Array` | `undefined` | +| `publicKey` | `undefined` \| `Uint8Array` | `undefined` | #### Defined in -[index.ts:272](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L272) +[wallet.ts:266](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L266) ## Methods ### getAddress -▸ **getAddress**(): `Buffer` +▸ **getAddress**(): `Uint8Array` Returns the wallet's address. #### Returns -`Buffer` +`Uint8Array` #### Defined in -[index.ts:556](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L556) +[wallet.ts:548](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L548) ___ @@ -78,7 +78,7 @@ Returns the wallet's address as a "0x" prefixed hex string #### Defined in -[index.ts:563](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L563) +[wallet.ts:555](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L555) ___ @@ -95,23 +95,23 @@ according to [EIP 55](https://github.com/ethereum/EIPs/issues/55). #### Defined in -[index.ts:571](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L571) +[wallet.ts:563](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L563) ___ ### getPrivateKey -▸ **getPrivateKey**(): `Buffer` +▸ **getPrivateKey**(): `Uint8Array` Returns the wallet's private key. #### Returns -`Buffer` +`Uint8Array` #### Defined in -[index.ts:530](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L530) +[wallet.ts:523](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L523) ___ @@ -125,23 +125,23 @@ ___ #### Defined in -[index.ts:534](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L534) +[wallet.ts:527](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L527) ___ ### getPublicKey -▸ **getPublicKey**(): `Buffer` +▸ **getPublicKey**(): `Uint8Array` Returns the wallet's public key. #### Returns -`Buffer` +`Uint8Array` #### Defined in -[index.ts:542](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L542) +[wallet.ts:534](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L534) ___ @@ -157,7 +157,7 @@ Returns the wallet's public key as a "0x" prefixed hex string #### Defined in -[index.ts:549](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L549) +[wallet.ts:541](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L541) ___ @@ -179,7 +179,7 @@ Return the suggested filename for V3 keystores. #### Defined in -[index.ts:643](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L643) +[wallet.ts:633](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L633) ___ @@ -202,7 +202,7 @@ Returns an Etherem Version 3 Keystore Format object representing the wallet #### Defined in -[index.ts:581](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L581) +[wallet.ts:573](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L573) ___ @@ -223,7 +223,7 @@ ___ #### Defined in -[index.ts:661](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L661) +[wallet.ts:654](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L654) ___ @@ -237,7 +237,7 @@ Verify the publicKey, privateKey pair | Name | Type | Description | | :------ | :------ | :------ | -| `publicKey` | `Buffer` | the public key to verify against the private key of the wallet | +| `publicKey` | `Uint8Array` | the public key to verify against the private key of the wallet | #### Returns @@ -245,7 +245,7 @@ Verify the publicKey, privateKey pair #### Defined in -[index.ts:670](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L670) +[wallet.ts:663](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L663) ___ @@ -266,7 +266,7 @@ ___ #### Defined in -[index.ts:471](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L471) +[wallet.ts:465](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L465) ___ @@ -288,7 +288,7 @@ Create an instance based on a BIP32 extended private key (xprv) #### Defined in -[index.ts:363](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L363) +[wallet.ts:357](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L357) ___ @@ -310,7 +310,7 @@ Create an instance based on a BIP32 extended public key (xpub) #### Defined in -[index.ts:344](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L344) +[wallet.ts:338](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L338) ___ @@ -324,7 +324,7 @@ Create an instance based on a raw private key | Name | Type | | :------ | :------ | -| `privateKey` | `Buffer` | +| `privateKey` | `Uint8Array` | #### Returns @@ -332,7 +332,7 @@ Create an instance based on a raw private key #### Defined in -[index.ts:356](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L356) +[wallet.ts:350](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L350) ___ @@ -349,7 +349,7 @@ the `nonStrict` flag is set to true. | Name | Type | Default value | | :------ | :------ | :------ | -| `publicKey` | `Buffer` | `undefined` | +| `publicKey` | `Uint8Array` | `undefined` | | `nonStrict` | `boolean` | `false` | #### Returns @@ -358,7 +358,7 @@ the `nonStrict` flag is set to true. #### Defined in -[index.ts:334](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L334) +[wallet.ts:328](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L328) ___ @@ -381,7 +381,7 @@ Import a wallet (Version 1 of the Ethereum wallet format). #### Defined in -[index.ts:380](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L380) +[wallet.ts:374](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L374) ___ @@ -405,7 +405,7 @@ Import a wallet (Version 3 of the Ethereum wallet format). Set `nonStrict` true #### Defined in -[index.ts:413](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L413) +[wallet.ts:407](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L407) ___ @@ -427,7 +427,7 @@ Create an instance based on a new random key. #### Defined in -[index.ts:296](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L296) +[wallet.ts:290](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L290) ___ @@ -449,4 +449,4 @@ Create an instance where the address is valid against the supplied pattern (**th #### Defined in -[index.ts:314](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/index.ts#L314) +[wallet.ts:308](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/wallet.ts#L308) diff --git a/packages/wallet/docs/classes/hdkey.EthereumHDKey.md b/packages/wallet/docs/classes/hdkey.EthereumHDKey.md new file mode 100644 index 0000000000..2d60198d12 --- /dev/null +++ b/packages/wallet/docs/classes/hdkey.EthereumHDKey.md @@ -0,0 +1,176 @@ +[@ethereumjs/wallet](../README.md) / [hdkey](../modules/hdkey.md) / EthereumHDKey + +# Class: EthereumHDKey + +[hdkey](../modules/hdkey.md).EthereumHDKey + +## Table of contents + +### Constructors + +- [constructor](hdkey.EthereumHDKey.md#constructor) + +### Methods + +- [deriveChild](hdkey.EthereumHDKey.md#derivechild) +- [derivePath](hdkey.EthereumHDKey.md#derivepath) +- [getWallet](hdkey.EthereumHDKey.md#getwallet) +- [privateExtendedKey](hdkey.EthereumHDKey.md#privateextendedkey) +- [publicExtendedKey](hdkey.EthereumHDKey.md#publicextendedkey) +- [fromExtendedKey](hdkey.EthereumHDKey.md#fromextendedkey) +- [fromMasterSeed](hdkey.EthereumHDKey.md#frommasterseed) + +## Constructors + +### constructor + +• **new EthereumHDKey**(`_hdkey`) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `_hdkey` | `HDKey` | + +#### Defined in + +[hdkey.ts:23](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L23) + +## Methods + +### deriveChild + +▸ **deriveChild**(`index`): [`EthereumHDKey`](hdkey.EthereumHDKey.md) + +Derive a node based on a child index + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `index` | `number` | + +#### Returns + +[`EthereumHDKey`](hdkey.EthereumHDKey.md) + +#### Defined in + +[hdkey.ts:52](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L52) + +___ + +### derivePath + +▸ **derivePath**(`path`): [`EthereumHDKey`](hdkey.EthereumHDKey.md) + +Derives a node based on a path (e.g. m/44'/0'/0/1) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `path` | `string` | + +#### Returns + +[`EthereumHDKey`](hdkey.EthereumHDKey.md) + +#### Defined in + +[hdkey.ts:45](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L45) + +___ + +### getWallet + +▸ **getWallet**(): [`Wallet`](Wallet.md) + +Return a `Wallet` instance as seen above + +#### Returns + +[`Wallet`](Wallet.md) + +#### Defined in + +[hdkey.ts:59](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L59) + +___ + +### privateExtendedKey + +▸ **privateExtendedKey**(): `string` + +Returns a BIP32 extended private key (xprv) + +#### Returns + +`string` + +#### Defined in + +[hdkey.ts:28](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L28) + +___ + +### publicExtendedKey + +▸ **publicExtendedKey**(): `string` + +Return a BIP32 extended public key (xpub) + +#### Returns + +`string` + +#### Defined in + +[hdkey.ts:38](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L38) + +___ + +### fromExtendedKey + +▸ `Static` **fromExtendedKey**(`base58Key`): [`EthereumHDKey`](hdkey.EthereumHDKey.md) + +Create an instance based on a BIP32 extended private or public key. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `base58Key` | `string` | + +#### Returns + +[`EthereumHDKey`](hdkey.EthereumHDKey.md) + +#### Defined in + +[hdkey.ts:19](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L19) + +___ + +### fromMasterSeed + +▸ `Static` **fromMasterSeed**(`seedBuffer`): [`EthereumHDKey`](hdkey.EthereumHDKey.md) + +Creates an instance based on a seed. + +For the seed we suggest to use [bip39](https://npmjs.org/package/bip39) to +create one from a BIP39 mnemonic. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `seedBuffer` | `Uint8Array` | + +#### Returns + +[`EthereumHDKey`](hdkey.EthereumHDKey.md) + +#### Defined in + +[hdkey.ts:12](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L12) diff --git a/packages/wallet/docs/classes/hdkey.md b/packages/wallet/docs/classes/hdkey.md deleted file mode 100644 index 397b8802cd..0000000000 --- a/packages/wallet/docs/classes/hdkey.md +++ /dev/null @@ -1,174 +0,0 @@ -[@ethereumjs/wallet](../README.md) / hdkey - -# Class: hdkey - -## Table of contents - -### Constructors - -- [constructor](hdkey.md#constructor) - -### Methods - -- [deriveChild](hdkey.md#derivechild) -- [derivePath](hdkey.md#derivepath) -- [getWallet](hdkey.md#getwallet) -- [privateExtendedKey](hdkey.md#privateextendedkey) -- [publicExtendedKey](hdkey.md#publicextendedkey) -- [fromExtendedKey](hdkey.md#fromextendedkey) -- [fromMasterSeed](hdkey.md#frommasterseed) - -## Constructors - -### constructor - -• **new hdkey**(`_hdkey`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `_hdkey` | `HDKey` | - -#### Defined in - -[hdkey.ts:24](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L24) - -## Methods - -### deriveChild - -▸ **deriveChild**(`index`): [`hdkey`](hdkey.md) - -Derive a node based on a child index - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `index` | `number` | - -#### Returns - -[`hdkey`](hdkey.md) - -#### Defined in - -[hdkey.ts:53](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L53) - -___ - -### derivePath - -▸ **derivePath**(`path`): [`hdkey`](hdkey.md) - -Derives a node based on a path (e.g. m/44'/0'/0/1) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `path` | `string` | - -#### Returns - -[`hdkey`](hdkey.md) - -#### Defined in - -[hdkey.ts:46](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L46) - -___ - -### getWallet - -▸ **getWallet**(): [`Wallet`](Wallet.md) - -Return a `Wallet` instance as seen above - -#### Returns - -[`Wallet`](Wallet.md) - -#### Defined in - -[hdkey.ts:60](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L60) - -___ - -### privateExtendedKey - -▸ **privateExtendedKey**(): `string` - -Returns a BIP32 extended private key (xprv) - -#### Returns - -`string` - -#### Defined in - -[hdkey.ts:29](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L29) - -___ - -### publicExtendedKey - -▸ **publicExtendedKey**(): `string` - -Return a BIP32 extended public key (xpub) - -#### Returns - -`string` - -#### Defined in - -[hdkey.ts:39](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L39) - -___ - -### fromExtendedKey - -▸ `Static` **fromExtendedKey**(`base58Key`): [`hdkey`](hdkey.md) - -Create an instance based on a BIP32 extended private or public key. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `base58Key` | `string` | - -#### Returns - -[`hdkey`](hdkey.md) - -#### Defined in - -[hdkey.ts:20](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L20) - -___ - -### fromMasterSeed - -▸ `Static` **fromMasterSeed**(`seedBuffer`): [`hdkey`](hdkey.md) - -Creates an instance based on a seed. - -For the seed we suggest to use [bip39](https://npmjs.org/package/bip39) to -create one from a BIP39 mnemonic. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `seedBuffer` | `Buffer` | - -#### Returns - -[`hdkey`](hdkey.md) - -#### Defined in - -[hdkey.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/hdkey.ts#L13) diff --git a/packages/wallet/docs/interfaces/thirdparty.EtherWalletOptions.md b/packages/wallet/docs/interfaces/thirdparty.EtherWalletOptions.md new file mode 100644 index 0000000000..faa38fb9fb --- /dev/null +++ b/packages/wallet/docs/interfaces/thirdparty.EtherWalletOptions.md @@ -0,0 +1,76 @@ +[@ethereumjs/wallet](../README.md) / [thirdparty](../modules/thirdparty.md) / EtherWalletOptions + +# Interface: EtherWalletOptions + +[thirdparty](../modules/thirdparty.md).EtherWalletOptions + +## Table of contents + +### Properties + +- [address](thirdparty.EtherWalletOptions.md#address) +- [encrypted](thirdparty.EtherWalletOptions.md#encrypted) +- [hash](thirdparty.EtherWalletOptions.md#hash) +- [locked](thirdparty.EtherWalletOptions.md#locked) +- [private](thirdparty.EtherWalletOptions.md#private) +- [public](thirdparty.EtherWalletOptions.md#public) + +## Properties + +### address + +• **address**: `string` + +#### Defined in + +[thirdparty.ts:105](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L105) + +___ + +### encrypted + +• **encrypted**: `boolean` + +#### Defined in + +[thirdparty.ts:106](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L106) + +___ + +### hash + +• **hash**: `string` + +#### Defined in + +[thirdparty.ts:108](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L108) + +___ + +### locked + +• **locked**: `boolean` + +#### Defined in + +[thirdparty.ts:107](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L107) + +___ + +### private + +• **private**: `string` + +#### Defined in + +[thirdparty.ts:109](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L109) + +___ + +### public + +• **public**: `string` + +#### Defined in + +[thirdparty.ts:110](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L110) diff --git a/packages/wallet/docs/interfaces/thirdparty.EvpKdfOpts.md b/packages/wallet/docs/interfaces/thirdparty.EvpKdfOpts.md new file mode 100644 index 0000000000..158acb2f42 --- /dev/null +++ b/packages/wallet/docs/interfaces/thirdparty.EvpKdfOpts.md @@ -0,0 +1,54 @@ +[@ethereumjs/wallet](../README.md) / [thirdparty](../modules/thirdparty.md) / EvpKdfOpts + +# Interface: EvpKdfOpts + +[thirdparty](../modules/thirdparty.md).EvpKdfOpts + +## Table of contents + +### Properties + +- [count](thirdparty.EvpKdfOpts.md#count) +- [digest](thirdparty.EvpKdfOpts.md#digest) +- [ivsize](thirdparty.EvpKdfOpts.md#ivsize) +- [keysize](thirdparty.EvpKdfOpts.md#keysize) + +## Properties + +### count + +• **count**: `number` + +#### Defined in + +[thirdparty.ts:13](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L13) + +___ + +### digest + +• **digest**: `string` + +#### Defined in + +[thirdparty.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L16) + +___ + +### ivsize + +• **ivsize**: `number` + +#### Defined in + +[thirdparty.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L15) + +___ + +### keysize + +• **keysize**: `number` + +#### Defined in + +[thirdparty.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L14) diff --git a/packages/wallet/docs/modules/hdkey.md b/packages/wallet/docs/modules/hdkey.md new file mode 100644 index 0000000000..1499d5c90c --- /dev/null +++ b/packages/wallet/docs/modules/hdkey.md @@ -0,0 +1,9 @@ +[@ethereumjs/wallet](../README.md) / hdkey + +# Namespace: hdkey + +## Table of contents + +### Classes + +- [EthereumHDKey](../classes/hdkey.EthereumHDKey.md) diff --git a/packages/wallet/docs/modules/thirdparty.md b/packages/wallet/docs/modules/thirdparty.md new file mode 100644 index 0000000000..fba3497760 --- /dev/null +++ b/packages/wallet/docs/modules/thirdparty.md @@ -0,0 +1,104 @@ +[@ethereumjs/wallet](../README.md) / thirdparty + +# Namespace: thirdparty + +## Table of contents + +### Interfaces + +- [EtherWalletOptions](../interfaces/thirdparty.EtherWalletOptions.md) +- [EvpKdfOpts](../interfaces/thirdparty.EvpKdfOpts.md) + +### Variables + +- [Thirdparty](thirdparty.md#thirdparty) + +### Functions + +- [fromEtherCamp](thirdparty.md#fromethercamp) +- [fromEtherWallet](thirdparty.md#frometherwallet) +- [fromQuorumWallet](thirdparty.md#fromquorumwallet) + +## Variables + +### Thirdparty + +• `Const` **Thirdparty**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `fromEtherCamp` | (`passphrase`: `string`) => [`Wallet`](../classes/Wallet.md) | +| `fromEtherWallet` | (`input`: `string` \| [`EtherWalletOptions`](../interfaces/thirdparty.EtherWalletOptions.md), `password`: `string`) => `Promise`<[`Wallet`](../classes/Wallet.md)\> | +| `fromQuorumWallet` | (`passphrase`: `string`, `userid`: `string`) => [`Wallet`](../classes/Wallet.md) | + +#### Defined in + +[thirdparty.ts:187](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L187) + +## Functions + +### fromEtherCamp + +▸ **fromEtherCamp**(`passphrase`): [`Wallet`](../classes/Wallet.md) + +Third Party API: Import a brain wallet used by Ether.Camp + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `passphrase` | `string` | + +#### Returns + +[`Wallet`](../classes/Wallet.md) + +#### Defined in + +[thirdparty.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L167) + +___ + +### fromEtherWallet + +▸ **fromEtherWallet**(`input`, `password`): `Promise`<[`Wallet`](../classes/Wallet.md)\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `input` | `string` \| [`EtherWalletOptions`](../interfaces/thirdparty.EtherWalletOptions.md) | +| `password` | `string` | + +#### Returns + +`Promise`<[`Wallet`](../classes/Wallet.md)\> + +#### Defined in + +[thirdparty.ts:118](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L118) + +___ + +### fromQuorumWallet + +▸ **fromQuorumWallet**(`passphrase`, `userid`): [`Wallet`](../classes/Wallet.md) + +Third Party API: Import a brain wallet used by Quorum Wallet + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `passphrase` | `string` | +| `userid` | `string` | + +#### Returns + +[`Wallet`](../classes/Wallet.md) + +#### Defined in + +[thirdparty.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/wallet/src/thirdparty.ts#L174) diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 77754fefc8..ed03ed2784 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/wallet", - "version": "2.0.0-rc.1", + "version": "2.0.0", "description": "Utilities for handling Ethereum keys", "keywords": [ "ethereum", @@ -46,7 +46,7 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/util": "9.0.0-rc.1", + "@ethereumjs/util": "^9.0.0", "@scure/base": "^1.1.1", "ethereum-cryptography": "^2.1.2", "js-md5": "^0.7.3",