diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 23e71efd..a7c5f2db 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] kotlin = "1.8.22" kotlin_coroutines = "1.6.4" -assetClassification = "3.8.1" +assetClassification = "3.9.0" bouncyCastle = "1.70" detekt = "1.18.1" grpc = "1.51.3" diff --git a/models/src/main/kotlin/io/provenance/api/models/p8e/ProvenanceConfig.kt b/models/src/main/kotlin/io/provenance/api/models/p8e/ProvenanceConfig.kt index 7afe24da..c8cfb6ce 100644 --- a/models/src/main/kotlin/io/provenance/api/models/p8e/ProvenanceConfig.kt +++ b/models/src/main/kotlin/io/provenance/api/models/p8e/ProvenanceConfig.kt @@ -8,4 +8,5 @@ data class ProvenanceConfig( val gasAdjustment: Double? = 1.5, val broadcastMode: ServiceOuterClass.BroadcastMode = ServiceOuterClass.BroadcastMode.BROADCAST_MODE_BLOCK, val feeGranter: String? = null, + val timeoutHeight: Long? = null, ) diff --git a/service/src/main/kotlin/io/provenance/api/frameworks/provenance/ProvenanceService.kt b/service/src/main/kotlin/io/provenance/api/frameworks/provenance/ProvenanceService.kt index 28c206f8..94fd229d 100644 --- a/service/src/main/kotlin/io/provenance/api/frameworks/provenance/ProvenanceService.kt +++ b/service/src/main/kotlin/io/provenance/api/frameworks/provenance/ProvenanceService.kt @@ -79,7 +79,7 @@ class ProvenanceService : Provenance { sequenceOffset = offset, ) - val tx = messages.toTxBody(pbClient) + val tx = config.timeoutHeight?.let { messages.toTxBody(timeoutHeight = it) } ?: messages.toTxBody(pbClient) val result = pbClient.estimateAndBroadcastTx( txBody = tx, @@ -123,7 +123,8 @@ class ProvenanceService : Provenance { options = BroadcastOptions( broadcastMode = config.broadcastMode, sequenceOffset = offset, - baseAccount = account + baseAccount = account, + timeoutHeight = config.timeoutHeight, ) ) }.txResponse.toTxResponse() @@ -142,7 +143,8 @@ class ProvenanceService : Provenance { options = BroadcastOptions( broadcastMode = config.broadcastMode, sequenceOffset = offset, - baseAccount = account + baseAccount = account, + timeoutHeight = config.timeoutHeight, ) ) }.txResponse.toTxResponse() diff --git a/service/src/main/kotlin/io/provenance/api/frameworks/provenance/extensions/ProvenanceExtensions.kt b/service/src/main/kotlin/io/provenance/api/frameworks/provenance/extensions/ProvenanceExtensions.kt index f336a8ba..39c4b121 100644 --- a/service/src/main/kotlin/io/provenance/api/frameworks/provenance/extensions/ProvenanceExtensions.kt +++ b/service/src/main/kotlin/io/provenance/api/frameworks/provenance/extensions/ProvenanceExtensions.kt @@ -54,6 +54,12 @@ fun Iterable.toTxBody(pbClient: PbClient) = .addAllMessages(this) .build() +internal fun Iterable.toTxBody(timeoutHeight: Long): TxOuterClass.TxBody = + TxOuterClass.TxBody.newBuilder() + .setTimeoutHeight(timeoutHeight) + .addAllMessages(this) + .build() + fun Any.toTxBody(pbClient: PbClient) = TxOuterClass.TxBody.newBuilder() .setTimeoutHeight(getCurrentHeight(pbClient) + 12L)