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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb5b3172c23e5d191c18aa42e79e1de8e48a21d7
4
- data.tar.gz: 8c87ab5668d6d74bb0c26c55d76860a1c595ac42
3
+ metadata.gz: 5daad66cb65aae696173dc3cba5afba5f8977dc8
4
+ data.tar.gz: 69b6ede62314c4fa19159b12c32ddd69017184f9
5
5
  SHA512:
6
- metadata.gz: 18c7d2be10311c301263af5669bf58548dccfae38101540bbd6722a78c0f73963b1013daf15846896c371eac62204c9cecd434eeedb0e62d14da845bc0f89567
7
- data.tar.gz: 02d1eccbeb770aaadc29082629264f283959def62ace6d3ade800d1fb7f83b5ad29e2083d20411a64fe8757dbd7a7f786b5fc92e586f3371b4a153d1bcced68d
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
- payload << Bitcoin::Protocol.pack_var_int(@asset_quantities.length).unpack("H*")
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
- payload << Bitcoin::Protocol.pack_var_int(@metadata.length).unpack("H*")
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
@@ -1,3 +1,3 @@
1
1
  module OpenAssets
2
- VERSION = '0.4.8'
2
+ VERSION = '0.4.9'
3
3
  end
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.8
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-06-23 00:00:00.000000000 Z
11
+ date: 2016-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitcoin-ruby