...
 
Commits (2)
......@@ -5,14 +5,14 @@ apply plugin: 'idea'
apply plugin: 'com.kezong.fat-aar'
android {
compileSdkVersion 29
compileSdkVersion 30
buildToolsVersion "29.0.3"
defaultConfig {
minSdkVersion 24
targetSdkVersion 29
versionCode 16
versionName "1.5.6"
targetSdkVersion 30
testApplicationId "io.camlcase.javatezos.test"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
......
......@@ -26,7 +26,7 @@ import java.io.InputStream
import java.security.Key
import java.security.MessageDigest
enum class EllipticalCurve {
enum class EllipticCurve {
ED25519
}
......
......@@ -66,7 +66,7 @@ data class PublicKey(
}
override fun getAlgorithm(): String {
return EllipticalCurve.ED25519.name // Not supported in Java yet
return EllipticCurve.ED25519.name // Not supported in Java yet
}
override fun getEncoded(): ByteArray {
......
......@@ -37,7 +37,7 @@ data class SecretKey(
}
override fun getAlgorithm(): String {
return EllipticalCurve.ED25519.name
return EllipticCurve.ED25519.name
}
override fun getEncoded(): ByteArray {
......
......@@ -46,7 +46,8 @@ internal val ENGLISH_MNEMONICS: List<String> by lazy {
"actress",
"actual",
"adapt",
"add", "addict",
"add",
"addict",
"address",
"adjust",
"admit",
......
......@@ -27,7 +27,7 @@ package io.camlcase.javatezos.model
data class RPCErrorResponse(
val type: RPCErrorType,
val cause: String,
val message : String? = null,
val message: String? = null,
val contract: String? = null
)
......@@ -44,7 +44,7 @@ enum class OperationResultStatus {
SUCCESS,
APPLIED;
companion object{
companion object {
fun get(status: String?): OperationResultStatus {
val found = values().firstOrNull { it.name.equals(status, true) }
return found ?: FAILED
......@@ -59,3 +59,36 @@ enum class OperationResultStatus {
}
}
}
/**
* Translates RPC error messages to more human readable causes. Keep in mind some of them might share error messages
* and other context checks might be needed to ensure the match.
*
* Search for [values] inside the [RPCErrorResponse.cause] attribute.
*/
enum class RPCErrorCause(vararg val values: String) {
/**
* Sending to correctly-formatted but nonexistent address.
*
* - When sending XTZ we receive a verbose error that shows a:
* * Unhandled error (Failure \"Invalid contract notation\")
* message hidden in between.
*
* - When sending FA1.2 tokens, the smart contract should return both:
* * contract.invalid_contract_notation
* * invalidSyntacticConstantError
*/
INVALID_CONTRACT(
"contract.invalid_contract_notation",
"invalidSyntacticConstantError",
"Invalid contract notation"
),
/**
* Not enough XTZ balance to cover fees and gas of an operation.
*/
INSUFFICIENT_XTZ_BALANCE(
"contract.balance_too_low",
"contract.cannot_pay_storage_fee"
)
}