From d4558a1b1add6c28b53c0015c597c2eb4ed70a92 Mon Sep 17 00:00:00 2001 From: Hugh Cunningham Date: Mon, 3 Feb 2025 13:53:07 -0800 Subject: [PATCH] reads identity from ledger in 'wallet:multisig:commitment:create' 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 --- .../wallet/multisig/commitment/create.ts | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/ironfish-cli/src/commands/wallet/multisig/commitment/create.ts b/ironfish-cli/src/commands/wallet/multisig/commitment/create.ts index f35a05cf03..76a7d56539 100644 --- a/ironfish-cli/src/commands/wallet/multisig/commitment/create.ts +++ b/ironfish-cli/src/commands/wallet/multisig/commitment/create.ts @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { multisig } from '@ironfish/rust-nodejs' -import { RpcClient, UnsignedTransaction } from '@ironfish/sdk' +import { UnsignedTransaction } from '@ironfish/sdk' import { Flags } from '@oclif/core' import { IronfishCommand } from '../../../../command' import { RemoteFlags } from '../../../../flags' @@ -95,12 +95,7 @@ export class CreateSigningCommitmentCommand extends IronfishCommand { await ui.confirmOrQuit('Confirm signing commitment creation', flags.confirm) if (flags.ledger) { - await this.createSigningCommitmentWithLedger( - client, - participantName, - unsignedTransaction, - identities, - ) + await this.createSigningCommitmentWithLedger(unsignedTransaction, identities) return } @@ -119,15 +114,18 @@ export class CreateSigningCommitmentCommand extends IronfishCommand { } async createSigningCommitmentWithLedger( - client: RpcClient, - participantName: string, unsignedTransaction: UnsignedTransaction, signers: string[], ): Promise { const ledger = new LedgerMultiSigner() - const identityResponse = await client.wallet.multisig.getIdentity({ name: participantName }) - const identity = identityResponse.content.identity + const identity = ( + await ui.ledger({ + ledger, + message: 'Getting Ledger Identity', + action: () => ledger.dkgGetIdentity(0), + }) + ).toString('hex') const rawCommitments = await ui.ledger({ ledger,