Add admin task to list LndHub balances #68

Merged
raucao merged 3 commits from feature/list_lndhub_balances into master 2022-04-18 08:41:41 +00:00
Showing only changes of commit d9970c126a - Show all commits

View File

@@ -5,4 +5,15 @@ namespace :lndhub do
CreateLndhubWalletJob.perform_later(user)
end
end
desc "List wallet balances"
task :balances => :environment do |t, args|
User.all.each do |user|
lndhub = Lndhub.new
auth_token = lndhub.authenticate(user)
data = lndhub.balance(auth_token)
balance = data["BTC"]["AvailableBalance"] rescue nil
puts "#{user.address}: #{balance}" if balance && balance > 0
end
end
end