diff --git a/Gemfile b/Gemfile index 16b6dc48..b28de653 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,7 @@ gem 'sprockets-rails' # Gems used only for assets and not required #gem 'jsonapi-serializers', path: '/home/benjamin/development/rails/components/jsonapi-serializers' gem 'jsonapi-serializers', github: 'bterkuile/jsonapi-serializers' +gem 'lnrpc', github: 'bterkuile/lnrpc' gem 'ruby-handlebars' group :assets do diff --git a/Gemfile.lock b/Gemfile.lock index aaeea08a..97afb284 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -49,9 +49,17 @@ GIT jsonapi-serializers (0.2.6) activesupport +GIT + remote: https://github.com/bterkuile/lnrpc.git + revision: 199c6f89e34ffc839aaeef518645994063f63529 + specs: + lnrpc (0.15.5) + google-protobuf (>= 3.15.7) + grpc (>= 1.28.0) + GIT remote: https://github.com/bterkuile/simply_stored.git - revision: 4d68cb32061e894eebe9e9da1c43af0d1f05777c + revision: 7687dbfaa012b19a0ead15ed393511dcff53d311 branch: master specs: simply_stored (1.0.0) @@ -200,11 +208,11 @@ GEM bigdecimal rexml crass (1.0.6) - cucumber-gherkin (33.1.0) - cucumber-messages (> 25, < 29) - cucumber-messages (28.1.0) - cuke_modeler (3.25.0) - cucumber-gherkin (< 34.0) + cucumber-gherkin (36.1.0) + cucumber-messages (> 25, < 30) + cucumber-messages (29.0.1) + cuke_modeler (3.26.0) + cucumber-gherkin (< 37.0) date (3.5.0) devise (4.9.4) bcrypt (~> 3.0) @@ -230,7 +238,7 @@ GEM eventmachine (>= 1.0.0.beta.4) email_validator (2.2.4) activemodel - erb (5.1.3) + erb (6.0.0) erubi (1.13.1) eventmachine (1.2.7) exception_notification (5.0.1) @@ -246,8 +254,8 @@ GEM faraday-net_http (>= 2.0, < 3.5) json logger - faraday-net_http (3.4.1) - net-http (>= 0.5.0) + faraday-net_http (3.4.2) + net-http (~> 0.5) faye (1.4.1) cookiejar (>= 0.3.0) em-http-request (>= 1.1.6) @@ -274,6 +282,26 @@ GEM ruby-progressbar (~> 1.4) globalid (1.3.0) activesupport (>= 6.1) + google-protobuf (4.33.1-aarch64-linux-gnu) + bigdecimal + rake (>= 13) + google-protobuf (4.33.1-x86_64-darwin) + bigdecimal + rake (>= 13) + google-protobuf (4.33.1-x86_64-linux-gnu) + bigdecimal + rake (>= 13) + googleapis-common-protos-types (1.22.0) + google-protobuf (~> 4.26) + grpc (1.76.0-aarch64-linux-gnu) + google-protobuf (>= 3.25, < 5.0) + googleapis-common-protos-types (~> 1.0) + grpc (1.76.0-x86_64-darwin) + google-protobuf (>= 3.25, < 5.0) + googleapis-common-protos-types (~> 1.0) + grpc (1.76.0-x86_64-linux-gnu) + google-protobuf (>= 3.25, < 5.0) + googleapis-common-protos-types (~> 1.0) hashdiff (1.2.1) hashie (5.0.0) http_parser.rb (0.8.0) @@ -296,7 +324,7 @@ GEM js-routes (2.3.5) railties (>= 5) sorbet-runtime - json (2.15.2) + json (2.16.0) jwt (3.1.2) base64 kaminari (1.2.2) @@ -346,7 +374,7 @@ GEM mini_magick (5.3.1) logger mini_mime (1.1.5) - minitest (5.26.0) + minitest (5.26.2) momentjs-rails (2.29.4.1) railties (>= 3.1) multi_json (1.17.0) @@ -354,8 +382,8 @@ GEM bigdecimal (~> 3.1) mutex_m (0.3.0) naught (1.1.0) - net-http (0.7.0) - uri + net-http (0.8.0) + uri (>= 0.11.1) net-imap (0.5.12) date net-protocol @@ -377,7 +405,7 @@ GEM racc (~> 1.4) nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) - oauth2 (2.0.17) + oauth2 (2.0.18) faraday (>= 0.17.3, < 4.0) jwt (>= 1.0, < 4.0) logger (~> 1.2) @@ -483,7 +511,7 @@ GEM psych (>= 4.0.0) tsort regexp_parser (2.11.3) - reline (0.6.2) + reline (0.6.3) io-console (~> 0.5) responders (3.2.0) actionpack (>= 7.0) @@ -548,7 +576,7 @@ GEM snaky_hash (2.0.3) hashie (>= 0.1.0, < 6) version_gem (>= 1.1.8, < 3) - sorbet-runtime (0.6.12690) + sorbet-runtime (0.6.12780) sprockets (4.2.2) concurrent-ruby (~> 1.0) logger @@ -564,7 +592,7 @@ GEM net-sftp (>= 2.1.2) net-ssh (>= 2.8.0) ostruct - stringio (3.1.7) + stringio (3.1.8) temple (0.10.4) terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) @@ -582,7 +610,7 @@ GEM concurrent-ruby (~> 1.0) uglifier (4.2.1) execjs (>= 0.3.0, < 3) - uri (1.1.0) + uri (1.1.1) useragent (0.16.11) version_gem (1.1.9) warden (1.2.9) @@ -642,6 +670,7 @@ DEPENDENCIES kt-paperclip launchy letter_opener + lnrpc! mini_magick mutex_m naught diff --git a/app/services/mozo/lnd.rb b/app/services/mozo/lnd.rb new file mode 100644 index 00000000..e83e5dd7 --- /dev/null +++ b/app/services/mozo/lnd.rb @@ -0,0 +1,11 @@ +module Mozo + module Lnd + def self.client + credentials = File.read(Rails.application.config.lnd_credentials_path) + macaroon = File.read(Rails.application.config.lnd_macaroon_path).unpack("H*") + #Lnrpc::Lightning::Stub.new("localhost:10009", GRPC::Core::ChannelCredentials.new(credentials)) + lnd = Lnrpc::Client.new(credentials_path: Rails.application.config.lnd_credentials_path, macaroon_path: Rails.application.config.lnd_macaroon_path) + end + + end +end diff --git a/config/environments/development.rb b/config/environments/development.rb index 40a16cc9..fee702d1 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -14,6 +14,8 @@ Mozo::Application.configure do resource '*', headers: :any, methods: %i[get post put patch delete options] end end + config.lnd_credentials_path = '/mnt/ext1/.lnd/tls.cert' + config.lnd_macaroon_path = '/mnt/ext1/.lnd/data/chain/bitcoin/mainnet/admin.macaroon' # Do not eager load code on boot. config.eager_load = false