Skip to content

Commit 65484cb

Browse files
committed
Change default block status to sealed
1 parent 9de140f commit 65484cb

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

flow/src/commonMain/kotlin/org/onflow/flow/FlowApi.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ class FlowApi(val chainId: ChainIdProvider) {
2929
private val scriptsApi = ScriptsApi(baseUrl)
3030
private val transactionsApi = TransactionsApi(baseUrl)
3131

32-
suspend fun getAccount(address: String, blockHeight: String? = null, blockStatus: BlockStatus = BlockStatus.FINAL): Account {
32+
suspend fun getAccount(address: String, blockHeight: String? = null, blockStatus: BlockStatus = BlockStatus.SEALED): Account {
3333
return accountsApi.getAccount(address, blockHeight, blockStatus)
3434
}
3535

36-
suspend fun getBlock(id: String? = null, blockHeight: String? = null, blockStatus: BlockStatus = BlockStatus.FINAL): Block {
36+
suspend fun getBlock(id: String? = null, blockHeight: String? = null, blockStatus: BlockStatus = BlockStatus.SEALED): Block {
3737
return blocksApi.getBlock(id, blockHeight, blockStatus)
3838
}
3939

4040
suspend fun getBlockHeader(
4141
id: String? = null,
4242
blockHeight: String? = null,
43-
blockStatus: BlockStatus = BlockStatus.FINAL
43+
blockStatus: BlockStatus = BlockStatus.SEALED
4444
): BlockHeader {
4545
return blocksApi.getBlockHeader(id, blockHeight, blockStatus)
4646
}
@@ -71,7 +71,7 @@ class FlowApi(val chainId: ChainIdProvider) {
7171
arguments: List<Cadence.Value>? = null,
7272
blockId: String? = null,
7373
blockHeight: String? = null,
74-
blockStatus: BlockStatus = BlockStatus.FINAL
74+
blockStatus: BlockStatus = BlockStatus.SEALED
7575
): Cadence.Value {
7676
return scriptsApi.executeScript(script, arguments, blockId, blockHeight, blockStatus)
7777
}

flow/src/commonMain/kotlin/org/onflow/flow/apis/AccountsApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ internal class AccountsApi(val baseUrl: String) : ApiBase() {
3737
* @param blockStatus The status of the block to query (FINAL or SEALED). Defaults to FINAL.
3838
* @return Account
3939
*/
40-
internal suspend fun getAccount(address: String, blockHeight: String? = null, blockStatus: BlockStatus = BlockStatus.FINAL): Account {
40+
internal suspend fun getAccount(address: String, blockHeight: String? = null, blockStatus: BlockStatus = BlockStatus.SEALED): Account {
4141
val expand = setOf("contracts", "keys")
4242
return if (blockHeight != null) {
4343
request(address, blockHeight, expand)

flow/src/commonMain/kotlin/org/onflow/flow/apis/BlocksApi.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ internal class BlocksApi(val baseUrl: String) : ApiBase() {
5454
}.body()
5555
}
5656

57-
internal suspend fun getBlock(id: String? = null, blockHeight: String? = null, blockStatus: BlockStatus = BlockStatus.FINAL): Block {
57+
internal suspend fun getBlock(id: String? = null, blockHeight: String? = null, blockStatus: BlockStatus = BlockStatus.SEALED): Block {
5858
val expand = setOf("payload")
5959
return if (id != null) {
6060
requestBlocksById(id, expand).first()
@@ -68,7 +68,7 @@ internal class BlocksApi(val baseUrl: String) : ApiBase() {
6868
internal suspend fun getBlockHeader(
6969
id: String? = null,
7070
blockHeight: String? = null,
71-
blockStatus: BlockStatus = BlockStatus.FINAL
71+
blockStatus: BlockStatus = BlockStatus.SEALED
7272
): BlockHeader {
7373
return getBlock(id, blockHeight, blockStatus).header
7474
}

flow/src/commonMain/kotlin/org/onflow/flow/apis/ScriptsApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ScriptsApi(val baseUrl: String) : ApiBase() {
5656
arguments: List<Cadence.Value>? = null,
5757
blockId: String? = null,
5858
blockHeight: String? = null,
59-
blockStatus: BlockStatus = BlockStatus.FINAL
59+
blockStatus: BlockStatus = BlockStatus.SEALED
6060
): Cadence.Value {
6161
val request = ScriptsPostRequest(
6262
script.encodeBase64(),

flow/src/commonTest/kotlin/org/onflow/flow/FlowApiTests.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ class FlowApiTests {
9191
fun testGetBlockWithHeight() {
9292
runBlocking {
9393
// First get a block to use its height
94-
val initialBlock = api.getBlock()
94+
val initialBlock = api.getBlock(blockStatus = BlockStatus.SEALED)
9595
val blockHeight = initialBlock.header.height
9696

9797
// Test getting block at specific height
98-
val block = api.getBlock(blockHeight = blockHeight)
98+
val block = api.getBlock(blockHeight = blockHeight, blockStatus = BlockStatus.SEALED)
9999
assertNotNull(block)
100100
assertEquals(blockHeight, block.header.height)
101101
}
@@ -105,11 +105,11 @@ class FlowApiTests {
105105
fun testGetBlockWithId() {
106106
runBlocking {
107107
// First get a block to use its ID
108-
val initialBlock = api.getBlock()
108+
val initialBlock = api.getBlock(blockStatus = BlockStatus.SEALED)
109109
val blockId = initialBlock.header.id
110110

111111
// Test getting block by ID
112-
val block = api.getBlock(id = blockId)
112+
val block = api.getBlock(id = blockId, blockStatus = BlockStatus.SEALED)
113113
assertNotNull(block)
114114
assertEquals(blockId, block.header.id)
115115
}

0 commit comments

Comments
 (0)