Merge pull request 'Add admin task to list LndHub balances' (#68) from feature/list_lndhub_balances into master
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #68
This commit is contained in:
commit
1f57bbd9c2
@ -5,4 +5,20 @@ namespace :lndhub do
|
|||||||
CreateLndhubWalletJob.perform_later(user)
|
CreateLndhubWalletJob.perform_later(user)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user