List balances of LndHub accounts

This commit is contained in:
Basti 2022-04-12 15:36:45 +02:00
parent 4e0d4bf86d
commit d9970c126a
Signed by untrusted user: basti
GPG Key ID: 9F88009D31D99C72

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