WIP Add wallet transactions route, view
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Adds a new component for the wallet summary as well, and makes the component tests work with RSpec.
This commit is contained in:
@@ -3,10 +3,10 @@ require "rqrcode"
|
||||
class WalletController < ApplicationController
|
||||
before_action :require_user_signed_in
|
||||
before_action :authenticate_with_lndhub
|
||||
before_action :set_current_section
|
||||
before_action :fetch_balance
|
||||
|
||||
def index
|
||||
@current_section = :wallet
|
||||
|
||||
@wallet_url = "lndhub://#{current_user.ln_login}:#{current_user.ln_password}@#{ENV['LNDHUB_PUBLIC_URL']}"
|
||||
|
||||
qrcode = RQRCode::QRCode.new(@wallet_url)
|
||||
@@ -20,8 +20,10 @@ class WalletController < ApplicationController
|
||||
class: 'inline-block'
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
def transactions
|
||||
|
||||
@balance = fetch_balance rescue nil
|
||||
end
|
||||
|
||||
private
|
||||
@@ -42,6 +44,10 @@ class WalletController < ApplicationController
|
||||
def fetch_balance
|
||||
lndhub = Lndhub.new
|
||||
data = lndhub.balance @ln_auth_token
|
||||
data["BTC"]["AvailableBalance"]
|
||||
@balance = data["BTC"]["AvailableBalance"] rescue nil
|
||||
end
|
||||
|
||||
def set_current_section
|
||||
@current_section = :wallet
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user