From 7c01621a3bff22c65012d76f055f37a7c47e1ed1 Mon Sep 17 00:00:00 2001 From: Lugon LQ <48004924+lugondev@users.noreply.github.com> Date: Sun, 7 Jan 2024 13:17:01 +0700 Subject: [PATCH 01/23] Add router Runes balance and format Tx response to JSON --- src/subcommand/server.rs | 30 +++++++++++++++++++++++++----- src/templates.rs | 2 +- src/templates/transaction.rs | 4 +++- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index d1e60c57e5..2890ae2974 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -15,7 +15,7 @@ use { PreviewAudioHtml, PreviewCodeHtml, PreviewFontHtml, PreviewImageHtml, PreviewMarkdownHtml, PreviewModelHtml, PreviewPdfHtml, PreviewTextHtml, PreviewUnknownHtml, PreviewVideoHtml, RangeHtml, RareTxt, RuneHtml, RuneJson, RunesHtml, RunesJson, SatHtml, SatInscriptionJson, - SatInscriptionsJson, SatJson, TransactionHtml, + SatInscriptionsJson, SatJson, TransactionHtml, TransactionJson, }, }, axum::{ @@ -268,6 +268,7 @@ impl Server { .route("/rare.txt", get(Self::rare_txt)) .route("/rune/:rune", get(Self::rune)) .route("/runes", get(Self::runes)) + .route("/runes/balance", get(Self::runes_balance)) .route("/sat/:sat", get(Self::sat)) .route("/search", get(Self::search_by_query)) .route("/search/*query", get(Self::search_by_path)) @@ -661,6 +662,13 @@ impl Server { }) } + async fn runes_balance( + Extension(_): Extension>, + Extension(index): Extension>, + ) -> ServerResult { + Ok(Json(index.get_rune_balance_map()?).into_response()) + } + async fn home( Extension(server_config): Extension>, Extension(index): Extension>, @@ -748,7 +756,8 @@ impl Server { Extension(server_config): Extension>, Extension(index): Extension>, Path(txid): Path, - ) -> ServerResult> { + AcceptJson(accept_json): AcceptJson, + ) -> ServerResult { let transaction = index .get_transaction(txid)? .ok_or_not_found(|| format!("transaction {txid}"))?; @@ -757,7 +766,17 @@ impl Server { let blockhash = index.get_transaction_blockhash(txid)?; - Ok( + Ok(if accept_json { + Json(TransactionJson { + blockhash, + transaction, + txid, + inscription_count, + chain: server_config.chain, + etching: index.get_etching(txid)?, + }) + .into_response() + } else { TransactionHtml { blockhash, transaction, @@ -766,8 +785,9 @@ impl Server { chain: server_config.chain, etching: index.get_etching(txid)?, } - .page(server_config), - ) + .page(server_config) + .into_response() + }) } async fn metadata( diff --git a/src/templates.rs b/src/templates.rs index 8906adca8a..c0607b79cb 100644 --- a/src/templates.rs +++ b/src/templates.rs @@ -25,7 +25,7 @@ pub(crate) use { sat::{SatHtml, SatInscriptionJson, SatInscriptionsJson, SatJson}, server_config::ServerConfig, status::StatusHtml, - transaction::TransactionHtml, + transaction::{TransactionHtml, TransactionJson}, }; pub mod block; diff --git a/src/templates/transaction.rs b/src/templates/transaction.rs index 6bd269742c..3fa1309c98 100644 --- a/src/templates/transaction.rs +++ b/src/templates/transaction.rs @@ -1,6 +1,8 @@ use super::*; -#[derive(Boilerplate)] +pub(crate) type TransactionJson = TransactionHtml; + +#[derive(Boilerplate, Debug, PartialEq, Serialize, Deserialize)] pub(crate) struct TransactionHtml { pub(crate) blockhash: Option, pub(crate) chain: Chain, From 38a179f7b974cee25e5b97e83d999ad75acb0dd9 Mon Sep 17 00:00:00 2001 From: Lugon LQ <48004924+lugondev@users.noreply.github.com> Date: Sun, 7 Jan 2024 13:42:07 +0700 Subject: [PATCH 02/23] Update path router Runes balances --- src/subcommand/server.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index 2890ae2974..32db94b5aa 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -268,7 +268,7 @@ impl Server { .route("/rare.txt", get(Self::rare_txt)) .route("/rune/:rune", get(Self::rune)) .route("/runes", get(Self::runes)) - .route("/runes/balance", get(Self::runes_balance)) + .route("/runes/balances", get(Self::runes_balances)) .route("/sat/:sat", get(Self::sat)) .route("/search", get(Self::search_by_query)) .route("/search/*query", get(Self::search_by_path)) @@ -662,7 +662,7 @@ impl Server { }) } - async fn runes_balance( + async fn runes_balances( Extension(_): Extension>, Extension(index): Extension>, ) -> ServerResult { From 83e6cc6327fa695632157c1fea7388514ed0e555 Mon Sep 17 00:00:00 2001 From: Lugon LQ <48004924+lugondev@users.noreply.github.com> Date: Sun, 28 Jan 2024 12:48:15 +0700 Subject: [PATCH 03/23] Fix conflict: TransactionJson --- src/subcommand/server.rs | 4 ---- src/templates.rs | 2 +- src/templates/transaction.rs | 15 +++++++-------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index cb639a87f1..09a0826070 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -801,11 +801,8 @@ impl Server { let inscription_count = index.inscription_count(txid)?; - let blockhash = index.get_transaction_blockhash(txid)?; - Ok(if accept_json { Json(TransactionJson { - blockhash, transaction, txid, inscription_count, @@ -815,7 +812,6 @@ impl Server { .into_response() } else { TransactionHtml { - blockhash, transaction, txid, inscription_count, diff --git a/src/templates.rs b/src/templates.rs index f8dbf1e7ba..a2008d26f8 100644 --- a/src/templates.rs +++ b/src/templates.rs @@ -24,7 +24,7 @@ pub(crate) use { runes::{RunesHtml, RunesJson}, sat::{SatHtml, SatInscriptionJson, SatInscriptionsJson, SatJson}, server_config::ServerConfig, - status::StatusHtml, + status::{StatusHtml, StatusJson}, transaction::{TransactionHtml, TransactionJson}, }; diff --git a/src/templates/transaction.rs b/src/templates/transaction.rs index 568d865562..a2f741bec3 100644 --- a/src/templates/transaction.rs +++ b/src/templates/transaction.rs @@ -1,15 +1,14 @@ use super::*; -pub(crate) type TransactionJson = TransactionHtml; +pub type TransactionJson = TransactionHtml; #[derive(Boilerplate, Debug, PartialEq, Serialize, Deserialize)] -pub(crate) struct TransactionHtml { - pub(crate) blockhash: Option, - pub(crate) chain: Chain, - pub(crate) etching: Option, - pub(crate) inscription_count: u32, - pub(crate) transaction: Transaction, - pub(crate) txid: Txid, +pub struct TransactionHtml { + pub chain: Chain, + pub etching: Option, + pub inscription_count: u32, + pub transaction: Transaction, + pub txid: Txid, } impl PageContent for TransactionHtml { From 84bb95a128a3693f7bc67cde648a631a90213cb7 Mon Sep 17 00:00:00 2001 From: Lugon LQ <48004924+lugondev@users.noreply.github.com> Date: Sun, 28 Jan 2024 14:31:02 +0700 Subject: [PATCH 04/23] Add tests for endpoint /runes/balances --- src/subcommand/server.rs | 1 - tests/json_api.rs | 57 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index 09a0826070..ba4cb48270 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -687,7 +687,6 @@ impl Server { } async fn runes_balances( - Extension(_): Extension>, Extension(index): Extension>, ) -> ServerResult { Ok(Json(index.get_rune_balance_map()?).into_response()) diff --git a/tests/json_api.rs b/tests/json_api.rs index ff16c9c4d5..66bdcd06ed 100644 --- a/tests/json_api.rs +++ b/tests/json_api.rs @@ -635,3 +635,60 @@ fn get_runes() { } ); } +#[test] +fn get_runes_balances() { + let bitcoin_rpc_server = test_bitcoincore_rpc::builder() + .network(Network::Regtest) + .build(); + + let ord_rpc_server = + TestServer::spawn_with_server_args(&bitcoin_rpc_server, &["--index-runes", "--regtest"], &[]); + + create_wallet(&bitcoin_rpc_server, &ord_rpc_server); + + bitcoin_rpc_server.mine_blocks(3); + + let rune0 = Rune(RUNE); + let rune1 = Rune(RUNE + 1); + let rune2 = Rune(RUNE + 2); + let e0 = etch(&bitcoin_rpc_server, &ord_rpc_server, rune0); + let e1 = etch(&bitcoin_rpc_server, &ord_rpc_server, rune1); + let e2 = etch(&bitcoin_rpc_server, &ord_rpc_server, rune2); + + bitcoin_rpc_server.mine_blocks(1); + + let response = ord_rpc_server.json_request("/runes/balances"); + assert_eq!(response.status(), StatusCode::OK); + + let runes_balance_json: BTreeMap> = serde_json::from_str(&response.text().unwrap()).unwrap(); + + let mut runes_balances: BTreeMap> = BTreeMap::new(); + let mut b0:BTreeMap = BTreeMap::new(); + let o0:OutPoint = OutPoint { + txid: e0.transaction, + vout: 1, + }; + b0.insert(o0, 1000); + runes_balances.insert(rune0, b0); + + let mut b1:BTreeMap = BTreeMap::new(); + let o1:OutPoint = OutPoint { + txid: e1.transaction, + vout: 1, + }; + b1.insert(o1, 1000); + runes_balances.insert(rune1, b1); + + let mut b2:BTreeMap = BTreeMap::new(); + let o2:OutPoint = OutPoint { + txid: e2.transaction, + vout: 1, + }; + b2.insert(o2, 1000); + runes_balances.insert(rune2, b2); + + pretty_assert_eq!( + runes_balance_json, + runes_balances + ); +} From 3c8600d41837210dbedb332bb896e3e5ef973b33 Mon Sep 17 00:00:00 2001 From: Lugon LQ <48004924+lugondev@users.noreply.github.com> Date: Sun, 28 Jan 2024 14:35:58 +0700 Subject: [PATCH 05/23] Format lint --- src/subcommand/server.rs | 4 +--- tests/json_api.rs | 20 +++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index ba4cb48270..1bb6e04018 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -686,9 +686,7 @@ impl Server { }) } - async fn runes_balances( - Extension(index): Extension>, - ) -> ServerResult { + async fn runes_balances(Extension(index): Extension>) -> ServerResult { Ok(Json(index.get_rune_balance_map()?).into_response()) } diff --git a/tests/json_api.rs b/tests/json_api.rs index 66bdcd06ed..f93669921b 100644 --- a/tests/json_api.rs +++ b/tests/json_api.rs @@ -660,35 +660,33 @@ fn get_runes_balances() { let response = ord_rpc_server.json_request("/runes/balances"); assert_eq!(response.status(), StatusCode::OK); - let runes_balance_json: BTreeMap> = serde_json::from_str(&response.text().unwrap()).unwrap(); + let runes_balance_json: BTreeMap> = + serde_json::from_str(&response.text().unwrap()).unwrap(); let mut runes_balances: BTreeMap> = BTreeMap::new(); - let mut b0:BTreeMap = BTreeMap::new(); - let o0:OutPoint = OutPoint { + let mut b0: BTreeMap = BTreeMap::new(); + let o0: OutPoint = OutPoint { txid: e0.transaction, vout: 1, }; b0.insert(o0, 1000); runes_balances.insert(rune0, b0); - let mut b1:BTreeMap = BTreeMap::new(); - let o1:OutPoint = OutPoint { + let mut b1: BTreeMap = BTreeMap::new(); + let o1: OutPoint = OutPoint { txid: e1.transaction, vout: 1, }; b1.insert(o1, 1000); runes_balances.insert(rune1, b1); - let mut b2:BTreeMap = BTreeMap::new(); - let o2:OutPoint = OutPoint { + let mut b2: BTreeMap = BTreeMap::new(); + let o2: OutPoint = OutPoint { txid: e2.transaction, vout: 1, }; b2.insert(o2, 1000); runes_balances.insert(rune2, b2); - pretty_assert_eq!( - runes_balance_json, - runes_balances - ); + pretty_assert_eq!(runes_balance_json, runes_balances); } From 43e4f075dd153b6794c0d8789ca452a7ddb75c75 Mon Sep 17 00:00:00 2001 From: 0xLugon Date: Mon, 29 Jan 2024 11:42:32 +0700 Subject: [PATCH 06/23] Update src/subcommand/server.rs Co-authored-by: raph --- src/subcommand/server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index 1bb6e04018..a95c8d2b22 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -687,7 +687,7 @@ impl Server { } async fn runes_balances(Extension(index): Extension>) -> ServerResult { - Ok(Json(index.get_rune_balance_map()?).into_response()) + task::block_in_place(|| Ok(Json(index.get_rune_balance_map()?).into_response())) } async fn home( From 3598200f7083a956d02a6e24c93b606cc6f9884a Mon Sep 17 00:00:00 2001 From: Lugon LQ <48004924+lugondev@users.noreply.github.com> Date: Mon, 29 Jan 2024 12:04:55 +0700 Subject: [PATCH 07/23] Format lint --- src/subcommand/server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index a95c8d2b22..0b5c544a99 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -687,7 +687,7 @@ impl Server { } async fn runes_balances(Extension(index): Extension>) -> ServerResult { - task::block_in_place(|| Ok(Json(index.get_rune_balance_map()?).into_response())) + task::block_in_place(|| Ok(Json(index.get_rune_balance_map()?).into_response())) } async fn home( From 425748aae1e6f91373e2f9a235420ae6f8314a64 Mon Sep 17 00:00:00 2001 From: Lugon LQ <48004924+lugondev@users.noreply.github.com> Date: Mon, 29 Jan 2024 13:29:31 +0700 Subject: [PATCH 08/23] Add html page for /runes/balances --- src/subcommand/server.rs | 23 +++++++++++++++++++---- src/templates.rs | 2 +- src/templates/runes.rs | 11 +++++++++++ templates/runes-balances.html | 24 ++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 templates/runes-balances.html diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index 0b5c544a99..a23d00840a 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -14,8 +14,9 @@ use { InscriptionsBlockHtml, InscriptionsHtml, InscriptionsJson, OutputHtml, OutputJson, PageContent, PageHtml, PreviewAudioHtml, PreviewCodeHtml, PreviewFontHtml, PreviewImageHtml, PreviewMarkdownHtml, PreviewModelHtml, PreviewPdfHtml, PreviewTextHtml, PreviewUnknownHtml, - PreviewVideoHtml, RangeHtml, RareTxt, RuneHtml, RuneJson, RunesHtml, RunesJson, SatHtml, - SatInscriptionJson, SatInscriptionsJson, SatJson, TransactionHtml, TransactionJson, + PreviewVideoHtml, RangeHtml, RareTxt, RuneHtml, RuneJson, RunesBalancesHtml, RunesHtml, + RunesJson, SatHtml, SatInscriptionJson, SatInscriptionsJson, SatJson, TransactionHtml, + TransactionJson, }, }, axum::{ @@ -686,8 +687,22 @@ impl Server { }) } - async fn runes_balances(Extension(index): Extension>) -> ServerResult { - task::block_in_place(|| Ok(Json(index.get_rune_balance_map()?).into_response())) + async fn runes_balances( + Extension(server_config): Extension>, + Extension(index): Extension>, + AcceptJson(accept_json): AcceptJson, + ) -> ServerResult { + task::block_in_place(|| { + Ok(if accept_json { + Json(index.get_rune_balance_map()?).into_response() + } else { + RunesBalancesHtml { + runes_balances: index.get_rune_balance_map()?, + } + .page(server_config) + .into_response() + }) + }) } async fn home( diff --git a/src/templates.rs b/src/templates.rs index a2008d26f8..24aaf90e4d 100644 --- a/src/templates.rs +++ b/src/templates.rs @@ -21,7 +21,7 @@ pub(crate) use { range::RangeHtml, rare::RareTxt, rune::{RuneHtml, RuneJson}, - runes::{RunesHtml, RunesJson}, + runes::{RunesBalancesHtml, RunesHtml, RunesJson}, sat::{SatHtml, SatInscriptionJson, SatInscriptionsJson, SatJson}, server_config::ServerConfig, status::{StatusHtml, StatusJson}, diff --git a/src/templates/runes.rs b/src/templates/runes.rs index ace35fca32..309e4de435 100644 --- a/src/templates/runes.rs +++ b/src/templates/runes.rs @@ -13,6 +13,17 @@ impl PageContent for RunesHtml { } } +#[derive(Boilerplate, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunesBalancesHtml { + pub runes_balances: BTreeMap>, +} + +impl PageContent for RunesBalancesHtml { + fn title(&self) -> String { + "Runes balances".to_string() + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/templates/runes-balances.html b/templates/runes-balances.html new file mode 100644 index 0000000000..4738f7be15 --- /dev/null +++ b/templates/runes-balances.html @@ -0,0 +1,24 @@ +

Runes Balances

+
    +%% for (rune, runes_balances) in &self.runes_balances { +
  • + {{ rune }} + + + + + + %% for (outpoint, balance) in runes_balances { + + + + + %% } +
    outpointbalance
    + {{outpoint.txid}}:{{outpoint.vout}} + + {{ balance }} +
    +
  • +%% } +
From 684927a23b185f2a5bb8dda2ee264f1428400a78 Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 15:10:36 -0800 Subject: [PATCH 09/23] only call function once --- src/subcommand/server.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index a23d00840a..2d8fe8c695 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -693,14 +693,13 @@ impl Server { AcceptJson(accept_json): AcceptJson, ) -> ServerResult { task::block_in_place(|| { + let runes_balances = index.get_rune_balance_map()?; Ok(if accept_json { - Json(index.get_rune_balance_map()?).into_response() + Json(runes_balances).into_response() } else { - RunesBalancesHtml { - runes_balances: index.get_rune_balance_map()?, - } - .page(server_config) - .into_response() + RunesBalancesHtml { runes_balances } + .page(server_config) + .into_response() }) }) } From d3d3e66115d37eb79543cd5330b445c992bb859c Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 15:12:18 -0800 Subject: [PATCH 10/23] Amend --- src/subcommand/server.rs | 50 +++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index 2d8fe8c695..8f4de6bde6 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -806,31 +806,33 @@ impl Server { Path(txid): Path, AcceptJson(accept_json): AcceptJson, ) -> ServerResult { - let transaction = index - .get_transaction(txid)? - .ok_or_not_found(|| format!("transaction {txid}"))?; - - let inscription_count = index.inscription_count(txid)?; - - Ok(if accept_json { - Json(TransactionJson { - transaction, - txid, - inscription_count, - chain: server_config.chain, - etching: index.get_etching(txid)?, + task::block_in_place(|| { + let transaction = index + .get_transaction(txid)? + .ok_or_not_found(|| format!("transaction {txid}"))?; + + let inscription_count = index.inscription_count(txid)?; + + Ok(if accept_json { + Json(TransactionJson { + transaction, + txid, + inscription_count, + chain: server_config.chain, + etching: index.get_etching(txid)?, + }) + .into_response() + } else { + TransactionHtml { + transaction, + txid, + inscription_count, + chain: server_config.chain, + etching: index.get_etching(txid)?, + } + .page(server_config) + .into_response() }) - .into_response() - } else { - TransactionHtml { - transaction, - txid, - inscription_count, - chain: server_config.chain, - etching: index.get_etching(txid)?, - } - .page(server_config) - .into_response() }) } From e3ad08145e099b3181db30cdb9454d01443940ec Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 15:13:14 -0800 Subject: [PATCH 11/23] fixit --- src/subcommand/server.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index 8f4de6bde6..e25db11e43 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -815,20 +815,20 @@ impl Server { Ok(if accept_json { Json(TransactionJson { - transaction, - txid, - inscription_count, chain: server_config.chain, etching: index.get_etching(txid)?, + inscription_count, + transaction, + txid, }) .into_response() } else { TransactionHtml { - transaction, - txid, - inscription_count, chain: server_config.chain, etching: index.get_etching(txid)?, + inscription_count, + transaction, + txid, } .page(server_config) .into_response() From 5075b73637198ea0c36c6f7822cece18d5cdca76 Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 15:15:12 -0800 Subject: [PATCH 12/23] Amend --- src/templates/range.rs | 2 +- src/templates/runes.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/templates/range.rs b/src/templates/range.rs index 2b575ce7bd..2577beb1af 100644 --- a/src/templates/range.rs +++ b/src/templates/range.rs @@ -8,7 +8,7 @@ pub(crate) struct RangeHtml { impl PageContent for RangeHtml { fn title(&self) -> String { - format!("Sat range {}–{}", self.start, self.end) + format!("Sat Range {}–{}", self.start, self.end) } } diff --git a/src/templates/runes.rs b/src/templates/runes.rs index 309e4de435..da7025cfa5 100644 --- a/src/templates/runes.rs +++ b/src/templates/runes.rs @@ -20,7 +20,7 @@ pub struct RunesBalancesHtml { impl PageContent for RunesBalancesHtml { fn title(&self) -> String { - "Runes balances".to_string() + "Runes Balances".to_string() } } From 6a6f54f74f7009730cacc81aae3aca36ff3ba28f Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 15:18:51 -0800 Subject: [PATCH 13/23] Amend --- src/templates.rs | 1 + src/templates/rune_balances.rs | 12 ++++++++++++ src/templates/runes.rs | 11 ----------- .../{runes-balances.html => rune-balances.html} | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 src/templates/rune_balances.rs rename templates/{runes-balances.html => rune-balances.html} (95%) diff --git a/src/templates.rs b/src/templates.rs index 24aaf90e4d..6886332534 100644 --- a/src/templates.rs +++ b/src/templates.rs @@ -45,6 +45,7 @@ mod preview; mod range; mod rare; pub mod rune; +pub mod rune_balances; pub mod runes; pub mod sat; pub mod status; diff --git a/src/templates/rune_balances.rs b/src/templates/rune_balances.rs new file mode 100644 index 0000000000..7ad241287a --- /dev/null +++ b/src/templates/rune_balances.rs @@ -0,0 +1,12 @@ +use super::*; + +#[derive(Boilerplate, Debug, PartialEq, Serialize, Deserialize)] +pub struct RuneBalancesHtml { + pub runes_balances: BTreeMap>, +} + +impl PageContent for RuneBalancesHtml { + fn title(&self) -> String { + "Rune Balances".to_string() + } +} diff --git a/src/templates/runes.rs b/src/templates/runes.rs index da7025cfa5..ace35fca32 100644 --- a/src/templates/runes.rs +++ b/src/templates/runes.rs @@ -13,17 +13,6 @@ impl PageContent for RunesHtml { } } -#[derive(Boilerplate, Debug, PartialEq, Serialize, Deserialize)] -pub struct RunesBalancesHtml { - pub runes_balances: BTreeMap>, -} - -impl PageContent for RunesBalancesHtml { - fn title(&self) -> String { - "Runes Balances".to_string() - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/templates/runes-balances.html b/templates/rune-balances.html similarity index 95% rename from templates/runes-balances.html rename to templates/rune-balances.html index 4738f7be15..ff624bf242 100644 --- a/templates/runes-balances.html +++ b/templates/rune-balances.html @@ -1,4 +1,4 @@ -

Runes Balances

+

Rune Balances

    %% for (rune, runes_balances) in &self.runes_balances {
  • From a8d9d1da50724c5f1dc45887a931aa1e996dd426 Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 15:20:55 -0800 Subject: [PATCH 14/23] Amend --- src/subcommand/server.rs | 4 ++-- src/templates.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index e25db11e43..a5d1a79dc0 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -14,7 +14,7 @@ use { InscriptionsBlockHtml, InscriptionsHtml, InscriptionsJson, OutputHtml, OutputJson, PageContent, PageHtml, PreviewAudioHtml, PreviewCodeHtml, PreviewFontHtml, PreviewImageHtml, PreviewMarkdownHtml, PreviewModelHtml, PreviewPdfHtml, PreviewTextHtml, PreviewUnknownHtml, - PreviewVideoHtml, RangeHtml, RareTxt, RuneHtml, RuneJson, RunesBalancesHtml, RunesHtml, + PreviewVideoHtml, RangeHtml, RareTxt, RuneBalancesHtml, RuneHtml, RuneJson, RunesHtml, RunesJson, SatHtml, SatInscriptionJson, SatInscriptionsJson, SatJson, TransactionHtml, TransactionJson, }, @@ -697,7 +697,7 @@ impl Server { Ok(if accept_json { Json(runes_balances).into_response() } else { - RunesBalancesHtml { runes_balances } + RuneBalancesHtml { runes_balances } .page(server_config) .into_response() }) diff --git a/src/templates.rs b/src/templates.rs index 6886332534..5c617becb4 100644 --- a/src/templates.rs +++ b/src/templates.rs @@ -21,7 +21,8 @@ pub(crate) use { range::RangeHtml, rare::RareTxt, rune::{RuneHtml, RuneJson}, - runes::{RunesBalancesHtml, RunesHtml, RunesJson}, + rune_balances::RuneBalancesHtml, + runes::{RunesHtml, RunesJson}, sat::{SatHtml, SatInscriptionJson, SatInscriptionsJson, SatJson}, server_config::ServerConfig, status::{StatusHtml, StatusJson}, From 8a73cd7061c4635140211d0529d1973bb46c2a8a Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 15:27:48 -0800 Subject: [PATCH 15/23] Amend --- src/subcommand/server.rs | 8 ++++---- src/templates/range.rs | 4 ++-- src/templates/rune_balances.rs | 2 +- templates/range.html | 2 +- templates/rune-balances.html | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index a5d1a79dc0..d5d768a9c9 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -693,11 +693,11 @@ impl Server { AcceptJson(accept_json): AcceptJson, ) -> ServerResult { task::block_in_place(|| { - let runes_balances = index.get_rune_balance_map()?; + let balances = index.get_rune_balance_map()?; Ok(if accept_json { - Json(runes_balances).into_response() + Json(balances).into_response() } else { - RuneBalancesHtml { runes_balances } + RuneBalancesHtml { balances } .page(server_config) .into_response() }) @@ -2831,7 +2831,7 @@ mod tests { TestServer::new().assert_response_regex( "/range/0/1", StatusCode::OK, - r".*Sat range 0–1.*

    Sat range 0–1

    + r".*Sat Range 0–1.*

    Sat Range 0–1

    value
    1
    first
    0
    diff --git a/src/templates/range.rs b/src/templates/range.rs index 2577beb1af..47bb9953d4 100644 --- a/src/templates/range.rs +++ b/src/templates/range.rs @@ -25,7 +25,7 @@ mod tests { } .to_string(), " -

    Sat range 0–1

    +

    Sat Range 0–1

    value
    1
    first
    0
    @@ -44,7 +44,7 @@ mod tests { } .to_string(), " -

    Sat range 1–10

    +

    Sat Range 1–10

    value
    9
    first
    1
    diff --git a/src/templates/rune_balances.rs b/src/templates/rune_balances.rs index 7ad241287a..db8e998fdb 100644 --- a/src/templates/rune_balances.rs +++ b/src/templates/rune_balances.rs @@ -2,7 +2,7 @@ use super::*; #[derive(Boilerplate, Debug, PartialEq, Serialize, Deserialize)] pub struct RuneBalancesHtml { - pub runes_balances: BTreeMap>, + pub balances: BTreeMap>, } impl PageContent for RuneBalancesHtml { diff --git a/templates/range.html b/templates/range.html index 478bdb9cae..21d2690aa9 100644 --- a/templates/range.html +++ b/templates/range.html @@ -1,4 +1,4 @@ -

    Sat range {{self.start}}–{{self.end}}

    +

    Sat Range {{self.start}}–{{self.end}}

    value
    {{self.end.n() - self.start.n()}}
    first
    {{self.start.n()}}
    diff --git a/templates/rune-balances.html b/templates/rune-balances.html index ff624bf242..d83027b835 100644 --- a/templates/rune-balances.html +++ b/templates/rune-balances.html @@ -1,6 +1,6 @@

    Rune Balances

      -%% for (rune, runes_balances) in &self.runes_balances { +%% for (rune, balances) in &self.balances {
    • {{ rune }} @@ -8,7 +8,7 @@

      Rune Balances

      - %% for (outpoint, balance) in runes_balances { + %% for (outpoint, balance) in balances { - +
      outpoint balance
      {{outpoint.txid}}:{{outpoint.vout}} From c4b650391781e7abe51c8ec5cc73357ce393acef Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 15:32:27 -0800 Subject: [PATCH 16/23] Make HTML nested tables --- templates/rune-balances.html | 52 ++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/templates/rune-balances.html b/templates/rune-balances.html index d83027b835..68a4d0e38b 100644 --- a/templates/rune-balances.html +++ b/templates/rune-balances.html @@ -1,24 +1,30 @@

      Rune Balances

      - + + + + + + %% for (rune, balances) in &self.balances { + + + + + %% } +
      runebalances
      {{ rune }} + + + + + + %% for (outpoint, balance) in balances { + + + + + %% } +
      outpointbalance
      + {{ outpoint }} + + {{ balance }} +
      +
      From c98649b4a6870502521da8d419a36c942bb0e8b2 Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 15:53:40 -0800 Subject: [PATCH 17/23] Amend --- src/templates/rune_balances.rs | 84 ++++++++++++++++++++++++++++++++++ tests/json_api.rs | 10 ++-- 2 files changed, 89 insertions(+), 5 deletions(-) diff --git a/src/templates/rune_balances.rs b/src/templates/rune_balances.rs index db8e998fdb..db62fea6f8 100644 --- a/src/templates/rune_balances.rs +++ b/src/templates/rune_balances.rs @@ -10,3 +10,87 @@ impl PageContent for RuneBalancesHtml { "Rune Balances".to_string() } } + +#[cfg(test)] +mod tests { + use super::*; + + const RUNE: u128 = 99246114928149462; + + #[test] + fn display_rune_balances() { + let mut balances: BTreeMap> = BTreeMap::new(); + + let rune_a = Rune(RUNE); + let rune_b = Rune(RUNE + 1); + + let mut rune_a_balances: BTreeMap = BTreeMap::new(); + rune_a_balances.insert( + OutPoint { + txid: txid(1), + vout: 1, + }, + 1000, + ); + + let mut rune_b_balances: BTreeMap = BTreeMap::new(); + rune_b_balances.insert( + OutPoint { + txid: txid(2), + vout: 2, + }, + 12345678, + ); + + balances.insert(rune_a, rune_a_balances); + balances.insert(rune_b, rune_b_balances); + + assert_regex_match!( + RuneBalancesHtml { balances }.to_string(), + "

      Rune Balances

      + + + + + + + + + + + + + +
      runebalances
      .* + + + + + + + + + +
      outpointbalance
      + .* + + 1000 +
      +
      .* + + + + + + + + + +
      outpointbalance
      + .* + + 12345678 +
      +
      ".unindent()); + } +} diff --git a/tests/json_api.rs b/tests/json_api.rs index f93669921b..4802e5973f 100644 --- a/tests/json_api.rs +++ b/tests/json_api.rs @@ -663,14 +663,14 @@ fn get_runes_balances() { let runes_balance_json: BTreeMap> = serde_json::from_str(&response.text().unwrap()).unwrap(); - let mut runes_balances: BTreeMap> = BTreeMap::new(); + let mut rune_balances: BTreeMap> = BTreeMap::new(); let mut b0: BTreeMap = BTreeMap::new(); let o0: OutPoint = OutPoint { txid: e0.transaction, vout: 1, }; b0.insert(o0, 1000); - runes_balances.insert(rune0, b0); + rune_balances.insert(rune0, b0); let mut b1: BTreeMap = BTreeMap::new(); let o1: OutPoint = OutPoint { @@ -678,7 +678,7 @@ fn get_runes_balances() { vout: 1, }; b1.insert(o1, 1000); - runes_balances.insert(rune1, b1); + rune_balances.insert(rune1, b1); let mut b2: BTreeMap = BTreeMap::new(); let o2: OutPoint = OutPoint { @@ -686,7 +686,7 @@ fn get_runes_balances() { vout: 1, }; b2.insert(o2, 1000); - runes_balances.insert(rune2, b2); + rune_balances.insert(rune2, b2); - pretty_assert_eq!(runes_balance_json, runes_balances); + pretty_assert_eq!(runes_balance_json, rune_balances); } From 0f0d3e5e8945822940cf29144b05b9c83edc3826 Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 16:06:41 -0800 Subject: [PATCH 18/23] Amend --- src/templates/rune_balances.rs | 4 ++-- templates/rune-balances.html | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/templates/rune_balances.rs b/src/templates/rune_balances.rs index db62fea6f8..faa5001a20 100644 --- a/src/templates/rune_balances.rs +++ b/src/templates/rune_balances.rs @@ -54,7 +54,7 @@ mod tests {
      balances
      .*.* @@ -73,7 +73,7 @@ mod tests { - + - %% } +%% }
      .*.* diff --git a/templates/rune-balances.html b/templates/rune-balances.html index 68a4d0e38b..acaef317a0 100644 --- a/templates/rune-balances.html +++ b/templates/rune-balances.html @@ -4,7 +4,7 @@

      Rune Balances

      - %% for (rune, balances) in &self.balances { +%% for (rune, balances) in &self.balances { - %% for (outpoint, balance) in balances { +%% for (outpoint, balance) in balances { - %% } +%% }
      rune balances
      {{ rune }} @@ -13,7 +13,7 @@

      Rune Balances

      outpoint balance
      {{ outpoint }} @@ -22,9 +22,9 @@

      Rune Balances

      {{ balance }}
      From e89a2f008db618c98fc395291d8b07a604c44ccd Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 20:08:37 -0800 Subject: [PATCH 19/23] Fix table formatting --- src/templates/rune_balances.rs | 29 +++++++++------------- static/index.css | 44 +++++++++++++++++++++++++--------- templates/rune-balances.html | 14 ++++------- 3 files changed, 49 insertions(+), 38 deletions(-) diff --git a/src/templates/rune_balances.rs b/src/templates/rune_balances.rs index faa5001a20..19061c5549 100644 --- a/src/templates/rune_balances.rs +++ b/src/templates/rune_balances.rs @@ -48,24 +48,20 @@ mod tests { assert_regex_match!( RuneBalancesHtml { balances }.to_string(), "

      Rune Balances

      - +
      - +
      rune balances
      .*.* - +
      - - - - - - @@ -73,24 +69,21 @@ mod tests { - + -
      outpointbalance
      + .* + 1000
      .*.* - - - - - +
      outpointbalance
      - -
      + .* + 12345678
      ".unindent()); +
      +".unindent()); } } diff --git a/static/index.css b/static/index.css index 1631fe3a40..f747a62834 100644 --- a/static/index.css +++ b/static/index.css @@ -73,7 +73,7 @@ nav { padding: 1rem; } -nav > :first-child { +nav> :first-child { color: var(--light-fg); font-weight: bold; } @@ -104,7 +104,8 @@ dl { overflow-wrap: break-word; } -ol, ul { +ol, +ul { overflow: hidden; } @@ -145,7 +146,26 @@ ol, ul { font-family: monospace, monospace; } -span.common, span.uncommon, span.rare, span.epic, span.legendary, span.mythic { +.right-align { + text-align: right; +} + +.full-width-table { + position: absolute; + right: 0; + width: 100vw; +} + +.full-width { + width: 100%; +} + +span.common, +span.uncommon, +span.rare, +span.epic, +span.legendary, +span.mythic { border-radius: 0.25rem; color: white; padding: 0.125rem 0.25rem; @@ -204,7 +224,7 @@ a.mythic { flex-wrap: wrap; } -.thumbnails > a { +.thumbnails>a { border-radius: 2%; margin: 1%; overflow: hidden; @@ -222,7 +242,8 @@ a.mythic { justify-content: center; } -.inscription > *:nth-child(1), .inscription > *:nth-child(3) { +.inscription>*:nth-child(1), +.inscription>*:nth-child(3) { align-items: center; color: var(--dark-bg); display: flex; @@ -232,15 +253,16 @@ a.mythic { text-decoration: none; } -.inscription > a:nth-child(1):hover, .inscription > a:nth-child(3):hover { +.inscription>a:nth-child(1):hover, +.inscription>a:nth-child(3):hover { color: var(--dark-fg); } -.inscription > *:nth-child(2) { +.inscription>*:nth-child(2) { flex: 0 75%; } -.inscription > a > iframe { +.inscription>a>iframe { width: 100%; } @@ -249,17 +271,17 @@ a.mythic { display: flex; } -.tabs > a { +.tabs>a { color: var(--light-fg); padding: 1rem; } -.tabs > *:first-child { +.tabs>*:first-child { flex: 1; text-align: right; } -.tabs > *:last-child { +.tabs>*:last-child { flex: 1; text-align: left; } diff --git a/templates/rune-balances.html b/templates/rune-balances.html index acaef317a0..ddbdeb762a 100644 --- a/templates/rune-balances.html +++ b/templates/rune-balances.html @@ -1,24 +1,20 @@

      Rune Balances

      - +
      %% for (rune, balances) in &self.balances { - +
      rune balances
      {{ rune }}{{ rune }} - - - - - +
      outpointbalance
      %% for (outpoint, balance) in balances { - - From 9e21d5b41757788d54072e1b21120394b2dcc66a Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 21:14:59 -0800 Subject: [PATCH 20/23] remove CSS --- src/templates/rune_balances.rs | 14 +++++++------- static/index.css | 10 ---------- templates/rune-balances.html | 8 ++++---- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/templates/rune_balances.rs b/src/templates/rune_balances.rs index 19061c5549..bf8d4e363b 100644 --- a/src/templates/rune_balances.rs +++ b/src/templates/rune_balances.rs @@ -48,20 +48,20 @@ mod tests { assert_regex_match!( RuneBalancesHtml { balances }.to_string(), "

      Rune Balances

      -
      + {{ outpoint }} + {{ balance }}
      +
      - +
      rune balances
      .*.* - +
      - @@ -69,14 +69,14 @@ mod tests { - +
      .* + 1000
      .*.* - +
      - diff --git a/static/index.css b/static/index.css index f747a62834..d5b79aac06 100644 --- a/static/index.css +++ b/static/index.css @@ -150,16 +150,6 @@ ul { text-align: right; } -.full-width-table { - position: absolute; - right: 0; - width: 100vw; -} - -.full-width { - width: 100%; -} - span.common, span.uncommon, span.rare, diff --git a/templates/rune-balances.html b/templates/rune-balances.html index ddbdeb762a..d39c0a36e8 100644 --- a/templates/rune-balances.html +++ b/templates/rune-balances.html @@ -1,20 +1,20 @@

      Rune Balances

      -
      .* + 12345678
      +
      %% for (rune, balances) in &self.balances { - +
      rune balances
      {{ rune }}{{ rune }} - +
      %% for (outpoint, balance) in balances { - From 1e78daa86d8fde37523623c88055c4344e8b089a Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 21:24:52 -0800 Subject: [PATCH 21/23] Make tests pretty --- src/templates/rune_balances.rs | 53 ++++++++++++++------------- tests/json_api.rs | 67 +++++++++++++++++++++------------- 2 files changed, 70 insertions(+), 50 deletions(-) diff --git a/src/templates/rune_balances.rs b/src/templates/rune_balances.rs index bf8d4e363b..d4712cc613 100644 --- a/src/templates/rune_balances.rs +++ b/src/templates/rune_balances.rs @@ -19,31 +19,34 @@ mod tests { #[test] fn display_rune_balances() { - let mut balances: BTreeMap> = BTreeMap::new(); - - let rune_a = Rune(RUNE); - let rune_b = Rune(RUNE + 1); - - let mut rune_a_balances: BTreeMap = BTreeMap::new(); - rune_a_balances.insert( - OutPoint { - txid: txid(1), - vout: 1, - }, - 1000, - ); - - let mut rune_b_balances: BTreeMap = BTreeMap::new(); - rune_b_balances.insert( - OutPoint { - txid: txid(2), - vout: 2, - }, - 12345678, - ); - - balances.insert(rune_a, rune_a_balances); - balances.insert(rune_b, rune_b_balances); + let balances: BTreeMap> = vec![ + ( + Rune(RUNE), + vec![( + OutPoint { + txid: txid(1), + vout: 1, + }, + 1000, + )] + .into_iter() + .collect(), + ), + ( + Rune(RUNE + 1), + vec![( + OutPoint { + txid: txid(2), + vout: 2, + }, + 12345678, + )] + .into_iter() + .collect(), + ), + ] + .into_iter() + .collect(); assert_regex_match!( RuneBalancesHtml { balances }.to_string(), diff --git a/tests/json_api.rs b/tests/json_api.rs index 4802e5973f..03f699d0d6 100644 --- a/tests/json_api.rs +++ b/tests/json_api.rs @@ -651,42 +651,59 @@ fn get_runes_balances() { let rune0 = Rune(RUNE); let rune1 = Rune(RUNE + 1); let rune2 = Rune(RUNE + 2); + let e0 = etch(&bitcoin_rpc_server, &ord_rpc_server, rune0); let e1 = etch(&bitcoin_rpc_server, &ord_rpc_server, rune1); let e2 = etch(&bitcoin_rpc_server, &ord_rpc_server, rune2); bitcoin_rpc_server.mine_blocks(1); + let rune_balances: BTreeMap> = vec![ + ( + rune0, + vec![( + OutPoint { + txid: e0.transaction, + vout: 1, + }, + 1000, + )] + .into_iter() + .collect(), + ), + ( + rune1, + vec![( + OutPoint { + txid: e1.transaction, + vout: 1, + }, + 1000, + )] + .into_iter() + .collect(), + ), + ( + rune2, + vec![( + OutPoint { + txid: e2.transaction, + vout: 1, + }, + 1000, + )] + .into_iter() + .collect(), + ), + ] + .into_iter() + .collect(); + let response = ord_rpc_server.json_request("/runes/balances"); assert_eq!(response.status(), StatusCode::OK); let runes_balance_json: BTreeMap> = serde_json::from_str(&response.text().unwrap()).unwrap(); - let mut rune_balances: BTreeMap> = BTreeMap::new(); - let mut b0: BTreeMap = BTreeMap::new(); - let o0: OutPoint = OutPoint { - txid: e0.transaction, - vout: 1, - }; - b0.insert(o0, 1000); - rune_balances.insert(rune0, b0); - - let mut b1: BTreeMap = BTreeMap::new(); - let o1: OutPoint = OutPoint { - txid: e1.transaction, - vout: 1, - }; - b1.insert(o1, 1000); - rune_balances.insert(rune1, b1); - - let mut b2: BTreeMap = BTreeMap::new(); - let o2: OutPoint = OutPoint { - txid: e2.transaction, - vout: 1, - }; - b2.insert(o2, 1000); - rune_balances.insert(rune2, b2); - pretty_assert_eq!(runes_balance_json, rune_balances); } From e219c97b7f0d9f0e37895a3fb1910837cec1a016 Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 21:31:17 -0800 Subject: [PATCH 22/23] Revert CSS to master --- src/templates/rune_balances.rs | 4 ++-- static/index.css | 34 +++++++++++----------------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/templates/rune_balances.rs b/src/templates/rune_balances.rs index d4712cc613..02564285b4 100644 --- a/src/templates/rune_balances.rs +++ b/src/templates/rune_balances.rs @@ -62,7 +62,7 @@ mod tests {
      {{ outpoint }} + {{ balance }}
      - .* + 1{64}:1 1000 @@ -77,7 +77,7 @@ mod tests {
      - .* + 2{64}:2 12345678 diff --git a/static/index.css b/static/index.css index d5b79aac06..1631fe3a40 100644 --- a/static/index.css +++ b/static/index.css @@ -73,7 +73,7 @@ nav { padding: 1rem; } -nav> :first-child { +nav > :first-child { color: var(--light-fg); font-weight: bold; } @@ -104,8 +104,7 @@ dl { overflow-wrap: break-word; } -ol, -ul { +ol, ul { overflow: hidden; } @@ -146,16 +145,7 @@ ul { font-family: monospace, monospace; } -.right-align { - text-align: right; -} - -span.common, -span.uncommon, -span.rare, -span.epic, -span.legendary, -span.mythic { +span.common, span.uncommon, span.rare, span.epic, span.legendary, span.mythic { border-radius: 0.25rem; color: white; padding: 0.125rem 0.25rem; @@ -214,7 +204,7 @@ a.mythic { flex-wrap: wrap; } -.thumbnails>a { +.thumbnails > a { border-radius: 2%; margin: 1%; overflow: hidden; @@ -232,8 +222,7 @@ a.mythic { justify-content: center; } -.inscription>*:nth-child(1), -.inscription>*:nth-child(3) { +.inscription > *:nth-child(1), .inscription > *:nth-child(3) { align-items: center; color: var(--dark-bg); display: flex; @@ -243,16 +232,15 @@ a.mythic { text-decoration: none; } -.inscription>a:nth-child(1):hover, -.inscription>a:nth-child(3):hover { +.inscription > a:nth-child(1):hover, .inscription > a:nth-child(3):hover { color: var(--dark-fg); } -.inscription>*:nth-child(2) { +.inscription > *:nth-child(2) { flex: 0 75%; } -.inscription>a>iframe { +.inscription > a > iframe { width: 100%; } @@ -261,17 +249,17 @@ a.mythic { display: flex; } -.tabs>a { +.tabs > a { color: var(--light-fg); padding: 1rem; } -.tabs>*:first-child { +.tabs > *:first-child { flex: 1; text-align: right; } -.tabs>*:last-child { +.tabs > *:last-child { flex: 1; text-align: left; } From 3ba7f853a8d88ad92e8991d9ad930922d1d15a55 Mon Sep 17 00:00:00 2001 From: raphjaph Date: Tue, 30 Jan 2024 21:31:34 -0800 Subject: [PATCH 23/23] Revert CSS to master --- src/templates/rune_balances.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/templates/rune_balances.rs b/src/templates/rune_balances.rs index 02564285b4..2ab7f4803e 100644 --- a/src/templates/rune_balances.rs +++ b/src/templates/rune_balances.rs @@ -87,6 +87,8 @@ mod tests {
      -".unindent()); +" + .unindent() + ); } }