stellar_core_commander 0.0.10 → 0.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd2f67696affdaab450d32a5f0af66983a30c4bf
4
- data.tar.gz: a1c96602fc57defdc5bc288ee2e1d3edcbb05ca2
3
+ metadata.gz: 39b1d602547d8c0fb71b64ee13f913d33710d259
4
+ data.tar.gz: 153ed88d97f786ed976fe2094aa0857110179719
5
5
  SHA512:
6
- metadata.gz: 754f6d203d4d406fc446ff8975ef964c2cfc14cea19824f4d8773d92a468dc1a01f5930f1ba091556187f0ffa2f8d35f038c50edb2bc661b1365c20453bb5b8b
7
- data.tar.gz: 78f2b8bf586722d6fa1f882c638b627c1b0ba9569a8a1dca823b22ab8b716e5bc4a1fc701a9894e61d1c5f9bf7d9a929d6675c1beb6f83cd24629a6416ef481b
6
+ metadata.gz: 522bf96970380a8cd175ff844f3e816051c28dcfbcf20451774c5ea035b579c5b516684eabd4c30443c70646792f8f35680645c9e533c2da99ae9984e61e6dd9
7
+ data.tar.gz: b70f74d24878e0e6285e324154d1c03ffc34fcf6b597e1814e835dc177803a89c86fc8f2be404b7859d9bfe1acfad47a4b5e3edb33202e3275790f8bc0e47ba9
@@ -0,0 +1,24 @@
1
+ use_manual_close #use_manual_close causes scc to run a process with MANUAL_CLOSE=true
2
+
3
+ account :usd_gateway
4
+ account :eur_gateway
5
+ account :scott
6
+
7
+ create_account :usd_gateway
8
+ create_account :eur_gateway
9
+ create_account :scott
10
+
11
+ close_ledger
12
+
13
+ trust :scott, :usd_gateway, "USD"
14
+ trust :scott, :eur_gateway, "EUR"
15
+
16
+ close_ledger
17
+
18
+ payment :usd_gateway, :scott, ["USD", :usd_gateway, 1000 * Stellar::ONE]
19
+ payment :eur_gateway, :scott, ["EUR", :eur_gateway, 1000 * Stellar::ONE]
20
+
21
+ close_ledger
22
+
23
+ passive_offer :scott, {sell:["USD", :usd_gateway], for:["EUR", :eur_gateway]}, 500 * Stellar::ONE, 1.0
24
+ passive_offer :scott, {buy:["USD", :usd_gateway], with:["EUR", :eur_gateway]}, 500 * Stellar::ONE, 1.0
@@ -84,7 +84,7 @@ module StellarCoreCommander
84
84
  }).to_envelope(account)
85
85
  end
86
86
 
87
- Contract Symbol, Symbol, String, Num, Bool => Any
87
+ Contract Symbol, Symbol, String, Bool => Any
88
88
  def allow_trust(account, trustor, code, authorize=true)
89
89
  currency = make_currency([code, account])
90
90
  account = get_account account
@@ -100,7 +100,7 @@ module StellarCoreCommander
100
100
  }).to_envelope(account)
101
101
  end
102
102
 
103
- Contract Symbol, Symbol, String, Num => Any
103
+ Contract Symbol, Symbol, String => Any
104
104
  def revoke_trust(account, trustor, code)
105
105
  allow_trust(account, trustor, code, false)
106
106
  end
@@ -119,7 +119,31 @@ module StellarCoreCommander
119
119
  amount = (amount * price).floor
120
120
  end
121
121
 
122
- Stellar::Transaction.create_offer({
122
+ Stellar::Transaction.manage_offer({
123
+ account: account,
124
+ sequence: next_sequence(account),
125
+ taker_gets: taker_gets,
126
+ taker_pays: taker_pays,
127
+ amount: amount,
128
+ price: price,
129
+ }).to_envelope(account)
130
+ end
131
+
132
+ Contract Symbol, OfferCurrencies, Num, Num => Any
133
+ def passive_offer(account, currencies, amount, price)
134
+ account = get_account account
135
+
136
+ if currencies.has_key?(:sell)
137
+ taker_pays = make_currency currencies[:for]
138
+ taker_gets = make_currency currencies[:sell]
139
+ else
140
+ taker_pays = make_currency currencies[:buy]
141
+ taker_gets = make_currency currencies[:with]
142
+ price = 1 / price
143
+ amount = (amount * price).floor
144
+ end
145
+
146
+ Stellar::Transaction.create_passive_offer({
123
147
  account: account,
124
148
  sequence: next_sequence(account),
125
149
  taker_gets: taker_gets,
@@ -102,6 +102,14 @@ module StellarCoreCommander
102
102
  submit_transaction envelope
103
103
  end
104
104
 
105
+ #
106
+ # @see StellarCoreCommander::OperationBuilder#passive_offer
107
+ def passive_offer(*args)
108
+ require_process_running
109
+ envelope = @operation_builder.passive_offer(*args)
110
+ submit_transaction envelope
111
+ end
112
+
105
113
  #
106
114
  # @see StellarCoreCommander::OperationBuilder#require_trust_auth
107
115
  def require_trust_auth(*args)
@@ -143,6 +151,14 @@ module StellarCoreCommander
143
151
  end
144
152
 
145
153
 
154
+ #
155
+ # @see StellarCoreCommander::OperationBuilder#revoke_trust
156
+ def revoke_trust(*args)
157
+ require_process_running
158
+ envelope = @operation_builder.revoke_trust(*args)
159
+ submit_transaction envelope
160
+ end
161
+
146
162
  #
147
163
  # @see StellarCoreCommander::OperationBuilder#merge_account
148
164
  def merge_account(*args)
@@ -1,3 +1,3 @@
1
1
  module StellarCoreCommander
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "stellar-base", "= 0.0.12"
20
+ spec.add_dependency "stellar-base", "= 0.0.13"
21
21
  spec.add_dependency "slop", "~> 3.6.0"
22
22
  spec.add_dependency "faraday", "~> 0.9.1"
23
23
  spec.add_dependency "faraday_middleware", "~> 0.9.1"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stellar_core_commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Fleckenstein
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.12
19
+ version: 0.0.13
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.12
26
+ version: 0.0.13
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: slop
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -183,6 +183,7 @@ files:
183
183
  - examples/merge_account.rb
184
184
  - examples/multi_host_simple_payment.rb
185
185
  - examples/non_native_payment.rb
186
+ - examples/passive_offer.rb
186
187
  - examples/pathed_payment.rb
187
188
  - examples/simple_payment.rb
188
189
  - examples/trade.rb