From e7c2981939bece900f937b1cc936f4b7701a713b Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 20 Dec 2022 11:58:14 -0800 Subject: [PATCH 1/9] Improve inscription style --- src/subcommand/server/templates/content.rs | 4 ++-- static/index.css | 17 ++++++++++++++++- templates/inscription.html | 6 +++++- templates/sat.html | 2 +- templates/transaction.html | 2 +- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/subcommand/server/templates/content.rs b/src/subcommand/server/templates/content.rs index 947829e3dd..34196647cc 100644 --- a/src/subcommand/server/templates/content.rs +++ b/src/subcommand/server/templates/content.rs @@ -9,9 +9,9 @@ impl<'a> Display for ContentHtml<'a> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { match self.content { Some(Content::Text(text)) => { - write!(f, "

")?; + write!(f, "

")?;
         text.escape(f, false)?;
-        write!(f, "

") + write!(f, "
") } Some(Content::Image) => write!(f, "", self.inscription_id), None => write!(f, "

UNKNOWN

"), diff --git a/static/index.css b/static/index.css index d511e33aa1..2fa55c936c 100644 --- a/static/index.css +++ b/static/index.css @@ -168,7 +168,7 @@ a.mythic { width: 23%; margin: 1%; overflow: hidden; - border-radius: 10%; + border-radius: 2%; } .inscriptions a img { @@ -177,3 +177,18 @@ a.mythic { min-width: 100%; image-rendering: pixelated; } + +.content { + display: flex; + justify-content: center; +} + +.content img { + min-width: 50%; + image-rendering: pixelated; +} + +a.content { + color: inherit; + text-decoration: none; +} diff --git a/templates/inscription.html b/templates/inscription.html index b4668284e5..6a7eb908bf 100644 --- a/templates/inscription.html +++ b/templates/inscription.html @@ -1,5 +1,7 @@

Inscription {{ self.inscription_id }}

+ {{ self.inscription.content_html(self.inscription_id) }} +
%% if let Some(content_size) = self.inscription.content_size() {
content size
@@ -9,6 +11,8 @@

Inscription {{ self.inscription_id }}

content type
{{ content_type }}
%% } +
genesis transaction
+
{{ self.inscription_id }}
location
-
{{ self.satpoint }}
+
{{ self.satpoint }}
diff --git a/templates/sat.html b/templates/sat.html index 61d8f448fd..11f1293cb0 100644 --- a/templates/sat.html +++ b/templates/sat.html @@ -13,7 +13,7 @@

Sat {{ self.sat.n() }}

time
{{ self.blocktime }}
%% if let Some((inscription_id, inscription)) = &self.inscription {
inscription
-
{{ inscription.content_html(*inscription_id) }}
+
{{ inscription.content_html(*inscription_id) }}
%% } %% if self.sat.n() > 0 { diff --git a/templates/transaction.html b/templates/transaction.html index 80fa59d61b..032abc1369 100644 --- a/templates/transaction.html +++ b/templates/transaction.html @@ -1,7 +1,7 @@

Transaction {{self.txid}}

%% if let Some(inscription) = &self.inscription {

Inscription

- + {{ inscription.content_html(self.txid) }} %% } From 1b86cc5780dca638bb42ba5e83f8aa8e2c12a700 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 20 Dec 2022 12:07:20 -0800 Subject: [PATCH 2/9] Fix unit tests --- src/subcommand/server/templates/home.rs | 2 +- .../server/templates/inscription.rs | 20 +++++++++++++++---- src/subcommand/server/templates/sat.rs | 4 ++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/subcommand/server/templates/home.rs b/src/subcommand/server/templates/home.rs index 101831845c..394e7eb908 100644 --- a/src/subcommand/server/templates/home.rs +++ b/src/subcommand/server/templates/home.rs @@ -64,7 +64,7 @@ mod tests { .to_string(), "

Bitcoin-native NFTs

.*

Latest Inscriptions

Status

diff --git a/src/subcommand/server/templates/inscription.rs b/src/subcommand/server/templates/inscription.rs index b53ae78754..c19b0a181d 100644 --- a/src/subcommand/server/templates/inscription.rs +++ b/src/subcommand/server/templates/inscription.rs @@ -35,14 +35,18 @@ mod tests { .to_string(), "

Inscription ec90757eb3b164aa43fc548faa2fa0c52025494f2c15d5ddf11260b4034ac6dc

-

HELLOWORLD

+ +
HELLOWORLD
+
content size
10 bytes
content type
text/plain;charset=utf-8
+
genesis transaction
+
ec90757eb3b164aa43fc548faa2fa0c52025494f2c15d5ddf11260b4034ac6dc
location
-
1111111111111111111111111111111111111111111111111111111111111111:1:0
+
1111111111111111111111111111111111111111111111111111111111111111:1:0
" .unindent() @@ -63,14 +67,18 @@ mod tests { .to_string(), "

Inscription ec90757eb3b164aa43fc548faa2fa0c52025494f2c15d5ddf11260b4034ac6dc

+ +
content size
100 bytes
content type
image/png
+
genesis transaction
+
ec90757eb3b164aa43fc548faa2fa0c52025494f2c15d5ddf11260b4034ac6dc
location
-
1111111111111111111111111111111111111111111111111111111111111111:1:0
+
1111111111111111111111111111111111111111111111111111111111111111:1:0
" .unindent() @@ -91,10 +99,14 @@ mod tests { .to_string(), "

Inscription ec90757eb3b164aa43fc548faa2fa0c52025494f2c15d5ddf11260b4034ac6dc

+

UNKNOWN

+
+
genesis transaction
+
ec90757eb3b164aa43fc548faa2fa0c52025494f2c15d5ddf11260b4034ac6dc
location
-
1111111111111111111111111111111111111111111111111111111111111111:1:0
+
1111111111111111111111111111111111111111111111111111111111111111:1:0
" .unindent() diff --git a/src/subcommand/server/templates/sat.rs b/src/subcommand/server/templates/sat.rs index 90e1a24c18..bfd586f434 100644 --- a/src/subcommand/server/templates/sat.rs +++ b/src/subcommand/server/templates/sat.rs @@ -109,7 +109,7 @@ mod tests {
rarity
mythic
time
1970-01-01 00:00:00
inscription
-

HELLOWORLD

+
HELLOWORLD
prev next @@ -151,7 +151,7 @@ mod tests {
rarity
mythic
time
1970-01-01 00:00:00
inscription
-

<script>alert('HELLOWORLD');</script>

+
<script>alert('HELLOWORLD');</script>
prev next From c4e63af000ae6585f5401ecf267316f10ea8cc0b Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 20 Dec 2022 12:33:42 -0800 Subject: [PATCH 3/9] Fix send works on signet --- tests/wallet.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/wallet.rs b/tests/wallet.rs index 4919dadcd7..f9b61759e2 100644 --- a/tests/wallet.rs +++ b/tests/wallet.rs @@ -92,12 +92,9 @@ fn send_works_on_signet() { ".*

Inscription {reveal_txid}

.*
-
content size
-
520 bytes
-
content type
-
image/png
+ .*
location
-
{send_txid}:0:0
+
{send_txid}:0:0
.*", ), From e21824e9764d57775e735956fc696ce1ee044b33 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 20 Dec 2022 12:39:47 -0800 Subject: [PATCH 4/9] Fix more tests --- tests/wallet.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/wallet.rs b/tests/wallet.rs index f9b61759e2..6958b13d4b 100644 --- a/tests/wallet.rs +++ b/tests/wallet.rs @@ -299,7 +299,7 @@ fn inscribe_png() { let rpc_server = test_bitcoincore_rpc::spawn_with(Network::Regtest, "ord"); let txid = rpc_server.mine_blocks(1)[0].txdata[0].txid(); - CommandBuilder::new(format!( + let stdout = CommandBuilder::new(format!( "--chain regtest --index-sats wallet inscribe --satpoint {txid}:0:0 --file degenerate.png" )) .write("degenerate.png", [1; 520]) @@ -307,13 +307,17 @@ fn inscribe_png() { .stdout_regex("commit\t[[:xdigit:]]{64}\nreveal\t[[:xdigit:]]{64}\n") .run(); + let txid = reveal_txid_from_inscribe_stdout(&stdout); + rpc_server.mine_blocks(1); let ord_server = TestServer::spawn_with_args(&rpc_server, &["--index-sats"]); ord_server.assert_response_regex( "/sat/5000000000", - ".*
inscription
\n
inscription\n
inscription\n

HELLOWORLD

.*", - ); + TestServer::spawn_with_args(&rpc_server, &["--index-sats"]) + .assert_response_regex("/sat/5000000000", ".*HELLOWORLD.*"); TestServer::spawn_with_args(&rpc_server, &[]).assert_response_regex( &format!("/inscription/{}", reveal_txid_from_inscribe_stdout(&stdout)), @@ -680,7 +682,8 @@ fn inscribe_gif() { .rpc_server(&rpc_server) .stdout_regex("commit\t[[:xdigit:]]{64}\nreveal\t[[:xdigit:]]{64}\n") .run(); - let inscription_id = reveal_txid_from_inscribe_stdout(&stdout); + + let txid = reveal_txid_from_inscribe_stdout(&stdout); rpc_server.mine_blocks(1); @@ -688,6 +691,8 @@ fn inscribe_gif() { ord_server.assert_response_regex( "/sat/5000000000", - &format!(".*
inscription
\n
inscription\n
Date: Tue, 20 Dec 2022 12:42:19 -0800 Subject: [PATCH 5/9] Fix more tests --- tests/wallet.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/wallet.rs b/tests/wallet.rs index 6958b13d4b..d1c4e84c41 100644 --- a/tests/wallet.rs +++ b/tests/wallet.rs @@ -151,12 +151,9 @@ fn send_inscribed_sat() { ".*

Inscription {reveal_txid}

.*
-
content size
-
520 bytes
-
content type
-
image/png
+ .*
location
-
{send_txid}:0:0
+
{send_txid}:0:0
.*", ), @@ -256,7 +253,7 @@ fn inscribe() { TestServer::spawn_with_args(&rpc_server, &["--index-sats"]).assert_response_regex( "/sat/5000000000", - ".*
inscription
\n

HELLOWORLD

.*", + ".*
inscription
\n
.*
HELLOWORLD
.*
.*", ); TestServer::spawn_with_args(&rpc_server, &[]).assert_response_regex( From 07804fc1699a06fbdd6e293ae368ac5ccff49baa Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 20 Dec 2022 12:48:00 -0800 Subject: [PATCH 6/9] Fix more tests --- tests/server.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/server.rs b/tests/server.rs index 4d40efd6d0..ddefe3e8b7 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -122,12 +122,9 @@ fn inscription_page_after_send() { ".*

Inscription {reveal_txid}

HELLOWORLD

-
content size
-
10 bytes
-
content type
-
text/plain;charset=utf-8
+ .*
location
-
{reveal_txid}:0:0
+
{reveal_txid}:0:0
.*", ), ); @@ -147,14 +144,13 @@ fn inscription_page_after_send() { &format!("/inscription/{reveal_txid}"), &format!( ".*

Inscription {reveal_txid}

-

HELLOWORLD

+
+
HELLOWORLD
+
-
content size
-
10 bytes
-
content type
-
text/plain;charset=utf-8
+ .*
location
-
{}:0:0
+
{}:0:0
.*", txid.trim(), ), From 6cee36892899b156964d57e9397b72036b8f5016 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 20 Dec 2022 12:50:42 -0800 Subject: [PATCH 7/9] Fix --- tests/server.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/server.rs b/tests/server.rs index ddefe3e8b7..1d181501df 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -56,14 +56,18 @@ fn inscription_page() { &format!( ".*.*

Inscription {reveal_tx}

-

HELLOWORLD

+ +
HELLOWORLD
+
content size
10 bytes
content type
text/plain;charset=utf-8
+
genesis transaction
+
{reveal_tx}
location
-
{reveal_tx}:0:0
+
{reveal_tx}:0:0
.*", ), ); From 5d35cb13c3b8f884e4288a384a6a0b60bff89d19 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 20 Dec 2022 13:06:12 -0800 Subject: [PATCH 8/9] Fix tests --- tests/server.rs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/tests/server.rs b/tests/server.rs index 1d181501df..11ade06f64 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -92,13 +92,7 @@ fn inscription_appears_on_reveal_transaction_page() { TestServer::spawn_with_args(&rpc_server, &[]).assert_response_regex( &format!("/tx/{}", reveal_tx), - &format!( - ".*

Transaction .*

.* -

Inscription

- -

HELLOWORLD

-
.*", - ), + &format!(".*

Transaction .*

.*HELLOWORLD.*",), ); } @@ -123,9 +117,7 @@ fn inscription_page_after_send() { ord_server.assert_response_regex( &format!("/inscription/{reveal_txid}"), &format!( - ".*

Inscription {reveal_txid}

-

HELLOWORLD

-
+ ".*

Inscription {reveal_txid}

.*HELLOWORLD.*
.*
location
{reveal_txid}:0:0
@@ -147,10 +139,7 @@ fn inscription_page_after_send() { ord_server.assert_response_regex( &format!("/inscription/{reveal_txid}"), &format!( - ".*

Inscription {reveal_txid}

- -
HELLOWORLD
-
+ ".*

Inscription {reveal_txid}

.*HELLOWORLD.*
.*
location
From 7c7a8c8cb4f91c64fb08e3c508ecc10b738029e8 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 20 Dec 2022 13:24:11 -0800 Subject: [PATCH 9/9] tweak --- tests/server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/server.rs b/tests/server.rs index c58cc3b377..c907fce300 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -94,7 +94,7 @@ fn inscription_appears_on_reveal_transaction_page() { TestServer::spawn_with_args(&rpc_server, &[]).assert_response_regex( &format!("/tx/{}", reveal_tx), - &format!(".*

Transaction .*

.*HELLOWORLD.*",), + ".*

Transaction .*

.*HELLOWORLD.*", ); }