diff --git a/build.gradle.kts b/build.gradle.kts index 6c4d707..2293a4f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,7 +22,7 @@ allprojects { } group = "org.onflow.flow" - val defaultVersion = "0.0.23" + val defaultVersion = "0.0.24" version = System.getenv("GITHUB_REF")?.split('/')?.last() ?: defaultVersion } diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/apis/TransactionsApi.kt b/flow/src/commonMain/kotlin/org/onflow/flow/apis/TransactionsApi.kt index cb94e45..567b320 100644 --- a/flow/src/commonMain/kotlin/org/onflow/flow/apis/TransactionsApi.kt +++ b/flow/src/commonMain/kotlin/org/onflow/flow/apis/TransactionsApi.kt @@ -105,10 +105,17 @@ internal class TransactionsApi(val baseUrl: String) : ApiBase() { // since finalized transactions haven't been executed yet return result } - + TransactionStatus.EXECUTED -> { + // Transaction is executed, return result + return result + } + TransactionStatus.SEALED -> { + // Transaction is sealed, return result + return result + } TransactionStatus.EXPIRED -> throw RuntimeException("Transaction expired") - TransactionStatus.EMPTY, TransactionStatus.UNKNOWN -> { - // Treat empty/unknown status as pending + TransactionStatus.EMPTY, TransactionStatus.UNKNOWN, TransactionStatus.PENDING -> { + // Treat empty/unknown/pending status as still processing, continue polling attempts++ // Use exponential backoff with jitter for first few attempts, then stabilize val delayMs = when { @@ -118,16 +125,6 @@ internal class TransactionsApi(val baseUrl: String) : ApiBase() { } delay(delayMs) } - - else -> { - attempts++ - val delayMs = when { - attempts <= 5 -> 1000L - attempts <= 15 -> 2000L - else -> 3000L - } - delay(delayMs) - } } } catch (e: Exception) { lastError = e