bitcoinrb 1.8.0 → 1.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0cc5450016d6ffbb76d36dcccd415a485a8532ab8414d9beddb9a7e25305dba
4
- data.tar.gz: 75d509c36069ce2dee667a0330962ae310c8062f24aa01d299e5692f6f069461
3
+ metadata.gz: a6e5ff6fa694353e122cd0028354edff2aa877debdc36d368503c25f6277c77f
4
+ data.tar.gz: a6ef9fb214582173d6681dcad6547208b6c606f9d4b82f1c2b3423f388866db1
5
5
  SHA512:
6
- metadata.gz: c2457464548bd24c937eaf55aa53ff2b7ca01b5db0b57b66d7e6fef60142cde6ff2752d670e06bd6052470b6eef25af9f3b676ffe1842fd98c1fd9d590888556
7
- data.tar.gz: 95d5649e3cacc1a155b0e033f0275d9f1806a9e39aad2bbe0c9b61809a10b76d117dddf94c0c68eae50e9dd52aa8e3f266244e2a400821d9172e2706a371c654
6
+ metadata.gz: b4b858790060163880d19b8d771383b406facaa755386e7919e8c6d1caa6b7f362eeb611846f13f40b406114cae7d3e100cf4f5cb46adef01e37d40a43c35de6
7
+ data.tar.gz: a4712b529713ad39bebd6f32d9124d2f07d3c77c22482297df550f384b6f3ebf0ee6000958494684a95cc70354f95a22d8361dd686241c2d67c645fcee20ea5c
data/bitcoinrb.gemspec CHANGED
@@ -30,10 +30,10 @@ Gem::Specification.new do |spec|
30
30
  spec.add_runtime_dependency 'eventmachine_httpserver'
31
31
  spec.add_runtime_dependency 'iniparse'
32
32
  spec.add_runtime_dependency 'siphash'
33
- spec.add_runtime_dependency 'json_pure', '>= 2.3.1', '< 2.8.0'
34
33
  spec.add_runtime_dependency 'bip-schnorr', '>= 0.7.0'
35
34
  spec.add_runtime_dependency 'base32', '>= 0.3.4'
36
35
  spec.add_runtime_dependency 'base64', '~> 0.2.0'
37
36
  spec.add_runtime_dependency 'observer', '~> 0.1.2'
38
37
  spec.add_runtime_dependency 'secp256k1rb', '0.1.1'
38
+ spec.add_runtime_dependency 'logger'
39
39
  end
data/lib/bitcoin/ext.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  module Bitcoin
2
2
  module Ext
3
- autoload :JsonParser, 'bitcoin/ext/json_parser'
4
3
  autoload :ArrayExt, 'bitcoin/ext/array_ext'
5
4
  autoload :ObjectExt, 'bitcoin/ext/object_ext'
6
5
  end
@@ -62,7 +62,8 @@ module Bitcoin
62
62
  request.body = data.to_json
63
63
  response = http.request(request)
64
64
  body = response.body
65
- response = Bitcoin::Ext::JsonParser.new(body.gsub(/\\u([\da-fA-F]{4})/) { [$1].pack('H*').unpack('n*').pack('U*').encode('ISO-8859-1').force_encoding('UTF-8') }).parse
65
+ json_data = JSON.parse(body.gsub(/\\u([\da-fA-F]{4})/) { [$1].pack('H*').unpack('n*').pack('U*').encode('ISO-8859-1').force_encoding('UTF-8') })
66
+ response = convert_floats_to_strings(json_data)
66
67
  raise response['error'].to_json if response['error']
67
68
  response['result']
68
69
  end
@@ -77,6 +78,19 @@ module Bitcoin
77
78
  end
78
79
  end
79
80
 
81
+ # Convert float value
82
+ def convert_floats_to_strings(obj)
83
+ case obj
84
+ when Float
85
+ obj.to_s
86
+ when Hash
87
+ obj.transform_values { |v| convert_floats_to_strings(v) }
88
+ when Array
89
+ obj.map { |item| convert_floats_to_strings(item) }
90
+ else
91
+ obj
92
+ end
93
+ end
80
94
  end
81
95
  end
82
96
  end
@@ -37,7 +37,7 @@ module Bitcoin
37
37
 
38
38
  # check schnorr signature.
39
39
  # @param [String] sig schnorr signature with hex format.
40
- # @param [String] pubkey a public key with hex fromat.
40
+ # @param [String] pubkey a public key with hex format.
41
41
  # @param [Symbol] sig_version whether :taproot or :tapscript
42
42
  # @return [Boolean] verification result
43
43
  def check_schnorr_sig(sig, pubkey, sig_version, opts = {})
@@ -1,3 +1,3 @@
1
1
  module Bitcoin
2
- VERSION = "1.8.0"
2
+ VERSION = "1.8.1"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitcoinrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - azuchi
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-03 00:00:00.000000000 Z
10
+ date: 2025-03-18 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ecdsa_ext
@@ -149,26 +149,6 @@ dependencies:
149
149
  - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
- - !ruby/object:Gem::Dependency
153
- name: json_pure
154
- requirement: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- version: 2.3.1
159
- - - "<"
160
- - !ruby/object:Gem::Version
161
- version: 2.8.0
162
- type: :runtime
163
- prerelease: false
164
- version_requirements: !ruby/object:Gem::Requirement
165
- requirements:
166
- - - ">="
167
- - !ruby/object:Gem::Version
168
- version: 2.3.1
169
- - - "<"
170
- - !ruby/object:Gem::Version
171
- version: 2.8.0
172
152
  - !ruby/object:Gem::Dependency
173
153
  name: bip-schnorr
174
154
  requirement: !ruby/object:Gem::Requirement
@@ -239,6 +219,20 @@ dependencies:
239
219
  - - '='
240
220
  - !ruby/object:Gem::Version
241
221
  version: 0.1.1
222
+ - !ruby/object:Gem::Dependency
223
+ name: logger
224
+ requirement: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - ">="
227
+ - !ruby/object:Gem::Version
228
+ version: '0'
229
+ type: :runtime
230
+ prerelease: false
231
+ version_requirements: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - ">="
234
+ - !ruby/object:Gem::Version
235
+ version: '0'
242
236
  description: The implementation of Bitcoin Protocol for Ruby.
243
237
  email:
244
238
  - azuchi@chaintope.com
@@ -308,7 +302,6 @@ files:
308
302
  - lib/bitcoin/ext.rb
309
303
  - lib/bitcoin/ext/array_ext.rb
310
304
  - lib/bitcoin/ext/ecdsa.rb
311
- - lib/bitcoin/ext/json_parser.rb
312
305
  - lib/bitcoin/ext/object_ext.rb
313
306
  - lib/bitcoin/ext_key.rb
314
307
  - lib/bitcoin/gcs_filter.rb
@@ -457,7 +450,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
457
450
  - !ruby/object:Gem::Version
458
451
  version: '0'
459
452
  requirements: []
460
- rubygems_version: 3.6.2
453
+ rubygems_version: 3.6.3
461
454
  specification_version: 4
462
455
  summary: The implementation of Bitcoin Protocol for Ruby.
463
456
  test_files: []
@@ -1,46 +0,0 @@
1
- require 'json/pure'
2
-
3
- module Bitcoin
4
- module Ext
5
- # Extension of JSON::Pure::Parser.
6
- # This class convert Float value to String value.
7
- class JsonParser < JSON::Pure::Parser
8
-
9
- def parse_value
10
- case
11
- when scan(FLOAT)
12
- self[1].to_s
13
- when scan(INTEGER)
14
- Integer(self[1])
15
- when scan(TRUE)
16
- true
17
- when scan(FALSE)
18
- false
19
- when scan(NULL)
20
- nil
21
- when !UNPARSED.equal?(string = parse_string)
22
- string
23
- when scan(ARRAY_OPEN)
24
- @current_nesting += 1
25
- ary = parse_array
26
- @current_nesting -= 1
27
- ary
28
- when scan(OBJECT_OPEN)
29
- @current_nesting += 1
30
- obj = parse_object
31
- @current_nesting -= 1
32
- obj
33
- when @allow_nan && scan(NAN)
34
- NaN
35
- when @allow_nan && scan(INFINITY)
36
- Infinity
37
- when @allow_nan && scan(MINUS_INFINITY)
38
- MinusInfinity
39
- else
40
- UNPARSED
41
- end
42
- end
43
-
44
- end
45
- end
46
- end