use crate::offers::payer::{PAYER_METADATA_TYPE, PayerTlvStream, PayerTlvStreamRef};
use crate::offers::refund::{IV_BYTES as REFUND_IV_BYTES, Refund, RefundContents};
use crate::offers::signer;
-use crate::util::ser::{HighZeroBytesDroppedBigSize, Iterable, SeekReadable, WithoutLength, Writeable, Writer};
+use crate::util::ser::{HighZeroBytesDroppedBigSize, Iterable, Readable, SeekReadable, WithoutLength, Writeable, Writer};
use crate::util::string::PrintableString;
#[allow(unused_imports)]
}
}
+impl Readable for Bolt12Invoice {
+ fn read<R: io::Read>(reader: &mut R) -> Result<Self, DecodeError> {
+ let bytes: WithoutLength<Vec<u8>> = Readable::read(reader)?;
+ Self::try_from(bytes.0).map_err(|_| DecodeError::InvalidValue)
+ }
+}
+
impl Writeable for InvoiceContents {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
self.as_tlv_stream().write(writer)