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

Add WalletConnect Modal support #22

Merged
merged 2 commits into from
Nov 27, 2024
Merged

Add WalletConnect Modal support #22

merged 2 commits into from
Nov 27, 2024

Conversation

ruixhuang
Copy link
Contributor

Also updated the sample app to show the usage:

Screen_Recording_20241126_150947_CarteraExample.mp4

tinaszheng
tinaszheng previously approved these changes Nov 27, 2024
modifier = Modifier
.fillMaxWidth()
.clickable {
// nav.openWalletConnectModal()

Choose a reason for hiding this comment

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

delete?

provider.signMessage(
request = request,
message = "Test Message",
connected = { info ->
Log.d(tag(this@WalletListViewModel), "Connected to: ${info?.peerName ?: info?.address}")
},
status = { requireAppSwitching ->
Log.d(tag(this@WalletListViewModel), "Require app switching: $requireAppSwitching")
toastMessage("Please switch to the wallet app")

Choose a reason for hiding this comment

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

do you save info.peerName from the connection anywhere? if so it would be nice to display the wallet name:

toastMessage("Please switch to {info.peerName} to complete this action.")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for the test app only, and won't be part of the production code. I will add proper localized text to the production mobile app code.

completion = { signature, error ->
// delay for 1 second

Choose a reason for hiding this comment

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

🤔 better comment for why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated


request["from"] = fromAddress
request["to"] = toAddress ?: "0x"
request["gas"] = gasLimit?.toHexString()

Choose a reason for hiding this comment

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

i dont think you need gas, gasPrice, or nonce here (should be set by the wallet and not the dapp)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can keep this here for backward compatibility. Those are optional fields and client can decided whether to use it.

Copy link
Contributor

@jaredvu jaredvu left a comment

Choose a reason for hiding this comment

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

@tinaszheng stamping for now as it is blocking mobile. feel free to retro-actively review the PR

@ruixhuang ruixhuang merged commit 358387d into main Nov 27, 2024
2 checks passed
@ruixhuang ruixhuang deleted the features/modal branch November 27, 2024 18:58
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