@@ -42,7 +42,7 @@ public protocol FlowAccessProtocol {
4242
4343 /// Get latest block header
4444 /// - Returns: Most recent block header
45- func getLatestBlockHeader( ) async throws -> Flow . BlockHeader
45+ func getLatestBlockHeader( blockStatus : Flow . BlockStatus ) async throws -> Flow . BlockHeader
4646
4747 /// Get block header by ID
4848 /// - Parameter id: Block identifier
@@ -51,7 +51,7 @@ public protocol FlowAccessProtocol {
5151
5252 func getBlockHeaderByHeight( height: UInt64 ) async throws -> Flow . BlockHeader
5353
54- func getLatestBlock( sealed : Bool ) async throws -> Flow . Block
54+ func getLatestBlock( blockStatus : Flow . BlockStatus ) async throws -> Flow . Block
5555
5656 func getBlockById( id: Flow . ID ) async throws -> Flow . Block
5757
@@ -65,13 +65,13 @@ public protocol FlowAccessProtocol {
6565
6666 func getTransactionResultById( id: Flow . ID ) async throws -> Flow . TransactionResult
6767
68- func getAccountAtLatestBlock( address: Flow . Address ) async throws -> Flow . Account
68+ func getAccountAtLatestBlock( address: Flow . Address , blockStatus : Flow . BlockStatus ) async throws -> Flow . Account
6969
7070 func getAccountByBlockHeight( address: Flow . Address , height: UInt64 ) async throws -> Flow . Account
7171
72- func executeScriptAtLatestBlock( script: Flow . Script , arguments: [ Flow . Argument ] ) async throws -> Flow . ScriptResponse
72+ func executeScriptAtLatestBlock( script: Flow . Script , arguments: [ Flow . Argument ] , blockStatus : Flow . BlockStatus ) async throws -> Flow . ScriptResponse
7373
74- func executeScriptAtLatestBlock( script: Flow . Script , arguments: [ Flow . Cadence . FValue ] ) async throws -> Flow . ScriptResponse
74+ func executeScriptAtLatestBlock( script: Flow . Script , arguments: [ Flow . Cadence . FValue ] , blockStatus : Flow . BlockStatus ) async throws -> Flow . ScriptResponse
7575
7676 func executeScriptAtBlockId( script: Flow . Script , blockId: Flow . ID , arguments: [ Flow . Argument ] ) async throws -> Flow . ScriptResponse
7777
@@ -91,8 +91,17 @@ public protocol FlowAccessProtocol {
9191}
9292
9393public extension FlowAccessProtocol {
94- func getAccountAtLatestBlock( address: String ) async throws -> Flow . Account {
95- return try await getAccountAtLatestBlock ( address: . init( hex: address. addHexPrefix ( ) ) )
94+
95+ func getLatestBlockHeader( blockStatus: Flow . BlockStatus = . final) async throws -> Flow . BlockHeader {
96+ return try await getLatestBlockHeader ( blockStatus: blockStatus)
97+ }
98+
99+ func getAccountAtLatestBlock( address: Flow . Address , blockStatus: Flow . BlockStatus = . final) async throws -> Flow . Account {
100+ return try await getAccountAtLatestBlock ( address: address, blockStatus: blockStatus)
101+ }
102+
103+ func getAccountAtLatestBlock( address: String , blockStatus: Flow . BlockStatus = . final) async throws -> Flow . Account {
104+ return try await getAccountAtLatestBlock ( address: . init( hex: address. addHexPrefix ( ) ) , blockStatus: blockStatus)
96105 }
97106
98107 func getTransactionById( id: String ) async throws -> Flow . Transaction {
@@ -104,24 +113,28 @@ public extension FlowAccessProtocol {
104113 }
105114
106115 func getLatestBlock( sealed: Bool = true ) async throws -> Flow . Block {
107- return try await getLatestBlock ( sealed : sealed )
116+ return try await getLatestBlock ( blockStatus : . final )
108117 }
109118
110- func executeScriptAtLatestBlock( cadence: String , arguments: [ Flow . Argument ] = [ ] ) async throws -> Flow . ScriptResponse {
111- return try await executeScriptAtLatestBlock ( script: . init( text: cadence) , arguments: arguments)
119+ func executeScriptAtLatestBlock( cadence: String , arguments: [ Flow . Argument ] = [ ] , blockStatus : Flow . BlockStatus = . final ) async throws -> Flow . ScriptResponse {
120+ return try await executeScriptAtLatestBlock ( script: . init( text: cadence) , arguments: arguments, blockStatus : blockStatus )
112121 }
113122
114- func executeScriptAtLatestBlock( cadence: String , arguments: [ Flow . Cadence . FValue ] = [ ] ) async throws -> Flow . ScriptResponse {
115- return try await executeScriptAtLatestBlock ( script: . init( text: cadence) , arguments: arguments. map { $0 . toArgument ( ) } )
123+ func executeScriptAtLatestBlock( cadence: String , arguments: [ Flow . Cadence . FValue ] = [ ] , blockStatus : Flow . BlockStatus = . final ) async throws -> Flow . ScriptResponse {
124+ return try await executeScriptAtLatestBlock ( script: . init( text: cadence) , arguments: arguments, blockStatus : blockStatus )
116125 }
117126
118- func executeScriptAtLatestBlock( script: Flow . Script ) async throws -> Flow . ScriptResponse {
127+ func executeScriptAtLatestBlock( script: Flow . Script , blockStatus : Flow . BlockStatus = . final ) async throws -> Flow . ScriptResponse {
119128 let list : [ Flow . Argument ] = [ ]
120- return try await executeScriptAtLatestBlock ( script: script, arguments: list)
129+ return try await executeScriptAtLatestBlock ( script: script, arguments: list, blockStatus: blockStatus)
130+ }
131+
132+ func executeScriptAtLatestBlock( script: Flow . Script , arguments: [ Flow . Argument ] , blockStatus: Flow . BlockStatus = . final) async throws -> Flow . ScriptResponse {
133+ return try await executeScriptAtLatestBlock ( script: script, arguments: arguments, blockStatus: blockStatus)
121134 }
122135
123- func executeScriptAtLatestBlock( script: Flow . Script , arguments: [ Flow . Cadence . FValue ] ) async throws -> Flow . ScriptResponse {
124- return try await executeScriptAtLatestBlock ( script: script, arguments: arguments. map { $0. toArgument ( ) } )
136+ func executeScriptAtLatestBlock( script: Flow . Script , arguments: [ Flow . Cadence . FValue ] , blockStatus : Flow . BlockStatus = . final ) async throws -> Flow . ScriptResponse {
137+ return try await executeScriptAtLatestBlock ( script: script, arguments: arguments. map { $0. toArgument ( ) } , blockStatus : blockStatus )
125138 }
126139
127140 func executeScriptAtBlockId( script: Flow . Script , blockId: Flow . ID , arguments: [ Flow . Argument ] = [ ] ) async throws -> Flow . ScriptResponse {
0 commit comments