ord/subcommand/wallet/
inscriptions.rs1use super::*;
2
3#[derive(Serialize, Deserialize)]
4pub struct Output {
5 pub inscription: InscriptionId,
6 pub location: SatPoint,
7 pub explorer: String,
8 pub postage: u64,
9}
10
11pub(crate) fn run(wallet: Wallet) -> SubcommandResult {
12 let explorer = match wallet.chain() {
13 Chain::Mainnet => "https://ordinals.com/inscription/",
14 Chain::Regtest => "http://localhost/inscription/",
15 Chain::Signet => "https://signet.ordinals.com/inscription/",
16 Chain::Testnet => "https://testnet.ordinals.com/inscription/",
17 };
18
19 let mut output = Vec::new();
20
21 for (location, inscriptions) in wallet.inscriptions() {
22 if let Some(txout) = wallet.utxos().get(&location.outpoint) {
23 for inscription in inscriptions {
24 output.push(Output {
25 location: *location,
26 inscription: *inscription,
27 explorer: format!("{explorer}{inscription}"),
28 postage: txout.value,
29 })
30 }
31 }
32 }
33
34 Ok(Some(Box::new(output)))
35}