-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.rs
39 lines (31 loc) · 961 Bytes
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use ordi::*;
fn main() -> anyhow::Result<()> {
let _ = dotenv::dotenv();
let mut ordi = Ordi::new(Options::default())?;
ordi.when_inscribe(|entry| {
println!(
"inscribe {}, {} at {}:{}.",
entry.id, &entry.inscription_id, &entry.txid, entry.vout
);
});
ordi.when_transfer(|entry| {
println!(
"transfer {} from {}:{} to {}:{}:{}.",
entry.inscription_id,
entry.from_output,
entry.from_offset,
entry.txid,
entry.vout,
entry.offset
);
});
// If index_previous_output_value is set true,
// dump-event would reindex utxos until height 767430.
// else use rpc to get utxo like ord.
if std::env::var("index_previous_output_value")? == "true" {
ordi.index_output_value()?;
}
ordi.start().expect("Error happened when ordi is running.");
ordi.close();
Ok(())
}