Skip to content
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

Rahul/ifl 2746 wallet sign command #5111

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

patnir
Copy link
Contributor

@patnir patnir commented Jul 3, 2024

Summary

Adds the wallet:sign CLI command along with the wallet/signTransaction RPC.

We already have a sign function on an UnsignedTransaction on the Rust side. This basically exposes that feature.

Also included is the ledger signing option for this CLI command.

Testing Plan

Manually tested signing an unsigned transaction and adding (wallet:transaction:add) the signed transaction using both an account with a spending key and an account that is a ledger device.

Documentation

To follow in a separate PR on the website

Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference
)? If yes, link a
related documentation pull request for the website.

[ ] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and label it with breaking-change-rpc or breaking-change-sdk.

[ ] Yes

@patnir patnir requested a review from a team as a code owner July 3, 2024 23:38
@patnir patnir changed the base branch from master to staging July 3, 2024 23:38
@patnir patnir force-pushed the rahul/ifl-2746-generic-walletsign-command branch from 6a76a47 to 8598516 Compare July 3, 2024 23:39
@patnir patnir changed the title Rahul/ifl 2746 generic walletsign command Rahul/ifl 2746 wallet sign command Jul 3, 2024
@patnir patnir force-pushed the rahul/ifl-2746-generic-walletsign-command branch 2 times, most recently from 86ddb1d to 22e3a96 Compare July 8, 2024 22:31
Comment on lines +53 to +57
if (!account.spendingKey) {
throw new Error('Account does not have a spending key')
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - we could include this check in the predicate function for findAccount, above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think distinct messages are better. If the user has the account but it is a view only account, that would be a different error than just not having the account

Comment on lines 46 to 42
if (!account) {
const response = await client.wallet.getDefaultAccount()

if (!response.content.account) {
this.error(
`No account is currently active.
Use ironfish wallet:create <name> to first create an account`,
)
}

account = response.content.account.name
}
Copy link
Contributor

Choose a reason for hiding this comment

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

account isn't used now that we can infer it from the transaction

Comment on lines 35 to 33
watch: Flags.boolean({
default: false,
description: 'Wait for the transaction to be confirmed',
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this only work if broadcast is set?

@patnir patnir force-pushed the rahul/ifl-2746-generic-walletsign-command branch from 22e3a96 to 8868138 Compare July 9, 2024 01:21
@patnir patnir force-pushed the rahul/ifl-2746-generic-walletsign-command branch from 8868138 to 7c54423 Compare July 9, 2024 01:31
@patnir patnir requested a review from hughy July 9, 2024 01:32
@patnir patnir merged commit c80830a into staging Jul 9, 2024
14 checks passed
@patnir patnir deleted the rahul/ifl-2746-generic-walletsign-command branch July 9, 2024 17:19
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.

2 participants