Skip to content
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

[ABW-1315] Radix Connect requset to CE and response from CE #444

Merged
merged 29 commits into from
Apr 14, 2023

Conversation

CyonAlexRDX
Copy link
Contributor

@CyonAlexRDX CyonAlexRDX commented Apr 12, 2023

(Sorry the confusing branch name...)

Description

This PR "upgrades" RadixConnect to work not only with Dapp request/response but with other request/response as well, e.g. messaging to/from ConnectorExtension for Ledger Nano commands.

Furthermore the Ledger related response and request models have been implemented.

PR submission checklist

  • I have tested account to account transfer flow and have confirmed that it works, tested GUMBALL flow

…e a message can be sent to either a Dapp or toe the ConnectorExtension itself (for Ledger Nano)
@CyonAlexRDX CyonAlexRDX marked this pull request as ready for review April 12, 2023 14:25
Copy link
Contributor

@kugel3 kugel3 left a comment

Choose a reason for hiding this comment

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

Awesome

Copy link
Contributor

@GhenadieVP GhenadieVP left a comment

Choose a reason for hiding this comment

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

Looks very very promising, added some first comments.

@@ -23,7 +23,8 @@ public struct RadixConnectClient: DependencyKey, Sendable {
public var addP2PWithPassword: AddP2PWithPassword

public var receiveMessages: ReceiveMessages
public var sendMessage: SendMessage
public var sendResponse: SendResponse
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A response is for now typically a response back to a Dapp for some "wallet interaction".

@@ -23,7 +23,8 @@ public struct RadixConnectClient: DependencyKey, Sendable {
public var addP2PWithPassword: AddP2PWithPassword

public var receiveMessages: ReceiveMessages
public var sendMessage: SendMessage
public var sendResponse: SendResponse
public var sendRequest: SendRequest
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A request is a new message, typically a request to Connector extension to execute some Ledger Hardware device command, recipient RTC peer is unknown, see SendStrategy below.


extension P2P {
/// Recipient of sender of an RTC message
public struct RTCRoute: Sendable, Hashable {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A since long missing tuple with the information on HOW to send an RTC message.

/// either a `response` or a `request`.
public enum RTCMessageFromPeer: Sendable, Hashable {
/// A response from a peer to some request we have sent over RTC
case response(Response)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@GhenadieVP I was able to remove the RTCRoute from here, was no needed.

Copy link
Contributor

@GhenadieVP GhenadieVP left a comment

Choose a reason for hiding this comment

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

Awesome work 🚀 ! Added some comments that need to be addressed.

Copy link
Contributor

@kugel3 kugel3 left a comment

Choose a reason for hiding this comment

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

Even better, only one question really.

Copy link
Contributor

@kugel3 kugel3 left a comment

Choose a reason for hiding this comment

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

CasePath is a nice solution here. Since you're only using the extract part, I first wanted to say that you should take only that as an argument:

extract: @escaping (P2P.RTCMessageFromPeer) -> Case?

but since you also use the .. composing functionality it might be worth it!

@CyonAlexRDX CyonAlexRDX changed the title Abw 1315 ledger pubkey [ABW-1315] Radix Connect requset to CE and response from CE Apr 14, 2023
@CyonAlexRDX CyonAlexRDX merged commit 4b0340a into main Apr 14, 2023
@CyonAlexRDX CyonAlexRDX deleted the ABW-1315_ledger_pubkey branch April 14, 2023 12:30
@GhenadieVP
Copy link
Contributor

Late to the party, but awesome work 💯 🚀!!!

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants