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

Consolidate Zerion's fork #48

Merged
merged 12 commits into from Jul 9, 2021
Merged

Consolidate Zerion's fork #48

merged 12 commits into from Jul 9, 2021

Conversation

pedrouid
Copy link
Member

@pedrouid pedrouid commented Apr 7, 2021

Hey @sche and @DmitryBespalov, I'm wondering what's your feedback on these changes made by @shmakovigor from Zerion? I would love to hear from @DarthMike from Argent as well

The more consensus we have on these clients the better! 🙌

@DarthMike
Copy link
Contributor

Changes don't seem to break anything on our side 👍

@DmitryBespalov
Copy link
Collaborator

Thanks for the pull request, still reviewing ⏳

@@ -32,4 +32,6 @@ class UpdateSessionHandler: RequestHandler {

struct SessionInfo: Decodable {
var approved: Bool
var accounts: [String]?
var chainId: Int
Copy link
Collaborator

Choose a reason for hiding this comment

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

@pedrouid

  1. Does it make sense to make chainId optional for wc_sessionUpdate?
  2. How to treat empty or absent accounts list if approved=true? My guess is that if accounts are not passed, then the old array is not changed. Should we send an error response if approved=true and accounts=[]?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@shmakovigor do you mind if we make chainId optional here?

@@ -35,7 +35,7 @@ class WebSocketConnection {
self.onDisconnect = onDisconnect
self.onTextReceive = onTextReceive
serialCallbackQueue = DispatchQueue(label: "org.walletconnect.swift.connection-\(url.bridgeURL)-\(url.topic)")
socket = WebSocket(url: url.bridgeURL)
socket = WebSocket(request: URLRequest(url: url.bridgeURL))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change and in other places in this file is because Starscream API changed in next version. Everything looks good to me.
I think private var isConnected = false can be removed in favour of isOpen

@@ -54,9 +56,9 @@ public struct Session: Codable {
public let accounts: [String]
public let chainId: Int
public let peerId: String
public let peerMeta: ClientMeta
public let peerMeta: ClientMeta?
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one is related to https://docs.walletconnect.org/tech-spec#session-request
According to specs:
The wc_sessionRequest will expect a response with the following parameters:

interface WCSessionRequestResponse {
  id: number;
  jsonrpc: "2.0";
  result: {
    peerId: string;
    peerMeta: ClientMeta;
    approved: boolean;
    chainId: number;
    accounts: string[];
  };
}

@pedrouid is it required by protocol to always have peerMeta in the response? If not what other parameters can be optional?

@sche
Copy link
Collaborator

sche commented Apr 9, 2021

@shmakovigor thanks for the proposed improvements. Let's merge it after resolving all comments.

@sche sche merged commit ed7ef94 into WalletConnect:master Jul 9, 2021
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.

None yet

5 participants