Skip to content

Ignore notifications#16

Closed
jiexi wants to merge 1 commit intomasterfrom
jl/ignore-notifications
Closed

Ignore notifications#16
jiexi wants to merge 1 commit intomasterfrom
jl/ignore-notifications

Conversation

@jiexi
Copy link
Copy Markdown
Member

@jiexi jiexi commented May 30, 2024

Fixes unhandled case where a notification (response without id) is received by the web3-stream-provider. This makes the request/response handling more closely match that of the inpage provider

Comment on lines +59 to +63
if (!data) {
throw new Error(
`StreamProvider - Unknown response id for response: ${response}`
)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this just a formatting preference or was something actually broken here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting preference. i can revert this and make the guard i added match the same syntax style if preferred

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No its alright, I think we prefer to always use brackets, I was just making sure I wasn't missing something obvious

@Gudahtt
Copy link
Copy Markdown
Member

Gudahtt commented May 30, 2024

Just to clarify, does this interface not support JSON-RPC notifications at all? I don't see how those would be received - this code is assuming each message written to this stream is a response. Though I don't see how we'd have received notifications previously either.

@jiexi
Copy link
Copy Markdown
Member Author

jiexi commented May 30, 2024

Correct, this interface does not support JSON-RPC notifications at all. They would not be received before (unless maybe if the wallet UI made a eth_subscribe call) because MetaMaskController did not send chainChanged and accountsChanged events to internal connections.

So apologies, I see a way on the extension where I can avoid sending the notification to internal connections that use this specific provider and the changes in this PR should no longer be necessary

@jiexi jiexi closed this May 30, 2024
@rekmarks rekmarks deleted the jl/ignore-notifications branch May 30, 2024 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants