Skip to content

Commit dff15a6

Browse files
committed
Merge branch 'master' into release
2 parents 658a56f + cbfee91 commit dff15a6

14 files changed

+1626
-642
lines changed

.eslintrc.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,16 @@ module.exports = {
66
config: require.resolve('./configs/webpack.config.eslint.js')
77
}
88
}
9-
}
9+
},
10+
overrides: [
11+
{
12+
files: [
13+
"**/*.test.js"
14+
],
15+
env: {
16+
jest: true // now **/*.test.js files' env has both es6 *and* jest
17+
},
18+
plugins: ["jest"],
19+
}
20+
]
1021
}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Head over to the releases page and grab the latest installers or binary. https:/
1414
If you are on Debian/Ubuntu, please download the '.AppImage' package and just run it.
1515

1616
```
17-
./Zecwallet.Fullnode-0.9.18.AppImage
17+
./Zecwallet.Fullnode-0.9.19.AppImage
1818
```
1919

2020
If you prefer to install a `.deb` package, that is also available.
2121

2222
```
23-
sudo apt install -f ./zecwallet_0.9.18_amd64.deb
23+
sudo apt install -f ./zecwallet_0.9.19_amd64.deb
2424
```
2525

2626
### Windows

app/Routes.js

+22-11
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import AppState, {
2626
} from './components/AppState';
2727
import RPC from './rpc';
2828
import Utils from './utils/utils';
29+
import { ZcashURITarget } from './utils/uris';
2930
import Zcashd from './components/Zcashd';
3031
import AddressBook from './components/Addressbook';
3132
import AddressbookImpl from './utils/AddressbookImpl';
@@ -225,24 +226,34 @@ export default class RouteApp extends React.Component<Props, AppState> {
225226
}
226227
};
227228

228-
setSendTo = (address: string, amount: number | null, memo: string | null) => {
229+
setSendTo = (targets: ZcashURITarget[] | ZcashURITarget) => {
229230
// Clear the existing send page state and set up the new one
230231
const { sendPageState } = this.state;
231232

232233
const newSendPageState = new SendPageState();
234+
newSendPageState.toaddrs = [];
233235
newSendPageState.fromaddr = sendPageState.fromaddr;
234236

235-
const to = new ToAddr(Utils.getNextToAddrID());
236-
if (address) {
237-
to.to = address;
237+
// If a single object is passed, accept that as well.
238+
let tgts = targets;
239+
if (!Array.isArray(tgts)) {
240+
tgts = [targets];
238241
}
239-
if (amount) {
240-
to.amount = amount;
241-
}
242-
if (memo) {
243-
to.memo = memo;
244-
}
245-
newSendPageState.toaddrs = [to];
242+
243+
tgts.forEach(tgt => {
244+
const to = new ToAddr(Utils.getNextToAddrID());
245+
if (tgt.address) {
246+
to.to = tgt.address;
247+
}
248+
if (tgt.amount) {
249+
to.amount = tgt.amount;
250+
}
251+
if (tgt.memoString) {
252+
to.memo = tgt.memoString;
253+
}
254+
255+
newSendPageState.toaddrs.push(to);
256+
});
246257

247258
this.setState({ sendPageState: newSendPageState });
248259
};

app/companion.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ export default class CompanionAppListener {
389389
maxzspendable,
390390
tokenName,
391391
zecprice,
392-
serverversion: '0.9.18'
392+
serverversion: '0.9.19'
393393
};
394394

395395
return JSON.stringify(resp);

app/components/Addressbook.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const AddressBookItemInteral = ({ item, removeAddressBookEntry, setSendTo, histo
3333
type="button"
3434
className={cstyles.primarybutton}
3535
onClick={() => {
36-
setSendTo(item.address, null, null);
36+
setSendTo(new ZcashURITarget(item.address, null, null));
3737
history.push(routes.SEND);
3838
}}
3939
>
@@ -53,7 +53,7 @@ type Props = {
5353
addressBook: AddressBookEntry[],
5454
addAddressBookEntry: (label: string, address: string) => void,
5555
removeAddressBookEntry: (label: string) => void,
56-
setSendTo: (address: string, amount: number | null, memo: string | null) => void
56+
setSendTo: (targets: ZcashURITarget[] | ZcashURITarget) => void
5757
};
5858

5959
type State = {

app/components/Sidebar.js

+21-34
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
/* eslint-disable react/prop-types */
55
import React, { PureComponent } from 'react';
66
import type { Element } from 'react';
7-
import url from 'url';
8-
import querystring from 'querystring';
97
import fs from 'fs';
108
import dateformat from 'dateformat';
119
import Modal from 'react-modal';
@@ -20,6 +18,7 @@ import routes from '../constants/routes.json';
2018
import Logo from '../assets/img/logobig.png';
2119
import { Info, Transaction } from './AppState';
2220
import Utils from '../utils/utils';
21+
import { parseZcashURI, ZcashURITarget } from '../utils/uris';
2322

2423
const ExportPrivKeyModal = ({ modalIsOpen, exportedPrivKeys, closeModal }) => {
2524
return (
@@ -184,7 +183,7 @@ type Props = {
184183
info: Info,
185184
addresses: string[],
186185
transactions: Transaction[],
187-
setSendTo: (address: string, amount: number | null, memo: string | null) => void,
186+
setSendTo: (targets: ZcashURITarget[] | ZcashURITarget) => void,
188187
getPrivKeyAsString: (address: string) => string,
189188
importPrivKeys: (keys: string[]) => void,
190189
history: PropTypes.object.isRequired,
@@ -226,7 +225,7 @@ class Sidebar extends PureComponent<Props, State> {
226225
openErrorModal(
227226
'Zecwallet Fullnode',
228227
<div className={cstyles.verticalflex}>
229-
<div className={cstyles.margintoplarge}>Zecwallet Fullnode v0.9.18</div>
228+
<div className={cstyles.margintoplarge}>Zecwallet Fullnode v0.9.19</div>
230229
<div className={cstyles.margintoplarge}>Built with Electron. Copyright (c) 2018-2020, Aditya Kulkarni.</div>
231230
<div className={cstyles.margintoplarge}>
232231
The MIT License (MIT) Copyright (c) 2018-present Zecwallet
@@ -256,9 +255,11 @@ class Sidebar extends PureComponent<Props, State> {
256255
// Donate button
257256
ipcRenderer.on('donate', () => {
258257
setSendTo(
259-
Utils.getDonationAddress(testnet),
260-
Utils.getDefaultDonationAmount(testnet),
261-
Utils.getDefaultDonationMemo(testnet)
258+
new ZcashURITarget(
259+
Utils.getDonationAddress(testnet),
260+
Utils.getDefaultDonationAmount(testnet),
261+
Utils.getDefaultDonationMemo(testnet)
262+
)
262263
);
263264

264265
history.push(routes.SEND);
@@ -418,41 +419,27 @@ class Sidebar extends PureComponent<Props, State> {
418419
const { openErrorModal, setSendTo, history } = this.props;
419420

420421
const errTitle = 'URI Error';
421-
const errBody = (
422-
<span>
423-
The URI &quot;{escape(uri)}&quot; was not recognized.
424-
<br />
425-
Please type in a valid URI of the form &quot; zcash:address?amout=xx&memo=yy &quot;
426-
</span>
427-
);
422+
const getErrorBody = (explain: string): Element<'div'> => {
423+
return (
424+
<div>
425+
<span>{explain}</span>
426+
<br />
427+
</div>
428+
);
429+
};
428430

429431
if (!uri || uri === '') {
430-
openErrorModal(errTitle, errBody);
432+
openErrorModal(errTitle, getErrorBody('URI was not found or invalid'));
431433
return;
432434
}
433435

434-
const parsedUri = url.parse(uri);
435-
if (!parsedUri || parsedUri.protocol !== 'zcash:' || !parsedUri.query) {
436-
openErrorModal(errTitle, errBody);
436+
const parsedUri = parseZcashURI(uri);
437+
if (typeof parsedUri === 'string') {
438+
openErrorModal(errTitle, getErrorBody(parsedUri));
437439
return;
438440
}
439441

440-
const address = parsedUri.host;
441-
if (!address || !(Utils.isTransparent(address) || Utils.isZaddr(address))) {
442-
openErrorModal(errTitle, <span>The address ${address} was not recognized as a Zcash address</span>);
443-
return;
444-
}
445-
446-
const parsedParams = querystring.parse(parsedUri.query);
447-
if (!parsedParams || (!parsedParams.amt && !parsedParams.amount)) {
448-
openErrorModal(errTitle, errBody);
449-
return;
450-
}
451-
452-
const amount = parsedParams.amt || parsedParams.amount;
453-
const memo = parsedParams.memo || '';
454-
455-
setSendTo(address, amount, memo);
442+
setSendTo(parsedUri);
456443
history.push(routes.SEND);
457444
};
458445

app/components/Transactions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const TxModalInternal = ({ modalIsOpen, tx, closeModal, currencyName, zecPrice,
5454
};
5555

5656
const doReply = (address: string) => {
57-
setSendTo(address, 0.0001, null);
57+
setSendTo(new ZcashURITarget(address, 0.0001, null));
5858
closeModal();
5959

6060
history.push(routes.SEND);
@@ -251,7 +251,7 @@ type Props = {
251251
transactions: Transaction[],
252252
addressBook: AddressBook[],
253253
info: Info,
254-
setSendTo: (string, number | null, string | null) => void
254+
setSendTo: (targets: ZcashURITarget[] | ZcashURITarget) => void
255255
};
256256

257257
type State = {

app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "zecwallet",
33
"productName": "Zecwallet Fullnode",
4-
"version": "0.9.18",
4+
"version": "0.9.19",
55
"description": "Zecwallet Fullnode",
66
"main": "./main.prod.js",
77
"author": {

0 commit comments

Comments
 (0)