diff --git a/Sources/Models/FlowChainId.swift b/Sources/Models/FlowChainId.swift index 0445a4b..cfa849a 100644 --- a/Sources/Models/FlowChainId.swift +++ b/Sources/Models/FlowChainId.swift @@ -33,7 +33,8 @@ public extension Flow { /// Default gRPC node is `access.devnet.nodes.onflow.org:9000` /// HTTP node `https://rest-mainnet.onflow.org/` case testnet - + + case testnetMigration /// Canarynet enviroment /// Default node is `access.canary.nodes.onflow.org:9000` case canarynet @@ -55,7 +56,7 @@ public extension Flow { case custom(name: String, transport: Flow.Transport) /// List of other type chain id exclude custom type - public static var allCases: [Flow.ChainID] = [.mainnet, .testnet, .canarynet, .crescendo,.previewnet, .emulator] + public static var allCases: [Flow.ChainID] = [.mainnet, .testnet, .testnetMigration, .canarynet, .crescendo,.previewnet, .emulator] /// Name of the chain id public var name: String { @@ -64,6 +65,8 @@ public extension Flow { return "mainnet" case .testnet: return "testnet" + case .testnetMigration: + return "testnet-migration" case .crescendo: return "crescendo" case .previewnet: @@ -100,6 +103,8 @@ public extension Flow { return .HTTP(URL(string: "https://rest-mainnet.onflow.org/")!) case .testnet: return .HTTP(URL(string: "https://rest-testnet.onflow.org/")!) + case .testnetMigration: + return .HTTP(URL(string: "https://rest-migrationtestnet.onflow.org/v1/")!) case .emulator: return .HTTP(URL(string: "http://127.0.0.1:8888/")!) case .crescendo: @@ -120,6 +125,8 @@ public extension Flow { return .gRPC(.init(node: "access.mainnet.nodes.onflow.org", port: 9000)) case .testnet: return .gRPC(.init(node: "access.devnet.nodes.onflow.org", port: 9000)) + case .testnetMigration: + return .gRPC(.init(node: "access.devnet.nodes.onflow.org", port: 9000)) case .canarynet: return .gRPC(.init(node: "access.canary.nodes.onflow.org", port: 9000)) case .crescendo: diff --git a/Tests/FlowAccessAPIOnMainnetTests.swift b/Tests/FlowAccessAPIOnMainnetTests.swift index 67fb0a9..274a18a 100644 --- a/Tests/FlowAccessAPIOnMainnetTests.swift +++ b/Tests/FlowAccessAPIOnMainnetTests.swift @@ -231,8 +231,11 @@ final class FlowAccessAPIOnMainnetTests: XCTestCase { let id: UInt64 let from: String } - - let test: TestType = try result.events.first!.payload.decode() + guard let event = result.events.first else { + + return + } + let test: TestType = try event.payload.decode() XCTAssertEqual(result.events.first?.payload.fields?.type, .event) XCTAssertEqual(test.id, 11800)