bsv-sdk 0.20.0 → 0.23.0

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +106 -0
  3. data/lib/bsv/mcp/tools/broadcast_p2pkh.rb +5 -3
  4. data/lib/bsv/network/protocols/arc.rb +4 -30
  5. data/lib/bsv/network/protocols/arcade.rb +163 -0
  6. data/lib/bsv/network/protocols/chaintracks.rb +27 -4
  7. data/lib/bsv/network/protocols/jungle_bus.rb +34 -0
  8. data/lib/bsv/network/protocols/woc_rest.rb +28 -1
  9. data/lib/bsv/network/protocols.rb +1 -0
  10. data/lib/bsv/network/providers/gorilla_pool.rb +18 -18
  11. data/lib/bsv/network/util.rb +44 -0
  12. data/lib/bsv/network.rb +1 -0
  13. data/lib/bsv/transaction/chain_tracker.rb +66 -13
  14. data/lib/bsv/transaction/chain_trackers.rb +0 -10
  15. data/lib/bsv/transaction/fee_models/live_policy.rb +10 -8
  16. data/lib/bsv/version.rb +1 -1
  17. data/lib/bsv/wallet/errors.rb +65 -21
  18. data/lib/bsv/wallet/proto_wallet/validators.rb +7 -49
  19. data/lib/bsv/wallet/proto_wallet.rb +14 -1
  20. data/lib/bsv/wallet/serializer/abort_action.rb +38 -0
  21. data/lib/bsv/wallet/serializer/acquire_certificate.rb +171 -0
  22. data/lib/bsv/wallet/serializer/certificate.rb +184 -0
  23. data/lib/bsv/wallet/serializer/common.rb +207 -0
  24. data/lib/bsv/wallet/serializer/create_action_args.rb +259 -0
  25. data/lib/bsv/wallet/serializer/create_action_result.rb +85 -0
  26. data/lib/bsv/wallet/serializer/create_hmac.rb +67 -0
  27. data/lib/bsv/wallet/serializer/create_signature.rb +90 -0
  28. data/lib/bsv/wallet/serializer/decrypt.rb +60 -0
  29. data/lib/bsv/wallet/serializer/discover_by_attributes.rb +61 -0
  30. data/lib/bsv/wallet/serializer/discover_by_identity_key.rb +49 -0
  31. data/lib/bsv/wallet/serializer/discover_certificates_result.rb +39 -0
  32. data/lib/bsv/wallet/serializer/encrypt.rb +60 -0
  33. data/lib/bsv/wallet/serializer/get_header_for_height.rb +71 -0
  34. data/lib/bsv/wallet/serializer/get_height.rb +46 -0
  35. data/lib/bsv/wallet/serializer/get_network.rb +65 -0
  36. data/lib/bsv/wallet/serializer/get_public_key.rb +86 -0
  37. data/lib/bsv/wallet/serializer/get_version.rb +44 -0
  38. data/lib/bsv/wallet/serializer/internalize_action.rb +151 -0
  39. data/lib/bsv/wallet/serializer/list_actions.rb +348 -0
  40. data/lib/bsv/wallet/serializer/list_certificates.rb +124 -0
  41. data/lib/bsv/wallet/serializer/list_outputs.rb +167 -0
  42. data/lib/bsv/wallet/serializer/prove_certificate.rb +146 -0
  43. data/lib/bsv/wallet/serializer/relinquish_certificate.rb +56 -0
  44. data/lib/bsv/wallet/serializer/relinquish_output.rb +44 -0
  45. data/lib/bsv/wallet/serializer/reveal_counterparty_key_linkage.rb +108 -0
  46. data/lib/bsv/wallet/serializer/reveal_specific_key_linkage.rb +116 -0
  47. data/lib/bsv/wallet/serializer/sign_action_args.rb +94 -0
  48. data/lib/bsv/wallet/serializer/sign_action_result.rb +49 -0
  49. data/lib/bsv/wallet/serializer/status.rb +85 -0
  50. data/lib/bsv/wallet/serializer/verify_hmac.rb +67 -0
  51. data/lib/bsv/wallet/serializer/verify_signature.rb +101 -0
  52. data/lib/bsv/wallet/serializer.rb +180 -0
  53. data/lib/bsv/wallet/substrates/http_wallet_json.rb +129 -0
  54. data/lib/bsv/wallet/substrates/http_wallet_wire.rb +99 -0
  55. data/lib/bsv/wallet/wallet_wire.rb +20 -0
  56. data/lib/bsv/wallet/wallet_wire_processor.rb +61 -0
  57. data/lib/bsv/wallet/wallet_wire_transceiver.rb +61 -0
  58. data/lib/bsv/wallet/wire/calls.rb +79 -0
  59. data/lib/bsv/wallet/wire/frame.rb +181 -0
  60. data/lib/bsv/wallet/wire/reader_writer.rb +402 -0
  61. data/lib/bsv/wallet/wire/validation.rb +213 -0
  62. data/lib/bsv/wallet/wire.rb +13 -0
  63. data/lib/bsv/wallet.rb +17 -0
  64. metadata +46 -2
  65. data/lib/bsv/transaction/chain_trackers/chaintracks.rb +0 -83
@@ -0,0 +1,213 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BSV
4
+ module Wallet
5
+ module Wire
6
+ # Branded-type validators for BRC-100 parameters.
7
+ #
8
+ # Each method raises InvalidParameterError on failure and returns nil
9
+ # on success. Port of ts-sdk/src/wallet/validationHelpers.ts.
10
+ #
11
+ # The existing ProtoWallet::Validators module delegates here so there
12
+ # is a single source of truth for all parameter validation logic.
13
+ module Validation
14
+ module_function
15
+
16
+ MAX_SATOSHIS = 21_000_000 * (10**8)
17
+
18
+ # Validates that +value+ is a hex string (even length, hex chars only).
19
+ #
20
+ # @param name [String] parameter name for error messages
21
+ # @param value [Object] the value to validate
22
+ # @param length [Integer, nil] expected number of hex chars (nil = any)
23
+ def hex_string!(name, value, length: nil)
24
+ raise InvalidParameterError.new(name, 'a String') unless value.is_a?(String)
25
+
26
+ raise InvalidParameterError.new(name, 'a hex string (characters 0-9, a-f, A-F only)') unless value.match?(/\A[0-9a-fA-F]*\z/)
27
+
28
+ raise InvalidParameterError.new(name, 'a hex string with even number of characters') if value.length.odd?
29
+
30
+ return unless length && value.length != length
31
+
32
+ raise InvalidParameterError.new(name, "a #{length}-character hex string, got #{value.length}")
33
+ end
34
+
35
+ # Validates that +value+ is a Base64-encoded string.
36
+ #
37
+ # @param name [String] parameter name for error messages
38
+ # @param value [Object] the value to validate
39
+ def base64_string!(name, value)
40
+ raise InvalidParameterError.new(name, 'a String') unless value.is_a?(String)
41
+
42
+ return if value.match?(%r{\A[A-Za-z0-9+/]*={0,2}\z})
43
+
44
+ raise InvalidParameterError.new(name, 'a valid Base64 string')
45
+ end
46
+
47
+ # Validates an outpoint string in the form "<64-hex-txid>.<vout>".
48
+ #
49
+ # @param name [String] parameter name for error messages
50
+ # @param value [Object] the value to validate
51
+ def outpoint_string!(name, value)
52
+ raise InvalidParameterError.new(name, 'a String') unless value.is_a?(String)
53
+
54
+ parts = value.split('.', 2)
55
+ raise InvalidParameterError.new(name, 'an outpoint string in the format <64-hex-txid>.<vout>') unless parts.length == 2
56
+
57
+ txid_hex, vout_str = parts
58
+
59
+ raise InvalidParameterError.new(name, 'an outpoint with a 64-character hex transaction ID') unless txid_hex.match?(/\A[0-9a-fA-F]{64}\z/)
60
+
61
+ raise InvalidParameterError.new(name, 'an outpoint with a non-negative integer output index') unless vout_str.match?(/\A\d+\z/)
62
+
63
+ vout = vout_str.to_i
64
+ return unless vout > 0xFFFFFFFF
65
+
66
+ raise InvalidParameterError.new(name, 'an outpoint with a vout that fits in a uint32 (0..4294967295)')
67
+ end
68
+
69
+ # Validates a compressed public key in hex form (66 chars, 02/03 prefix).
70
+ #
71
+ # @param name [String] parameter name for error messages
72
+ # @param value [Object] the value to validate
73
+ def pub_key_hex!(name, value)
74
+ raise InvalidParameterError.new(name, 'a String') unless value.is_a?(String)
75
+
76
+ return if value.match?(/\A0[23][0-9a-fA-F]{64}\z/)
77
+
78
+ raise InvalidParameterError.new(name, 'a 66-character compressed public key hex string (02 or 03 prefix)')
79
+ end
80
+
81
+ # Validates a description string (5..50 printable characters).
82
+ #
83
+ # @param name [String] parameter name for error messages
84
+ # @param value [Object] the value to validate
85
+ def description_5_to_50!(name, value)
86
+ raise InvalidParameterError.new(name, 'a String') unless value.is_a?(String)
87
+
88
+ len = value.length
89
+ raise InvalidParameterError.new(name, 'between 5 and 50 characters') if len < 5 || len > 50
90
+ end
91
+
92
+ # Validates a label string (1..150 characters, no spaces).
93
+ #
94
+ # @param name [String] parameter name for error messages
95
+ # @param value [Object] the value to validate
96
+ def label_string!(name, value)
97
+ raise InvalidParameterError.new(name, 'a String') unless value.is_a?(String)
98
+
99
+ len = value.length
100
+ raise InvalidParameterError.new(name, 'between 1 and 150 characters') if len < 1 || len > 150
101
+ end
102
+
103
+ # Validates a basket name (1..300 characters).
104
+ #
105
+ # @param name [String] parameter name for error messages
106
+ # @param value [Object] the value to validate
107
+ def basket_string!(name, value)
108
+ raise InvalidParameterError.new(name, 'a String') unless value.is_a?(String)
109
+
110
+ len = value.length
111
+ raise InvalidParameterError.new(name, 'between 1 and 300 characters') if len < 1 || len > 300
112
+ end
113
+
114
+ # Validates an originator domain (1..250 bytes UTF-8).
115
+ # The originator must fit in a single-byte length field in the wire frame.
116
+ #
117
+ # @param name [String] parameter name for error messages
118
+ # @param value [Object] the value to validate
119
+ def originator_domain!(name, value)
120
+ raise InvalidParameterError.new(name, 'a String') unless value.is_a?(String)
121
+
122
+ byte_len = value.bytesize
123
+ raise InvalidParameterError.new(name, 'at most 250 bytes') if byte_len > 250
124
+ end
125
+
126
+ # Validates a satoshi amount (0..21_000_000 * 10^8).
127
+ #
128
+ # @param name [String] parameter name for error messages
129
+ # @param value [Object] the value to validate
130
+ def satoshi_value!(name, value)
131
+ raise InvalidParameterError.new(name, 'a non-negative integer') unless value.is_a?(Integer)
132
+
133
+ return unless value.negative? || value > MAX_SATOSHIS
134
+
135
+ raise InvalidParameterError.new(name, "between 0 and #{MAX_SATOSHIS} satoshis")
136
+ end
137
+
138
+ # Validates a non-negative integer.
139
+ #
140
+ # @param name [String] parameter name for error messages
141
+ # @param value [Object] the value to validate
142
+ def positive_integer_or_zero!(name, value)
143
+ return if value.is_a?(Integer) && !value.negative?
144
+
145
+ raise InvalidParameterError.new(name, 'a non-negative integer')
146
+ end
147
+
148
+ # Validates a BRC-43 protocol name string (5..400 chars, lowercase).
149
+ #
150
+ # @param name [String] parameter name for error messages
151
+ # @param value [Object] the value to validate
152
+ def protocol_string_5_to_400!(name, value)
153
+ raise InvalidParameterError.new(name, 'a String') unless value.is_a?(String)
154
+
155
+ normalized = value.strip.downcase
156
+ max_length = normalized.start_with?('specific linkage revelation') ? 430 : 400
157
+
158
+ raise InvalidParameterError.new(name, "between 5 and #{max_length} characters") if normalized.length < 5 || normalized.length > max_length
159
+
160
+ raise InvalidParameterError.new(name, 'lowercase letters, numbers, and spaces only') unless normalized.match?(/\A[a-z0-9 ]+\z/)
161
+
162
+ return unless normalized.include?(' ')
163
+
164
+ raise InvalidParameterError.new(name, 'free of consecutive spaces')
165
+ end
166
+
167
+ # Validates a BRC-43 key ID string (1..800 bytes).
168
+ #
169
+ # @param name [String] parameter name for error messages
170
+ # @param value [Object] the value to validate
171
+ def key_id_string_1_to_800!(name, value)
172
+ raise InvalidParameterError.new(name, 'a String') unless value.is_a?(String)
173
+
174
+ byte_length = value.bytesize
175
+ raise InvalidParameterError.new(name, 'between 1 and 800 bytes') if byte_length < 1 || byte_length > 800
176
+ end
177
+
178
+ # Validates a wallet counterparty: 'self', 'anyone', or a 66-char hex pubkey.
179
+ #
180
+ # @param name [String] parameter name for error messages
181
+ # @param value [Object] the value to validate
182
+ def wallet_counterparty!(name, value)
183
+ return if %w[self anyone].include?(value)
184
+
185
+ pub_key_hex!(name, value)
186
+ end
187
+
188
+ # Validates a BRC-43 protocol ID: [security_level (0-2), protocol_name (5-400 chars)].
189
+ #
190
+ # @param name [String] parameter name for error messages
191
+ # @param value [Object] the value to validate
192
+ def wallet_protocol!(name, value)
193
+ raise InvalidParameterError.new(name, 'an Array of [security_level, protocol_name]') unless value.is_a?(Array) && value.length == 2
194
+
195
+ level, proto_name = value
196
+ raise InvalidParameterError.new(name, 'a security level of 0, 1, or 2') unless [0, 1, 2].include?(level)
197
+
198
+ protocol_string_5_to_400!("#{name} protocol name", proto_name)
199
+ end
200
+
201
+ # Validates a certificate acquisition protocol: 'direct' or 'issuance'.
202
+ #
203
+ # @param name [String] parameter name for error messages
204
+ # @param value [Object] the value to validate
205
+ def acquisition_protocol!(name, value)
206
+ return if %w[direct issuance].include?(value)
207
+
208
+ raise InvalidParameterError.new(name, "'direct' or 'issuance'")
209
+ end
210
+ end
211
+ end
212
+ end
213
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BSV
4
+ module Wallet
5
+ module Wire
6
+ autoload :Frame, 'bsv/wallet/wire/frame'
7
+ autoload :Calls, 'bsv/wallet/wire/calls'
8
+ autoload :Validation, 'bsv/wallet/wire/validation'
9
+ autoload :Writer, 'bsv/wallet/wire/reader_writer'
10
+ autoload :Reader, 'bsv/wallet/wire/reader_writer'
11
+ end
12
+ end
13
+ end
data/lib/bsv/wallet.rb CHANGED
@@ -8,9 +8,26 @@ module BSV
8
8
  require_relative 'wallet/errors'
9
9
  require_relative 'wallet/interface'
10
10
 
11
+ # Wire layer — BRC-103 frame codec, call enum, validators, reader/writer.
12
+ require_relative 'wallet/wire'
13
+
14
+ # Per-call BRC-103 serialisers and dispatch tables.
15
+ autoload :Serializer, 'bsv/wallet/serializer'
16
+
11
17
  # ProtoWallet — minimal crypto-only BRC-100 implementation.
12
18
  # Its internals (KeyDeriver, Validators) are scoped under ProtoWallet::
13
19
  # to avoid collision with bsv-wallet's own KeyDeriver.
14
20
  require_relative 'wallet/proto_wallet'
21
+
22
+ # BRC-103 transport layer.
23
+ autoload :WalletWire, 'bsv/wallet/wallet_wire'
24
+ autoload :WalletWireTransceiver, 'bsv/wallet/wallet_wire_transceiver'
25
+ autoload :WalletWireProcessor, 'bsv/wallet/wallet_wire_processor'
26
+
27
+ # BRC-103 transport substrates.
28
+ module Substrates
29
+ autoload :HTTPWalletWire, 'bsv/wallet/substrates/http_wallet_wire'
30
+ autoload :HTTPWalletJSON, 'bsv/wallet/substrates/http_wallet_json'
31
+ end
15
32
  end
16
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bsv-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Bettison
@@ -100,6 +100,7 @@ files:
100
100
  - lib/bsv/network/protocol_response.rb
101
101
  - lib/bsv/network/protocols.rb
102
102
  - lib/bsv/network/protocols/arc.rb
103
+ - lib/bsv/network/protocols/arcade.rb
103
104
  - lib/bsv/network/protocols/chaintracks.rb
104
105
  - lib/bsv/network/protocols/jungle_bus.rb
105
106
  - lib/bsv/network/protocols/ordinals.rb
@@ -110,6 +111,7 @@ files:
110
111
  - lib/bsv/network/providers/gorilla_pool.rb
111
112
  - lib/bsv/network/providers/taal.rb
112
113
  - lib/bsv/network/providers/whats_on_chain.rb
114
+ - lib/bsv/network/util.rb
113
115
  - lib/bsv/network/utxo.rb
114
116
  - lib/bsv/overlay.rb
115
117
  - lib/bsv/overlay/admin_token_template.rb
@@ -171,7 +173,6 @@ files:
171
173
  - lib/bsv/transaction/beef.rb
172
174
  - lib/bsv/transaction/chain_tracker.rb
173
175
  - lib/bsv/transaction/chain_trackers.rb
174
- - lib/bsv/transaction/chain_trackers/chaintracks.rb
175
176
  - lib/bsv/transaction/chain_trackers/whats_on_chain.rb
176
177
  - lib/bsv/transaction/fee_model.rb
177
178
  - lib/bsv/transaction/fee_models.rb
@@ -194,6 +195,49 @@ files:
194
195
  - lib/bsv/wallet/proto_wallet.rb
195
196
  - lib/bsv/wallet/proto_wallet/key_deriver.rb
196
197
  - lib/bsv/wallet/proto_wallet/validators.rb
198
+ - lib/bsv/wallet/serializer.rb
199
+ - lib/bsv/wallet/serializer/abort_action.rb
200
+ - lib/bsv/wallet/serializer/acquire_certificate.rb
201
+ - lib/bsv/wallet/serializer/certificate.rb
202
+ - lib/bsv/wallet/serializer/common.rb
203
+ - lib/bsv/wallet/serializer/create_action_args.rb
204
+ - lib/bsv/wallet/serializer/create_action_result.rb
205
+ - lib/bsv/wallet/serializer/create_hmac.rb
206
+ - lib/bsv/wallet/serializer/create_signature.rb
207
+ - lib/bsv/wallet/serializer/decrypt.rb
208
+ - lib/bsv/wallet/serializer/discover_by_attributes.rb
209
+ - lib/bsv/wallet/serializer/discover_by_identity_key.rb
210
+ - lib/bsv/wallet/serializer/discover_certificates_result.rb
211
+ - lib/bsv/wallet/serializer/encrypt.rb
212
+ - lib/bsv/wallet/serializer/get_header_for_height.rb
213
+ - lib/bsv/wallet/serializer/get_height.rb
214
+ - lib/bsv/wallet/serializer/get_network.rb
215
+ - lib/bsv/wallet/serializer/get_public_key.rb
216
+ - lib/bsv/wallet/serializer/get_version.rb
217
+ - lib/bsv/wallet/serializer/internalize_action.rb
218
+ - lib/bsv/wallet/serializer/list_actions.rb
219
+ - lib/bsv/wallet/serializer/list_certificates.rb
220
+ - lib/bsv/wallet/serializer/list_outputs.rb
221
+ - lib/bsv/wallet/serializer/prove_certificate.rb
222
+ - lib/bsv/wallet/serializer/relinquish_certificate.rb
223
+ - lib/bsv/wallet/serializer/relinquish_output.rb
224
+ - lib/bsv/wallet/serializer/reveal_counterparty_key_linkage.rb
225
+ - lib/bsv/wallet/serializer/reveal_specific_key_linkage.rb
226
+ - lib/bsv/wallet/serializer/sign_action_args.rb
227
+ - lib/bsv/wallet/serializer/sign_action_result.rb
228
+ - lib/bsv/wallet/serializer/status.rb
229
+ - lib/bsv/wallet/serializer/verify_hmac.rb
230
+ - lib/bsv/wallet/serializer/verify_signature.rb
231
+ - lib/bsv/wallet/substrates/http_wallet_json.rb
232
+ - lib/bsv/wallet/substrates/http_wallet_wire.rb
233
+ - lib/bsv/wallet/wallet_wire.rb
234
+ - lib/bsv/wallet/wallet_wire_processor.rb
235
+ - lib/bsv/wallet/wallet_wire_transceiver.rb
236
+ - lib/bsv/wallet/wire.rb
237
+ - lib/bsv/wallet/wire/calls.rb
238
+ - lib/bsv/wallet/wire/frame.rb
239
+ - lib/bsv/wallet/wire/reader_writer.rb
240
+ - lib/bsv/wallet/wire/validation.rb
197
241
  - lib/bsv/wire_format.rb
198
242
  homepage: https://github.com/sgbett/bsv-ruby-sdk
199
243
  licenses:
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BSV
4
- module Transaction
5
- module ChainTrackers
6
- # Chain tracker that verifies merkle roots using the Chaintracks API (Arcade/GorillaPool).
7
- #
8
- # Delegates all HTTP communication to {BSV::Network::Protocols::Chaintracks}.
9
- # The constructor signature and {ChainTracker} contract are preserved.
10
- #
11
- # @example
12
- # tracker = BSV::Transaction::ChainTrackers::Chaintracks.new
13
- # tracker.valid_root_for_height?('abcd...', 800_000)
14
- #
15
- # @example With API key
16
- # tracker = BSV::Transaction::ChainTrackers::Chaintracks.new(api_key: 'my-key')
17
- # tracker.current_height
18
- class Chaintracks < ChainTracker
19
- # Returns a Chaintracks instance using the GorillaPool provider default.
20
- #
21
- # @param testnet [Boolean] when true, uses the testnet endpoint
22
- # @param ** [Hash] forwarded to the underlying protocol (e.g. +api_key:+, +http_client:+)
23
- # @return [Chaintracks]
24
- def self.default(testnet: false, **)
25
- provider = BSV::Network::Providers::GorillaPool.default(testnet: testnet, **)
26
- protocol = provider.protocol_for(:current_height)
27
- new(protocol: protocol)
28
- end
29
-
30
- # @param url [String, nil] base URL (legacy compat — prefer .default or protocol:)
31
- # @param api_key [String, nil] optional Bearer API key
32
- # @param http_client [#request, nil] injectable HTTP client for testing
33
- # @param protocol [BSV::Network::Protocols::Chaintracks, nil] pre-configured protocol
34
- def initialize(url: nil, api_key: nil, http_client: nil, protocol: nil)
35
- super()
36
- if protocol
37
- @protocol = protocol
38
- elsif url
39
- @url = url.chomp('/')
40
- @api_key = api_key
41
- @protocol = BSV::Network::Protocols::Chaintracks.new(
42
- base_url: @url,
43
- api_key: api_key,
44
- http_client: http_client
45
- )
46
- else
47
- provider = BSV::Network::Providers::GorillaPool.default(api_key: api_key, http_client: http_client)
48
- @protocol = provider.protocol_for(:current_height)
49
- end
50
- end
51
-
52
- # Verify that a merkle root is valid for the given block height.
53
- #
54
- # @param root [String] merkle root as a hex string
55
- # @param height [Integer] block height
56
- # @return [Boolean]
57
- # @raise [StandardError] on network or API error
58
- def valid_root_for_height?(root, height)
59
- result = @protocol.call(:get_block_header, height)
60
- return false if result.http_not_found?
61
-
62
- raise result.message.to_s unless result.http_success?
63
-
64
- merkle_root = result.data['merkleRoot']
65
- return false unless merkle_root
66
-
67
- merkle_root.downcase == root.downcase
68
- end
69
-
70
- # Return the current blockchain height.
71
- #
72
- # @return [Integer]
73
- # @raise [StandardError] on network or API error
74
- def current_height
75
- result = @protocol.call(:current_height)
76
- return result.data if result.http_success?
77
-
78
- raise result.message.to_s
79
- end
80
- end
81
- end
82
- end
83
- end