Skip to content

Commit

Permalink
Fix missing 'previewnet' in cleanNetwork method and FlowNetwork (#1870
Browse files Browse the repository at this point in the history
)
  • Loading branch information
btspoony committed May 13, 2024
1 parent 7ef7edf commit ad089fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/long-books-own.md
@@ -0,0 +1,5 @@
---
"@onflow/config": minor
---

Add previewnet to config.load
9 changes: 5 additions & 4 deletions packages/config/src/utils/utils.ts
@@ -1,4 +1,4 @@
type FlowNetwork = "emulator" | "testnet" | "mainnet"
type FlowNetwork = "emulator" | "testnet" | "mainnet" | "previewnet"
export interface FlowJson {
networks?: {
[key in FlowNetwork]?: string
Expand Down Expand Up @@ -237,17 +237,18 @@ export const anyHasPrivateKeys = (value: FlowJson | FlowJson[]) => {
}

/**
* @description Format network to always be 'emulator', 'testnet', or 'mainnet'
* @description Format network to always be 'emulator', 'testnet', 'previewnet' or 'mainnet'
* @param network - Network to format
* @returns Formatted network name (either 'emulator', 'testnet', or 'mainnet')
* @returns Formatted network name (either 'emulator', 'testnet', 'previewnet' or 'mainnet')
*/
export const cleanNetwork = (network: string): FlowNetwork => {
const cleanedNetwork =
network?.toLowerCase() === "local" ? "emulator" : network?.toLowerCase()
if (
cleanedNetwork === "emulator" ||
cleanedNetwork === "testnet" ||
cleanedNetwork === "mainnet"
cleanedNetwork === "mainnet" ||
cleanedNetwork === "previewnet"
)
return cleanedNetwork

Expand Down

0 comments on commit ad089fe

Please sign in to comment.