Skip to content

Commit

Permalink
Merge branch '1.x' into wyatt/1.x/4397-doc-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
spacesailor24 authored Sep 30, 2021
2 parents 5bafc89 + 202be5b commit faffe91
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 11 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,9 @@ Released with 1.0.0-beta.37 code base.
- ethers from 5.1.4 to 5.4.4 (#4231)
- karma from 5.2.3 to 6.3.4 (#4231)
- 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
- Dropped build tests in CI for Node v8 and v10, and added support for Node v14 (#4231)
- Change default value for `maxPriorityFeePerGas` from `1 Gwei` to `2.5 Gwei` (#4284)
- 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,7 +461,9 @@ 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)

### Fixed

- Added missing PromiEvent handler types (#4194)
- Updated README to include Webpack 5 angular support instructions (#4174)
- Emit subscription id with connect event when creating a subscription (#4300)
- Introduced new configuration "blockHeaderTimeout" for waiting of block headers for transaction receipt (#3891)
- Format `block.baseFeePerGas` to number (#4330)
- Correct `web3-eth-personal.sendTransaction` example in documentation (#4409)
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,54 @@ If you are using the types in a `commonjs` module, like in a Node app, you just
## Trouble shooting and known issues.
### Web3 and Angular
### New solution
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.
- Install the required dependencies within your angular project:
```bash
npm install --save-dev crypto-browserify stream-browserify assert stream-http https-browserify os-browserify
```
- Within `tsconfig.json` add the following `paths` in `compilerOptions` so Webpack can get the correct dependencies
```typescript
{
"compilerOptions": {
"paths" : {
"crypto": ["./node_modules/crypto-browserify"],
"stream": ["./node_modules/stream-browserify"],
"assert": ["./node_modules/assert"],
"http": ["./node_modules/stream-http"],
"https": ["./node_modules/https-browserify"],
"os": ["./node_modules/os-browserify"],
}
}
```
- Add the following lines to `polyfills.ts` file:
```typescript
import { Buffer } from 'buffer';

(window as any).global = window;
global.Buffer = Buffer;
global.process = {
env: { DEBUG: undefined },
version: '',
nextTick: require('next-tick')
} as any;
```
### Old solution
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`
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)
Another variation of this problem was an issue opned on angular-cli: https://github.com/angular/angular-cli/issues/1548
Another variation of this problem was an [issue opned on angular-cli](https://github.com/angular/angular-cli/issues/1548)
## Documentation
Expand Down
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 faffe91

Please sign in to comment.