class Nem::Transaction::MosaicSupplyChange

@attr [Nem::Model::MosaicId] mosaic_id @attr [Symbol] supply_type @attr [Integer] delta @see nemproject.github.io/#mosaicSupplyChangeTransaction

Constants

DECREASE
INCREASE
TYPE

Attributes

delta[RW]
mosaic_id[RW]
supply_type[RW]

Public Class Methods

new(mosaic_id, type, delta, timestamp: nil, deadline: nil, network: nil) click to toggle source
# 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

Public Instance Methods

to_hash() click to toggle source

attributes must be CAMEL CASE for NIS params @return [Hash]

# File lib/nem/transaction/mosaic_supply_change.rb, line 29
def to_hash
  {
    mosaicId: mosaic_id.to_hash,
    supplyType: parse_type,
    delta: delta,
  }
end

Private Instance Methods

parse_type() click to toggle source
# File lib/nem/transaction/mosaic_supply_change.rb, line 39
def parse_type
  case type
  when :increase  then INCREASE
  when :descrease then DECREASE
    else raise "Not implemented type: #{type}"
  end
end