main.org.onflow.flow.sdk.FlowAccessApi.kt Maven / Gradle / Ivy
package org.onflow.flow.sdk
import com.google.protobuf.ByteString
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.ReceiveChannel
interface FlowAccessApi {
sealed class AccessApiCallResponse {
data class Success(val data: T) : AccessApiCallResponse()
data class Error(val message: String, val throwable: Throwable? = null) : AccessApiCallResponse()
}
fun ping(): AccessApiCallResponse
fun getLatestBlockHeader(sealed: Boolean = true): AccessApiCallResponse
fun getBlockHeaderById(id: FlowId): AccessApiCallResponse
fun getBlockHeaderByHeight(height: Long): AccessApiCallResponse
fun getLatestBlock(sealed: Boolean = true): AccessApiCallResponse
fun getBlockById(id: FlowId): AccessApiCallResponse
fun getBlockByHeight(height: Long): AccessApiCallResponse
fun getCollectionById(id: FlowId): AccessApiCallResponse
fun sendTransaction(transaction: FlowTransaction): AccessApiCallResponse
fun getTransactionById(id: FlowId): AccessApiCallResponse
fun getTransactionResultById(id: FlowId): AccessApiCallResponse
@Deprecated(
message = "Behaves identically to getAccountAtLatestBlock",
replaceWith = ReplaceWith("getAccountAtLatestBlock")
)
fun getAccountByAddress(addresss: FlowAddress): AccessApiCallResponse
fun getAccountAtLatestBlock(addresss: FlowAddress): AccessApiCallResponse
fun getAccountByBlockHeight(addresss: FlowAddress, height: Long): AccessApiCallResponse
fun executeScriptAtLatestBlock(script: FlowScript, arguments: Iterable = emptyList()): AccessApiCallResponse
fun executeScriptAtBlockId(script: FlowScript, blockId: FlowId, arguments: Iterable = emptyList()): AccessApiCallResponse
fun executeScriptAtBlockHeight(script: FlowScript, height: Long, arguments: Iterable = emptyList()): AccessApiCallResponse
fun getEventsForHeightRange(type: String, range: ClosedRange): AccessApiCallResponse>
fun getEventsForBlockIds(type: String, ids: Set): AccessApiCallResponse>
fun getNetworkParameters(): AccessApiCallResponse
fun getLatestProtocolStateSnapshot(): AccessApiCallResponse
fun getTransactionsByBlockId(id: FlowId): AccessApiCallResponse>
fun getTransactionResultsByBlockId(id: FlowId): AccessApiCallResponse>
fun getExecutionResultByBlockId(id: FlowId): AccessApiCallResponse
fun subscribeExecutionDataByBlockId(
scope: CoroutineScope,
blockId: FlowId
): Pair, ReceiveChannel>
fun subscribeExecutionDataByBlockHeight(
scope: CoroutineScope,
height: Long
): Pair, ReceiveChannel>
fun subscribeEventsByBlockId(
scope: CoroutineScope,
blockId: FlowId
): Pair>, ReceiveChannel>
fun subscribeEventsByBlockHeight(
scope: CoroutineScope,
height: Long
): Pair>, ReceiveChannel>
}