Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/api.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use {
super::*,
crate::index::entry::{InscriptionEventEntry, InscriptionEventType},
serde_hex::{SerHex, Strict},
};

Expand Down Expand Up @@ -264,3 +265,42 @@ pub struct AddressInfo {
pub struct Offers {
pub offers: Vec<String>,
}

#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct InscriptionEvents {
pub events: Vec<InscriptionEvent>,
pub more: bool,
pub page: usize,
}

#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct InscriptionEvent {
pub event_type: String,
pub block_height: u32,
pub inscription_id: InscriptionId,
pub txid: Txid,
pub new_satpoint: Option<SatPoint>,
pub old_satpoint: Option<SatPoint>,
pub to_address: Option<String>,
pub from_address: Option<String>,
pub charms: Option<u16>,
}

impl From<InscriptionEventEntry> for InscriptionEvent {
fn from(entry: InscriptionEventEntry) -> Self {
Self {
event_type: match entry.event_type {
InscriptionEventType::Created => "created".to_string(),
InscriptionEventType::Transferred => "transferred".to_string(),
},
block_height: entry.block_height,
inscription_id: entry.inscription_id,
txid: entry.txid,
new_satpoint: entry.new_satpoint,
old_satpoint: entry.old_satpoint,
to_address: entry.to_address,
from_address: entry.from_address,
charms: entry.charms,
}
}
Comment thread
markwu35 marked this conversation as resolved.
}
Loading