From 64910b6dd0e1ffbab007601a95f00d51d133684f Mon Sep 17 00:00:00 2001 From: raphjaph Date: Thu, 23 Nov 2023 17:31:07 -0300 Subject: [PATCH 1/4] Add docs and examples for sat recursive endpoint --- docs/src/inscriptions/recursion.md | 53 ++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/docs/src/inscriptions/recursion.md b/docs/src/inscriptions/recursion.md index ce8ddbd09c..f7a0375363 100644 --- a/docs/src/inscriptions/recursion.md +++ b/docs/src/inscriptions/recursion.md @@ -23,12 +23,61 @@ This has a number of interesting use-cases: The recursive endpoints are: - `/r/blockheight`: latest block height. + +```json +777000 +``` + - `/r/blockhash`: latest block hash. + +```json +"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" +``` + - `/r/blockhash/`: block hash at given block height. + - `/r/blocktime`: UNIX time stamp of latest block. -- `/r/metadata/`: returns a JSON string containing the hex-encoded CBOR metadata. -Responses from the above recursive endpoints are JSON. For backwards compatibility additional endpoints are supported, some of which return plain-text responses. +```json +1700770905 +``` + +- `/r/metadata/`: JSON string containing the + hex-encoded CBOR metadata. + +```json +"a2657469746c65664d656d6f727966617574686f726e79656c6c6f775f6f72645f626f74" +``` + +- `/r/sat/`: the first 100 inscription ids on a sat. + +```json +{ + "ids":[ + "17541f6adf6eb160d52bc6eb0a3546c7c1d2adfe607b1a3cddc72cc0619526adi0" + ], + "more":false, + "page":0 +} +``` + +- `/r/sat//`: the set of 100 inscription ids on ``. +- `/r/sat//at/`: the inscription id at `` of all + inscriptions on a sat. + +```json +{ + "id":"17541f6adf6eb160d52bc6eb0a3546c7c1d2adfe607b1a3cddc72cc0619526adi0" +} +``` + +Note: `` only allows the actual number of a sat no other sat +notations like degree, percentile or decimal. We may expand to allow those in +the future. + +Responses from the above recursive endpoints are JSON. For backwards +compatibility additional endpoints are supported, some of which return +plain-text responses. - `/blockheight`: latest block height. - `/blockhash`: latest block hash. From 76a4eb1e41ac6998c60ca09e191782a73fc1fcf8 Mon Sep 17 00:00:00 2001 From: raphjaph Date: Thu, 23 Nov 2023 17:35:33 -0300 Subject: [PATCH 2/4] move to separate examples section --- docs/src/inscriptions/recursion.md | 55 +++++++++++++++++------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/docs/src/inscriptions/recursion.md b/docs/src/inscriptions/recursion.md index f7a0375363..c702984f7f 100644 --- a/docs/src/inscriptions/recursion.md +++ b/docs/src/inscriptions/recursion.md @@ -23,33 +23,57 @@ This has a number of interesting use-cases: The recursive endpoints are: - `/r/blockheight`: latest block height. +- `/r/blockhash`: latest block hash. +- `/r/blockhash/`: block hash at given block height. +- `/r/blocktime`: UNIX time stamp of latest block. +- `/r/metadata/`: JSON string containing the + hex-encoded CBOR metadata. +- `/r/sat/`: the first 100 inscription ids on a sat. +- `/r/sat//`: the set of 100 inscription ids on ``. +- `/r/sat//at/`: the inscription id at `` of all + inscriptions on a sat. + +Note: `` only allows the actual number of a sat no other sat +notations like degree, percentile or decimal. We may expand to allow those in +the future. + +Responses from the above recursive endpoints are JSON. For backwards +compatibility additional endpoints are supported, some of which return +plain-text responses. + +- `/blockheight`: latest block height. +- `/blockhash`: latest block hash. +- `/blockhash/`: block hash at given block height. +- `/blocktime`: UNIX time stamp of latest block. + +Examples +-------- + +- `/r/blockheight`: ```json 777000 ``` -- `/r/blockhash`: latest block hash. +- `/r/blockhash/0`: ```json "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" ``` -- `/r/blockhash/`: block hash at given block height. - -- `/r/blocktime`: UNIX time stamp of latest block. +- `/r/blocktime`: ```json 1700770905 ``` -- `/r/metadata/`: JSON string containing the - hex-encoded CBOR metadata. +- `/r/metadata/35b66389b44535861c44b2b18ed602997ee11db9a30d384ae89630c9fc6f011fi3`: ```json "a2657469746c65664d656d6f727966617574686f726e79656c6c6f775f6f72645f626f74" ``` -- `/r/sat/`: the first 100 inscription ids on a sat. +- `/r/sat/1023795949035695`: ```json { @@ -61,25 +85,10 @@ The recursive endpoints are: } ``` -- `/r/sat//`: the set of 100 inscription ids on ``. -- `/r/sat//at/`: the inscription id at `` of all - inscriptions on a sat. +- `/r/sat/1023795949035695/at/0`: ```json { "id":"17541f6adf6eb160d52bc6eb0a3546c7c1d2adfe607b1a3cddc72cc0619526adi0" } ``` - -Note: `` only allows the actual number of a sat no other sat -notations like degree, percentile or decimal. We may expand to allow those in -the future. - -Responses from the above recursive endpoints are JSON. For backwards -compatibility additional endpoints are supported, some of which return -plain-text responses. - -- `/blockheight`: latest block height. -- `/blockhash`: latest block hash. -- `/blockhash/`: block hash at given block height. -- `/blocktime`: UNIX time stamp of latest block. From 66f475fdec743c5ec9eab8dc712cca7d6f681c0f Mon Sep 17 00:00:00 2001 From: raphjaph Date: Thu, 23 Nov 2023 17:37:18 -0300 Subject: [PATCH 3/4] quick fix --- docs/src/inscriptions/recursion.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/src/inscriptions/recursion.md b/docs/src/inscriptions/recursion.md index c702984f7f..8b8e5fa565 100644 --- a/docs/src/inscriptions/recursion.md +++ b/docs/src/inscriptions/recursion.md @@ -31,7 +31,8 @@ The recursive endpoints are: - `/r/sat/`: the first 100 inscription ids on a sat. - `/r/sat//`: the set of 100 inscription ids on ``. - `/r/sat//at/`: the inscription id at `` of all - inscriptions on a sat. + inscriptions on a sat. `` may be a negative number to index from the + back. Note: `` only allows the actual number of a sat no other sat notations like degree, percentile or decimal. We may expand to allow those in @@ -85,7 +86,7 @@ Examples } ``` -- `/r/sat/1023795949035695/at/0`: +- `/r/sat/1023795949035695/at/-1`: ```json { From 0b7c68e789e8420a831c2fdd877f3a20e27ae913 Mon Sep 17 00:00:00 2001 From: raphjaph Date: Fri, 24 Nov 2023 13:59:07 -0300 Subject: [PATCH 4/4] be more explicit --- docs/src/inscriptions/recursion.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/inscriptions/recursion.md b/docs/src/inscriptions/recursion.md index 8b8e5fa565..46d2ac6458 100644 --- a/docs/src/inscriptions/recursion.md +++ b/docs/src/inscriptions/recursion.md @@ -32,7 +32,7 @@ The recursive endpoints are: - `/r/sat//`: the set of 100 inscription ids on ``. - `/r/sat//at/`: the inscription id at `` of all inscriptions on a sat. `` may be a negative number to index from the - back. + back. `0` being the first and `-1` being the most recent for example. Note: `` only allows the actual number of a sat no other sat notations like degree, percentile or decimal. We may expand to allow those in