Skip to content

Commit

Permalink
add offset
Browse files Browse the repository at this point in the history
  • Loading branch information
YaroShkvorets committed Jan 3, 2024
1 parent a310415 commit 8261600
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions bitcoin.ordinals/proto/v1/bitcoin.ordinals.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ message Inscription {
string owned_by = 3;
int64 time = 5;
int64 height = 6;
uint32 offset = 7;
string content_type = 8;
uint32 content_length = 9;
bytes content = 10;
Expand Down
3 changes: 2 additions & 1 deletion bitcoin.ordinals/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use substreams_bitcoin::pb::btc::v1::Block;
#[allow(dead_code)]
mod ord;
mod pb;
// use crate::ord::envelope::ParsedEnvelope;

#[substreams::handlers::map]
fn map_inscriptions(block: Block) -> Result<Inscriptions, Error> {
Expand All @@ -25,8 +24,10 @@ fn map_inscriptions(block: Block) -> Result<Inscriptions, Error> {
Some(Inscription {
inscription_id: format!("{}i{}", trx_id, envelope.offset),
inscribed_by: owner.into(),
owned_by: owner.into(),
time: block.time,
height: block.height,
offset: envelope.offset,
content_type: envelope.payload.content_type().unwrap_or_default().to_string(),
content_length: envelope.payload.content_length().unwrap_or_default() as u32,
content: envelope.payload.body().unwrap_or_default().to_vec(),
Expand Down
2 changes: 2 additions & 0 deletions bitcoin.ordinals/src/pb/bitcoin.ordinals.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub struct Inscription {
pub time: i64,
#[prost(int64, tag="6")]
pub height: i64,
#[prost(uint32, tag="7")]
pub offset: u32,
#[prost(string, tag="8")]
pub content_type: ::prost::alloc::string::String,
#[prost(uint32, tag="9")]
Expand Down

0 comments on commit 8261600

Please sign in to comment.