Skip to content

Commit

Permalink
Resolve issues with Ordzaar modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
danadi7 committed May 25, 2024
1 parent 0bc5c23 commit 659cd0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 41 deletions.
3 changes: 3 additions & 0 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2017,12 +2017,15 @@ impl Index {
.map(|address| address.to_string()),
charms: Charm::charms(charms),
children,
content_encoding: inscription.content_encoding_str().map(|s| s.to_string()),
content_length: inscription.content_length(),
content_type: inscription.content_type().map(|s| s.to_string()),
delegate: inscription.delegate(),
effective_content_type: effective_mime_type,
fee: entry.fee,
height: entry.height,
id: entry.id,
inscription_sequence: entry.sequence_number,
next,
number: entry.inscription_number,
parents,
Expand Down
47 changes: 6 additions & 41 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,13 @@ impl Server {
}

let rune = match rune_query {
query::Rune::SpacedRune(spaced_rune) => spaced_rune.rune,
query::Rune::RuneId(rune_id) => index
query::Rune::Spaced(spaced_rune) => spaced_rune.rune,
query::Rune::Id(rune_id) => index
.get_rune_by_id(rune_id)?
.ok_or_not_found(|| format!("rune {rune_id}"))?,
query::Rune::Number(number) => index
.get_rune_by_number(usize::try_from(number).unwrap())?
.ok_or_not_found(|| format!("rune number {number}"))?,
};

let (id, entry, _) = index
Expand Down Expand Up @@ -1682,45 +1685,7 @@ impl Server {
.ok_or_not_found(|| format!("inscription {query}"))?;

Ok(if accept_json {
Json(api::Inscription {
address: info
.output
.as_ref()
.and_then(|o| {
server_config
.chain
.address_from_script(&o.script_pubkey)
.ok()
})
.map(|address| address.to_string()),
charms: Charm::charms(info.charms),
children: info.children,
content_length: info.inscription.content_length(),
content_type: info.inscription.content_type().map(|s| s.to_string()),
effective_content_type: effective_mime_type,
fee: info.entry.fee,
height: info.entry.height,
id: info.entry.id,
next: info.next,
number: info.entry.inscription_number,
parents: info.parents,
previous: info.previous,
rune: info.rune,
sat: info.entry.sat,
satpoint: info.satpoint,
timestamp: timestamp(info.entry.timestamp.into()).timestamp(),
value: info.output.as_ref().map(|o| o.value),

// ---- Ordzaar ----
inscription_sequence: info.entry.sequence_number,
delegate: info.inscription.delegate(),
content_encoding: info
.inscription
.content_encoding_str()
.map(|s| s.to_string()),
// ---- Ordzaar ----
})
.into_response()
Json(info).into_response()
} else {
InscriptionHtml {
chain: server_config.chain,
Expand Down

0 comments on commit 659cd0a

Please sign in to comment.