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

reads identity from ledger in dkg round1 #5711

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions ironfish-cli/src/commands/wallet/multisig/dkg/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,18 @@ export class DkgCreateCommand extends IronfishCommand {

async performRound1WithLedger(
ledger: LedgerMultiSigner,
client: RpcClient,
participantName: string,
identities: string[],
minSigners: number,
): Promise<{
round1: { secretPackage: string; publicPackage: string }
}> {
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')

if (!identities.includes(identity)) {
identities.push(identity)
Expand Down Expand Up @@ -351,13 +354,7 @@ export class DkgCreateCommand extends IronfishCommand {
})

if (ledger) {
return await this.performRound1WithLedger(
ledger,
client,
participantName,
identities,
minSigners,
)
return await this.performRound1WithLedger(ledger, identities, minSigners)
}

this.log('\nPerforming DKG Round 1...')
Expand Down
19 changes: 9 additions & 10 deletions ironfish-cli/src/commands/wallet/multisig/dkg/round1.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 { RpcClient } from '@ironfish/sdk'
import { Flags } from '@oclif/core'
import { IronfishCommand } from '../../../../command'
import { RemoteFlags } from '../../../../flags'
Expand Down Expand Up @@ -72,7 +71,7 @@ export class DkgRound1Command extends IronfishCommand {
}

if (flags.ledger) {
await this.performRound1WithLedger(client, participantName, identities, minSigners)
await this.performRound1WithLedger(identities, minSigners)
return
}

Expand All @@ -94,16 +93,16 @@ export class DkgRound1Command extends IronfishCommand {
this.log('Send the round 1 public package to each participant')
}

async performRound1WithLedger(
client: RpcClient,
participantName: string,
identities: string[],
minSigners: number,
): Promise<void> {
async performRound1WithLedger(identities: string[], minSigners: number): Promise<void> {
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')

if (!identities.includes(identity)) {
identities.push(identity)
Expand Down