Class: Straight::AddressProvider::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/straight/address_providers/base.rb

Direct Known Subclasses

Bip32

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gateway) ⇒ Base

Returns a new instance of Base.



7
8
9
# File 'lib/straight/address_providers/base.rb', line 7

def initialize(gateway)
  @gateway = gateway
end

Instance Attribute Details

#gatewayObject (readonly)

Returns the value of attribute gateway.



5
6
7
# File 'lib/straight/address_providers/base.rb', line 5

def gateway
  @gateway
end

Instance Method Details

#new_address(keychain_id:, **args) ⇒ String

Returns a Base58-encoded Bitcoin address to which the payment transaction is expected to arrive. keychain_id is an integer > 0 (hopefully not too large and hopefully the one a user of this class is going to properly increment) that is used to generate a an BIP32 bitcoin address deterministically.

Parameters:

  • args (Hash)

    see GatewayModule::Includable#new_order

Returns:

  • (String)

    bitcoin address

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/straight/address_providers/base.rb', line 17

def new_address(keychain_id:, **args)
  raise NotImplementedError
end

#takes_fees?Boolean

If this method returns true, then address provider is expected to define #new_address_and_amount which returns [‘address’, Integer(amount in satoshi)]

Returns:

  • (Boolean)


23
24
25
# File 'lib/straight/address_providers/base.rb', line 23

def takes_fees?
  false
end