-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix JSON-RPC response validation #2862
Fix JSON-RPC response validation #2862
Conversation
I’ve been reading through the API described in EIP1193 and become skeptical about my fix above. The example showed here seems like the provider’s send method only returns the JSON-RPC response result. In this case, the current return value from Web3EthereumProvider.send method seems right but the validation method needs to be changed to something like below.
@nivida Could you verify this approach, please? |
|
||
if (validationResult instanceof Error) { | ||
throw validationResult; | ||
if (result === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check isn't required :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix: 747554b
bdcca21
to
747554b
Compare
@nivida Undefined check is now removed! |
Description
Fixed the send method on Web3EthereumProvider to return response result, not response object itself otherwise GetAccountsMethod.js#L47 throws an error.
Type of change
Checklist:
npm run test
in the root folder with success and extended the tests if necessary.npm run build
in the root folder and tested it in the browser and with node.npm run dtslint
in the root folder and tested that all my types are correct