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
Labels
provider.send
varies
#2556
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 thesend
normalization portion ofstandardizeOrThrow
.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 likefunction (payload, callback)
get transformed tofunction(payload, callback)
rather than being transformed tofunction(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'ssend
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 withweb3-providers-ws
(Websocket providers) and@0x/utils@5.4.1
Context
Your Environment
The text was updated successfully, but these errors were encountered: