Skip to content

Commit f75391d

Browse files
committed
refactor: add default walletshield address constant
1 parent 19dec46 commit f75391d

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/pages/Networks.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import { platform } from "@tauri-apps/plugin-os";
77
import { Child, Command } from "@tauri-apps/plugin-shell";
88
import { download } from "@tauri-apps/plugin-upload";
99
import { useStore } from "../store";
10-
import { getNetworks, urlNetwork } from "../utils";
10+
import {
11+
defaultWalletshieldListenAddress,
12+
getNetworks,
13+
urlNetwork,
14+
} from "../utils";
1115

1216
export function Networks() {
1317
const [dlProgress, setDlProgress] = useState(0);
@@ -144,8 +148,8 @@ export function Networks() {
144148
////////////////////////////////////////////////////////////////////////
145149
setMessage("info", "Starting network client...");
146150
const cmd = "walletshield";
147-
const listen = walletshieldListenAddress ?? ":7070";
148-
const args = ["-listen", listen, "-config", "client.toml"];
151+
const wla = walletshieldListenAddress ?? defaultWalletshieldListenAddress;
152+
const args = ["-listen", wla, "-config", "client.toml"];
149153
const command = Command.create("walletshield-listen", args, {
150154
cwd: dirNetwork,
151155
env: {

src/pages/Settings.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useEffect, useState } from "react";
22
import { useStore } from "../store";
3+
import { defaultWalletshieldListenAddress } from "../utils";
34

45
export function Settings() {
56
const [listenAddress, setListenAddress] = useState("");
@@ -43,7 +44,7 @@ export function Settings() {
4344
<input
4445
type="text"
4546
className="input validator"
46-
placeholder=":7070"
47+
placeholder={defaultWalletshieldListenAddress}
4748
value={listenAddress}
4849
onChange={(e) => setListenAddress(e.target.value)}
4950
pattern="^((\d{1,3}\.){3}\d{1,3}|[a-zA-Z0-9.-]+)?:(\d{1,5})$"

src/utils/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { BaseDirectory, readDir } from "@tauri-apps/plugin-fs";
22
import { arch, platform } from "@tauri-apps/plugin-os";
33

4+
export const defaultWalletshieldListenAddress = ":7070";
5+
46
export const urlNetwork = "https://test.net.zknet.io";
57

68
// Map the os platform and architecture to a supported ZKN format

0 commit comments

Comments
 (0)