2 Commits

Author SHA1 Message Date
7e8443c598 Change Lightning balance property
Some checks failed
continuous-integration/drone/push Build is failing
... so that clients can use the same property with all balances
2024-01-15 11:39:24 +03:00
3aa0c49507 Set CORS headers for BTCPay API endpoints 2024-01-02 09:49:09 +03:00
2 changed files with 8 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
class Api::BtcpayController < Api::BaseController
before_action :require_feature_enabled
before_action :set_cors_access_control_headers
def onchain_btc_balance
balance = BtcpayManager::FetchOnchainWalletBalance.call
@@ -26,4 +27,10 @@ class Api::BtcpayController < Api::BaseController
http_status :not_found and return
end
end
def set_cors_access_control_headers
headers['Access-Control-Allow-Origin'] = "*"
headers['Access-Control-Allow-Headers'] = "*"
headers['Access-Control-Allow-Methods'] = "GET"
end
end

View File

@@ -4,7 +4,7 @@ module BtcpayManager
res = get "stores/#{store_id}/lightning/BTC/balance"
{
balance: res["offchain"]["local"].to_i / 1000 # msats to sats
confirmed_balance: res["offchain"]["local"].to_i / 1000 # msats to sats
}
end
end