diff --git a/Sources/Starknet/Data/Block.swift b/Sources/Starknet/Data/Block.swift index eabd49e2..cdfe796d 100644 --- a/Sources/Starknet/Data/Block.swift +++ b/Sources/Starknet/Data/Block.swift @@ -2,7 +2,6 @@ public enum BlockStatus: String, Codable { case preConfirmed = "PRE_CONFIRMED" case acceptedOnL1 = "ACCEPTED_ON_L1" case acceptedOnL2 = "ACCEPTED_ON_L2" - case rejected = "REJECTED" } public protocol StarknetBlock: Codable { diff --git a/Sources/Starknet/Data/StarknetBlockId.swift b/Sources/Starknet/Data/StarknetBlockId.swift index d077ee72..00f483e5 100644 --- a/Sources/Starknet/Data/StarknetBlockId.swift +++ b/Sources/Starknet/Data/StarknetBlockId.swift @@ -2,6 +2,7 @@ import Foundation public enum StarknetBlockId: Equatable { public enum BlockTag: String, Codable { + case l1Accepted = "l1_accepted" case latest case preConfirmed = "pre_confirmed" } diff --git a/Tests/NetworkTests/Providers/ProviderTests.swift b/Tests/NetworkTests/Providers/ProviderTests.swift index f3e06b5b..b67d7fd8 100644 --- a/Tests/NetworkTests/Providers/ProviderTests.swift +++ b/Tests/NetworkTests/Providers/ProviderTests.swift @@ -16,19 +16,30 @@ final class ProviderTests: XCTestCase { provider = StarknetProvider(url: "https://rpc.pathfinder.equilibrium.co/testnet-sepolia/rpc/v0_9") } + func testGetBlockWithTxsWithL1AcceptedBlockTag() async throws { + let result = try await provider.send(request: RequestBuilder.getBlockWithTxs(StarknetBlockId.BlockTag.l1Accepted)) + + guard case .processed = result else { + XCTFail("Expected result to be of type .processed") + return + } + } + func testGetBlockWithTxsWithLatestBlockTag() async throws { let result = try await provider.send(request: RequestBuilder.getBlockWithTxs(StarknetBlockId.BlockTag.latest)) - if case .preConfirmed = result { - XCTFail("Expected .processed") + guard case .processed = result else { + XCTFail("Expected result to be of type .processed") + return } } func testGetBlockWithTxsWithPreConfirmedBlockTag() async throws { let result = try await provider.send(request: RequestBuilder.getBlockWithTxs(StarknetBlockId.BlockTag.preConfirmed)) - if case .processed = result { - XCTFail("Expected .preConfirmed") + guard case .preConfirmed = result else { + XCTFail("Expected result to be of type .preConfirmed") + return } }