-
Notifications
You must be signed in to change notification settings - Fork 911
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(experimental): add
ClusterUrl
types
As per @lorisleiva's suggestion, here's some types for cluster URLs! Straight from [this comment](#2053 (comment))
- Loading branch information
1 parent
e9c1b10
commit 61f7ba0
Showing
2 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export type MainnetUrl = string & { '~cluster': 'mainnet' }; | ||
export type DevnetUrl = string & { '~cluster': 'devnet' }; | ||
export type TestnetUrl = string & { '~cluster': 'testnet' }; | ||
export type ClusterUrl = string | MainnetUrl | DevnetUrl | TestnetUrl; | ||
|
||
export function mainnet(putativeString: string): MainnetUrl { | ||
return putativeString as MainnetUrl; | ||
} | ||
export function devnet(putativeString: string): DevnetUrl { | ||
return putativeString as DevnetUrl; | ||
} | ||
export function testnet(putativeString: string): TestnetUrl { | ||
return putativeString as TestnetUrl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters