-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: add Load & Sign unbroadcasted tx #1986
Conversation
not for vcs
I don't have the capability to test this right now -- has @mhsmith or @fyookball or maybe even @EchterAgo tried this ? Or can you, @mpatc 100% vouch for it working? |
I'll have a look at it tomorrow. |
Thanks mhsmith, I've tested on the emulator and a galaxy note 20 ultra and it works, but it's my first contribution, so I don't know what I might have missed. The changes are the addition of ColdSend.kt and ColdLoad.kt, and accompanying changes to the wallet menu xml |
ColdSend.kt is mostly a duplicate of Send.kt, except for what happens after you enter the password. This isn't good, because any future change to the send process will require twice as many changes and twice as much testing. Instead, I think saving a signed transaction should be combined with the existing send process, as it is in the desktop version. Here's one possible way, but if you've got any other ideas then let's discuss them:
I've also got a few other minor comments which I'll add below. |
By the way, there's no need to create a new pull request every time you make some changes: it should be enough just to push the changes to your branch on GitHub, and they'll appear in the existing PR. |
This comment has been minimized.
This comment has been minimized.
android/app/src/main/java/org/electroncash/electroncash3/ColdLoad.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/org/electroncash/electroncash3/ColdLoad.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/org/electroncash/electroncash3/ColdLoad.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/org/electroncash/electroncash3/ColdLoad.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/org/electroncash/electroncash3/ColdLoad.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/org/electroncash/electroncash3/ColdLoad.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/org/electroncash/electroncash3/ColdLoad.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/org/electroncash/electroncash3/ColdLoad.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/org/electroncash/electroncash3/ColdLoad.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/org/electroncash/electroncash3/Util.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/python/electroncash_gui/android/strings.py
Outdated
Show resolved
Hide resolved
So at this point I've gotten rid of the ColdSend.kt and instead do the work it did in Send.kt by the use of a flag. Seems to work as intended. The only major thing is to get ColdLoad to toast any errors after it attempts to broadcast. |
As far as I can see, everything is done here, I'm going to work on implementing freeze/unfreeze addresses. |
Thanks, I'll give it a last look over and probably merge it tomorrow. |
It never seems to be empty on the emulator, but I was able to make the app crash on a physical device by trying to paste after a reboot.
It was passing a string to a method which expected a transaction, so the method always returned failure. Detecting "success" by looking for "txid" in the text of the error message isn't reliable, because that string could also appear in a real error. Changed to reuse the existing result checking code in Send.kt.
onShowDialog is called again after each rotation, so it can't unconditionally disable the button.
…be specified everywhere: Actually getBoolean already returns false by default, but it's better to be explicit.
* Make unbroadcasted flag an instance variable rather than a global. * Fix duplicate code in `if` statements.
Thanks for all your work on this. I did a few fixes and cleanups before merging: please look over my commits above before submitting your next PR. By the way, I notice that the Electron Cash desktop app doesn't display transaction QRs as hex, but as an Electrum-specific base 43 format, so the app isn't able to scan them. How did you test this feature? Did you use some other wallet that displays hex QRs? Or did you just do the same as me, and copy a hex transaction into a QR generator? |
cool, I'll take a look later, yes, I just pasted the signed tx from virtual
instance into chrome qr generator and then scanned it from my actual phone
to load.
…On Sat, Sep 26, 2020 at 6:49 PM Malcolm Smith ***@***.***> wrote:
Thanks for all your work on this. I did a few fixes and cleanups before
merging: please look over my commits above before submitting your next PR.
By the way, I notice that the Electron Cash desktop app doesn't display
transaction QRs as hex, but as base 43, so the app isn't able to scan them.
How did you test this feature? Did you use some other wallet that displays
hex QRs? Or did you just do the same as me, and copy a hex transaction into
a QR generator?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1986 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADZVZPQUACQ6Z7NSNZAR243SHZVYFANCNFSM4QR4OY3Q>
.
|
* added unbroadcasted send * added kt file for unbroadcast tx * fix coldsend dialog title * add load unbroadcasted tx * add load tx kotlin file * cleanup * Delete local.properties not for vcs * added missing files * removed generated files * remove files * cleanup * fix qr code in coldload * change buttontext ok to sign * cleanup whitespace * remove ColdSend.kt and add sign unbroadcasted to Send.kt * format comments and remove paste button enabler * removed accidently added package to main.kt * change name of paste button * remove toast used for testing * toast errors from broadcasting transactions * fix toast message on tx broadcast * comment fix * fix result toast * fixes * rename variables * change title to sign transaction * remove redundent declaration * remove extraneous generated files * copy Util.kt from original repo * replace original gitignore and project_default files * whitspace cleanup * check if connected before broadcasting Cold tx * refactor if statement * Check whether clipboard is empty before pasting: It never seems to be empty on the emulator, but I was able to make the app crash on a physical device by trying to paste after a reboot. * Fix ColdLoad toast issues: It was passing a string to a method which expected a transaction, so the method always returned failure. Detecting "success" by looking for "txid" in the text of the error message isn't reliable, because that string could also appear in a real error. Changed to reuse the existing result checking code in Send.kt. * Fix ColdLoad send button being disabled after rotating screen: onShowDialog is called again after each rotation, so it can't unconditionally disable the button. * Revert irrelevant whitespace changes in Send.kt * Make "unbroadcasted" argument false by default so it doesn't have to be specified everywhere: Actually getBoolean already returns false by default, but it's better to be explicit. * Send.kt cleanups: * Make unbroadcasted flag an instance variable rather than a global. * Fix duplicate code in `if` statements. Co-authored-by: Matthew Clancy <matthewpclancy@mpc.local> Co-authored-by: Malcolm Smith <smith@chaquo.com>
same as before but with .gitignore and android/.idea/inspectionProfiles/Project_Default.xml added