@@ -9,7 +9,6 @@ export interface SolidityVersion {
9
9
export interface VyperVersion {
10
10
version : string ;
11
11
longVersion : string ;
12
- build : string ;
13
12
isPrerelease : boolean ;
14
13
}
15
14
@@ -34,7 +33,7 @@ interface CompilerVersionsContextType {
34
33
const CompilerVersionsContext = createContext < CompilerVersionsContextType | undefined > ( undefined ) ;
35
34
36
35
const SOLC_VERSIONS_LIST_URL = "https://raw.githubusercontent.com/ethereum/solc-bin/gh-pages/bin/list.txt" ;
37
- const VYPER_VERSIONS_LIST_URL = "https://raw.githubusercontent.com/blockscout/solc-bin/refs/heads/main/vyper. list.json" ;
36
+ const VYPER_VERSIONS_LIST_URL = "https://vyper-releases-mirror.hardhat.org/ list.json" ;
38
37
39
38
function formatSolidityVersionName ( filename : string ) : SolidityVersion {
40
39
// Remove "soljson-v" prefix and ".js" suffix
@@ -48,11 +47,17 @@ function formatSolidityVersionName(filename: string): SolidityVersion {
48
47
} ;
49
48
}
50
49
51
- interface VyperBuild {
52
- version : string ;
53
- longVersion : string ;
54
- build : string ;
55
- prerelease ?: string ;
50
+ function getVersionWithCommit ( assetName : string ) : string {
51
+ // Remove vyper. prefix and platform suffix (.darwin, .linux, .windows.exe)
52
+ return assetName . replace ( / ^ v y p e r \. / , "" ) . replace ( / \. ( d a r w i n | l i n u x | w i n d o w s \. e x e ) $ / , "" ) ;
53
+ }
54
+
55
+ interface HardhatVyperVersion {
56
+ tag_name : string ;
57
+ assets : {
58
+ name : string ;
59
+ browser_download_url : string ;
60
+ } [ ] ;
56
61
}
57
62
58
63
export function CompilerVersionsProvider ( { children } : { children : React . ReactNode } ) {
@@ -91,13 +96,21 @@ export function CompilerVersionsProvider({ children }: { children: React.ReactNo
91
96
useEffect ( ( ) => {
92
97
fetch ( VYPER_VERSIONS_LIST_URL )
93
98
. then ( ( response ) => response . json ( ) )
94
- . then ( ( data : { builds : VyperBuild [ ] } ) => {
95
- const allVersionsList : VyperVersion [ ] = data . builds . map ( ( build ) => ( {
96
- version : build . version ,
97
- longVersion : build . longVersion ,
98
- build : build . build ,
99
- isPrerelease : ! ! build . prerelease ,
100
- } ) ) ;
99
+ . then ( ( data : HardhatVyperVersion [ ] ) => {
100
+ const allVersionsList : VyperVersion [ ] = data
101
+ . filter ( ( release ) => release . assets . length > 0 )
102
+ . map ( ( release ) => {
103
+ const versionWithCommit = getVersionWithCommit ( release . assets [ 0 ] . name ) ;
104
+ const version = release . tag_name . replace ( / ^ v / , "" ) ; // Remove 'v' prefix
105
+ // Check if tag has suffix after version (e.g., v0.4.1b1 is prerelease, v0.4.1 is not)
106
+ const isPrerelease = / ^ v \d + \. \d + \. \d + .+ / . test ( release . tag_name ) ;
107
+
108
+ return {
109
+ version,
110
+ longVersion : versionWithCommit ,
111
+ isPrerelease,
112
+ } ;
113
+ } ) ;
101
114
102
115
setVyperVersions ( allVersionsList ) ;
103
116
setOfficialVyperVersions ( allVersionsList . filter ( ( version ) => ! version . isPrerelease ) ) ;
0 commit comments