Skip to content

Conversation

@sisou
Copy link
Member

@sisou sisou commented Jun 30, 2025

With an address list gated by required balance and auto-updating balances.

The balance-update code was pulled from CheckoutCardNimiq.vue.

@sisou sisou requested a review from danimoh June 30, 2025 13:17
@sisou sisou self-assigned this Jun 30, 2025
With an address list gated by required balance and auto-updating balances.
@sisou sisou force-pushed the soeren/sign-tx-no-sender branch from 0898bae to 1d1dff8 Compare July 6, 2025 13:50

<AccountSelector
:wallets="processedWallets"
disableContracts
Copy link
Member

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.

Comment on lines 16 to +73
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();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should incorporate the changes from #563 here to automatically redirect to the onboarding if the user has no account, or add that change to #563 for SignTransaction.

Comment on lines +68 to +69
// 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.
Copy link
Member

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;
Copy link
Member

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) => {
Copy link
Member

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) {
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

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) {
Copy link
Member

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.'));
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants