//modify to return error // NOT WORKING // actually uses visor func (self *WalletRPC) GetWalletBalance(v *visor.Visor, walletID wallet.WalletID) (wallet.BalancePair, error) { wlt := self.Wallets.Get(walletID) if wlt == nil { log.Printf("GetWalletBalance: ID NOT FOUND: id= %s", walletID) return wallet.BalancePair{}, errors.New("Id not found") } auxs := v.Blockchain.Unspent.AllForAddresses(wlt.GetAddresses()) puxs := v.Unconfirmed.SpendsForAddresses(&v.Blockchain.Unspent, wlt.GetAddressSet()) coins1, hours1 := v.AddressBalance(auxs) coins2, hours2 := v.AddressBalance(auxs.Sub(puxs)) confirmed := wallet.Balance{coins1, hours1} predicted := wallet.Balance{coins2, hours2} return wallet.BalancePair{confirmed, predicted}, nil }