Skip to content

Commit

Permalink
Merge pull request #203 from juanky201271/dev_improvements
Browse files Browse the repository at this point in the history
New version 1.4.3
  • Loading branch information
juanky201271 authored Aug 5, 2024
2 parents de42dae + 25734ec commit d0ef157
Show file tree
Hide file tree
Showing 27 changed files with 215 additions and 595 deletions.
2 changes: 1 addition & 1 deletion bin/printversion.ps1
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion bin/printversion.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
VERSION="1.1.0"
VERSION="1.4.3"
echo "VERSION=$VERSION" >> $GITHUB_ENV
6 changes: 2 additions & 4 deletions native/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fn zingolib_wallet_exists(mut cx: FunctionContext) -> JsResult<JsBoolean> {
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<JsString> {
let server_uri = cx.argument::<JsString>(0)?.value(&mut cx);
let chain_hint = cx.argument::<JsString>(1)?.value(&mut cx);
Expand Down Expand Up @@ -139,7 +139,7 @@ fn zingolib_init_new(mut cx: FunctionContext) -> JsResult<JsString> {
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<JsString> {
let server_uri = cx.argument::<JsString>(0)?.value(&mut cx);
let seed = cx.argument::<JsString>(1)?.value(&mut cx);
Expand Down Expand Up @@ -299,8 +299,6 @@ fn zingolib_execute_async(mut cx: FunctionContext) -> JsResult<JsPromise> {

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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
106 changes: 0 additions & 106 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = {
Expand All @@ -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",
Expand Down Expand Up @@ -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 = {
Expand All @@ -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");
},
},
Expand Down Expand Up @@ -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",
Expand All @@ -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");
// },
// },
],
},
{
Expand All @@ -408,12 +310,6 @@ class MenuBuilder {
mainWindow.webContents.send("about");
},
},
//{
// label: "Donate",
// click() {
// mainWindow.webContents.send("donate");
// },
//},
{
label: "Check github.com for updates",
click() {
Expand Down Expand Up @@ -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)
});
Expand Down
7 changes: 1 addition & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="App">
<header className="App-header">
<p>Built using CRA electron-builder-typescript Template.</p>
{/*<p>{addon.zingolib_say_hello("Me")}</p>*/}
<img src={logo} className="App-logo" alt="logo" />
<p>Zingo PC v1.1.0</p>
<p>Zingo PC v1.4.3</p>
<p>
Edit <code>public/electron.js</code> or <code>src/App.js</code> and save to reload.
</p>
Expand Down
3 changes: 1 addition & 2 deletions src/components/appstate/components/ValueTransfer.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
65 changes: 3 additions & 62 deletions src/components/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import { ContextApp } from "../../context/ContextAppState";
import { Address } from "../appstate";

type DashboardProps = {
shieldTransparentBalanceToOrchard: () => Promise<string>;
openErrorModal: (title: string, body: string | JSX.Element) => void;
calculateShieldFee: () => Promise<number>;
handleShieldButton: () => void;
};

const Dashboard: React.FC<DashboardProps> = ({shieldTransparentBalanceToOrchard, openErrorModal, calculateShieldFee}) => {
const Dashboard: React.FC<DashboardProps> = ({calculateShieldFee, handleShieldButton}) => {
const context = useContext(ContextApp);
const { totalBalance, info, addresses, readOnly, fetchError } = context;

Expand All @@ -38,64 +37,6 @@ const Dashboard: React.FC<DashboardProps> = ({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",
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', marginRight: 10 }}>
<div>{(resultJSON.txids.length === 1 ? 'Transaction was' : 'Transactions were') + ' successfully broadcast.'}</div>
<div>{`TXID: ${resultJSON.txids[0]}`}</div>
{resultJSON.txids.length > 1 && (
<div>{`TXID: ${resultJSON.txids[1]}`}</div>
)}
{resultJSON.txids.length > 2 && (
<div>{`TXID: ${resultJSON.txids[2]}`}</div>
)}
</div>
<div className={cstyles.primarybutton} onClick={() => Utils.openTxid(resultJSON.txids[0], info.currencyName)}>
View TXID &nbsp;
<i className={["fas", "fa-external-link-square-alt"].join(" ")} />
</div>
{resultJSON.txids.length > 1 && (
<div className={cstyles.primarybutton} onClick={() => Utils.openTxid(resultJSON.txids[1], info.currencyName)}>
View TXID &nbsp;
<i className={["fas", "fa-external-link-square-alt"].join(" ")} />
</div>
)}
{resultJSON.txids.length > 2 && (
<div className={cstyles.primarybutton} onClick={() => Utils.openTxid(resultJSON.txids[2], info.currencyName)}>
View TXID &nbsp;
<i className={["fas", "fa-external-link-square-alt"].join(" ")} />
</div>
)}
</div>
);
}
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 (
Expand Down Expand Up @@ -130,7 +71,7 @@ const Dashboard: React.FC<DashboardProps> = ({shieldTransparentBalanceToOrchard,
<div className={cstyles.balancebox}>
{totalBalance.transparent >= shieldFee && shieldFee > 0 && !readOnly && !anyPending && (
<>
<button className={[cstyles.primarybutton].join(" ")} type="button" onClick={shieldButton}>
<button className={[cstyles.primarybutton].join(" ")} type="button" onClick={handleShieldButton}>
Shield Transparent Balance To Orchard (Fee: {shieldFee})
</button>
</>
Expand Down
1 change: 0 additions & 1 deletion src/components/dashboard/components/AddressBalanceItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const AddressBalanceItem: React.FC<AddressBalanceItemProps> = ({ currencyName, z
</div>
</div>
</div>
{/* Add label displaying receiver types */}
{item.type === AddressType.unified && !!item.receivers && (
<div className={[cstyles.small, cstyles.padtopsmall, cstyles.sublight].join(" ")}>
Address types: {Utils.getReceivers(item.receivers).join(" + ")}
Expand Down
Loading

0 comments on commit d0ef157

Please sign in to comment.