Class: Coinbase::StakingOperation
- Inherits:
-
Object
- Object
- Coinbase::StakingOperation
- Defined in:
- lib/coinbase/staking_operation.rb
Overview
A representation of a staking operation (stake, unstake, claim rewards, etc). It may have multiple steps with some being transactions to sign, and others to wait.
Instance Attribute Summary collapse
-
#transactions ⇒ Array<Coinbase::Transaction>
readonly
The list of current transactions associated with the operation.
Instance Method Summary collapse
-
#initialize(model) ⇒ StakingOperation
constructor
Returns a new StakingOperation object.
-
#sign(key) ⇒ Object
Signs the Open Transactions with the provided key.
Constructor Details
#initialize(model) ⇒ StakingOperation
Returns a new StakingOperation object.
13 14 15 16 17 18 19 |
# File 'lib/coinbase/staking_operation.rb', line 13 def initialize(model) @model = model @transactions = model.transactions.map do |transaction_model| Transaction.new(transaction_model) end end |
Instance Attribute Details
#transactions ⇒ Array<Coinbase::Transaction> (readonly)
The list of current transactions associated with the operation
8 9 10 |
# File 'lib/coinbase/staking_operation.rb', line 8 def transactions @transactions end |
Instance Method Details
#sign(key) ⇒ Object
Signs the Open Transactions with the provided key
23 24 25 26 27 |
# File 'lib/coinbase/staking_operation.rb', line 23 def sign(key) transactions.each do |transaction| transaction.sign(key) unless transaction.signed? end end |