Skip to content

Commit 571b0af

Browse files
authored
reads identity from ledger in 'wallet:multisig:commitment:create' (#5716)
when a user passes the '--ledger' flag to the 'wallet:multisig:commitment:create' command they intend to use a Ledger device to create a signing commitment. the identity used _must_ be the identity from the Ledger device, so read the identity from the device instead of from the walletDB
1 parent acd4c8b commit 571b0af

File tree

1 file changed

+9
-11
lines changed
  • ironfish-cli/src/commands/wallet/multisig/commitment

1 file changed

+9
-11
lines changed

ironfish-cli/src/commands/wallet/multisig/commitment/create.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44
import { multisig } from '@ironfish/rust-nodejs'
5-
import { RpcClient, UnsignedTransaction } from '@ironfish/sdk'
5+
import { UnsignedTransaction } from '@ironfish/sdk'
66
import { Flags } from '@oclif/core'
77
import { IronfishCommand } from '../../../../command'
88
import { RemoteFlags } from '../../../../flags'
@@ -95,12 +95,7 @@ export class CreateSigningCommitmentCommand extends IronfishCommand {
9595
await ui.confirmOrQuit('Confirm signing commitment creation', flags.confirm)
9696

9797
if (flags.ledger) {
98-
await this.createSigningCommitmentWithLedger(
99-
client,
100-
participantName,
101-
unsignedTransaction,
102-
identities,
103-
)
98+
await this.createSigningCommitmentWithLedger(unsignedTransaction, identities)
10499
return
105100
}
106101

@@ -119,15 +114,18 @@ export class CreateSigningCommitmentCommand extends IronfishCommand {
119114
}
120115

121116
async createSigningCommitmentWithLedger(
122-
client: RpcClient,
123-
participantName: string,
124117
unsignedTransaction: UnsignedTransaction,
125118
signers: string[],
126119
): Promise<void> {
127120
const ledger = new LedgerMultiSigner()
128121

129-
const identityResponse = await client.wallet.multisig.getIdentity({ name: participantName })
130-
const identity = identityResponse.content.identity
122+
const identity = (
123+
await ui.ledger({
124+
ledger,
125+
message: 'Getting Ledger Identity',
126+
action: () => ledger.dkgGetIdentity(0),
127+
})
128+
).toString('hex')
131129

132130
const rawCommitments = await ui.ledger({
133131
ledger,

0 commit comments

Comments
 (0)