Class: Runar::SDK::Provider

Inherits:
Object
  • Object
show all
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

MockProvider, RPCProvider

Instance Method Summary collapse

Instance Method Details

#broadcast(_raw_tx) ⇒ Object

Broadcast a raw transaction hex to the network. Returns the txid of the broadcasted transaction.

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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_rateObject

Return the current fee rate in satoshis per kilobyte.

Raises:

  • (NotImplementedError)


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_networkObject

Return the network this provider is connected to (e.g. ‘mainnet’, ‘testnet’).

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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