Class: Nem::Transaction::MosaicSupplyChange

Inherits:
Base
  • Object
show all
Defined in:
lib/nem/transaction/mosaic_supply_change.rb

Overview

Constant Summary collapse

TYPE =

16386 (mosaic supply change transaction)

0x4002
INCREASE =
0x0001
DECREASE =
0x0002

Constants inherited from Base

Base::NETWORK

Instance Attribute Summary collapse

Attributes inherited from Base

#deadline, #fee, #signature, #signer, #timestamp, #type

Instance Method Summary collapse

Methods inherited from Base

#network, #version

Constructor Details

#initialize(mosaic_id, type, delta, timestamp: nil, deadline: nil, network: nil) ⇒ MosaicSupplyChange

Returns a new instance of MosaicSupplyChange.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/nem/transaction/mosaic_supply_change.rb', line 15

def initialize(mosaic_id, type, delta, timestamp: nil, deadline: nil, network: nil)
  @mosaic_id = mosaic_id
  @supply_type = type
  @delta = delta

  @network = network || Nem.default_network
  @type = TYPE
  @fee = Nem::Fee::MosaicSupplyChangeTransfer.new(self)
  @timestamp = timestamp || Time.now
  @deadline = deadline || Time.now + Nem.default_deadline
end

Instance Attribute Details

#deltaInteger

Returns the current value of delta.

Returns:

  • (Integer)

    the current value of delta



7
8
9
# File 'lib/nem/transaction/mosaic_supply_change.rb', line 7

def delta
  @delta
end

#mosaic_idNem::Model::MosaicId

Returns the current value of mosaic_id.

Returns:



7
8
9
# File 'lib/nem/transaction/mosaic_supply_change.rb', line 7

def mosaic_id
  @mosaic_id
end

#supply_typeSymbol

Returns the current value of supply_type.

Returns:

  • (Symbol)

    the current value of supply_type



7
8
9
# File 'lib/nem/transaction/mosaic_supply_change.rb', line 7

def supply_type
  @supply_type
end

Instance Method Details

#to_hashHash

attributes must be CAMEL CASE for NIS params

Returns:

  • (Hash)


29
30
31
32
33
34
35
# File 'lib/nem/transaction/mosaic_supply_change.rb', line 29

def to_hash
  {
    mosaicId: mosaic_id.to_hash,
    supplyType: parse_type,
    delta: delta,
  }
end