Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit 4a3fd21

Browse files
Merge pull request #424 from autonomoussoftware/fix-active-wallet
Set activeWallet on wallet creation and only open activeWallet on start.
2 parents ed03f61 + 6704b94 commit 4a3fd21

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

public/main/client/handlers/single-core.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,21 @@ function createWallet (data, { coreApi, emitter }) {
2626
return Promise.all([
2727
wallet.setSeed(data.seed, data.password),
2828
wallet.setAddressForWalletId(walletId, address)
29-
]).then(() => emitter.emit('create-wallet', { walletId }))
29+
])
30+
.then(() => wallet.setActiveWallet(walletId))
31+
.then(() => emitter.emit('create-wallet', { walletId }))
3032
}
3133

32-
const openWallet = ({ emitter }) =>
33-
wallet.getWallets().forEach(walletId =>
34-
wallet.getAddressesForWalletId(walletId).forEach(address =>
35-
emitter.emit('open-wallets', {
36-
walletIds: [walletId],
37-
activeWallet: walletId,
38-
address
39-
})
40-
)
34+
function openWallet ({ emitter }) {
35+
const activeWallet = wallet.getActiveWallet() || wallet.getWallets()[0]
36+
wallet.getAddressesForWalletId(activeWallet).forEach(address =>
37+
emitter.emit('open-wallets', {
38+
walletIds: [activeWallet],
39+
activeWallet,
40+
address
41+
})
4142
)
43+
}
4244

4345
function refreshAllTransactions ({ address }, { coreApi, emitter }) {
4446
emitter.emit('transactions-scan-started', {})

0 commit comments

Comments
 (0)