Commit ce4c6dc1 authored by pokkst's avatar pokkst

Move getBlockiesAddressFromTokenId from SLPWalletHelper to WalletManager. Delete SLPWalletHelper.kt

parent de09bc1a
No preview for this file type
......@@ -19,7 +19,6 @@ import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.utils.Constants
import app.crescentcash.src.utils.PermissionHelper
import app.crescentcash.src.utils.PrefsUtil
import app.crescentcash.src.wallet.SLPWalletHelper
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.firebase.FirebaseApp
import org.bitcoinj.utils.MonetaryFormat
......@@ -85,7 +84,7 @@ class MainActivity : AppCompatActivity() {
this.initListeners()
FirebaseApp.initializeApp(this)
NetManager.establishProxy()
SLPWalletHelper.setAPIKey()
WalletManager.setAPIKey()
isNewUser = !File(this.applicationInfo.dataDir + "/users_wallet.wallet").exists()
......
......@@ -18,7 +18,6 @@ import app.crescentcash.src.manager.UIManager
import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.ui.NonScrollListView
import app.crescentcash.src.utils.Constants
import app.crescentcash.src.wallet.SLPWalletHelper
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.luminiasoft.ethereum.blockiesandroid.BlockiesIdenticon
import java.math.BigDecimal
......@@ -127,7 +126,7 @@ class TokensListActivity : AppCompatActivity() {
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
// Get the Item from ListView
val view = LayoutInflater.from(this@TokensListActivity).inflate(R.layout.list_view_activity, null)
val slpBlockiesAddress = SLPWalletHelper.blockieAddressFromTokenId(WalletManager.tokenList[position]["tokenHash"]
val slpBlockiesAddress = WalletManager.blockieAddressFromTokenId(WalletManager.tokenList[position]["tokenHash"]
?: error(""))
val slpImage = view.findViewById<BlockiesIdenticon>(R.id.slpImage)
......
......@@ -24,6 +24,7 @@ import app.crescentcash.src.utils.PrefsUtil
import app.crescentcash.src.utils.UtxoUtil
import com.bitcoin.slpwallet.Network
import com.bitcoin.slpwallet.SLPWallet
import com.bitcoin.slpwallet.SLPWalletConfig
import com.bitcoin.slpwallet.presentation.BalanceInfo
import com.google.common.collect.ImmutableList
import com.google.common.util.concurrent.FutureCallback
......@@ -845,5 +846,13 @@ class WalletManager {
return null
}
fun setAPIKey() {
SLPWalletConfig.restAPIKey = "slpsdkH6aIcXEApC4wXQfqqPH"
}
fun blockieAddressFromTokenId(tokenId: String): String {
return tokenId.slice(IntRange(12, tokenId.count() - 1))
}
}
}
\ No newline at end of file
package app.crescentcash.src.wallet
import com.bitcoin.slpwallet.SLPWalletConfig
class SLPWalletHelper {
companion object {
fun setAPIKey() {
SLPWalletConfig.restAPIKey = "slpsdkH6aIcXEApC4wXQfqqPH"
}
fun blockieAddressFromTokenId(tokenId: String): String {
return tokenId.slice(IntRange(12, tokenId.count() - 1))
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment