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

feat: prepare NextNet network #1018

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/src/main/cpp/jniWallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ Java_com_tari_android_wallet_ffi_FFIWallet_jniCreate(
jobject jThis,
jobject jpWalletConfig,
jstring jLogPath,
jint logVerbosity,
jint maxNumberOfRollingLogFiles,
jint rollingLogFileMaxSizeBytes,
jstring jPassphrase,
Expand Down Expand Up @@ -443,6 +444,7 @@ Java_com_tari_android_wallet_ffi_FFIWallet_jniCreate(
TariWallet *pWallet = wallet_create(
pWalletConfig,
pLogPath,
logVerbosity,
static_cast<unsigned int>(maxNumberOfRollingLogFiles),
static_cast<unsigned int>(rollingLogFileMaxSizeBytes),
pPassphrase,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ class BaseNodes(
startSync()
}
}
@Suppress("UNUSED_EXPRESSION")

private fun getBaseNodeResource(network: Network): Int = when (network) {
else -> R.raw.stagenet_base_nodes
Network.STAGENET -> R.raw.stagenet_base_nodes
Network.NEXTNET -> R.raw.nextnet_base_nodes
else -> error("No base nodes for network: $network")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class NetworkRepositoryImpl(sharedPrefs: SharedPreferences) : NetworkRepository
try {
currentNetwork!!.network.displayName
} catch (e: Throwable) {
currentNetwork = getStagenet()
currentNetwork = getNextnet()
}
}

override var ffiNetwork: Network? by SharedPrefGsonDelegate(sharedPrefs, SimpleRepository(this), formatKey(Keys.ffiNetwork), Network::class.java)

override var incompatibleNetworkShown by SharedPrefBooleanDelegate(sharedPrefs, SimpleRepository(this), formatKey(Keys.networkIncompatible), false)

override fun getAllNetworks(): List<TariNetwork> = listOf(getStagenet())
override fun getAllNetworks(): List<TariNetwork> = listOf(getNextnet())

object Keys {
const val currentNetwork = "tari_current_network"
Expand All @@ -39,5 +39,6 @@ class NetworkRepositoryImpl(sharedPrefs: SharedPreferences) : NetworkRepository
private const val testNetThicker = "tXTR"

fun getStagenet(): TariNetwork = TariNetwork(Network.STAGENET, testNetThicker)
fun getNextnet(): TariNetwork = TariNetwork(Network.NEXTNET, testNetThicker)
}
}
5 changes: 5 additions & 0 deletions app/src/main/java/com/tari/android/wallet/ffi/FFIWallet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
*/
package com.tari.android.wallet.ffi

import com.tari.android.wallet.BuildConfig
import com.tari.android.wallet.data.sharedPrefs.SharedPrefsRepository
import com.tari.android.wallet.data.sharedPrefs.network.NetworkRepository
import com.tari.android.wallet.data.sharedPrefs.security.SecurityPrefRepository
Expand Down Expand Up @@ -61,6 +62,8 @@ class FFIWallet(
private val coroutineContext = Job()
private var localScope = CoroutineScope(coroutineContext)

private val logVerbosity: Int = if (BuildConfig.BUILD_TYPE == "debug") 11 else 2

companion object {
private var atomicInstance = AtomicReference<FFIWallet>()
var instance: FFIWallet?
Expand All @@ -71,6 +74,7 @@ class FFIWallet(
private external fun jniCreate(
commsConfig: FFICommsConfig,
logPath: String,
logVerbosity: Int,
maxNumberOfRollingLogFiles: Int,
rollingLogFileMaxSizeBytes: Int,
passphrase: String?,
Expand Down Expand Up @@ -236,6 +240,7 @@ class FFIWallet(
jniCreate(
commsConfig,
logPath,
logVerbosity,
Constants.Wallet.maxNumberOfRollingLogFiles,
Constants.Wallet.rollingLogFileMaxSizeBytes,
passphrase,
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/raw/nextnet_base_nodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NextNet 01::0cff11dff44458bfea3e39444d440e54260746ff2a5ce6a6c3f7355decff2167::/ip4/54.195.217.107/tcp/18189
NextNet 02::0cff11dff44458bfea3e39444d440e54260746ff2a5ce6a6c3f7355decff2167::/onion3/h6oj2cusgtaxo63zbfw2wjir4mltkqzz4jquoak2i5mvgyszaieowwad:18141
NextNet 03::4c236de788e803ef9615f72a4d973cf3f8a9b83c9d2fb176cbaf65c1b0442572::/onion3/3jtk3e2ud3zqtbrq36sw6ata6u5epkjmqgr5tfuemcfpyhisrzkgbtyd:18141
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {

// JNI libs
ext.libwalletHostURL = "https://github.com/tari-project/tari/releases/download/"
ext.libwalletVersion = "v0.52.0"
ext.libwalletVersion = "v1.0.0-rc.1"
ext.libwalletx64A = "libminotari_wallet_ffi.android_x86_64.a"
ext.libwalletArmA = "libminotari_wallet_ffi.android_aarch64.a"
ext.libwalletHeader = "libminotari_wallet_ffi.h"
Expand All @@ -29,7 +29,7 @@ buildscript {
}

plugins {
id "de.undercouch.download" version "4.0.4"
id "de.undercouch.download" version "4.1.0"
}

allprojects {
Expand Down