Class: Nem::Transaction::MultisigAggregateModification
- Defined in:
- lib/nem/transaction/multisig_aggregate_modification.rb
Constant Summary collapse
- TYPE =
4097 (multisig aggregate modification transfer transaction)
0x1001
Constants inherited from Base
Instance Attribute Summary collapse
-
#min_cosignatories ⇒ Interger
The current value of min_cosignatories.
-
#modifications ⇒ Array <Nem::Model::MultisigCosignatoryModification>
The current value of modifications.
-
#relative_change ⇒ Interger
The current value of relative_change.
Attributes inherited from Base
#deadline, #fee, #signature, #signer, #timestamp, #type
Instance Method Summary collapse
- #has_relative_change? ⇒ Boolean
-
#initialize(modifications, relative_change = 0, timestamp: nil, deadline: nil, network: nil) ⇒ MultisigAggregateModification
constructor
A new instance of MultisigAggregateModification.
-
#to_hash ⇒ Hash
attributes must be CAMEL CASE for NIS params Modifications need to be sorted by address.
- #version ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(modifications, relative_change = 0, timestamp: nil, deadline: nil, network: nil) ⇒ MultisigAggregateModification
Returns a new instance of MultisigAggregateModification.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/nem/transaction/multisig_aggregate_modification.rb', line 11 def initialize(modifications, relative_change = 0, timestamp: nil, deadline: nil, network: nil) @modifications = modifications @relative_change = relative_change @network = network || Nem.default_network @type = TYPE @fee = Nem::Fee::MultisigAggregateModification.new(self) @timestamp = || Time.now @deadline = deadline || Time.now + Nem.default_deadline end |
Instance Attribute Details
#min_cosignatories ⇒ Interger
Returns the current value of min_cosignatories.
6 7 8 |
# File 'lib/nem/transaction/multisig_aggregate_modification.rb', line 6 def min_cosignatories @min_cosignatories end |
#modifications ⇒ Array <Nem::Model::MultisigCosignatoryModification>
Returns the current value of modifications.
6 7 8 |
# File 'lib/nem/transaction/multisig_aggregate_modification.rb', line 6 def modifications @modifications end |
#relative_change ⇒ Interger
Returns the current value of relative_change.
6 7 8 |
# File 'lib/nem/transaction/multisig_aggregate_modification.rb', line 6 def relative_change @relative_change end |
Instance Method Details
#has_relative_change? ⇒ Boolean
22 23 24 |
# File 'lib/nem/transaction/multisig_aggregate_modification.rb', line 22 def has_relative_change? relative_change != 0 end |
#to_hash ⇒ Hash
attributes must be CAMEL CASE for NIS params Modifications need to be sorted by address. if not it will occur FAILURE_SIGNATURE_NOT_VERIFIABLE
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/nem/transaction/multisig_aggregate_modification.rb', line 34 def to_hash tmp = { minCosignatories: { relativeChange: relative_change } } tmp[:modifications] = modifications .sort_by { |mo| Nem::Unit::Address.from_public_key(mo.cosignatory_account) } .map(&:to_hash) tmp end |
#version ⇒ Object
26 27 28 |
# File 'lib/nem/transaction/multisig_aggregate_modification.rb', line 26 def version network(hex: true) + (has_relative_change? ? 2 : 1) end |