Skip to content

Commit 8ded7da

Browse files
css adjustments, add new wallet handling
1 parent a3cb8df commit 8ded7da

File tree

6 files changed

+44
-10
lines changed

6 files changed

+44
-10
lines changed

public/modules/chainManager.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,18 @@ class ChainManager {
7979
return this.getBitcoinArgs();
8080
}
8181
if (chainId === 'enforcer') {
82+
const mnemonicsPath = path.join(app.getPath('userData'), 'wallet_starters', 'mnemonics', 'l1.txt');
83+
const walletArg = fs.existsSync(mnemonicsPath)
84+
? `--wallet-seed-file=${mnemonicsPath}`
85+
: '--wallet-auto-create';
86+
8287
return [
8388
'--node-rpc-pass=password',
8489
'--node-rpc-user=user',
8590
'--node-rpc-addr=127.0.0.1:38332',
8691
'--node-zmq-addr-sequence=tcp://127.0.0.1:29000',
8792
'--enable-wallet',
88-
'--wallet-auto-create'
93+
walletArg
8994
];
9095
}
9196
return [];
@@ -738,4 +743,4 @@ class ChainManager {
738743
}
739744
}
740745

741-
module.exports = ChainManager;
746+
module.exports = ChainManager;

public/modules/walletManager.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ class WalletManager extends EventEmitter {
4747
});
4848
const success = await this.walletService.saveWallet(wallet);
4949
if (!success) throw new Error('Failed to save imported wallet');
50+
51+
// Generate all chain starters immediately
52+
try {
53+
await this.walletService.generateAllStarters();
54+
} catch (error) {
55+
console.error('Error generating chain starters:', error);
56+
// Don't throw here - master wallet was imported successfully
57+
}
58+
5059
return wallet;
5160
} catch (error) {
5261
console.error('Error importing master wallet:', error);
@@ -197,4 +206,4 @@ class WalletManager extends EventEmitter {
197206
}
198207
}
199208

200-
module.exports = WalletManager;
209+
module.exports = WalletManager;

public/modules/walletService.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,19 @@ class WalletService extends EventEmitter {
171171
}
172172

173173
async saveL1Starter(walletData) {
174+
// Save full wallet data
174175
const l1Path = path.join(this.walletDir, 'l1_starter.json');
175176
await fs.writeJson(l1Path, walletData, { spaces: 2 });
177+
178+
// Save mnemonic only for L1 if it doesn't exist
179+
const mnemonicPath = path.join(this.mnemonicsDir, 'l1.txt');
180+
if (!(await fs.pathExists(mnemonicPath))) {
181+
console.log('Creating new mnemonic file for L1');
182+
await fs.writeFile(mnemonicPath, walletData.mnemonic);
183+
} else {
184+
console.log('Mnemonic file already exists for L1, skipping creation');
185+
}
186+
176187
this.emit('wallet-updated');
177188
}
178189

@@ -381,4 +392,4 @@ class WalletService extends EventEmitter {
381392
}
382393
}
383394

384-
module.exports = WalletService;
395+
module.exports = WalletService;

src/components/Button.module.css

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
.stop,
2424
.stopping {
2525
composes: btn;
26-
width: 85px;
27-
overflow: hidden;
28-
text-overflow: ellipsis;
26+
width: 100px;
2927
}
3028

3129
/* Variable width states */

src/components/Nodes.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ function Nodes() {
349349
return (
350350
<div className={styles.container}>
351351
<div className={styles.chainSection}>
352-
<div className={styles.chainHeading}>
352+
<div className={styles.l1ChainHeading}>
353353
<h2>Layer 1</h2>
354354
{isInitialized && (
355355
<button
@@ -409,7 +409,9 @@ function Nodes() {
409409
</div>
410410
</div>
411411
<div className={styles.chainSection}>
412-
<h2 className={styles.chainHeading}>Layer 2</h2>
412+
<div className={styles.l2ChainHeading}>
413+
<h2>Layer 2</h2>
414+
</div>
413415
<div className={styles.l2Chains}>
414416
{chains
415417
.filter(chain => chain.chain_type === 2)

src/components/Nodes.module.css

+10-1
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,22 @@
2323
.chainHeading {
2424
font-size: calc(var(--base-font-size) * 1.1);
2525
font-weight: bold;
26-
margin: 0 0 var(--base-spacing) 0;
2726
padding: 0;
2827
display: flex;
2928
align-items: center;
3029
justify-content: space-between;
3130
}
3231

32+
.l1ChainHeading {
33+
composes: chainHeading;
34+
margin: var(--base-spacing) 0 0 0;
35+
}
36+
37+
.l2ChainHeading {
38+
composes: chainHeading;
39+
margin: calc(var(--base-spacing) * 0.25) 0;
40+
}
41+
3342
/* Chain lists */
3443
.l1Chains,
3544
.l2Chains {

0 commit comments

Comments
 (0)