mastercoin-ruby 0.2.3 → 0.2.4
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.
- data/VERSION +1 -1
- data/lib/mastercoin-ruby/message.rb +4 -0
- data/lib/mastercoin-ruby/transaction.rb +7 -1
- data/mastercoin-ruby.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
@@ -19,12 +19,16 @@ module Mastercoin
|
|
19
19
|
else
|
20
20
|
transaction_type = result[0][1][2..9].to_i(16)
|
21
21
|
end
|
22
|
+
Mastercoin.log.debug("Transaction type: #{transaction_type}")
|
22
23
|
|
23
24
|
if transaction_type == Mastercoin::TRANSACTION_SELL_FOR_BITCOIN
|
25
|
+
Mastercoin.log.debug("Selling offer found")
|
24
26
|
Mastercoin::SellingOffer.decode_from_compressed_public_key([result[0][0], result[1][0]], xor_target)
|
25
27
|
elsif transaction_type.to_s == Mastercoin::TRANSACTION_PURCHASE_BTC_TRADE.to_i.to_s
|
28
|
+
Mastercoin.log.debug("Purchase offer found")
|
26
29
|
Mastercoin::PurchaseOffer.decode_from_compressed_public_key(result[0][0], xor_target)
|
27
30
|
elsif transaction_type.to_s == Mastercoin::TRANSACTION_SIMPLE_SEND.to_s
|
31
|
+
Mastercoin.log.debug("Simple send found")
|
28
32
|
Mastercoin::SimpleSend.decode_from_compressed_public_key(result[0][0], xor_target)
|
29
33
|
end
|
30
34
|
end
|
@@ -56,6 +56,10 @@ module Mastercoin
|
|
56
56
|
end
|
57
57
|
else
|
58
58
|
exodus_size_outputs = self.btc_tx.outputs.find_all{|x| x.value == exodus_value}
|
59
|
+
if exodus_size_outputs.length < 3
|
60
|
+
raise NoMastercoinTransactionException.new("Not enough Exodus outputs found, we need at least 3 outputs with the value specified to Exodus, but got #{exodus_size_outputs.length}")
|
61
|
+
end
|
62
|
+
|
59
63
|
self.btc_tx.outputs.each do |output|
|
60
64
|
if output.get_address == Mastercoin::EXODUS_ADDRESS
|
61
65
|
# Do nothing yet; this is simply the exodus address
|
@@ -74,10 +78,12 @@ module Mastercoin
|
|
74
78
|
|
75
79
|
if (self.data.sequence.to_i + 1).to_s == sequence.to_s
|
76
80
|
self.target_address = address
|
81
|
+
Mastercoin.log.debug "Target address found #{self.target_address}"
|
77
82
|
end
|
78
83
|
end
|
79
84
|
|
80
85
|
unless self.target_address
|
86
|
+
Mastercoin.log.debug "Target address not found attempting peek & decode."
|
81
87
|
# Find data outputs and brute force receiver
|
82
88
|
found = exodus_size_outputs.reject do |output|
|
83
89
|
output.get_address == Mastercoin::EXODUS_ADDRESS || Mastercoin::SimpleSend.decode_from_address(output.get_address).looks_like_mastercoin? # This looks like a data packet
|
@@ -86,7 +92,7 @@ module Mastercoin
|
|
86
92
|
if found.length == 1
|
87
93
|
self.target_address = found.first.get_address
|
88
94
|
else
|
89
|
-
|
95
|
+
raise NoMastercoinTransactionException.new("Could not find a recipient address.") unless self.data
|
90
96
|
end
|
91
97
|
end
|
92
98
|
end
|
data/mastercoin-ruby.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "mastercoin-ruby"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Maran"]
|
12
|
-
s.date = "2013-12-
|
12
|
+
s.date = "2013-12-16"
|
13
13
|
s.description = "Basic implementation of the Mastercoin protocol."
|
14
14
|
s.email = "maran.hidskes@gmail.com"
|
15
15
|
s.executables = ["console", "exodus_payment", "mastercoin_transaction", "simple_send", "wallet.rb"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mastercoin-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bitcoin-ruby
|
@@ -194,7 +194,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
194
194
|
version: '0'
|
195
195
|
segments:
|
196
196
|
- 0
|
197
|
-
hash:
|
197
|
+
hash: 2239308773199340819
|
198
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
199
|
none: false
|
200
200
|
requirements:
|