Skip to content

Commit

Permalink
fix android not running
Browse files Browse the repository at this point in the history
  • Loading branch information
Baah Kusi committed Sep 10, 2021
1 parent d33a87b commit c67f50f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 55 deletions.
10 changes: 0 additions & 10 deletions .idea/runConfigurations.xml

This file was deleted.

37 changes: 2 additions & 35 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions android/src/main/kotlin/africa/ejara/trustdart/TrustdartPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ class TrustdartPlugin: FlutterPlugin, MethodCallHandler {
"validateAddressForCoin" -> {
val address: String? = call.argument("address")
val coin: String? = call.argument("coin")
if (path != null && coin != null) {
val isValid: bool = validateAddressForCoin(coin, address)
result.success(bool)
if (address != null && coin != null) {
val isValid: Boolean = validateAddressForCoin(coin, address)
result.success(isValid)
} else {
result.error("arguments_null", "$path and $coin cannot be null", null)
result.error("arguments_null", "$address and $coin cannot be null", null)
}
}
else -> result.notImplemented()
Expand All @@ -89,25 +89,27 @@ class TrustdartPlugin: FlutterPlugin, MethodCallHandler {
mapOf("legacy" to CoinType.ETHEREUM.deriveAddress(privateKey))
}
"XTZ" -> {
CoinType.TEZOS.
mapOf("legacy" to CoinType.TEZOS.deriveAddress(privateKey))
}
else -> null
}
}

private fun validateAddressForCoin(coin: String, address: String): bool {
private fun validateAddressForCoin(coin: String, address: String): Boolean {
return when(coin) {
"BTC" -> {
CoinType.BITCOIN.validateAddress(address)
// CoinType.BITCOIN.validateAddress(address)
true
}
"ETH" -> {
CoinType.ETHEREUM.validateAddress(address)
// CoinType.ETHEREUM.validateAddress(address)
true
}
"XTZ" -> {
CoinType.TEZOS.validateAddress(address)
// CoinType.TEZOS.validateAddress(address)
true
}
else -> null
else -> false
}
}
}

0 comments on commit c67f50f

Please sign in to comment.