openassets-ruby 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openassets/protocol/marker_output.rb +25 -2
- data/lib/openassets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5daad66cb65aae696173dc3cba5afba5f8977dc8
|
4
|
+
data.tar.gz: 69b6ede62314c4fa19159b12c32ddd69017184f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbf79b9c3896e27924fa445fddda472e44fd82288e84139dda121bad3fc238a1ee53ca6864d42b5d518dfe222e1137e2d9f9eca48c23cf81e8808c21a964e947
|
7
|
+
data.tar.gz: 369a11d56c95c56f336353fed8ac5feed2e19015b7abc3d1237dff695f25a5f5afa60ac86097c2cd8bb0f619e09532284b04e6ea0c148f915868ca4883ef6dc2
|
@@ -27,10 +27,12 @@ module OpenAssets
|
|
27
27
|
# @return [String] The serialized payload.
|
28
28
|
def to_payload
|
29
29
|
payload = [OAP_MARKER, VERSION]
|
30
|
-
|
30
|
+
asset_quantity_count = Bitcoin::Protocol.pack_var_int(@asset_quantities.length).unpack("H*")
|
31
|
+
payload << sort_count(asset_quantity_count[0])
|
31
32
|
@asset_quantities.map{|q|payload << encode_leb128(q)}
|
32
33
|
@metadata ||= ''
|
33
|
-
|
34
|
+
metadata_length = Bitcoin::Protocol.pack_var_int(@metadata.length).unpack("H*")
|
35
|
+
payload << sort_count(metadata_length[0])
|
34
36
|
tmp = []
|
35
37
|
@metadata.bytes{|b| tmp << b.to_s(16)}
|
36
38
|
payload << tmp.join
|
@@ -78,6 +80,27 @@ module OpenAssets
|
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
83
|
+
def sort_count(count)
|
84
|
+
bytes = to_bytes(count)
|
85
|
+
case bytes[0]
|
86
|
+
when "fd" then
|
87
|
+
tmp = count[2..3]
|
88
|
+
count[2..3] = count[4..5]
|
89
|
+
count[4..5] = tmp
|
90
|
+
count
|
91
|
+
when "fe" then
|
92
|
+
tmp_1 = count[2..3]
|
93
|
+
tmp_2 = count[4..5]
|
94
|
+
count[2..3] = count[8..9]
|
95
|
+
count[8..9] = tmp_1
|
96
|
+
count[4..5] = count[6..7]
|
97
|
+
count[6..7] = tmp_2
|
98
|
+
count
|
99
|
+
else
|
100
|
+
count
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
81
104
|
end
|
82
105
|
|
83
106
|
end
|
data/lib/openassets/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openassets-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bitcoin-ruby
|