Class: Nem::Fee::Transfer

Inherits:
Object
  • Object
show all
Defined in:
lib/nem/fee/transfer.rb

Constant Summary collapse

FEE_FACTOR =
0.05

Instance Method Summary collapse

Constructor Details

#initialize(transaction) ⇒ Transfer

Returns a new instance of Transfer.



6
7
8
# File 'lib/nem/fee/transfer.rb', line 6

def initialize(transaction)
  @transaction = transaction
end

Instance Method Details

#testnet?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/nem/fee/transfer.rb', line 27

def testnet?
  @transaction.network == :testnet
end

#to_iInteger

Returns fee in micro XEM.

Returns:

  • (Integer)

    fee in micro XEM



22
23
24
# File 'lib/nem/fee/transfer.rb', line 22

def to_i
  value.to_i
end

#valueInteger

Returns fee in micro XEM.

Returns:

  • (Integer)

    fee in micro XEM



11
12
13
14
15
16
17
18
19
# File 'lib/nem/fee/transfer.rb', line 11

def value
  tmp = if @transaction.has_mosaics?
    mosaics_fee
  else
    FEE_FACTOR * minimum_fee(@transaction.amount).to_i
  end
  tmp += message_fee if @transaction.has_message?
  tmp * 1_000_000
end