From 94d59484df3b4f4040b8c8e58fac81038d3b4cf8 Mon Sep 17 00:00:00 2001 From: Anton Gushcha Date: Sat, 1 Mar 2025 00:23:50 +0700 Subject: [PATCH 1/2] Make ParsedEnvelope and Envelope public. Allow people to access ParsedEnvelope::from_transaction --- src/inscriptions.rs | 7 +++++-- src/inscriptions/envelope.rs | 8 ++++---- src/lib.rs | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/inscriptions.rs b/src/inscriptions.rs index dd8f4e4ae4..705c15e425 100644 --- a/src/inscriptions.rs +++ b/src/inscriptions.rs @@ -2,9 +2,12 @@ use super::*; use tag::Tag; -pub(crate) use self::{envelope::ParsedEnvelope, media::Media}; +pub(crate) use self::media::Media; -pub use self::{envelope::Envelope, inscription::Inscription, inscription_id::InscriptionId}; +pub use self::{ + envelope::Envelope, envelope::ParsedEnvelope, envelope::RawEnvelope, inscription::Inscription, + inscription_id::InscriptionId, +}; mod envelope; mod inscription; diff --git a/src/inscriptions/envelope.rs b/src/inscriptions/envelope.rs index e4cb48af99..a4bf5cac71 100644 --- a/src/inscriptions/envelope.rs +++ b/src/inscriptions/envelope.rs @@ -14,8 +14,8 @@ pub(crate) const PROTOCOL_ID: [u8; 3] = *b"ord"; pub(crate) const BODY_TAG: [u8; 0] = []; type Result = std::result::Result; -type RawEnvelope = Envelope>>; -pub(crate) type ParsedEnvelope = Envelope; +pub type RawEnvelope = Envelope>>; +pub type ParsedEnvelope = Envelope; #[derive(Default, PartialEq, Clone, Serialize, Deserialize, Debug, Eq)] pub struct Envelope { @@ -92,7 +92,7 @@ impl From for ParsedEnvelope { } impl ParsedEnvelope { - pub(crate) fn from_transaction(transaction: &Transaction) -> Vec { + pub fn from_transaction(transaction: &Transaction) -> Vec { RawEnvelope::from_transaction(transaction) .into_iter() .map(|envelope| envelope.into()) @@ -101,7 +101,7 @@ impl ParsedEnvelope { } impl RawEnvelope { - pub(crate) fn from_transaction(transaction: &Transaction) -> Vec { + pub fn from_transaction(transaction: &Transaction) -> Vec { let mut envelopes = Vec::new(); for (i, input) in transaction.input.iter().enumerate() { diff --git a/src/lib.rs b/src/lib.rs index d951a5ac98..6c52c1d775 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,7 +21,7 @@ use { inscriptions::{ inscription_id, media::{self, ImageRendering, Media}, - teleburn, ParsedEnvelope, + teleburn, }, into_usize::IntoUsize, option_ext::OptionExt, @@ -96,7 +96,7 @@ pub use self::{ chain::Chain, fee_rate::FeeRate, index::{Index, RuneEntry}, - inscriptions::{Envelope, Inscription, InscriptionId}, + inscriptions::{Envelope, ParsedEnvelope, RawEnvelope, Inscription, InscriptionId}, object::Object, options::Options, wallet::transaction_builder::{Target, TransactionBuilder}, From 06ceaee36a895f9fe4bd059ebd1ffd96f48c9419 Mon Sep 17 00:00:00 2001 From: Anton Gushcha Date: Tue, 4 Mar 2025 20:49:09 +0700 Subject: [PATCH 2/2] Format --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 6c52c1d775..aea15f814f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -96,7 +96,7 @@ pub use self::{ chain::Chain, fee_rate::FeeRate, index::{Index, RuneEntry}, - inscriptions::{Envelope, ParsedEnvelope, RawEnvelope, Inscription, InscriptionId}, + inscriptions::{Envelope, Inscription, InscriptionId, ParsedEnvelope, RawEnvelope}, object::Object, options::Options, wallet::transaction_builder::{Target, TransactionBuilder},