Class: PolarLoop::Types::BatchResult
- Inherits:
-
Struct
- Object
- Struct
- PolarLoop::Types::BatchResult
- Defined in:
- lib/polarloop/types/batch_result.rb
Instance Attribute Summary collapse
-
#mandate_id ⇒ Object
Returns the value of attribute mandate_id.
-
#reason ⇒ Object
Returns the value of attribute reason.
-
#success ⇒ Object
Returns the value of attribute success.
Class Method Summary collapse
Instance Attribute Details
#mandate_id ⇒ Object
Returns the value of attribute mandate_id
5 6 7 |
# File 'lib/polarloop/types/batch_result.rb', line 5 def mandate_id @mandate_id end |
#reason ⇒ Object
Returns the value of attribute reason
5 6 7 |
# File 'lib/polarloop/types/batch_result.rb', line 5 def reason @reason end |
#success ⇒ Object
Returns the value of attribute success
5 6 7 |
# File 'lib/polarloop/types/batch_result.rb', line 5 def success @success end |
Class Method Details
.from_abi_array(tuples) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/polarloop/types/batch_result.rb', line 11 def self.from_abi_array(tuples) tuples.map do |tuple| new( mandate_id: to_hex_bytes32(tuple[0]), success: tuple[1], reason: tuple[2] ) end end |
.to_hex_bytes32(binary) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/polarloop/types/batch_result.rb', line 21 def self.to_hex_bytes32(binary) if binary.is_a?(String) && binary.start_with?("0x") binary.downcase elsif binary.is_a?(String) "0x" + binary.unpack1("H*") else "0x" + binary.to_s(16).rjust(64, "0") end end |