fix: improper implementation of handleBatchMethod + more robust tests #1065
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
This PR fixes a bug where the extension provider invokes the
metamask_batch
request logic correctly, but then also sends ametamask_batch
request again. This (at best) causes the requests to be sent individually, then all at once or (at worst) causingmetamask_batch
to break entirely if the extension doesn't support the RPCCurrently, the latter case happens. The requests are sent individually, but then errors because it then tries to send
metamask_batch
and the extension doesn't support thatWith the fixed logic in
handleBatchMethod
, the extension and SDK return the correct resultThis PR also updates the unit tests for
handleBatchMethod
to be more robust to ensure this behavior doesn't regress.Checklist