@@ -57,9 +57,10 @@ class DecredWalletService extends WalletService<
57
57
@override
58
58
Future <DecredWallet > create (DecredNewWalletCredentials credentials, {bool ? isTestnet}) async {
59
59
await this .init ();
60
+ final dirPath = await pathForWalletDir (name: credentials.walletInfo! .name, type: getType ());
60
61
final config = {
61
62
"name" : credentials.walletInfo! .name,
62
- "datadir" : credentials.walletInfo ! . dirPath,
63
+ "datadir" : dirPath,
63
64
"pass" : credentials.password! ,
64
65
"net" : isTestnet == true ? testnet : mainnet,
65
66
"unsyncedaddrs" : true ,
@@ -84,14 +85,11 @@ class DecredWalletService extends WalletService<
84
85
: mainnet;
85
86
86
87
await this .init ();
87
- final walletDirExists = Directory (walletInfo.dirPath).existsSync ();
88
- if (! walletDirExists) {
89
- walletInfo.dirPath = await pathForWalletDir (name: name, type: getType ());
90
- }
88
+ final dirPath = await pathForWalletDir (name: name, type: getType ());
91
89
92
90
final config = {
93
- "name" : walletInfo. name,
94
- "datadir" : walletInfo. dirPath,
91
+ "name" : name,
92
+ "datadir" : dirPath,
95
93
"net" : network,
96
94
"unsyncedaddrs" : true ,
97
95
};
@@ -123,11 +121,9 @@ class DecredWalletService extends WalletService<
123
121
124
122
await currentWallet.renameWalletFiles (newName);
125
123
126
- final newDirPath = await pathForWalletDir (name: newName, type: getType ());
127
124
final newWalletInfo = currentWalletInfo;
128
125
newWalletInfo.id = WalletBase .idFor (newName, getType ());
129
126
newWalletInfo.name = newName;
130
- newWalletInfo.dirPath = newDirPath;
131
127
newWalletInfo.network = network;
132
128
133
129
await walletInfoSource.put (currentWalletInfo.key, newWalletInfo);
@@ -137,9 +133,10 @@ class DecredWalletService extends WalletService<
137
133
Future <DecredWallet > restoreFromSeed (DecredRestoreWalletFromSeedCredentials credentials,
138
134
{bool ? isTestnet}) async {
139
135
await this .init ();
136
+ final dirPath = await pathForWalletDir (name: credentials.walletInfo! .name, type: getType ());
140
137
final config = {
141
138
"name" : credentials.walletInfo! .name,
142
- "datadir" : credentials.walletInfo ! . dirPath,
139
+ "datadir" : dirPath,
143
140
"pass" : credentials.password! ,
144
141
"mnemonic" : credentials.mnemonic,
145
142
"net" : isTestnet == true ? testnet : mainnet,
@@ -161,9 +158,10 @@ class DecredWalletService extends WalletService<
161
158
Future <DecredWallet > restoreFromKeys (DecredRestoreWalletFromPubkeyCredentials credentials,
162
159
{bool ? isTestnet}) async {
163
160
await this .init ();
161
+ final dirPath = await pathForWalletDir (name: credentials.walletInfo! .name, type: getType ());
164
162
final config = {
165
163
"name" : credentials.walletInfo! .name,
166
- "datadir" : credentials.walletInfo ! . dirPath,
164
+ "datadir" : dirPath,
167
165
"pubkey" : credentials.pubkey,
168
166
"net" : isTestnet == true ? testnet : mainnet,
169
167
"unsyncedaddrs" : true ,
0 commit comments