Skip to content

Commit

Permalink
Adapt templates and some other tests to Qtum
Browse files Browse the repository at this point in the history
  • Loading branch information
lateminer committed Jan 23, 2024
1 parent 5778d96 commit 8367fed
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 43 deletions.
4 changes: 2 additions & 2 deletions batch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ inscriptions:
metus est et odio. Nullam venenatis, urna et molestie vestibulum, orci
mi efficitur risus, eu malesuada diam lorem sed velit. Nam fermentum
dolor et luctus euismod.
destination: bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4
destination: qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv

- file: token.json
metaprotocol: brc-20

- file: tulip.png
metadata:
author: Satoshi Nakamoto
destination: bc1pdqrcrxa8vx6gy75mfdfj84puhxffh4fq46h3gkp6jxdd0vjcsdyspfxcv6
destination: qc1p89p24u0pva8sr7a8kf8ljqvr7fs8smqg9hpjusxelr8dh9ke0v7s4h94rf
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/transaction_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fuzz_target!(|input: Input| {
);
}

let recipient = "bc1pdqrcrxa8vx6gy75mfdfj84puhxffh4fq46h3gkp6jxdd0vjcsdyspfxcv6"
let recipient = "qc1p89p24u0pva8sr7a8kf8ljqvr7fs8smqg9hpjusxelr8dh9ke0v7s4h94rf"
.parse::<Address<NetworkUnchecked>>()
.unwrap()
.assume_checked();
Expand Down
8 changes: 4 additions & 4 deletions src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,17 @@ mod tests {
]),
);
case(
"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
"qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv",
Object::Address(
"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"
"qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv"
.parse()
.unwrap(),
),
);
case(
"BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4",
"QC1QQ37JR27G4037WDFQTAD2T9HFD6M2D5W6FKA3UV",
Object::Address(
"BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4"
"QC1QQ37JR27G4037WDFQTAD2T9HFD6M2D5W6FKA3UV"
.parse()
.unwrap(),
),
Expand Down
4 changes: 2 additions & 2 deletions src/subcommand/wallet/inscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ inscriptions:
reveal_fee_rate: fee_rate,
no_limit: false,
reinscribe: false,
postage: Amount::from_sat(10_000),
postage: Amount::from_sat(20_000),
mode,
..Default::default()
}
Expand Down Expand Up @@ -1013,7 +1013,7 @@ inscriptions:
reveal_fee_rate: 4.0.try_into().unwrap(),
no_limit: false,
reinscribe: false,
postage: Amount::from_sat(10_000),
postage: Amount::from_sat(20_000),
mode: Mode::SharedOutput,
..Default::default()
}
Expand Down
1 change: 1 addition & 0 deletions src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ mod tests {
<script src=/static/index.js defer></script>
</head>
<body>
.*
<header>
<nav>
<a href=/ title=home>Qtum Ordinals<sup>beta</sup></a>
Expand Down
4 changes: 2 additions & 2 deletions src/templates/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ mod tests {
<dt>hash</dt><dd class=monospace>[[:xdigit:]]{64}</dd>
<dt>target</dt><dd class=monospace>[[:xdigit:]]{64}</dd>
<dt>timestamp</dt><dd><time>2017-09-06 10:50:29 UTC</time></dd>
<dt>size</dt><dd>285</dd>
<dt>weight</dt><dd>1140</dd>
<dt>size</dt><dd>375</dd>
<dt>weight</dt><dd>1500</dd>
</dl>
.*
prev
Expand Down
2 changes: 1 addition & 1 deletion src/templates/inscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ mod tests {
<dl>
.*
<dt>address</dt>
<dd class=monospace>bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4</dd>
<dd class=monospace>qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv</dd>
<dt>output value</dt>
<dd>1</dd>
.*
Expand Down
4 changes: 2 additions & 2 deletions src/templates/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ mod tests {
<dl>
<dt>value</dt><dd>3</dd>
<dt>script pubkey</dt><dd class=monospace>OP_DUP OP_HASH160 OP_PUSHBYTES_20 0{40} OP_EQUALVERIFY OP_CHECKSIG</dd>
<dt>address</dt><dd class=monospace>1111111111111111111114oLvT2</dd>
<dt>address</dt><dd class=monospace>QLbz7JHiBTspS962RLKV8GndWFwiJNvEPz</dd>
<dt>transaction</dt><dd><a class=monospace href=/tx/1{64}>1{64}</a></dd>
</dl>
<h2>2 Sat Ranges</h2>
Expand Down Expand Up @@ -143,7 +143,7 @@ mod tests {
<dl>
<dt>value</dt><dd>3</dd>
<dt>script pubkey</dt><dd class=monospace>OP_DUP OP_HASH160 OP_PUSHBYTES_20 0{40} OP_EQUALVERIFY OP_CHECKSIG</dd>
<dt>address</dt><dd class=monospace>1111111111111111111114oLvT2</dd>
<dt>address</dt><dd class=monospace>QLbz7JHiBTspS962RLKV8GndWFwiJNvEPz</dd>
<dt>transaction</dt><dd><a class=monospace href=/tx/1{64}>1{64}</a></dd>
</dl>
"
Expand Down
2 changes: 1 addition & 1 deletion src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub(crate) fn satpoint(n: u64, offset: u64) -> SatPoint {
}

pub(crate) fn address() -> Address {
"qc1p6p8u0j2z4p339suwg5dygkfxjxft5nkuxrmh23s39rvavlwsmhpqx4fc0w"
"qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv"
.parse::<Address<NetworkUnchecked>>()
.unwrap()
.assume_checked()
Expand Down
4 changes: 1 addition & 3 deletions templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
<img src="/static/qtum_logo.png" alt="Qtum" width="50">
<span style="margin-left: 10px;">Qtum Ordinals explorer</span>
</a>
</div>

</div>
<header>
<nav>

<a href=/ title=home>Qtum Ordinals<sup>{{ self.superscript() }}</sup></a>
<a href=/inscriptions title=inscriptions><img class=icon src=/static/images.svg></a>
<a href=/collections title=collections><img class=icon src=/static/diagram-project.svg></a>
Expand Down
10 changes: 5 additions & 5 deletions tests/wallet/inscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1358,9 +1358,9 @@ fn batch_inscribe_fails_if_invalid_network_destination_address() {

CommandBuilder::new("--regtest wallet inscribe --fee-rate 2.1 --batch batch.yaml")
.write("inscription.txt", "Hello World")
.write("batch.yaml", "mode: separate-outputs\ninscriptions:\n- file: inscription.txt\n destination: bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4")
.write("batch.yaml", "mode: separate-outputs\ninscriptions:\n- file: inscription.txt\n destination: qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv")
.rpc_server(&rpc_server)
.stderr_regex("error: address bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 belongs to network bitcoin which is different from required regtest\n")
.stderr_regex("error: address qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv belongs to network bitcoin which is different from required regtest\n")
.expected_exit_code(1)
.run_and_extract_stdout();
}
Expand All @@ -1377,7 +1377,7 @@ fn batch_inscribe_fails_with_shared_output_and_destination_set() {
CommandBuilder::new("wallet inscribe --fee-rate 2.1 --batch batch.yaml")
.write("inscription.txt", "Hello World")
.write("tulip.png", "")
.write("batch.yaml", "mode: shared-output\ninscriptions:\n- file: inscription.txt\n destination: bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4\n- file: tulip.png")
.write("batch.yaml", "mode: shared-output\ninscriptions:\n- file: inscription.txt\n destination: qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv\n- file: tulip.png")
.rpc_server(&rpc_server)
.expected_exit_code(1)
.stderr_regex("error: individual inscription destinations cannot be set in shared-output mode\n")
Expand All @@ -1399,7 +1399,7 @@ fn batch_inscribe_works_with_some_destinations_set_and_others_not() {
.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"
"mode: separate-outputs\ninscriptions:\n- file: inscription.txt\n destination: qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv\n- file: tulip.png\n- file: meow.wav\n destination: bc1pxwww0ct9ue7e8tdnlmug5m2tamfn7q06sahstg39ys4c9f3340qqxrdu9k\n"
)
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Inscribe>();
Expand All @@ -1414,7 +1414,7 @@ fn batch_inscribe_works_with_some_destinations_set_and_others_not() {
format!("/inscription/{}", output.inscriptions[0].id),
".*
<dt>address</dt>
<dd class=monospace>bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4</dd>.*",
<dd class=monospace>qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv</dd>.*",
);

ord_server.assert_response_regex(
Expand Down
40 changes: 20 additions & 20 deletions tests/wallet/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn inscriptions_can_be_sent() {
rpc_server.mine_blocks(1);

let output = CommandBuilder::new(format!(
"wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {inscription}",
"wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {inscription}",
))
.rpc_server(&rpc_server)
.stdout_regex(r".*")
Expand Down Expand Up @@ -98,7 +98,7 @@ fn send_on_mainnnet_works_with_wallet_named_foo() {
.run_and_deserialize_output::<ord::subcommand::wallet::create::Output>();

CommandBuilder::new(format!(
"wallet --name foo send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {txid}:0:0"
"wallet --name foo send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {txid}:0:0"
))
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>();
Expand Down Expand Up @@ -128,7 +128,7 @@ fn send_on_mainnnet_works_with_wallet_named_ord() {
create_wallet(&rpc_server);

let output = CommandBuilder::new(format!(
"wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {txid}:0:0"
"wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {txid}:0:0"
))
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>();
Expand All @@ -151,7 +151,7 @@ fn send_does_not_use_inscribed_sats_as_cardinal_utxos() {

let txid = rpc_server.mine_blocks_with_subsidy(1, 100)[0].txdata[0].txid();
CommandBuilder::new(format!(
"wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {txid}:0:0"
"wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {txid}:0:0"
))
.rpc_server(&rpc_server)
.expected_exit_code(1)
Expand All @@ -174,7 +174,7 @@ fn do_not_send_within_dust_limit_of_an_inscription() {
};

CommandBuilder::new(format!(
"wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {output}:329"
"wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {output}:329"
))
.rpc_server(&rpc_server)
.expected_exit_code(1)
Expand All @@ -199,7 +199,7 @@ fn can_send_after_dust_limit_from_an_inscription() {
};

CommandBuilder::new(format!(
"wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {output}:330"
"wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {output}:330"
))
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>();
Expand Down Expand Up @@ -267,7 +267,7 @@ fn splitting_merged_inscriptions_is_possible() {

// try and fail to send first
CommandBuilder::new(format!(
"wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {}i0",
"wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {}i0",
reveal_txid,
))
.rpc_server(&rpc_server)
Expand All @@ -279,7 +279,7 @@ fn splitting_merged_inscriptions_is_possible() {

// splitting out last
CommandBuilder::new(format!(
"wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {}i2",
"wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {}i2",
reveal_txid,
))
.rpc_server(&rpc_server)
Expand All @@ -289,7 +289,7 @@ fn splitting_merged_inscriptions_is_possible() {

// splitting second to last
CommandBuilder::new(format!(
"wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {}i1",
"wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {}i1",
reveal_txid,
))
.rpc_server(&rpc_server)
Expand All @@ -299,7 +299,7 @@ fn splitting_merged_inscriptions_is_possible() {

// splitting send first
CommandBuilder::new(format!(
"wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {}i0",
"wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {}i0",
reveal_txid,
))
.rpc_server(&rpc_server)
Expand All @@ -316,7 +316,7 @@ fn inscriptions_cannot_be_sent_by_satpoint() {
rpc_server.mine_blocks(1);

CommandBuilder::new(format!(
"wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {reveal}:0:0"
"wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {reveal}:0:0"
))
.rpc_server(&rpc_server)
.expected_stderr("error: inscriptions must be sent by inscription ID\n")
Expand All @@ -332,7 +332,7 @@ fn send_btc_with_fee_rate() {
rpc_server.mine_blocks(1);

CommandBuilder::new(
"wallet send --fee-rate 13.3 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 1btc",
"wallet send --fee-rate 13.3 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv 1btc",
)
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>();
Expand All @@ -357,7 +357,7 @@ fn send_btc_with_fee_rate() {
rpc_server.sent(),
&[Sent {
amount: 1.0,
address: "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"
address: "qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv"
.parse::<Address<NetworkUnchecked>>()
.unwrap()
.assume_checked(),
Expand All @@ -375,15 +375,15 @@ fn send_btc_locks_inscriptions() {

let (_, reveal) = inscribe(&rpc_server);

CommandBuilder::new("wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 1btc")
CommandBuilder::new("wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv 1btc")
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>();

assert_eq!(
rpc_server.sent(),
&[Sent {
amount: 1.0,
address: "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"
address: "qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv"
.parse::<Address<NetworkUnchecked>>()
.unwrap()
.assume_checked(),
Expand All @@ -404,7 +404,7 @@ fn send_btc_fails_if_lock_unspent_fails() {

rpc_server.mine_blocks(1);

CommandBuilder::new("wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 1btc")
CommandBuilder::new("wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv 1btc")
.rpc_server(&rpc_server)
.expected_stderr("error: failed to lock UTXOs\n")
.expected_exit_code(1)
Expand All @@ -420,7 +420,7 @@ fn wallet_send_with_fee_rate() {
let (inscription, _) = inscribe(&rpc_server);

CommandBuilder::new(format!(
"wallet send bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {inscription} --fee-rate 2.0"
"wallet send qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {inscription} --fee-rate 2.0"
))
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>();
Expand Down Expand Up @@ -451,7 +451,7 @@ fn user_must_provide_fee_rate_to_send() {
let (inscription, _) = inscribe(&rpc_server);

CommandBuilder::new(format!(
"wallet send bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {inscription}"
"wallet send qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {inscription}"
))
.rpc_server(&rpc_server)
.expected_exit_code(2)
Expand All @@ -471,7 +471,7 @@ fn wallet_send_with_fee_rate_and_target_postage() {
let (inscription, _) = inscribe(&rpc_server);

CommandBuilder::new(format!(
"wallet send bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 {inscription} --fee-rate 2.0 --postage 77000sat"
"wallet send qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv {inscription} --fee-rate 2.0 --postage 77000sat"
))
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>();
Expand Down Expand Up @@ -504,7 +504,7 @@ fn send_btc_does_not_send_locked_utxos() {

rpc_server.lock(outpoint);

CommandBuilder::new("wallet send --fee-rate 1 bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 1btc")
CommandBuilder::new("wallet send --fee-rate 1 qc1qq37jr27g4037wdfqtad2t9hfd6m2d5w6fka3uv 1btc")
.rpc_server(&rpc_server)
.expected_exit_code(1)
.stderr_regex("error:.*")
Expand Down

0 comments on commit 8367fed

Please sign in to comment.