-
Notifications
You must be signed in to change notification settings - Fork 13
Allow selecting a sender in the sign-transaction flow #566
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
With an address list gated by required balance and auto-updating balances.
0898bae to
1d1dff8
Compare
|
|
||
| <AccountSelector | ||
| :wallets="processedWallets" | ||
| disableContracts |
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.
For transaction signing, vesting contracts should be supported.
| public created() { | ||
| if (this.request.sender) { | ||
| this.forwardToKeyguard(this.request.sender); | ||
| return; | ||
| } | ||
| // If account not specified / found or is an unsupported Ledger account let the user pick another account. | ||
| // Don't automatically reject to not directly leak the information whether an account exists / is a Ledger. | ||
| this.syncStatus = this.$t('Contacting seed nodes...') as string; | ||
| this.showAccountSelector = true; | ||
| this.initNimiq(); | ||
| } |
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.
| // If account not specified / found or is an unsupported Ledger account let the user pick another account. | ||
| // Don't automatically reject to not directly leak the information whether an account exists / is a Ledger. |
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 accounts do support transaction signing.
| // If account not specified / found or is an unsupported Ledger account let the user pick another account. | ||
| // Don't automatically reject to not directly leak the information whether an account exists / is a Ledger. | ||
| this.syncStatus = this.$t('Contacting seed nodes...') as 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.
To me, it feels nicer to move this line to initNimiq, or addConsensusListener as it's the case in CheckoutCardNimiq.
| await this.network.init(); | ||
| this.addConsensusListeners(); | ||
| this.updateBalancePromise = this.getBalances().then((balances) => { |
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.
updateBalancePromise is unused.
| }); | ||
| } | ||
| private async setAccount(walletId: string, address: string, isFromRequest = 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.
setAccount is never called with true for isFromRequest, so it can be removed.
| public created() { | ||
| if (this.request.sender) { | ||
| this.forwardToKeyguard(this.request.sender); |
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.
setAccount should be called instead, to run the existence check for the walletInfo.
Then actually with isFromRequest true.
| const addresses = accountsAndContracts.map((accountOrContract) => accountOrContract.userFriendlyAddress); | ||
| // Get balances through pico consensus, also triggers head-change event | ||
| const balances: Map<string, number> = await this.network.getBalance(addresses); |
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 throws if no account is logged in.
| } | ||
| } | ||
| private goToOnboarding(useReplace?: boolean) { |
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.
Never called with useReplace true.
| // Direct sign transaction request invocation | ||
| const signTransactionRequest = this.request as ParsedSignTransactionRequest; | ||
| if (!signTransactionRequest.sender) { | ||
| this.$rpc.reject(new Error('Ledger Transaction Signing expects a sender in the request.')); |
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 throws on page reload.
With an address list gated by required balance and auto-updating balances.
The balance-update code was pulled from
CheckoutCardNimiq.vue.