Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add network ‘testnet-migration’ #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Sources/Models/FlowChainId.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -64,6 +65,8 @@ public extension Flow {
return "mainnet"
case .testnet:
return "testnet"
case .testnetMigration:
return "testnet-migration"
case .crescendo:
return "crescendo"
case .previewnet:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions Tests/FlowAccessAPIOnMainnetTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading