bsv-sdk 0.20.0 → 0.22.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +82 -0
- data/lib/bsv/mcp/tools/broadcast_p2pkh.rb +5 -3
- data/lib/bsv/network/protocols/arc.rb +4 -30
- data/lib/bsv/network/protocols/arcade.rb +163 -0
- data/lib/bsv/network/protocols/chaintracks.rb +6 -3
- data/lib/bsv/network/protocols/jungle_bus.rb +6 -0
- data/lib/bsv/network/protocols.rb +1 -0
- data/lib/bsv/network/providers/gorilla_pool.rb +18 -18
- data/lib/bsv/network/util.rb +44 -0
- data/lib/bsv/network.rb +1 -0
- data/lib/bsv/transaction/chain_tracker.rb +74 -13
- data/lib/bsv/transaction/chain_trackers.rb +0 -10
- data/lib/bsv/transaction/fee_models/live_policy.rb +10 -8
- data/lib/bsv/version.rb +1 -1
- data/lib/bsv/wallet/errors.rb +65 -21
- data/lib/bsv/wallet/proto_wallet/validators.rb +7 -49
- data/lib/bsv/wallet/proto_wallet.rb +14 -1
- data/lib/bsv/wallet/serializer/abort_action.rb +38 -0
- data/lib/bsv/wallet/serializer/acquire_certificate.rb +171 -0
- data/lib/bsv/wallet/serializer/certificate.rb +184 -0
- data/lib/bsv/wallet/serializer/common.rb +207 -0
- data/lib/bsv/wallet/serializer/create_action_args.rb +259 -0
- data/lib/bsv/wallet/serializer/create_action_result.rb +85 -0
- data/lib/bsv/wallet/serializer/create_hmac.rb +67 -0
- data/lib/bsv/wallet/serializer/create_signature.rb +90 -0
- data/lib/bsv/wallet/serializer/decrypt.rb +60 -0
- data/lib/bsv/wallet/serializer/discover_by_attributes.rb +61 -0
- data/lib/bsv/wallet/serializer/discover_by_identity_key.rb +49 -0
- data/lib/bsv/wallet/serializer/discover_certificates_result.rb +39 -0
- data/lib/bsv/wallet/serializer/encrypt.rb +60 -0
- data/lib/bsv/wallet/serializer/get_header_for_height.rb +71 -0
- data/lib/bsv/wallet/serializer/get_height.rb +46 -0
- data/lib/bsv/wallet/serializer/get_network.rb +65 -0
- data/lib/bsv/wallet/serializer/get_public_key.rb +86 -0
- data/lib/bsv/wallet/serializer/get_version.rb +44 -0
- data/lib/bsv/wallet/serializer/internalize_action.rb +151 -0
- data/lib/bsv/wallet/serializer/list_actions.rb +348 -0
- data/lib/bsv/wallet/serializer/list_certificates.rb +124 -0
- data/lib/bsv/wallet/serializer/list_outputs.rb +167 -0
- data/lib/bsv/wallet/serializer/prove_certificate.rb +146 -0
- data/lib/bsv/wallet/serializer/relinquish_certificate.rb +56 -0
- data/lib/bsv/wallet/serializer/relinquish_output.rb +44 -0
- data/lib/bsv/wallet/serializer/reveal_counterparty_key_linkage.rb +108 -0
- data/lib/bsv/wallet/serializer/reveal_specific_key_linkage.rb +116 -0
- data/lib/bsv/wallet/serializer/sign_action_args.rb +94 -0
- data/lib/bsv/wallet/serializer/sign_action_result.rb +49 -0
- data/lib/bsv/wallet/serializer/status.rb +85 -0
- data/lib/bsv/wallet/serializer/verify_hmac.rb +67 -0
- data/lib/bsv/wallet/serializer/verify_signature.rb +101 -0
- data/lib/bsv/wallet/serializer.rb +180 -0
- data/lib/bsv/wallet/substrates/http_wallet_json.rb +129 -0
- data/lib/bsv/wallet/substrates/http_wallet_wire.rb +99 -0
- data/lib/bsv/wallet/wallet_wire.rb +20 -0
- data/lib/bsv/wallet/wallet_wire_processor.rb +61 -0
- data/lib/bsv/wallet/wallet_wire_transceiver.rb +61 -0
- data/lib/bsv/wallet/wire/calls.rb +79 -0
- data/lib/bsv/wallet/wire/frame.rb +181 -0
- data/lib/bsv/wallet/wire/reader_writer.rb +402 -0
- data/lib/bsv/wallet/wire/validation.rb +213 -0
- data/lib/bsv/wallet/wire.rb +13 -0
- data/lib/bsv/wallet.rb +17 -0
- metadata +46 -2
- data/lib/bsv/transaction/chain_trackers/chaintracks.rb +0 -83
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.
|
|
4
|
+
version: 0.22.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
|