From 25734ec08f61eff3f12a38f628dc7300b1c3db03 Mon Sep 17 00:00:00 2001 From: JC Date: Sun, 4 Aug 2024 18:27:20 -0600 Subject: [PATCH] fix: new version 1.4.3 & dead code removed & DRY shield button handle --- bin/printversion.ps1 | 2 +- bin/printversion.sh | 2 +- native/src/lib.rs | 6 +- package.json | 2 +- public/electron.js | 106 ------------- src/App.tsx | 7 +- .../appstate/components/ValueTransfer.ts | 3 +- src/components/dashboard/Dashboard.tsx | 65 +------- .../components/AddressBalanceItem.tsx | 1 - src/components/history/History.tsx | 48 +++++- src/components/history/components/VtModal.tsx | 2 - src/components/insight/Insight.tsx | 10 -- .../loadingscreen/LoadingScreen.tsx | 15 -- src/components/logo/Logo.tsx | 2 +- src/components/receive/Receive.module.css | 4 +- src/components/receive/Receive.tsx | 55 +------ .../receive/components/AddressBlock.tsx | 90 ++--------- src/components/scrollPane/ScrollPane.tsx | 3 - src/components/send/Send.tsx | 112 +++++++------- .../send/components/ConfirmModal.tsx | 12 +- .../serverselectmodal/ServerSelectModal.tsx | 14 -- src/components/sidebar/Sidebar.tsx | 140 +----------------- src/react-app-env.d.ts | 4 - src/root/Routes.tsx | 70 ++++++++- src/rpc/rpc.ts | 27 +--- src/utils/uris.ts | 4 +- src/utils/utils.ts | 4 - 27 files changed, 215 insertions(+), 595 deletions(-) diff --git a/bin/printversion.ps1 b/bin/printversion.ps1 index c897ff8e..2552ea1d 100644 --- a/bin/printversion.ps1 +++ b/bin/printversion.ps1 @@ -1 +1 @@ -echo "VERSION=1.1.0" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append +echo "VERSION=1.4.3" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append diff --git a/bin/printversion.sh b/bin/printversion.sh index 1d36ba07..ec198d56 100755 --- a/bin/printversion.sh +++ b/bin/printversion.sh @@ -1,3 +1,3 @@ #!/bin/bash -VERSION="1.1.0" +VERSION="1.4.3" echo "VERSION=$VERSION" >> $GITHUB_ENV diff --git a/native/src/lib.rs b/native/src/lib.rs index a1b9345a..3d8da347 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -109,7 +109,7 @@ fn zingolib_wallet_exists(mut cx: FunctionContext) -> JsResult { Ok(cx.boolean(config.wallet_path_exists())) } -/// Create a new wallet and return the seed for the newly created wallet. +// Create a new wallet and return the seed for the newly created wallet. fn zingolib_init_new(mut cx: FunctionContext) -> JsResult { let server_uri = cx.argument::(0)?.value(&mut cx); let chain_hint = cx.argument::(1)?.value(&mut cx); @@ -139,7 +139,7 @@ fn zingolib_init_new(mut cx: FunctionContext) -> JsResult { Ok(cx.string(resp())) } -/// Restore a wallet from the seed phrase +// Restore a wallet from the seed phrase fn zingolib_init_from_seed(mut cx: FunctionContext) -> JsResult { let server_uri = cx.argument::(0)?.value(&mut cx); let seed = cx.argument::(1)?.value(&mut cx); @@ -299,8 +299,6 @@ fn zingolib_execute_async(mut cx: FunctionContext) -> JsResult { deferred.settle_with(&channel, move |mut cx| Ok(cx.string(resp))); - // Settle the promise based on the response - //deferred.resolve(&mut cx, cx.string(&resp)); }); // Return the promise back to JavaScript diff --git a/package.json b/package.json index ba69d82f..1a9a0b32 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "zingo-pc", "productName": "Zingo PC", - "version": "1.1.0", + "version": "1.4.3", "private": true, "description": "Zingo PC", "license": "MIT", diff --git a/public/electron.js b/public/electron.js index 787c565c..fdba33d9 100644 --- a/public/electron.js +++ b/public/electron.js @@ -121,18 +121,6 @@ class MenuBuilder { mainWindow.webContents.send("change"); }, }, - //{ - // label: "&Import Private Keys", - // click: () => { - // mainWindow.webContents.send("import"); - // }, - //}, - //{ - // label: "&Export All Private Keys", - // click: () => { - // mainWindow.webContents.send("exportall"); - // }, - //}, { type: "separator" }, { label: "&Pay URI", @@ -159,27 +147,6 @@ class MenuBuilder { this.mainWindow.webContents.send("zcashd"); }, }, - // { type: "separator" }, - // { - // label: "Remove Wallet Encryption", - // click: () => { - // this.mainWindow.webContents.send("decrypt"); - // }, - // }, - // { - // label: "Unlock", - // click: () => { - // this.mainWindow.webContents.send("unlock"); - // }, - // }, - // { type: 'separator' }, - // { - // label: 'Toggle Developer Tools', - // accelerator: 'Alt+Command+I', - // click: () => { - // this.mainWindow.toggleDevTools(); - // } - // } ], }; const subMenuViewProd = { @@ -198,18 +165,6 @@ class MenuBuilder { mainWindow.webContents.send("change"); }, }, - //{ - // label: "&Import Private Keys", - // click: () => { - // mainWindow.webContents.send("import"); - // }, - //}, - //{ - // label: "&Export All Private Keys", - // click: () => { - // mainWindow.webContents.send("exportall"); - // }, - //}, { type: "separator" }, { label: "&Pay URI", @@ -242,19 +197,6 @@ class MenuBuilder { this.mainWindow.webContents.send("zcashd"); }, }, - // { type: "separator" }, - // { - // label: "Remove Wallet Encryption", - // click: () => { - // this.mainWindow.webContents.send("decrypt"); - // }, - // }, - // { - // label: "Unlock", - // click: () => { - // this.mainWindow.webContents.send("unlock"); - // }, - // }, ], }; const subMenuWindow = { @@ -273,16 +215,9 @@ class MenuBuilder { const subMenuHelp = { label: "Help", submenu: [ - //{ - // label: "Donate", - // click() { - // mainWindow.webContents.send("donate"); - // }, - //}, { label: "Check github.com for updates", click() { - //shell.openExternal("https://github.com/zingolabs/zingo-pc/releases"); shell.openExternal("https://github.com/zingolabs/zingo-pc"); }, }, @@ -339,20 +274,6 @@ class MenuBuilder { mainWindow.webContents.send("change"); }, }, - // { - // label: "&Import Private Keys", - // click: () => { - // // Uninplemented by Zingolib - // mainWindow.webContents.send("import"); - // }, - // }, - // { - // label: "&Export All Private Keys", - // click: () => { - // // Uninplemented by Zingolib - // mainWindow.webContents.send("exportall"); - // }, - // }, { type: "separator" }, { label: "Export All &Transactions", @@ -378,25 +299,6 @@ class MenuBuilder { this.mainWindow.webContents.send("zcashd"); }, }, - // { - // label: 'Devtools', - // click: () => { - // mainWindow.webContents.openDevTools(); - // } - // }, - // { type: "separator" }, - // { - // label: "Remove Wallet Encryption", - // click: () => { - // this.mainWindow.webContents.send("decrypt"); - // }, - // }, - // { - // label: "Unlock", - // click: () => { - // this.mainWindow.webContents.send("unlock"); - // }, - // }, ], }, { @@ -408,12 +310,6 @@ class MenuBuilder { mainWindow.webContents.send("about"); }, }, - //{ - // label: "Donate", - // click() { - // mainWindow.webContents.send("donate"); - // }, - //}, { label: "Check github.com for updates", click() { @@ -480,8 +376,6 @@ function createWindow() { }); ipcMain.on("apprestart", () => { - //console.log(process.argv); - //console.log(process.argv.slice(1).concat(['--relaunch'])); app.relaunch({ args: process.argv.slice(1).concat(['--relaunch']) }) app.exit(0) }); diff --git a/src/App.tsx b/src/App.tsx index 344a408a..3fdb8f19 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,19 +1,14 @@ import logo from "./assets/img/logobig.png"; import "./App.css"; -//import addon from "./native.node"; - function App() { - //console.log("Addon is:"); - //console.log(addon); return (

Built using CRA electron-builder-typescript Template.

- {/*

{addon.zingolib_say_hello("Me")}

*/} logo -

Zingo PC v1.1.0

+

Zingo PC v1.4.3

Edit public/electron.js or src/App.js and save to reload.

diff --git a/src/components/appstate/components/ValueTransfer.ts b/src/components/appstate/components/ValueTransfer.ts index 09872c75..91e08fe5 100644 --- a/src/components/appstate/components/ValueTransfer.ts +++ b/src/components/appstate/components/ValueTransfer.ts @@ -1,6 +1,5 @@ -// List of transactions. TODO: Handle memos, multiple addresses etc... export default class ValueTransfer { - type: 'sent' | 'received' | 'send-to-self' | 'memo-to-self' | 'shield'; // like kind + type: 'sent' | 'received' | 'send-to-self' | 'memo-to-self' | 'shield'; fee?: number; confirmations: number; txid: string; diff --git a/src/components/dashboard/Dashboard.tsx b/src/components/dashboard/Dashboard.tsx index 05ccf353..42cfccca 100644 --- a/src/components/dashboard/Dashboard.tsx +++ b/src/components/dashboard/Dashboard.tsx @@ -12,12 +12,11 @@ import { ContextApp } from "../../context/ContextAppState"; import { Address } from "../appstate"; type DashboardProps = { - shieldTransparentBalanceToOrchard: () => Promise; - openErrorModal: (title: string, body: string | JSX.Element) => void; calculateShieldFee: () => Promise; + handleShieldButton: () => void; }; -const Dashboard: React.FC = ({shieldTransparentBalanceToOrchard, openErrorModal, calculateShieldFee}) => { +const Dashboard: React.FC = ({calculateShieldFee, handleShieldButton}) => { const context = useContext(ContextApp); const { totalBalance, info, addresses, readOnly, fetchError } = context; @@ -38,64 +37,6 @@ const Dashboard: React.FC = ({shieldTransparentBalanceToOrchard, // eslint-disable-next-line react-hooks/exhaustive-deps }, [totalBalance.transparent, anyPending]); - const shieldButton = () => { - openErrorModal("Computing Transaction", "Please wait...This could take a while"); - - setTimeout(() => { - (async () => { - try { - const result: string = await shieldTransparentBalanceToOrchard(); - console.log('shielding balance', result); - - if (result.toLocaleLowerCase().startsWith('error')) { - openErrorModal("Error Shielding Transaction", `${result}`); - return; - } - const resultJSON = JSON.parse(result); - if (resultJSON.txids) { - openErrorModal( - "Successfully Broadcast Transaction", -
-
-
{(resultJSON.txids.length === 1 ? 'Transaction was' : 'Transactions were') + ' successfully broadcast.'}
-
{`TXID: ${resultJSON.txids[0]}`}
- {resultJSON.txids.length > 1 && ( -
{`TXID: ${resultJSON.txids[1]}`}
- )} - {resultJSON.txids.length > 2 && ( -
{`TXID: ${resultJSON.txids[2]}`}
- )} -
-
Utils.openTxid(resultJSON.txids[0], info.currencyName)}> - View TXID   - -
- {resultJSON.txids.length > 1 && ( -
Utils.openTxid(resultJSON.txids[1], info.currencyName)}> - View TXID   - -
- )} - {resultJSON.txids.length > 2 && ( -
Utils.openTxid(resultJSON.txids[2], info.currencyName)}> - View TXID   - -
- )} -
- ); - } - if (resultJSON.error) { - openErrorModal("Error Shielding Transaction", `${resultJSON.error}`); - } - } catch (err) { - // If there was an error, show the error modal - openErrorModal("Error Shielding Transaction", `${err}`); - } - })(); - }, 10); - }; - console.log('shield fee', shieldFee); return ( @@ -130,7 +71,7 @@ const Dashboard: React.FC = ({shieldTransparentBalanceToOrchard,
{totalBalance.transparent >= shieldFee && shieldFee > 0 && !readOnly && !anyPending && ( <> - diff --git a/src/components/dashboard/components/AddressBalanceItem.tsx b/src/components/dashboard/components/AddressBalanceItem.tsx index 04ba1de3..d5065494 100644 --- a/src/components/dashboard/components/AddressBalanceItem.tsx +++ b/src/components/dashboard/components/AddressBalanceItem.tsx @@ -49,7 +49,6 @@ const AddressBalanceItem: React.FC = ({ currencyName, z
- {/* Add label displaying receiver types */} {item.type === AddressType.unified && !!item.receivers && (
Address types: {Utils.getReceivers(item.receivers).join(" + ")} diff --git a/src/components/history/History.tsx b/src/components/history/History.tsx index ddc5c178..74502e1b 100644 --- a/src/components/history/History.tsx +++ b/src/components/history/History.tsx @@ -1,7 +1,7 @@ import React, { useContext, useEffect, useState } from "react"; import cstyles from "../common/Common.module.css"; import styles from "./History.module.css"; -import { ValueTransfer, AddressBookEntry } from "../appstate"; +import { ValueTransfer, AddressBookEntry, Address } from "../appstate"; import ScrollPane from "../scrollPane/ScrollPane"; import { ZcashURITarget } from "../../utils/uris"; import VtItemBlock from "./components/VtItemBlock"; @@ -12,11 +12,13 @@ import { ContextApp } from "../../context/ContextAppState"; type HistoryProps = { setSendTo: (targets: ZcashURITarget[] | ZcashURITarget) => void; + calculateShieldFee: () => Promise; + handleShieldButton: () => void; }; -const History: React.FC = ({ setSendTo }) => { +const History: React.FC = ({ setSendTo, calculateShieldFee, handleShieldButton }) => { const context = useContext(ContextApp); - const { valueTransfers, info, addressBook, totalBalance } = context; + const { valueTransfers, info, addressBook, totalBalance, addresses, readOnly, fetchError } = context; const [valueTransferDetail, setValueTransferDetail] = useState(undefined); const [valueTransferDetailIndex, setValueTransferDetailIndex] = useState(-1); @@ -26,6 +28,23 @@ const History: React.FC = ({ setSendTo }) => { const [valueTransfersSorted, setValueTransfersSorted] = useState([]); const [addressBookMap, setAddressBookMap] = useState>(new Map()); + const [anyPending, setAnyPending] = useState(false); + const [shieldFee, setShieldFee] = useState(0); + + useEffect(() => { + const _anyPending: Address | undefined = !!addresses && addresses.find((i: Address) => i.containsPending === true); + setAnyPending(!!_anyPending); + }, [addresses]); + + useEffect(() => { + if (totalBalance.transparent > 0) { + (async () => { + setShieldFee(await calculateShieldFee()); + })(); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [totalBalance.transparent, anyPending]); + useEffect(() => { setIsLoadMoreEnabled(valueTransfers && numVtnsToShow < valueTransfers.length); }, [numVtnsToShow, valueTransfers]); @@ -119,11 +138,32 @@ const History: React.FC = ({ setSendTo }) => { currencyName={info.currencyName} />
+
+ {totalBalance.transparent >= shieldFee && shieldFee > 0 && !readOnly && !anyPending && ( + <> + + + )} + {!!anyPending && ( +
+ Some transactions are pending. Balances may change. +
+ )} +
+ {!!fetchError && !!fetchError.error && ( + <> +
+
+ {fetchError.command + ': ' + fetchError.error} +
+ + )}
History
- {/* Change the hardcoded height */} {!valueTransfersSorted && (
Loading...
diff --git a/src/components/history/components/VtModal.tsx b/src/components/history/components/VtModal.tsx index ea195768..cdc7cbea 100644 --- a/src/components/history/components/VtModal.tsx +++ b/src/components/history/components/VtModal.tsx @@ -70,10 +70,8 @@ const VtModalInternal: React.FC = ({ }; useEffect(() => { - // Suscribirse al evento de teclado cuando el componente se monta window.addEventListener('keydown', handleKeyDown); return () => { - // Limpiar el evento cuando el componente se desmonta window.removeEventListener('keydown', handleKeyDown); }; // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/src/components/insight/Insight.tsx b/src/components/insight/Insight.tsx index 79cabd29..0f41f8f8 100644 --- a/src/components/insight/Insight.tsx +++ b/src/components/insight/Insight.tsx @@ -1,7 +1,6 @@ import React, { useContext, useEffect, useState } from "react"; import styles from "./Insight.module.css"; import cstyles from "../common/Common.module.css"; -//import { AddressBookEntry } from "../appstate"; import ScrollPane from "../scrollPane/ScrollPane"; import Utils from "../../utils/utils"; import { ContextApp } from "../../context/ContextAppState"; @@ -29,9 +28,6 @@ const Insight: React.FC = () => { const context = useContext(ContextApp); const { addressBook } = context; - //const [expandAddressSent, setExpandAddressSent] = useState([]); - //const [expandAddressSends, setExpandAddressSends] = useState([]); - //const [expandAddressMemobytes, setExpandAddressMemobytes] = useState([]); const [dataSent, setDataSent] = useState({} as Data); const [dataSends, setDataSends] = useState({} as Data); const [dataMemobytes, setDataMemobytes] = useState({} as Data); @@ -82,8 +78,6 @@ const Insight: React.FC = () => { } as Dataset, ], } as Data); - //const newExpandAddress = Array(newData.length).fill(false); - //setExpandAddressSent(newExpandAddress) } const fetchDataSends: () => void = async () => { @@ -121,8 +115,6 @@ const Insight: React.FC = () => { } as Dataset, ], } as Data); - //const newExpandAddress = Array(newData.length).fill(false); - //setExpandAddressSends(newExpandAddress); } const fetchDataMemobytes: () => void = async () => { @@ -160,8 +152,6 @@ const Insight: React.FC = () => { } as Dataset, ], } as Data); - //const newExpandAddress = Array(newData.length).fill(false); - //setExpandAddressMemobytes(newExpandAddress); } const getPercent = (percent: number) => { diff --git a/src/components/loadingscreen/LoadingScreen.tsx b/src/components/loadingscreen/LoadingScreen.tsx index 7a094fd6..4b4c4ef5 100644 --- a/src/components/loadingscreen/LoadingScreen.tsx +++ b/src/components/loadingscreen/LoadingScreen.tsx @@ -442,14 +442,6 @@ class LoadingScreen extends Component let's go to dashboard if (ss.sync_id > prevSyncId || !ss.in_progress || ss.batch_num >= 25) { - // First, save the wallet so we don't lose the just-synced data - //if (!ss.last_error) { - // RPC.doSave(); - //} - - // Set the info object, so the sidebar will show - //console.log("Object info\n"); - //console.log(info); setInfo(info); setRescanning(false, prevSyncId); @@ -474,13 +466,6 @@ class LoadingScreen extends Component= myThis.state.nextSaveBatch) { - // console.log('&&&&&&&&&&&&&&&&&&&&&&&&&&& save wallet', ss.batch_num, myThis.state.nextSaveBatch); - // RPC.doSave(); - // myThis.setState({ nextSaveBatch: ss.batch_num + 2}); - //} - let base = 0; if (ss.batch_total) { base = (ss.batch_num * 100) / ss.batch_total; diff --git a/src/components/logo/Logo.tsx b/src/components/logo/Logo.tsx index 762805ba..184970e7 100644 --- a/src/components/logo/Logo.tsx +++ b/src/components/logo/Logo.tsx @@ -10,7 +10,7 @@ const Logo = ({ readOnly }: LogoProps) => { return ( <> -
Zingo PC v1.1.0
+
Zingo PC v1.4.3
logo {readOnly && ( diff --git a/src/components/receive/Receive.module.css b/src/components/receive/Receive.module.css index 8bc603fa..c0cc1072 100644 --- a/src/components/receive/Receive.module.css +++ b/src/components/receive/Receive.module.css @@ -13,7 +13,7 @@ } .receiveQrcode { - padding: 8px; + padding: 0px; background-color: white; - margin-right: 5px; + margin: 5px; } diff --git a/src/components/receive/Receive.tsx b/src/components/receive/Receive.tsx index 7a7ede95..46a4b16d 100644 --- a/src/components/receive/Receive.tsx +++ b/src/components/receive/Receive.tsx @@ -10,20 +10,17 @@ import AddressBlock from "./components/AddressBlock"; import { ContextApp } from "../../context/ContextAppState"; type ReceiveProps = { - fetchAndSetSinglePrivKey: (k: string) => void; - fetchAndSetSingleViewKey: (k: string) => void; - //createNewAddress: (t: AddressType) => void; - shieldTransparentBalanceToOrchard: () => Promise; calculateShieldFee: () => Promise; - openErrorModal: (title: string, body: string | JSX.Element) => void; + handleShieldButton: () => void; }; -const Receive: React.FC = ({ fetchAndSetSinglePrivKey, fetchAndSetSingleViewKey, shieldTransparentBalanceToOrchard, calculateShieldFee, openErrorModal }) => { +const Receive: React.FC = ({ + calculateShieldFee, + handleShieldButton, +}) => { const context = useContext(ContextApp); const { addresses, - addressPrivateKeys, - addressViewKeys, addressBook, info, receivePageState, @@ -117,27 +114,16 @@ const Receive: React.FC = ({ fetchAndSetSinglePrivKey, fetchAndSet currencyName={info.currencyName} label={addressBookMap.get(a.address)} zecPrice={info.zecPrice} - privateKey={addressPrivateKeys.get(a.address)} - viewKey={addressViewKeys.get(a.address)} - fetchAndSetSinglePrivKey={fetchAndSetSinglePrivKey} - fetchAndSetSingleViewKey={fetchAndSetSingleViewKey} + handleShieldButton={handleShieldButton} /> ))} )} - {/**/} - {/* Change the hardcoded height */} {zaddrs && zaddrs.length > 0 && ( @@ -148,29 +134,16 @@ const Receive: React.FC = ({ fetchAndSetSinglePrivKey, fetchAndSet currencyName={info.currencyName} label={addressBookMap.get(a.address)} zecPrice={info.zecPrice} - privateKey={addressPrivateKeys.get(a.address)} - viewKey={addressViewKeys.get(a.address)} - fetchAndSetSinglePrivKey={fetchAndSetSinglePrivKey} - fetchAndSetSingleViewKey={fetchAndSetSingleViewKey} - openErrorModal={openErrorModal} + handleShieldButton={handleShieldButton} /> ))} )} - - {/**/} - {/* Change the hardcoded height */} {taddrs && taddrs.length > 0 && ( @@ -181,25 +154,13 @@ const Receive: React.FC = ({ fetchAndSetSinglePrivKey, fetchAndSet currencyName={info.currencyName} label={addressBookMap.get(a.address)} zecPrice={info.zecPrice} - privateKey={addressPrivateKeys.get(a.address)} - viewKey={addressViewKeys.get(a.address)} - fetchAndSetSinglePrivKey={fetchAndSetSinglePrivKey} - fetchAndSetSingleViewKey={fetchAndSetSingleViewKey} - shieldTransparentBalanceToOrchard={shieldTransparentBalanceToOrchard} calculateShieldFee={calculateShieldFee} - openErrorModal={openErrorModal} + handleShieldButton={handleShieldButton} /> ))} )} - {/**/} diff --git a/src/components/receive/components/AddressBlock.tsx b/src/components/receive/components/AddressBlock.tsx index 0dfbfadc..a826e3b8 100644 --- a/src/components/receive/components/AddressBlock.tsx +++ b/src/components/receive/components/AddressBlock.tsx @@ -16,16 +16,11 @@ const { clipboard } = window.require("electron"); type AddressBlockProps = { address: Address; + label?: string; currencyName: string; zecPrice: number; - privateKey?: string; - viewKey?: string; - label?: string; - fetchAndSetSinglePrivKey: (k: string) => void; - fetchAndSetSingleViewKey: (k: string) => void; - shieldTransparentBalanceToOrchard?: () => Promise; calculateShieldFee?: () => Promise; - openErrorModal?: (title: string, body: string | JSX.Element) => void; + handleShieldButton: () => void; }; const AddressBlock: React.FC = ({ @@ -33,13 +28,8 @@ const AddressBlock: React.FC = ({ label, currencyName, zecPrice, - privateKey, - fetchAndSetSinglePrivKey, - viewKey, - fetchAndSetSingleViewKey, - shieldTransparentBalanceToOrchard, calculateShieldFee, - openErrorModal, + handleShieldButton }) => { const context = useContext(ContextApp); const { readOnly, addresses } = context; @@ -73,68 +63,6 @@ const AddressBlock: React.FC = ({ } }, [balance, calculateShieldFee, type, anyPending]); - - const shieldButton = () => { - if (!shieldTransparentBalanceToOrchard || !openErrorModal) { - return; - } - openErrorModal("Computing Transaction", "Please wait...This could take a while"); - - setTimeout(() => { - (async () => { - try { - const result: string = await shieldTransparentBalanceToOrchard(); - console.log('shielding balance', result); - - if (result.toLocaleLowerCase().startsWith('error')) { - openErrorModal("Error Shielding Transaction", `${result}`); - return; - } - const resultJSON = JSON.parse(result); - if (resultJSON.txids) { - openErrorModal( - "Successfully Broadcast Transaction", -
-
-
{(resultJSON.txids.length === 1 ? 'Transaction was' : 'Transactions were') + ' successfully broadcast.'}
-
{`TXID: ${resultJSON.txids[0]}`}
- {resultJSON.txids.length > 1 && ( -
{`TXID: ${resultJSON.txids[1]}`}
- )} - {resultJSON.txids.length > 2 && ( -
{`TXID: ${resultJSON.txids[2]}`}
- )} -
-
Utils.openTxid(resultJSON.txids[0], currencyName)}> - View TXID   - -
- {resultJSON.txids.length > 1 && ( -
Utils.openTxid(resultJSON.txids[1], currencyName)}> - View TXID   - -
- )} - {resultJSON.txids.length > 2 && ( -
Utils.openTxid(resultJSON.txids[2], currencyName)}> - View TXID   - -
- )} -
- ); - } - if (resultJSON.error) { - openErrorModal("Error Shielding Transaction", `${resultJSON.error}`); - } - } catch (err) { - // If there was an error, show the error modal - openErrorModal("Error Shielding Transaction", `${err}`); - } - })(); - }, 10); - }; - const handleQRCodeClick = async () => { console.log('____________ click processed'); const canvas: HTMLCanvasElement | null = document.querySelector("canvas"); @@ -173,19 +101,19 @@ const AddressBlock: React.FC = ({ )} {type === AddressType.unified && !!receivers && ( -
+
Address types: {Utils.getReceivers(receivers).join(" + ")}
)} {type === AddressType.sapling && ( -
+
Address type: Sapling
)} {type === AddressType.transparent && ( -
+
Address type: Transparent
)} @@ -209,12 +137,12 @@ const AddressBlock: React.FC = ({ {copied ? Copied! : Copy Address} - {type === AddressType.transparent && balance >= shieldFee && shieldFee > 0 && !readOnly && ( <> - @@ -224,7 +152,7 @@ const AddressBlock: React.FC = ({
{/* // @ts-ignore */} - +
{'Click to download'}
diff --git a/src/components/scrollPane/ScrollPane.tsx b/src/components/scrollPane/ScrollPane.tsx index 6f5e5b31..61df6bfe 100644 --- a/src/components/scrollPane/ScrollPane.tsx +++ b/src/components/scrollPane/ScrollPane.tsx @@ -9,9 +9,6 @@ type ScrollPaneProps = { const ScrollPane: React.FC = ({ children, className, offsetHeight }) => { const [height, setHeight] = useState(0); - /** - * Calculate & Update state of height, needed for the scrolling - */ const updateDimensions = useCallback(() => { const updateHeight = window.innerHeight - offsetHeight; setHeight(updateHeight); diff --git a/src/components/send/Send.tsx b/src/components/send/Send.tsx index eae728d6..3873ab07 100644 --- a/src/components/send/Send.tsx +++ b/src/components/send/Send.tsx @@ -21,17 +21,14 @@ import { ContextApp } from "../../context/ContextAppState"; import native from "../../native.node"; import getSendManyJSON from "./components/getSendManyJSON"; -//type OptionType = { -// value: string; -// label: string; -//}; - type SendProps = { setSendTo: (targets: ZcashURITarget[] | ZcashURITarget) => void; sendTransaction: (sendJson: SendManyJsonType[], setSendProgress: (p?: SendProgress) => void) => Promise; setSendPageState: (sendPageState: SendPageState) => void; openErrorModal: (title: string, body: string | JSX.Element) => void; openPasswordAndUnlockIfNeeded: (successCallback: () => void) => void; + calculateShieldFee: () => Promise; + handleShieldButton: () => void; }; const Send: React.FC = ({ @@ -40,6 +37,8 @@ const Send: React.FC = ({ setSendPageState, openErrorModal, openPasswordAndUnlockIfNeeded, + calculateShieldFee, + handleShieldButton, }) => { const context = useContext(ContextApp); const { @@ -49,6 +48,7 @@ const Send: React.FC = ({ totalBalance, readOnly, addressBook, + fetchError, } = context; const [modalIsOpen, setModalIsOpen] = useState(false); @@ -59,6 +59,23 @@ const Send: React.FC = ({ const [tooltip, setTooltip ] = useState(''); const [fromaddr, setFromaddr] = useState(''); + const [anyPending, setAnyPending] = useState(false); + const [shieldFee, setShieldFee] = useState(0); + + useEffect(() => { + const _anyPending: Address | undefined = !!addresses && addresses.find((i: Address) => i.containsPending === true); + setAnyPending(!!_anyPending); + }, [addresses]); + + useEffect(() => { + if (totalBalance.transparent > 0) { + (async () => { + setShieldFee(await calculateShieldFee()); + })(); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [totalBalance.transparent, anyPending]); + useEffect(() => { // transparent funds are not spendable. let _totalAmountAvailable: number = totalBalance.spendableZ + totalBalance.spendableO; @@ -77,20 +94,6 @@ const Send: React.FC = ({ setTooltip(_tooltip); }, [addresses, totalBalance.spendableO, totalBalance.spendableZ, totalBalance.unverifiedO, totalBalance.unverifiedZ]); - /* - addToAddr = () => { - const { sendPageState, setSendPageState } = this.props; - const newToAddrs = sendPageState.toaddrs.concat(new ToAddr(Utils.getNextToAddrID())); - - // Create the new state object - const newState = new SendPageState(); - newState.fromaddr = sendPageState.fromaddr; - newState.toaddrs = newToAddrs; - - setSendPageState(newState); - }; - */ - const clearToAddrs = () => { const newToAddrs: ToAddr[] = [new ToAddr(Utils.getNextToAddrID())]; @@ -112,15 +115,6 @@ const Send: React.FC = ({ setTotalAmountAvailable(_totalAmountAvailable); }; - //const changeFrom = (selectedOption: OptionType) => { - // Create the new state object - // const newState = new SendPageState(); - // newState.fromaddr = selectedOption.value; - // newState.toaddrs = sendPageState.toaddrs; - - // setSendPageState(newState); - //}; - const updateToField = async ( id: number, address: string | null, @@ -133,7 +127,6 @@ const Send: React.FC = ({ const restToAddr: ToAddr[] = sendPageState.toaddrs.filter((a: ToAddr) => a.id !== id); if (address !== null) { // First, check if this is a URI - // $FlowFixMe const parsedUri: string | ZcashURITarget[] = await parseZcashURI(address.replace(/ /g, "")); if (typeof parsedUri === "string") { if (parsedUri.toLowerCase().startsWith('error')) { @@ -156,12 +149,10 @@ const Send: React.FC = ({ if (amount !== null) { // Check to see the new amount if valid - // $FlowFixMe const newAmount: number = parseFloat(amount); if (newAmount < 0 || newAmount > 21 * 10 ** 6) { return; } - // $FlowFixMe if (toAddr) { toAddr.amount = newAmount; } @@ -304,27 +295,51 @@ const Send: React.FC = ({ currencyName={info.currencyName} /> -
- - +
+
+ + +
+
+ {totalBalance.transparent >= shieldFee && shieldFee > 0 && !readOnly && !anyPending && ( + <> + + + )} + {!!anyPending && ( +
+ Some transactions are pending. Balances may change. +
+ )} +
+ {!!fetchError && !!fetchError.error && ( + <> +
+
+ {fetchError.command + ': ' + fetchError.error} +
+ + )}
Send
- + {[sendPageState.toaddrs[0]].map((toaddr: ToAddr) => { return ( = ({ /> ); })} - {/*
- -
*/}
diff --git a/src/components/send/components/ConfirmModal.tsx b/src/components/send/components/ConfirmModal.tsx index 8ff7d2ee..aaecb712 100644 --- a/src/components/send/components/ConfirmModal.tsx +++ b/src/components/send/components/ConfirmModal.tsx @@ -82,9 +82,15 @@ type ConfirmModalProps = { } else { return '-'; } - // TODO: check if the json parse is correct. - const resultJSON = await JSON.parse(result); - + + let resultJSON; + try { + resultJSON = await JSON.parse(result); + } catch (error) { + console.log('parse-address', error); + return '-'; + } + //console.log('parse-address', address, resultJSON.status === 'success'); if (resultJSON.status !== 'success') { diff --git a/src/components/serverselectmodal/ServerSelectModal.tsx b/src/components/serverselectmodal/ServerSelectModal.tsx index c276b016..94fe9e10 100644 --- a/src/components/serverselectmodal/ServerSelectModal.tsx +++ b/src/components/serverselectmodal/ServerSelectModal.tsx @@ -24,9 +24,7 @@ export default function ServerSelectModal({ closeModal, openErrorModal }: ModalP const [customServer, setCustomServer] = useState(""); const [listServer, setListServer] = useState(""); - //const [autoChain, setAutoChain] = useState<'main' | 'test' | 'regtest' | ''>(""); const [customChain, setCustomChain] = useState<'main' | 'test' | 'regtest' | ''>(""); - //const [listChain, setListChain] = useState<'main' | 'test' | 'regtest' | ''>(""); const [servers, setServers] = useState(serverUris.length > 0 ? serverUris : serverUrisList().filter((s: Server) => s.obsolete === false)); @@ -43,28 +41,22 @@ export default function ServerSelectModal({ closeModal, openErrorModal }: ModalP setCustomChain(chain); setListServer(""); - //setListChain(""); setAutoServer(servers[0].uri); - //setAutoChain(""); } else if (selection === 'auto') { setAutoServer(server); - //setAutoChain(chain); setListServer(""); - //setListChain(""); setCustomServer(""); setCustomChain(""); } else { // list setListServer(server); - //setListChain(chain); setCustomServer(""); setCustomChain(""); setAutoServer(servers[0].uri); - //setAutoChain(""); } }, []); @@ -90,16 +82,10 @@ export default function ServerSelectModal({ closeModal, openErrorModal }: ModalP const serverchain_name: 'main' | 'test' | 'regtest' | '' = selectedChain; const serverselection: 'auto' | 'list' | 'custom' | '' = selectedSelection; - //const settingsb = await ipcRenderer.invoke("loadSettings"); - //console.log('before', settingsb.serveruri, settingsb.serverchain_name, settingsb.serverselection, settingsb); - await ipcRenderer.invoke("saveSettings", { key: "serveruri", value: serveruri }); await ipcRenderer.invoke("saveSettings", { key: "serverchain_name", value: serverchain_name }); await ipcRenderer.invoke("saveSettings", { key: "serverselection", value: serverselection }); - //const settingsa = await ipcRenderer.invoke("loadSettings"); - //console.log('after', settingsa.serveruri, settingsa.serverchain_name, settingsa.serverselection, settingsa); - localCloseModal(); setTimeout(() => { diff --git a/src/components/sidebar/Sidebar.tsx b/src/components/sidebar/Sidebar.tsx index f9348a4b..d5f3dcee 100644 --- a/src/components/sidebar/Sidebar.tsx +++ b/src/components/sidebar/Sidebar.tsx @@ -4,14 +4,12 @@ import { RouteComponentProps, withRouter } from "react-router"; import styles from "./Sidebar.module.css"; import cstyles from "../common/Common.module.css"; import routes from "../../constants/routes.json"; -import { Address, Info, Server, ValueTransfer } from "../appstate"; +import { Info, Server, ValueTransfer } from "../appstate"; import Utils from "../../utils/utils"; import RPC from "../../rpc/rpc"; import { parseZcashURI, ZcashURITarget } from "../../utils/uris"; import WalletSettingsModal from "../walletsettingsmodal/WalletSettingsModal"; import PayURIModal from "./components/PayURIModal"; -import ImportPrivKeyModal from "./components/ImportPrivKeyModal"; -import ExportPrivKeyModal from "./components/ExportPrivKeyModal"; import SidebarMenuItem from "./components/SidebarMenuItem"; import { ContextApp } from "../../context/ContextAppState"; import { Logo } from "../logo"; @@ -61,14 +59,10 @@ const Sidebar: React.FC = ({ location, }) => { const context = useContext(ContextApp); - const { info, serverUris, valueTransfers, addresses, verificationProgress, walletSettings, readOnly } = context; + const { info, serverUris, valueTransfers, verificationProgress, walletSettings, readOnly } = context; const [uriModalIsOpen, setUriModalIsOpen] = useState(false); const [uriModalInputValue, setUriModalInputValue] = useState(undefined); - const [privKeyModalIsOpen, setPrivKeyModalIsOpen] = useState(false); - //const [privKeyInputValue, setPrivKeyInputValue] = useState(null); - const [exportPrivKeysModalIsOpen, setExportPrivKeysModalIsOpen] = useState(false); - const [exportedPrivKeys, setExportedPrivKeys] = useState([]); const [walletSettingsModalIsOpen, setWalletSettingsModalIsOpen] = useState(false); let stateSync: string = "DISCONNECTED"; @@ -95,7 +89,7 @@ const Sidebar: React.FC = ({ openErrorModal( "Zingo PC",
-
Zingo PC v1.1.0
+
Zingo PC v1.4.3
Built with Electron. Copyright (c) 2024, ZingoLabs.
The MIT License (MIT) Copyright (c) 2024 ZingoLabs @@ -136,10 +130,6 @@ const Sidebar: React.FC = ({ history.push(routes.SEND); }); - // Import a Private Key - //ipcRenderer.on("import", () => { - // openImportPrivKeyModal(null); - //}); // Pay URI ipcRenderer.on("payuri", (event: any, uri: string) => { @@ -344,23 +334,6 @@ const Sidebar: React.FC = ({ navigateToLoadingScreen(false, "", serverUris) }); - // Export all private keys - ipcRenderer.on("exportall", async () => { - const ad = addresses; - const ge = getPrivKeyAsString; - // Get all the addresses and run export key on each of them. - openPasswordAndUnlockIfNeeded(async () => { - const _privKeysPromise: Promise[] = ad.map(async (a: Address) => { - const privKey: string = await ge(a.address); - return `${privKey} #${a}`; - }); - const _exportedPrivKeys: string[] = await Promise.all(_privKeysPromise); - - setExportPrivKeysModalIsOpen(true); - setExportedPrivKeys(_exportedPrivKeys); - }); - }); - // View zcashd ipcRenderer.on("zcashd", () => { history.push(routes.ZCASHD); @@ -377,102 +350,12 @@ const Sidebar: React.FC = ({ }); }; - const closeExportPrivKeysModal = () => { - setExportPrivKeysModalIsOpen(false); - setExportedPrivKeys([]); - }; - - //const openImportPrivKeyModal = (defaultValue: string | null) => { - // const _privKeyInputValue: string = defaultValue || ""; - // setPrivKeyModalIsOpen(true); - // setPrivKeyInputValue(_privKeyInputValue); - //}; - - //const setImprovPrivKeyInputValue = (_privKeyInputValue: string) => { - // setPrivKeyInputValue(_privKeyInputValue); - //}; - - const closeImportPrivKeyModal = () => { - setPrivKeyModalIsOpen(false); - }; - const openURIModal = (defaultValue: string | null) => { const _uriModalInputValue: string = defaultValue || ""; setUriModalIsOpen(true); setUriModalInputValue(_uriModalInputValue); }; - const doImportPrivKeys = async (key: string, birthday: string) => { - if (key) { - let keys: string[] = key.split(new RegExp("[\\n\\r]+")); - if (!keys || keys.length === 0) { - openErrorModal("No Keys Imported", "No keys were specified, so none were imported"); - return; - } - - // Filter out empty lines and clean up the private keys - keys = keys.filter((k) => !(k.trim().startsWith("#") || k.trim().length === 0)); - - // Special case. - // Sometimes, when importing from a paperwallet or such, the key is split by newlines, and might have - // been pasted like that. So check to see if the whole thing is one big private key - if (Utils.isValidSaplingPrivateKey(keys.join("")) || Utils.isValidSaplingViewingKey(keys.join(""))) { - keys = [keys.join("")]; - } - - if (keys.length > 1) { - openErrorModal("Multiple Keys Not Supported", "Please import one key at a time"); - return; - } - - if (!Utils.isValidSaplingPrivateKey(keys[0]) && !Utils.isValidSaplingViewingKey(keys[0])) { - openErrorModal( - "Bad Key", - "The input key was not recognized as either a sapling spending key or a sapling viewing key" - ); - return; - } - - // in order to import a viewing key, the wallet can be encrypted, - // but it must be unlocked - //if (Utils.isValidSaplingViewingKey(keys[0]) && info.locked) { - // openErrorModal( - // "Wallet Is Locked", - // "In order to import a Sapling viewing key, your wallet must be unlocked. If you wish to continue, unlock your wallet and try again." - // ); - // return; - //} - - // in order to import a private key, the wallet must be unencrypted - //if (Utils.isValidSaplingPrivateKey(keys[0]) && info.encrypted) { - // openErrorModal( - // "Wallet Is Encrypted", - // "In order to import a Sapling private key, your wallet cannot be encrypted. If you wish to continue, remove the encryption from your wallet and try again." - // ); - // return; - //} - - // To rescan, we reset the wallet loading - // So set info the default, and redirect to the loading screen - clearTimers(); - - // Grab the previous sync ID. - const syncStatus: string = await RPC.doSyncStatus(); - const prevSyncId: number = JSON.parse(syncStatus).sync_id; - const success: boolean = importPrivKeys(keys, birthday); - - if (success) { - // Set the rescanning global state to true - setRescanning(true, prevSyncId); - - // Reset the info object, it will be refetched - setInfo(new Info()); - - navigateToLoadingScreen(false, "", serverUris) - } - } - }; - const setURIInputValue = (_uriModalInputValue: string) => { setUriModalInputValue(_uriModalInputValue); }; @@ -528,7 +411,6 @@ const Sidebar: React.FC = ({ return (
- {/* Payment URI Modal */} = ({ actionCallback={payURI} /> - {/* Import Private Key Modal */} - - - {/* Exported (all) Private Keys */} - - -/// -/// - declare namespace NodeJS { interface ProcessEnv { readonly NODE_ENV: "development" | "production" | "test"; diff --git a/src/root/Routes.tsx b/src/root/Routes.tsx index 6c876bfd..c73613b8 100644 --- a/src/root/Routes.tsx +++ b/src/root/Routes.tsx @@ -512,6 +512,65 @@ class Routes extends React.Component { return result; } + handleShieldButton = () => { + this.openErrorModal("Computing Transaction", "Please wait...This could take a while"); + + setTimeout(() => { + (async () => { + try { + const result: string = await this.shieldTransparentBalanceToOrchard(); + console.log('shielding balance', result); + + if (result.toLocaleLowerCase().startsWith('error')) { + this.openErrorModal("Error Shielding Transaction", `${result}`); + return; + } + const resultJSON = JSON.parse(result); + if (resultJSON.txids) { + this.openErrorModal( + "Successfully Broadcast Transaction", +
+
+
{(resultJSON.txids.length === 1 ? 'Transaction was' : 'Transactions were') + ' successfully broadcast.'}
+
{`TXID: ${resultJSON.txids[0]}`}
+ {resultJSON.txids.length > 1 && ( +
{`TXID: ${resultJSON.txids[1]}`}
+ )} + {resultJSON.txids.length > 2 && ( +
{`TXID: ${resultJSON.txids[2]}`}
+ )} +
+
Utils.openTxid(resultJSON.txids[0], this.state.info.currencyName)}> + View TXID   + +
+ {resultJSON.txids.length > 1 && ( +
Utils.openTxid(resultJSON.txids[1], this.state.info.currencyName)}> + View TXID   + +
+ )} + {resultJSON.txids.length > 2 && ( +
Utils.openTxid(resultJSON.txids[2], this.state.info.currencyName)}> + View TXID   + +
+ )} +
+ ); + } + if (resultJSON.error) { + this.openErrorModal("Error Shielding Transaction", `${resultJSON.error}`); + } + } catch (err) { + // If there was an error, show the error modal + this.openErrorModal("Error Shielding Transaction", `${err}`); + } + })(); + }, 10); + }; + + navigateToDashboard = () => { this.props.history.replace({ pathname: routes.DASHBOARD, @@ -577,6 +636,8 @@ class Routes extends React.Component { )} @@ -585,10 +646,8 @@ class Routes extends React.Component { path={routes.RECEIVE} render={() => ( )} @@ -607,9 +666,8 @@ class Routes extends React.Component { path={routes.DASHBOARD} render={() => ( )} /> @@ -624,6 +682,8 @@ class Routes extends React.Component { render={() => ( )} /> diff --git a/src/rpc/rpc.ts b/src/rpc/rpc.ts index 8aadc0a6..173724c9 100644 --- a/src/rpc/rpc.ts +++ b/src/rpc/rpc.ts @@ -70,8 +70,6 @@ export default class RPC { console.log('refresh - 30 sec'); // trying to sync this.refresh(false); - // I need to save the wallet every 30 seconds Just in case. - //RPC.doSave(); // I need to fetch the ZEC price in USD. this.getZecPrice(); }, 30 * 1000); // 30 sec @@ -87,7 +85,6 @@ export default class RPC { // Immediately call the refresh after configure to update the UI this.refresh(true); this.updateData(); - //RPC.doSave(); } clearTimers() { @@ -251,7 +248,6 @@ export default class RPC { // the sync is finished // the sync process in zingolib finish fakely & if you try again // the sync continue with a NEW ID - // verificationProgress = 100; // And fetch the rest of the data. this.fetchTotalBalance(); this.fetchTandZandOValueTransfers(latestBlockHeight); @@ -325,7 +321,7 @@ export default class RPC { info.zecPrice = 0; } - //zingolib version + // zingolib version let zingolibStr: string = await native.zingolib_execute_async("version", ""); if (zingolibStr) { if (zingolibStr.toLowerCase().startsWith('error')) { @@ -411,7 +407,6 @@ export default class RPC { static async setWalletSettingOption(name: string, value: string): Promise { const r: string = await native.zingolib_execute_async("setoption", `${name}=${value}`); - //RPC.doSave(); return r; } @@ -683,8 +678,6 @@ export default class RPC { // This method will get the total balances async fetchTotalBalance() { - //const balanceStr = native.zingolib_execute_async("balance", ""); - //const balanceJSON = JSON.parse(balanceStr); const balanceJSON: any = await this.zingolibBalance(); @@ -704,10 +697,6 @@ export default class RPC { balance.total = balance.obalance + balance.zbalance + balance.transparent; this.fnSetTotalBalance(balance); - // Fetch pending notes and UTXOs - // const pendingNotes = native.zingolib_execute_async("notes", ""); - // const pendingJSON = JSON.parse(pendingNotes); - const pendingJSON: any = await this.zingolibNotes(); const pendingAddressBalances = new Map(); @@ -738,8 +727,6 @@ export default class RPC { ab.type = o.address_type; return ab; }); - // I need all the addresses here - //.filter((ab: Address) => ab.balance > 0); const zaddresses = balanceJSON.z_addresses.map((o: any) => { // If this has any unconfirmed txns, show that in the UI @@ -750,8 +737,6 @@ export default class RPC { ab.type = o.address_type; return ab; }); - // I need all the addresses here - //.filter((ab: Address) => ab.balance > 0); //console.log(zaddresses); @@ -764,8 +749,6 @@ export default class RPC { ab.type = o.address_type; return ab; }); - // I need all the addresses here - //.filter((ab: Address) => ab.balance > 0); const addresses = uaddresses.concat(zaddresses.concat(taddresses)); @@ -924,7 +907,6 @@ export default class RPC { const resp: string = await native.zingolib_execute_async("send", JSON.stringify(sendJson)); console.log(`End Sending, response: ${resp}`); } catch (err) { - // TODO Show a modal with the error console.log(`Error sending Tx: ${err}`); throw err; } @@ -950,7 +932,6 @@ export default class RPC { } } } catch (err) { - // TODO Show a modal with the error console.log(`Error confirming Tx: ${err}`); throw err; } @@ -1036,9 +1017,6 @@ export default class RPC { // To update the wallet encryption status this.fetchInfo(); - // And save the wallet - //RPC.doSave(); - return resultJSON.result === "success"; } @@ -1049,9 +1027,6 @@ export default class RPC { // To update the wallet encryption status this.fetchInfo(); - // And save the wallet - //RPC.doSave(); - return resultJSON.result === "success"; } diff --git a/src/utils/uris.ts b/src/utils/uris.ts index 59717115..bda016a3 100644 --- a/src/utils/uris.ts +++ b/src/utils/uris.ts @@ -177,8 +177,8 @@ export const checkServerURI = async (uri: string, oldUri: string): Promise 9067 - // for `zecwallet` -> 443 - port = uri.includes('lwdv3.zecwallet') ? '443' : '9067'; + // for `zec.rocks` -> 443 + port = uri.includes('zec.rocks') ? '443' : '9067'; } try { diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 1cf7cbe4..eec522c6 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -51,10 +51,6 @@ export default class Utils { static maxPrecision(v: number): string { if (!v) return `${v}`; - // if (typeof v === 'string' || v instanceof String) { - // v = parseFloat(v); - // } - return v.toFixed(8); }