Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 3.x with 1.x #4197

Merged
merged 13 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ on:
tags:
- v1*
- v3*
paths-ignore:
- "docs/**"
- "assets/**"
- "**.md"
pull_request:
branches:
- "1.x"
- "3.x"
types: [opened, reopened, synchronize]
paths-ignore:
- "docs/**"
- "assets/**"
- "**.md"
jobs:
lint:
runs-on: ubuntu-latest
Expand Down
50 changes: 47 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@ Released with 1.0.0-beta.37 code base.
- Deprecation of bzz warning (#3872)
- Deprecation of shh warning (#3888)

## [Unreleased]

## [1.3.5]

### Added
Expand All @@ -359,6 +357,7 @@ Released with 1.0.0-beta.37 code base.
- Added description to documentation on how to connect using a remote node provider (#3884)
- Added Security risk warning to docs for `web3.utils.soliditySha3` (#3908)
- `.nvmrc` file using Node.js version `v.14.15.1` (#3817)
- Add commitment to semantic versioning since version `1.3.0` and onwards (#3961)

### Changed

Expand All @@ -372,8 +371,53 @@ Released with 1.0.0-beta.37 code base.
- Bump `elliptic` from `6.5.3` to `6.5.4` for `web3-core-requestmanager` (#3945)
- Rewrite `web3-eth-iban` in ES6 (#3955)

## [1.3.6]

### Changes

- Bump `underscore` package from `1.9.1` to `1.12.1` (#4051)
- Bump `@ensdomains/ens` package from `^0.4.5` to `^0.6.0` (#4059)
- Bump `ethers` package from `^5.0.18` to `^5.1.4` (#4059)

### Removes

- Accidental commit (yarn-error.log) (#4062)

## [1.4.0]

### Added

- Berlin Transaction Support (#4083)
- When signing a transaction, common object now defaults to berlin instead of petersburg

### Changed

- Changed Geth Docker verision from `stable` to `1.10.3` in `e2e.geth.instamine.sh` and `scripts/e2e.geth.automine.sh` (#4154)

## [1.4.1]

### Removes

- Removing the underscore package

## [Unreleased]

## [1.5.0]

### Added

- London transaction support (#4155)
- RPC support `eth_feehistory` call (#4191)
- Add `toNumber` method to `web3.utils` (#4191)

### Changed
- Grammar fix (#4088) and updated Swarm (#4151)and Whisper doc links (#4170)
- Removed deprecation notice for HttpProvider (#4008)
- Nonce added to send options in documentation and types (#4052)
- Updated Solidity example to modern syntax (#4147)
- Changing web3 connection example from lets to const (#3967)
- Updated the documentation for the transaction object to include EIP-2718 and EIP-1559 options (#4188)

## [3.0.0]

### Changed
Expand All @@ -383,4 +427,4 @@ Released with 1.0.0-beta.37 code base.

### Removed

- Removed bzz and shh api (#3909)
- Removed bzz and shh api (#3909)
29 changes: 16 additions & 13 deletions dist/web3.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/web3.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/callbacks-promises-events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To help web3 integrate into all kinds of projects with different standards we pr
Most web3.js objects allow a callback as the last parameter, as well as returning promises to chain functions.

Ethereum as a blockchain has different levels of finality and therefore needs to return multiple "stages" of an action.
To cope with requirement we return a "promiEvent" for functions like ``web3.eth.sendTransaction`` or contract methods.
To cope with this requirement we return a "promiEvent" for functions like ``web3.eth.sendTransaction`` or contract methods.
This "promiEvent" is a promise combined with an event emitter to allow acting on different stages of action on the blockchain, like a transaction.

PromiEvents work like a normal promises with added ``on``, ``once`` and ``off`` functions.
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ If this property is ``null`` you should connect to a remote/local node.

// In Node.js use: const Web3 = require('web3');

let web3 = new Web3(Web3.givenProvider || "ws://localhost:8545");
const web3 = new Web3(Web3.givenProvider || "ws://localhost:8545");

That's it! now you can use the ``web3`` object.
60 changes: 32 additions & 28 deletions docs/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,47 +51,51 @@ Example

.. code-block:: javascript

pragma solidity ^0.8.4;
contract Test {
uint a;
address d = 0x12345678901234567890123456789012;
address d = 0xdCad3a6d3569DF655070DEd06cb7A1b2Ccd1D3AF;

function Test(uint testInt) { a = testInt;}
constructor(uint testInt) { a = testInt;}

event Event(uint indexed b, bytes32 c);

event Event2(uint indexed b, bytes32 c);

function foo(uint b, bytes32 c) returns(address) {
Event(b, c);
function foo(uint b, bytes32 c) public returns(address) {
emit Event(b, c);
return d;
}
}


// would result in the JSON:
[{
"type":"constructor",
"payable":false,
"stateMutability":"nonpayable"
"inputs":[{"name":"testInt","type":"uint256"}],
},{
"type":"function",
"name":"foo",
"constant":false,
"payable":false,
"stateMutability":"nonpayable",
"inputs":[{"name":"b","type":"uint256"}, {"name":"c","type":"bytes32"}],
"outputs":[{"name":"","type":"address"}]
},{
"type":"event",
"name":"Event",
"inputs":[{"indexed":true,"name":"b","type":"uint256"}, {"indexed":false,"name":"c","type":"bytes32"}],
"anonymous":false
},{
"type":"event",
"name":"Event2",
"inputs":[{"indexed":true,"name":"b","type":"uint256"},{"indexed":false,"name":"c","type":"bytes32"}],
"anonymous":false
}]
[
{
"type": "constructor"
"stateMutability": "nonpayable",
"inputs": [{"internalType":"uint256","name":"testInt","type":"uint256"}],
},
{
"type": "event"
"name": "Event",
"inputs": [{"indexed":true,"internalType":"uint256","name":"b","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"c","type":"bytes32"}],
"anonymous": false,
},
{
"type": "event"
"name": "Event2",
"inputs": [{"indexed":true,"internalType":"uint256","name":"b","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"c","type":"bytes32"}],
"anonymous": false,
},
{
"type": "function"
"name": "foo",
"stateMutability": "nonpayable",
"inputs": [{"internalType":"uint256","name":"b","type":"uint256"},{"internalType":"bytes32","name":"c","type":"bytes32"}],
"outputs": [{"internalType":"address","name":"","type":"address"}],
}
]


------------------------------------------------------------------------------
2 changes: 1 addition & 1 deletion docs/include_package-core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Value

``Object`` with the following providers:

- ``Object`` - ``HttpProvider``: The HTTP provider is **deprecated**, as it won't work for subscriptions.
- ``Object`` - ``HttpProvider``: HTTP provider, does not support subscriptions.
- ``Object`` - ``WebsocketProvider``: The Websocket provider is the standard for usage in legacy browsers.
- ``Object`` - ``IpcProvider``: The IPC provider is used node.js dapps when running a local node. Gives the most secure connection.

Expand Down
4 changes: 2 additions & 2 deletions docs/web3-eth-accounts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ Parameters
- ``gasPrice`` - ``String``: (optional) The gas price set by this transaction, if empty, it will use :ref:`web3.eth.getGasPrice() <eth-gasprice>`
- ``gas`` - ``String``: The gas provided by the transaction.
- ``chain`` - ``String``: (optional) Defaults to ``mainnet``.
- ``hardfork`` - ``String``: (optional) Defaults to ``petersburg``.
- ``hardfork`` - ``String``: (optional) Defaults to ``berlin``.
- ``common`` - ``Object``: (optional) The common object
- ``customChain`` - ``Object``: The custom chain properties
- ``name`` - ``string``: (optional) The name of the chain
- ``networkId`` - ``number``: Network ID of the custom chain
- ``chainId`` - ``number``: Chain ID of the custom chain
- ``baseChain`` - ``string``: (optional) ``mainnet``, ``goerli``, ``kovan``, ``rinkeby``, or ``ropsten``
- ``hardfork`` - ``string``: (optional) ``chainstart``, ``homestead``, ``dao``, ``tangerineWhistle``, ``spuriousDragon``, ``byzantium``, ``constantinople``, ``petersburg``, or ``istanbul``
- ``hardfork`` - ``string``: (optional) ``chainstart``, ``homestead``, ``dao``, ``tangerineWhistle``, ``spuriousDragon``, ``byzantium``, ``constantinople``, ``petersburg``, ``istanbul``, or ``berlin``
2. ``privateKey`` - ``String``: The private key to sign with.
3. ``callback`` - ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second.

Expand Down
2 changes: 2 additions & 0 deletions docs/web3-eth-contract.rst
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,8 @@ Parameters
* ``gasPrice`` - ``String`` (optional): The gas price in wei to use for this transaction.
* ``gas`` - ``Number`` (optional): The maximum gas provided for this transaction (gas limit).
* ``value`` - ``Number|String|BN|BigNumber``(optional): The value transferred for the transaction in wei.
* ``nonce`` - ``Number`` (optional): the nonce number of transaction

2. ``callback`` - ``Function`` (optional): This callback will be fired first with the "transactionHash", or with an error object as the first argument.

-------
Expand Down
55 changes: 49 additions & 6 deletions docs/web3-eth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ The default hardfork property can be one of the following:
- ``"constantinople"`` - ``String``
- ``"petersburg"`` - ``String``
- ``"istanbul"`` - ``String``
- ``"berlin"`` - ``String``
- ``"london"`` - ``String``

Default is ``"petersburg"``
Default is ``"london"``


-------
Expand All @@ -247,7 +249,7 @@ Example
.. code-block:: javascript

web3.eth.defaultHardfork;
> "petersburg"
> "london"

// set the default block
web3.eth.defaultHardfork = 'istanbul';
Expand Down Expand Up @@ -318,7 +320,7 @@ The default common property does contain the following ``Common`` object:
- ``networkId`` - ``number``: Network ID of the custom chain
- ``chainId`` - ``number``: Chain ID of the custom chain
- ``baseChain`` - ``string``: (optional) ``mainnet``, ``goerli``, ``kovan``, ``rinkeby``, or ``ropsten``
- ``hardfork`` - ``string``: (optional) ``chainstart``, ``homestead``, ``dao``, ``tangerineWhistle``, ``spuriousDragon``, ``byzantium``, ``constantinople``, ``petersburg``, or ``istanbul``
- ``hardfork`` - ``string``: (optional) ``chainstart``, ``homestead``, ``dao``, ``tangerineWhistle``, ``spuriousDragon``, ``byzantium``, ``constantinople``, ``petersburg``, ``istanbul``, ``berlin``, or ``london``


Default is ``undefined``.
Expand Down Expand Up @@ -714,6 +716,43 @@ Example

------------------------------------------------------------------------------

.. _eth-feehistory:


getFeeHistory
=====================

.. code-block:: javascript

web3.eth.getFeeHistory(blockCount, newestBlock, rewardPercentiles, [callback])

Transaction fee history
Returns base fee per gas and transaction effective priority fee per gas history for the requested block range if available.
The range between headBlock-4 and headBlock is guaranteed to be available while retrieving data from the pending block and older
history are optional to support. For pre-EIP-1559 blocks the gas prices are returned as rewards and zeroes are returned for the base fee per gas.

----------
Parameters
----------

1. ``String|Number|BN|BigNumber`` - Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available.
2. ``String|Number|BN|BigNumber`` - Highest number block of the requested range.
3. ``Array of numbers`` - A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used. Example: `["0", "25", "50", "75", "100"]` or `["0", "0.5", "1", "1.5", "3", "80"]`
4. ``Function`` - (optional) Optional callback, returns an error object as first parameter and the result as second.

-------
Returns
-------

``Promise`` returns ``Object`` - Fee history for the returned block range. The object:

- ``Number`` oldestBlock - Lowest number block of the returned range.
- ``Array of strings`` baseFeePerGas - An array of block base fees per gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-1559 blocks.
- ``Array of numbers`` gasUsedRatio - An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit.
- ``Array of string arrays`` reward - An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty.

------------------------------------------------------------------------------


getAccounts
=====================
Expand Down Expand Up @@ -1419,17 +1458,21 @@ Parameters
- ``value`` - ``Number|String|BN|BigNumber``: (optional) The value transferred for the transaction in :ref:`wei <what-is-wei>`, also the endowment if it's a contract-creation transaction.
- ``gas`` - ``Number``: (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded).
- ``gasPrice`` - ``Number|String|BN|BigNumber``: (optional) The price of gas for this transaction in :ref:`wei <what-is-wei>`, defaults to :ref:`web3.eth.gasPrice <eth-gasprice>`.
- ``type`` - ``Number|String|BN|BigNumber``: (optional) A positive unsigned 8-bit number between 0 and 0x7f that represents the type of the transaction.
- ``maxFeePerGas`` - ``Number|String|BN``: (optional, defaulted to ``(2 * block.baseFeePerGas) + maxPriorityFeePerGas``) The maximum fee per gas that the transaction is willing to pay in total
- ``maxPriorityFeePerGas`` - ``Number|String|BN`` (optional, defaulted to ``1 Gwei``) The maximum fee per gas to give miners to incentivize them to include the transaction (Priority fee)
- ``accessList`` - ``List of hexstrings`` (optional) a list of addresses and storage keys that the transaction plans to access
- ``data`` - ``String``: (optional) Either a `ABI byte string <http://solidity.readthedocs.io/en/latest/abi-spec.html>`_ containing the data of the function call on a contract, or in the case of a contract-creation transaction the initialisation code.
- ``nonce`` - ``Number``: (optional) Integer of the nonce. This allows to overwrite your own pending transactions that use the same nonce.
- ``chain`` - ``String``: (optional) Defaults to ``mainnet``.
- ``hardfork`` - ``String``: (optional) Defaults to ``petersburg``.
- ``hardfork`` - ``String``: (optional) Defaults to ``london``.
- ``common`` - ``Object``: (optional) The common object
- ``customChain`` - ``Object``: The custom chain properties
- ``name`` - ``string``: (optional) The name of the chain
- ``networkId`` - ``number``: Network ID of the custom chain
- ``chainId`` - ``number``: Chain ID of the custom chain
- ``baseChain`` - ``string``: (optional) ``mainnet``, ``goerli``, ``kovan``, ``rinkeby``, or ``ropsten``
- ``hardfork`` - ``string``: (optional) ``chainstart``, ``homestead``, ``dao``, ``tangerineWhistle``, ``spuriousDragon``, ``byzantium``, ``constantinople``, ``petersburg``, or ``istanbul``
- ``hardfork`` - ``string``: (optional) ``chainstart``, ``homestead``, ``dao``, ``tangerineWhistle``, ``spuriousDragon``, ``byzantium``, ``constantinople``, ``petersburg``, ``istanbul``, ``berlin``, or ``london``

2. ``callback`` - ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second.

Expand Down Expand Up @@ -1534,7 +1577,7 @@ Example

.. code-block:: javascript

var Tx = require('ethereumjs-tx').Transaction;
var Tx = require('@ethereumjs/tx').Transaction;
var privateKey = Buffer.from('e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', 'hex');

var rawTx = {
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.3.4",
"version": "1.4.0",
"lerna": "2.0.0",
"command": {
"init": {
Expand Down
Loading