Skip to content

Commit

Permalink
Upgrade wallet:import to use ui.ledger
Browse files Browse the repository at this point in the history
  • Loading branch information
NullSoldier committed Oct 7, 2024
1 parent 5f1d60d commit bb6d24c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ironfish-cli/src/commands/wallet/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { IronfishCommand } from '../../command'
import { RemoteFlags } from '../../flags'
import { LedgerError, LedgerSingleSigner } from '../../ledger'
import { checkWalletUnlocked, inputPrompt } from '../../ui'
import * as ui from '../../ui'
import { importFile, importPipe, longPrompt } from '../../ui/longPrompt'
import { importAccount } from '../../utils'

Expand Down Expand Up @@ -119,8 +120,14 @@ export class ImportCommand extends IronfishCommand {
async importLedger(): Promise<string> {
try {
const ledger = new LedgerSingleSigner(this.logger)
await ledger.connect()
const account = await ledger.importAccount()

const account = await ui.ledger({
ledger,
message: 'Import Wallet',
approval: true,
action: () => ledger.importAccount(),
})

return encodeAccountImport(account, AccountFormat.Base64Json)
} catch (e) {
if (e instanceof LedgerError) {
Expand Down

0 comments on commit bb6d24c

Please sign in to comment.