Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
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: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,21 @@ Released with 1.0.0-beta.37 code base.

### Changed

- Remove `notImplemented` flag from ETH2 Beacon Chain package methods schema (#3861)
- Fixed mutation of inputs to encoding and decoding functions (#3748)
- Fix default value for `fromBlock` option for `logs` subscriptions (defaults to `latest`) (#3883)
- ethjs-signer test (#3876)
- Rename `web3-eth2-base` to `web3-eth2-core` and `web3-eth2-beacon` to `web3-eth2-beaconchain` (#3833)
- Bump `ts-node` from version `^8.10.2` to `^9.0.0` (#3856)
- Ran `npm audit fix` which fixed 4 vulnerabilities (#3856)
- Correct `web3-eth2-beaconchain` type declarations (#3859) and (#3865)
- Move interfaces `IBaseAPISchema` and `IBaseAPIMethodSchema` to `index.d.ts` for `web3-eth2-core` (#3878)
- Removes `IETH2BeaconChain` interface in favor of exporting a class type: `ETH2BeaconChain` (#3878)
- Remove `index.d.ts` files in favor of `types.ts` for `web3-eth2-core` and `web3-eth2-beaconchain` (#3878)
- Update dependencies for `web3-eth2-core` (#3878)

### Removed

- Remove `notImplemented` flag from ETH2 Beacon Chain package methods schema (#3861)
- Removes `IETH2BeaconChain` interface in favor of exporting a class type: `ETH2BeaconChain` (#3878)
- Remove `index.d.ts` files in favor of `types.ts` for `web3-eth2-core` and `web3-eth2-beaconchain` (#3878)
- `schema.ts` from `web3-eth2-core` (#3878)
- `dtslint` npm command from `web3-eth2-core` and `web3-eth2-beaconchain` as `index.d.ts` files were removed (#3878)

Expand Down
2 changes: 1 addition & 1 deletion docs/web3-eth-subscribe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ Parameters

1. ``"logs"`` - ``String``, the type of the subscription.
2. ``Object`` - The subscription options
- ``fromBlock`` - ``Number``: The number of the earliest block. By default ``null``.
- ``fromBlock`` - ``Number``: The ``fromBlock`` dictates at which block the subscription will start from, if it is left empty, the default is ``latest`` (a.k.a the chain head)
- ``address`` - ``String|Array``: An address or a list of addresses to only get logs from particular account(s).
- ``topics`` - ``Array``: An array of values which must each appear in the log entries. The order is important, if you want to leave topics out use ``null``, e.g. ``[null, '0x00...']``. You can also pass another array for each topic with options for that topic e.g. ``[null, ['option1', 'option2']]``
3. ``callback`` - ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second. Will be called for each incoming subscription.
Expand Down
3 changes: 3 additions & 0 deletions packages/web3-core-helpers/src/formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ var inputLogFormatter = function (options) {
return utils.fromUtf8(value);
};

if (options === undefined) options = {}
// If options !== undefined, don't blow out existing data
if (options.fromBlock === undefined) options = {...options, fromBlock: 'latest'}
if (options.fromBlock || options.fromBlock === 0)
options.fromBlock = inputBlockNumberFormatter(options.fromBlock);

Expand Down
1 change: 1 addition & 0 deletions test/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -2745,6 +2745,7 @@ var runTests = function(contractFactory) {
assert.equal(payload.method, 'eth_getLogs');
assert.deepEqual(payload.params, [{
address: addressLowercase,
fromBlock: "latest",
topics: [
"0x792991ed5ba9322deaef76cff5051ce4bedaaa4d097585970f9ad8f09f54e651",
"0x000000000000000000000000" + address2.replace('0x',''),
Expand Down