Skip to content

Commit

Permalink
add missing promievent handlers - closes #4194 (#4336)
Browse files Browse the repository at this point in the history
* add missing PromiEvent handler types

* fixing linter

* updating changelog

* updating changelog

Co-authored-by: Jeff Rossiter <jeffrey.rossiter@me.com>
Co-authored-by: Nazar Hussain <nazarhussain@gmail.com>
  • Loading branch information
3 people authored Sep 30, 2021
1 parent 44bb68a commit d4155d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@ Released with 1.0.0-beta.37 code base.
- lerna from 3.22.1 to 4.0.0 (#4231)
- Dropped build tests in CI for Node v8 and v10, and added support for Node v14
- Change default value for `maxPriorityFeePerGas` from `1 Gwei` to `2.5 Gwei` (#4284)
- Introduced new configuration "blockHeaderTimeout" for waiting of block headers for transaction receipt (#3891)
- Fixed bug in signTransaction (#4295)
- Format `block.baseFeePerGas` to number (#4330)
- Introduced new configuration "blockHeaderTimeout" for waiting of block headers for transaction receipt (#3891)

## [Unreleased]

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

- Not considering `tx.chainId` if `tx.common.customChain.chainId` is provided for `web3.eth.accounts.signTransaction` function (#4293)
- Added missing PromiEvent handler types (#4194)
18 changes: 14 additions & 4 deletions packages/web3-core/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,18 @@ export interface PromiEvent<T> extends Promise<T> {
once(type: 'error', handler: (error: Error) => void): PromiEvent<T>;

once(
type: 'error' | 'confirmation' | 'receipt' | 'transactionHash',
handler: (error: Error | TransactionReceipt | string) => void
type: 'error' | 'confirmation' | 'receipt' | 'transactionHash' | 'sent' | 'sending',
handler: (error: Error | TransactionReceipt | string | object) => void
): PromiEvent<T>;

on(
type: 'sending',
handler: (payload: object) => void
): PromiEvent<T>;

on(
type: 'sent',
handler: (payload: object) => void
): PromiEvent<T>;

on(
Expand All @@ -109,8 +119,8 @@ export interface PromiEvent<T> extends Promise<T> {
on(type: 'error', handler: (error: Error) => void): PromiEvent<T>;

on(
type: 'error' | 'confirmation' | 'receipt' | 'transactionHash',
handler: (error: Error | TransactionReceipt | string) => void
type: 'error' | 'confirmation' | 'receipt' | 'transactionHash' | 'sent' | 'sending',
handler: (error: Error | TransactionReceipt | string | object) => void
): PromiEvent<T>;
}

Expand Down

0 comments on commit d4155d6

Please sign in to comment.