Class: Fabric::Transaction
- Inherits:
-
Object
- Object
- Fabric::Transaction
- Defined in:
- lib/fabric/transaction.rb
Instance Attribute Summary collapse
-
#identity ⇒ Object
readonly
Returns the value of attribute identity.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #chaincode_action ⇒ Object
- #endorsements ⇒ Object
- #header ⇒ Object
-
#initialize(identity, request = {}) ⇒ Transaction
constructor
A new instance of Transaction.
- #proposal ⇒ Object
- #responses ⇒ Object
- #transaction ⇒ Object
- #tx_id ⇒ Object
Constructor Details
#initialize(identity, request = {}) ⇒ Transaction
Returns a new instance of Transaction.
7 8 9 10 |
# File 'lib/fabric/transaction.rb', line 7 def initialize(identity, request = {}) @identity = identity @request = request end |
Instance Attribute Details
#identity ⇒ Object (readonly)
Returns the value of attribute identity.
5 6 7 |
# File 'lib/fabric/transaction.rb', line 5 def identity @identity end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
5 6 7 |
# File 'lib/fabric/transaction.rb', line 5 def request @request end |
Instance Method Details
#chaincode_action ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fabric/transaction.rb', line 38 def chaincode_action action = Protos::ChaincodeEndorsedAction.new proposal_response_payload: responses.first.payload, endorsements: endorsements payload = Protos::ChaincodeProposalPayload.decode proposal.proposal.payload payload_no_trans = Protos::ChaincodeProposalPayload.new input: payload.input Protos::ChaincodeActionPayload.new action: action, chaincode_proposal_payload: payload_no_trans.to_proto end |
#endorsements ⇒ Object
24 25 26 |
# File 'lib/fabric/transaction.rb', line 24 def endorsements responses.map(&:endorsement) end |
#header ⇒ Object
28 29 30 |
# File 'lib/fabric/transaction.rb', line 28 def header proposal.header end |
#proposal ⇒ Object
16 17 18 |
# File 'lib/fabric/transaction.rb', line 16 def proposal request[:proposal] end |
#responses ⇒ Object
20 21 22 |
# File 'lib/fabric/transaction.rb', line 20 def responses request[:responses] end |
#transaction ⇒ Object
32 33 34 35 36 |
# File 'lib/fabric/transaction.rb', line 32 def transaction transaction_action = Protos::TransactionAction.new header: proposal.signature_header.to_proto, payload: chaincode_action.to_proto Protos::Transaction.new actions: [transaction_action] end |
#tx_id ⇒ Object
12 13 14 |
# File 'lib/fabric/transaction.rb', line 12 def tx_id proposal.tx_id end |