bsv-sdk 0.18.0 → 0.19.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 +37 -0
- data/lib/bsv/mcp/tools/broadcast_p2pkh.rb +4 -4
- data/lib/bsv/mcp/tools/check_balance.rb +2 -2
- data/lib/bsv/mcp/tools/fetch_tx.rb +2 -2
- data/lib/bsv/mcp/tools/fetch_utxos.rb +2 -2
- data/lib/bsv/network/protocol.rb +41 -30
- data/lib/bsv/network/protocol_response.rb +86 -0
- data/lib/bsv/network/protocols/arc.rb +73 -119
- data/lib/bsv/network/protocols/ordinals.rb +10 -10
- data/lib/bsv/network/protocols/taal_binary.rb +11 -12
- data/lib/bsv/network/protocols/woc_rest.rb +25 -25
- data/lib/bsv/network/protocols.rb +2 -3
- data/lib/bsv/network/provider.rb +2 -2
- data/lib/bsv/network.rb +1 -6
- data/lib/bsv/transaction/chain_tracker.rb +30 -12
- data/lib/bsv/transaction/chain_trackers/chaintracks.rb +6 -14
- data/lib/bsv/transaction/chain_trackers/whats_on_chain.rb +6 -14
- data/lib/bsv/version.rb +1 -1
- data/lib/bsv/wallet/proto_wallet.rb +44 -8
- metadata +2 -7
- data/lib/bsv/network/arc.rb +0 -26
- data/lib/bsv/network/broadcast_error.rb +0 -18
- data/lib/bsv/network/broadcast_response.rb +0 -31
- data/lib/bsv/network/chain_provider_error.rb +0 -14
- data/lib/bsv/network/result.rb +0 -119
- data/lib/bsv/network/whats_on_chain.rb +0 -26
data/lib/bsv/network/result.rb
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module BSV
|
|
4
|
-
module Network
|
|
5
|
-
# Result module provides three immutable value types for Protocol dispatch outcomes.
|
|
6
|
-
#
|
|
7
|
-
# All three types share a Predicates mixin with default false implementations.
|
|
8
|
-
# Each type overrides only the predicate that returns true for that type.
|
|
9
|
-
module Result
|
|
10
|
-
# Mixin providing default false implementations for all query predicates.
|
|
11
|
-
module Predicates
|
|
12
|
-
def success?
|
|
13
|
-
false
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def error?
|
|
17
|
-
false
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def not_found?
|
|
21
|
-
false
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# Represents a successful outcome. Carries the response payload in +data+
|
|
26
|
-
# and optional protocol-specific extras in +metadata+.
|
|
27
|
-
class Success
|
|
28
|
-
include Predicates
|
|
29
|
-
|
|
30
|
-
attr_reader :data, :metadata
|
|
31
|
-
|
|
32
|
-
def initialize(data:, metadata: {})
|
|
33
|
-
@data = data
|
|
34
|
-
@metadata = metadata.freeze
|
|
35
|
-
freeze
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def success?
|
|
39
|
-
true
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def ==(other)
|
|
43
|
-
other.is_a?(Success) && data == other.data && metadata == other.metadata
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
alias eql? ==
|
|
47
|
-
|
|
48
|
-
def hash
|
|
49
|
-
[self.class, data, metadata].hash
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# Represents a failed outcome. Carries a human-readable +message+, a boolean
|
|
54
|
-
# +retryable+ flag indicating whether the caller should retry, and optional
|
|
55
|
-
# +metadata+ for structured protocol-specific details (e.g. +arc_status+).
|
|
56
|
-
class Error
|
|
57
|
-
include Predicates
|
|
58
|
-
|
|
59
|
-
attr_reader :message, :retryable, :metadata
|
|
60
|
-
|
|
61
|
-
def initialize(message:, retryable: false, metadata: {})
|
|
62
|
-
@message = message
|
|
63
|
-
@retryable = retryable
|
|
64
|
-
@metadata = metadata.freeze
|
|
65
|
-
freeze
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def error?
|
|
69
|
-
true
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def retryable?
|
|
73
|
-
@retryable
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def ==(other)
|
|
77
|
-
other.is_a?(Error) &&
|
|
78
|
-
message == other.message &&
|
|
79
|
-
retryable == other.retryable &&
|
|
80
|
-
metadata == other.metadata
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
alias eql? ==
|
|
84
|
-
|
|
85
|
-
def hash
|
|
86
|
-
[self.class, message, retryable, metadata].hash
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
# Represents a resource-not-found outcome. Carries an optional human-readable
|
|
91
|
-
# +message+ and optional +metadata+.
|
|
92
|
-
class NotFound
|
|
93
|
-
include Predicates
|
|
94
|
-
|
|
95
|
-
attr_reader :message, :metadata
|
|
96
|
-
|
|
97
|
-
def initialize(message: nil, metadata: {})
|
|
98
|
-
@message = message
|
|
99
|
-
@metadata = metadata.freeze
|
|
100
|
-
freeze
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def not_found?
|
|
104
|
-
true
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
def ==(other)
|
|
108
|
-
other.is_a?(NotFound) && message == other.message && metadata == other.metadata
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
alias eql? ==
|
|
112
|
-
|
|
113
|
-
def hash
|
|
114
|
-
[self.class, message, metadata].hash
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module BSV
|
|
4
|
-
module Network
|
|
5
|
-
# @deprecated Use {BSV::Network::Protocols::WoCREST} directly instead.
|
|
6
|
-
# The facade converted clean Result objects into exceptions — every
|
|
7
|
-
# consumer immediately caught them and converted back to data.
|
|
8
|
-
# Use the protocol layer, which returns Result objects natively.
|
|
9
|
-
class WhatsOnChain
|
|
10
|
-
# Raised when deprecated facade classes are instantiated.
|
|
11
|
-
class DeprecationError < StandardError; end
|
|
12
|
-
|
|
13
|
-
MESSAGE = 'BSV::Network::WhatsOnChain is deprecated. ' \
|
|
14
|
-
'Use BSV::Network::Protocols::WoCREST directly — it returns Result objects ' \
|
|
15
|
-
'instead of raising exceptions. See BSV::Network::Protocols::WoCREST for usage.'
|
|
16
|
-
|
|
17
|
-
def self.default(**)
|
|
18
|
-
raise DeprecationError, MESSAGE
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def initialize(*)
|
|
22
|
-
raise DeprecationError, MESSAGE
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|