generateWithDefaults static method
Future<KdfStartupConfig>
generateWithDefaults({
- required String walletName,
- required String walletPassword,
- required bool? enableHd,
- String? rpcPassword,
- String? coinsPath,
- String? seed,
- String? dbDir,
- String? userHome,
- String? rpcIp,
- int? hdAccountId,
- bool allowWeakPassword = false,
- int rpcPort = 7783,
- int netid = kDefaultNetId,
- String gui = 'komodo-defi-flutter-auth',
- bool https = false,
- bool rpcLocalOnly = true,
- bool allowRegistrations = true,
- List<
String> ? seedNodes, - bool? disableP2p,
- bool? iAmSeed,
- bool? isBootstrapNode,
Implementation
static Future<KdfStartupConfig> generateWithDefaults({
required String walletName,
required String walletPassword,
required bool? enableHd,
String? rpcPassword,
String? coinsPath,
String? seed,
String? dbDir,
String? userHome,
String? rpcIp,
int? hdAccountId,
bool allowWeakPassword = false,
int rpcPort = 7783,
int netid = kDefaultNetId,
String gui = 'komodo-defi-flutter-auth',
bool https = false,
bool rpcLocalOnly = true,
bool allowRegistrations = true,
List<String>? seedNodes,
bool? disableP2p,
bool? iAmSeed,
bool? isBootstrapNode,
}) async {
assert(
!kIsWeb || userHome == null && dbDir == null,
'Web does not support userHome or dbDir',
);
assert(
[walletName, walletPassword].every((e) => e.isNotEmpty),
'Wallet name and password must not be empty',
);
final (String? userHomePath, String? dbPath) = await _getAndSetupUserHome(
userHome: userHome,
dbHome: dbDir,
);
assert(
hdAccountId == null,
'HD Account ID is not supported yet in the SDK. '
'Use at your own risk.');
// Validate seed node configuration before creating the object
SeedNodeValidator.validate(
seedNodes: seedNodes,
disableP2p: disableP2p,
iAmSeed: iAmSeed,
isBootstrapNode: isBootstrapNode,
);
return KdfStartupConfig._(
walletName: walletName,
walletPassword: walletPassword,
rpcPassword: rpcPassword ?? SecurityUtils.generatePasswordSecure(32),
seed: seed,
dbDir: dbPath,
userHome: userHomePath,
allowWeakPassword: allowWeakPassword,
netid: netid,
gui: gui,
coins: coinsPath ?? await _fetchCoinsData(),
https: https,
seedNodes: seedNodes,
disableP2p: disableP2p,
iAmSeed: iAmSeed,
isBootstrapNode: isBootstrapNode,
rpcIp: rpcIp,
rpcPort: rpcPort,
rpcLocalOnly: rpcLocalOnly,
hdAccountId: hdAccountId,
allowRegistrations: allowRegistrations,
enableHd: enableHd,
);
}