Class: Fabric::Status
- Inherits:
-
Object
- Object
- Fabric::Status
- Defined in:
- lib/fabric/entities/status.rb
Overview
Status of a transaction that is to be committed to the ledger.
Constant Summary collapse
- TRANSACTION_STATUSES =
::Protos::TxValidationCode.constants.map(&::Protos::TxValidationCode.method(:const_get)) .collect do |i| [::Protos::TxValidationCode.lookup(i), i] end.to_h
Instance Attribute Summary collapse
-
#block_number ⇒ Integer
readonly
Block number in which the transaction committed.
-
#code ⇒ Integer
readonly
Transaction status.
-
#successful ⇒ Boolean
readonly
true
if the transaction committed successfully; otherwisefalse
. -
#transaction_id ⇒ String
readonly
The ID of the transaction.
Instance Method Summary collapse
-
#initialize(transaction_id, block_number, code) ⇒ Status
constructor
A new instance of Status.
Constructor Details
#initialize(transaction_id, block_number, code) ⇒ Status
Returns a new instance of Status.
25 26 27 28 29 30 |
# File 'lib/fabric/entities/status.rb', line 25 def initialize(transaction_id, block_number, code) @transaction_id = transaction_id @block_number = block_number @code = code @successful = @code == TRANSACTION_STATUSES[:VALID] end |
Instance Attribute Details
#block_number ⇒ Integer (readonly)
Returns Block number in which the transaction committed.
14 15 16 |
# File 'lib/fabric/entities/status.rb', line 14 def block_number @block_number end |
#code ⇒ Integer (readonly)
Returns Transaction status.
17 18 19 |
# File 'lib/fabric/entities/status.rb', line 17 def code @code end |
#successful ⇒ Boolean (readonly)
Returns true
if the transaction committed successfully; otherwise false
.
20 21 22 |
# File 'lib/fabric/entities/status.rb', line 20 def successful @successful end |
#transaction_id ⇒ String (readonly)
Returns The ID of the transaction.
23 24 25 |
# File 'lib/fabric/entities/status.rb', line 23 def transaction_id @transaction_id end |