diff --git a/lib/tasks/lndhub.rake b/lib/tasks/lndhub.rake index 04e7aac..bc6b13f 100644 --- a/lib/tasks/lndhub.rake +++ b/lib/tasks/lndhub.rake @@ -1,3 +1,6 @@ +require "digest" +require "pp" + namespace :lndhub do desc "Generate wallets for all users" task :generate_wallets => :environment do |t, args| @@ -22,6 +25,21 @@ namespace :lndhub do puts "--\nSum of user balances: #{sum} sats" end + desc "Create test invoice" + task :create_test_invoice, [:username, :amount, :description] => :environment do |t, args| + user = User.find_by cn: args[:username] + desc = args[:description] + hash = Digest::SHA256.hexdigest(desc) + + invoice = LndhubManager::CreateUserInvoice.call(user: user, payload: { + "amount": args[:amount].to_i, + "description": desc, + "description_hash": hash + }) + + pp invoice + end + desc "Migrate existing accounts to lndhub.go" task :migrate => :environment do |t, args| # user = User.find_by cn: "jimmy"