Skip to content

Commit a99c110

Browse files
authored
Fix JSON import for accounts without a view key (#3562)
1 parent 35e3a4d commit a99c110

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,16 @@ export class ImportCommand extends IronfishCommand {
127127

128128
// raw json
129129
try {
130-
return JSONUtils.parse<AccountImport>(data)
130+
let json = JSONUtils.parse<AccountImport>(data)
131+
132+
if (json.spendingKey) {
133+
json = {
134+
...json,
135+
...generateKeyFromPrivateKey(json.spendingKey),
136+
}
137+
}
138+
139+
return json
131140
} catch (e) {
132141
CliUx.ux.error(`Import failed for the given input: ${data}`)
133142
}

0 commit comments

Comments
 (0)