stellar_core_commander 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bd690aabdd136d2e056b1c887f733a16fd95197
4
- data.tar.gz: e314104fcf1862f33ce680eb181a1a52c5e966f3
3
+ metadata.gz: 2d1cd8f2aeaf80f4c957fa062d63449ff0d36dfd
4
+ data.tar.gz: 257c977e5fa0b37615448040ebcb42fd77cae408
5
5
  SHA512:
6
- metadata.gz: 8dba971da397b4acc0c692b8b2351434acd1b3312cae99addacd8b373e9b747c56a2d013c5a29c4b8373f044c934e40925815a905838568cf152daca081c7cdb
7
- data.tar.gz: fe0334578e9af7e3e32f4df18dfe0e5b49b1d4d664ff40ef59621ed5ccca21feba5c382545629f33fc9bc4d1e16c6ee6dca32d08e1ead5e179dc51328cba42cf
6
+ metadata.gz: 690851008b629b2ece84d06e27cac23a4f794b66383686335983491858e35f3d1634f60f25452dc4a50a483ceba2f14ca7206db291c3ca890013362cefec53e5
7
+ data.tar.gz: 8321aaa93507ce629edc802adbbc203a5b69248b610fe223144910a267c6edc12db9c5c2d373acb24e9d02928223ab56d76ffd8554c42d9f4a7dca0d53de078e
data/examples/trade.rb CHANGED
@@ -3,11 +3,10 @@ account :eur_gateway
3
3
  account :scott
4
4
  account :bartek
5
5
 
6
- payment :master, :usd_gateway, [:native, 1000_000000]
7
- payment :master, :eur_gateway, [:native, 1000_000000]
8
-
9
- payment :master, :scott, [:native, 1000_000000]
10
- payment :master, :bartek, [:native, 1000_000000]
6
+ create_account :usd_gateway, :master, 1000_000000
7
+ create_account :eur_gateway, :master, 1000_000000
8
+ create_account :scott, :master, 1000_000000
9
+ create_account :bartek, :master, 1000_000000
11
10
 
12
11
  close_ledger
13
12
 
@@ -29,3 +28,4 @@ close_ledger
29
28
 
30
29
  offer :scott, {sell:["USD", :usd_gateway], for:["EUR", :eur_gateway]}, 500_000000, 1.0
31
30
 
31
+ offer :scott, {sell:["USD", :usd_gateway], for: :native}, 500_000000, 1.0
@@ -3,7 +3,10 @@ module StellarCoreCommander
3
3
  class OperationBuilder
4
4
  include Contracts
5
5
 
6
- Currency = [String, Symbol]
6
+ Currency = Or[
7
+ [String, Symbol],
8
+ :native
9
+ ]
7
10
  Amount = Any #TODO
8
11
 
9
12
  OfferCurrencies = Or[
@@ -53,12 +56,12 @@ module StellarCoreCommander
53
56
  sequence: next_sequence(funder),
54
57
  starting_balance: starting_balance,
55
58
  }).to_envelope(funder)
56
- end
59
+ end
57
60
 
58
61
  Contract Symbol, Symbol, String => Any
59
62
  def trust(account, issuer, code)
60
63
  change_trust account, issuer, code, (2**63)-1
61
- end
64
+ end
62
65
 
63
66
  Contract Symbol, Symbol, String, Num => Any
64
67
  def change_trust(account, issuer, code, limit)
@@ -70,14 +73,14 @@ module StellarCoreCommander
70
73
  line: make_currency([code, issuer]),
71
74
  limit: limit
72
75
  }).to_envelope(account)
73
- end
76
+ end
74
77
 
75
78
  Contract Symbol, Symbol, String, Num => Any
76
79
  def allow_trust(account, trustor, code)
77
80
  currency = make_currency([code, account])
78
81
  account = get_account account
79
82
  trustor = get_account trustor
80
-
83
+
81
84
 
82
85
  Stellar::Transaction.allow_trust({
83
86
  account: account,
@@ -109,14 +112,14 @@ module StellarCoreCommander
109
112
  taker_pays: taker_pays,
110
113
  amount: amount,
111
114
  price: price,
112
- }).to_envelope(account)
115
+ }).to_envelope(account)
113
116
  end
114
117
 
115
118
 
116
119
  Contract Symbol => Any
117
120
  def require_trust_auth(account)
118
121
  set_flags account, [:auth_required_flag]
119
- end
122
+ end
120
123
 
121
124
  Contract Symbol, ArrayOf[Symbol] => Any
122
125
  def set_flags(account, flags)
@@ -129,15 +132,19 @@ module StellarCoreCommander
129
132
  })
130
133
 
131
134
  tx.to_envelope(account)
132
- end
135
+ end
133
136
 
134
137
  private
135
138
 
136
139
  delegate :get_account, to: :@transactor
137
140
  delegate :next_sequence, to: :@transactor
138
141
 
139
- Contract Currency => [Symbol, String, Stellar::KeyPair]
142
+ Contract Currency => Or[[Symbol, String, Stellar::KeyPair], [:native]]
140
143
  def make_currency(input)
144
+ if input == :native
145
+ return [:native]
146
+ end
147
+
141
148
  code, issuer = *input
142
149
  code = code.ljust(4, "\x00")
143
150
  issuer = get_account issuer
@@ -151,4 +158,4 @@ module StellarCoreCommander
151
158
  end
152
159
 
153
160
  end
154
- end
161
+ end
@@ -1,3 +1,3 @@
1
1
  module StellarCoreCommander
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stellar_core_commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Fleckenstein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-14 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stellar-base