Class: Nem::Transaction::ProvisionNamespace

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

Constant Summary collapse

TYPE =

8193 (provision namespace transaction)

0x2001

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(new_part, parent = nil, timestamp: nil, deadline: nil, network: nil) ⇒ ProvisionNamespace

Returns a new instance of ProvisionNamespace.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/nem/transaction/provision_namespace.rb', line 12

def initialize(new_part, parent = nil, timestamp: nil, deadline: nil, network: nil)
  @new_part = new_part
  @parent = parent
  @rental_fee = rental[:fee]
  @rental_fee_sink = rental[:sink]

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

Instance Attribute Details

#new_partString

Returns the current value of new_part.

Returns:

  • (String)

    the current value of new_part



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

def new_part
  @new_part
end

#parentString

Returns the current value of parent.

Returns:

  • (String)

    the current value of parent



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

def parent
  @parent
end

#rental_feeInteger

Returns the current value of rental_fee.

Returns:

  • (Integer)

    the current value of rental_fee



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

def rental_fee
  @rental_fee
end

#rental_fee_sinkString

Returns the current value of rental_fee_sink.

Returns:

  • (String)

    the current value of rental_fee_sink



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

def rental_fee_sink
  @rental_fee_sink
end

Instance Method Details

#root?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/nem/transaction/provision_namespace.rb', line 26

def root?
  !!(@parent == nil)
end

#sub?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/nem/transaction/provision_namespace.rb', line 31

def sub?
  !!(@parent && @new_part)
end

#to_hashHash

attributes must be CAMEL CASE for NIS params

Returns:

  • (Hash)


37
38
39
40
41
42
43
44
# File 'lib/nem/transaction/provision_namespace.rb', line 37

def to_hash
  {
    newPart: new_part,
    parent: parent,
    rentalFeeSink: rental_fee_sink,
    rentalFee: rental_fee
  }
end