stellar_base-rails 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/concepts/stellar_base/deposit_requests/contracts/create.rb +1 -0
- data/app/concepts/stellar_base/deposit_requests/operations/create.rb +21 -19
- data/app/representers/stellar_base/deposit_request_representer.rb +7 -1
- data/app/services/stellar_base/determine_extra_info.rb +14 -0
- data/lib/stellar_base/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3ba1fbf0fe9d7db7eed5889e238341a767f77970abd4e75ad2cb91581ff2ab7
|
4
|
+
data.tar.gz: d83e78f1b44edc67dd8fa1d91abf63b9b7badae37935bef70177aa3925686f1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbfcaf41ebd418882dc75f878ad900a9ac39f8ab72566d0e41ca8fb2d4e7f9ec7c49d0624cb70df943be12b9a706c3558ce93eaa1f23e18e7826bd2c40028b08
|
7
|
+
data.tar.gz: 141470c4f0642ffc5557f0fc945793a062ac7b35518511e6eb733a18224e90d0e57f75384406070ab1c112923670993115258d3d32f77feee16e165fa21eb43b
|
@@ -7,11 +7,12 @@ module StellarBase
|
|
7
7
|
|
8
8
|
step self::Policy::Pundit(DepositRequestPolicy, :create?)
|
9
9
|
step Model(DepositRequest, :new)
|
10
|
+
step :find_depositable_asset_details!
|
10
11
|
step :setup_params!
|
12
|
+
step :set_extra_info!
|
11
13
|
step Contract::Build(constant: Contracts::Create)
|
12
14
|
step Contract::Validate(key: :deposit_request)
|
13
15
|
step Contract::Persist(method: :sync)
|
14
|
-
step :find_depositable_asset_details!
|
15
16
|
step :determine_how!
|
16
17
|
step :determine_max_amount!
|
17
18
|
success :set_defaults!
|
@@ -30,33 +31,34 @@ module StellarBase
|
|
30
31
|
|
31
32
|
def find_depositable_asset_details!(options, params:, **)
|
32
33
|
details = FindDepositableAsset.(params[:deposit_request][:asset_code])
|
33
|
-
|
34
|
+
options[:asset_details] = details.presence || {}
|
34
35
|
end
|
35
36
|
|
36
|
-
def determine_how!(options, params:, **)
|
37
|
-
|
38
|
-
|
39
|
-
DetermineHow.(details[:how_from], params[:deposit_request])
|
37
|
+
def determine_how!(options, params:, asset_details:, model:, **)
|
38
|
+
model.deposit_address =
|
39
|
+
DetermineHow.(asset_details[:how_from], params[:deposit_request])
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
|
44
|
-
|
45
|
-
ConfiguredClassRunner.(details[:max_amount_from]) || 0
|
42
|
+
def set_extra_info!(ctx, params:, asset_details:, **)
|
43
|
+
params[:deposit_request][:extra_info] =
|
44
|
+
DetermineExtraInfo.(asset_details).to_json
|
46
45
|
end
|
47
46
|
|
48
|
-
def
|
49
|
-
|
47
|
+
def determine_max_amount!(options, params:, asset_details:, model:, **)
|
48
|
+
model.max_amount =
|
49
|
+
ConfiguredClassRunner.(asset_details[:max_amount_from]) || 0
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
def set_defaults!(options, params:, model:, asset_details:, **)
|
53
|
+
model.asset_type = asset_details[:type]
|
54
|
+
model.issuer = asset_details[:issuer]
|
55
|
+
model.eta = DEFAULT_ETA
|
56
|
+
model.min_amount = 0.0
|
55
57
|
|
56
58
|
# Make Deposits free unless we want it configured
|
57
|
-
# TODO: this should come from `CallDepositFeeFrom.(params,
|
58
|
-
|
59
|
-
|
59
|
+
# TODO: this should come from `CallDepositFeeFrom.(params, asset_details)`
|
60
|
+
model.fee_fixed = asset_details[:fee_fixed] || 0.0
|
61
|
+
model.fee_percent = asset_details[:fee_percent] || 0.0
|
60
62
|
end
|
61
63
|
|
62
64
|
def memo_type_from(params)
|
@@ -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
|
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: 4.
|
4
|
+
version: 4.1.0
|
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-
|
11
|
+
date: 2019-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: disposable
|
@@ -496,6 +496,7 @@ files:
|
|
496
496
|
- app/services/stellar_base/deposit_requests/send_asset.rb
|
497
497
|
- app/services/stellar_base/deposit_requests/trigger.rb
|
498
498
|
- app/services/stellar_base/deposit_requests/update_deposit.rb
|
499
|
+
- app/services/stellar_base/determine_extra_info.rb
|
499
500
|
- app/services/stellar_base/fee_requests/call_withdraw_fee_fixed_quote_from.rb
|
500
501
|
- app/services/stellar_base/find_asset_details.rb
|
501
502
|
- app/services/stellar_base/gen_memo_for.rb
|
@@ -561,7 +562,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
561
562
|
- !ruby/object:Gem::Version
|
562
563
|
version: '0'
|
563
564
|
requirements: []
|
564
|
-
rubygems_version: 3.0.
|
565
|
+
rubygems_version: 3.0.4
|
565
566
|
signing_key:
|
566
567
|
specification_version: 4
|
567
568
|
summary: Mountable Stellar API Endpoints for Rails
|