-
Notifications
You must be signed in to change notification settings - Fork 2
Trezor #51
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
base: master
Are you sure you want to change the base?
Conversation
|
bmultisig backend |
| amount, | ||
| }; | ||
|
|
||
| segwit = false; |
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 think there is a bug in here regarding a tx with both segwit and non segwit inputs. We need segwit value to determine the output address toBase58 or toBech32. To have segwit be in scope for the outputs loop, its declared above and out of the loops. Its set to false each iteration and then set to true if the input isProgram. If the last input is legacy, then segwit will be false for the outputs loop. The last input will determine the value for the output loop
| return mtx; | ||
| } | ||
| case 'trezor': { | ||
| // TrezorConnect uses their backend to fetch |
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 has two different methods for signing and returning tx vs just fetching signature while Trezor has one method that returns both the raw tx and the signature. This causes the API to be a bit redundant in Trezor's case, as Ledger was the first client added to this codebase
| prev_index: input.prevout.index, | ||
| sequence: input.sequence, | ||
| // default to normal spend | ||
| script_type: 'SPENDADDRESS', |
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.
See https://github.com/trezor/trezor.js/blob/master/src/utils/signbjstx.js#L42
Copy this when segwit input
| const proposals = await multisig.getProposals(walletId, true); | ||
|
|
||
| // fetch both pending and non pending proposals | ||
| // and combine the two lists |
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.
TODO: this will query the same proposals twice, filter out the ones that appear twice
| proposalInfo = | ||
| proposals[selectedWallet].find(p => p.name === selectedProposal) || {}; | ||
| proposalInfo = proposals.find(p => p.name === selectedProposal) || {}; | ||
| } catch (e) {} |
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.
TODO: remove this useless try/catch
| type: hardwareType, | ||
| network, | ||
| chain, | ||
| logLevel: 'debug', |
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.
TODO: remove hardcoding of logLevel
lib/utilities/sign.js
Outdated
| const path = parsePath(paths[i], true); | ||
| let ti = { | ||
| address_n: path, | ||
| prev_hash: input.prevout.hash.toString('hex'), |
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 bug here, should use txid() method instead of toString('hex')
|
|
||
| return mtx; | ||
| // alter if its multisig | ||
| if (input.script.isMultisig()) { |
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 method is only used for p2sh and p2wsh - remove multisig stuff, add a comment around it saying that
This comment has been minimized.
This comment has been minimized.
|
Rebase ontop https://github.com/bpanel-org/bwallet/pull/56/files complete |
This requires https://github.com/trezor/trezord-go to be running
you can also download it here https://trezor.io/start/
They bundle the program as a mac app as well as it being available as a go program
To test, pull this into a
bpanelinstance and