Skip to content

Commit 35e3a4d

Browse files
authored
Fix bech32 import for accounts without view key (#3561)
1 parent abfcd31 commit 35e3a4d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ironfish-cli/src/commands/wallet/import.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class ImportCommand extends IronfishCommand {
8484
}
8585
}
8686
CliUx.ux.error(
87-
`Detected mnemonic input, but the import failed.
87+
`Detected mnemonic input, but the import failed.
8888
Please verify the input text or use a different method to import wallet`,
8989
)
9090
}
@@ -101,7 +101,16 @@ export class ImportCommand extends IronfishCommand {
101101
// bech32 encoded json
102102
const [decoded, _] = Bech32m.decode(data)
103103
if (decoded) {
104-
return JSONUtils.parse<AccountImport>(decoded)
104+
let data = JSONUtils.parse<AccountImport>(decoded)
105+
106+
if (data.spendingKey) {
107+
data = {
108+
...data,
109+
...generateKeyFromPrivateKey(data.spendingKey),
110+
}
111+
}
112+
113+
return data
105114
}
106115

107116
// mnemonic or explicit spending key

0 commit comments

Comments
 (0)