WalletConnect Kotlin SDK v2

Overview

WalletConnect V2

WalletConnect V2 - Kotlin

Kotlin implementation of WalletConnect v2 protocol for Android applications.

Requirements

  • Android min SDK 21
  • Java 11

Installation

root/build.gradle:

allprojects {
 repositories {
    maven { url "https://jitpack.io" }
 }
}

app/build.gradle(.kts)

groovy - implementation 'com.walletconnect:walletconnectv2:1.0.0-alpha01'

kotlin - implementation("com.walletconnect:walletconnectv2:1.0.0-alpha01")

Usage

Initialize WalletConnect Client

val initializeParams = ClientTypes.InitialParams(useTls = true, hostName = "relay.walletconnect.org", apiKey = "sample key", isController = true)
WalletConnectClient.initalize(initalizeParams)

The controller client will always be the "wallet" which is exposing blockchain accounts to a "Dapp" and therefore is also in charge of signing. To initialize the WalletConnect client, create a ClientTypes.InitialParams object in the Android Application class. The InitialParams object will need at least the API key and the Application. The InitialParams object will then be passed to the WalletConnect.initialize function.

Pair Clients

val pairParams = ClientTypes.PairParams("wc:...")
val pairListener = WalletConnectClientListeners.Pairing { sessionProposal -> /* handle session proposal */ }
WalletConnectClient.pair(pairParams, pairListener)

To pair the wallet with the Dapp, call the WalletConnectClient.pair function which needs a ClientTypes.PairParams and WalletConnectClientListeners.Pairing. ClientTypes.Params is where the Dapp Uri will be passed. WalletConnectClientListeners.Pairing is the callback that will be asynchronously called once there a pairing has been made with the Dapp. A SessionProposal object is returned once a pairing is made.

Session Approval

val accounts: List<String> = /*list of accounts on chains*/
val proposerPublicKey: String = /*proposerPublicKey from the Session Proposal*/
val proposalTtl: Long = /*Ttl from the Session Proposal*/
val proposalTopic: String = /*Topic from the Session Proposal*/
val approveParams: ClientTypes.ApproveParams = ClientTypes.ApproveParams(accounts, proposerPublicKey, proposalTtl, proposalTopic)

WalletConnectClient.approve(approveParams)

To send a approval for the Session Proposal, pass the Session Proposal public key, ttl, and topic along with the list of accounts to the WalletConnectClient.approve function.

Session Rejection

val rejectionReason: String = /*The reason for rejecting the Session Proposal*/
val proposalTopic: String = /*Topic from the Session Proposal*/
val rejectParams: ClientTypes.RejectParams = ClientTypes.RejectParams(rejectionReason, proposalTopic)

WalletConnectClient.reject(rejectParams)

To send a rejection for the Session Proposal, pass a rejection reason and the Session Proposal public key to the WalletConnectClient.approve function.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

LGPL-3.0

You might also like...
Java/Kotlin WE contract SDK.

we-contract-sdk Java/Kotlin contract SDK used for building Docker smart contracts. All transaction handling is done via methods of a single class mark

Android Word/Letter Tracing SDK is a complet solution to build apps for kids learning in pure kotlin
Android Word/Letter Tracing SDK is a complet solution to build apps for kids learning in pure kotlin

Android Word/Letter Tracing SDK is a complet solution to build apps for kids learning in pure kotlin. It supports all kind of shapes and all language letters e.g. english, arabic, Urdu, hindi etc.

AWS SDK for Android. For more information, see our web site:

AWS SDK for Android For new projects, we recommend interacting with AWS using the Amplify Framework. The AWS SDK for Android is a collection of low-le

Countly Product Analytics Android SDK
Countly Product Analytics Android SDK

Countly Android SDK We're hiring: Countly is looking for Android SDK developers, full stack devs, devops and growth hackers (remote work). Click this

Android Real Time Chat & Messaging SDK
Android Real Time Chat & Messaging SDK

Android Chat SDK Overview Applozic brings real-time engagement with chat, video, and voice to your web, mobile, and conversational apps. We power emer

Evernote SDK for Android

Evernote SDK for Android version 2.0.0-RC4 Evernote API version 1.25 Overview This SDK wraps the Evernote Cloud API and provides OAuth authentication

Air Native Extension (iOS and Android) for the Facebook mobile SDK

Air Native Extension for Facebook (iOS + Android) This is an AIR Native Extension for the Facebook SDK on iOS and Android. It has been developed by Fr

Android Chat SDK built on Firebase
Android Chat SDK built on Firebase

Chat21 is the core of the open source live chat platform Tiledesk.com. Chat21 SDK Documentation Features With Chat21 Android SDK you can: Send a direc

Liquid SDK (Android)

Liquid Android SDK Quick Start to Liquid SDK for Android This document is just a quick start introduction to Liquid SDK for Android. We recommend you

Releases(1.0.0-test07)
Owner
WalletConnect Labs
Developing software solutions for decentralized identity and digital wallet authentication
WalletConnect Labs
HubSpot Kotlin SDK ๐Ÿงบ Implementation of HubSpot API for Java/Kotlin in tiny SDK

HubSpot Kotlin SDK ?? Implementation of HubSpot API for Java/Kotlin in tiny SDK

BOOM 3 Oct 27, 2022
Sdk-android - SnapOdds Android SDK

Documentation For the full API documentation go to https://snapodds.github.io/sd

Snapodds 0 Jan 30, 2022
Frogo SDK - SDK Core for Easy Development

SDK for anything your problem to make easier developing android apps

Frogobox 10 Dec 15, 2022
Its measurement app made using kotlin with sceneform sdk by google

ARCORE MEASUREMENT This app is build using sceneform sdk for android using kotlin language It helps you measure the distance between multiple points i

Kashif Mehmood 39 Dec 9, 2022
Storyblok Kotlin Multiplatform SDK sample (Android, JVM, JS)

storyblok-mp-SDK-sample *WIP* ... a showcase of the Storyblok Kotlin Multiplatform Client SDK. (Android, JVM, JS, iOS, ...) What's included ?? โ€ข About

Mike Penz 6 Jan 8, 2022
Kotlin Multi Platform SDK

Xeon SDK (work-in-progress ?? ??๏ธ ??โ€โ™€๏ธ โ› ) Development Version Release This Is Latest Release ~ In Development $version_release = ~ What's New?? * I

Frogobox 3 Oct 15, 2021
NextPay Kotlin SDK

Welcome to nextpay-kt ?? Connect to NextPay.ir payment gateway in easy way. ?? Homepage Setup Kotlin KTS 1- Add mavenCentral() to your repositories se

Farhad 5 Nov 6, 2021
Official Appwrite Kotlin SDK ๐Ÿ’™๐Ÿงก

Appwrite Kotlin SDK This SDK is compatible with Appwrite server version 0.11.x. For older versions, please check previous releases. This is the Kotlin

Appwrite 47 Nov 26, 2022
Streem Server SDK for Java & Kotlin

Streem Server SDK for Java & Kotlin Server-side JVM library for interacting with the Streem API, and generation of Streem Tokens for use in client SDK

Streem, Inc. 1 Dec 15, 2022
Implement a Casper Kotlin SDK to interact with the Casper network.

CSPR-Kotlin-SDK Kotlin SDK library for interacting with a CSPR node. What is CSPR-Kotlin-SDK? SDK to streamline the 3rd party Kotlin client integratio

null 2 Mar 28, 2022