forked from planetdecred/dcrlibwallet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwallets.go
More file actions
29 lines (24 loc) · 662 Bytes
/
wallets.go
File metadata and controls
29 lines (24 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package dcrlibwallet
func (mw *MultiWallet) AllWallets() (wallets []*Wallet) {
for _, wallet := range mw.wallets {
wallets = append(wallets, wallet)
}
return wallets
}
func (mw *MultiWallet) WalletsIterator() *WalletsIterator {
return &WalletsIterator{
currentIndex: 0,
wallets: mw.AllWallets(),
}
}
func (walletsIterator *WalletsIterator) Next() *Wallet {
if walletsIterator.currentIndex < len(walletsIterator.wallets) {
wallet := walletsIterator.wallets[walletsIterator.currentIndex]
walletsIterator.currentIndex++
return wallet
}
return nil
}
func (walletsIterator *WalletsIterator) Reset() {
walletsIterator.currentIndex = 0
}