-
-
Notifications
You must be signed in to change notification settings - Fork 650
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
Wallet Decrypt - Mnemonic #180
Conversation
return dPath.split("'/").length === 4; | ||
//TODO: use a regex to detect proper paths | ||
const len = dPath.split("'/").length; | ||
return len === 3 || len === 4; |
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.
Ledger uses m/44'/60'/0'
for some reason:
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.
Oh wow, BIP44 is way more readable than BIP32. Would have saved me a lot of headaches: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
Would you mind changing the comment to reflect that BIP 44 is really where we're determining that 4 is the amount, but that ledger is the exception for 3?
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.
yep, will do 👍
}) | ||
); | ||
|
||
try { |
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.
try/catch
introduced because derived addresses wouldn't populate on network/api failure
: 'is-invalid'}`} | ||
value={phrase} | ||
onChange={this.onMnemonicChange} | ||
placeholder={translateRaw('x_Mnemonic')} |
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.
You can save the translateRaw
import by passing true
as the argument for the textOnly
parameter:
translate('x_Mnemonic', true)
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.
Makes me question if translateRaw
should even be exported.
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 kinda like it as a separate function, makes the flow typing a little easier (Not two return types) and is very easy to understand over mystery args.
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.
Unfortunately I'm out of town sans Trezor, but I'll run this ASAP on Tuesday to make sure it still works.
: 'is-invalid'}`} | ||
value={phrase} | ||
onChange={this.onMnemonicChange} | ||
placeholder={translateRaw('x_Mnemonic')} |
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 kinda like it as a separate function, makes the flow typing a little easier (Not two return types) and is very easy to understand over mystery args.
this.setState({ phrase: e.target.value }); | ||
}; | ||
|
||
onChooseAddress = (e: SyntheticInputEvent) => { |
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.
Very minor, but this feels like a misnomer. This isn't when you choose the address, this is more like opening the modal, or validating the phrase / pass.
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.
Good call, I'll switch it to onDWModalOpen
, unless you can suggest something else.
common/config/dpaths.json
Outdated
{ | ||
"label": "Expanse", | ||
"value": "m/44'/40'/0'/0" | ||
} |
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.
Seeing multiple now, might be worth making this a JS file so that we can assign these repeated ones to variables and reuse them.
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.
Converted dpaths.json
to dpaths.js
.
return dPath.split("'/").length === 4; | ||
//TODO: use a regex to detect proper paths | ||
const len = dPath.split("'/").length; | ||
return len === 3 || len === 4; |
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.
Oh wow, BIP44 is way more readable than BIP32. Would have saved me a lot of headaches: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
Would you mind changing the comment to reflect that BIP 44 is really where we're determining that 4 is the amount, but that ledger is the exception for 3?
@@ -40,13 +40,15 @@ type Props = { | |||
dPaths: { label: string, value: string }[], | |||
publicKey: string, | |||
chainCode: string, | |||
seed: string, |
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.
This is a required prop, but the DecryptWallet/Trezor.jsx wasn't altered to send it (And probably shouldn't, I think this should be optional.) Any idea why flow didn't catch that?
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.
Agree, I'll make it optional. Not sure why flow didn't catch that, it definitely should have...
common/sagas/deterministicWallets.js
Outdated
} | ||
} catch (err) { | ||
console.log(err); | ||
//TODO: maybe communicate API call error to user? |
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.
Definitely, I think you can just get away with a yield put(showNotification(...
common/sagas/deterministicWallets.js
Outdated
} | ||
} catch (err) { | ||
console.log(err); | ||
//TODO: maybe communicate API call error to user? |
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.
Same as above, showNotification
Tested the branch on my Trezor, everything seems to work fine. Still not sure how it's not complaining more about the lack of seed arg, but looks like no regressions here. |
@wbobeirne Interesting. I'm currently unable to send via Trezor on the latest develop. You're able to send via Trezor on this branch? Notice: The signed tx generates, but when attempting to broadcast it the node always responds with
There is likely something wrong with the generation of the signedTx. I have more info listed here: MyEtherWallet/MyEtherWallet#182 (comment) |
I'm going to attempt to send via Trezor on this branch -- will update with my results. I get a similar failure when testing on this branch. @wbobeirne Can you confirm whether or not you attempted to actually broadcast the signedTx, and not just generate it? |
Sorry, allow me to reiterate, I only tested unlocking. This branch is a bit behind develop, and I didn't test sending until it was up to date. |
@@ -165,7 +171,7 @@ export class WalletDecrypt extends Component { | |||
|
|||
onUnlock = (payload: any) => { | |||
this.props.dispatch( | |||
WALLETS[this.state.selectedWalletKey].unlock(this.state.value || payload) | |||
WALLETS[this.state.selectedWalletKey].unlock(payload || this.state.value) |
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.
Payload is a SyntheticEvent in some cases. We'll either need to check if payload isn't one, or change how onUnlock is called so that it's never sent an event.
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 believe I have fixed this in one of my recent PRs https://github.com/MyEtherWallet/MyEtherWallet/pull/183/files#diff-c2a1968700ed6452c7c0257d4dde4cd4R168
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.
Sweet, in that case we just need to bring develop
back into this bad boy.
79241a1
to
d518ba6
Compare
@dternyak, @wbobeirne I think I've addressed all the comments with these latest commits. Also added some tests, rebased this branch with Also, still haven't been able to test using Trezor, but I can get to it tonight if need be. |
@wboberine is working on a fix to Trezor, and is planning on commiting that
directly to this branch.
After that we should be good to merge! :)
…On Thu, Sep 14, 2017 at 11:13 AM skubakdj ***@***.***> wrote:
@dternyak <https://github.com/dternyak>, @wbobeirne
<https://github.com/wbobeirne> I think I've addressed all the comments
with these latest commits. Also added some tests, rebased this branch with
develop, and did some manual testing. Any additional feedback on the
changes?
Also, still haven't been able to test using Trezor, but I can get to it
tonight if need be.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<MyEtherWallet/MyEtherWallet#180 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHf02TBDYLVBm_EEf_g_q521wzHQ9Hsuks5siWy-gaJpZM4PQtnT>
.
|
* Match v3 more closely. * Require wallet index on deterministic wallets, update trezor to send index. * remove redundent stripAndLower function and rename existing stripHex to stripHexPrefixAndLower
What This Does
Broadly speaking, two things are accomplished:
DeterministicWalletsModal
& accompanying sagasWhat Still Needs to Happen
A few things to get done before this is merged:
Need to write unit tests fordecryptMnemonicToPrivKey
Need to do more manual testing