Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

@0x/utils: Extra space in provider.send varies #2556

Closed
chpwssn opened this issue Apr 16, 2020 · 4 comments
Closed

@0x/utils: Extra space in provider.send varies #2556

chpwssn opened this issue Apr 16, 2020 · 4 comments
Labels

Comments

@chpwssn
Copy link

chpwssn commented Apr 16, 2020

Expected Behavior

When working with different versions and types of web3.js providers the provider.send signature should have whitespace replaced so that it matches the comparison in the send normalization portion of standardizeOrThrow.

Current Behavior

The current function signature check implementation uses String.prototype.replace() with a literal string: .replace(" ", ""). This only replaces the first space in the string meaning signatures like function (payload, callback) get transformed to function(payload, callback) rather than being transformed to function(payload,callback) as desired.

#2494 likely worked but as web3.js shifts, the signature differ.

Possible Solution

Using a regular expression with a global flag .replace(/\s+/g, "") would replace all of the whitespaces in the provider's send signature with empty strings.

I can open a PR with the above change if it's acceptable.

Steps to Reproduce (for bugs)

We're seeing this behavior and have made the change to the package in node_modules when working with web3-providers-ws (Websocket providers) and @0x/utils@5.4.1

Context

Your Environment

Package Version
@0x/utils 5.4.1
web3-providers-ws {1.2.1, 1.2.4, 1.2.6}
Network
ganache privnet
@stale
Copy link

stale bot commented May 16, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 16, 2020
@adamlaska
Copy link

@stale stale bot removed the stale label May 27, 2020
@stale
Copy link

stale bot commented Jun 30, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 30, 2020
@stale
Copy link

stale bot commented Aug 1, 2020

This issue has been automatically closed because no activity occured in 7 days after being marked as stale. If it's still relevant - feel free to reopen. Thank you for your contributions.

@stale stale bot closed this as completed Aug 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@chpwssn @adamlaska and others