@@ -6,39 +6,12 @@ import { arch, platform } from "@tauri-apps/plugin-os";
6
6
import { download } from "@tauri-apps/plugin-upload" ;
7
7
import { fetch } from "@tauri-apps/plugin-http" ;
8
8
import { Child , Command } from "@tauri-apps/plugin-shell" ;
9
- import { mkdir , exists , readDir , BaseDirectory } from "@tauri-apps/plugin-fs" ;
9
+ import { mkdir , exists } from "@tauri-apps/plugin-fs" ;
10
10
import { Footer } from "./components" ;
11
11
import { useStore } from "./store" ;
12
+ import { getNetworks , getPlatformArch , urlNetwork } from "./utils" ;
12
13
import "./App.css" ;
13
14
14
- const urlNetwork = "https://test.net.zknet.io" ;
15
-
16
- // Map the os platform and architecture to a supported ZKN format
17
- const getPlatformArch = ( ) : string => {
18
- const platArch = `${ platform ( ) } -${ arch ( ) } ` ;
19
- switch ( platArch ) {
20
- case "linux-aarch64" :
21
- return "linux-arm64" ;
22
- case "linux-x86_64" :
23
- return "linux-x64" ;
24
- case "macos-aarch64" :
25
- case "macos-x86_64" :
26
- return "macos" ;
27
- case "windows-x86_64" :
28
- return "windows-x64" ;
29
- default :
30
- throw new Error ( `Unsupported Operating System: ${ platArch } ` ) ;
31
- }
32
- } ;
33
-
34
- // Get networks with previously downloaded assets
35
- const getNetworks = async ( ) => {
36
- const entries = await readDir ( "networks" , {
37
- baseDir : BaseDirectory . AppLocalData ,
38
- } ) ;
39
- return entries . filter ( ( i ) => i . isDirectory ) . map ( ( i ) => i . name ) ;
40
- } ;
41
-
42
15
function App ( ) {
43
16
const [ msg , setMsg ] = useState ( "" ) ;
44
17
const [ msgType , setMsgType ] = useState ( "" ) ; // error, info, success
0 commit comments