CreateWalletCommand constructor
CreateWalletCommand({})
Implementation
CreateWalletCommand({
required String walletId,
required this.walletName,
this.mnemonic,
this.wif,
this.xpriv,
this.xpub,
this.passphrase,
this.walletMetadata,
String? commandId,
DateTime? timestamp,
Map<String, dynamic>? metadata,
}) : super(
walletId: walletId,
commandId: commandId,
timestamp: timestamp,
metadata: metadata,
) {
// Validation: At most one wallet type can be specified
final specified = [
mnemonic != null && mnemonic!.isNotEmpty,
wif != null && wif!.isNotEmpty,
xpriv != null && xpriv!.isNotEmpty,
xpub != null && xpub!.isNotEmpty,
].where((x) => x).length;
if (specified > 1) {
throw ArgumentError(
'Only one of mnemonic, wif, xpriv, or xpub can be specified'
);
}
}