Skip to content

Commit

Permalink
feat: add previewnet
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouxl committed Mar 15, 2024
1 parent ac9b3f5 commit b42992c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ https://outblock.github.io/flow-swift/
This is a Swift Package, and can be installed via Xcode with the URL of this repository:

```swift
.package(name: "Flow", url: "https://github.com/outblock/flow-swift.git", from: "0.3.4")
.package(name: "Flow", url: "https://github.com/outblock/flow-swift.git", from: "0.3.6")
```

## Config
Expand Down
14 changes: 12 additions & 2 deletions Sources/Models/FlowChainId.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ public extension Flow {
/// Default node is `access.crescendo.nodes.onflow.org:9000`
/// HTTP node `https://rest-crescendo.onflow.org/`
case crescendo


Check warning on line 45 in Sources/Models/FlowChainId.swift

View workflow job for this annotation

GitHub Actions / lint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
/// Previewnet enviroment
/// Default node is `access-previewnet.onflow.org/:9000`
/// HTTP node `https://rest-previewnet.onflow.org/`
case previewnet
/// Emulator enviroment
/// Default node is `127.0.0.1:9000`
case emulator
Expand All @@ -51,7 +55,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, .emulator]
public static var allCases: [Flow.ChainID] = [.mainnet, .testnet, .canarynet, .crescendo,.previewnet, .emulator]

Check warning on line 58 in Sources/Models/FlowChainId.swift

View workflow job for this annotation

GitHub Actions / lint

Comma Spacing Violation: There should be no space before and one after any comma (comma)

/// Name of the chain id
public var name: String {
Expand All @@ -62,6 +66,8 @@ public extension Flow {
return "testnet"
case .crescendo:
return "crescendo"
case .previewnet:
return "previewnet"
case .canarynet:
return "canarynet"
case .emulator:
Expand Down Expand Up @@ -98,6 +104,8 @@ public extension Flow {
return .HTTP(URL(string: "http://127.0.0.1:8888/")!)
case .crescendo:
return .HTTP(URL(string: "https://rest-crescendo.onflow.org/")!)
case .previewnet:
return .HTTP(URL(string: "https://rest-previewnet.onflow.org/")!)
case let .custom(_, transport):
return transport
default:
Expand All @@ -116,6 +124,8 @@ public extension Flow {
return .gRPC(.init(node: "access.canary.nodes.onflow.org", port: 9000))
case .crescendo:
return .gRPC(.init(node: "access.crescendo.nodes.onflow.org", port: 9000))
case .previewnet:
return .gRPC(.init(node: "access-previewnet.onflow.org", port: 9000))
case .emulator:
return .gRPC(.init(node: "127.0.0.1", port: 9000))
case let .custom(_, endpoint):
Expand Down

0 comments on commit b42992c

Please sign in to comment.