Add wallet page
With setup code to connect Blue Wallet to Kosmos account wallets
This commit is contained in:
21
app/controllers/wallet_controller.rb
Normal file
21
app/controllers/wallet_controller.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require "rqrcode"
|
||||
|
||||
class WalletController < ApplicationController
|
||||
before_action :require_user_signed_in
|
||||
|
||||
def index
|
||||
@current_section = :wallet
|
||||
|
||||
@wallet_url = "lndhub://#{current_user.ln_login}:#{current_user.ln_password}@https://lndhub.kosmos.org"
|
||||
|
||||
qrcode = RQRCode::QRCode.new(@wallet_url)
|
||||
@svg = qrcode.as_svg(
|
||||
color: "000",
|
||||
shape_rendering: "crispEdges",
|
||||
module_size: 6,
|
||||
standalone: true,
|
||||
use_path: true
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
2
app/helpers/wallet_helper.rb
Normal file
2
app/helpers/wallet_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module WalletHelper
|
||||
end
|
||||
@@ -13,6 +13,10 @@
|
||||
<%= link_to "Donations", donations_path,
|
||||
class: @current_section == :contributions ? "active" : nil %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "Wallet", wallet_path,
|
||||
class: @current_section == :wallet ? "active" : nil %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "Security", security_path,
|
||||
class: @current_section == :security ? "active" : nil %>
|
||||
|
||||
42
app/views/wallet/index.html.erb
Normal file
42
app/views/wallet/index.html.erb
Normal file
@@ -0,0 +1,42 @@
|
||||
<section>
|
||||
<h2>Wallet</h2>
|
||||
<p>
|
||||
Send and receive BTC via the Lightning Network.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h3>
|
||||
Blue Wallet
|
||||
</h3>
|
||||
<p>
|
||||
You can connect Blue Wallet (Android or iOS) to your Kosmos bitcoin wallet.
|
||||
</p>
|
||||
<p>
|
||||
<a id="show-setup-code" class="ks-text-link cursor-pointer">Show setup code</a>
|
||||
<a id="hide-setup-code" class="ks-text-link cursor-pointer" style="display: none;">Hide setup code</a>
|
||||
</p>
|
||||
<p id="setup-code" style="display: none;">
|
||||
<%= raw @svg %>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<script type="text/javascript">
|
||||
const linkShow = document.querySelector('#show-setup-code');
|
||||
const linkHide = document.querySelector('#hide-setup-code');
|
||||
const setupCode = document.querySelector('#setup-code');
|
||||
linkShow.addEventListener('click', function(ev) {
|
||||
ev.preventDefault();
|
||||
setupCode.style.display = 'block';
|
||||
linkShow.style.display = 'none';
|
||||
linkHide.style.display = 'block';
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
});
|
||||
linkHide.addEventListener('click', function(ev) {
|
||||
ev.preventDefault();
|
||||
const el = document.querySelector('#setup-code');
|
||||
setupCode.style.display = 'none';
|
||||
linkShow.style.display = 'block';
|
||||
linkHide.style.display = 'none';
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user