Skip to content

Commit

Permalink
Merge branch '1.x' into wyatt/4058-unsubscribe-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
spacesailor24 committed Sep 30, 2021
2 parents 1ad6858 + 202be5b commit d5c4036
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 8 deletions.
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,39 @@
name: Feature Request
description: Request a feature
labels: ["Feature Request"]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the feature you're requesting
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Feature Request
description: A concise description of the feature you're requesting
validations:
required: true
- type: textarea
attributes:
label: Use Cases
description: A concise description of use cases for the feature you're requesting
validations:
required: true
- type: textarea
attributes:
label: Implementation Ideas
description: Do you have ideas regarding the implementation of this feature?
- type: textarea
attributes:
label: Feature Examples/References
description: Do you have any examples or references regarding this feature?
placeholder: |
- [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)
- [Ethers' implementation](https://github.com/ethers-io/ethers.js/blob/master/packages/abstract-signer/src.ts/index.ts)
- type: checkboxes
attributes:
label: Are you willing to implement this feature?
options:
- label: "Yes"
8 changes: 5 additions & 3 deletions CHANGELOG.md
Expand Up @@ -446,10 +446,7 @@ 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 (#4231)
- Change default value for `maxPriorityFeePerGas` from `1 Gwei` to `2.5 Gwei` (#4284)
- Emit subscription id with connect event when creating a subscription (#4300)
- 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 @@ -464,3 +461,8 @@ 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)
- 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)
45 changes: 44 additions & 1 deletion README.md
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
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 d5c4036

Please sign in to comment.