Class: Bitcoin::Builder::ScriptBuilder
- Inherits:
-
Object
- Object
- Bitcoin::Builder::ScriptBuilder
- Defined in:
- lib/bitcoin/builder.rb
Overview
Create a Bitcoin::Script used by TxOutBuilder#script.
Instance Attribute Summary collapse
-
#redeem_script ⇒ Object
readonly
Returns the value of attribute redeem_script.
-
#script ⇒ Object
readonly
Returns the value of attribute script.
Instance Method Summary collapse
-
#initialize ⇒ ScriptBuilder
constructor
A new instance of ScriptBuilder.
-
#recipient(*data) ⇒ Object
Recipient(s) of the script.
-
#type(type) ⇒ Object
Script type (:pubkey, :address/hash160, :multisig).
Constructor Details
#initialize ⇒ ScriptBuilder
Returns a new instance of ScriptBuilder.
410 411 412 413 |
# File 'lib/bitcoin/builder.rb', line 410 def initialize @type = :address @script = nil end |
Instance Attribute Details
#redeem_script ⇒ Object (readonly)
Returns the value of attribute redeem_script.
408 409 410 |
# File 'lib/bitcoin/builder.rb', line 408 def redeem_script @redeem_script end |
#script ⇒ Object (readonly)
Returns the value of attribute script.
408 409 410 |
# File 'lib/bitcoin/builder.rb', line 408 def script @script end |
Instance Method Details
#recipient(*data) ⇒ Object
Recipient(s) of the script. Depending on the #type, this should be an address, a hash160 pubkey, or an array of multisig pubkeys.
424 425 426 |
# File 'lib/bitcoin/builder.rb', line 424 def recipient *data @script, @redeem_script = *Script.send("to_#{@type}_script", *data) end |
#type(type) ⇒ Object
Script type (:pubkey, :address/hash160, :multisig). Defaults to :address.
417 418 419 |
# File 'lib/bitcoin/builder.rb', line 417 def type type @type = type.to_sym end |