-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: create a simple Sign API example on top of the WS client #1
Conversation
Solved: needed to |
//! The crate exports common types used when interacting with messages between | ||
//! clients. This also includes communication over HTTP between relays. |
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.
Bad copy/paste
} | ||
} | ||
|
||
/// Validates the request payload. |
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.
Need to add more validations.
} | ||
|
||
/// Validates the parameters. | ||
pub fn validate(&self) -> Result<(), ValidationError> { |
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.
Need to add more validations
|
||
impl Payload { | ||
/// Returns the message ID contained within the payload. | ||
pub fn id(&self) -> u64 { |
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.
Not really used anywhere, should remove?
17baa3e
to
3a06da3
Compare
This change adds WalletConnect v2 Sign API, as per: https://specs.walletconnect.com/2.0/specs/clients/sign/ Please note that although the specification is fairly thorough, there are some inconsistencies. This implementation is derived from specs, analyzing ws traffic in browsers devtools, as well as the original WalletConnect JavaScript client at: https://github.com/WalletConnect/walletconnect-monorepo Design decisions: Modularity: - RPC and crypto modules are not dependent on each other, so client implementations don't have to use their own crypto implementation. Closes: reown-com#47
This client implements pairing and session flows: https://specs.walletconnect.com/2.0/specs/clients/core/pairing https://specs.walletconnect.com/2.0/specs/clients/sign/session-proposal Supported actions: - pairing - session establishment - session delete - ping This example could be expanded to handle multiple sessions. Caution: The purpose of this example is demonstration of core Sign API functionality. However, it shouldn't be used in production, as might exhibit some race conditions such as with session deletion, etc...
3a06da3
to
968a167
Compare
Description
This change adds Sign API framework, and a simple example client to demonstrate pairing and session creation capabilities.
This change introduces the following functionality:
Resolves reown-com#47
How Has This Been Tested?
- Click on "Goerli" and then "connect"
- In a new pop-up, click "New Pairing"
- Copy the Pairing URI
- In the terminal,
cd path/to/WalletConnectRust
-
.../WalletConnectRust$ cargo run --example session "<copied URI>"
- DApp should now display the session window
- In the DApp click disconnect
Due Diligence
TODO
crypto/session.rs
refactorAdditional information
WCv2 uses layered approach. The relay protocol messages (currently only IRN, but there might be other in future), are used to carry the useful payload. In terms of this change the useful payload is Sign API messages.
Useful materials:
https://specs.walletconnect.com/2.0/specs/clients/core/pairing
https://specs.walletconnect.com/2.0/specs/clients/sign/session-proposal
https://specs.walletconnect.com/2.0/specs/servers/relay/relay-server-rpc
https://specs.walletconnect.com/2.0/specs/clients/sign/rpc-methods