Class: Runar::SDK::Signer

Inherits:
Object
  • Object
show all
Defined in:
lib/runar/sdk/signer.rb

Overview

Abstract base class for signers.

Subclasses must implement all abstract methods.

Direct Known Subclasses

ExternalSigner, LocalSigner, MockSigner

Instance Method Summary collapse

Instance Method Details

#get_addressObject

Return the BSV address string.

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/runar/sdk/signer.rb', line 20

def get_address
  raise NotImplementedError, "#{self.class}#get_address is not implemented"
end

#get_public_keyObject

Return the hex-encoded compressed public key (66 hex chars).

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/runar/sdk/signer.rb', line 15

def get_public_key
  raise NotImplementedError, "#{self.class}#get_public_key is not implemented"
end

#sign(_tx_hex, _input_index, _subscript, _satoshis, _sighash_type = nil) ⇒ String

Sign a transaction input and return the DER-encoded signature with the sighash byte appended, hex-encoded.

Parameters:

  • tx_hex (String)

    raw transaction hex

  • input_index (Integer)

    index of the input being signed

  • subscript (String)

    subscript (locking script) for BIP-143

  • satoshis (Integer)

    value of the input UTXO in satoshis

  • sighash_type (Integer, nil)

    sighash type (defaults to SIGHASH_ALL | SIGHASH_FORKID)

Returns:

  • (String)

    DER + sighash byte, hex-encoded

Raises:

  • (NotImplementedError)


33
34
35
# File 'lib/runar/sdk/signer.rb', line 33

def sign(_tx_hex, _input_index, _subscript, _satoshis, _sighash_type = nil)
  raise NotImplementedError, "#{self.class}#sign is not implemented"
end