lighstorm 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +2 -2
  4. data/adapters/connections/channel_node.rb +1 -0
  5. data/adapters/edges/payment/purpose.rb +3 -3
  6. data/adapters/edges/payment.rb +1 -3
  7. data/adapters/invoice.rb +0 -2
  8. data/adapters/wallet.rb +42 -0
  9. data/components/cache.rb +1 -1
  10. data/components/lnd.rb +24 -8
  11. data/controllers/action.rb +5 -0
  12. data/controllers/activity/all.rb +85 -20
  13. data/controllers/activity.rb +15 -6
  14. data/controllers/channel/actions/apply_gossip.rb +3 -4
  15. data/controllers/channel/actions/update_fee.rb +11 -7
  16. data/controllers/channel/all.rb +11 -7
  17. data/controllers/channel/find_by_id.rb +11 -11
  18. data/controllers/channel/mine.rb +10 -10
  19. data/controllers/channel.rb +25 -11
  20. data/controllers/concerns/impersonatable.rb +33 -0
  21. data/controllers/connection.rb +33 -0
  22. data/controllers/forward/all.rb +16 -12
  23. data/controllers/forward/group_by_channel.rb +2 -2
  24. data/controllers/forward.rb +19 -13
  25. data/controllers/invoice/actions/create.rb +21 -13
  26. data/controllers/invoice/actions/pay.rb +13 -12
  27. data/controllers/invoice/actions/pay_through_route.rb +2 -2
  28. data/controllers/invoice/all.rb +7 -7
  29. data/controllers/invoice/decode.rb +6 -6
  30. data/controllers/invoice/find_by_code.rb +7 -7
  31. data/controllers/invoice/find_by_secret_hash.rb +10 -6
  32. data/controllers/invoice.rb +46 -39
  33. data/controllers/node/actions/apply_gossip.rb +1 -1
  34. data/controllers/node/actions/pay.rb +13 -12
  35. data/controllers/node/all.rb +11 -7
  36. data/controllers/node/find_by_public_key.rb +11 -7
  37. data/controllers/node/myself.rb +6 -6
  38. data/controllers/node.rb +17 -11
  39. data/controllers/payment/actions/pay.rb +23 -19
  40. data/controllers/payment/all.rb +7 -4
  41. data/controllers/payment.rb +20 -14
  42. data/controllers/secret/valid_proof.rb +5 -5
  43. data/controllers/transaction/all.rb +6 -5
  44. data/controllers/transaction.rb +14 -6
  45. data/controllers/wallet/balance.rb +34 -0
  46. data/controllers/wallet.rb +19 -0
  47. data/docs/README.md +70 -7
  48. data/docs/_coverpage.md +1 -1
  49. data/docs/index.html +1 -1
  50. data/lighstorm.gemspec +1 -1
  51. data/models/activity.rb +3 -2
  52. data/models/connections/channel_node/fee.rb +5 -2
  53. data/models/connections/channel_node/policy.rb +3 -2
  54. data/models/connections/channel_node.rb +14 -4
  55. data/models/connections/forward_channel.rb +3 -2
  56. data/models/edges/channel/hop.rb +1 -1
  57. data/models/edges/channel.rb +5 -7
  58. data/models/edges/forward.rb +4 -3
  59. data/models/edges/groups/channel_forwards.rb +3 -2
  60. data/models/edges/payment.rb +4 -3
  61. data/models/errors.rb +16 -24
  62. data/models/invoice.rb +10 -4
  63. data/models/nodes/node.rb +10 -4
  64. data/models/secret.rb +10 -4
  65. data/models/wallet.rb +40 -0
  66. data/ports/dsl/lighstorm.rb +6 -2
  67. data/ports/grpc.rb +30 -2
  68. data/static/cache.rb +2 -0
  69. data/static/spec.rb +1 -1
  70. metadata +10 -5
  71. data/deleted.sh +0 -1
@@ -26,7 +26,7 @@ module Lighstorm
26
26
  ].freeze
27
27
 
28
28
  def self.perform(actual, gossip)
29
- updated = Models::Node.new(Adapter::Node.subscribe_channel_graph(gossip))
29
+ updated = Models::Node.new(Adapter::Node.subscribe_channel_graph(gossip), nil)
30
30
 
31
31
  actual_dump = actual.dump
32
32
  updated_dump = updated.dump
@@ -18,20 +18,20 @@ module Lighstorm
18
18
  module Controllers
19
19
  module Node
20
20
  module Pay
21
- def self.dispatch(grpc_request, &vcr)
22
- Payment::Pay.dispatch(grpc_request, &vcr)
21
+ def self.dispatch(components, grpc_request, &vcr)
22
+ Payment::Pay.dispatch(components, grpc_request, &vcr)
23
23
  end
24
24
 
25
- def self.fetch(&vcr)
26
- Payment::Pay.fetch(&vcr)
25
+ def self.fetch(components, &vcr)
26
+ Payment::Pay.fetch(components, &vcr)
27
27
  end
28
28
 
29
29
  def self.adapt(data, node_get_info)
30
30
  Payment::Pay.adapt(data, node_get_info)
31
31
  end
32
32
 
33
- def self.model(data)
34
- Payment::Pay.model(data)
33
+ def self.model(data, components)
34
+ Payment::Pay.model(data, components)
35
35
  end
36
36
 
37
37
  def self.prepare(public_key:, amount:, times_out_in:, secret:, through:, fee: nil, message: nil)
@@ -75,6 +75,7 @@ module Lighstorm
75
75
  end
76
76
 
77
77
  def self.perform(
78
+ components,
78
79
  public_key:, amount:, through:,
79
80
  times_out_in:, fee: nil,
80
81
  message: nil, secret: nil,
@@ -94,19 +95,19 @@ module Lighstorm
94
95
 
95
96
  return grpc_request if preview
96
97
 
97
- response = dispatch(grpc_request, &vcr)
98
+ response = dispatch(components, grpc_request, &vcr)
98
99
 
99
- Payment::Pay.raise_error_if_exists!(response)
100
+ Payment::Pay.raise_error_if_exists!(grpc_request, response)
100
101
 
101
- data = fetch(&vcr)
102
+ data = fetch(components, &vcr)
102
103
 
103
104
  adapted = adapt(response, data)
104
105
 
105
- model = self.model(adapted)
106
+ model = self.model(adapted, components)
106
107
 
107
- Payment::Pay.raise_failure_if_exists!(model, response)
108
+ Payment::Pay.raise_failure_if_exists!(model, grpc_request, response)
108
109
 
109
- Action::Output.new({ response: response[:response], result: model })
110
+ Action::Output.new({ request: grpc_request, response: response[:response], result: model })
110
111
  end
111
112
  end
112
113
  end
@@ -7,11 +7,11 @@ module Lighstorm
7
7
  module Controllers
8
8
  module Node
9
9
  module All
10
- def self.fetch(limit: nil)
10
+ def self.fetch(components, limit: nil)
11
11
  data = {
12
12
  at: Time.now,
13
- get_info: Ports::GRPC.lightning.get_info.to_h,
14
- describe_graph: Ports::GRPC.lightning.describe_graph.nodes
13
+ get_info: components[:grpc].lightning.get_info.to_h,
14
+ describe_graph: components[:grpc].lightning.describe_graph.nodes
15
15
  }
16
16
 
17
17
  data[:describe_graph] = data[:describe_graph][0..limit - 1] unless limit.nil?
@@ -42,8 +42,12 @@ module Lighstorm
42
42
  end
43
43
  end
44
44
 
45
- def self.data(limit: nil, &vcr)
46
- raw = vcr.nil? ? fetch(limit: limit) : vcr.call(-> { fetch(limit: limit) })
45
+ def self.data(components, limit: nil, &vcr)
46
+ raw = if vcr.nil?
47
+ fetch(components, limit: limit)
48
+ else
49
+ vcr.call(-> { fetch(components, limit: limit) })
50
+ end
47
51
 
48
52
  adapted = adapt(raw)
49
53
 
@@ -52,9 +56,9 @@ module Lighstorm
52
56
  end
53
57
  end
54
58
 
55
- def self.model(data)
59
+ def self.model(data, components)
56
60
  data.map do |node_data|
57
- Lighstorm::Models::Node.new(node_data)
61
+ Lighstorm::Models::Node.new(node_data, components)
58
62
  end
59
63
  end
60
64
  end
@@ -7,11 +7,11 @@ module Lighstorm
7
7
  module Controllers
8
8
  module Node
9
9
  module FindByPublicKey
10
- def self.fetch(public_key)
10
+ def self.fetch(components, public_key)
11
11
  {
12
12
  at: Time.now,
13
- get_info: Ports::GRPC.lightning.get_info.to_h,
14
- get_node_info: Ports::GRPC.lightning.get_node_info(pub_key: public_key).to_h
13
+ get_info: components[:grpc].lightning.get_info.to_h,
14
+ get_node_info: components[:grpc].lightning.get_node_info(pub_key: public_key).to_h
15
15
  }
16
16
  end
17
17
 
@@ -22,8 +22,12 @@ module Lighstorm
22
22
  }
23
23
  end
24
24
 
25
- def self.data(public_key, &vcr)
26
- raw = vcr.nil? ? fetch(public_key) : vcr.call(-> { fetch(public_key) })
25
+ def self.data(components, public_key, &vcr)
26
+ raw = if vcr.nil?
27
+ fetch(components, public_key)
28
+ else
29
+ vcr.call(-> { fetch(components, public_key) })
30
+ end
27
31
 
28
32
  adapted = adapt(raw)
29
33
 
@@ -40,8 +44,8 @@ module Lighstorm
40
44
  end
41
45
  end
42
46
 
43
- def self.model(data)
44
- Lighstorm::Models::Node.new(data)
47
+ def self.model(data, components)
48
+ Lighstorm::Models::Node.new(data, components)
45
49
  end
46
50
  end
47
51
  end
@@ -7,10 +7,10 @@ module Lighstorm
7
7
  module Controllers
8
8
  module Node
9
9
  module Myself
10
- def self.fetch
10
+ def self.fetch(components)
11
11
  {
12
12
  at: Time.now,
13
- get_info: Ports::GRPC.lightning.get_info.to_h
13
+ get_info: components[:grpc].lightning.get_info.to_h
14
14
  }
15
15
  end
16
16
 
@@ -18,15 +18,15 @@ module Lighstorm
18
18
  { get_info: Lighstorm::Adapter::Node.get_info(raw[:get_info]) }
19
19
  end
20
20
 
21
- def self.data(&vcr)
22
- raw = vcr.nil? ? fetch : vcr.call(-> { fetch })
21
+ def self.data(components, &vcr)
22
+ raw = vcr.nil? ? fetch(components) : vcr.call(-> { fetch(components) })
23
23
 
24
24
  adapted = adapt(raw)
25
25
  adapted[:get_info].merge(myself: true)
26
26
  end
27
27
 
28
- def self.model(data)
29
- Lighstorm::Models::Node.new(data)
28
+ def self.model(data, components)
29
+ Lighstorm::Models::Node.new(data, components)
30
30
  end
31
31
  end
32
32
  end
data/controllers/node.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative './concerns/impersonatable'
4
+
3
5
  require_relative './node/myself'
4
6
  require_relative './node/all'
5
7
  require_relative './node/find_by_public_key'
@@ -7,20 +9,24 @@ require_relative './node/find_by_public_key'
7
9
  module Lighstorm
8
10
  module Controllers
9
11
  module Node
10
- def self.myself
11
- Myself.model(Myself.data)
12
- end
12
+ extend Impersonatable
13
13
 
14
- def self.all(limit: nil)
15
- All.model(All.data(limit: limit))
16
- end
14
+ class DSL < Impersonatable::DSL
15
+ def myself
16
+ Myself.model(Myself.data(components), components)
17
+ end
17
18
 
18
- def self.find_by_public_key(public_key)
19
- FindByPublicKey.model(FindByPublicKey.data(public_key))
20
- end
19
+ def all(limit: nil)
20
+ All.model(All.data(components, limit: limit), components)
21
+ end
22
+
23
+ def find_by_public_key(public_key)
24
+ FindByPublicKey.model(FindByPublicKey.data(components, public_key), components)
25
+ end
21
26
 
22
- def self.adapt(dump: nil, gossip: nil)
23
- Models::Node.adapt(dump: dump, gossip: gossip)
27
+ def adapt(dump: nil, gossip: nil)
28
+ Models::Node.adapt(dump: dump, gossip: gossip)
29
+ end
24
30
  end
25
31
  end
26
32
  end
@@ -14,9 +14,9 @@ module Lighstorm
14
14
  module Controllers
15
15
  module Payment
16
16
  module Pay
17
- def self.call(grpc_request)
17
+ def self.call(components, grpc_request)
18
18
  result = []
19
- Lighstorm::Ports::GRPC.send(grpc_request[:service]).send(
19
+ components[:grpc].send(grpc_request[:service]).send(
20
20
  grpc_request[:method], grpc_request[:params]
21
21
  ) do |response|
22
22
  result << response.to_h
@@ -26,19 +26,23 @@ module Lighstorm
26
26
  { exception: e }
27
27
  end
28
28
 
29
- def self.dispatch(grpc_request, &vcr)
30
- vcr.nil? ? call(grpc_request) : vcr.call(-> { call(grpc_request) }, :dispatch)
29
+ def self.dispatch(components, grpc_request, &vcr)
30
+ if vcr.nil?
31
+ call(components, grpc_request)
32
+ else
33
+ vcr.call(-> { call(components, grpc_request) }, :dispatch)
34
+ end
31
35
  end
32
36
 
33
- def self.fetch_all(code)
37
+ def self.fetch_all(components, code)
34
38
  {
35
- invoice_decode: code.nil? ? nil : Invoice::Decode.data(code),
36
- node_myself: Node::Myself.data
39
+ invoice_decode: code.nil? ? nil : Invoice::Decode.data(components, code),
40
+ node_myself: Node::Myself.data(components)
37
41
  }
38
42
  end
39
43
 
40
- def self.fetch(code = nil, &vcr)
41
- raw = vcr.nil? ? fetch_all(code) : vcr.call(-> { fetch_all(code) })
44
+ def self.fetch(components, code = nil, &vcr)
45
+ raw = vcr.nil? ? fetch_all(components, code) : vcr.call(-> { fetch_all(components, code) })
42
46
  end
43
47
 
44
48
  def self.adapt(grpc_data, fetch_data)
@@ -49,52 +53,52 @@ module Lighstorm
49
53
  )
50
54
  end
51
55
 
52
- def self.model(data)
53
- Models::Payment.new(data)
56
+ def self.model(data, components)
57
+ Models::Payment.new(data, components)
54
58
  end
55
59
 
56
- def self.raise_error_if_exists!(response)
60
+ def self.raise_error_if_exists!(request, response)
57
61
  return if response[:exception].nil?
58
62
 
59
63
  if response[:exception].is_a?(GRPC::AlreadyExists)
60
64
  raise AlreadyPaidError.new(
61
65
  'The invoice is already paid.',
62
- grpc: response[:exception]
66
+ request: request, grpc: response[:exception]
63
67
  )
64
68
  end
65
69
 
66
70
  if response[:exception].message =~ /amount must not be specified when paying a non-zero/
67
71
  raise AmountForNonZeroError.new(
68
72
  'Millisatoshis must not be specified when paying a non-zero amount invoice.',
69
- grpc: response[:exception]
73
+ request: request, grpc: response[:exception]
70
74
  )
71
75
  end
72
76
 
73
77
  if response[:exception].message =~ /amount must be specified when paying a zero amount/
74
78
  raise MissingMillisatoshisError.new(
75
79
  'Millisatoshis must be specified when paying a zero amount invoice.',
76
- grpc: response[:exception]
80
+ request: request, grpc: response[:exception]
77
81
  )
78
82
  end
79
83
 
80
84
  raise PaymentError.new(
81
85
  response[:exception].message,
82
- grpc: response[:exception]
86
+ request: request, grpc: response[:exception]
83
87
  )
84
88
  end
85
89
 
86
- def self.raise_failure_if_exists!(model, response)
90
+ def self.raise_failure_if_exists!(model, request, response)
87
91
  return unless model.state == 'failed'
88
92
 
89
93
  if response[:response].last[:failure_reason] == :FAILURE_REASON_NO_ROUTE
90
94
  raise NoRouteFoundError.new(
91
95
  response[:response].last[:failure_reason],
92
- response: response[:response], result: model
96
+ request: request, response: response[:response], result: model
93
97
  )
94
98
  else
95
99
  raise PaymentError.new(
96
100
  response[:response].last[:failure_reason],
97
- response: response[:response], result: model
101
+ request: request, response: response[:response], result: model
98
102
  )
99
103
  end
100
104
  end
@@ -12,10 +12,10 @@ module Lighstorm
12
12
  module Controllers
13
13
  module Payment
14
14
  module All
15
- def self.fetch(purpose: nil, invoice_code: nil, secret_hash: nil, limit: nil, fetch: {})
15
+ def self.fetch(components, purpose: nil, invoice_code: nil, secret_hash: nil, limit: nil, fetch: {})
16
16
  at = Time.now
17
17
 
18
- grpc = Ports::GRPC.session
18
+ grpc = components[:grpc].session
19
19
 
20
20
  get_info = grpc.lightning.get_info.to_h
21
21
 
@@ -396,17 +396,20 @@ module Lighstorm
396
396
  end
397
397
 
398
398
  def self.data(
399
+ components,
399
400
  purpose: nil, invoice_code: nil, secret_hash: nil, limit: nil,
400
401
  fetch: {}, &vcr
401
402
  )
402
403
  raw = if vcr.nil?
403
404
  self.fetch(
405
+ components,
404
406
  purpose: purpose, invoice_code: invoice_code, secret_hash: secret_hash,
405
407
  limit: limit, fetch: fetch
406
408
  )
407
409
  else
408
410
  vcr.call(lambda {
409
411
  self.fetch(
412
+ components,
410
413
  purpose: purpose, invoice_code: invoice_code, secret_hash: secret_hash,
411
414
  limit: limit, fetch: fetch
412
415
  )
@@ -423,9 +426,9 @@ module Lighstorm
423
426
  }
424
427
  end
425
428
 
426
- def self.model(data)
429
+ def self.model(data, components)
427
430
  data[:data].map do |node_data|
428
- Lighstorm::Models::Payment.new(node_data)
431
+ Lighstorm::Models::Payment.new(node_data, components)
429
432
  end
430
433
  end
431
434
  end
@@ -1,28 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative './concerns/impersonatable'
4
+
3
5
  require_relative './payment/all'
4
6
 
5
7
  module Lighstorm
6
8
  module Controllers
7
9
  module Payment
8
- def self.all(purpose: nil, limit: nil, fetch: {})
9
- All.model(All.data(purpose: purpose, limit: limit, fetch: fetch))
10
- end
10
+ extend Impersonatable
11
11
 
12
- def self.first(purpose: nil, fetch: {})
13
- All.model(All.data(purpose: purpose, fetch: fetch)).first
14
- end
12
+ class DSL < Impersonatable::DSL
13
+ def all(purpose: nil, limit: nil, fetch: {})
14
+ All.model(All.data(components, purpose: purpose, limit: limit, fetch: fetch), components)
15
+ end
15
16
 
16
- def self.last(purpose: nil, fetch: {})
17
- All.model(All.data(purpose: purpose, fetch: fetch)).last
18
- end
17
+ def first(purpose: nil, fetch: {})
18
+ All.model(All.data(components, purpose: purpose, fetch: fetch), components).first
19
+ end
19
20
 
20
- def self.find_by_secret_hash(secret_hash, &vcr)
21
- All.model(All.data(secret_hash: secret_hash, &vcr)).first
22
- end
21
+ def last(purpose: nil, fetch: {})
22
+ All.model(All.data(components, purpose: purpose, fetch: fetch), components).last
23
+ end
24
+
25
+ def find_by_secret_hash(secret_hash, &vcr)
26
+ All.model(All.data(components, secret_hash: secret_hash, &vcr), components).first
27
+ end
23
28
 
24
- def self.find_by_invoice_code(invoice_code, &vcr)
25
- All.model(All.data(invoice_code: invoice_code, &vcr)).first
29
+ def find_by_invoice_code(invoice_code, &vcr)
30
+ All.model(All.data(components, invoice_code: invoice_code, &vcr), components).first
31
+ end
26
32
  end
27
33
  end
28
34
  end
@@ -8,10 +8,10 @@ module Lighstorm
8
8
  module Controllers
9
9
  module Secret
10
10
  module ValidProof
11
- def self.fetch(invoice_main_secret_hash)
11
+ def self.fetch(components, invoice_main_secret_hash)
12
12
  { response: {
13
13
  at: Time.now,
14
- lookup_invoice: Ports::GRPC.lightning.lookup_invoice(r_hash_str: invoice_main_secret_hash).to_h
14
+ lookup_invoice: components[:grpc].lightning.lookup_invoice(r_hash_str: invoice_main_secret_hash).to_h
15
15
  }, exception: nil }
16
16
  rescue StandardError => e
17
17
  { exception: e }
@@ -39,13 +39,13 @@ module Lighstorm
39
39
  end.nil?
40
40
  end
41
41
 
42
- def self.data(invoice_main_secret_hash, proof, &vcr)
42
+ def self.data(components, invoice_main_secret_hash, proof, &vcr)
43
43
  raise 'Invalid proof' if proof.size != 64
44
44
 
45
45
  raw = if vcr.nil?
46
- fetch(invoice_main_secret_hash)
46
+ fetch(components, invoice_main_secret_hash)
47
47
  else
48
- vcr.call(-> { fetch(invoice_main_secret_hash) })
48
+ vcr.call(-> { fetch(components, invoice_main_secret_hash) })
49
49
  end
50
50
 
51
51
  adapted = adapt(raw[:response])
@@ -8,12 +8,12 @@ module Lighstorm
8
8
  module Controllers
9
9
  module Transaction
10
10
  module All
11
- def self.fetch(limit: nil)
11
+ def self.fetch(components, limit: nil)
12
12
  at = Time.now
13
13
 
14
14
  transactions = []
15
15
 
16
- response = Ports::GRPC.lightning.get_transactions
16
+ response = components[:grpc].lightning.get_transactions
17
17
 
18
18
  response.transactions.each do |transaction|
19
19
  transactions << transaction.to_h
@@ -38,12 +38,13 @@ module Lighstorm
38
38
  adapted[:get_transactions]
39
39
  end
40
40
 
41
- def self.data(limit: nil, &vcr)
41
+ def self.data(components, limit: nil, &vcr)
42
42
  raw = if vcr.nil?
43
- fetch(limit: limit)
43
+ fetch(components, limit: limit)
44
44
  else
45
- vcr.call(-> { fetch(limit: limit) })
45
+ vcr.call(-> { fetch(components, limit: limit) })
46
46
  end
47
+
47
48
  adapted = adapt(raw)
48
49
 
49
50
  transform(adapted)
@@ -1,16 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative './concerns/impersonatable'
4
+
3
5
  require_relative './transaction/all'
4
6
 
5
7
  module Lighstorm
6
8
  module Controllers
7
9
  module Transaction
8
- def self.all(direction: nil, how: nil, limit: nil)
9
- All.model(All.data(
10
- direction: direction,
11
- how: how,
12
- limit: limit
13
- ))
10
+ extend Impersonatable
11
+
12
+ class DSL < Impersonatable::DSL
13
+ def all(direction: nil, how: nil, layer: nil, limit: nil)
14
+ All.model(All.data(
15
+ components,
16
+ direction: direction,
17
+ how: how,
18
+ layer: layer,
19
+ limit: limit
20
+ ))
21
+ end
14
22
  end
15
23
  end
16
24
  end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../adapters/wallet'
4
+ require_relative '../../models/wallet'
5
+
6
+ module Lighstorm
7
+ module Controllers
8
+ module Wallet
9
+ module Balance
10
+ def self.fetch(components)
11
+ {
12
+ at: Time.now,
13
+ wallet_balance: components[:grpc].lightning.wallet_balance.to_h,
14
+ channel_balance: components[:grpc].lightning.channel_balance.to_h
15
+ }
16
+ end
17
+
18
+ def self.adapt(raw)
19
+ Adapter::Wallet.balance(raw)
20
+ end
21
+
22
+ def self.data(components, &vcr)
23
+ raw = vcr.nil? ? fetch(components) : vcr.call(-> { fetch(components) })
24
+
25
+ adapt(raw)
26
+ end
27
+
28
+ def self.model(data)
29
+ Models::Wallet.new(data)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './concerns/impersonatable'
4
+
5
+ require_relative './wallet/balance'
6
+
7
+ module Lighstorm
8
+ module Controllers
9
+ module Wallet
10
+ extend Impersonatable
11
+
12
+ class DSL < Impersonatable::DSL
13
+ def balance
14
+ Balance.model(Balance.data(components))
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end