Skip to content

Commit

Permalink
Upgrade dependencies, Remove outdated (#47)
Browse files Browse the repository at this point in the history
* * Upgrade Kotlin 1.5.31 -> 1.6.21

* Upgrade Grade Build Tool 4.0.0 -> 7.2.1
* Upgrade Gradle 6.1.1 -> 7.4.2
* sourceCompatibility/targetCompatibility Java 8 -> Java 11
* (sample) app module depends on library module directly instead of using Jitpack
* Upgrade all dependencies
- Remove jcenter()

* + CHANGELOG.md

* + ViewBinding
- Kotlin Android Extensions

* * Fix trustwallet-core dep. version

* * Update CHANGELOG.md

Co-authored-by: Viacheslav Kulish <32914239+vcoolish@users.noreply.github.com>
  • Loading branch information
jemshit and vcoolish committed Aug 13, 2022
1 parent 9bbadc2 commit 75b2590
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 46 deletions.
86 changes: 86 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- [Sample app](app)
- [CHANGELOG.md](CHANGELOG.md)
- `ViewBinding`

### Changed

- [README.md](README.md)
- Upgrade Kotlin, Gradle, all dependencies
- sourceCompatibility/targetCompatibility Java 8 -> Java 11
- (sample) app module depends on library module directly instead of using Jitpack

### Removed

- jcenter()
- `appcompat-v7` dependency from library
- `kotlin android extensions`

### Fixed

- `trustwallet:wallet-core` dep. version in sample app

## [1.5.4] - 2021-11-11

### Changed

- Allow chain changes on session approve

## [1.5.3] - 2021-10-06

### Added

- EIP-1559 fields to ETH transaction model

## [1.5.2] - 2021-05-15

### Fixed

- Parse ETH transaction payload params ([#26](https://github.com/trustwallet/wallet-connect-kotlin/issues/26))

## [1.5.1] - 2021-05-14

### Fixed

- Parse ETH transaction payload params ([#26](https://github.com/trustwallet/wallet-connect-kotlin/issues/26))

## [1.5.0] - 2020-09-30

### Added

- Persist chainId

## [1.4.9] - 2020-06-16

### Added

- Decode gas and gasLimit in WCEthereumTransaction

### Changed

- Upgrade Gradle dependencies


[Unreleased]: https://github.com/trustwallet/wallet-connect-kotlin/compare/1.0.0...HEAD

[1.5.4]: https://github.com/trustwallet/wallet-connect-kotlin/compare/1.5.3...1.5.4

[1.5.3]: https://github.com/trustwallet/wallet-connect-kotlin/compare/1.5.2...1.5.3

[1.5.2]: https://github.com/trustwallet/wallet-connect-kotlin/compare/1.5.1...1.5.2

[1.5.1]: https://github.com/trustwallet/wallet-connect-kotlin/compare/1.5.0...1.5.1

[1.5.0]: https://github.com/trustwallet/wallet-connect-kotlin/compare/1.4.9...1.5.0

[1.4.9]: https://github.com/trustwallet/wallet-connect-kotlin/compare/1.4.8...1.4.9
25 changes: 13 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 31
defaultConfig {
Expand All @@ -14,30 +12,33 @@ android {
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildFeatures {
viewBinding = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(":walletconnect")

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.31"
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.6.1'

implementation "com.squareup.okhttp3:okhttp:4.9.1"
implementation "com.google.code.gson:gson:2.8.8"
implementation "com.squareup.okhttp3:okhttp:4.9.3"
implementation "com.google.code.gson:gson:2.9.0"

implementation "com.github.TrustWallet:wallet-connect-kotlin:1.5.4"
implementation "com.trustwallet:wallet-core:2.6.33"
implementation "com.trustwallet:wallet-core:2.9.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ import com.trustwallet.walletconnect.models.binance.WCBinanceTxConfirmParam
import com.trustwallet.walletconnect.models.ethereum.WCEthereumSignMessage
import com.trustwallet.walletconnect.models.ethereum.WCEthereumTransaction
import com.trustwallet.walletconnect.models.session.WCSession
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.activity_main.view.*
import com.trustwallet.walletconnect.sample.databinding.ActivityMainBinding
import okhttp3.OkHttpClient
import wallet.core.jni.CoinType
import wallet.core.jni.PrivateKey

class MainActivity : AppCompatActivity() {

private lateinit var binding: ActivityMainBinding

private val wcClient by lazy {
WCClient(GsonBuilder(), OkHttpClient())
}
Expand All @@ -37,11 +38,18 @@ class MainActivity : AppCompatActivity() {

private var remotePeerMeta: WCPeerMeta? = null

companion object {
init {
System.loadLibrary("TrustWalletCore")
}
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

addressInput.editText?.setText(address)
binding.addressInput.editText?.setText(address)
wcClient.onDisconnect = { _, _ -> onDisconnect() }
wcClient.onFailure = { t -> onFailure(t) }
wcClient.onSessionRequest = { _, peer -> onSessionRequest(peer) }
Expand All @@ -62,9 +70,9 @@ class MainActivity : AppCompatActivity() {

private fun setupConnectButton() {
runOnUiThread {
connectButton.text = "Connect"
connectButton.setOnClickListener {
connect(uriInput.editText?.text?.toString() ?: return@setOnClickListener)
binding.connectButton.text = "Connect"
binding.connectButton.setOnClickListener {
connect(binding.uriInput.editText?.text?.toString() ?: return@setOnClickListener)
}
}
}
Expand All @@ -84,11 +92,11 @@ class MainActivity : AppCompatActivity() {
}

fun approveSession() {
val address = addressInput.editText?.text?.toString() ?: address
val chainId = chainInput.editText?.text?.toString()?.toIntOrNull() ?: 1
val address = binding.addressInput.editText?.text?.toString() ?: address
val chainId = binding.chainInput.editText?.text?.toString()?.toIntOrNull() ?: 1
wcClient.approveSession(listOf(address), chainId)
connectButton.text = "Kill Session"
connectButton.setOnClickListener {
binding.connectButton.text = "Kill Session"
binding.connectButton.setOnClickListener {
disconnect()
}
}
Expand Down Expand Up @@ -158,8 +166,8 @@ class MainActivity : AppCompatActivity() {

private fun onGetAccounts(id: Long) {
val account = WCAccount(
chainInput.editText?.text?.toString()?.toIntOrNull() ?: 1,
addressInput.editText?.text?.toString() ?: address,
binding.chainInput.editText?.text?.toString()?.toIntOrNull() ?: 1,
binding.addressInput.editText?.text?.toString() ?: address,
)
wcClient.approveRequest(id, account)
}
Expand All @@ -175,9 +183,4 @@ class MainActivity : AppCompatActivity() {
.toByteArray()
}

companion object {
init {
System.loadLibrary("TrustWalletCore")
}
}
}
8 changes: 3 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.5.31'
ext.kotlin_version = '1.6.21'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:7.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -19,7 +18,6 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
19 changes: 9 additions & 10 deletions walletconnect/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ apply plugin: 'kotlin-android'
group='com.github.TrustWallet'

android {
compileSdkVersion 28
compileSdkVersion 31


defaultConfig {
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 31
versionCode 1
versionName "1.0"

Expand All @@ -31,20 +31,19 @@ android {
}
}
compileOptions {
sourceCompatibility = "1.8"
targetCompatibility = 1.8
sourceCompatibility = "11"
targetCompatibility = 11
}
buildToolsVersion = '28.0.3'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.squareup.okhttp3:okhttp:4.7.2'
implementation 'com.google.code.gson:gson:2.8.6'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.github.salomonbrys.kotson:kotson:2.5.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.13'

testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.3'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ open class WCClient (
.firstOrNull() ?: throw InvalidJsonRpcParamsException(request.id)
onWalletAddNetwork(request.id, param)
}
null -> TODO()
}
}

Expand Down

0 comments on commit 75b2590

Please sign in to comment.