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

signEngine.metadata is final, but I want unique redirects for each Sign session. #170

Open
bobwith2bees opened this issue Aug 10, 2023 · 3 comments

Comments

@bobwith2bees
Copy link

What I am trying to do:

Have my Dapp allow the user to connect to multiple wallets. I will have a tab in the UI for each wallet so the user can manage them separately as needed. When I sent a transaction to a specific wallet Sign session , I want the redirect URI to be unique so that my app hand handle the deep link and open the corresponding tab in the UI for that wallet.

I see the pairingInfo is marked final, and it managed at the Core level and not the Session level. I was hoping I could re-use the Web3App instance, just update the paringInfo metatdata for the redirect before each new Sign Session. There is no need to change the redirect once the Sign session has been established.

Protocol wise - I don't see the need to have a Web3 / Core instance per wallet (what the code can do today.) Looking for thoughts/guidance?

Priority - Low (for me) - Again I am just writing a class and this would have been nice to show off the capabilities. (Also assumes wallets actually pay attention to the peerMetadata redirect :-p)

@Luzzotica
Copy link
Contributor

Each session has pairingMetadata for both dapp and wallet that should let you do as you're requesting.

They are embedded in the peer and self objects.

You can launch the peer's url or native link (If provided), or query it from the explorer and launch it that way.

@bobwith2bees
Copy link
Author

bobwith2bees commented Aug 11, 2023

@Luzzotica - I am referring to the PairingMetadata (which includes redirect) passed into the WebApp instance and is not modifiable (marked final). (i.e. The PeerInfo that my app advertises to the wallet.)

https://github.com/WalletConnect/WalletConnectFlutterV2/blob/3b27b06b29219ba71f5189c4d9ef5ec33dc3155d/lib/apis/core/core.dart#L119C9-L119C9

On my app deep link support, I have a unique path supporting navigating to specific pages(tabs)

  • returnToMyApp//tab1 - advertised in the Sign session to wallet 1
  • returnToMyApp//tab2 - advertised in the Sign session to wallet 2
  • returnToMyApp//tab3 - advertised in the Sign session to wallet 3

Leveraging a package like https://pub.dev/packages/go_router.

// was hoping I could pass a custom redirect in this call
web3App.signEngine.connect()

// or perhaps after the ConnectResponse was returned before launching the URI - but this is not allowed 
web3App.signEngine.metadata = web3App.signEngine.metadata.copyWith(redirect: Redirect(native: '$kNativeLink$sessionNumber'));

@bobwith2bees
Copy link
Author

bobwith2bees commented Aug 11, 2023

Deleted the idea that didn't work. But I did learn you can modify the peer metadata, and fix any errors. (Metamask - I am talking to you.)

// be sure you have the pairing topic not the session topic 
await web3App.core.pairing.updateMetadata(topic: pairingTopic, metadata: updatedPairingMetadata);

@bobwith2bees bobwith2bees changed the title Core paringMetadata is final, but I want unique redirects for each Sign session. signEngine.metadata is final, but I want unique redirects for each Sign session. Aug 24, 2023
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

No branches or pull requests

2 participants