Browse Source

Merge pull request #1 from MyHush/duke

update to last commit
pull/154/head
Denio 4 years ago
committed by GitHub
parent
commit
aefb39a36f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 620
      LICENSE
  2. 2
      README.md
  3. 16
      build.sh
  4. 12
      hush-cli
  5. 56
      res/libsodium/buildlibsodium.sh
  6. BIN
      res/silentdragon_de.qm
  7. 694
      res/silentdragon_de.ts
  8. BIN
      res/silentdragon_es.qm
  9. 694
      res/silentdragon_es.ts
  10. BIN
      res/silentdragon_fi.qm
  11. 696
      res/silentdragon_fi.ts
  12. BIN
      res/silentdragon_fr.qm
  13. 730
      res/silentdragon_fr.ts
  14. BIN
      res/silentdragon_hr.qm
  15. 704
      res/silentdragon_hr.ts
  16. BIN
      res/silentdragon_it.qm
  17. 706
      res/silentdragon_it.ts
  18. BIN
      res/silentdragon_nl.qm
  19. 710
      res/silentdragon_nl.ts
  20. BIN
      res/silentdragon_pt.qm
  21. 706
      res/silentdragon_pt.ts
  22. BIN
      res/silentdragon_ru.qm
  23. 706
      res/silentdragon_ru.ts
  24. BIN
      res/silentdragon_sr.qm
  25. 704
      res/silentdragon_sr.ts
  26. 2
      res/silentdragon_template.ts
  27. BIN
      res/silentdragon_tr.qm
  28. 696
      res/silentdragon_tr.ts
  29. BIN
      res/silentdragon_uk.qm
  30. 708
      res/silentdragon_uk.ts
  31. BIN
      res/silentdragon_zh.qm
  32. 694
      res/silentdragon_zh.ts
  33. 4
      run-after-build.sh
  34. 5
      silentdragon.pro
  35. 33
      src/about.ui
  36. 4
      src/addresscombo.cpp
  37. 2
      src/balancestablemodel.cpp
  38. 13
      src/connection.cpp
  39. 242
      src/mainwindow.cpp
  40. 9
      src/mainwindow.h
  41. 184
      src/mainwindow.ui
  42. 2
      src/privkey.ui
  43. 148
      src/rpc.cpp
  44. 5
      src/rpc.h
  45. 17
      src/scripts/docker/Dockerfile
  46. 5
      src/scripts/dotranslations.sh
  47. 49
      src/scripts/make-binary-tarball.sh
  48. 123
      src/scripts/make-deb.sh
  49. 40
      src/scripts/make-only-deb.sh
  50. 46
      src/scripts/mkmacdmg.sh
  51. 129
      src/scripts/mkrelease.sh
  52. 7
      src/scripts/signbinaries.sh
  53. 16
      src/sendtab.cpp
  54. 2
      src/senttxstore.cpp
  55. 87
      src/settings.cpp
  56. 23
      src/settings.h
  57. 254
      src/settings.ui
  58. 2
      src/txtablemodel.cpp
  59. 2
      src/version.h
  60. 17
      src/websockets.cpp
  61. 46
      win-build.sh

620
LICENSE

@ -1,7 +1,619 @@
Copyright 2018 adityapk
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Preamble
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

2
README.md

@ -9,9 +9,11 @@ This is experimental software under active development!
SilentDragon contacts a few different external websites to get various
bits of data.
* coingecko.com for price data API
* explorer.myhush.org for explorer links
* dexstats.info for address utilities
* wormhole.myhush.org for Wormhole services
This means your IP address is known to these servers. Enable Tor setting
in SilentDragon to prevent this, or better yet, use TAILS: https://tails.boum.org/

16
build.sh

@ -1,6 +1,8 @@
#!/bin/bash
# Copyright 2019 The Hush Developers
# Copyright 2019-2020 The Hush Developers
# Released under the GPLv3
set -e
UNAME=$(uname)
if [ "$UNAME" == "Linux" ] ; then
@ -17,11 +19,13 @@ VERSION=$(cat src/version.h |cut -d\" -f2)
echo "Compiling SilentDragon $VERSION with $JOBS threads..."
CONF=silentdragon.pro
set -e
qbuild () {
qmake $CONF CONFIG+=debug
#lupdate $CONF
#lrelease $CONF
qmake $CONF -spec linux-clang CONFIG+=debug
make -j$JOBS
}
qbuild_release () {
qmake $CONF -spec linux-clang CONFIG+=release
make -j$JOBS
}
@ -33,6 +37,8 @@ elif [ "$1" == "linguist" ]; then
elif [ "$1" == "cleanbuild" ]; then
make clean
qbuild
elif [ "$1" == "release" ]; then
qbuild_release
else
qbuild
fi

12
hush-cli

@ -2,10 +2,20 @@
# Copyright (c) 2019 Hush developers
# set working directory to the location of this script
# readlink -f does not always exist
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
DIR="$( cd "$( dirname "$( readlink "${BASH_SOURCE[0]}" )" )" && pwd )"
cd $DIR
NAME=HUSH3
CLI=${KOMODOCLI:-./komodo-cli}
$CLI -ac_name=$NAME "$@"
if [ -f $CLI ]; then
$CLI -ac_name=$NAME "$@"
else
# We prefix our binary when installed
# system wide on Debain system, to prevent clashes
CLI=hush-komodo-cli
$CLI -ac_name=$NAME "$@"
fi

56
res/libsodium/buildlibsodium.sh

@ -1,32 +1,64 @@
#!/bin/bash
# Copyright (c) 2019-2020 The Hush developers
# Released under the GPLv3
VERSION=1.0.18
LIB="libsodium"
DIR="$LIB-$VERSION"
FILE="$DIR.tar.gz"
URL=https://github.com/MyHush/libsodium/releases/download/${VERSION}/${FILE}
SHA=6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1
# First thing to do is see if libsodium.a exists in the res folder. If it does, then there's nothing to do
if [ -f res/libsodium.a ]; then
if [ -f res/${LIB}.a ]; then
exit 0
fi
echo "Building libsodium"
echo "Building $LIB"
# Go into the libsodium directory
cd res/$LIB
if [ ! -f $FILE ]; then
curl -LO $URL
fi
echo "$SHA $FILE" | shasum -a 256 --check
# TWO SPACES or sadness sometimes:
# https://unix.stackexchange.com/questions/139891/why-does-verifying-sha256-checksum-with-sha256sum-fail-on-debian-and-work-on-u
echo "$SHA $FILE" | shasum -a 256 --check --status
if [ $? -ne 0 ]; then
FOUNDSHA=$(shasum -a 256 $FILE)
echo "SHA256 mismatch on $FILE!"
echo "$FOUNDSHA did not match $SHA . Aborting..."
exit 1
fi
# Go into the lib sodium directory
cd res/libsodium
if [ ! -f libsodium-1.0.16.tar.gz ]; then
curl -LO https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz
if [ ! -d $DIR ]; then
tar xf $FILE
fi
if [ ! -d libsodium-1.0.16 ]; then
tar xf libsodium-1.0.16.tar.gz
# Try to use full core count to build
if [ "$UNAME" == "Linux" ] ; then
JOBS=$(nproc)
elif [ "$UNAME" == "FreeBSD" ] ; then
JOBS=$(nproc)
elif [ "$UNAME" == "Darwin" ] ; then
JOBS=$(sysctl -n hw.ncpu)
else
JOBS=4
fi
# Now build it
cd libsodium-1.0.16
cd $DIR
LIBS="" ./configure
make clean
echo "Building $LIB with $JOBS cores..."
if [[ "$OSTYPE" == "darwin"* ]]; then
make CFLAGS="-mmacosx-version-min=10.11" CPPFLAGS="-mmacosx-version-min=10.11" -j4
make CFLAGS="-mmacosx-version-min=10.11" CPPFLAGS="-mmacosx-version-min=10.11" -j$JOBS
else
make -j4
make -j$JOBS
fi
cd ..
# copy the library to the parents's res/ folder
cp libsodium-1.0.16/src/libsodium/.libs/libsodium.a ../
cp $DIR/src/libsodium/.libs/libsodium.a ../

BIN
res/silentdragon_de.qm

Binary file not shown.

694
res/silentdragon_de.ts

File diff suppressed because it is too large

BIN
res/silentdragon_es.qm

Binary file not shown.

694
res/silentdragon_es.ts

File diff suppressed because it is too large

BIN
res/silentdragon_fi.qm

Binary file not shown.

696
res/silentdragon_fi.ts

File diff suppressed because it is too large

BIN
res/silentdragon_fr.qm

Binary file not shown.

730
res/silentdragon_fr.ts

File diff suppressed because it is too large

BIN
res/silentdragon_hr.qm

Binary file not shown.

704
res/silentdragon_hr.ts

File diff suppressed because it is too large

BIN
res/silentdragon_it.qm

Binary file not shown.

706
res/silentdragon_it.ts

File diff suppressed because it is too large

BIN
res/silentdragon_nl.qm

Binary file not shown.

710
res/silentdragon_nl.ts

File diff suppressed because it is too large

BIN
res/silentdragon_pt.qm

Binary file not shown.

706
res/silentdragon_pt.ts

File diff suppressed because it is too large

BIN
res/silentdragon_ru.qm

Binary file not shown.

706
res/silentdragon_ru.ts

File diff suppressed because it is too large

BIN
res/silentdragon_sr.qm

Binary file not shown.

704
res/silentdragon_sr.ts

File diff suppressed because it is too large

2
res/silentdragon_template.ts

@ -1574,7 +1574,7 @@ Would you like to visit the releases page?</source>
</message>
<message>
<location filename="../src/settings.ui" line="326"/>
<source>Fetch HUSH / USD prices</source>
<source>Fetch HUSH prices</source>
<translation type="unfinished"></translation>
</message>
<message>

BIN
res/silentdragon_tr.qm

Binary file not shown.

696
res/silentdragon_tr.ts

File diff suppressed because it is too large

BIN
res/silentdragon_uk.qm

Binary file not shown.

708
res/silentdragon_uk.ts

File diff suppressed because it is too large

BIN
res/silentdragon_zh.qm

Binary file not shown.

694
res/silentdragon_zh.ts

File diff suppressed because it is too large

4
run-after-build.sh

@ -0,0 +1,4 @@
#!/bin/bash
# Copyright 2019-2020 The Hush Developers
./build.sh && ./silentdragon

5
silentdragon.pro

@ -26,6 +26,10 @@ DEFINES += \
INCLUDEPATH += src/3rdparty/
mac: LIBS+= -Wl,-dead_strip
mac: LIBS+= -Wl,-dead_strip_dylibs
mac: LIBS+= -Wl,-bind_at_load
RESOURCES = application.qrc
MOC_DIR = bin
@ -92,6 +96,7 @@ FORMS += \
src/about.ui \
src/confirm.ui \
src/privkey.ui \
src/viewkey.ui \
src/memodialog.ui \
src/viewalladdresses.ui \
src/validateaddress.ui \

33
src/about.ui

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>497</width>
<height>448</height>
<width>1234</width>
<height>856</height>
</rect>
</property>
<property name="windowTitle">
@ -40,8 +40,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>463</width>
<height>517</height>
<width>1196</width>
<height>626</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -51,17 +51,20 @@
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.1pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;Copyright (c) 2019 Duke Leto, David Mercer and Aditya Kulkarni. (MIT License)&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;Special thanks to:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;JSON for Modern C++ : &lt;/span&gt;&lt;a href=&quot;https://nlohmann.github.io/json/&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;https://nlohmann.github.io/json/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;QR Code generator library Nayuki : &lt;/span&gt;&lt;a href=&quot;https://www.nayuki.io/page/qr-code-generator-library&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;https://www.nayuki.io/page/qr-code-ge…&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;Made with QT : &lt;/span&gt;&lt;a href=&quot;https://www.qt.io/&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;https://www.qt.io/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;LICENSE:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &amp;quot;Software&amp;quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.&lt;/li&gt;
&lt;li style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The Software is provided &amp;quot;as is&amp;quot;, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:12pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8.1pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt;&quot;&gt;Copyright(c) 2019-2020 The Hush developers (GPLv3)&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt;&quot;&gt;Copyright (c) 2019 Duke Leto, David Mercer and Aditya Kulkarni. (MIT License)&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt;&quot;&gt;Special thanks to:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt;&quot;&gt;JSON for Modern C++ : &lt;/span&gt;&lt;a href=&quot;https://nlohmann.github.io/json/&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;https://nlohmann.github.io/json/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt;&quot;&gt;QR Code generator library Nayuki : &lt;/span&gt;&lt;a href=&quot;https://www.nayuki.io/page/qr-code-generator-library&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;https://www.nayuki.io/page/qr-code-ge…&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt;&quot;&gt;Made with QT : &lt;/span&gt;&lt;a href=&quot;https://www.qt.io/&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;https://www.qt.io/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt;&quot;&gt;LICENSE:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.en.html
&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;GPL Version 3&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px; text-decoration: underline; color:#0000ff;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>

4
src/addresscombo.cpp

@ -27,13 +27,13 @@ void AddressCombo::setCurrentText(const QString& text) {
void AddressCombo::addItem(const QString& text, double bal) {
QString txt = AddressBook::addLabelToAddress(text);
if (bal > 0)
txt = txt % "(" % Settings::getZECDisplayFormat(bal) % ")";
txt = txt % "(" % Settings::getDisplayFormat(bal) % ")";
QComboBox::addItem(txt);
}
void AddressCombo::insertItem(int index, const QString& text, double bal) {
QString txt = AddressBook::addLabelToAddress(text) %
"(" % Settings::getZECDisplayFormat(bal) % ")";
"(" % Settings::getDisplayFormat(bal) % ")";
QComboBox::insertItem(index, txt);
}

2
src/balancestablemodel.cpp

@ -87,7 +87,7 @@ QVariant BalancesTableModel::data(const QModelIndex &index, int role) const
if (role == Qt::DisplayRole) {
switch (index.column()) {
case 0: return AddressBook::addLabelToAddress(std::get<0>(modeldata->at(index.row())));
case 1: return Settings::getZECDisplayFormat(std::get<1>(modeldata->at(index.row())));
case 1: return Settings::getDisplayFormat(std::get<1>(modeldata->at(index.row())));
}
}

13
src/connection.cpp

@ -1,4 +1,4 @@
// Copyright 2019 The Hush developers
// Copyright 2019-2020 The Hush developers
// GPLv3
#include "connection.h"
#include "mainwindow.h"
@ -21,7 +21,7 @@ ConnectionLoader::ConnectionLoader(MainWindow* main, RPC* rpc) {
connD->setupUi(d);
QPixmap logo(":/img/res/logobig.gif");
connD->topIcon->setBasePixmap(logo.scaled(512, 512, Qt::KeepAspectRatio, Qt::SmoothTransformation));
main->logger->write("set topIcon");
//main->logger->write("set topIcon");
}
ConnectionLoader::~ConnectionLoader() {
@ -129,7 +129,7 @@ QString randomPassword() {
}
/**
* This will create a new HUSH3.conf, download Zcash parameters.
* This will create a new HUSH3.conf and download params if they cannot be found
*/
void ConnectionLoader::createZcashConf() {
main->logger->write("createZcashConf");
@ -347,7 +347,8 @@ bool ConnectionLoader::startEmbeddedZcashd() {
auto hushdProgram = appPath.absoluteFilePath("komodod");
#endif
if (!QFile(hushdProgram).exists()) {
//if (!QFile(hushdProgram).exists()) {
if (!QFile::exists(hushdProgram)) {
qDebug() << "Can't find hushd at " << hushdProgram;
main->logger->write("Can't find hushd at " + hushdProgram);
return false;
@ -387,7 +388,7 @@ bool ConnectionLoader::startEmbeddedZcashd() {
qDebug() << "Starting on Linux: " + hushdProgram + " " + params;
ezcashd->start(hushdProgram, arguments);
#elif defined(Q_OS_DARWIN)
qDebug() << "Starting on Darwin" + hushdProgram + " " + params;
qDebug() << "Starting on Darwin: " + hushdProgram + " " + params;
ezcashd->start(hushdProgram, arguments);
#elif defined(Q_OS_WIN64)
qDebug() << "Starting on Win64: " + hushdProgram + " " + params;
@ -460,7 +461,7 @@ Connection* ConnectionLoader::makeConnection(std::shared_ptr<ConnectionConfig> c
}
void ConnectionLoader::refreshZcashdState(Connection* connection, std::function<void(void)> refused) {
main->logger->write("refreshZcashdState");
main->logger->write("refreshing state");
json payload = {
{"jsonrpc", "1.0"},

242
src/mainwindow.cpp

@ -1,4 +1,5 @@
// Copyright 2019 The Hush Developers
// Copyright 2019-2020 The Hush Developers
// Released under the GPLv3
#include "mainwindow.h"
#include "addressbook.h"
#include "viewalladdresses.h"
@ -7,6 +8,7 @@
#include "ui_mobileappconnector.h"
#include "ui_addressbook.h"
#include "ui_privkey.h"
#include "ui_viewkey.h"
#include "ui_about.h"
#include "ui_settings.h"
#include "ui_viewalladdresses.h"
@ -55,6 +57,8 @@ MainWindow::MainWindow(QWidget *parent) :
QObject::connect(ui->actionDiscord, &QAction::triggered, this, &MainWindow::discord);
QObject::connect(ui->actionReportBug, &QAction::triggered, this, &MainWindow::reportbug);
QObject::connect(ui->actionWebsite, &QAction::triggered, this, &MainWindow::website);
// Set up check for updates action
@ -119,7 +123,9 @@ MainWindow::MainWindow(QWidget *parent) :
setupTransactionsTab();
setupReceiveTab();
setupBalancesTab();
setupZcashdTab();
setupMarketTab();
setupChatTab();
setupHushTab();
rpc = new RPC(this);
qDebug() << "Created RPC";
@ -133,7 +139,7 @@ MainWindow::MainWindow(QWidget *parent) :
if (ads->getAllowInternetConnection())
wormholecode = ads->getWormholeCode(ads->getSecretHex());
qDebug() << "MainWindow: createWebsocket with wormholcode=" << wormholecode;
qDebug() << "MainWindow: createWebsocket with wormholecode=" << wormholecode;
createWebsocket(wormholecode);
}
}
@ -225,13 +231,22 @@ void MainWindow::setupStatusBar() {
menu.addAction("Copy txid", [=]() {
QGuiApplication::clipboard()->setText(txid);
});
menu.addAction("View tx on block explorer", [=]() {
menu.addAction("Copy block explorer link", [=]() {
QString url;
auto explorer = Settings::getInstance()->getExplorer();
if (Settings::getInstance()->isTestnet()) {
url = explorer.testnetTxExplorerUrl + txid;
} else {
url = explorer.txExplorerUrl + txid;
}
else {
QGuiApplication::clipboard()->setText(url);
});
menu.addAction("View tx on block explorer", [=]() {
QString url;
auto explorer = Settings::getInstance()->getExplorer();
if (Settings::getInstance()->isTestnet()) {
url = explorer.testnetTxExplorerUrl + txid;
} else {
url = explorer.txExplorerUrl + txid;
}
QDesktopServices::openUrl(QUrl(url));
@ -265,6 +280,16 @@ void MainWindow::setupSettingsModal() {
Settings::getInstance()->setSaveZtxs(checked);
});
std::string currency_name;
try {
currency_name = Settings::getInstance()->get_currency_name();
} catch (const std::exception& e) {
qDebug() << QString("Currency name exception! : ") << e.what();
currency_name = "USD";
}
this->slot_change_currency(currency_name);
// Setup clear button
QObject::connect(settings.btnClearSaved, &QCheckBox::clicked, [=]() {
if (QMessageBox::warning(this, "Clear saved history?",
@ -282,8 +307,18 @@ void MainWindow::setupSettingsModal() {
QObject::connect(settings.comboBoxTheme, SIGNAL(currentIndexChanged(QString)), this, SLOT(slot_change_theme(QString)));
QObject::connect(settings.comboBoxTheme, &QComboBox::currentTextChanged, [=] (QString theme_name) {
this->slot_change_theme(theme_name);
// Tell the user to restart
QMessageBox::information(this, tr("Restart"), tr("Please restart SilentDragon to have the theme apply"), QMessageBox::Ok);
QMessageBox::information(this, tr("Theme Change"), tr("This change can take a few seconds."), QMessageBox::Ok);
});
// Set local currency
QString ticker = QString::fromStdString( Settings::getInstance()->get_currency_name() );
int currency_index = settings.comboBoxCurrency->findText(ticker, Qt::MatchExactly);
settings.comboBoxCurrency->setCurrentIndex(currency_index);
QObject::connect(settings.comboBoxCurrency, SIGNAL(currentIndexChanged(QString)), this, SLOT(slot_change_currency(QString)));
QObject::connect(settings.comboBoxCurrency, &QComboBox::currentTextChanged, [=] (QString ticker) {
this->slot_change_currency(ticker.toStdString());
rpc->refresh(true);
QMessageBox::information(this, tr("Currency Change"), tr("This change can take a few seconds."), QMessageBox::Ok);
});
// Save sent transactions
@ -363,6 +398,7 @@ void MainWindow::setupSettingsModal() {
}
if (settingsDialog.exec() == QDialog::Accepted) {
qDebug() << "Setting dialog box accepted";
// Custom fees
bool customFees = settings.chkCustomFees->isChecked();
Settings::getInstance()->setAllowCustomFees(customFees);
@ -459,6 +495,11 @@ void MainWindow::discord() {
QDesktopServices::openUrl(QUrl(url));
}
void MainWindow::reportbug() {
QString url = "https://github.com/MyHush/SilentDragon/issues/new";
QDesktopServices::openUrl(QUrl(url));
}
void MainWindow::website() {
QString url = "https://myhush.org";
QDesktopServices::openUrl(QUrl(url));
@ -581,7 +622,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event) {
}
// Pay the Zcash URI by showing a confirmation window. If the URI parameter is empty, the UI
// Pay the Hush URI by showing a confirmation window. If the URI parameter is empty, the UI
// will prompt for one. If the myAddr is empty, then the default from address is used to send
// the transaction.
void MainWindow::payZcashURI(QString uri, QString myAddr) {
@ -735,6 +776,68 @@ void MainWindow::exportAllKeys() {
exportKeys("");
}
void MainWindow::getViewKey(QString addr) {
QDialog d(this);
Ui_ViewKey vui;
vui.setupUi(&d);
// Make the window big by default
auto ps = this->geometry();
QMargins margin = QMargins() + 50;
d.setGeometry(ps.marginsRemoved(margin));
Settings::saveRestore(&d);
vui.viewKeyTxt->setPlainText(tr("Loading..."));
vui.viewKeyTxt->setReadOnly(true);
vui.viewKeyTxt->setLineWrapMode(QPlainTextEdit::LineWrapMode::NoWrap);
// Disable the save button until it finishes loading
vui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
vui.buttonBox->button(QDialogButtonBox::Ok)->setVisible(false);
bool allKeys = false; //addr.isEmpty() ? true : false;
// Wire up save button
QObject::connect(vui.buttonBox->button(QDialogButtonBox::Save), &QPushButton::clicked, [=] () {
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"),
allKeys ? "hush-all-viewkeys.txt" : "hush-viewkey.txt");
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly)) {
QMessageBox::information(this, tr("Unable to open file"), file.errorString());
return;
}
QTextStream out(&file);
// TODO: Output in address, viewkey CSV format?
out << vui.viewKeyTxt->toPlainText();
});
auto isDialogAlive = std::make_shared<bool>(true);
auto fnUpdateUIWithKeys = [=](QList<QPair<QString, QString>> viewKeys) {
// Check to see if we are still showing.
if (! *(isDialogAlive.get()) ) return;
QString allKeysTxt;
for (auto keypair : viewKeys) {
allKeysTxt = allKeysTxt % keypair.second % " # addr=" % keypair.first % "\n";
}
vui.viewKeyTxt->setPlainText(allKeysTxt);
vui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(true);
};
auto fnAddKey = [=](json key) {
QList<QPair<QString, QString>> singleAddrKey;
singleAddrKey.push_back(QPair<QString, QString>(addr, QString::fromStdString(key.get<json::string_t>())));
fnUpdateUIWithKeys(singleAddrKey);
};
rpc->getZViewKey(addr, fnAddKey);
d.exec();
*isDialogAlive = false;
}
void MainWindow::exportKeys(QString addr) {
bool allKeys = addr.isEmpty() ? true : false;
@ -803,8 +906,7 @@ void MainWindow::exportKeys(QString addr) {
if (Settings::getInstance()->isZAddress(addr)) {
rpc->getZPrivKey(addr, fnAddKey);
}
else {
} else {
rpc->getTPrivKey(addr, fnAddKey);
}
}
@ -873,10 +975,20 @@ void MainWindow::setupBalancesTab() {
this->exportKeys(addr);
});
if (addr.startsWith("zs1")) {
menu.addAction(tr("Get viewing key"), [=] () {
this->getViewKey(addr);
});
}
menu.addAction("Send from " % addr.left(40) % (addr.size() > 40 ? "..." : ""), [=]() {
fnDoSendFrom(addr);
});
menu.addAction("Send to " % addr.left(40) % (addr.size() > 40 ? "..." : ""), [=]() {
fnDoSendFrom("",addr);
});
if (addr.startsWith("R")) {
auto defaultSapling = rpc->getDefaultSaplingAddress();
if (!defaultSapling.isEmpty()) {
@ -889,7 +1001,6 @@ void MainWindow::setupBalancesTab() {
QString url;
auto explorer = Settings::getInstance()->getExplorer();
if (Settings::getInstance()->isTestnet()) {
//TODO
url = explorer.testnetAddressExplorerUrl + addr;
} else {
url = explorer.addressExplorerUrl + addr;
@ -897,6 +1008,17 @@ void MainWindow::setupBalancesTab() {
QDesktopServices::openUrl(QUrl(url));
});
menu.addAction("Copy explorer link", [=]() {
QString url;
auto explorer = Settings::getInstance()->getExplorer();
if (Settings::getInstance()->isTestnet()) {
url = explorer.testnetAddressExplorerUrl + addr;
} else {
url = explorer.addressExplorerUrl + addr;
}
QGuiApplication::clipboard()->setText(url);
});
menu.addAction(tr("Address Asset Viewer"), [=] () {
QString url;
url = "https://dexstats.info/assetviewer.php?address=" + addr;
@ -914,10 +1036,51 @@ void MainWindow::setupBalancesTab() {
});
}
void MainWindow::setupZcashdTab() {
void MainWindow::setupHushTab() {
ui->hushlogo->setBasePixmap(QPixmap(":/img/res/zcashdlogo.gif"));
}
void MainWindow::setupChatTab() {
qDebug() << __FUNCTION__;
QList<QPair<QString,QString>> addressLabels = AddressBook::getInstance()->getAllAddressLabels();
QStringListModel *chatModel = new QStringListModel();
QStringList contacts;
//contacts << "Alice" << "Bob" << "Charlie" << "Eve";
for (int i = 0; i < addressLabels.size(); ++i) {
QPair<QString,QString> pair = addressLabels.at(i);
qDebug() << "Found contact " << pair.first << " " << pair.second;
contacts << pair.first;
}
chatModel->setStringList(contacts);
QStringListModel *conversationModel = new QStringListModel();
QStringList conversations;
conversations << "Bring home some milk" << "Markets look rough" << "How's the weather?" << "Is this on?";
conversationModel->setStringList(conversations);
//Ui_addressBook ab;
//AddressBookModel model(ab.addresses);
//ab.addresses->setModel(&model);
//TODO: ui->contactsView->setModel( model of address book );
//ui->contactsView->setModel(&model );
ui->contactsView->setModel(chatModel);
ui->chatView->setModel( conversationModel );
}
void MainWindow::setupMarketTab() {
qDebug() << "Setting up market tab";
auto s = Settings::getInstance();
auto ticker = s->get_currency_name();
ui->volume->setText(QString::number((double) s->get_volume("HUSH") ,'f',8) + " HUSH");
ui->volumeLocal->setText(QString::number((double) s->get_volume(ticker) ,'f',8) + " " + QString::fromStdString(ticker));
ui->volumeBTC->setText(QString::number((double) s->get_volume("BTC") ,'f',8) + " BTC");
}
void MainWindow::setupTransactionsTab() {
// Double click opens up memo if one exists
QObject::connect(ui->transactionsTable, &QTableView::doubleClicked, [=] (auto index) {
@ -971,6 +1134,17 @@ void MainWindow::setupTransactionsTab() {
QDesktopServices::openUrl(QUrl(url));
});
menu.addAction(tr("Copy block explorer link"), [=] () {
QString url;
auto explorer = Settings::getInstance()->getExplorer();
if (Settings::getInstance()->isTestnet()) {
url = explorer.testnetTxExplorerUrl + txid;
} else {
url = explorer.txExplorerUrl + txid;
}
QGuiApplication::clipboard()->setText(url);
});
// Payment Request
if (!memo.isEmpty() && memo.startsWith("hush:")) {
menu.addAction(tr("View Payment Request"), [=] () {
@ -993,8 +1167,7 @@ void MainWindow::setupTransactionsTab() {
int lastPost = memo.trimmed().lastIndexOf(QRegExp("[\r\n]+"));
QString lastWord = memo.right(memo.length() - lastPost - 1);
if (Settings::getInstance()->isSaplingAddress(lastWord) ||
Settings::getInstance()->isSproutAddress(lastWord)) {
if (Settings::getInstance()->isSaplingAddress(lastWord)) {
menu.addAction(tr("Reply to ") + lastWord.left(25) + "...", [=]() {
// First, cancel any pending stuff in the send tab by pretending to click
// the cancel button
@ -1020,26 +1193,24 @@ void MainWindow::setupTransactionsTab() {
});
}
void MainWindow::addNewZaddr(bool sapling) {
rpc->newZaddr(sapling, [=] (json reply) {
void MainWindow::addNewZaddr() {
rpc->newZaddr( [=] (json reply) {
QString addr = QString::fromStdString(reply.get<json::string_t>());
// Make sure the RPC class reloads the z-addrs for future use
rpc->refreshAddresses();
// Just double make sure the z-address is still checked
if ( sapling && ui->rdioZSAddr->isChecked() ) {
if ( ui->rdioZSAddr->isChecked() ) {
ui->listReceiveAddresses->insertItem(0, addr);
ui->listReceiveAddresses->setCurrentIndex(0);
ui->statusBar->showMessage(QString::fromStdString("Created new zAddr") %
(sapling ? "(Sapling)" : "(Sprout)"),
10 * 1000);
ui->statusBar->showMessage(QString::fromStdString("Created new Sapling zaddr"), 10 * 1000);
}
});
}
// Adds sapling or sprout z-addresses to the combo box. Technically, returns a
// Adds z-addresses to the combo box. Technically, returns a
// lambda, which can be connected to the appropriate signal
std::function<void(bool)> MainWindow::addZAddrsToComboList(bool sapling) {
return [=] (bool checked) {
@ -1059,7 +1230,7 @@ std::function<void(bool)> MainWindow::addZAddrsToComboList(bool sapling) {
// If z-addrs are empty, then create a new one.
if (addrs->isEmpty()) {
addNewZaddr(sapling);
addNewZaddr();
}
}
};
@ -1144,7 +1315,7 @@ void MainWindow::setupReceiveTab() {
return;
if (ui->rdioZSAddr->isChecked()) {
addNewZaddr(true);
addNewZaddr();
} else if (ui->rdioTAddr->isChecked()) {
addNewTAddr();
}
@ -1279,18 +1450,33 @@ void MainWindow::updateLabels() {
updateLabelsAutoComplete();
}
void MainWindow::slot_change_currency(const std::string& currency_name)
{
qDebug() << "slot_change_currency"; //<< ": " << currency_name;
Settings::getInstance()->set_currency_name(currency_name);
qDebug() << "Refreshing price stats after currency change";
rpc->refreshPrice();
// Include currency
std::string saved_currency_name;
try {
saved_currency_name = Settings::getInstance()->get_currency_name();
} catch (const std::exception& e) {
qDebug() << QString("Ignoring currency change Exception! : ") << e.what();
saved_currency_name = "USD";
}
}
void MainWindow::slot_change_theme(const QString& theme_name)
{
Settings::getInstance()->set_theme_name(theme_name);
// Include css
QString saved_theme_name;
try
{
try {
saved_theme_name = Settings::getInstance()->get_theme_name();
}
catch (...)
{
} catch (const std::exception& e) {
qDebug() << QString("Ignoring theme change Exception! : ") << e.what();
saved_theme_name = "default";
}

9
src/mainwindow.h

@ -80,9 +80,12 @@ private:
void setupTransactionsTab();
void setupReceiveTab();
void setupBalancesTab();
void setupZcashdTab();
void setupHushTab();
void setupChatTab();
void setupMarketTab();
void slot_change_theme(const QString& themeName);
void slot_change_currency(const std::string& currencyName);
void setupTurnstileDialog();
void setupSettingsModal();
void setupStatusBar();
@ -106,7 +109,7 @@ private:
void addressChanged(int number, const QString& text);
void amountChanged (int number, const QString& text);
void addNewZaddr(bool sapling);
void addNewZaddr();
std::function<void(bool)> addZAddrsToComboList(bool sapling);
void memoButtonClicked(int number, bool includeReplyTo = false);
@ -116,11 +119,13 @@ private:
void donate();
void website();
void discord();
void reportbug();
void addressBook();
void postToZBoard();
void importPrivKey();
void exportAllKeys();
void exportKeys(QString addr = "");
void getViewKey(QString addr = "");
void backupWalletDat();
void exportTransactions();

184
src/mainwindow.ui

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>968</width>
<height>616</height>
<width>1487</width>
<height>1214</height>
</rect>
</property>
<property name="windowTitle">
@ -22,7 +22,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>5</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -148,7 +148,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_99">
<item>
@ -166,7 +165,7 @@
</font>
</property>
<property name="text">
<string></string>
<string/>
</property>
</widget>
</item>
@ -188,7 +187,6 @@
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -387,8 +385,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>920</width>
<height>301</height>
<width>1403</width>
<height>619</height>
</rect>
</property>
<layout class="QVBoxLayout" name="sendToLayout">
@ -740,7 +738,7 @@
</item>
<item>
<widget class="QRadioButton" name="rdioTAddr">
<property name="sizePolicy">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
@ -934,8 +932,122 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>Market</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="11" column="0" colspan="3">
<widget class="QLabel" name="label_24">
<property name="font">
<font>
<pointsize>15</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Hush Market Information&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="3">
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_31">
<property name="text">
<string>Market Cap</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="marketcap">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="13" column="2">
<widget class="QLabel" name="marketcapLocal">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="13" column="3">
<widget class="QLabel" name="marketcapBTC">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="volumeLabel">
<property name="text">
<string>24H Volume</string>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLabel" name="volume">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="14" column="2">
<widget class="QLabel" name="volumeLocal">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="14" column="3">
<widget class="QLabel" name="volumeBTC">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="chat_tab">
<attribute name="title">
<string>Chat</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QListView" name="contactsView"/>
</item>
<item row="1" column="1">
<widget class="QTextEdit" name="textEdit"/>
</item>
<item row="0" column="1">
<widget class="QListView" name="chatView"/>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>New HushChat</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>hushd</string>
@ -999,7 +1111,6 @@
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="notarizedhashlabel">
<property name="text">
@ -1021,7 +1132,6 @@
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="notarizedtxidlabel">
<property name="text">
@ -1043,7 +1153,6 @@
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="laglabel">
<property name="text">
@ -1065,7 +1174,6 @@
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="kmdversionlabel">
<property name="text">
@ -1087,8 +1195,6 @@
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="protocolversionlabel">
<property name="text">
@ -1110,8 +1216,6 @@
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="versionlabel">
<property name="text">
@ -1133,7 +1237,6 @@
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="p2pportlabel">
<property name="text">
@ -1155,8 +1258,6 @@
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="rpcportlabel">
<property name="text">
@ -1178,7 +1279,6 @@
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QLabel" name="clientnamelabel">
<property name="text">
@ -1200,7 +1300,6 @@
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QLabel" name="halvinglabel">
<property name="text">
@ -1222,7 +1321,6 @@
</property>
</widget>
</item>
<item row="17" column="0">
<widget class="QLabel" name="localserviceslabel">
<property name="text">
@ -1244,7 +1342,6 @@
</property>
</widget>
</item>
<item row="18" column="0">
<widget class="QLabel" name="longestchainlabel">
<property name="text">
@ -1266,7 +1363,6 @@
</property>
</widget>
</item>
<item row="19" column="0">
<widget class="QLabel" name="txcountlabel">
<property name="text">
@ -1288,8 +1384,27 @@
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QLabel" name="chaintxcountlabel">
<property name="text">
<string>Chain Transactions</string>
</property>
</widget>
</item>
<item row="20" column="2">
<widget class="QLabel" name="chaintxcount">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="20" column="1">
<widget class="QLabel" name="chaintxcountspacer">
<property name="text">
<string>|</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="solrate">
<property name="text">
@ -1375,8 +1490,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>968</width>
<height>22</height>
<width>1487</width>
<height>42</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -1402,6 +1517,7 @@
<addaction name="actionDiscord"/>
<addaction name="actionWebsite"/>
<addaction name="actionCheck_for_Updates"/>
<addaction name="actionReportBug"/>
<addaction name="actionAbout"/>
</widget>
<widget class="QMenu" name="menuApps">
@ -1435,6 +1551,11 @@
<string>&amp;About</string>
</property>
</action>
<action name="actionReportBug">
<property name="text">
<string>&amp;Report a bug on Github</string>
</property>
</action>
<action name="actionSettings">
<property name="text">
<string>&amp;Settings</string>
@ -1550,7 +1671,6 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>inputsCombo</tabstop>
<tabstop>Address1</tabstop>
<tabstop>Amount1</tabstop>

2
src/privkey.ui

@ -34,7 +34,7 @@
<item row="0" column="0">
<widget class="QLabel" name="helpLbl">
<property name="text">
<string notr="true">TextLabel</string>
<string notr="true">Private Key(s). Keep Secure!</string>
</property>
</widget>
</item>

148
src/rpc.cpp

@ -1,4 +1,5 @@
// Copyright 2019 The Hush Developers
// Copyright 2019-2020 The Hush Developers
// Released under the GPLv3
#include "rpc.h"
#include "addressbook.h"
@ -30,7 +31,7 @@ RPC::RPC(MainWindow* main) {
// Set up timer to refresh Price
priceTimer = new QTimer(main);
QObject::connect(priceTimer, &QTimer::timeout, [=]() {
refreshZECPrice();
refreshPrice();
});
priceTimer->start(Settings::priceRefreshSpeed); // Every hour
@ -93,7 +94,7 @@ void RPC::setConnection(Connection* c) {
Settings::removeFromZcashConf(zcashConfLocation, "reindex");
// Refresh the UI
refreshZECPrice();
refreshPrice();
checkForUpdate();
// Force update, because this might be coming from a settings update
@ -153,12 +154,12 @@ void RPC::getZUnspent(const std::function<void(json)>& cb) {
conn->doRPCWithDefaultErrorHandling(payload, cb);
}
void RPC::newZaddr(bool sapling, const std::function<void(json)>& cb) {
void RPC::newZaddr(const std::function<void(json)>& cb) {
json payload = {
{"jsonrpc", "1.0"},
{"id", "someid"},
{"method", "z_getnewaddress"},
{"params", { sapling ? "sapling" : "sprout" }},
{"params", { "sapling" }},
};
conn->doRPCWithDefaultErrorHandling(payload, cb);
@ -170,6 +171,11 @@ void RPC::newTaddr(const std::function<void(json)>& cb) {
conn->doRPCWithDefaultErrorHandling(makePayload(method), cb);
}
void RPC::getZViewKey(QString addr, const std::function<void(json)>& cb) {
std::string method = "z_exportviewingkey";
conn->doRPCWithDefaultErrorHandling(makePayload(method, addr.toStdString()), cb);
}
void RPC::getZPrivKey(QString addr, const std::function<void(json)>& cb) {
std::string method = "z_exportkey";
conn->doRPCWithDefaultErrorHandling(makePayload(method, addr.toStdString()), cb);
@ -526,7 +532,7 @@ void RPC::refreshReceivedZTrans(QList<QString> zaddrs) {
);
}
/// This will refresh all the balance data from zcashd
/// This will refresh all the balance data from hushd
void RPC::refresh(bool force) {
if (conn == nullptr)
return noConnection();
@ -536,9 +542,7 @@ void RPC::refresh(bool force) {
void RPC::getInfoThenRefresh(bool force) {
//qDebug() << "getinfo";
if (conn == nullptr)
return noConnection();
@ -551,6 +555,7 @@ void RPC::getInfoThenRefresh(bool force) {
Settings::getInstance()->setTestnet(reply["testnet"].get<json::boolean_t>());
};
// TODO: checkmark only when getinfo.synced == true!
// Connected, so display checkmark.
QIcon i(":/icons/res/connected.gif");
main->statusIcon->setPixmap(i.pixmap(16, 16));
@ -633,22 +638,21 @@ void RPC::getInfoThenRefresh(bool force) {
});
std::string method2 = "getwalletinfo";
conn->doRPCIgnoreError(makePayload(method2), [=](const json& reply) {
conn->doRPCIgnoreError(makePayload("getwalletinfo"), [=](const json& reply) {
int txcount = reply["txcount"].get<json::number_integer_t>();
ui->txcount->setText(QString::number(txcount));
});
// Call to see if the blockchain is syncing.
payload = {
{"jsonrpc", "1.0"},
{"id", "someid"},
{"method", "getblockchaininfo"}
};
//TODO: If -zindex is enabled, show stats
conn->doRPCIgnoreError(makePayload("getchaintxstats"), [=](const json& reply) {
int txcount = reply["txcount"].get<json::number_integer_t>();
ui->chaintxcount->setText(QString::number(txcount));
});
conn->doRPCIgnoreError(payload, [=](const json& reply) {
// Call to see if the blockchain is syncing.
conn->doRPCIgnoreError(makePayload("getblockchaininfo"), [=](const json& reply) {
auto progress = reply["verificationprogress"].get<double>();
// TODO: use getinfo.synced
// TODO: use getinfo.synced
bool isSyncing = progress < 0.9999; // 99.99%
int blockNumber = reply["blocks"].get<json::number_unsigned_t>();
@ -657,10 +661,12 @@ void RPC::getInfoThenRefresh(bool force) {
estimatedheight = reply["estimatedheight"].get<json::number_unsigned_t>();
}
Settings::getInstance()->setSyncing(isSyncing);
Settings::getInstance()->setBlockNumber(blockNumber);
auto s = Settings::getInstance();
s->setSyncing(isSyncing);
s->setBlockNumber(blockNumber);
std::string ticker = s->get_currency_name();
// Update zcashd tab if it exists
// Update hushd tab
if (isSyncing) {
QString txt = QString::number(blockNumber);
if (estimatedheight > 0) {
@ -677,20 +683,28 @@ void RPC::getInfoThenRefresh(bool force) {
ui->heightLabel->setText(QObject::tr("Block height"));
}
auto ticker_price = s->get_price(ticker);
QString extra = "";
if(ticker_price > 0 && ticker != "BTC") {
extra = QString::number( s->getBTCPrice() ) % "sat";
}
QString price = "";
if (ticker_price > 0) {
price = QString(", ") % "HUSH" % "=" % QString::number( (double)ticker_price,'f',8) % " " % QString::fromStdString(ticker) % " " % extra;
}
// Update the status bar
QString statusText = QString() %
(isSyncing ? QObject::tr("Syncing") : QObject::tr("Connected")) %
" (" %
(Settings::getInstance()->isTestnet() ? QObject::tr("testnet:") : "") %
(s->isTestnet() ? QObject::tr("testnet:") : "") %
QString::number(blockNumber) %
(isSyncing ? ("/" % QString::number(progress*100, 'f', 2) % "%") : QString()) %
") " %
" Lag: " % QString::number(blockNumber - notarized) %
" HUSH/USD=$" % QString::number( (double) Settings::getInstance()->getZECPrice() ) %
" " % QString::number( Settings::getInstance()->getBTCPrice() ) % "sat";
" Lag: " % QString::number(blockNumber - notarized) % price;
main->statusLabel->setText(statusText);
auto zecPrice = Settings::getUSDFormat(1);
auto hushPrice = Settings::getUSDFormat(1);
QString tooltip;
if (connections > 0) {
tooltip = QObject::tr("Connected to hushd");
@ -698,10 +712,10 @@ void RPC::getInfoThenRefresh(bool force) {
else {
tooltip = QObject::tr("hushd has no peer connections! Network issues?");
}
tooltip = tooltip % "(v " % QString::number(Settings::getInstance()->getZcashdVersion()) % ")";
tooltip = tooltip % "(v" % QString::number(Settings::getInstance()->getZcashdVersion()) % ")";
if (!zecPrice.isEmpty()) {
tooltip = "1 HUSH = " % zecPrice % "\n" % tooltip;
if (!hushPrice.isEmpty()) {
tooltip = "1 HUSH = " % hushPrice % "\n" % tooltip;
}
main->statusLabel->setToolTip(tooltip);
main->statusIcon->setToolTip(tooltip);
@ -801,9 +815,9 @@ void RPC::refreshBalances() {
AppDataModel::getInstance()->setBalances(balT, balZ);
ui->balSheilded ->setText(Settings::getZECDisplayFormat(balZ));
ui->balTransparent->setText(Settings::getZECDisplayFormat(balT));
ui->balTotal ->setText(Settings::getZECDisplayFormat(balTotal));
ui->balSheilded ->setText(Settings::getDisplayFormat(balZ));
ui->balTransparent->setText(Settings::getDisplayFormat(balT));
ui->balTotal ->setText(Settings::getDisplayFormat(balTotal));
ui->balSheilded ->setToolTip(Settings::getUSDFormat(balZ));
ui->balTransparent->setToolTip(Settings::getUSDFormat(balT));
@ -1085,15 +1099,16 @@ void RPC::checkForUpdate(bool silent) {
}
// Get the HUSH prices
void RPC::refreshZECPrice() {
void RPC::refreshPrice() {
if (conn == nullptr)
return noConnection();
// TODO: use/render all this data
QUrl cmcURL("https://api.coingecko.com/api/v3/simple/price?ids=hush&vs_currencies=btc%2Cusd%2Ceur&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true");
QString price_feed = "https://api.coingecko.com/api/v3/simple/price?ids=hush&vs_currencies=btc%2Cusd%2Ceur%2Ceth%2Cgbp%2Ccny%2Cjpy%2Cidr%2Crub%2Ccad%2Csgd%2Cchf%2Cinr%2Caud%2Cinr%2Ckrw%2Cthb%2Cnzd%2Czar%2Cvef%2Cxau%2Cxag%2Cvnd%2Csar%2Ctwd%2Caed%2Cars%2Cbdt%2Cbhd%2Cbmd%2Cbrl%2Cclp%2Cczk%2Cdkk%2Chuf%2Cils%2Ckwd%2Clkr%2Cpkr%2Cnok%2Ctry%2Csek%2Cmxn%2Cuah%2Chkd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true";
QUrl cmcURL(price_feed);
QNetworkRequest req;
req.setUrl(cmcURL);
QNetworkReply *reply = conn->restclient->get(req);
auto s = Settings::getInstance();
QObject::connect(reply, &QNetworkReply::finished, [=] {
reply->deleteLater();
@ -1106,8 +1121,8 @@ void RPC::refreshZECPrice() {
} else {
qDebug() << reply->errorString();
}
Settings::getInstance()->setZECPrice(0);
Settings::getInstance()->setBTCPrice(0);
s->setZECPrice(0);
s->setBTCPrice(0);
return;
}
@ -1115,8 +1130,8 @@ void RPC::refreshZECPrice() {
auto all = reply->readAll();
auto parsed = json::parse(all, nullptr, false);
if (parsed.is_discarded()) {
Settings::getInstance()->setZECPrice(0);
Settings::getInstance()->setBTCPrice(0);
s->setZECPrice(0);
s->setBTCPrice(0);
return;
}
@ -1124,16 +1139,51 @@ void RPC::refreshZECPrice() {
const json& item = parsed.get<json::object_t>();
const json& hush = item["hush"].get<json::object_t>();
std::string ticker = s->get_currency_name();
std::for_each(ticker.begin(), ticker.end(), [](char & c){ c = ::tolower(c); });
fprintf(stderr,"ticker=%s\n", ticker.c_str());
//qDebug() << "Ticker = " + ticker;
if (hush["usd"] >= 0) {
if (hush[ticker] >= 0) {
qDebug() << "Found hush key in price json";
// TODO: support BTC/EUR prices as well
//QString price = QString::fromStdString(hush["usd"].get<json::string_t>());
qDebug() << "HUSH = $" << QString::number((double)hush["usd"]);
qDebug() << "HUSH = " << QString::number((double)hush["btc"]) << " sat ";
Settings::getInstance()->setZECPrice( hush["usd"] );
Settings::getInstance()->setBTCPrice( (unsigned int) 100000000 * (double)hush["btc"] );
qDebug() << "HUSH = $" << QString::number((double)hush["usd"]) << " USD";
qDebug() << "HUSH = " << QString::number((double)hush["eur"]) << " EUR";
qDebug() << "HUSH = " << QString::number((int) 100000000 * (double) hush["btc"]) << " sat ";
s->setZECPrice( hush[ticker] );
s->setBTCPrice( (unsigned int) 100000000 * (double)hush["btc"] );
std::for_each(ticker.begin(), ticker.end(), [](char & c){ c = ::tolower(c); });
qDebug() << "ticker=" << QString::fromStdString(ticker);
// TODO: work harder to prevent coredumps!
auto price = hush[ticker];
auto vol = hush[ticker + "_24h_vol"];
auto mcap = hush[ticker + "_market_cap"];
auto btcprice = hush["btc"];
auto btcvol = hush["btc_24h_vol"];
auto btcmcap = hush["btc_market_cap"];
s->set_price(ticker, price);
s->set_volume(ticker, vol);
s->set_volume("BTC", btcvol);
s->set_marketcap(ticker, mcap);
qDebug() << "Volume = " << (double) vol;
std::for_each(ticker.begin(), ticker.end(), [](char & c){ c = ::toupper(c); });
ui->volume->setText( QString::number((double) vol, 'f', 2) + " " + QString::fromStdString(ticker) );
ui->volumeBTC->setText( QString::number((double) btcvol, 'f', 2) + " BTC" );
std::for_each(ticker.begin(), ticker.end(), [](char & c){ c = ::toupper(c); });
// We don't get an actual HUSH volume stat, so we calculate it
if (price > 0)
ui->volumeLocal->setText( QString::number((double) vol / (double) price) + " HUSH");
qDebug() << "Mcap = " << (double) mcap;
ui->marketcap->setText( QString::number( (double) mcap, 'f', 2) + " " + QString::fromStdString(ticker) );
ui->marketcapBTC->setText( QString::number((double) btcmcap, 'f', 2) + " BTC" );
//ui->marketcapLocal->setText( QString::number((double) mcap * (double) price) + " " + QString::fromStdString(ticker) );
refresh(true);
return;
} else {
qDebug() << "No hush key found in JSON! API might be down or we are rate-limited\n";
@ -1150,7 +1200,7 @@ void RPC::refreshZECPrice() {
}
void RPC::shutdownZcashd() {
// Shutdown embedded zcashd if it was started
// Shutdown embedded hushd if it was started
if (ezcashd == nullptr || ezcashd->processId() == 0 || conn == nullptr) {
// No hushd running internally, just return
return;
@ -1179,7 +1229,7 @@ void RPC::shutdownZcashd() {
if ((ezcashd->atEnd() && ezcashd->processId() == 0) ||
ezcashd->state() == QProcess::NotRunning ||
waitCount > 30 ||
conn->config->zcashDaemon) { // If zcashd is daemon, then we don't have to do anything else
conn->config->zcashDaemon) { // If hushd is daemon, then we don't have to do anything else
qDebug() << "Ended";
waiter.stop();
QTimer::singleShot(1000, [&]() { d.accept(); });
@ -1189,7 +1239,7 @@ void RPC::shutdownZcashd() {
});
waiter.start(1000);
// Wait for the zcash process to exit.
// Wait for the hush process to exit.
if (!Settings::getInstance()->isHeadless()) {
d.exec();
} else {

5
src/rpc.h

@ -46,7 +46,7 @@ public:
void refreshAddresses();
void checkForUpdate(bool silent = true);
void refreshZECPrice();
void refreshPrice();
void getZboardTopics(std::function<void(QMap<QString, QString>)> cb);
void executeTransaction(Tx tx,
@ -68,10 +68,11 @@ public:
const QMap<QString, double>* getAllBalances() { return allBalances; }
const QMap<QString, bool>* getUsedAddresses() { return usedAddresses; }
void newZaddr(bool sapling, const std::function<void(json)>& cb);
void newZaddr(const std::function<void(json)>& cb);
void newTaddr(const std::function<void(json)>& cb);
void getZPrivKey(QString addr, const std::function<void(json)>& cb);
void getZViewKey(QString addr, const std::function<void(json)>& cb);
void getTPrivKey(QString addr, const std::function<void(json)>& cb);
void importZPrivKey(QString addr, bool rescan, const std::function<void(json)>& cb);
void importTPrivKey(QString addr, bool rescan, const std::function<void(json)>& cb);

17
src/scripts/docker/Dockerfile

@ -42,4 +42,21 @@ RUN cd /opt && \
cd /opt/mxe && \
make -j$(nproc) MXE_TARGETS=x86_64-w64-mingw32.static qtbase qtwebsockets
# Add rust
RUN apt install -y gcc-aarch64-linux-gnu
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.38.0 -y
RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
RUN ~/.cargo/bin/rustup target add x86_64-pc-windows-gnu
RUN ~/.cargo/bin/rustup target add aarch64-unknown-linux-gnu
# Append the linker to the cargo config for Windows cross compile
RUN echo "[target.x86_64-pc-windows-gnu]" >> ~/.cargo/config && \
echo "linker = 'x86_64-w64-mingw32.static-gcc'" >> ~/.cargo/config
RUN echo "[target.aarch64-unknown-linux-gnu]" >> ~/.cargo/config && \
echo "linker = '/usr/bin/aarch64-linux-gnu-gcc'" >> ~/.cargo/config
ENV CC_x86_64_pc_windows_gnu="x86_64-w64-mingw32.static-gcc"
ENV CC_aarch64_unknown_linux_gnu="aarch64-linux-gnu-gcc"
ENV PATH="/opt/mxe/usr/bin:${PATH}"

5
src/scripts/dotranslations.sh

@ -1,4 +1,6 @@
#!/bin/bash
# Copyright (c) 2019-2020 The Hush developers
# Released under the GPLv3
if [ -z $QT_STATIC ]; then
echo "QT_STATIC is not set. Please set it to the base directory of a statically compiled Qt";
@ -11,7 +13,6 @@ $QT_STATIC/bin/lrelease silentdragon.pro
# Then update the qt base translations. First, get all languages
ls res/*.qm | awk -F '[_.]' '{print $4}' | while read -r language ; do
if [ -f $QT_STATIC/translations/qtbase_$language.qm ]; then
$QT_STATIC/bin/lconvert -o res/zec_$language.qm $QT_STATIC/translations/qtbase_$language.qm res/silentdragon_$language.qm
mv res/zec_$language.qm res/silentdragon_$language.qm
$QT_STATIC/bin/lconvert -o res/silentdragon_$language.qm $QT_STATIC/translations/qtbase_$language.qm res/silentdragon_$language.qm
fi
done

49
src/scripts/make-binary-tarball.sh

@ -0,0 +1,49 @@
#!/bin/bash
# Copyright (c) 2020 The Hush developers
# Released under the GPLv3
APP_VERSION=$(cat src/version.h | cut -d\" -f2)
if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set"; exit 1; fi
# This assumes we already have a staticly compiled SD
set -e
OS=$(uname)
ARCH=$(uname -i)
APP=SilentDragon-v$APP_VERSION-$OS-$ARCH
DIR=$APP
echo "Making tarball for $APP..."
if [ -e $DIR ]; then
mv $DIR $DIR.$(perl -e 'print time')
fi
mkdir -p $DIR
strip silentdragon
strip komodod
strip komodo-tx
strip komodo-cli
cp silentdragon $DIR
cp komodod $DIR
cp komodo-cli $DIR
cp komodo-tx $DIR
cp hushd $DIR
cp hush-cli $DIR
cp hush-tx $DIR
cp README.md $DIR
cp LICENSE $DIR
# We make tarballs without params for people who already have them installed
echo "Creating $APP-noparams.tar.gz..."
tar czf $APP-noparams.tar.gz $DIR/
cp sapling-output.params $DIR
cp sapling-spend.params $DIR
# By default we tell users to use the normal tarball with params, which will
# be about 50MB larger but should cause less user support issues
echo "Creating $APP.tar.gz..."
tar czf $APP.tar.gz $DIR/
echo "CHECKSUMS for $APP_VERSION"
sha256sum $APP-noparams.tar.gz
sha256sum $APP.tar.gz

123
src/scripts/make-deb.sh

@ -0,0 +1,123 @@
#!/bin/bash
# Copyright (c) 2019-2020 The Hush developers
# Released under the GPLv3
DEBLOG=deb.log.$$
if [ -z $QT_STATIC ]; then
echo "QT_STATIC is not set. Please set it to the base directory of a statically compiled Qt";
exit 1;
fi
APP_VERSION=$(cat src/version.h | cut -d\" -f2)
if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set"; exit 1; fi
#if [ -z $PREV_VERSION ]; then echo "PREV_VERSION is not set"; exit 1; fi
if [ -z $HUSH_DIR ]; then
echo "HUSH_DIR is not set. Please set it to the base directory of hush3.git"
exit 1;
fi
if [ ! -f $HUSH_DIR/artifacts/komodod ]; then
echo "Couldn't find komodod in $HUSH_DIR/artifacts/. Please build komodod."
exit 1;
fi
if [ ! -f $HUSH_DIR/artifacts/komodo-cli ]; then
echo "Couldn't find komodo-cli in $HUSH_DIR/artifacts/. Please build komodod."
exit 1;
fi
echo -n "Cleaning..............."
rm -rf bin/*
rm -rf artifacts/*
make distclean >/dev/null 2>&1
echo "[OK]"
echo ""
echo "[Building $APP_VERSION on" `lsb_release -r`" logging to $DEBLOG ]"
echo -n "Translations............"
QT_STATIC=$QT_STATIC bash src/scripts/dotranslations.sh >/dev/null
echo -n "Configuring............"
$QT_STATIC/bin/qmake silentdragon.pro -spec linux-clang CONFIG+=release > /dev/null
echo "[OK]"
echo -n "Building..............."
rm -rf bin/silentdragon* > /dev/null
make clean > /dev/null
./build.sh release > /dev/null
echo "[OK]"
# Test for Qt
echo -n "Static link............"
if [[ $(ldd silentdragon | grep -i "Qt") ]]; then
echo "FOUND QT; ABORT";
exit 1
fi
echo "[OK]"
echo -n "Packaging.............."
APP=SilentDragon-v$APP_VERSION
DIR=bin/$APP
mkdir $DIR > /dev/null
strip silentdragon
cp silentdragon $DIR > /dev/null
cp $HUSH_DIR/artifacts/komodod $DIR > /dev/null
cp $HUSH_DIR/artifacts/komodo-cli $DIR > /dev/null
cp $HUSH_DIR/artifacts/komodo-tx $DIR > /dev/null
cp $HUSH_DIR/artifacts/hushd $DIR > /dev/null
cp $HUSH_DIR/artifacts/hush-cli $DIR > /dev/null
cp $HUSH_DIR/artifacts/hush-tx $DIR > /dev/null
cp README.md $DIR > /dev/null
cp LICENSE $DIR > /dev/null
cd bin && tar czf $APP.tar.gz $DIR/ > /dev/null
cd ..
mkdir artifacts >/dev/null 2>&1
cp $DIR.tar.gz ./artifacts/$APP-linux.tar.gz
echo "[OK]"
if [ -f artifacts/$APP-linux.tar.gz ] ; then
echo -n "Package contents......."
# Test if the package is built OK
if tar tf "artifacts/$APP-linux.tar.gz" | wc -l | grep -q "9"; then
echo "[OK]"
else
echo "[ERROR] Wrong number of files does not match 9"
exit 1
fi
else
echo "[ERROR]"
exit 1
fi
echo -n "Building deb..........."
debdir=bin/deb/silentdragon-v$APP_VERSION
mkdir -p $debdir > /dev/null
mkdir $debdir/DEBIAN
mkdir -p $debdir/usr/local/bin
cat src/scripts/control | sed "s/RELEASE_VERSION/$APP_VERSION/g" > $debdir/DEBIAN/control
cp silentdragon $debdir/usr/local/bin/
# TODO: how does this interact with hushd deb ?
cp $HUSH_DIR/artifacts/komodod $debdir/usr/local/bin/hush-komodod
mkdir -p $debdir/usr/share/pixmaps/
cp res/silentdragon.xpm $debdir/usr/share/pixmaps/
mkdir -p $debdir/usr/share/applications
cp src/scripts/desktopentry $debdir/usr/share/applications/silentdragon.desktop
dpkg-deb --build $debdir >/dev/null
cp $debdir.deb artifacts/$DIR.deb
echo "[OK]"
exit 0

40
src/scripts/make-only-deb.sh

@ -0,0 +1,40 @@
#!/bin/bash
# Copyright (c) 2020 The Hush developers
# Released under the GPLv3
echo "Let There Be Debian Packages"
set -e
#set -x
ARCH=$(uname -i)
APP_VERSION=$(cat src/version.h | cut -d\" -f2)
if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set"; exit 1; fi
# This assumes we already have a staticly compiled SD
echo "Building Debian package for $APP_VERSION-$ARCH..."
debdir=deb-SilentDragon-v$APP_VERSION-$ARCH
if [ -e $debdir ]; then
mv $debdir $debdir-backup.$(perl -e 'print time')
fi
mkdir -p $debdir > /dev/null
mkdir $debdir/DEBIAN
mkdir -p $debdir/usr/local/bin
cat src/scripts/control | sed "s/RELEASE_VERSION/$APP_VERSION/g" > $debdir/DEBIAN/control
# might have been done already, but just in case
strip silentdragon
cp silentdragon $debdir/usr/local/bin/
# TODO: We need an updated pixmap!
#mkdir -p $debdir/usr/share/pixmaps/
#cp res/silentdragon.xpm $debdir/usr/share/pixmaps/
mkdir -p $debdir/usr/share/applications
cp src/scripts/desktopentry $debdir/usr/share/applications/silentdragon.desktop
dpkg-deb --build $debdir >/dev/null
sha256sum $debdir.deb
exit 0

46
src/scripts/mkmacdmg.sh

@ -17,7 +17,17 @@ case $key in
shift # past argument
shift # past value
;;
-c|--certificate)
-u|--username)
APPLE_USERNAME="$2"
shift # past argument
shift # past value
;;
-p|--password)
APPLE_PASSWORD="$2"
shift # past argument
shift # past value
;;
-c|--certificate)
CERTIFICATE="$2"
shift # past argument
shift # past value
@ -45,6 +55,16 @@ if [ -z $HUSH_DIR ]; then
exit 1;
fi
if [ -z "$APPLE_USERNAME" ]; then
echo "APPLE_USERNAME is not set. Please set it the name of the MacOS developer login email to submit the binary for Apple for notarization";
exit 1;
fi
if [ -z "$APPLE_PASSWORD" ]; then
echo "APPLE_PASSWORD is not set. Please set it the name of the MacOS developer Application password to submit the binary for Apple for notarization";
exit 1;
fi
if [ -z "$CERTIFICATE" ]; then
echo "CERTIFICATE is not set. Please set it the name of the MacOS developer certificate to sign the binary with";
exit 1;
@ -94,31 +114,25 @@ cp $HUSH_DIR/src/hushd silentdragon.app/Contents/MacOS/
cp $HUSH_DIR/src/hush-cli silentdragon.app/Contents/MacOS/
cp $HUSH_DIR/src/komodod silentdragon.app/Contents/MacOS/
cp $HUSH_DIR/src/komodo-cli silentdragon.app/Contents/MacOS/
cp $HUSH_DIR/sapling-output.params silentdragon.app/Contents/MacOS/
cp $HUSH_DIR/sapling-spend.params silentdragon.app/Contents/MacOS/
$QT_PATH/bin/macdeployqt silentdragon.app
codesign --deep --force --verify --verbose -s "$CERTIFICATE" --options runtime --timestamp silentdragon.app
echo "[OK]"
# Code Signing Note:
# On MacOS, you still need to run these 3 commands:
# xcrun altool --notarize-app -t osx -f macOS-zecwallet-v0.8.0.dmg --primary-bundle-id="com.yourcompany.zecwallet" -u "apple developer id@email.com" -p "one time password"
# xcrun altool --notarization-info <output from pervious command> -u "apple developer id@email.com" -p "one time password"
#...wait for the notarization to finish...
# xcrun stapler staple macOS-zecwallet-v0.8.0.dmg
# On MacOS, you still need to run signbinaries.sh to staple.
#
echo -n "Building dmg..........."
mv silentdragon.app silentdragon.app
create-dmg --volname "silentdragon-v$APP_VERSION" --volicon "res/logo.icns" --window-pos 200 120 --icon "silentdragon.app" 200 190 --app-drop-link 600 185 --hide-extension "silentdragon.app" --window-size 800 400 --hdiutil-quiet --background res/dmgbg.png artifacts/macOS-silentdragon-v$APP_VERSION.dmg silentdragon.app >/dev/null 2>&1
#mkdir bin/dmgbuild >/dev/null 2>&1
#sed "s/RELEASE_VERSION/${APP_VERSION}/g" res/appdmg.json > bin/dmgbuild/appdmg.json
#cp res/logo.icns bin/dmgbuild/
#cp res/dmgbg.png bin/dmgbuild/
#cp -r silentdragon.app bin/dmgbuild/
#appdmg --quiet bin/dmgbuild/appdmg.json artifacts/macOS-silentdragon-v$APP_VERSION.dmg >/dev/null
if [ ! -f artifacts/macOS-silentdragon-v$APP_VERSION.dmg ]; then
echo "[ERROR]"
exit 1
fi
echo "[OK]"
# Submit to Apple for notarization
echo -n "Apple notarization....."
xcrun altool --notarize-app -t osx -f artifacts/macOS-silentdragon-v$APP_VERSION.dmg --primary-bundle-id="com.myHush.silentdragon" -u "$APPLE_USERNAME" -p "$APPLE_PASSWORD"
echo "[OK]"

129
src/scripts/mkrelease.sh

@ -7,39 +7,39 @@ fi
if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set"; exit 1; fi
if [ -z $PREV_VERSION ]; then echo "PREV_VERSION is not set"; exit 1; fi
if [ -z $ZCASH_DIR ]; then
echo "ZCASH_DIR is not set. Please set it to the base directory of a Zcash project with built Zcash binaries."
if [ -z $HUSH_DIR ]; then
echo "HUSH_DIR is not set. Please set it to the base directory of a Zcash project with built Zcash binaries."
exit 1;
fi
if [ ! -f $ZCASH_DIR/artifacts/zcashd ]; then
echo "Couldn't find zcashd in $ZCASH_DIR/artifacts/. Please build zcashd."
if [ ! -f $HUSH_DIR/artifacts/komodod ]; then
echo "Couldn't find komodod in $HUSH_DIR/artifacts/. Please build komodod."
exit 1;
fi
if [ ! -f $ZCASH_DIR/artifacts/zcash-cli ]; then
echo "Couldn't find zcash-cli in $ZCASH_DIR/artifacts/. Please build zcashd."
if [ ! -f $HUSH_DIR/artifacts/hush-cli ]; then
echo "Couldn't find hush-cli in $HUSH_DIR/artifacts/. Please build komodod."
exit 1;
fi
# Ensure that zcashd is the right build
echo -n "zcashd version........."
if grep -q "zqwMagicBean" $ZCASH_DIR/artifacts/zcashd && ! readelf -s $ZCASH_DIR/artifacts/zcashd | grep -q "GLIBC_2\.25"; then
echo "[OK]"
else
echo "[ERROR]"
echo "zcashd doesn't seem to be a zqwMagicBean build or zcashd is built with libc 2.25"
exit 1
fi
echo -n "zcashd.exe version....."
if grep -q "zqwMagicBean" $ZCASH_DIR/artifacts/zcashd.exe; then
echo "[OK]"
else
echo "[ERROR]"
echo "zcashd doesn't seem to be a zqwMagicBean build"
exit 1
fi
# Ensure that komodod is the right build
#echo -n "komodod version........."
#if grep -q "zqwMagicBean" $HUSH_DIR/artifacts/komodod && ! readelf -s $HUSH_DIR/artifacts/komodod | grep -q "GLIBC_2\.25"; then
# echo "[OK]"
#else
# echo "[ERROR]"
## echo "komodod doesn't seem to be a zqwMagicBean build or komodod is built with libc 2.25"
# exit 1
#fi
#echo -n "komodod.exe version....."
#if grep -q "zqwMagicBean" $HUSH_DIR/artifacts/komodod.exe; then
# echo "[OK]"
#else
# echo "[ERROR]"
# echo "komodod doesn't seem to be a zqwMagicBean build"
# exit 1
#fi
echo -n "Version files.........."
# Replace the version number in the .pro file so it gets picked up everywhere
@ -65,16 +65,15 @@ echo "[OK]"
echo -n "Building..............."
rm -rf bin/zec-qt-wallet* > /dev/null
rm -rf bin/zecwallet* > /dev/null
rm -rf bin/silentdragon* > /dev/null
make clean > /dev/null
make -j$(nproc) > /dev/null
./build.sh release > /dev/null
echo "[OK]"
# Test for Qt
echo -n "Static link............"
if [[ $(ldd zecwallet | grep -i "Qt") ]]; then
if [[ $(ldd silentdragon | grep -i "Qt") ]]; then
echo "FOUND QT; ABORT";
exit 1
fi
@ -82,27 +81,31 @@ echo "[OK]"
echo -n "Packaging.............."
mkdir bin/zecwallet-v$APP_VERSION > /dev/null
strip zecwallet
cp zecwallet bin/zecwallet-v$APP_VERSION > /dev/null
cp $ZCASH_DIR/artifacts/zcashd bin/zecwallet-v$APP_VERSION > /dev/null
cp $ZCASH_DIR/artifacts/zcash-cli bin/zecwallet-v$APP_VERSION > /dev/null
cp README.md bin/zecwallet-v$APP_VERSION > /dev/null
cp LICENSE bin/zecwallet-v$APP_VERSION > /dev/null
cd bin && tar czf linux-zecwallet-v$APP_VERSION.tar.gz zecwallet-v$APP_VERSION/ > /dev/null
mkdir bin/silentdragon-v$APP_VERSION > /dev/null
strip silentdragon
cp silentdragon bin/silentdragon-v$APP_VERSION > /dev/null
cp $HUSH_DIR/artifacts/komodod bin/silentdragon-v$APP_VERSION > /dev/null
cp $HUSH_DIR/artifacts/komodo-cli bin/silentdragon-v$APP_VERSION > /dev/null
cp $HUSH_DIR/artifacts/komodo-tx bin/silentdragon-v$APP_VERSION > /dev/null
cp $HUSH_DIR/artifacts/hushd bin/silentdragon-v$APP_VERSION > /dev/null
cp $HUSH_DIR/artifacts/hush-cli bin/silentdragon-v$APP_VERSION > /dev/null
cp $HUSH_DIR/artifacts/hush-tx bin/silentdragon-v$APP_VERSION > /dev/null
cp README.md bin/silentdragon-v$APP_VERSION > /dev/null
cp LICENSE bin/silentdragon-v$APP_VERSION > /dev/null
cd bin && tar czf linux-silentdragon-v$APP_VERSION.tar.gz silentdragon-v$APP_VERSION/ > /dev/null
cd ..
mkdir artifacts >/dev/null 2>&1
cp bin/linux-zecwallet-v$APP_VERSION.tar.gz ./artifacts/linux-binaries-zecwallet-v$APP_VERSION.tar.gz
cp bin/linux-silentdragon-v$APP_VERSION.tar.gz ./artifacts/linux-binaries-silentdragon-v$APP_VERSION.tar.gz
echo "[OK]"
if [ -f artifacts/linux-binaries-zecwallet-v$APP_VERSION.tar.gz ] ; then
if [ -f artifacts/linux-binaries-silentdragon-v$APP_VERSION.tar.gz ] ; then
echo -n "Package contents......."
# Test if the package is built OK
if tar tf "artifacts/linux-binaries-zecwallet-v$APP_VERSION.tar.gz" | wc -l | grep -q "6"; then
if tar tf "artifacts/linux-binaries-silentdragon-v$APP_VERSION.tar.gz" | wc -l | grep -q "6"; then
echo "[OK]"
else
echo "[ERROR]"
@ -114,24 +117,25 @@ else
fi
echo -n "Building deb..........."
debdir=bin/deb/zecwallet-v$APP_VERSION
debdir=bin/deb/silentdragon-v$APP_VERSION
mkdir -p $debdir > /dev/null
mkdir $debdir/DEBIAN
mkdir -p $debdir/usr/local/bin
cat src/scripts/control | sed "s/RELEASE_VERSION/$APP_VERSION/g" > $debdir/DEBIAN/control
cp zecwallet $debdir/usr/local/bin/
cp $ZCASH_DIR/artifacts/zcashd $debdir/usr/local/bin/zqw-zcashd
cp silentdragon $debdir/usr/local/bin/
# TODO: how does this interact with hushd deb ?
cp $HUSH_DIR/artifacts/komodod $debdir/usr/local/bin/hush-komodod
mkdir -p $debdir/usr/share/pixmaps/
cp res/zecwallet.xpm $debdir/usr/share/pixmaps/
cp res/silentdragon.xpm $debdir/usr/share/pixmaps/
mkdir -p $debdir/usr/share/applications
cp src/scripts/desktopentry $debdir/usr/share/applications/zec-qt-wallet.desktop
cp src/scripts/desktopentry $debdir/usr/share/applications/silentdragon.desktop
dpkg-deb --build $debdir >/dev/null
cp $debdir.deb artifacts/linux-deb-zecwallet-v$APP_VERSION.deb
cp $debdir.deb artifacts/linux-deb-silentdragon-v$APP_VERSION.deb
echo "[OK]"
@ -145,14 +149,14 @@ if [ -z $MXE_PATH ]; then
exit 0;
fi
if [ ! -f $ZCASH_DIR/artifacts/zcashd.exe ]; then
echo "Couldn't find zcashd.exe in $ZCASH_DIR/artifacts/. Please build zcashd.exe"
if [ ! -f $HUSH_DIR/artifacts/komodod.exe ]; then
echo "Couldn't find komodod.exe in $HUSH_DIR/artifacts/. Please build komodod.exe"
exit 1;
fi
if [ ! -f $ZCASH_DIR/artifacts/zcash-cli.exe ]; then
echo "Couldn't find zcash-cli.exe in $ZCASH_DIR/artifacts/. Please build zcashd.exe"
if [ ! -f $HUSH_DIR/artifacts/komodo-cli.exe ]; then
echo "Couldn't find komodo-cli.exe in $HUSH_DIR/artifacts/. Please build komodod-cli.exe"
exit 1;
fi
@ -168,28 +172,31 @@ echo "[OK]"
echo -n "Building..............."
# TODO: where is this .pro file?
x86_64-w64-mingw32.static-qmake-qt5 zec-qt-wallet-mingw.pro CONFIG+=release > /dev/null
make -j32 > /dev/null
echo "[OK]"
echo -n "Packaging.............."
mkdir release/zecwallet-v$APP_VERSION
cp release/zecwallet.exe release/zecwallet-v$APP_VERSION
cp $ZCASH_DIR/artifacts/zcashd.exe release/zecwallet-v$APP_VERSION > /dev/null
cp $ZCASH_DIR/artifacts/zcash-cli.exe release/zecwallet-v$APP_VERSION > /dev/null
cp README.md release/zecwallet-v$APP_VERSION
cp LICENSE release/zecwallet-v$APP_VERSION
cd release && zip -r Windows-binaries-zecwallet-v$APP_VERSION.zip zecwallet-v$APP_VERSION/ > /dev/null
mkdir release/silentdragon-v$APP_VERSION
cp release/silentdragon.exe release/silentdragon-v$APP_VERSION
cp $HUSH_DIR/artifacts/komodod.exe release/silentdragon-v$APP_VERSION > /dev/null
cp $HUSH_DIR/artifacts/komodo-cli.exe release/silentdragon-v$APP_VERSION > /dev/null
cp $HUSH_DIR/artifacts/hushd.bat release/silentdragon-v$APP_VERSION > /dev/null
cp $HUSH_DIR/artifacts/hush-cli.bat release/silentdragon-v$APP_VERSION > /dev/null
cp README.md release/silentdragon-v$APP_VERSION
cp LICENSE release/silentdragon-v$APP_VERSION
cd release && zip -r Windows-binaries-silentdragon-v$APP_VERSION.zip silentdragon-v$APP_VERSION/ > /dev/null
cd ..
mkdir artifacts >/dev/null 2>&1
cp release/Windows-binaries-zecwallet-v$APP_VERSION.zip ./artifacts/
cp release/Windows-binaries-silentdragon-v$APP_VERSION.zip ./artifacts/
echo "[OK]"
if [ -f artifacts/Windows-binaries-zecwallet-v$APP_VERSION.zip ] ; then
if [ -f artifacts/Windows-binaries-silentdragon-v$APP_VERSION.zip ] ; then
echo -n "Package contents......."
if unzip -l "artifacts/Windows-binaries-zecwallet-v$APP_VERSION.zip" | wc -l | grep -q "11"; then
if unzip -l "artifacts/Windows-binaries-silentdragon-v$APP_VERSION.zip" | wc -l | grep -q "11"; then
echo "[OK]"
else
echo "[ERROR]"

7
src/scripts/signbinaries.sh

@ -24,7 +24,12 @@ if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set"; exit 1; fi
# Store the hash and signatures here
rm -rf release/signatures
mkdir -p release/signatures
mkdir -p release/signatures
# Staple the notarization
xcrun stapler staple artifacts/macOS-silentdragon-v$APP_VERSION.dmg
cd artifacts
cd artifacts

16
src/sendtab.cpp

@ -1,4 +1,4 @@
// Copyright 2019 The Hush developers
// Copyright 2019-2020 Hush developers
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "addressbook.h"
@ -196,7 +196,7 @@ void MainWindow::updateFromCombo() {
void MainWindow::inputComboTextChanged(int index) {
auto addr = ui->inputsCombo->itemText(index);
auto bal = rpc->getAllBalances()->value(addr);
auto balFmt = Settings::getZECDisplayFormat(bal);
auto balFmt = Settings::getDisplayFormat(bal);
ui->sendAddressBalance->setText(balFmt);
ui->sendAddressBalanceUSD->setText(Settings::getUSDFormat(bal));
@ -497,9 +497,6 @@ Tx MainWindow::createTxFromSendPage() {
// Remove label if it exists
addr = AddressBook::addressFromAddressLabel(addr);
// If address is sprout, then we can't send change to sapling, because of turnstile.
//sendChangeToSapling = sendChangeToSapling && !Settings::getInstance()->isSproutAddress(addr);
double amt = ui->sendToWidgets->findChild<QLineEdit*>(QString("Amount") % QString::number(i+1))->text().trimmed().toDouble();
totalAmt += amt;
QString memo = ui->sendToWidgets->findChild<QLabel*>(QString("MemoTxt") % QString::number(i+1))->text().trimmed();
@ -598,7 +595,7 @@ bool MainWindow::confirmTx(Tx tx) {
// Amount (HUSH)
auto Amt = new QLabel(confirm.sendToAddrs);
Amt->setObjectName(QString("Amt") % QString::number(i + 1));
Amt->setText(Settings::getZECDisplayFormat(toAddr.amount));
Amt->setText(Settings::getDisplayFormat(toAddr.amount));
Amt->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
confirm.gridLayout->addWidget(Amt, row, 1, 1, 1);
totalSpending += toAddr.amount;
@ -648,7 +645,7 @@ bool MainWindow::confirmTx(Tx tx) {
minerFee->setObjectName(QStringLiteral("minerFee"));
minerFee->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
confirm.gridLayout->addWidget(minerFee, row, 1, 1, 1);
minerFee->setText(Settings::getZECDisplayFormat(tx.fee));
minerFee->setText(Settings::getDisplayFormat(tx.fee));
totalSpending += tx.fee;
auto minerFeeUSD = new QLabel(confirm.sendToAddrs);
@ -732,7 +729,10 @@ void MainWindow::sendButton() {
QString MainWindow::doSendTxValidations(Tx tx) {
//TODO: Feedback fromAddr is empty for some reason
if (!Settings::isValidAddress(tx.fromAddr)) return QString(tr("From Address is Invalid"));
if (!Settings::isValidAddress(tx.fromAddr)){
qDebug() << "address is invalid! " << tx.fromAddr;
return QString(tr("From Address is Invalid!"));
}
for (auto toAddr : tx.toAddrs) {
if (!Settings::isValidAddress(toAddr.addr)) {

2
src/senttxstore.cpp

@ -90,7 +90,7 @@ void SentTxStore::addToSentTx(Tx tx, QString txid) {
} else {
// Concatenate all the toAddresses
for (auto a : tx.toAddrs) {
toAddresses += a.addr % "(" % Settings::getZECDisplayFormat(a.amount) % ") ";
toAddresses += a.addr % "(" % Settings::getDisplayFormat(a.amount) % ") ";
}
}

87
src/settings.cpp

@ -1,4 +1,5 @@
// Copyright 2019 The Hush developers
// Copyright 2019-2020 Hush developers
// Released under the GPLv3
#include "mainwindow.h"
#include "settings.h"
@ -162,6 +163,63 @@ double Settings::getZECPrice() {
return zecPrice;
}
double Settings::get_price(std::string currency) {
std::for_each(currency.begin(), currency.end(), [](char & c){ c = ::tolower(c); });
QString ticker = QString::fromStdString(currency);
auto search = prices.find(currency);
if (search != prices.end()) {
qDebug() << "Found price of " << ticker << " = " << search->second;
return search->second;
} else {
qDebug() << "Could not find price of" << ticker << "!!!";
return 0.0;
}
}
void Settings::set_price(std::string curr, double price) {
QString ticker = QString::fromStdString(curr);
qDebug() << "Setting price of " << ticker << "=" << QString::number(price);
prices.insert( std::make_pair(curr, price) );
}
void Settings::set_volume(std::string curr, double volume) {
QString ticker = QString::fromStdString(curr);
qDebug() << "Setting volume of " << ticker << "=" << QString::number(volume);
volumes.insert( std::make_pair(curr, volume) );
}
double Settings::get_volume(std::string currency) {
std::for_each(currency.begin(), currency.end(), [](char & c){ c = ::tolower(c); });
QString ticker = QString::fromStdString(currency);
auto search = volumes.find(currency);
if (search != volumes.end()) {
qDebug() << "Found volume of " << ticker << " = " << search->second;
return search->second;
} else {
qDebug() << "Could not find volume of" << ticker << "!!!";
return 0.0;
}
}
void Settings::set_marketcap(std::string curr, double marketcap) {
QString ticker = QString::fromStdString(curr);
qDebug() << "Setting marketcap of " << ticker << "=" << QString::number(marketcap);
marketcaps.insert( std::make_pair(curr, marketcap) );
}
double Settings::get_marketcap(std::string currency) {
std::for_each(currency.begin(), currency.end(), [](char & c){ c = ::tolower(c); });
QString ticker = QString::fromStdString(currency);
auto search = marketcaps.find(currency);
if (search != marketcaps.end()) {
qDebug() << "Found marketcap of " << ticker << " = " << search->second;
return search->second;
} else {
qDebug() << "Could not find marketcap of" << ticker << "!!!";
return -1.0;
}
}
unsigned int Settings::getBTCPrice() {
// in satoshis
return btcPrice;
@ -222,7 +280,8 @@ void Settings::saveRestore(QDialog* d) {
}
QString Settings::getUSDFormat(double bal) {
return "$" + QLocale(QLocale::English).toString(bal * Settings::getInstance()->getZECPrice(), 'f', 2);
//TODO: respect current locale!
return QLocale(QLocale::English).toString(bal * Settings::getInstance()->getZECPrice(), 'f', 8) + " " + QString::fromStdString(Settings::getInstance()->get_currency_name());
}
QString Settings::getDecimalString(double amt) {
@ -237,7 +296,7 @@ QString Settings::getDecimalString(double amt) {
return f;
}
QString Settings::getZECDisplayFormat(double bal) {
QString Settings::getDisplayFormat(double bal) {
// This is idiotic. Why doesn't QString have a way to do this?
return getDecimalString(bal) % " " % Settings::getTokenName();
}
@ -245,25 +304,27 @@ QString Settings::getZECDisplayFormat(double bal) {
QString Settings::getZECUSDDisplayFormat(double bal) {
auto usdFormat = getUSDFormat(bal);
if (!usdFormat.isEmpty())
return getZECDisplayFormat(bal) % " (" % getUSDFormat(bal) % ")";
return getDisplayFormat(bal) % " (" % getUSDFormat(bal) % ")";
else
return getZECDisplayFormat(bal);
return getDisplayFormat(bal);
}
const QString Settings::txidStatusMessage = QString(QObject::tr("Tx submitted (right click to copy) txid:"));
const QString Settings::txidStatusMessage = QString(QObject::tr("Transaction submitted (right click to copy) txid:"));
QString Settings::getTokenName() {
if (Settings::getInstance()->isTestnet()) {
return "HUSHT";
return "TUSH";
} else {
return "HUSH";
}
}
//TODO: this isn't used for donations
QString Settings::getDonationAddr() {
if (Settings::getInstance()->isTestnet()) {
return "ztestsaplingXXX";
}
// This is used for user feedback
return "zs1aq4xnrkjlnxx0zesqye7jz3dfrf3rjh7q5z6u8l6mwyqqaam3gx3j2fkqakp33v93yavq46j83q";
}
@ -280,6 +341,16 @@ bool Settings::addToZcashConf(QString confLocation, QString line) {
return true;
}
std::string Settings::get_currency_name() {
// Load from the QT Settings.
return QSettings().value("options/currency_name", "BTC").toString().toStdString();
}
void Settings::set_currency_name(std::string currency_name) {
QSettings().setValue("options/currency_name", QString::fromStdString(currency_name));
}
bool Settings::removeFromZcashConf(QString confLocation, QString option) {
if (confLocation.isEmpty())
return false;
@ -339,7 +410,7 @@ bool Settings::isValidAddress(QString addr) {
// Get a pretty string representation of this Payment URI
QString Settings::paymentURIPretty(PaymentURI uri) {
return QString() + "Payment Request\n" + "Pay: " + uri.addr + "\nAmount: " + getZECDisplayFormat(uri.amt.toDouble())
return QString() + "Payment Request\n" + "Pay: " + uri.addr + "\nAmount: " + getDisplayFormat(uri.amt.toDouble())
+ "\nMemo:" + QUrl::fromPercentEncoding(uri.memo.toUtf8());
}

23
src/settings.h

@ -85,13 +85,24 @@ public:
QString get_theme_name();
void set_theme_name(QString theme_name);
std::string get_currency_name();
void set_currency_name(std::string currency_name);
void setUsingZcashConf(QString confLocation);
const QString& getZcashdConfLocation() { return _confLocation; }
void setZECPrice(double p) { zecPrice = p; }
void setBTCPrice(unsigned int p) { btcPrice = p; }
void setZECPrice(double p) { zecPrice = p; }
void set_fiat_price(double p) { fiat_price = p; }
void setBTCPrice(unsigned int p) { btcPrice = p; }
double getZECPrice();
double get_fiat_price();
unsigned int getBTCPrice();
double get_price(std::string currency);
void set_price(std::string currency, double price);
double get_volume(std::string ticker);
void set_volume(std::string curr, double volume);
double get_marketcap(std::string curr);
void set_marketcap(std::string curr, double marketcap);
void setPeers(int peers);
int getPeers();
@ -110,7 +121,7 @@ public:
static QString getDecimalString(double amt);
static QString getUSDFormat(double bal);
static QString getZECDisplayFormat(double bal);
static QString getDisplayFormat(double bal);
static QString getZECUSDDisplayFormat(double bal);
static QString getTokenName();
@ -152,7 +163,11 @@ private:
int _peerConnections = 0;
double zecPrice = 0.0;
unsigned int btcPrice = 0.0;
double fiat_price = 0.0;
unsigned int btcPrice = 0;
std::map<std::string, double> prices;
std::map<std::string, double> volumes;
std::map<std::string, double> marketcaps;
};
#endif // SETTINGS_H

254
src/settings.ui

@ -161,6 +161,258 @@
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QLabel" name="label_20">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Local Currency</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="16" column="1">
<widget class="QComboBox" name="comboBoxCurrency">
<property name="geometry">
<rect>
<x>80</x>
<y>150</y>
<width>80</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>AED</string>
</property>
</item>
<item>
<property name="text">
<string>ARS</string>
</property>
</item>
<item>
<property name="text">
<string>AUD</string>
</property>
</item>
<item>
<property name="text">
<string>BDT</string>
</property>
</item>
<item>
<property name="text">
<string>BHD</string>
</property>
</item>
<item>
<property name="text">
<string>BMD</string>
</property>
</item>
<item>
<property name="text">
<string>BRL</string>
</property>
</item>
<item>
<property name="text">
<string>BTC</string>
</property>
</item>
<item>
<property name="text">
<string>CAD</string>
</property>
</item>
<item>
<property name="text">
<string>CHF</string>
</property>
</item>
<item>
<property name="text">
<string>CLP</string>
</property>
</item>
<item>
<property name="text">
<string>CNY</string>
</property>
</item>
<item>
<property name="text">
<string>CZK</string>
</property>
</item>
<item>
<property name="text">
<string>DKK</string>
</property>
</item>
<item>
<property name="text">
<string>EUR</string>
</property>
</item>
<item>
<property name="text">
<string>GBP</string>
</property>
</item>
<item>
<property name="text">
<string>HKD</string>
</property>
</item>
<item>
<property name="text">
<string>HUF</string>
</property>
</item>
<item>
<property name="text">
<string>IDR</string>
</property>
</item>
<item>
<property name="text">
<string>ILS</string>
</property>
</item>
<item>
<property name="text">
<string>INR</string>
</property>
</item>
<item>
<property name="text">
<string>JPY</string>
</property>
</item>
<item>
<property name="text">
<string>KRW</string>
</property>
</item>
<item>
<property name="text">
<string>KWD</string>
</property>
</item>
<item>
<property name="text">
<string>LKR</string>
</property>
</item>
<item>
<property name="text">
<string>PKR</string>
</property>
</item>
<item>
<property name="text">
<string>MXN</string>
</property>
</item>
<item>
<property name="text">
<string>NOK</string>
</property>
</item>
<item>
<property name="text">
<string>NZD</string>
</property>
</item>
<item>
<property name="text">
<string>RUB</string>
</property>
</item>
<item>
<property name="text">
<string>SAR</string>
</property>
</item>
<item>
<property name="text">
<string>SEK</string>
</property>
</item>
<item>
<property name="text">
<string>SGD</string>
</property>
</item>
<item>
<property name="text">
<string>THB</string>
</property>
</item>
<item>
<property name="text">
<string>TRY</string>
</property>
</item>
<item>
<property name="text">
<string>TWD</string>
</property>
</item>
<item>
<property name="text">
<string>UAH</string>
</property>
</item>
<item>
<property name="text">
<string>USD</string>
</property>
</item>
<item>
<property name="text">
<string>VEF</string>
</property>
</item>
<item>
<property name="text">
<string>VND</string>
</property>
</item>
<item>
<property name="text">
<string>XAG</string>
</property>
</item>
<item>
<property name="text">
<string>XAU</string>
</property>
</item>
<item>
<property name="text">
<string>ZAR</string>
</property>
</item>
</widget>
</item>
<item row="15" column="1">
<widget class="QComboBox" name="comboBoxTheme">
<property name="sizePolicy">
@ -323,7 +575,7 @@
<item row="11" column="0" colspan="2">
<widget class="QCheckBox" name="chkFetchPrices">
<property name="text">
<string>Fetch HUSH / USD prices</string>
<string>Fetch HUSH prices</string>
</property>
</widget>
</item>

2
src/txtablemodel.cpp

@ -132,7 +132,7 @@ void TxTableModel::updateAllData() {
return addr;
}
case 2: return QDateTime::fromMSecsSinceEpoch(modeldata->at(index.row()).datetime * (qint64)1000).toLocalTime().toString();
case 3: return Settings::getZECDisplayFormat(modeldata->at(index.row()).amount);
case 3: return Settings::getDisplayFormat(modeldata->at(index.row()).amount);
}
}

2
src/version.h

@ -1 +1 @@
#define APP_VERSION "0.8.3"
#define APP_VERSION "0.9.0"

17
src/websockets.cpp

@ -1,4 +1,4 @@
// Copyright 2019 The Hush developers
// Copyright 2019-2020 Hush developers
#include "websockets.h"
#include "rpc.h"
@ -480,10 +480,16 @@ void AppDataServer::saveNonceHex(NonceType nt, QString noncehex) {
// Encrypt an outgoing message with the stored secret key.
QString AppDataServer::encryptOutgoing(QString msg) {
qDebug() << "Encrypting msg";
if (msg.length() % 256 > 0) {
msg = msg + QString(" ").repeated(256 - (msg.length() % 256));
// This padding size is ~50% larger than current largest
// message size and makes all current message types
// indistinguishable. If some new message type can
// be larger than this, the padding should probably be increased
int padding = 16*1024;
qDebug() << "Encrypt msg(pad="<<padding<<") prepad len=" << msg.length();
if (msg.length() % padding > 0) {
msg = msg + QString(" ").repeated(padding - (msg.length() % padding));
}
qDebug() << "Encrypt msg postpad len=" << msg.length();
QString localNonceHex = getNonceHex(NonceType::LOCAL);
@ -747,9 +753,6 @@ void AppDataServer::processSendTx(QJsonObject sendTx, MainWindow* mainwindow, st
auto allBalances = mainwindow->getRPC()->getAllBalances();
QList<QPair<QString, double>> bals;
for (auto i : allBalances->keys()) {
// Filter out sprout addresses
if (Settings::getInstance()->isSproutAddress(i))
continue;
// Filter out balances that don't have the requisite amount
// TODO: should this be amt+tx.fee?
if (allBalances->value(i) < amt)

46
win-build.sh

@ -0,0 +1,46 @@
#!/bin/bash
# Copyright 2019-2020 The Hush Developers
# Released under the GPLv3
# This script will cross-compile windoze binaries, hopefully!
set -e
UNAME=$(uname)
if [ "$UNAME" == "Linux" ] ; then
JOBS=$(nproc)
elif [ "$UNAME" == "FreeBSD" ] ; then
JOBS=$(nproc)
elif [ "$UNAME" == "Darwin" ] ; then
JOBS=$(sysctl -n hw.ncpu)
else
JOBS=1
fi
VERSION=$(cat src/version.h |cut -d\" -f2)
echo "Compiling SilentDragon $VERSION with $JOBS threads..."
CONF=silentdragon.pro
qbuild () {
x86_64-w64-mingw32.static-qmake-qt5 $CONF CONFIG+=debug
make -j$JOBS
}
qbuild_release () {
# This binary must be in your PATH!
x86_64-w64-mingw32.static-qmake-qt5 $CONF CONFIG+=release
make -j$JOBS
}
if [ "$1" == "clean" ]; then
make clean
elif [ "$1" == "linguist" ]; then
lupdate $CONF
lrelease $CONF
elif [ "$1" == "cleanbuild" ]; then
make clean
qbuild
elif [ "$1" == "release" ]; then
qbuild_release
else
qbuild
fi
Loading…
Cancel
Save