Class: Runar::SDK::Provider
- Inherits:
-
Object
- Object
- Runar::SDK::Provider
- Defined in:
- lib/runar/sdk/provider.rb
Overview
Abstract base class for blockchain providers.
Subclasses must implement all abstract methods. Raise NotImplementedError from the default implementations keeps the intent explicit.
Direct Known Subclasses
Instance Method Summary collapse
-
#broadcast(_raw_tx) ⇒ Object
Broadcast a raw transaction hex to the network.
-
#get_contract_utxo(_script_hash) ⇒ Object
Find a UTXO by its script hash (for stateful contract lookup).
-
#get_fee_rate ⇒ Object
Return the current fee rate in satoshis per kilobyte.
-
#get_network ⇒ Object
Return the network this provider is connected to (e.g. ‘mainnet’, ‘testnet’).
-
#get_raw_transaction(_txid) ⇒ Object
Fetch the raw transaction hex by its txid.
-
#get_transaction(_txid) ⇒ Object
Fetch a Transaction by its txid.
-
#get_utxos(_address) ⇒ Object
Return all UTXOs for a given address.
Instance Method Details
#broadcast(_raw_tx) ⇒ Object
Broadcast a raw transaction hex to the network. Returns the txid of the broadcasted transaction.
29 30 31 |
# File 'lib/runar/sdk/provider.rb', line 29 def broadcast(_raw_tx) raise NotImplementedError, "#{self.class}#broadcast is not implemented" end |
#get_contract_utxo(_script_hash) ⇒ Object
Find a UTXO by its script hash (for stateful contract lookup). Returns nil if not found.
40 41 42 |
# File 'lib/runar/sdk/provider.rb', line 40 def get_contract_utxo(_script_hash) raise NotImplementedError, "#{self.class}#get_contract_utxo is not implemented" end |
#get_fee_rate ⇒ Object
Return the current fee rate in satoshis per kilobyte.
50 51 52 |
# File 'lib/runar/sdk/provider.rb', line 50 def get_fee_rate raise NotImplementedError, "#{self.class}#get_fee_rate is not implemented" end |
#get_network ⇒ Object
Return the network this provider is connected to (e.g. ‘mainnet’, ‘testnet’).
45 46 47 |
# File 'lib/runar/sdk/provider.rb', line 45 def get_network raise NotImplementedError, "#{self.class}#get_network is not implemented" end |
#get_raw_transaction(_txid) ⇒ Object
Fetch the raw transaction hex by its txid.
23 24 25 |
# File 'lib/runar/sdk/provider.rb', line 23 def get_raw_transaction(_txid) raise NotImplementedError, "#{self.class}#get_raw_transaction is not implemented" end |
#get_transaction(_txid) ⇒ Object
Fetch a Transaction by its txid.
18 19 20 |
# File 'lib/runar/sdk/provider.rb', line 18 def get_transaction(_txid) raise NotImplementedError, "#{self.class}#get_transaction is not implemented" end |
#get_utxos(_address) ⇒ Object
Return all UTXOs for a given address.
34 35 36 |
# File 'lib/runar/sdk/provider.rb', line 34 def get_utxos(_address) raise NotImplementedError, "#{self.class}#get_utxos is not implemented" end |