Compare commits
4 Commits
4e0d4bf86d
...
1f57bbd9c2
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f57bbd9c2 | |||
|
2a2793ae44
|
|||
|
8773bf5f9e
|
|||
|
d9970c126a
|
@@ -5,4 +5,20 @@ namespace :lndhub do
|
||||
CreateLndhubWalletJob.perform_later(user)
|
||||
end
|
||||
end
|
||||
|
||||
desc "List wallet balances"
|
||||
task :balances => :environment do |t, args|
|
||||
sum = 0
|
||||
User.all.each do |user|
|
||||
lndhub = Lndhub.new
|
||||
auth_token = lndhub.authenticate(user)
|
||||
data = lndhub.balance(auth_token)
|
||||
balance = data["BTC"]["AvailableBalance"] rescue nil
|
||||
if balance && balance > 0
|
||||
sum += balance
|
||||
puts "#{user.address}: #{balance} sats"
|
||||
end
|
||||
end
|
||||
puts "--\nSum of user balances: #{sum} sats"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user