Module: BSV::Wallet::Serializer::GetHeight::Result
- Defined in:
- lib/bsv/wallet/serializer/get_height.rb
Class Method Summary collapse
-
.deserialize(bytes) ⇒ Hash
{ height: Integer }.
-
.serialize(result) ⇒ String
Binary (varint-encoded height).
Class Method Details
.deserialize(bytes) ⇒ Hash
Returns { height: Integer }.
36 37 38 39 40 41 |
# File 'lib/bsv/wallet/serializer/get_height.rb', line 36 def deserialize(bytes) raise BSV::Wallet::InvalidParameterError.new('get_height result', 'at least 1 byte') if bytes.b.empty? height, = BSV::Transaction::VarInt.decode(bytes.b, 0) { height: height } end |
.serialize(result) ⇒ String
Returns binary (varint-encoded height).
30 31 32 |
# File 'lib/bsv/wallet/serializer/get_height.rb', line 30 def serialize(result) BSV::Transaction::VarInt.encode(result[:height].to_i) end |