lighstorm 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.env.example +5 -0
  3. data/.gitignore +1 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +10 -0
  6. data/Gemfile +4 -0
  7. data/Gemfile.lock +26 -2
  8. data/README.md +29 -370
  9. data/adapters/connections/channel_node/fee.rb +26 -0
  10. data/adapters/connections/channel_node.rb +52 -0
  11. data/adapters/connections/payment_channel.rb +28 -0
  12. data/adapters/edges/channel.rb +80 -0
  13. data/adapters/edges/forward.rb +41 -0
  14. data/adapters/edges/payment/purpose.rb +34 -0
  15. data/adapters/edges/payment.rb +53 -0
  16. data/adapters/invoice.rb +50 -0
  17. data/adapters/nodes/node.rb +77 -0
  18. data/adapters/payment_request.rb +77 -0
  19. data/components/cache.rb +3 -2
  20. data/components/lnd.rb +5 -1
  21. data/controllers/channel/actions/update_fee.rb +76 -0
  22. data/controllers/channel/all.rb +79 -0
  23. data/controllers/channel/find_by_id.rb +153 -0
  24. data/controllers/channel/mine.rb +114 -0
  25. data/controllers/channel.rb +23 -0
  26. data/controllers/forward/all.rb +244 -0
  27. data/controllers/forward/group_by_channel.rb +89 -0
  28. data/controllers/forward.rb +28 -0
  29. data/controllers/invoice/actions/create.rb +36 -0
  30. data/controllers/invoice/actions/pay.rb +28 -0
  31. data/controllers/invoice/actions/pay_through_route.rb +71 -0
  32. data/controllers/invoice/all.rb +70 -0
  33. data/controllers/invoice/find_by_secret_hash.rb +42 -0
  34. data/controllers/invoice.rb +36 -0
  35. data/controllers/node/all.rb +63 -0
  36. data/controllers/node/find_by_public_key.rb +49 -0
  37. data/controllers/node/myself.rb +34 -0
  38. data/controllers/node.rb +23 -0
  39. data/controllers/payment/all.rb +352 -0
  40. data/controllers/payment.rb +21 -0
  41. data/docs/.nojekyll +0 -0
  42. data/docs/README.md +655 -0
  43. data/docs/_coverpage.md +12 -0
  44. data/docs/index.html +26 -0
  45. data/docs/vendor/docsify/docsify@4.js +1 -0
  46. data/docs/vendor/docsify-themeable/theme-simple-dark.css +3 -0
  47. data/docs/vendor/docsify-themeable/theme-simple-dark.css.map +1 -0
  48. data/docs/vendor/prismjs/prism-bash.min.js +1 -0
  49. data/docs/vendor/prismjs/prism-ruby.min.js +1 -0
  50. data/docs/vendor/prismjs/prism-tomorrow.min.css +1 -0
  51. data/lighstorm.gemspec +3 -1
  52. data/models/connections/channel_node/accounting.rb +3 -14
  53. data/models/connections/channel_node/fee.rb +39 -77
  54. data/models/connections/channel_node/htlc.rb +30 -10
  55. data/models/connections/channel_node/policy.rb +6 -18
  56. data/models/connections/channel_node.rb +20 -26
  57. data/models/connections/forward_channel.rb +8 -43
  58. data/models/connections/payment_channel.rb +18 -39
  59. data/models/edges/channel/accounting.rb +28 -20
  60. data/models/edges/channel/hop.rb +65 -0
  61. data/models/edges/channel.rb +80 -172
  62. data/models/edges/forward.rb +9 -118
  63. data/models/edges/groups/{analysis.rb → channel_forwards/analysis.rb} +9 -9
  64. data/models/edges/groups/channel_forwards.rb +10 -40
  65. data/models/edges/payment.rb +29 -214
  66. data/models/errors.rb +29 -0
  67. data/models/invoice.rb +49 -0
  68. data/models/nodes/node/lightning.rb +5 -16
  69. data/models/nodes/node/platform.rb +7 -13
  70. data/models/nodes/node.rb +20 -115
  71. data/models/payment_request.rb +69 -0
  72. data/models/rate.rb +11 -1
  73. data/models/satoshis.rb +5 -6
  74. data/ports/dsl/lighstorm/errors.rb +5 -0
  75. data/ports/dsl/lighstorm.rb +11 -9
  76. data/ports/grpc.rb +62 -0
  77. data/static/cache.rb +12 -0
  78. data/static/spec.rb +3 -1
  79. metadata +55 -6
  80. data/models/connections/channel_node/constraints.rb +0 -24
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../../components/lnd'
4
-
5
3
  require_relative 'lightning'
6
4
 
5
+ require_relative '../../..//ports/grpc'
6
+ require_relative '../../../adapters/nodes/node'
7
+
7
8
  module Lighstorm
8
9
  module Models
9
10
  class Platform
@@ -11,26 +12,19 @@ module Lighstorm
11
12
 
12
13
  def initialize(node)
13
14
  @node = node
14
-
15
- response = Cache.for('lightning.get_info') do
16
- LND.instance.middleware('lightning.get_info') do
17
- LND.instance.client.lightning.get_info
18
- end
19
- end
20
-
21
- @data = { get_info: response }
15
+ @data = @node.data[:platform]
22
16
  end
23
17
 
24
18
  def blockchain
25
- @blockchain ||= @data[:get_info].chains.first.chain
19
+ @blockchain ||= @data ? @data[:blockchain] : nil
26
20
  end
27
21
 
28
22
  def network
29
- @network ||= @data[:get_info].chains.first.network
23
+ @network ||= @data ? @data[:network] : nil
30
24
  end
31
25
 
32
26
  def lightning
33
- @lightning ||= Lightning.new(self, @node)
27
+ @lightning ||= Lightning.new(@node)
34
28
  end
35
29
 
36
30
  def to_h
data/models/nodes/node.rb CHANGED
@@ -1,46 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../components/lnd'
4
-
5
- require_relative '../edges/channel'
3
+ require_relative '../../controllers/channel'
4
+ require_relative '../errors'
6
5
 
7
6
  require_relative 'node/platform'
8
7
 
9
8
  module Lighstorm
10
9
  module Models
11
10
  class Node
12
- KIND = :node
13
-
14
- attr_reader :alias, :public_key, :color
11
+ attr_reader :data, :_key, :alias, :public_key, :color
15
12
 
16
- def self.myself
17
- response = Cache.for('lightning.get_info') do
18
- LND.instance.middleware('lightning.get_info') do
19
- LND.instance.client.lightning.get_info
20
- end
21
- end
22
-
23
- Node.find_by_public_key(response.identity_pubkey, myself: true)
24
- end
13
+ def initialize(data)
14
+ @data = data
25
15
 
26
- def self.find_by_public_key(public_key, myself: false)
27
- Node.new({ public_key: public_key }, myself: myself)
28
- end
29
-
30
- def self.all
31
- response = LND.instance.middleware('lightning.describe_graph') do
32
- LND.instance.client.lightning.describe_graph
33
- end
34
-
35
- myself_public_key = myself.public_key
36
-
37
- response.nodes.map do |raw_node|
38
- Node.new({ describe_graph: raw_node }, myself: raw_node.pub_key == myself_public_key)
39
- end
16
+ @_key = @data[:_key]
17
+ @alias = @data[:alias]
18
+ @public_key = @data[:public_key]
19
+ @color = @data[:color]
40
20
  end
41
21
 
42
22
  def myself?
43
- @myself
23
+ @data[:myself] == true
44
24
  end
45
25
 
46
26
  def platform
@@ -48,98 +28,23 @@ module Lighstorm
48
28
  end
49
29
 
50
30
  def channels
51
- if myself?
52
- Channel.mine
53
- else
54
- Channel.all
55
- end
56
- end
31
+ raise Errors::NotYourNodeError unless myself?
57
32
 
58
- def raw
59
- {
60
- get_node_info: @data[:get_node_info].to_h,
61
- describe_graph: @data[:describe_graph].to_h
62
- }
33
+ Controllers::Channel.mine
63
34
  end
64
35
 
65
36
  def to_h
66
- if (@data[:get_node_info] || @data[:describe_graph]) && myself?
67
- {
68
- alias: @alias,
69
- public_key: @public_key,
70
- color: @color,
71
- platform: platform.to_h
72
- }
73
- elsif @data[:get_node_info] || @data[:describe_graph]
74
- {
75
- alias: @alias,
76
- public_key: @public_key,
77
- color: @color
78
- }
79
- else
80
- {
81
- public_key: @public_key
82
- }
83
- end
84
- end
85
-
86
- def myself
87
- return @myself unless @myself.nil?
88
-
89
- response_get_info = Cache.for('lightning.get_info') do
90
- LND.instance.middleware('lightning.get_info') do
91
- LND.instance.client.lightning.get_info
92
- end
93
- end
94
-
95
- @myself = public_key == response_get_info.identity_pubkey
96
- end
97
-
98
- def error?
99
- !@data[:error].nil?
100
- end
101
-
102
- def error
103
- @data[:error]
104
- end
105
-
106
- def initialize(params, myself: false, fetch: true)
107
- if params[:public_key] && fetch
108
- begin
109
- response = Cache.for('lightning.get_node_info', params: { pub_key: params[:public_key] }) do
110
- LND.instance.middleware('lightning.get_node_info') do
111
- LND.instance.client.lightning.get_node_info(pub_key: params[:public_key])
112
- end
113
- end
114
-
115
- @data = { get_node_info: response }
116
- @raw_node = response.node
117
- rescue StandardError => e
118
- @data = { get_node_info: nil, error: e }
119
- @public_key = params[:public_key]
120
- end
121
- elsif params[:describe_graph]
122
- @data = { describe_graph: params[:describe_graph] }
123
-
124
- @raw_node = params[:describe_graph]
125
- else
126
- @data = {}
127
- end
128
-
129
- @myself = myself
130
-
131
- if params[:public_key] && !fetch
132
- @public_key = params[:public_key]
133
- return
134
- end
37
+ result = {
38
+ _key: _key,
39
+ public_key: public_key
40
+ }
135
41
 
136
- @myself = myself
42
+ result[:alias] = @alias unless self.alias.nil?
43
+ result[:color] = @color unless color.nil?
137
44
 
138
- return unless @raw_node
45
+ result[:platform] = platform.to_h if @data[:platform]
139
46
 
140
- @alias = @raw_node.alias
141
- @public_key = @raw_node.pub_key
142
- @color = @raw_node.color
47
+ result
143
48
  end
144
49
  end
145
50
  end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'digest'
4
+ require_relative 'satoshis'
5
+
6
+ module Lighstorm
7
+ module Models
8
+ class PaymentRequest
9
+ attr_reader :_key, :code, :address
10
+
11
+ def initialize(data)
12
+ @data = data
13
+
14
+ @_key = Digest::SHA256.hexdigest(data[:code])
15
+ @code = data[:code]
16
+
17
+ @address = data[:address]
18
+ end
19
+
20
+ def amount
21
+ @amount ||= Satoshis.new(milisatoshis: @data[:amount][:milisatoshis])
22
+ end
23
+
24
+ def description
25
+ @description ||= Struct.new(:data) do
26
+ def memo
27
+ data[:memo]
28
+ end
29
+
30
+ def hash
31
+ data[:hash]
32
+ end
33
+
34
+ def to_h
35
+ { memo: memo, hash: hash }
36
+ end
37
+ end.new(@data[:description])
38
+ end
39
+
40
+ def secret
41
+ @secret ||= Struct.new(:data) do
42
+ def preimage
43
+ data[:preimage]
44
+ end
45
+
46
+ def hash
47
+ data[:hash]
48
+ end
49
+
50
+ def to_h
51
+ # Don't expose 'secret' by default: Security
52
+ { hash: hash }
53
+ end
54
+ end.new(@data[:secret])
55
+ end
56
+
57
+ def to_h
58
+ # Don't expose 'address' by default: Privacy
59
+ {
60
+ _key: _key,
61
+ code: code,
62
+ amount: amount.to_h,
63
+ description: description.to_h,
64
+ secret: secret.to_h
65
+ }
66
+ end
67
+ end
68
+ end
69
+ end
data/models/rate.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative '../ports/dsl/lighstorm/errors'
4
+
3
5
  module Lighstorm
4
6
  module Models
5
7
  class Rate
@@ -7,12 +9,20 @@ module Lighstorm
7
9
 
8
10
  # https://en.wikipedia.org/wiki/Parts-per_notation
9
11
  def initialize(parts_per_million: nil)
10
- raise 'missing parts_per_million' if parts_per_million.nil?
12
+ raise MissingPartsPerMillionError, 'missing parts_per_million' if parts_per_million.nil?
11
13
 
12
14
  # TODO
13
15
  @parts_per_million = parts_per_million
14
16
  end
15
17
 
18
+ def ppm
19
+ @parts_per_million
20
+ end
21
+
22
+ def percentage
23
+ @percentage ||= @parts_per_million.to_f / 10_000
24
+ end
25
+
16
26
  def to_h
17
27
  {
18
28
  parts_per_million: @parts_per_million
data/models/satoshis.rb CHANGED
@@ -1,10 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative '../ports/dsl/lighstorm/errors'
4
+
3
5
  module Lighstorm
4
6
  module Models
5
7
  class Satoshis
6
8
  def initialize(milisatoshis: nil)
7
- raise 'missing milisatoshis' if milisatoshis.nil?
9
+ raise MissingMilisatoshisError, 'missing milisatoshis' if milisatoshis.nil?
8
10
 
9
11
  @amount_in_milisatoshis = milisatoshis
10
12
  end
@@ -15,8 +17,7 @@ module Lighstorm
15
17
  if reference_milisatoshis.zero?
16
18
  0
17
19
  else
18
- @amount_in_milisatoshis.to_f /
19
- reference_milisatoshis
20
+ @amount_in_milisatoshis.to_f / reference_milisatoshis
20
21
  end
21
22
  ) * 1_000_000.0
22
23
  )
@@ -27,7 +28,7 @@ module Lighstorm
27
28
  end
28
29
 
29
30
  def satoshis
30
- (@amount_in_milisatoshis.to_f / 1000.0).to_i
31
+ @amount_in_milisatoshis.to_f / 1000.0
31
32
  end
32
33
 
33
34
  def bitcoins
@@ -49,8 +50,6 @@ module Lighstorm
49
50
  def to_h
50
51
  {
51
52
  milisatoshis: milisatoshis
52
- # satoshis: satoshis,
53
- # bitcoins: bitcoins
54
53
  }
55
54
  end
56
55
  end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../models/errors'
4
+
5
+ include Lighstorm::Errors
@@ -6,17 +6,19 @@ require_relative '../../static/spec'
6
6
 
7
7
  require_relative '../../models/satoshis'
8
8
 
9
- require_relative '../../models/nodes/node'
10
-
11
- require_relative '../../models/edges/channel'
12
- require_relative '../../models/edges/forward'
13
- require_relative '../../models/edges/payment'
9
+ require_relative '../../controllers/node'
10
+ require_relative '../../controllers/channel'
11
+ require_relative '../../controllers/payment'
12
+ require_relative '../../controllers/forward'
13
+ require_relative '../../controllers/invoice'
14
14
 
15
15
  module Lighstorm
16
- Node = Models::Node
17
- Channel = Models::Channel
18
- Forward = Models::Forward
19
- Payment = Models::Payment
16
+ Node = Controllers::Node
17
+ Channel = Controllers::Channel
18
+ Payment = Controllers::Payment
19
+ Forward = Controllers::Forward
20
+ Invoice = Controllers::Invoice
21
+
20
22
  Satoshis = Models::Satoshis
21
23
 
22
24
  def self.config!(config)
data/ports/grpc.rb ADDED
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../components/cache'
4
+ require_relative '../components/lnd'
5
+
6
+ module Lighstorm
7
+ module Ports
8
+ class GRPC
9
+ def initialize(service, service_key)
10
+ @service = service
11
+ @service_key = service_key
12
+ end
13
+
14
+ def call!(call_key, *args, &block)
15
+ key = "#{@service_key}.#{call_key}"
16
+
17
+ if block.nil?
18
+ response = Cache.for(key, params: args&.first) do
19
+ LND.instance.middleware(key) do
20
+ @service.send(call_key, *args, &block)
21
+ end
22
+ end
23
+ else
24
+ LND.instance.middleware(key) do
25
+ @service.send(call_key, *args, &block)
26
+ end
27
+ end
28
+ end
29
+
30
+ def method_missing(method_name, *args, &block)
31
+ call_key = method_name.to_sym
32
+
33
+ raise ArgumentError, "Method `#{method_name}` doesn't exist." unless @service.respond_to?(call_key)
34
+
35
+ call!(call_key, *args, &block)
36
+ end
37
+
38
+ def respond_to_missing?(method_name, include_private = false)
39
+ call_key = method_name.to_sym
40
+
41
+ @service.respond_to?(call_key) || super
42
+ end
43
+
44
+ def self.method_missing(method_name, *_args)
45
+ service_key = method_name.to_sym
46
+
47
+ unless LND.instance.client.respond_to?(service_key)
48
+ raise ArgumentError,
49
+ "Method `#{method_name}` doesn't exist."
50
+ end
51
+
52
+ new(LND.instance.client.send(service_key), service_key)
53
+ end
54
+
55
+ def self.respond_to_missing?(method_name, include_private = false)
56
+ service_key = method_name.to_sym
57
+
58
+ LND.instance.client.respond_to?(service_key) || super
59
+ end
60
+ end
61
+ end
62
+ end
data/static/cache.rb CHANGED
@@ -9,6 +9,18 @@ module Lighstorm
9
9
  base_fee_msat fee_per_mil
10
10
  ]
11
11
  },
12
+ decode_pay_req: {
13
+ ttl: 5 * 60
14
+ },
15
+ describe_graph: {
16
+ ttl: 0
17
+ },
18
+ lookup_invoice: {
19
+ ttl: 1
20
+ },
21
+ list_invoices: {
22
+ ttl: 1
23
+ },
12
24
  forwarding_history: {
13
25
  ttl: 1,
14
26
  properties: %i[
data/static/spec.rb CHANGED
@@ -4,11 +4,13 @@ module Lighstorm
4
4
  module Static
5
5
  SPEC = {
6
6
  name: 'lighstorm',
7
- version: '0.0.3',
7
+ version: '0.0.4',
8
8
  author: 'icebaker',
9
9
  summary: 'API for interacting with a Lightning Node.',
10
10
  description: 'Lighstorm is an opinionated abstraction layer on top of the lnd-client for interacting with a Lightning Node.',
11
11
  github: 'https://github.com/icebaker/lighstorm',
12
+ documentation: 'https://icebaker.github.io/lighstorm',
13
+ issues: 'https://github.com/icebaker/lighstorm/issues',
12
14
  license: 'MIT'
13
15
  }.freeze
14
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lighstorm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - icebaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-12 00:00:00.000000000 Z
11
+ date: 2023-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -65,18 +65,59 @@ executables: []
65
65
  extensions: []
66
66
  extra_rdoc_files: []
67
67
  files:
68
+ - ".env.example"
68
69
  - ".gitignore"
70
+ - ".rspec"
69
71
  - ".rubocop.yml"
70
72
  - Gemfile
71
73
  - Gemfile.lock
72
74
  - LICENSE
73
75
  - README.md
76
+ - adapters/connections/channel_node.rb
77
+ - adapters/connections/channel_node/fee.rb
78
+ - adapters/connections/payment_channel.rb
79
+ - adapters/edges/channel.rb
80
+ - adapters/edges/forward.rb
81
+ - adapters/edges/payment.rb
82
+ - adapters/edges/payment/purpose.rb
83
+ - adapters/invoice.rb
84
+ - adapters/nodes/node.rb
85
+ - adapters/payment_request.rb
74
86
  - components/cache.rb
75
87
  - components/lnd.rb
88
+ - controllers/channel.rb
89
+ - controllers/channel/actions/update_fee.rb
90
+ - controllers/channel/all.rb
91
+ - controllers/channel/find_by_id.rb
92
+ - controllers/channel/mine.rb
93
+ - controllers/forward.rb
94
+ - controllers/forward/all.rb
95
+ - controllers/forward/group_by_channel.rb
96
+ - controllers/invoice.rb
97
+ - controllers/invoice/actions/create.rb
98
+ - controllers/invoice/actions/pay.rb
99
+ - controllers/invoice/actions/pay_through_route.rb
100
+ - controllers/invoice/all.rb
101
+ - controllers/invoice/find_by_secret_hash.rb
102
+ - controllers/node.rb
103
+ - controllers/node/all.rb
104
+ - controllers/node/find_by_public_key.rb
105
+ - controllers/node/myself.rb
106
+ - controllers/payment.rb
107
+ - controllers/payment/all.rb
108
+ - docs/.nojekyll
109
+ - docs/README.md
110
+ - docs/_coverpage.md
111
+ - docs/index.html
112
+ - docs/vendor/docsify-themeable/theme-simple-dark.css
113
+ - docs/vendor/docsify-themeable/theme-simple-dark.css.map
114
+ - docs/vendor/docsify/docsify@4.js
115
+ - docs/vendor/prismjs/prism-bash.min.js
116
+ - docs/vendor/prismjs/prism-ruby.min.js
117
+ - docs/vendor/prismjs/prism-tomorrow.min.css
76
118
  - lighstorm.gemspec
77
119
  - models/connections/channel_node.rb
78
120
  - models/connections/channel_node/accounting.rb
79
- - models/connections/channel_node/constraints.rb
80
121
  - models/connections/channel_node/fee.rb
81
122
  - models/connections/channel_node/htlc.rb
82
123
  - models/connections/channel_node/policy.rb
@@ -84,25 +125,33 @@ files:
84
125
  - models/connections/payment_channel.rb
85
126
  - models/edges/channel.rb
86
127
  - models/edges/channel/accounting.rb
128
+ - models/edges/channel/hop.rb
87
129
  - models/edges/forward.rb
88
- - models/edges/groups/analysis.rb
89
130
  - models/edges/groups/channel_forwards.rb
131
+ - models/edges/groups/channel_forwards/analysis.rb
90
132
  - models/edges/payment.rb
133
+ - models/errors.rb
134
+ - models/invoice.rb
91
135
  - models/nodes/node.rb
92
136
  - models/nodes/node/lightning.rb
93
137
  - models/nodes/node/platform.rb
138
+ - models/payment_request.rb
94
139
  - models/rate.rb
95
140
  - models/satoshis.rb
96
141
  - ports/dsl/lighstorm.rb
142
+ - ports/dsl/lighstorm/errors.rb
143
+ - ports/grpc.rb
97
144
  - static/cache.rb
98
145
  - static/spec.rb
99
- homepage: https://github.com/icebaker/lighstorm
146
+ homepage: https://icebaker.github.io/lighstorm
100
147
  licenses:
101
148
  - MIT
102
149
  metadata:
103
150
  allowed_push_host: https://rubygems.org
104
- homepage_uri: https://github.com/icebaker/lighstorm
151
+ homepage_uri: https://icebaker.github.io/lighstorm
105
152
  source_code_uri: https://github.com/icebaker/lighstorm
153
+ documentation_uri: https://icebaker.github.io/lighstorm
154
+ bug_tracker_uri: https://github.com/icebaker/lighstorm/issues
106
155
  rubygems_mfa_required: 'true'
107
156
  post_install_message:
108
157
  rdoc_options: []
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Lighstorm
4
- module Models
5
- class Constraints
6
- def initialize(channel, node)
7
- @channel = channel
8
- @node = node
9
- end
10
-
11
- def data
12
- @data ||= if @node.myself?
13
- @channel.data[:list_channels][:channels].first.local_constraints
14
- else
15
- @channel.data[:list_channels][:channels].first.remote_constraints
16
- end
17
- end
18
-
19
- def to_h
20
- data.to_h
21
- end
22
- end
23
- end
24
- end