Skip to content

Commit

Permalink
revere mapping emoji as values
Browse files Browse the repository at this point in the history
  • Loading branch information
elocremarc committed Oct 26, 2024
1 parent 172e9ba commit 084173c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 31 deletions.
49 changes: 22 additions & 27 deletions docs/src/inscriptions/recursion.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -32,7 +31,7 @@ Recursion has a number of interesting use-cases:

The recursive endpoints are:

- `/content/<INSCRIPTION_ID>`: the content of the inscription with `<INSCRIPTION_ID>`
- `/content/<INSCRIPTION_ID>`: the content of the inscription with `<INSCRIPTION_ID>`
- `/r/blockhash/<HEIGHT>`: block hash at given block height.
- `/r/blockhash`: latest block hash.
- `/r/blockheight`: latest block height.
Expand Down Expand Up @@ -64,8 +63,7 @@ plain-text responses.
- `/blockhash/<HEIGHT>`: block hash at given block height.
- `/blocktime`: UNIX time stamp of latest block.

Examples
--------
## Examples

- `/r/blockhash/0`:

Expand Down Expand Up @@ -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": "🔥"
}
```

Expand Down Expand Up @@ -228,22 +226,19 @@ percentile in sats/vB.

```json
{
"ids":[
"17541f6adf6eb160d52bc6eb0a3546c7c1d2adfe607b1a3cddc72cc0619526adi0"
],
"more":false,
"page":0
"ids": ["17541f6adf6eb160d52bc6eb0a3546c7c1d2adfe607b1a3cddc72cc0619526adi0"],
"more": false,
"page": 0
}
```

- `/r/sat/1023795949035695/at/-1`:

```json
{
"id":"17541f6adf6eb160d52bc6eb0a3546c7c1d2adfe607b1a3cddc72cc0619526adi0"
"id": "17541f6adf6eb160d52bc6eb0a3546c7c1d2adfe607b1a3cddc72cc0619526adi0"
}
```


See
[examples](examples.md#recursion) for on-chain examples of inscriptions that feature this functionality.
[examples](examples.md#recursion) for on-chain examples of inscriptions that feature this functionality.
8 changes: 4 additions & 4 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ impl Server {
async fn charms() -> ServerResult {
let charms_map: HashMap<String, String> = 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())
Expand Down Expand Up @@ -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));
}
}

Expand Down

0 comments on commit 084173c

Please sign in to comment.