Module: BSV::Wallet::Serializer::DiscoverByIdentityKey
- Defined in:
- lib/bsv/wallet/serializer/discover_by_identity_key.rb
Overview
BRC-103 wire codec for the discover_by_identity_key call (call byte 21).
Args wire layout:
[33 bytes: identity_key compressed pubkey]
[optional_uint32: limit]
[optional_uint32: offset]
[optional_bool: seek_permission]
Result wire layout: see DiscoverCertificatesResult.
Constant Summary collapse
- PUBKEY_SIZE =
33
Class Method Summary collapse
- .deserialize_args(bytes) ⇒ Object
- .deserialize_result(bytes) ⇒ Object
- .serialize_args(args) ⇒ Object
- .serialize_result(result) ⇒ Object
Class Method Details
.deserialize_args(bytes) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/bsv/wallet/serializer/discover_by_identity_key.rb', line 29 def deserialize_args(bytes) r = Wire::Reader.new(bytes) identity_key = r.read_bytes(PUBKEY_SIZE).unpack1('H*') limit = r.read_optional_uint32 offset = r.read_optional_uint32 = r.read_optional_bool { identity_key: identity_key, limit: limit, offset: offset, seek_permission: } end |
.deserialize_result(bytes) ⇒ Object
43 44 45 |
# File 'lib/bsv/wallet/serializer/discover_by_identity_key.rb', line 43 def deserialize_result(bytes) DiscoverCertificatesResult.deserialize(bytes) end |
.serialize_args(args) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/bsv/wallet/serializer/discover_by_identity_key.rb', line 20 def serialize_args(args) w = Wire::Writer.new w.write_bytes([args[:identity_key].to_s].pack('H*')) w.write_optional_uint32(args[:limit]) w.write_optional_uint32(args[:offset]) w.write_optional_bool(args[:seek_permission]) w.buf end |
.serialize_result(result) ⇒ Object
39 40 41 |
# File 'lib/bsv/wallet/serializer/discover_by_identity_key.rb', line 39 def serialize_result(result) DiscoverCertificatesResult.serialize(result) end |