Class: Coinbase::StakingOperation

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ StakingOperation

Returns a new StakingOperation object.

Parameters:



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

#transactionsArray<Coinbase::Transaction> (readonly)

The list of current transactions associated with the operation

Returns:



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

Parameters:

  • key (Eth::Key)

    The key to sign the transactions with



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