stellar_base-rails 0.5.5 → 0.5.6
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.
- checksums.yaml +4 -4
- data/app/concepts/stellar_base/withdrawal_requests/contracts/create.rb +1 -3
- data/app/concepts/stellar_base/withdrawal_requests/operations/create.rb +12 -5
- data/app/services/stellar_base/withdrawal_requests/determine_max_amount.rb +14 -0
- data/app/services/stellar_base/withdrawal_requests/find_withdrawable_asset.rb +12 -0
- data/lib/stellar_base/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b42873b418f519fda036560eef2596c0f75835247bf43d6680f9b3c82b6cb5b9
|
4
|
+
data.tar.gz: 892c7e80de8320d7bc137cacdfb72bd6e31a813d446c67b8e8676ccb4ef6b09e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cfeddf2e1766828779c2635afc3fdf13b17f081aab34a797977d1a2798c11f058d6541c891a144de89c7d15faa5a71e9b86e77dcb7dca65abee4cca0d818a05
|
7
|
+
data.tar.gz: 01c19269320076cb8e8636aa4a5a855a51a02e0371695afd014b84e4a0710b14df7c39eed13b664e21219cb572c7737c25d0a92e52db97da74c9d271ee723056
|
@@ -19,9 +19,7 @@ module StellarBase
|
|
19
19
|
validate :check_valid_asset_code
|
20
20
|
|
21
21
|
def check_valid_asset_code
|
22
|
-
asset_codes = StellarBase
|
23
|
-
.configuration
|
24
|
-
.withdrawable_assets
|
22
|
+
asset_codes = StellarBase.configuration.withdrawable_assets
|
25
23
|
&.map do |asset|
|
26
24
|
asset[:asset_code]
|
27
25
|
end
|
@@ -24,10 +24,8 @@ module StellarBase
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def find_withdrawal_asset_details!(options, params:, **)
|
27
|
-
|
28
|
-
|
29
|
-
e[:asset_code] == params[:withdrawal_request][:asset_code]
|
30
|
-
end
|
27
|
+
details = FindWithdrawableAsset
|
28
|
+
.(params[:withdrawal_request][:asset_code])
|
31
29
|
|
32
30
|
params[:withdrawal_asset_details] = details.presence || {}
|
33
31
|
end
|
@@ -47,7 +45,8 @@ module StellarBase
|
|
47
45
|
options["model"].memo = GenMemo.()
|
48
46
|
options["model"].eta = DEFAULT_ETA
|
49
47
|
options["model"].min_amount = 0.0
|
50
|
-
options["model"].max_amount =
|
48
|
+
options["model"].max_amount =
|
49
|
+
DetermineMaxAmount.(withdrawal_asset_details[:max_amount_from])
|
51
50
|
options["model"].fee_fixed =
|
52
51
|
DetermineFee.(withdrawal_asset_details[:fee_fixed])
|
53
52
|
options["model"].fee_percent =
|
@@ -55,6 +54,14 @@ module StellarBase
|
|
55
54
|
options["model"].fee_network = fee_network
|
56
55
|
end
|
57
56
|
|
57
|
+
def get_balance_from(balance_checker_class)
|
58
|
+
if balance_checker_present?
|
59
|
+
return balance_checker_class.constantize.send(:call)
|
60
|
+
end
|
61
|
+
|
62
|
+
nil
|
63
|
+
end
|
64
|
+
|
58
65
|
end
|
59
66
|
end
|
60
67
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module StellarBase
|
2
|
+
module WithdrawalRequests
|
3
|
+
class FindWithdrawableAsset
|
4
|
+
|
5
|
+
def self.call(asset_code)
|
6
|
+
withdrawable_assets = StellarBase.configuration.withdrawable_assets
|
7
|
+
withdrawable_assets.find {|asset| asset[:asset_code] == asset_code }
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/stellar_base/version.rb
CHANGED
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: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ace Subido
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: disposable
|
@@ -325,6 +325,8 @@ files:
|
|
325
325
|
- app/services/stellar_base/gen_random_string.rb
|
326
326
|
- app/services/stellar_base/withdrawal_requests/call_on_withdraw.rb
|
327
327
|
- app/services/stellar_base/withdrawal_requests/determine_fee.rb
|
328
|
+
- app/services/stellar_base/withdrawal_requests/determine_max_amount.rb
|
329
|
+
- app/services/stellar_base/withdrawal_requests/find_withdrawable_asset.rb
|
328
330
|
- app/services/stellar_base/withdrawal_requests/find_withdrawal_request.rb
|
329
331
|
- app/services/stellar_base/withdrawal_requests/gen_memo.rb
|
330
332
|
- app/services/stellar_base/withdrawal_requests/process.rb
|