Skip to content

Commit 6c5cab3

Browse files
committed
Add retry mechanism to getLatestBlock
1 parent e749918 commit 6c5cab3

File tree

3 files changed

+1
-5
lines changed

3 files changed

+1
-5
lines changed

kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/AccessAPIConnectorTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import java.math.BigDecimal
1515

1616
@FlowEmulatorProjectTest(flowJsonLocation = "../flow/flow.json")
1717
internal class AccessAPIConnectorTest {
18-
1918
// user key pairs using all supported signing algorithms
2019
private val userKeyPairs = arrayOf(
2120
Crypto.generateKeyPair(SignatureAlgorithm.ECDSA_P256),
@@ -63,7 +62,6 @@ internal class AccessAPIConnectorTest {
6362
accessAPIConnector.transferTokens(sender, to, amount)
6463
}
6564

66-
6765
@Test
6866
fun `Can transfer tokens to other account`() {
6967
val amount = BigDecimal("10.00000001")

kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getProtocolState/GetProtocolStateAccessAPIConnectorTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ internal class GetProtocolStateAccessAPIConnectorTest {
3838

3939
@Test
4040
fun `Can get protocol state snapshot by height`() {
41-
4241
val latestSnapshot: FlowSnapshot = protocolStateConnector.getProtocolStateSnapshotByHeight(block.height)
4342
assertNotNull(latestSnapshot, ("Snapshot should not be null"))
4443
}

kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getTransaction/GetTransactionAccessAPIConnectorTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import org.junit.jupiter.api.Assertions.*
66
import org.junit.jupiter.api.BeforeEach
77
import org.junit.jupiter.api.Test
88
import org.onflow.examples.kotlin.AccessAPIConnector
9-
import org.onflow.examples.kotlin.AccessAPIConnectorTest
109
import org.onflow.flow.common.test.FlowEmulatorProjectTest
1110
import org.onflow.flow.common.test.FlowServiceAccountCredentials
1211
import org.onflow.flow.common.test.FlowTestClient
@@ -68,7 +67,7 @@ internal class GetTransactionAccessAPIConnectorTest {
6867
}
6968

7069
companion object {
71-
fun fetchLatestBlockWithRetries(accessAPI : FlowAccessApi, retries: Int = 5, delayMillis: Long = 500): FlowBlock {
70+
fun fetchLatestBlockWithRetries(accessAPI: FlowAccessApi, retries: Int = 5, delayMillis: Long = 500): FlowBlock {
7271
repeat(retries) { attempt ->
7372
when (val response = accessAPI.getLatestBlock()) {
7473
is FlowAccessApi.AccessApiCallResponse.Success -> return response.data

0 commit comments

Comments
 (0)