Skip to content

Commit 5beee9c

Browse files
Support RPC 0.9.0-rc.2 (#246)
1 parent 789940e commit 5beee9c

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

Sources/Starknet/Data/Block.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ public enum BlockStatus: String, Codable {
22
case preConfirmed = "PRE_CONFIRMED"
33
case acceptedOnL1 = "ACCEPTED_ON_L1"
44
case acceptedOnL2 = "ACCEPTED_ON_L2"
5-
case rejected = "REJECTED"
65
}
76

87
public protocol StarknetBlock: Codable {

Sources/Starknet/Data/StarknetBlockId.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Foundation
22

33
public enum StarknetBlockId: Equatable {
44
public enum BlockTag: String, Codable {
5+
case l1Accepted = "l1_accepted"
56
case latest
67
case preConfirmed = "pre_confirmed"
78
}

Tests/NetworkTests/Providers/ProviderTests.swift

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,30 @@ final class ProviderTests: XCTestCase {
1616
provider = StarknetProvider(url: "https://rpc.pathfinder.equilibrium.co/testnet-sepolia/rpc/v0_9")
1717
}
1818

19+
func testGetBlockWithTxsWithL1AcceptedBlockTag() async throws {
20+
let result = try await provider.send(request: RequestBuilder.getBlockWithTxs(StarknetBlockId.BlockTag.l1Accepted))
21+
22+
guard case .processed = result else {
23+
XCTFail("Expected result to be of type .processed")
24+
return
25+
}
26+
}
27+
1928
func testGetBlockWithTxsWithLatestBlockTag() async throws {
2029
let result = try await provider.send(request: RequestBuilder.getBlockWithTxs(StarknetBlockId.BlockTag.latest))
2130

22-
if case .preConfirmed = result {
23-
XCTFail("Expected .processed")
31+
guard case .processed = result else {
32+
XCTFail("Expected result to be of type .processed")
33+
return
2434
}
2535
}
2636

2737
func testGetBlockWithTxsWithPreConfirmedBlockTag() async throws {
2838
let result = try await provider.send(request: RequestBuilder.getBlockWithTxs(StarknetBlockId.BlockTag.preConfirmed))
2939

30-
if case .processed = result {
31-
XCTFail("Expected .preConfirmed")
40+
guard case .preConfirmed = result else {
41+
XCTFail("Expected result to be of type .preConfirmed")
42+
return
3243
}
3344
}
3445

0 commit comments

Comments
 (0)