Class: Nis::Fee::Transfer

Inherits:
Object
  • Object
show all
Defined in:
lib/nis/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.



5
6
7
# File 'lib/nis/fee/transfer.rb', line 5

def initialize(transaction)
  @transaction = transaction
end

Instance Method Details

#testnet?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/nis/fee/transfer.rb', line 26

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

#to_iInteger

Returns fee in micro XEM.

Returns:

  • (Integer)

    fee in micro XEM



21
22
23
# File 'lib/nis/fee/transfer.rb', line 21

def to_i
  value.to_i
end

#valueInteger

Returns fee in micro XEM.

Returns:

  • (Integer)

    fee in micro XEM



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

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