Skip to content

Add WalletConnect dApp module with AppKit integration#31

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/update-dapp-sample
Draft

Add WalletConnect dApp module with AppKit integration#31
Copilot wants to merge 2 commits into
masterfrom
copilot/update-dapp-sample

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 6, 2026

Implements a Kotlin Android dApp module mirroring the reown-kotlin sample dApp — chain selection, WalletConnect session lifecycle, and session request flows using AppKit.

Build system

  • Gradle wrapper: 6.7.1 → 7.6.4; AGP: 4.2.2 → 7.4.2
  • Added Kotlin 1.9.23 plugin to root build.gradle
  • :dapp added to settings.gradle

New :dapp module

Domain

  • DappDelegate — singleton AppKit.ModalDelegate + CoreClient.CoreDelegate that republishes all WC events as Kotlin SharedFlows

ViewModels

  • ChainSelectionViewModel — creates a WC pairing, manages chain toggle state, maps wallet events to DappSampleEvent
  • SessionViewModel — wraps AppKit.ping, AppKit.disconnect, and AppKit.request (personal_sign); exposes loading state and one-shot events

Screens (View-based, no Compose)

  • ChainSelectionFragmentRecyclerView chain list with loading indicator while awaiting wallet response
  • SessionFragment — peer info, accounts, ping/sign/disconnect actions
  • PairingUriDialogFragment — copy-to-clipboard or direct wallet deep-link for the WC URI

Shared utility

  • util/StringExtensions.ktString.encodeToHex() for EVM personal_sign payloads
// DappDelegate bridges AppKit callbacks → Flows consumed by ViewModels
override fun onSessionApproved(approvedSession: Modal.Model.ApprovedSession) {
    if (approvedSession is Modal.Model.ApprovedSession.WalletConnectSession) {
        selectedSessionTopic = approvedSession.topic
    }
    scope.launch { _wcEventModels.emit(approvedSession) }
}

Project ID is injected at build time via WC_CLOUD_PROJECT_ID env var — never hardcoded.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-7.6.4-all/39vjj63r4f4sim2tgn0oekese9/gradle-7.6.4/lib/gradle-launcher-7.6.4.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.6.4 (dns block)
  • https://api.github.com/repos/reown-com/reown-kotlin/contents/sample/dapp
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

https://github.com/reown-com/reown-kotlin/tree/b20e813b09f5dc56bcbcc679c3a66c633250f776/sample/dapp


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: montinode <258148236+montinode@users.noreply.github.com>
Copilot AI changed the title [WIP] Update sample dApp for better user experience Add WalletConnect dApp module with AppKit integration Mar 6, 2026
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.

2 participants