Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit faffe91

Browse files
Merge branch '1.x' into wyatt/1.x/4397-doc-fix
2 parents 5bafc89 + 202be5b commit faffe91

File tree

3 files changed

+64
-11
lines changed

3 files changed

+64
-11
lines changed

CHANGELOG.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -444,11 +444,9 @@ Released with 1.0.0-beta.37 code base.
444444
- ethers from 5.1.4 to 5.4.4 (#4231)
445445
- karma from 5.2.3 to 6.3.4 (#4231)
446446
- lerna from 3.22.1 to 4.0.0 (#4231)
447-
- Dropped build tests in CI for Node v8 and v10, and added support for Node v14
447+
- Dropped build tests in CI for Node v8 and v10, and added support for Node v14 (#4231)
448448
- Change default value for `maxPriorityFeePerGas` from `1 Gwei` to `2.5 Gwei` (#4284)
449449
- Fixed bug in signTransaction (#4295)
450-
- Format `block.baseFeePerGas` to number (#4330)
451-
- Introduced new configuration "blockHeaderTimeout" for waiting of block headers for transaction receipt (#3891)
452450

453451
## [Unreleased]
454452

@@ -463,7 +461,9 @@ Released with 1.0.0-beta.37 code base.
463461
### Changed
464462

465463
- Not considering `tx.chainId` if `tx.common.customChain.chainId` is provided for `web3.eth.accounts.signTransaction` function (#4293)
466-
467-
### Fixed
468-
464+
- Added missing PromiEvent handler types (#4194)
465+
- Updated README to include Webpack 5 angular support instructions (#4174)
466+
- Emit subscription id with connect event when creating a subscription (#4300)
467+
- Introduced new configuration "blockHeaderTimeout" for waiting of block headers for transaction receipt (#3891)
468+
- Format `block.baseFeePerGas` to number (#4330)
469469
- Correct `web3-eth-personal.sendTransaction` example in documentation (#4409)

README.md

+44-1
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,54 @@ If you are using the types in a `commonjs` module, like in a Node app, you just
104104
## Trouble shooting and known issues.
105105
106106
### Web3 and Angular
107+
108+
### New solution
109+
110+
If you are using Angular version >11 and run into an issue building, the old solution below will not work. This is because polyfills are not included in the newest version of Angular.
111+
112+
- Install the required dependencies within your angular project:
113+
114+
```bash
115+
npm install --save-dev crypto-browserify stream-browserify assert stream-http https-browserify os-browserify
116+
```
117+
118+
- Within `tsconfig.json` add the following `paths` in `compilerOptions` so Webpack can get the correct dependencies
119+
120+
```typescript
121+
{
122+
"compilerOptions": {
123+
"paths" : {
124+
"crypto": ["./node_modules/crypto-browserify"],
125+
"stream": ["./node_modules/stream-browserify"],
126+
"assert": ["./node_modules/assert"],
127+
"http": ["./node_modules/stream-http"],
128+
"https": ["./node_modules/https-browserify"],
129+
"os": ["./node_modules/os-browserify"],
130+
}
131+
}
132+
```
133+
134+
- Add the following lines to `polyfills.ts` file:
135+
136+
```typescript
137+
import { Buffer } from 'buffer';
138+
139+
(window as any).global = window;
140+
global.Buffer = Buffer;
141+
global.process = {
142+
env: { DEBUG: undefined },
143+
version: '',
144+
nextTick: require('next-tick')
145+
} as any;
146+
```
147+
148+
### Old solution
149+
107150
If you are using Ionic/Angular at a version >5 you may run into a build error in which modules `crypto` and `stream` are `undefined`
108151
109152
a work around for this is to go into your node-modules and at `/angular-cli-files/models/webpack-configs/browser.js` change the `node: false` to `node: {crypto: true, stream: true}` as mentioned [here](https://github.com/ethereum/web3.js/issues/2260#issuecomment-458519127)
110153
111-
Another variation of this problem was an issue opned on angular-cli: https://github.com/angular/angular-cli/issues/1548
154+
Another variation of this problem was an [issue opned on angular-cli](https://github.com/angular/angular-cli/issues/1548)
112155
113156
## Documentation
114157

packages/web3-core/types/index.d.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,18 @@ export interface PromiEvent<T> extends Promise<T> {
8787
once(type: 'error', handler: (error: Error) => void): PromiEvent<T>;
8888

8989
once(
90-
type: 'error' | 'confirmation' | 'receipt' | 'transactionHash',
91-
handler: (error: Error | TransactionReceipt | string) => void
90+
type: 'error' | 'confirmation' | 'receipt' | 'transactionHash' | 'sent' | 'sending',
91+
handler: (error: Error | TransactionReceipt | string | object) => void
92+
): PromiEvent<T>;
93+
94+
on(
95+
type: 'sending',
96+
handler: (payload: object) => void
97+
): PromiEvent<T>;
98+
99+
on(
100+
type: 'sent',
101+
handler: (payload: object) => void
92102
): PromiEvent<T>;
93103

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

111121
on(
112-
type: 'error' | 'confirmation' | 'receipt' | 'transactionHash',
113-
handler: (error: Error | TransactionReceipt | string) => void
122+
type: 'error' | 'confirmation' | 'receipt' | 'transactionHash' | 'sent' | 'sending',
123+
handler: (error: Error | TransactionReceipt | string | object) => void
114124
): PromiEvent<T>;
115125
}
116126

0 commit comments

Comments
 (0)