pub enum OrdParser {
Ordinal(Nft),
Brc20(Brc20),
}
Expand description
Encapsulates inscription parsing logic for both Ordinals and BRC20s.
Variants§
Implementations§
Source§impl OrdParser
impl OrdParser
Sourcepub fn parse_all(tx: &Transaction) -> OrdResult<Vec<(InscriptionId, Self)>>
pub fn parse_all(tx: &Transaction) -> OrdResult<Vec<(InscriptionId, Self)>>
Parses all inscriptions from a given transaction and categorizes them as either Self::Brc20
or Self::Ordinal
.
This function extracts all inscription data from the transaction, attempts to parse each inscription, and returns a vector of categorized inscriptions with their corresponding IDs.
§Errors
Will return an error if any inscription data cannot be parsed correctly, or if no valid inscriptions are found in the transaction.
Sourcepub fn parse_one(
tx: &Transaction,
index: usize,
) -> OrdResult<(InscriptionId, Self)>
pub fn parse_one( tx: &Transaction, index: usize, ) -> OrdResult<(InscriptionId, Self)>
Parses a single inscription from a transaction at a specified index, returning the parsed inscription along with its ID.
This method specifically targets one inscription identified by its index within the transaction’s inputs.
It extracts the inscription data, attempts to parse it, and categorizes it as either Self::Brc20
or Self::Ordinal
.
§Errors
Returns an error if the inscription data at the specified index cannot be parsed, if there is no data at the specified index, or if the data at the index does not contain a valid payload.