stellar_base-rails 3.1.0 → 4.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/app/concepts/stellar_base/deposit_requests/contracts/create.rb +1 -0
  4. data/app/concepts/stellar_base/deposit_requests/operations/create.rb +22 -22
  5. data/app/concepts/stellar_base/fee_requests/operations/show.rb +2 -2
  6. data/app/concepts/stellar_base/withdrawal_requests/contracts/create.rb +3 -2
  7. data/app/concepts/stellar_base/withdrawal_requests/operations/create.rb +19 -30
  8. data/app/controllers/stellar_base/withdraw_controller.rb +0 -1
  9. data/app/representers/stellar_base/deposit_request_representer.rb +7 -1
  10. data/app/representers/stellar_base/withdrawal_request_representer.rb +0 -1
  11. data/app/services/stellar_base/bridge_callbacks/process.rb +1 -2
  12. data/app/services/stellar_base/configured_class_runner.rb +4 -1
  13. data/app/services/stellar_base/deposit_requests/determine_eta.rb +22 -0
  14. data/app/services/stellar_base/deposit_requests/determine_how.rb +4 -3
  15. data/app/services/stellar_base/determine_extra_info.rb +14 -0
  16. data/app/services/stellar_base/fee_requests/call_withdraw_fee_fixed_quote_from.rb +42 -0
  17. data/app/services/stellar_base/get_callback_from.rb +13 -0
  18. data/app/services/stellar_base/withdrawal_requests/call_fee_fixed_from.rb +29 -0
  19. data/app/services/stellar_base/withdrawal_requests/call_on_withdraw.rb +1 -3
  20. data/app/services/stellar_base/withdrawal_requests/determine_max_amount.rb +2 -2
  21. data/app/twins/stellar_base/withdrawal_request_twin.rb +0 -1
  22. data/db/migrate/20190808014913_remove_fee_network.rb +8 -0
  23. data/lib/stellar_base/version.rb +1 -1
  24. metadata +23 -12
  25. data/app/services/stellar_base/fee_requests/call_fee_from.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74b62f61385eba2ad71a788469192da7d9056875055582a17c38e982688f0bfc
4
- data.tar.gz: 37012d044e08a99b22116cfc54b243a27440721ed4a26eee198c022d10d327c8
3
+ metadata.gz: 1bdb1de1dfc55634223730e54bb842bfafd076cc22eac56dbc11357eaeabbb6d
4
+ data.tar.gz: 0275c78f1e5ab0d14a0a20145c4cd9b0b26895b53d37d6ef9e3bfdc73b9a4f1a
5
5
  SHA512:
6
- metadata.gz: 2868b757d5cea6de7ca3a25e9d4f3131f029954f07a2f995b674c858fb6602b00c041a1877176d1c9f106a8d2e543ef2cbd608129e116caa9b9fd01f3f2703ee
7
- data.tar.gz: 54ef4814eb47f06e8d7148b4f6eaf1d68b0ba89d64b38d56b2af169b957e7962a2009cfffaf203c6ad918e6088eb1cd78507b043c4bdf12e5149f60033fbe26e
6
+ metadata.gz: 5900cbcd9b5c4069feb88c0cc829a8bfddef0b0f71addf8491b6c2b2fe18edbf238ed5cf40e883d915e813440b59f0951d06daa41dc9430a42fc3321a8258e0c
7
+ data.tar.gz: 55c79dadfa9626290bf42a081d6d95537295e147b82176cabca5df41c630fcc2950653df886b60a0335272de9d4d014e04c5862eefd234a09a33fbbe63806dfb
data/README.md CHANGED
@@ -102,6 +102,8 @@ gem 'stellar_base-rails'
102
102
  And then execute:
103
103
  ```bash
104
104
  $ bundle
105
+ $ rails stellar_base:install:migrations
106
+ $ rails db:migrate
105
107
  ```
106
108
 
107
109
  If you're using `StellarBase.on_deposit_trigger` you'll need to install:
@@ -9,6 +9,7 @@ module StellarBase
9
9
  property :memo
10
10
  property :email_address
11
11
  property :deposit_type
12
+ property :extra_info
12
13
 
13
14
  validates(
14
15
  :asset_code,
@@ -3,15 +3,14 @@ module StellarBase
3
3
  module Operations
4
4
  class Create < ApplicationOperation
5
5
 
6
- DEFAULT_ETA = (10 * 60).freeze
7
-
8
6
  step self::Policy::Pundit(DepositRequestPolicy, :create?)
9
7
  step Model(DepositRequest, :new)
8
+ step :find_depositable_asset_details!
10
9
  step :setup_params!
10
+ step :set_extra_info!
11
11
  step Contract::Build(constant: Contracts::Create)
12
12
  step Contract::Validate(key: :deposit_request)
13
13
  step Contract::Persist(method: :sync)
14
- step :find_depositable_asset_details!
15
14
  step :determine_how!
16
15
  step :determine_max_amount!
17
16
  success :set_defaults!
@@ -30,34 +29,35 @@ module StellarBase
30
29
 
31
30
  def find_depositable_asset_details!(options, params:, **)
32
31
  details = FindDepositableAsset.(params[:deposit_request][:asset_code])
33
- params[:deposit_asset_details] = details.presence || {}
32
+ options[:asset_details] = details.presence || {}
34
33
  end
35
34
 
36
- def determine_how!(options, params:, **)
37
- details = params[:deposit_asset_details]
38
- options["model"].deposit_address =
39
- DetermineHow.(details[:how_from], params[:deposit_request])
35
+ def determine_how!(options, params:, asset_details:, model:, **)
36
+ model.deposit_address =
37
+ DetermineHow.(asset_details[:how_from], params[:deposit_request])
40
38
  end
41
39
 
42
- def determine_max_amount!(options, params:, **)
43
- details = params[:deposit_asset_details]
44
- options["model"].max_amount =
45
- ConfiguredClassRunner.(details[:max_amount_from]) || 0
40
+ def set_extra_info!(ctx, params:, asset_details:, **)
41
+ params[:deposit_request][:extra_info] =
42
+ DetermineExtraInfo.(asset_details).to_json
46
43
  end
47
44
 
48
- def set_defaults!(options, params:, **)
49
- details = params[:deposit_asset_details]
45
+ def determine_max_amount!(options, params:, asset_details:, model:, **)
46
+ model.max_amount =
47
+ ConfiguredClassRunner.(asset_details[:max_amount_from]) || 0
48
+ end
50
49
 
51
- options["model"].asset_type = details[:type]
52
- options["model"].issuer = details[:issuer]
53
- options["model"].eta = DEFAULT_ETA
54
- options["model"].min_amount = 0.0
50
+ def set_defaults!(options, params:, model:, asset_details:, **)
51
+ model.asset_type = asset_details[:type]
52
+ model.issuer = asset_details[:issuer]
53
+ model.eta =
54
+ DetermineEta.(asset_details[:eta_from], params[:deposit_request])
55
+ model.min_amount = 0.0
55
56
 
56
57
  # Make Deposits free unless we want it configured
57
- #
58
- # TODO: this should come from `CallFeeFrom.(details[:fee_from)`
59
- options["model"].fee_fixed = details[:fee_fixed] || 0.0
60
- options["model"].fee_percent = details[:fee_percent] || 0.0
58
+ # TODO: this should come from `CallDepositFeeFrom.(params, asset_details)`
59
+ model.fee_fixed = asset_details[:fee_fixed] || 0.0
60
+ model.fee_percent = asset_details[:fee_percent] || 0.0
61
61
  end
62
62
 
63
63
  def memo_type_from(params)
@@ -29,9 +29,9 @@ module StellarBase
29
29
  end
30
30
 
31
31
  def set_fee_response!(options, model:, asset_details:, params:, **)
32
- model.fee_response = FeeRequests::CallFeeFrom.(
32
+ model.fee_response = FeeRequests::CallWithdrawFeeFixedQuoteFrom.(
33
33
  fee_request: model,
34
- fee_from: asset_details[:fee_from],
34
+ fee_fixed_quote_from: asset_details[:fee_fixed_quote_from],
35
35
  )
36
36
  end
37
37
 
@@ -7,16 +7,17 @@ module StellarBase
7
7
  property :asset_code
8
8
  property :dest
9
9
  property :dest_extra
10
- property :fee_network
10
+ property :fee_fixed
11
11
 
12
12
  validates(
13
13
  :asset_type,
14
14
  :asset_code,
15
15
  :dest,
16
- :fee_network,
16
+ :fee_fixed,
17
17
  presence: true,
18
18
  )
19
19
  validate :check_valid_asset_code
20
+ validates(:fee_fixed, numericality: {greater_than_or_equal_to: 0})
20
21
 
21
22
  def check_valid_asset_code
22
23
  asset_codes = StellarBase.configuration.withdrawable_assets
@@ -10,10 +10,11 @@ module StellarBase
10
10
  failure :set_policy_error!
11
11
  step Model(WithdrawalRequest, :new)
12
12
  step :setup_params!
13
+ step :find_withdrawal_asset_details!
14
+ step :set_fee_fixed!
13
15
  step Contract::Build(constant: Contracts::Create)
14
16
  step Contract::Validate(key: :withdrawal_request)
15
17
  step Contract::Persist(method: :sync)
16
- step :find_withdrawal_asset_details!
17
18
  success :set_defaults!
18
19
  step Contract::Persist(method: :save)
19
20
 
@@ -29,38 +30,26 @@ module StellarBase
29
30
  })
30
31
  end
31
32
 
32
- def find_withdrawal_asset_details!(options, params:, **)
33
- details = FindWithdrawableAsset
34
- .(params[:withdrawal_request][:asset_code])
35
- params[:withdrawal_asset_details] = details.presence || {}
33
+ def find_withdrawal_asset_details!(ctx, params:, **)
34
+ asset_code = params[:withdrawal_request][:asset_code]
35
+ details = FindWithdrawableAsset.(asset_code)
36
+ ctx["asset_details"] = details.presence || {}
36
37
  end
37
38
 
38
- def set_defaults!(options, params:, **)
39
- withdrawal_asset_details = params[:withdrawal_asset_details]
40
-
41
- fee_network = DetermineFee.network(
42
- withdrawal_asset_details[:network],
43
- params[:withdrawal_request][:fee_network],
44
- )
45
-
46
- options["model"].issuer = withdrawal_asset_details[:issuer]
47
- options["model"].account_id =
48
- StellarBase.configuration.distribution_account
49
- options["model"].memo_type = "text"
50
- options["model"].memo = GenMemoFor.(WithdrawalRequest)
51
- options["model"].eta = DEFAULT_ETA
52
- options["model"].min_amount = 0.0
53
- options["model"].max_amount =
54
- DetermineMaxAmount.(withdrawal_asset_details[:max_amount_from])
55
-
56
- # TODO: This should come from `CallFeeFrom.(details[:fee_from])`
57
- # or dest_extra
58
- options["model"].fee_fixed =
59
- DetermineFee.(withdrawal_asset_details[:fee_fixed])
39
+ def set_fee_fixed!(ctx, params:, asset_details:, **)
40
+ params[:withdrawal_request][:fee_fixed] =
41
+ CallFeeFixedFrom.(params[:withdrawal_request], asset_details)
42
+ end
60
43
 
61
- options["model"].fee_percent =
62
- DetermineFee.(withdrawal_asset_details[:fee_percent])
63
- options["model"].fee_network = fee_network
44
+ def set_defaults!(options, params:, asset_details:, model:, **)
45
+ model.issuer = asset_details[:issuer]
46
+ model.account_id = StellarBase.configuration.distribution_account
47
+ model.memo_type = "text"
48
+ model.memo = GenMemoFor.(WithdrawalRequest)
49
+ model.eta = DEFAULT_ETA
50
+ model.min_amount = 0.0
51
+ model.max_amount = DetermineMaxAmount.(asset_details[:max_amount_from])
52
+ model.fee_percent = DetermineFee.(asset_details[:fee_percent])
64
53
  end
65
54
 
66
55
  end
@@ -25,7 +25,6 @@ module StellarBase
25
25
  :asset_code,
26
26
  :dest,
27
27
  :dest_extra,
28
- :fee_network,
29
28
  :type,
30
29
  ).to_hash.with_indifferent_access
31
30
  end
@@ -7,7 +7,13 @@ module StellarBase
7
7
  property :max_amount
8
8
  property :fee_fixed
9
9
  property :fee_percent
10
- property :extra_info
10
+ property :extra_info, exec_context: :decorator
11
+
12
+ def extra_info
13
+ ::JSON.parse(represented.extra_info)
14
+ rescue
15
+ {}
16
+ end
11
17
 
12
18
  end
13
19
  end
@@ -8,7 +8,6 @@ module StellarBase
8
8
  property :max_amount
9
9
  property :fee_fixed
10
10
  property :fee_percent
11
- property :fee_network
12
11
  property :extra_info
13
12
 
14
13
  end
@@ -9,8 +9,7 @@ module StellarBase
9
9
 
10
10
  def self.callback_class
11
11
  on_bridge_callback = StellarBase.configuration.on_bridge_callback
12
- return on_bridge_callback if on_bridge_callback.respond_to?(:call)
13
- on_bridge_callback.constantize
12
+ GetCallbackFrom.(on_bridge_callback)
14
13
  rescue NameError
15
14
  error_message = [
16
15
  "StellarBase.on_bridge_callback isn't configured or the",
@@ -5,7 +5,10 @@ module StellarBase
5
5
 
6
6
  def self.call(class_name)
7
7
  # TODO: how do we handle errors
8
- return class_name.constantize.send(:call) if class_name.present?
8
+ if class_name.present?
9
+ callback = GetCallbackFrom.(class_name)
10
+ return callback.send(:call)
11
+ end
9
12
  DEFAULT
10
13
  end
11
14
 
@@ -0,0 +1,22 @@
1
+ module StellarBase
2
+ module DepositRequests
3
+ class DetermineEta
4
+
5
+ DEFAULT = nil
6
+
7
+ def self.call(class_name, params)
8
+ # TODO: how do we handle errors
9
+ if class_name.present?
10
+ callback = GetCallbackFrom.(class_name)
11
+ unless callback.method(:call).arity.zero?
12
+ return callback.send(:call, params)
13
+ end
14
+
15
+ return callback.send(:call)
16
+ end
17
+ DEFAULT
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -7,11 +7,12 @@ module StellarBase
7
7
  def self.call(class_name, params)
8
8
  # TODO: how do we handle errors
9
9
  if class_name.present?
10
- unless class_name.constantize.method(:call).arity.zero?
11
- return class_name.constantize.send(:call, params)
10
+ callback = GetCallbackFrom.(class_name)
11
+ unless callback.method(:call).arity.zero?
12
+ return callback.send(:call, params)
12
13
  end
13
14
 
14
- return class_name.constantize.send(:call)
15
+ return callback.send(:call)
15
16
  end
16
17
  DEFAULT
17
18
  end
@@ -0,0 +1,14 @@
1
+ module StellarBase
2
+ class DetermineExtraInfo
3
+
4
+ def self.call(asset_details)
5
+ info_from =
6
+ GetCallbackFrom.(asset_details[:extra_info_from])
7
+
8
+ if info_from
9
+ return info_from.(asset_details)
10
+ end
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,42 @@
1
+ module StellarBase
2
+ module FeeRequests
3
+ class CallWithdrawFeeFixedQuoteFrom
4
+
5
+ FEE_FIXED_QUOTE_FROM_ERROR = "`fee_fixed_quote_from` must be a string of an object " \
6
+ "that responds to `.call` or the object itself".freeze
7
+
8
+ def self.call(fee_request:, fee_fixed_quote_from:)
9
+ asset_details = asset_details_from(fee_request)
10
+
11
+ if fee = asset_details[:fee_fixed]
12
+ return fee
13
+ end
14
+
15
+ return 0.0 if fee_fixed_quote_from.nil?
16
+
17
+ callback = callback_from(fee_fixed_quote_from)
18
+ callback.(fee_request)
19
+ end
20
+
21
+ def self.callback_from(fee_fixed_quote_from)
22
+ fee_fixed_quote_from = GetCallbackFrom.(fee_fixed_quote_from)
23
+
24
+ if !fee_fixed_quote_from.respond_to?(:call)
25
+ fail ArgumentError, FEE_FIXED_QUOTE_FROM_ERROR
26
+ end
27
+
28
+ fee_fixed_quote_from
29
+ end
30
+
31
+ private
32
+
33
+ def self.asset_details_from(fee_request)
34
+ FindAssetDetails.(
35
+ operation: "withdraw",
36
+ asset_code: fee_request.asset_code,
37
+ )
38
+ end
39
+
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,13 @@
1
+ module StellarBase
2
+ class GetCallbackFrom
3
+
4
+ def self.call(callback)
5
+ if callback.respond_to?(:constantize)
6
+ callback = callback.constantize
7
+ end
8
+
9
+ callback
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,29 @@
1
+ module StellarBase
2
+ module WithdrawalRequests
3
+ class CallFeeFixedFrom
4
+
5
+ CALLBACK_CONFIG_NAME = :fee_fixed_from
6
+ INVALID_FEE_MESSAGE =
7
+ "`fee_fixed_from` must return a value >= 0".freeze
8
+
9
+ def self.call(params, asset_details)
10
+ if fee_fixed = asset_details[:fee_fixed]
11
+ return fee_fixed
12
+ end
13
+
14
+ callback = GetCallbackFrom.(asset_details[CALLBACK_CONFIG_NAME])
15
+
16
+ return 0.0 if callback.nil?
17
+
18
+ fee_fixed = callback.(params, asset_details)
19
+
20
+ if fee_fixed.nil?
21
+ fail ArgumentError, INVALID_FEE_MESSAGE
22
+ end
23
+
24
+ fee_fixed
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -15,9 +15,7 @@ module StellarBase
15
15
  end
16
16
 
17
17
  def self.callback_from(on_withdraw)
18
- if on_withdraw.respond_to?(:constantize)
19
- on_withdraw = on_withdraw.constantize
20
- end
18
+ on_withdraw = GetCallbackFrom.(on_withdraw)
21
19
 
22
20
  if !on_withdraw.respond_to?(:call)
23
21
  fail ArgumentError, ON_WITHDRAW_ERROR
@@ -5,8 +5,8 @@ module StellarBase
5
5
  DEFAULT = nil
6
6
 
7
7
  def self.call(class_name)
8
- return class_name.constantize.send(:call) if class_name.present?
9
- DEFAULT
8
+ return DEFAULT if class_name.blank?
9
+ GetCallbackFrom.(class_name).()
10
10
  end
11
11
 
12
12
  end
@@ -8,7 +8,6 @@ module StellarBase
8
8
  property :max_amount
9
9
  property :fee_fixed
10
10
  property :fee_percent
11
- property :fee_network
12
11
  property :extra_info
13
12
 
14
13
  end
@@ -0,0 +1,8 @@
1
+ class RemoveFeeNetwork < ActiveRecord::Migration[5.2]
2
+ def change
3
+ remove_column(:stellar_base_withdrawal_requests, :fee_network, :decimal, {
4
+ default: "0.0",
5
+ null: false,
6
+ })
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module StellarBase
2
- VERSION = "3.1.0".freeze
2
+ VERSION = "4.2.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stellar_base-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 4.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Subido
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-07 00:00:00.000000000 Z
11
+ date: 2020-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: disposable
@@ -112,30 +112,30 @@ dependencies:
112
112
  name: sidekiq
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '5.1'
117
+ version: '5.0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '5.1'
124
+ version: '5.0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rails
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '5.1'
131
+ version: '6.0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '5.1'
138
+ version: '6.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: representable
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '2.0'
173
+ version: '3.0'
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '2.0'
180
+ version: '3.0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: toml-rb
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -199,6 +199,9 @@ dependencies:
199
199
  - - ">="
200
200
  - !ruby/object:Gem::Version
201
201
  version: '2.0'
202
+ - - "<"
203
+ - !ruby/object:Gem::Version
204
+ version: '2.1'
202
205
  type: :runtime
203
206
  prerelease: false
204
207
  version_requirements: !ruby/object:Gem::Requirement
@@ -206,6 +209,9 @@ dependencies:
206
209
  - - ">="
207
210
  - !ruby/object:Gem::Version
208
211
  version: '2.0'
212
+ - - "<"
213
+ - !ruby/object:Gem::Version
214
+ version: '2.1'
209
215
  - !ruby/object:Gem::Dependency
210
216
  name: trailblazer-rails
211
217
  requirement: !ruby/object:Gem::Requirement
@@ -484,6 +490,7 @@ files:
484
490
  - app/services/stellar_base/bridge_callbacks/verify_mac_payload.rb
485
491
  - app/services/stellar_base/configured_class_runner.rb
486
492
  - app/services/stellar_base/deposit_requests/create_deposit.rb
493
+ - app/services/stellar_base/deposit_requests/determine_eta.rb
487
494
  - app/services/stellar_base/deposit_requests/determine_how.rb
488
495
  - app/services/stellar_base/deposit_requests/find_config.rb
489
496
  - app/services/stellar_base/deposit_requests/find_deposit_request.rb
@@ -496,13 +503,16 @@ files:
496
503
  - app/services/stellar_base/deposit_requests/send_asset.rb
497
504
  - app/services/stellar_base/deposit_requests/trigger.rb
498
505
  - app/services/stellar_base/deposit_requests/update_deposit.rb
499
- - app/services/stellar_base/fee_requests/call_fee_from.rb
506
+ - app/services/stellar_base/determine_extra_info.rb
507
+ - app/services/stellar_base/fee_requests/call_withdraw_fee_fixed_quote_from.rb
500
508
  - app/services/stellar_base/find_asset_details.rb
501
509
  - app/services/stellar_base/gen_memo_for.rb
502
510
  - app/services/stellar_base/gen_random_string.rb
511
+ - app/services/stellar_base/get_callback_from.rb
503
512
  - app/services/stellar_base/init_asset_sending_client.rb
504
513
  - app/services/stellar_base/init_stellar_client.rb
505
514
  - app/services/stellar_base/subscribe_account.rb
515
+ - app/services/stellar_base/withdrawal_requests/call_fee_fixed_from.rb
506
516
  - app/services/stellar_base/withdrawal_requests/call_on_withdraw.rb
507
517
  - app/services/stellar_base/withdrawal_requests/determine_fee.rb
508
518
  - app/services/stellar_base/withdrawal_requests/determine_max_amount.rb
@@ -523,6 +533,7 @@ files:
523
533
  - db/migrate/20181003072138_create_stellar_base_account_subscriptions.rb
524
534
  - db/migrate/20181210043919_add_unique_index_to_deposits.rb
525
535
  - db/migrate/20181217090323_create_stellar_transactions_and_operations.rb
536
+ - db/migrate/20190808014913_remove_fee_network.rb
526
537
  - lib/stellar_base-rails.rb
527
538
  - lib/stellar_base.rb
528
539
  - lib/stellar_base/engine.rb
@@ -558,7 +569,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
558
569
  - !ruby/object:Gem::Version
559
570
  version: '0'
560
571
  requirements: []
561
- rubygems_version: 3.0.1
572
+ rubygems_version: 3.0.3
562
573
  signing_key:
563
574
  specification_version: 4
564
575
  summary: Mountable Stellar API Endpoints for Rails
@@ -1,28 +0,0 @@
1
- module StellarBase
2
- module FeeRequests
3
- class CallFeeFrom
4
-
5
- FEE_FROM_ERROR = "`fee_from` must be a string of an object " \
6
- "that responds to `.call` or the object itself".freeze
7
-
8
- def self.call(fee_request:, fee_from:)
9
- return 0 if fee_from.nil?
10
- callback = callback_from(fee_from)
11
- callback.(fee_request)
12
- end
13
-
14
- def self.callback_from(fee_from)
15
- if fee_from.respond_to?(:constantize)
16
- fee_from = fee_from.constantize
17
- end
18
-
19
- if !fee_from.respond_to?(:call)
20
- fail ArgumentError, FEE_FROM_ERROR
21
- end
22
-
23
- fee_from
24
- end
25
-
26
- end
27
- end
28
- end