diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e20721e744..e4cccf77ca5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,3 +82,11 @@ Released with 1.0.0-beta.37 code base. - Fix hexToNumber and hexToNumberString prefix validation (#3086) - The receipt will now returned on a EVM error (this got removed on beta.18) (#3129) - Fixes transaction confirmations with the HttpProvider (#3140) + +## [1.2.3] + +### Added + +### Fixed + +- Fix TS types for eth.subscribe syncing, newBlockHeaders, pendingTransactions (#3159) diff --git a/packages/web3-eth/types/index.d.ts b/packages/web3-eth/types/index.d.ts index b42d386741f..71c1da0f308 100644 --- a/packages/web3-eth/types/index.d.ts +++ b/packages/web3-eth/types/index.d.ts @@ -78,32 +78,21 @@ export class Eth { subscribe( type: 'logs', - options?: LogsOptions, + options: LogsOptions, callback?: (error: Error, log: Log) => void ): Subscription; subscribe( type: 'syncing', - options?: null, callback?: (error: Error, result: Syncing) => void ): Subscription; subscribe( type: 'newBlockHeaders', - options?: null, callback?: (error: Error, blockHeader: BlockHeader) => void ): Subscription; subscribe( type: 'pendingTransactions', - options?: null, callback?: (error: Error, transactionHash: string) => void ): Subscription; - subscribe( - type: 'pendingTransactions' | 'logs' | 'syncing' | 'newBlockHeaders', - options?: null | LogsOptions, - callback?: ( - error: Error, - item: Log | Syncing | BlockHeader | string - ) => void - ): Subscription; getProtocolVersion( callback?: (error: Error, protocolVersion: string) => void diff --git a/packages/web3-eth/types/tests/eth.tests.ts b/packages/web3-eth/types/tests/eth.tests.ts index 395bd7ee0a2..50be6454cf7 100644 --- a/packages/web3-eth/types/tests/eth.tests.ts +++ b/packages/web3-eth/types/tests/eth.tests.ts @@ -79,9 +79,6 @@ eth.net; // $ExpectType void eth.clearSubscriptions(() => {}); -// $ExpectType Subscription -eth.subscribe('logs'); - // $ExpectType Subscription eth.subscribe('logs', {}); // $ExpectType Subscription @@ -90,14 +87,16 @@ eth.subscribe('logs', {}, (error: Error, log: Log) => {}); // $ExpectType Subscription eth.subscribe('syncing'); // $ExpectType Subscription -eth.subscribe('syncing', null, (error: Error, result: Syncing) => {}); +eth.subscribe( + 'syncing', + (error: Error, result: Syncing) => {} +); // $ExpectType Subscription eth.subscribe('newBlockHeaders'); // $ExpectType Subscription eth.subscribe( 'newBlockHeaders', - null, (error: Error, blockHeader: BlockHeader) => {} ); @@ -106,7 +105,6 @@ eth.subscribe('pendingTransactions'); // $ExpectType Subscription eth.subscribe( 'pendingTransactions', - null, (error: Error, transactionHash: string) => {} );