From 82616005d68b6822c01e0b32019712bba05e91fc Mon Sep 17 00:00:00 2001 From: YaroShkvorets Date: Wed, 3 Jan 2024 16:56:17 -0500 Subject: [PATCH] add offset --- bitcoin.ordinals/proto/v1/bitcoin.ordinals.proto | 1 + bitcoin.ordinals/src/lib.rs | 3 ++- bitcoin.ordinals/src/pb/bitcoin.ordinals.v1.rs | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bitcoin.ordinals/proto/v1/bitcoin.ordinals.proto b/bitcoin.ordinals/proto/v1/bitcoin.ordinals.proto index 37873c7..7544349 100644 --- a/bitcoin.ordinals/proto/v1/bitcoin.ordinals.proto +++ b/bitcoin.ordinals/proto/v1/bitcoin.ordinals.proto @@ -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; diff --git a/bitcoin.ordinals/src/lib.rs b/bitcoin.ordinals/src/lib.rs index e738948..94f1542 100644 --- a/bitcoin.ordinals/src/lib.rs +++ b/bitcoin.ordinals/src/lib.rs @@ -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 { @@ -25,8 +24,10 @@ fn map_inscriptions(block: Block) -> Result { 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(), diff --git a/bitcoin.ordinals/src/pb/bitcoin.ordinals.v1.rs b/bitcoin.ordinals/src/pb/bitcoin.ordinals.v1.rs index b1272c0..c30bb2c 100644 --- a/bitcoin.ordinals/src/pb/bitcoin.ordinals.v1.rs +++ b/bitcoin.ordinals/src/pb/bitcoin.ordinals.v1.rs @@ -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")]