From 084173c754ca52a887c5ea8ce4591af9df243349 Mon Sep 17 00:00:00 2001 From: Eloc <42568538+elocremarc@users.noreply.github.com> Date: Sat, 26 Oct 2024 04:22:15 -0700 Subject: [PATCH] revere mapping emoji as values --- docs/src/inscriptions/recursion.md | 49 ++++++++++++++---------------- src/subcommand/server.rs | 8 ++--- 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/docs/src/inscriptions/recursion.md b/docs/src/inscriptions/recursion.md index 086e6e69c7..fe18686bc7 100644 --- a/docs/src/inscriptions/recursion.md +++ b/docs/src/inscriptions/recursion.md @@ -1,8 +1,7 @@ -Recursion -========= +# Recursion An important exception to [sandboxing](../inscriptions.md#sandboxing) is -recursion. Recursive endpoints are whitelisted endpoints that allow access to +recursion. Recursive endpoints are whitelisted endpoints that allow access to1 on-chain data, including the content of other inscriptions. Since changes to recursive endpoints might break inscriptions that rely on @@ -32,7 +31,7 @@ Recursion has a number of interesting use-cases: The recursive endpoints are: -- `/content/`: the content of the inscription with `` +- `/content/`: the content of the inscription with `` - `/r/blockhash/`: block hash at given block height. - `/r/blockhash`: latest block hash. - `/r/blockheight`: latest block height. @@ -64,8 +63,7 @@ plain-text responses. - `/blockhash/`: block hash at given block height. - `/blocktime`: UNIX time stamp of latest block. -Examples --------- +## Examples - `/r/blockhash/0`: @@ -143,19 +141,19 @@ percentile in sats/vB. ```json { - "👹": "cursed", - "đŸĒģ": "epic", - "đŸ§ŋ": "rare", - "đŸĒ™": "coin", - "🌱": "uncommon", - "🎃": "mythic", - "9ī¸âƒŖ": "nineball", - "🔓": "unbound", - "❤ī¸â€đŸ”Ĩ": "vindicated", - "â™ģī¸": "reinscription", - "🤔": "lost", - "🌝": "legendary", - "đŸ”Ĩ": "burned" + "cursed": "👹", + "epic": "đŸĒģ", + "rare": "đŸ§ŋ", + "coin": "đŸĒ™", + "uncommon": "🌱", + "mythic": "🎃", + "nineball": "9ī¸âƒŖ", + "unbound": "🔓", + "vindicated": "❤ī¸â€đŸ”Ĩ", + "reinscription": "â™ģī¸", + "lost": "🤔", + "legendary": "🌝", + "burned": "đŸ”Ĩ" } ``` @@ -228,11 +226,9 @@ percentile in sats/vB. ```json { - "ids":[ - "17541f6adf6eb160d52bc6eb0a3546c7c1d2adfe607b1a3cddc72cc0619526adi0" - ], - "more":false, - "page":0 + "ids": ["17541f6adf6eb160d52bc6eb0a3546c7c1d2adfe607b1a3cddc72cc0619526adi0"], + "more": false, + "page": 0 } ``` @@ -240,10 +236,9 @@ percentile in sats/vB. ```json { - "id":"17541f6adf6eb160d52bc6eb0a3546c7c1d2adfe607b1a3cddc72cc0619526adi0" + "id": "17541f6adf6eb160d52bc6eb0a3546c7c1d2adfe607b1a3cddc72cc0619526adi0" } ``` - See -[examples](examples.md#recursion) for on-chain examples of inscriptions that feature this functionality. \ No newline at end of file +[examples](examples.md#recursion) for on-chain examples of inscriptions that feature this functionality. diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index aaa221b2fe..2ad7af3c9a 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -1743,7 +1743,7 @@ impl Server { async fn charms() -> ServerResult { let charms_map: HashMap = Charm::ALL .iter() - .map(|charm| (charm.icon().to_string(), charm.to_string())) + .map(|charm| (charm.to_string(), charm.icon().to_string())) .collect(); Ok(Json(charms_map).into_response()) @@ -6261,15 +6261,15 @@ next assert!(!charms_response.is_empty()); for charm in Charm::ALL { - let icon = charm.icon(); + let icon = charm.icon().to_string(); let name = charm.to_string(); - assert_eq!(charms_response.get(icon), Some(&name)); + assert_eq!(charms_response.get(&name), Some(&icon)); } assert_eq!(charms_response.len(), Charm::ALL.len()); for value in charms_response.values() { - assert!(Charm::ALL.iter().any(|c| c.to_string() == *value)); + assert!(Charm::ALL.iter().any(|c| c.icon() == value)); } }