Module: BSV::Wallet::Pushable
- Defined in:
- lib/bsv/wallet/pushable.rb
Overview
Mixin contract for entities that can be pushed to the network.
Include this module in any model that needs to submit data to a network service (e.g. broadcasting a transaction via ARC). The including class must override every method — the defaults raise NotImplementedError to enforce the contract.
Designed to work alongside Fetchable. When a class includes both, only one write! method exists — the class must provide its own override that handles both push and fetch response shapes.
Instance Method Summary collapse
-
#needs_push? ⇒ Boolean
Whether this entity currently needs pushing.
-
#push_command ⇒ Symbol
The protocol command to invoke (e.g.
:broadcast). -
#push_payload ⇒ Object
The payload to send (e.g. raw_tx binary).
-
#write!(response) ⇒ Object
Update self from the network response after a successful push.
Instance Method Details
#needs_push? ⇒ Boolean
Whether this entity currently needs pushing.
40 41 42 |
# File 'lib/bsv/wallet/pushable.rb', line 40 def needs_push? raise NotImplementedError, "#{self.class}#needs_push? not implemented" end |
#push_command ⇒ Symbol
The protocol command to invoke (e.g. :broadcast).
19 20 21 |
# File 'lib/bsv/wallet/pushable.rb', line 19 def push_command raise NotImplementedError, "#{self.class}#push_command not implemented" end |
#push_payload ⇒ Object
The payload to send (e.g. raw_tx binary).
26 27 28 |
# File 'lib/bsv/wallet/pushable.rb', line 26 def push_payload raise NotImplementedError, "#{self.class}#push_payload not implemented" end |
#write!(response) ⇒ Object
Update self from the network response after a successful push.
33 34 35 |
# File 'lib/bsv/wallet/pushable.rb', line 33 def write!(response) raise NotImplementedError, "#{self.class}#write! not implemented" end |