Support URL path in Electrum credentials for path-based API keys#928
Merged
lukasz-zimnoch merged 2 commits intomainfrom Mar 3, 2026
Merged
Support URL path in Electrum credentials for path-based API keys#928lukasz-zimnoch merged 2 commits intomainfrom
lukasz-zimnoch merged 2 commits intomainfrom
Conversation
pdyraga
commented
Mar 3, 2026
Some Electrum RPC providers expose authenticated WebSocket endpoints where the API key is embedded in the URL path (e.g. wss://host:443/<api-key>). Previously, parseElectrumCredentials discarded the path component entirely, and silently produced NaN when the URL lacked an explicit port. Add optional `path` field to ElectrumCredentials and pass it through to the electrum-client-js constructor. Throw an explicit error when the port cannot be parsed from the URL. Bump electrum-client-js to a commit that accepts the path parameter in its constructor chain. Add unit tests for fromUrl covering path extraction, missing port rejection, array input, and bare-slash normalization.
b2ea191 to
64f200f
Compare
The new v0.2.0 version has just been released. It's the same code as the previously referenced dev commit hash.
lukasz-zimnoch
approved these changes
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Some Electrum RPC providers expose authenticated WebSocket endpoints where the API key is embedded in the URL path (e.g.
wss://host:443/<api-key>). Previously,parseElectrumCredentialsdiscarded the path component entirely, and silently produced NaN when the URL lacked an explicit port.Added an optional
pathfield toElectrumCredentialsand passed it through to theelectrum-client-jsconstructor.Additionally, the code now throws an explicit error when the port cannot be parsed from the URL. I wanted to keep the changes minimal and not change the port parsing code, but added an explicit error to avoid NaN during execution.
Added unit tests for
fromUrlcovering path extraction, missing port rejection, array input, and bare-slash normalization.