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.
494 495 496 497 |
# File 'lib/bitcoin/builder.rb', line 494 def initialize @type = :address @script = nil end |
Instance Attribute Details
#redeem_script ⇒ Object (readonly)
Returns the value of attribute redeem_script.
492 493 494 |
# File 'lib/bitcoin/builder.rb', line 492 def redeem_script @redeem_script end |
#script ⇒ Object (readonly)
Returns the value of attribute script.
492 493 494 |
# File 'lib/bitcoin/builder.rb', line 492 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.
508 509 510 |
# File 'lib/bitcoin/builder.rb', line 508 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.
501 502 503 |
# File 'lib/bitcoin/builder.rb', line 501 def type(type) @type = type.to_sym end |