diff --git a/src/api.rs b/src/api.rs
index dc30628e75..1e1f104e80 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -149,12 +149,18 @@ pub struct Inscriptions {
pub page_index: u32,
}
+#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+pub struct RuneInfo {
+ pub id: RuneId,
+ pub pile: Pile,
+}
+
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct Output {
pub address: Option
>,
pub indexed: bool,
pub inscriptions: Vec,
- pub runes: BTreeMap,
+ pub runes: BTreeMap,
pub sat_ranges: Option>,
pub script_pubkey: ScriptBuf,
pub spent: bool,
@@ -169,7 +175,7 @@ impl Output {
outpoint: OutPoint,
tx_out: TxOut,
indexed: bool,
- runes: BTreeMap,
+ runes: BTreeMap,
sat_ranges: Option>,
spent: bool,
) -> Self {
diff --git a/src/index.rs b/src/index.rs
index 94bafd85cb..ef9d53b8f2 100644
--- a/src/index.rs
+++ b/src/index.rs
@@ -1,5 +1,6 @@
use {
self::{
+ api::RuneInfo,
entry::{
Entry, HeaderValue, InscriptionEntry, InscriptionEntryValue, InscriptionIdValue,
OutPointValue, RuneEntryValue, RuneIdValue, SatPointValue, SatRange, TxidValue,
@@ -1007,7 +1008,7 @@ impl Index {
pub fn get_rune_balances_for_output(
&self,
outpoint: OutPoint,
- ) -> Result> {
+ ) -> Result> {
let rtx = self.database.begin_read()?;
let outpoint_to_balances = rtx.open_table(OUTPOINT_TO_RUNE_BALANCES)?;
@@ -1030,10 +1031,13 @@ impl Index {
balances.insert(
entry.spaced_rune,
- Pile {
- amount,
- divisibility: entry.divisibility,
- symbol: entry.symbol,
+ RuneInfo {
+ id,
+ pile: Pile {
+ amount,
+ divisibility: entry.divisibility,
+ symbol: entry.symbol,
+ },
},
);
}
@@ -2276,19 +2280,19 @@ impl Index {
for output in outputs {
let rune_balances = self.get_rune_balances_for_output(*output)?;
- for (spaced_rune, pile) in rune_balances {
+ for (spaced_rune, info) in rune_balances {
runes
.entry(spaced_rune)
.and_modify(|(decimal, _symbol): &mut (Decimal, Option)| {
- assert_eq!(decimal.scale, pile.divisibility);
- decimal.value += pile.amount;
+ assert_eq!(decimal.scale, info.pile.divisibility);
+ decimal.value += info.pile.amount;
})
.or_insert((
Decimal {
- value: pile.amount,
- scale: pile.divisibility,
+ value: info.pile.amount,
+ scale: info.pile.divisibility,
},
- pile.symbol,
+ info.pile.symbol,
));
}
}
diff --git a/src/subcommand/list.rs b/src/subcommand/list.rs
index b790a621e8..1d858c4e6a 100644
--- a/src/subcommand/list.rs
+++ b/src/subcommand/list.rs
@@ -1,4 +1,4 @@
-use super::*;
+use {super::*, crate::api::RuneInfo};
#[derive(Debug, Parser)]
pub(crate) struct List {
@@ -11,7 +11,7 @@ pub struct Output {
pub address: Option>,
pub indexed: bool,
pub inscriptions: Vec,
- pub runes: BTreeMap,
+ pub runes: BTreeMap,
pub sat_ranges: Option>,
pub script_pubkey: String,
pub spent: bool,
diff --git a/src/subcommand/wallet/balance.rs b/src/subcommand/wallet/balance.rs
index 192904a069..64ab5e3a1a 100644
--- a/src/subcommand/wallet/balance.rs
+++ b/src/subcommand/wallet/balance.rs
@@ -36,7 +36,8 @@ pub(crate) fn run(wallet: Wallet) -> SubcommandResult {
}
if is_runic {
- for (spaced_rune, pile) in rune_balances {
+ for (spaced_rune, info) in rune_balances {
+ let pile = info.pile;
runes
.entry(spaced_rune)
.and_modify(|decimal: &mut Decimal| {
diff --git a/src/subcommand/wallet/runics.rs b/src/subcommand/wallet/runics.rs
index 12631e0e70..9845f598e0 100644
--- a/src/subcommand/wallet/runics.rs
+++ b/src/subcommand/wallet/runics.rs
@@ -17,7 +17,8 @@ pub(crate) fn run(wallet: Wallet) -> SubcommandResult {
let rune_balances = wallet.get_runes_balances_in_output(output).ok()?;
let mut runes = BTreeMap::new();
- for (spaced_rune, pile) in rune_balances {
+ for (spaced_rune, info) in rune_balances {
+ let pile = info.pile;
runes
.entry(spaced_rune)
.and_modify(|decimal: &mut Decimal| {
diff --git a/src/subcommand/wallet/send.rs b/src/subcommand/wallet/send.rs
index 8b3d6ba150..3e6a34a50c 100644
--- a/src/subcommand/wallet/send.rs
+++ b/src/subcommand/wallet/send.rs
@@ -194,7 +194,7 @@ impl Send {
output,
balance
.into_iter()
- .map(|(spaced_rune, pile)| (spaced_rune.rune, pile))
+ .map(|(spaced_rune, info)| (spaced_rune.rune, info.pile))
.collect(),
)
})
diff --git a/src/templates/output.rs b/src/templates/output.rs
index 7bcd0c7009..946e37b553 100644
--- a/src/templates/output.rs
+++ b/src/templates/output.rs
@@ -1,4 +1,4 @@
-use super::*;
+use {super::*, crate::api::RuneInfo};
#[derive(Boilerplate)]
pub(crate) struct OutputHtml {
@@ -6,7 +6,7 @@ pub(crate) struct OutputHtml {
pub(crate) inscriptions: Vec,
pub(crate) outpoint: OutPoint,
pub(crate) output: TxOut,
- pub(crate) runes: BTreeMap,
+ pub(crate) runes: BTreeMap,
pub(crate) sat_ranges: Option>,
pub(crate) spent: bool,
}
diff --git a/src/wallet.rs b/src/wallet.rs
index 85c664d94d..149930a357 100644
--- a/src/wallet.rs
+++ b/src/wallet.rs
@@ -1,5 +1,6 @@
use {
super::*,
+ api::RuneInfo,
base64::{self, Engine},
batch::ParentInfo,
bitcoin::secp256k1::{All, Secp256k1},
@@ -260,7 +261,7 @@ impl Wallet {
pub(crate) fn get_runes_balances_in_output(
&self,
output: &OutPoint,
- ) -> Result> {
+ ) -> Result> {
Ok(
self
.output_info
diff --git a/templates/output.html b/templates/output.html
index ffbdde4a37..d787b57f75 100644
--- a/templates/output.html
+++ b/templates/output.html
@@ -16,10 +16,10 @@ Output {{self.outpoint}}
rune |
balance |
-%% for (rune, balance) in &self.runes {
+%% for (rune, info) in &self.runes {
{{ rune }} |
- {{ balance }} |
+ {{ info.pile }} |
%% }