-
Notifications
You must be signed in to change notification settings - Fork 33
Conversation
- Add option to import a Parity Signer account. It is then stored in local storage. - Send transactions with Parity Signer accounts - Refactor sendStore so that "token" (and chainId) is inside this.tx; avoids having to pass `token` around every function, and it makes sense to put it in the object since it is part of the tx info. - Add account type (either node or signer) to accountsInfo - Add account type to withAccount; output props are now `{account: {address, type}}` instead of `{accountAddress}`
<AccountAddressFromRouter> | ||
{accountAddress => { | ||
const DecoratedComponent = compose( | ||
light({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
light({
transactionCount: () =>
transactionCountOf$(accountAddress).pipe(withoutLoading())
}),
This makes the component remount on every new block (blank screen for a short period then TxForm appears again, reset). Not sure how to rewrite this?
If I remove those lines the TxForm fields "just" reset on every block (even though there is no remounting), even after removing all RequireHealth; because of the RPC calls in withBalance. Wasn't the case before; not sure how to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believ HOCs in the render method is an anti-pattern.
Would something like this work?
const WithAccount = compose(
withRouter,
withAccountsInfo,
light({
transactionCount: props =>
transactionCountOf$(props.router.accountAddress).pipe(withoutLoading())
}),
mapProps(...)
)(props => props.children(props.account));
export default Component => initialProps => (
<WithAccount>
{account => <Component {...initialProps} account={account} />}
</WithAccount>
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does work! much cleaner 👍 still doesn't resolve the reset issue though, I'll continue investigating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually my bad, it does seem to have resolved the issue!! 🎉
Awesome!! I gave it a go and here is an early feedback:
edit: problems on my machine
|
Okay, I have the same thing. Good to know it's not just me :P Might be an issue in
Not sure I get it. When I'm importing a Parity Signer account, after scanning I land on the AccountName screen with the account name field automatically focused ; once I've entered something, if I press enter it submits the form as expected
Cannot reproduce; after entering the account name for a Parity Signer account I'm redirected to the accounts list.
Cannot reproduce. Maybe reinstall the dependencies? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found little things apart from the styling nits mentioned before.
packages/fether-react/src/Send/SignedTxSummary/SignedTxSummary.js
Outdated
Show resolved
Hide resolved
packages/fether-react/src/Send/SignedTxSummary/SignedTxSummary.js
Outdated
Show resolved
Hide resolved
I tried using the new features using a Samsung Galaxy S8 Note mobile using Parity Signer 2.0 Beta and on macOS Mojave 10.14. 1) Creating an account just using Fether without Parity SignerIf we create an account just using Fether (without Parity Signer), then once its created nothing is in localStorage until you associate a token (other than ETH) like THIBCoin with the account it's stored in localStorage as:
Note: If we import an account that was created with Parity Signer that is from a different network other than Kovan, it just shows the Parity Signer logo inside their identicon, could we also show what network it is associated with 2) Local Storage values after importing an Account from Parity SignerAfter importing from Parity Signer it's stored in localStorage as the following. Notice how I've had to name the accounts with the network name they were created on?:
After importing an account from Parity Signer it:
3) After associating a token like THIBCoin with the account that we imported from Parity Signer:The following was observed:
4) Removing the token THIBCoin from an account that we imported from Parity Signer:The following was observed:
5) Importing Account in Fether using the passphrase that was generated when I created an in Parity SignerAfter importing an an account from Parity Signer that was created on a network (tested so far using Ethereum mainnet, and Kovan). If within Fether I try to "Import Account" and enter the recovery words that were shown in Parity Signer, it returns "The passphrase was not recognised... ". Shouldn't we be able to recover an account using the keyphrase both from Parity Signer and Fether? 6) Error with an unknown causeAt one stage after I was testing to see if I could recover a Parity Signer keyphrase using Fether, when I then went to scan a QR code to import an account it wasn't working, and when I checked the console it displayed error:
7) Unable to Send Transaction using Fether from an account imported from Parity SignerAfter transferring some ETH to the Parity Signer account that I imported into Fether. I then tried to see what would happen if I transferred some of that ETH from an account that was created using Parity Signer on the Kovan network to another account (I tried sending it to another account that was created using Parity Signer on the Ropsten network, and then tried sending it to an account that was created using Fether on the Kovan network, but both exhibited the same behaviour as follows). It showed "Scan" instead of "Send" correctly, and instead of prompting me for a password (as it does for accounts created in Fether), it correctly asks me to "Please scan the QR code of the transaction on Parity Signer". So I scan the QR code that's shown with Parity Signer, and clicked the "Sign" button within Parity Signer, and then Parity Signer displays another QR code and prompts me to "SCAN SIGNATURE", so in Fether I click the "Next" button and on the next screen I use my webcam to scan the QR code that's shown in Parity Signer. But then it just goes back to the "Send Ether" page with the amount and recipient values that I previously entered still in the input fields but the fields aren't editable, and nothing was sent when I check the account on BlockScout, and nothing is shown in the console to indicate any error. Note: I think the QR code that's shown needs some padding and should be centred on the screen with CSS (as mentioned by @Tbaut 8) Gap between Identicon and Account nameI think this is unrelated to this PR, but on the account page, the gap between the identicon and the account name is too small in my opinion Very impressive work! So far I've only performed "user testing" and haven't yet reviewed the code, apart from having a quick peek :). I'll look at it tonight |
This will be needed soon (if we have some network change ability) but I think it's outside of the scope of this PR. (I want to release 0.2 as soon as this PR is merged, let's keep it simple).
Good catch. Probably not if we want to be consistent.
Too much sun/light visible on the picture, my (Berlin calibrated) eyes couldn't process it 🌧️
The signature contains much more info, it is a much more complex QR code that requires better light and overall scanning conditions.
Damn, that's clearly a bug in Parity Signer, for some reason it generates a 11 words recovery. This must be fixed on Signer. For those who created an account with 11 words though it's be nice to support it in Fether.
This is an edge case that I propose to handle separately. For the beta let's assume ppl work on the same network. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 . The resetting of TxForm needs to be fixed though, I'm not 100% how either, I proposed something in the comments
<AccountAddressFromRouter> | ||
{accountAddress => { | ||
const DecoratedComponent = compose( | ||
light({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believ HOCs in the render method is an anti-pattern.
Would something like this work?
const WithAccount = compose(
withRouter,
withAccountsInfo,
light({
transactionCount: props =>
transactionCountOf$(props.router.accountAddress).pipe(withoutLoading())
}),
mapProps(...)
)(props => props.children(props.account));
export default Component => initialProps => (
<WithAccount>
{account => <Component {...initialProps} account={account} />}
</WithAccount>
);
<TokenBalance | ||
decimals={6} | ||
drawers={[ | ||
<Form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make sense to factorize code between this and TxForm, if it's easily doable
packages/fether-react/src/Accounts/CreateAccount/AccountImportOptions/AccountImportOptions.js
Outdated
Show resolved
Hide resolved
5) Importing Account in Fether using the passphrase that was generated when I created an in Parity Signer (Continued)Since my previous comment #336 (comment), @Tbaut created this PR #351 so that if we created an account on Parity Signer we could import it into Fether using its 11 Recovery Words, and his fix works! But I encountered a problem, which I'll now explain... So I'd previously created a Parity Signer account and imported it into Fether using the QR scanner, and it displays successfully in my account list (with the Parity Signer logo embedded in the identicon). I had topped it up with some ETH and THIBCoin. In my previous comment #336 (comment) I tried importing the same Parity Signer account into Fether that I had already previously imported into Fether from Parity Signer and was already shown in my account list, and found that it didn't prevent me from doing so (even though I expected it to say But now I wanted to see what would happen if I tried to import a Parity Signer account using "Recover from Seed Phrase" in Fether, even though I'd already previously imported it using "Recover from Parity Signer" and the account was already in my account list in Fether under the name "test-signer2", as shown below: So I entered the recovery words that were generated when I created my Parity Signer account, but instead of it displaying And on that page it showed an identicon with the Parity Signer logo embedded inside it. Is this a bug too? i.e. how does it know that it was generated with Parity Signer when I'm importing it using the recovery words approach instead of the QR scanner approach, or is it showing the Parity Signer logo embedded in the identicon because it's already in my Fether account list since it was previously imported using the QR code? So then I gave it a different name "test-signer2-again", and clicked "Next" where it prompted me for a password, which I entered as shown below: It then returned me to the Accounts page, but now I have both the "test-signer2" account (WITH the Parity Signer logo embedded), and the "test-signer2-again" account (WITHOUT the Parity Signer logo embedded), and they both have the same Ethereum address When I went to the "test-signer2" account page it still showed both ETH and THIBCoin tabs, If I check Dev Tools > Application > Local Storage, it hasn't updated the following list of Parity Signer accounts:
And the following entry for the account hasn't changed:
So... my thoughts are: i) If the user tries to import the same Parity Signer account into Fether using "Recover from Recovery Words" when they had already previously imported that account into Fether from Parity Signer and that account is already shown in their account list, then it should display ii) If the user does not already have a specific Parity Signer account in their Fether account list and they choose to import it using "Recover from Recovery Words" instead of "Recover from Parity Signer", do we still consider it as being "Parity Signer"-originated and show the Parity Signer logo embedded in the account identicon? I don't think we should. I think we should somehow communicate to the user that if they don't import an account that they created with Parity Signer using "Recover from Parity Signer" that it won't have the Parity Signer logo embedded in the account identicon... I also think that if they forget to import an account that they created with Parity Signer using "Recover from Parity Signer", they may find themselves upset that they don't have the Parity Signer logo embedded in the account identicon. But there's currently no way to delete their account from Fether and then re-import it again but using "Recover from Parity Signer" so that they get the Parity Signer logo embedded in the account identicon. So I think we need a Fether feature to Delete Account just like we have in Parity Signer (once we've got a Fether menu #264 (comment)) |
Thanks for the write-up Luke,
also happened to me. I haven't checked if it prevents us form scanning?
I don't think I can reproduce; or the issue specifically linked to transferring across chains? I'd be surprised because the account addresses all use the same format afaik?
it is actually related to this PR; added some quickfix for the margin. |
@ltfschoen I fixed being able to import an existing account with Signer; now if I import a Parity Signer account with QRCode in Fether then try to reimport it using the passphrase it tells me "account already exists". Same if I import with recovery phrase on fether then try to reimport again with qrcode 👍
no, this is unintended behaviour, linked to the lack of verification that the account already exists. fixed now |
TODO:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some nits with the buttons that.
9. Handling a webcam hardware errorI just pulled the latest changes from this branch I killed it and restarted again with I think it's because the FaceTime HD Camera (built-in) webcam on my MacBook Pro encountered an error, because when I try to create a New Movie Recording in QuickTime it says it cannot use the webcam. Hopefully I just have to restart the computer. So I think we need to update the
|
10. Backup to JSON file of an account that was created with Parity Signer but imported into Fether using "Recover from Seed Phrase"I just created an account using Parity Signer. But I wanted to have the option of either:
Now I know that if I imported the account into Fether using "Recover from Parity Signer" then if I went to that account's page in Fether it wouldn't show the option to "Backup Account" so I could save it to a JSON file as an additional backup option So instead of importing the account into Fether using "Recover from Parity Signer", I chose to "Recover from Seed Phrase", and it successfully imported the account (but it does not show the Parity Signer logo embedded into the identicon). In the Fether, on the Account List I clicked the account to take me to the Account page, where it displayed the "Backup Account" page, and I got all excited! So I downloaded the JSON file backup for the account. So to I assumed that I could import the JSON file since it's worked in the past, but I wanted to double check. So I navigated to Then in Fether I went to "+ > Import account > Recover from JSON Keyfile" and chose the JSON file that was downloaded. It successfully imported the account. Why don't users who import an account they created with Parity Signer using "Recover from Parity Signer" get the same privilege as users who import it with "Recover from Seed Phrase" instead, such that they are able to backup the account to a JSON file if they want to? |
11. TypeError: Invalid hex string, when accidently scanned the sending accounts QR code instead of the signed transaction's QR codeI just tried sending some Ether from one imported Parity Signer account to another imported Parity Signer account. I entered 0.01 ETH and the recipient, and clicked "Send". It prompted me to scan the QR Code of the transaction on Parity Signer, so in Parity Signer I clicked "Scanner", and aimed the mobile phone's camera at the transaction QR code shown in the Fether window. Parity Signer then showed me the "Sign Transaction" screen with a "Sign Transaction" button. I then clicked the "Next Step" button in Fether. And was prompted to show the QR code of the signed transaction on the webcam. But I somehow accidently clicked the wrong button in Parity Signer and lost the screen that had the QR code for the transaction. So as a new user who doesn't read instructions carefully (and also trying to deliberately do the wrong/clumsy/confused/panicy thing that new users may do) I went back to the account that I was sending it from and clicked the "Show Account QR Code" button (when I should have just clicked the "Scanner" button an it would have taken me back to the screen with the "signed transaction" QR code to sign the transaction). I then tried aimed the "account" QR code at the webcam (instead of the "signed transaction" QR code), and it displayed the following error in Fether window:
And in the Dev Tools Console it showed: I think we should show just show an error on the page if the QR code that is read is incorrect, and remind them that it should be the signed transaction QR code, not an account QR code or some other random one. |
12. Broken 'Details' buttonSee this issue that relates to this PR #354 |
This is the whole point of Parity Signer, nobody else than the phone has the private key. The JSON is the (encrypted) private key. Fether doesn't have it for such accounts. |
it looks like the reset/refreshing bug is fixed thanks to Amaury's refactoring suggestion 🎉 |
I'll just update the qr-signer dependency to get rid of the bar around the webcam and I think this is good to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes yes yes, tested and approved 🎉
I've gone through all my previous comments and checked to see if they've been fixed (able to close my dot points 1, 2, 4, 5, 8, 10). Here are the results using Fether generated Parity Ethereum node using latest from this branch:
i.e.
Update: This is unrelated to this PR. I've restored an old issue in Parity Signer here novasamatech/parity-signer#127 (comment)
So I cleared all the key/value pairs from Local Storage and refreshed Fether and it displayed the T&Cs page, then when I pressed Accept, it showed the following error: When I refreshed again it went to T&Cs page again and clicked Accept it and it went to the account list page ok. So now I didn't have any accounts listed in the account list page. I tried to import the Parity Signer "Mainnet" account again using Recover from Parity Signer, but although it did add it to Local Storage as shown below, it didn't appear in the account list page again, perhaps because it's now stored with So I decided to start a Parity Ethereum node on "Mainnet" separately This is the same as the error that occurs if you try to run a 2nd Parity Ethereum instance. See #333 If I clicked the "X" button it went back to T&Cs page, and this time when I clicked "Accept" the UI went blank, even after refreshing, and in the Dev Tools console it displayed: So I went back to starting a Parity Ethereum node on "Kovan" separately So as a last resort I just started Fether by itself so it would generate the Parity Ethereum node, and that worked as before. So it looks like Fether is crashing now when you run a separate Parity Ethereum Light node even with the Kovan network before starting Fether. Perhaps it's trying to create a 2nd node?. Note that I tried starting it with But it is correctly not listing accounts that were created for non-Kovan networks with Parity Signer that the user has imported into Fether (since Fether generates only a Kovan network node at the moment)
If I click "Send" it signs it and shows "Sending your transaction...". It's taking a long time and I still haven't received any block confirmations... If I wanted to repeat the same transaction amount multiple times to the same recipient could I just ignore scanning the QR code shown by Fether and skip to the next step and then just show the same screenshot of the original signature QR code that I saved to my device?
|
I see no issue left in any of the points raised @ltfschoen (except the last one, "6) Error with an unknown cause", if you can reproduce.). The centring of the error message was known to me but doesn't apply to this PR. If the code is ok, I'm good to merge. |
Yes I don't see any issues merging it. It'd be good to get some quick feedback on the "unchecked" checkboxes though (i.e. whether a separate issue should be raised after this PR is merged, or whether I've potentially misunderstood something, or ..). Sorry it's a bit long-winded but wanted to try and cover all bases |
Sure, here's my feedback:
I think this should be understood separately from Fether and as part of the signer workflow. A user installing and using Signer will know why it does this. Recovery is not something users do every day.
if you import the account with the recovery phrase, then it'll be in Fether, and since the recovery passphrase = private key, Signer has no role to play anymore. It's normal not to have the Signer logo.
This wouldn't work and this is what transaction nonces are made for, to avoid replay transactions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code lgtm! Feel free to merge.
Integrate Parity Signer (closes #146)
token
around every function, and it makes sense to put it in the object since it is part of the tx info.{account: {address, type}}
instead of{accountAddress}
For some reason some of the changes I introduced makes TxForm (and seemingly AccountsList as well) reset/remount on every block; not sure why that is, need to track this down. Makes it difficult to send transactions.