stellar-base 0.1.0 → 0.1.1
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/examples/create_account.rb +2 -2
- data/examples/mid_level_transaction_post.rb +2 -2
- data/examples/non_native_payment.rb +2 -2
- data/examples/offer.rb +5 -5
- data/examples/transaction_merge.rb +1 -1
- data/lib/stellar/base/version.rb +1 -1
- data/lib/stellar/operation.rb +8 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ea78340f6994e3e65e1ff94c06da49d4c7443ec
|
4
|
+
data.tar.gz: c7e8b4bec536d169cda2728b576d837cf26fc049
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1df05ce3d1bf317582b8d83b15e0416d3dba1bd90a99293f21c9a86c67f2c477778d5ae9c7d53beca95bebe42ea6d54c1a00eb7bea5ea1fcad13d2e78fdd5b4d
|
7
|
+
data.tar.gz: 11258c89a6dede4947fb70809a365b4840495d3a15e60d998a0a53c38bf831b756259ee9bced4bb85767f4e5f26bc613d3ff2b1ac353b7f3ca7e19ee71a3bc40
|
data/examples/create_account.rb
CHANGED
@@ -20,7 +20,7 @@ tx = Stellar::Transaction.create_account({
|
|
20
20
|
starting_balance: 50 * Stellar::ONE
|
21
21
|
})
|
22
22
|
|
23
|
-
|
23
|
+
b64 = tx.to_envelope(master).to_xdr(:base64)
|
24
24
|
|
25
|
-
result = $server.get('tx', blob:
|
25
|
+
result = $server.get('tx', blob: b64)
|
26
26
|
p result.body
|
@@ -27,7 +27,7 @@ tx = Stellar::Transaction.payment({
|
|
27
27
|
amount: [:native, 20 * Stellar::ONE]
|
28
28
|
})
|
29
29
|
|
30
|
-
|
30
|
+
b64 = tx.to_envelope(master).to_xdr(:base64)
|
31
31
|
|
32
|
-
result = $server.get('tx', blob:
|
32
|
+
result = $server.get('tx', blob: b64)
|
33
33
|
p result.body
|
@@ -22,8 +22,8 @@ $server = Faraday.new(url: "http://localhost:39132") do |conn|
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def submit(key, tx)
|
25
|
-
|
26
|
-
response = $server.get('tx', blob:
|
25
|
+
b64 = tx.to_envelope(key).to_xdr(:base64)
|
26
|
+
response = $server.get('tx', blob: b64)
|
27
27
|
raw = [response.body["result"]].pack("H*")
|
28
28
|
p response.body
|
29
29
|
end
|
data/examples/offer.rb
CHANGED
@@ -22,8 +22,8 @@ $server = Faraday.new(url: "http://localhost:39132") do |conn|
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def submit(key, tx)
|
25
|
-
|
26
|
-
response = $server.get('tx', blob:
|
25
|
+
b64 = tx.to_envelope(key).to_xdr(:base64)
|
26
|
+
response = $server.get('tx', blob: b64)
|
27
27
|
p response.body
|
28
28
|
end
|
29
29
|
|
@@ -67,9 +67,9 @@ submit master, Stellar::Transaction.payment({
|
|
67
67
|
|
68
68
|
submit master, Stellar::Transaction.manage_offer({
|
69
69
|
account: destination,
|
70
|
-
sequence: destination_sequence + 3
|
71
|
-
|
72
|
-
|
70
|
+
sequence: destination_sequence + 3,
|
71
|
+
selling: [:alphanum4, "USD\x00", usd_gateway],
|
72
|
+
buying: [:alphanum4, "EUR\x00", eur_gateway],
|
73
73
|
amount: 100,
|
74
74
|
price: 2.0,
|
75
75
|
})
|
data/lib/stellar/base/version.rb
CHANGED
data/lib/stellar/operation.rb
CHANGED
@@ -131,15 +131,15 @@ module Stellar
|
|
131
131
|
end
|
132
132
|
|
133
133
|
def self.manage_offer(attributes={})
|
134
|
-
|
135
|
-
|
134
|
+
buying = Asset.send(*attributes[:buying])
|
135
|
+
selling = Asset.send(*attributes[:selling])
|
136
136
|
amount = attributes[:amount]
|
137
137
|
offer_id = attributes[:offer_id] || 0
|
138
138
|
price = Price.from_f(attributes[:price])
|
139
139
|
|
140
140
|
op = ManageOfferOp.new({
|
141
|
-
|
142
|
-
|
141
|
+
buying: buying,
|
142
|
+
selling: selling,
|
143
143
|
amount: amount,
|
144
144
|
price: price,
|
145
145
|
offer_id: offer_id
|
@@ -151,14 +151,14 @@ module Stellar
|
|
151
151
|
end
|
152
152
|
|
153
153
|
def self.create_passive_offer(attributes={})
|
154
|
-
|
155
|
-
|
154
|
+
buying = Asset.send(*attributes[:buying])
|
155
|
+
selling = Asset.send(*attributes[:selling])
|
156
156
|
amount = attributes[:amount]
|
157
157
|
price = Price.from_f(attributes[:price])
|
158
158
|
|
159
159
|
op = CreatePassiveOfferOp.new({
|
160
|
-
|
161
|
-
|
160
|
+
buying: buying,
|
161
|
+
selling: selling,
|
162
162
|
amount: amount,
|
163
163
|
price: price,
|
164
164
|
})
|