Class: Fabric::TransactionInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/fabric/transaction_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identity) ⇒ TransactionInfo

Returns a new instance of TransactionInfo.



5
6
7
8
9
# File 'lib/fabric/transaction_info.rb', line 5

def initialize(identity)
  @identity = identity
  @nonce = identity.crypto_suite.generate_nonce
  @tx_id = identity.crypto_suite.hexdigest(nonce + identity.serialize)
end

Instance Attribute Details

#identityObject (readonly)

Returns the value of attribute identity.



3
4
5
# File 'lib/fabric/transaction_info.rb', line 3

def identity
  @identity
end

#nonceObject (readonly)

Returns the value of attribute nonce.



3
4
5
# File 'lib/fabric/transaction_info.rb', line 3

def nonce
  @nonce
end

#tx_idObject (readonly)

Returns the value of attribute tx_id.



3
4
5
# File 'lib/fabric/transaction_info.rb', line 3

def tx_id
  @tx_id
end

Instance Method Details

#nonce_hexObject



11
12
13
# File 'lib/fabric/transaction_info.rb', line 11

def nonce_hex
  identity.crypto_suite.encode_hex nonce
end

#signature_headerObject



15
16
17
# File 'lib/fabric/transaction_info.rb', line 15

def signature_header
  ::Common::SignatureHeader.new creator: identity.serialize, nonce: nonce
end