SHOWING: First 60
)
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>();
let tx = &rpc_server.mempool()[0];
let mut fee = 0;
for input in &tx.input {
fee += rpc_server
.get_utxo_amount(&input.previous_output)
.unwrap()
.to_sat();
}
for output in &tx.output {
fee -= output.value;
}
let fee_rate = fee as f64 / tx.vsize() as f64;
assert!(f64::abs(fee_rate - 13.3) < 0.1);
assert_eq!(
output.transaction,
"0000000000000000000000000000000000000000000000000000000000000000"
.parse()
.unwrap()
);
assert_eq!(
rpc_server.sent(),
&[Sent {
amount: 1.0,
address: "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"
.parse::<Address<NetworkUnchecked>>()
.unwrap()
.assume_checked(),
locked: Vec::new(),
}]
);
}
#[test]
fn send_btc_locks_inscriptions() {
let rpc_server = test_bitcoincore_rpc::spawn();
create_wallet(&rpc_server);
rpc_server.mine_blocks(1);
let (_, reveal) = inscribe(&rpc_server);
let output =
#45,022,472text "index_path": ".*\.redb",
"leaf_pages": \d+,
"metadata_bytes": \d+,
"outputs_traversed": 0,
"page_size": \d+,
"sat_ranges": 0,
"stored_bytes": \d+,
"tables": .*,
"transactions": \[
\{
"starting_block_count": 0,
"starting_timestamp": \d+
\}
\],
"tree_height": \d+,
"utxos_indexed": 0
\}
"#,
)
.run_and_extract_stdout();
}
#[test]
fn transactions() {
let rpc_server = test_bitcoincore_rpc::spawn();
let tempdir = TempDir::new().unwrap();
let index_path = tempdir.path().join("index.redb");
assert!(CommandBuilder::new(format!(
"--index {} index info --transactions",
index_path.display()
))
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Vec<TransactionsOutput>>()
.is_empty());
rpc_server.mine_blocks(10);
let output = CommandBuilder::new(format!(
"--index {} index info --transactions",
index_path.display()
))
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Vec<TransactionsOutput>>();
assert_eq!(output[0].start, 0);
#44,996,647text .rpc_server(&rpc_server)
.expected_exit_code(1)
.stderr_regex("error: individual inscription destinations cannot be set in shared-output mode\n")
.run_and_extract_stdout();
}
#[test]
fn batch_inscribe_works_with_some_destinations_set_and_others_not() {
let rpc_server = test_bitcoincore_rpc::spawn();
rpc_server.mine_blocks(1);
assert_eq!(rpc_server.descriptors().len(), 0);
create_wallet(&rpc_server);
let output = CommandBuilder::new("wallet inscribe --batch batch.yaml --fee-rate 55")
.write("inscription.txt", "Hello World")
.write("tulip.png", [0; 555])
.write("meow.wav", [0; 2048])
.write(
"batch.yaml",
"mode: separate-outputs\ninscriptions:\n- file: inscription.txt\n destination: bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4\n- file: tulip.png\n- file: meow.wav\n destination: bc1pxwww0ct9ue7e8tdnlmug5m2tamfn7q06sahstg39ys4c9f3340qqxrdu9k\n"
)
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Inscribe>();
rpc_server.mine_blocks(1);
#44,991,208text