---
diff --git a/content/docs/bitcoin/ordinals/api/brc20/get-brc20-activity.mdx b/content/docs/bitcoin/ordinals/api/brc20/get-brc20-activity.mdx
index 3a4ef0438..835be2513 100644
--- a/content/docs/bitcoin/ordinals/api/brc20/get-brc20-activity.mdx
+++ b/content/docs/bitcoin/ordinals/api/brc20/get-brc20-activity.mdx
@@ -99,8 +99,8 @@ Results per page
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/brc-20/activity?ticker=%5B%0A++%22string%22%0A%5D&block_height=string&operation=%5B%0A++%22deploy%22%0A%5D&address=string&offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/brc-20/activity?ticker=%5B%0A++%22string%22%0A%5D&block_height=string&operation=%5B%0A++%22deploy%22%0A%5D&address=string&offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/ordinals/api/brc20/get-brc20-balances.mdx b/content/docs/bitcoin/ordinals/api/brc20/get-brc20-balances.mdx
index 1d1907643..d4fe92a75 100644
--- a/content/docs/bitcoin/ordinals/api/brc20/get-brc20-balances.mdx
+++ b/content/docs/bitcoin/ordinals/api/brc20/get-brc20-balances.mdx
@@ -86,8 +86,8 @@ Bitcoin address
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/brc-20/balances/string?ticker=%5B%0A++%22string%22%0A%5D&block_height=string&offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/brc-20/balances/string?ticker=%5B%0A++%22string%22%0A%5D&block_height=string&offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/ordinals/api/brc20/get-brc20-token-details.mdx b/content/docs/bitcoin/ordinals/api/brc20/get-brc20-token-details.mdx
index 42f5d0346..6da99a263 100644
--- a/content/docs/bitcoin/ordinals/api/brc20/get-brc20-token-details.mdx
+++ b/content/docs/bitcoin/ordinals/api/brc20/get-brc20-token-details.mdx
@@ -53,8 +53,8 @@ Retrieves information for a BRC-20 token including supply and holders
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/brc-20/tokens/string"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/brc-20/tokens/string"
```
diff --git a/content/docs/bitcoin/ordinals/api/brc20/get-brc20-token-holders.mdx b/content/docs/bitcoin/ordinals/api/brc20/get-brc20-token-holders.mdx
index c5cf2dcb1..103ea1057 100644
--- a/content/docs/bitcoin/ordinals/api/brc20/get-brc20-token-holders.mdx
+++ b/content/docs/bitcoin/ordinals/api/brc20/get-brc20-token-holders.mdx
@@ -73,8 +73,8 @@ Results per page
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/brc-20/tokens/string/holders?offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/brc-20/tokens/string/holders?offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/ordinals/api/brc20/get-brc20-tokens.mdx b/content/docs/bitcoin/ordinals/api/brc20/get-brc20-tokens.mdx
index 4927fd653..1be281dbe 100644
--- a/content/docs/bitcoin/ordinals/api/brc20/get-brc20-tokens.mdx
+++ b/content/docs/bitcoin/ordinals/api/brc20/get-brc20-tokens.mdx
@@ -76,8 +76,8 @@ Results per page
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/brc-20/tokens?ticker=%5B%0A++%22string%22%0A%5D&order_by=tx_count&offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/brc-20/tokens?ticker=%5B%0A++%22string%22%0A%5D&order_by=tx_count&offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/ordinals/api/info/status.mdx b/content/docs/bitcoin/ordinals/api/info/status.mdx
index c50f50b9c..780e4b239 100644
--- a/content/docs/bitcoin/ordinals/api/info/status.mdx
+++ b/content/docs/bitcoin/ordinals/api/info/status.mdx
@@ -46,8 +46,8 @@ Displays the status of the API
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/"
```
diff --git a/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription-content.mdx b/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription-content.mdx
index d45dc9256..901d0815e 100644
--- a/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription-content.mdx
+++ b/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription-content.mdx
@@ -55,8 +55,8 @@ Inscription unique identifier (number or ID)
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/inscriptions/38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0/content"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/inscriptions/38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0/content"
```
diff --git a/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription-transfers.mdx b/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription-transfers.mdx
index dad025219..2dee370a1 100644
--- a/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription-transfers.mdx
+++ b/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription-transfers.mdx
@@ -75,8 +75,8 @@ Inscription unique identifier (number or ID)
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/inscriptions/38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0/transfers?offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/inscriptions/38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0/transfers?offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription.mdx b/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription.mdx
index 8d4edaf5e..ee582a52c 100644
--- a/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription.mdx
+++ b/content/docs/bitcoin/ordinals/api/inscriptions/get-inscription.mdx
@@ -55,8 +55,8 @@ Inscription unique identifier (number or ID)
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/inscriptions/38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/inscriptions/38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0"
```
diff --git a/content/docs/bitcoin/ordinals/api/inscriptions/get-inscriptions.mdx b/content/docs/bitcoin/ordinals/api/inscriptions/get-inscriptions.mdx
index 42d3a2996..db54e3e62 100644
--- a/content/docs/bitcoin/ordinals/api/inscriptions/get-inscriptions.mdx
+++ b/content/docs/bitcoin/ordinals/api/inscriptions/get-inscriptions.mdx
@@ -226,8 +226,8 @@ Results order
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/inscriptions?genesis_block=0000000000000000000452773967cdd62297137cdaf79950c5e8bb0c62075133&from_genesis_block_height=string&to_genesis_block_height=string&from_genesis_timestamp=0&to_genesis_timestamp=0&from_sat_ordinal=2099999997689999&to_sat_ordinal=2099999997689999&from_sat_coinbase_height=string&to_sat_coinbase_height=string&from_number=0&to_number=0&id=%5B%0A++%2238c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0%22%0A%5D&number=%5B%0A++%2210500%22%0A%5D&output=string&address=%5B%0A++%22bc1p8aq8s3z9xl87e74twfk93mljxq6alv4a79yheadx33t9np4g2wkqqt8kc5%22%0A%5D&genesis_address=%5B%0A++%22bc1p8aq8s3z9xl87e74twfk93mljxq6alv4a79yheadx33t9np4g2wkqqt8kc5%22%0A%5D&mime_type=%5B%0A++%22image%2Fpng%22%0A%5D&rarity=%5B%0A++%22uncommon%22%0A%5D&recursive=true&cursed=true&offset=0&limit=1&order_by=number&order=asc"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/inscriptions?genesis_block=0000000000000000000452773967cdd62297137cdaf79950c5e8bb0c62075133&from_genesis_block_height=string&to_genesis_block_height=string&from_genesis_timestamp=0&to_genesis_timestamp=0&from_sat_ordinal=2099999997689999&to_sat_ordinal=2099999997689999&from_sat_coinbase_height=string&to_sat_coinbase_height=string&from_number=0&to_number=0&id=%5B%0A++%2238c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0%22%0A%5D&number=%5B%0A++%2210500%22%0A%5D&output=string&address=%5B%0A++%22bc1p8aq8s3z9xl87e74twfk93mljxq6alv4a79yheadx33t9np4g2wkqqt8kc5%22%0A%5D&genesis_address=%5B%0A++%22bc1p8aq8s3z9xl87e74twfk93mljxq6alv4a79yheadx33t9np4g2wkqqt8kc5%22%0A%5D&mime_type=%5B%0A++%22image%2Fpng%22%0A%5D&rarity=%5B%0A++%22uncommon%22%0A%5D&recursive=true&cursed=true&offset=0&limit=1&order_by=number&order=asc"
```
diff --git a/content/docs/bitcoin/ordinals/api/inscriptions/get-transfers-per-block.mdx b/content/docs/bitcoin/ordinals/api/inscriptions/get-transfers-per-block.mdx
index 7f2b14286..1432ccb81 100644
--- a/content/docs/bitcoin/ordinals/api/inscriptions/get-transfers-per-block.mdx
+++ b/content/docs/bitcoin/ordinals/api/inscriptions/get-transfers-per-block.mdx
@@ -73,8 +73,8 @@ Results per page
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/inscriptions/transfers?block=0000000000000000000452773967cdd62297137cdaf79950c5e8bb0c62075133&offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/inscriptions/transfers?block=0000000000000000000452773967cdd62297137cdaf79950c5e8bb0c62075133&offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/ordinals/api/satoshis/get-satoshi-inscriptions.mdx b/content/docs/bitcoin/ordinals/api/satoshis/get-satoshi-inscriptions.mdx
index d5ebb2c18..a3ba20055 100644
--- a/content/docs/bitcoin/ordinals/api/satoshis/get-satoshi-inscriptions.mdx
+++ b/content/docs/bitcoin/ordinals/api/satoshis/get-satoshi-inscriptions.mdx
@@ -77,8 +77,8 @@ Ordinal number that uniquely identifies a satoshi
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/sats/2099999997689999/inscriptions?offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/sats/2099999997689999/inscriptions?offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/ordinals/api/satoshis/get-satoshi.mdx b/content/docs/bitcoin/ordinals/api/satoshis/get-satoshi.mdx
index 7c12c52eb..695c450f7 100644
--- a/content/docs/bitcoin/ordinals/api/satoshis/get-satoshi.mdx
+++ b/content/docs/bitcoin/ordinals/api/satoshis/get-satoshi.mdx
@@ -57,8 +57,8 @@ Ordinal number that uniquely identifies a satoshi
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/sats/2099999997689999"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/sats/2099999997689999"
```
diff --git a/content/docs/bitcoin/ordinals/api/statistics/get-stats-inscription-count.mdx b/content/docs/bitcoin/ordinals/api/statistics/get-stats-inscription-count.mdx
index aa3fa9bcb..51a418fe6 100644
--- a/content/docs/bitcoin/ordinals/api/statistics/get-stats-inscription-count.mdx
+++ b/content/docs/bitcoin/ordinals/api/statistics/get-stats-inscription-count.mdx
@@ -65,8 +65,8 @@ Bitcoin block height
-```bash
-curl -X GET "https://api.hiro.so/ordinals/v1/stats/inscriptions?from_block_height=string&to_block_height=string"
+```terminal
+$ curl -X GET "https://api.hiro.so/ordinals/v1/stats/inscriptions?from_block_height=string&to_block_height=string"
```
diff --git a/content/docs/bitcoin/ordinals/ordhook/guides/ordhook-as-a-service.mdx b/content/docs/bitcoin/ordinals/ordhook/guides/ordhook-as-a-service.mdx
index 92e29df1e..46023e62a 100644
--- a/content/docs/bitcoin/ordinals/ordhook/guides/ordhook-as-a-service.mdx
+++ b/content/docs/bitcoin/ordinals/ordhook/guides/ordhook-as-a-service.mdx
@@ -19,8 +19,8 @@ In this section, you will configure Ordhook to match the network configurations
Next, you will generate a `Ordhook.toml` file to connect Ordhook with your bitcoind node. Navigate to the directory where you want to generate the `Ordhook.toml` file and use the following command in your terminal:
-```console
-ordhook config generate --mainnet
+```terminal
+$ ordhook config generate --mainnet
```
Several network parameters in the generated `Ordhook.toml` configuration file need to match those in the `bitcoin.conf` file created earlier in the [setting up a Bitcoin node](#setting-up-a-bitcoin-node) section. Please update the following parameters accordingly:
diff --git a/content/docs/bitcoin/ordinals/ordhook/installation.mdx b/content/docs/bitcoin/ordinals/ordhook/installation.mdx
index 2e371be82..2ab37d465 100644
--- a/content/docs/bitcoin/ordinals/ordhook/installation.mdx
+++ b/content/docs/bitcoin/ordinals/ordhook/installation.mdx
@@ -5,11 +5,8 @@ toc: false
---
Clone the [Ordhook repository](https://github.com/hirosystems/ordhook) to your local machine and install via `cargo`.
-```console title="Terminal"
-# Clone the ordhook repository
+```terminal
$ git clone https://github.com/hirosystems/ordhook.git
-# Navigate into the ordhook directory
$ cd ordhook
-# Install ordhook using cargo
$ cargo ordhook-install
```
\ No newline at end of file
diff --git a/content/docs/bitcoin/ordinals/ordhook/quickstart.mdx b/content/docs/bitcoin/ordinals/ordhook/quickstart.mdx
index ccfe58bde..63db02bc8 100644
--- a/content/docs/bitcoin/ordinals/ordhook/quickstart.mdx
+++ b/content/docs/bitcoin/ordinals/ordhook/quickstart.mdx
@@ -15,8 +15,8 @@ Check out the [Ordhook as a service](/bitcoin/ordinals/ordhook/guides/ordhook-as
To scan blocks for Ordinal activity, you can use the `scan blocks` command. The output will show details of the inscription, including the block number it was revealed at, `ordinal_number`, and `inscription_number`.
- ```console title="Terminal"
- ordhook scan blocks --interval 767430:767753 --mainnet
+ ```terminal
+ $ ordhook scan blocks --interval 767430:767753 --mainnet
```
The `--interval` flag is used to specify a block range. The range is inclusive, meaning both the start and end blocks will be included in the scan. And the `--mainnet` flag is used to specify the Bitcoin network to scan.
@@ -30,16 +30,13 @@ Check out the [Ordhook as a service](/bitcoin/ordinals/ordhook/guides/ordhook-as
To inspect an inscription, you can run a similar command, `scan inscription` and pass in the inscription's ID.
- ```console title="Terminal"
- ordhook scan inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 --mainnet
- ```
-
- The output will show where and when the inscription was revealed and any subsequent transfer events.
-
- ```console
+ ```terminal
+ $ ordhook scan inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 --mainnet
Inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 revealed at block #767430 (ordinal_number 1252201400444387, inscription_number 0)
Transferred in transaction bc4c30829a9564c0d58e6287195622b53ced54a25711d1b86be7cd3a70ef61ed at block 785396
```
+
+ The output will show where and when the inscription was revealed and any subsequent transfer events.
diff --git a/content/docs/bitcoin/runes/api/activities/activity.mdx b/content/docs/bitcoin/runes/api/activities/activity.mdx
index b7bc584fd..943d9e953 100644
--- a/content/docs/bitcoin/runes/api/activities/activity.mdx
+++ b/content/docs/bitcoin/runes/api/activities/activity.mdx
@@ -72,8 +72,8 @@ Results per page
-```bash
-curl -X GET "https://api.hiro.so/runes/v1/etchings/string/activity?offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/runes/v1/etchings/string/activity?offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/runes/api/activities/for-address.mdx b/content/docs/bitcoin/runes/api/activities/for-address.mdx
index 04eb05978..8d61afe6e 100644
--- a/content/docs/bitcoin/runes/api/activities/for-address.mdx
+++ b/content/docs/bitcoin/runes/api/activities/for-address.mdx
@@ -78,8 +78,8 @@ Bitcoin address
-```bash
-curl -X GET "https://api.hiro.so/runes/v1/etchings/string/activity/string?offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/runes/v1/etchings/string/activity/string?offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/runes/api/activities/for-block.mdx b/content/docs/bitcoin/runes/api/activities/for-block.mdx
index 25050d4f0..e7c4dcb85 100644
--- a/content/docs/bitcoin/runes/api/activities/for-block.mdx
+++ b/content/docs/bitcoin/runes/api/activities/for-block.mdx
@@ -73,8 +73,8 @@ Results per page
-```bash
-curl -X GET "https://api.hiro.so/runes/v1/blocks/777678/activity?offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/runes/v1/blocks/777678/activity?offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/runes/api/activities/for-transaction.mdx b/content/docs/bitcoin/runes/api/activities/for-transaction.mdx
index 3750362d6..8e2d9e750 100644
--- a/content/docs/bitcoin/runes/api/activities/for-transaction.mdx
+++ b/content/docs/bitcoin/runes/api/activities/for-transaction.mdx
@@ -76,8 +76,8 @@ A transaction ID
-```bash
-curl -X GET "https://api.hiro.so/runes/v1/transactions/string/activity?offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/runes/v1/transactions/string/activity?offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/runes/api/balances/address.mdx b/content/docs/bitcoin/runes/api/balances/address.mdx
index be3e00bca..f5d6f6f84 100644
--- a/content/docs/bitcoin/runes/api/balances/address.mdx
+++ b/content/docs/bitcoin/runes/api/balances/address.mdx
@@ -74,8 +74,8 @@ Bitcoin address
-```bash
-curl -X GET "https://api.hiro.so/runes/v1/addresses/string/balances?offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/runes/v1/addresses/string/balances?offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/runes/api/balances/holder-balance.mdx b/content/docs/bitcoin/runes/api/balances/holder-balance.mdx
index 1e079eae5..6ad56dc49 100644
--- a/content/docs/bitcoin/runes/api/balances/holder-balance.mdx
+++ b/content/docs/bitcoin/runes/api/balances/holder-balance.mdx
@@ -59,8 +59,8 @@ Bitcoin address
-```bash
-curl -X GET "https://api.hiro.so/runes/v1/etchings/string/holders/string"
+```terminal
+$ curl -X GET "https://api.hiro.so/runes/v1/etchings/string/holders/string"
```
diff --git a/content/docs/bitcoin/runes/api/balances/holders.mdx b/content/docs/bitcoin/runes/api/balances/holders.mdx
index cfce6ca58..409aae0ff 100644
--- a/content/docs/bitcoin/runes/api/balances/holders.mdx
+++ b/content/docs/bitcoin/runes/api/balances/holders.mdx
@@ -72,8 +72,8 @@ Results per page
-```bash
-curl -X GET "https://api.hiro.so/runes/v1/etchings/string/holders?offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/runes/v1/etchings/string/holders?offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/runes/api/etchings/get-etching.mdx b/content/docs/bitcoin/runes/api/etchings/get-etching.mdx
index 336426d07..66e133aac 100644
--- a/content/docs/bitcoin/runes/api/etchings/get-etching.mdx
+++ b/content/docs/bitcoin/runes/api/etchings/get-etching.mdx
@@ -53,8 +53,8 @@ Retrieves information for a Rune etching
-```bash
-curl -X GET "https://api.hiro.so/runes/v1/etchings/string"
+```terminal
+$ curl -X GET "https://api.hiro.so/runes/v1/etchings/string"
```
diff --git a/content/docs/bitcoin/runes/api/etchings/get-etchings.mdx b/content/docs/bitcoin/runes/api/etchings/get-etchings.mdx
index 1297307fb..bdf5b60d4 100644
--- a/content/docs/bitcoin/runes/api/etchings/get-etchings.mdx
+++ b/content/docs/bitcoin/runes/api/etchings/get-etchings.mdx
@@ -66,8 +66,8 @@ Results per page
-```bash
-curl -X GET "https://api.hiro.so/runes/v1/etchings?offset=0&limit=1"
+```terminal
+$ curl -X GET "https://api.hiro.so/runes/v1/etchings?offset=0&limit=1"
```
diff --git a/content/docs/bitcoin/runes/api/info/status.mdx b/content/docs/bitcoin/runes/api/info/status.mdx
index 7302a355a..7abc0108c 100644
--- a/content/docs/bitcoin/runes/api/info/status.mdx
+++ b/content/docs/bitcoin/runes/api/info/status.mdx
@@ -46,8 +46,8 @@ Displays the status of the API
-```bash
-curl -X GET "https://api.hiro.so/runes/v1/"
+```terminal
+$ curl -X GET "https://api.hiro.so/runes/v1/"
```
diff --git a/content/docs/bitcoin/runes/runehook/installation.mdx b/content/docs/bitcoin/runes/runehook/installation.mdx
index 50795cc4f..bbafe5fa7 100644
--- a/content/docs/bitcoin/runes/runehook/installation.mdx
+++ b/content/docs/bitcoin/runes/runehook/installation.mdx
@@ -5,11 +5,8 @@ toc: false
---
Clone the [Runehook repository](https://github.com/hirosystems/runehook) to your local machine and install via `cargo`.
-```bash title="Terminal"
-# Clone the runehook repository
+```terminal
$ git clone https://github.com/hirosystems/runehook.git
-# Navigate into the runehook directory
$ cd runehook
-# Install runehook using cargo
$ cargo runehook-install
```
\ No newline at end of file
diff --git a/content/docs/bitcoin/runes/runehook/quickstart.mdx b/content/docs/bitcoin/runes/runehook/quickstart.mdx
index 4f1e2d661..8edd6ee0b 100644
--- a/content/docs/bitcoin/runes/runehook/quickstart.mdx
+++ b/content/docs/bitcoin/runes/runehook/quickstart.mdx
@@ -20,53 +20,6 @@ Before starting, ensure you have `runehook` installed. If you haven't already, c
---
-{/*
-
-
-
-
Scanning for Ordinal activity
-
-
To scan blocks for Ordinal activity, you can use the `scan blocks` command. The output will show details of the inscription, including the block number it was revealed at, `ordinal_number`, and `inscription_number`.
The `--interval` flag is used to specify a block range. The range is inclusive, meaning both the start and end blocks will be included in the scan. And the `--mainnet` flag is used to specify the Bitcoin network to scan.
-
-
- When running `scan` for the first time, an archive of Bitcoin blockchain data will be downloaded. The subsequent scans will use the cached chainstate if already present, speeding up iterations and the overall feedback loop. To learn more, check out the [Hiro Archive](/stacks/archive) section.
-
-
-
-
-
-
-
-
Inspecting a specific inscription
-
To inspect a specific inscription, you can run a similar command, `scan inscription` and pass in the inscription's ID.
The output will show where and when the inscription was revealed and any subsequent transfer events.
-
- ```plaintext
- Inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 revealed at block #767430 (ordinal_number 1252201400444387, inscription_number 0)
- Transferred in transaction bc4c30829a9564c0d58e6287195622b53ced54a25711d1b86be7cd3a70ef61ed at block 785396
- ```
-
-
-
*/}
-
----
-
### Next steps
diff --git a/content/docs/guides/docskit.mdx b/content/docs/guides/docskit.mdx
new file mode 100644
index 000000000..78af32fb5
--- /dev/null
+++ b/content/docs/guides/docskit.mdx
@@ -0,0 +1,363 @@
+---
+title: DocsKit
+description: DocsKit usage
+---
+
+## Features
+
+DocsKit features:
+
+- adds [flags](#flags) and [annotations](#annotations) to codeblocks
+- includes a special syntax for [inline code](#inline-code)
+- adds three components that can be used in MDX: [_``_](#codetabs), [_``_](#withnotes), and [_``_](#terminal-picker)
+- adds a [language switcher](#language-switcher) (which is another usage of _``_)
+- codeblocks with language [`terminal`](#terminal) or [`package-install`](#package-install) are rendered with a different component
+
+## Flags
+
+````txt flags-example.md
+# !mark[/-wn/]
+```js index.js -wn
+```
+````
+
+- `-n` add line numbers
+- `-c` add copy button
+- `-w` word wrap
+- `-a` animate (for tabs)
+
+## Annotations
+
+````txt annotations-example.md
+```js
+const x = 1;
+# !mark[/!mark/]
+// !mark(1:2)
+const y = 2;
+const z = 3;
+```
+````
+
+- `!mark` - highlight a line, a range of lines, or a regex
+- `!diff` - highlight added or removed lines
+- `!collapse` - collapse a range of lines
+- `!fold` - fold a regex pattern inline
+- `!link` - add a link
+- `!tooltip` - add a tooltip
+- `!callout` - add a callout
+
+Learn more about using annotations from Code Hike docs:
+
+- [Annotation comments](https://codehike.org/docs/concepts/annotations#annotation-comments)
+- [Using regular expressions](https://codehike.org/docs/concepts/annotations#using-regular-expressions-instead-of-ranges)
+
+## Mark
+
+You can use it for one line (`!mark`), a range of lines (`!mark(1:3)`), a range of columns (`!mark[5:10]`), or a regex pattern (`!mark[/pattern/]`).
+
+You can provide any valid CSS color, for example: `!mark(1:3) red` or `!mark(1:3) hsl(var(--hiro))`.
+
+```clarity
+;; !mark[/Counters/mg]
+(define-map Counters principal uint)
+
+;; !mark(1:3)
+(define-public (count-up)
+ (ok (map-set Counters tx-sender (+ (get-count tx-sender) u1)))
+)
+
+;; !mark hsl(var(--hiro))
+(define-read-only (get-count (who principal))
+ (default-to u0 (map-get? Counters who))
+)
+```
+
+## Diff
+
+```js
+function lorem(ipsum, dolor = 1) {
+ const sit = 10;
+ // !diff -
+ dolor = ipsum - sit;
+ // !diff +
+ dolor = sit - amet(dolor);
+ return sit ? consectetur(ipsum) : [];
+}
+```
+
+## Collapse
+
+```jsonc sample-alert-payload.json -cwn
+{
+ "nonce": 5,
+ "fee_rate": "250",
+ "sponsored": false,
+ "post_condition_mode": "deny",
+ // !collapse(1:9) collapsed
+ "post_conditions": [
+ {
+ "type": "stx",
+ "condition_code": "sent_equal_to",
+ "amount": "3000000",
+ "principal": {
+ "type_id": "principal_standard",
+ },
+ },
+ ],
+ "anchor_mode": "any",
+ "tx_status": "pending",
+ "receipt_time": 1726104636,
+ "tx_type": "contract_call",
+ // !collapse(1:11) collapsed
+ "contract_call": {
+ "function_name": "donate",
+ "function_signature": "(define-public (donate (amount uint)))",
+ "function_args": [
+ {
+ "hex": "0x01000000000000000000000000002dc6c0",
+ "repr": "u3000000",
+ "name": "amount",
+ "type": "uint",
+ },
+ ],
+ },
+}
+```
+
+## Fold
+
+```jsx
+// !fold[/className="(.*?)"/gm]
+function Foo() {
+ return (
+
+ hey
+
+ );
+}
+```
+
+## Link
+
+```js
+// !link[/foo/mg] https://example.com
+// !link[/bar/mg] https://example.com
+import { foo, bar } from "baz";
+
+const x = foo(10);
+const y = bar(x);
+```
+
+## CodeTabs
+
+````txt tabs-example.md
+# !mark[/!!/mg]
+
+
+```ts !! index.ts
+
+```
+
+```css !! styles.css
+
+```
+
+````
+
+Note: the codeblocks inside the _``_ component should have the `!!` decoration and a title.
+
+You can pass flags to the _``_ component to apply them to all codeblocks inside it. The `a` flag will animate the transition between tabs.
+
+Example:
+
+
+
+```clarity !! one.clar
+;; !mark[/increment/mg]
+(define-data-var count uint u0)
+
+(define-public (increment)
+ (begin
+ (var-set count (+ (var-get count) u1))
+ (ok (var-get count)) ;; !mark
+ )
+)
+```
+
+```solidity !! two.sol
+// !mark[/add/mg]
+uint256 constant TOO_BIG = 10;
+uint256 count = 0;
+
+function add(uint256 amount) public returns (uint256) {
+ uint256 newCount = count + amount;
+ if (newCount <= TOO_BIG) {
+ count = newCount;
+ return count;
+ }
+ revert("Amount too large"); // !mark
+}
+```
+
+
+
+### Language switcher
+
+To switch between languages, use the _``_ component with the `storage` prop. The `storage` prop is used to store the selected language in the local storage and sync all the _``_ using the same `storage` key.
+
+
+
+```ts !! TypeScript
+(async () => {
+ const apiConfig: Configuration = new Configuration({
+ fetchApi: fetch,
+ // for mainnet, replace `testnet` with `mainnet`
+ basePath: "https://api.testnet.hiro.so",
+ });
+})().catch(console.error);
+```
+
+```js !! JavaScript
+(async () => {
+ const apiConfig = new Configuration({
+ fetchApi: fetch,
+ // for mainnet, replace `testnet` with `mainnet`
+ basePath: "https://api.testnet.hiro.so",
+ });
+})().catch(console.error);
+```
+
+
+
+## WithNotes
+
+For `!callout` and `!tooltip` annotations, you can use the _``_ to define the content you want to show.
+
+### Callouts
+
+
+
+```js index.js
+// !callout[/ipsum/] description
+import lorem from "ipsum";
+
+// !callout[/sit/] inspect
+const sit = lorem({ a: 1, b: 2 });
+```
+
+```js !inspect
+sit = [
+ { name: "a", value: 1 },
+ { name: "b", value: 2 },
+];
+```
+
+## !description
+
+The default export of the `ipsum` package is a function that **returns an array**.
+
+Kind of like _`Object.entries(x)`_ but different.
+
+
+
+### Tooltips
+
+
+
+```js demo.js
+// !tooltip[/lorem/] install
+import { read, write } from "lorem";
+
+// !tooltip[/data.json/] data
+var data = read("data.json");
+
+// !tooltip[/test-123/] apikey
+write({ x: 1 }, { apiKey: "test-123" });
+```
+
+We can also use tooltips [here](tooltip "install") in [prose](tooltip "data") text.
+
+```json !data data.json
+{
+ "lorem": "ipsum dolor sit amet",
+ "foo": [4, 8, 15, 16]
+}
+```
+
+## !install
+
+This is a **fake library**. You can install it with:
+
+```terminal
+$ npm install lorem
+```
+
+It lets you read and write data.
+
+## !apikey
+
+This is a public sample test mode [API key](https://example.com). Don’t submit any personally information using this key.
+
+Replace this with your secret key found on the [API Keys page](https://example.com) in the dashboard.
+
+
+
+## Inline code
+
+To use inline codeyou need to use a special syntax: ``_`code`_``.
+
+This syntax also allows you to specify the language for inline code ``_clarity`(contract-call? .counter count-up)`_`` renders: _clarity`(contract-call? .counter count-up)`_
+
+## Terminal
+
+To use the terminal component, set the language of a codeblock to `terminal`, and start each command with `$`.
+
+```terminal
+$ tar -xf clarinet-linux-x64.tar.gz
+$ chmod +x ./clarinet
+$ mv ./clarinet /usr/local/bin
+```
+
+The lines that don't start with `$` are rendered as collapsed output. The output can use ANSI colors and styles.
+
+```terminal
+$ npx create-next-app@latest
+create-next-app@14.2.13
+[32m✔[0m [1mWhat is your project?[0m [90m…[0m my-app
+$ npm run dev
+```
+
+### Terminal Picker
+
+
+
+```terminal !! macOS
+$ brew install clarinet
+```
+
+```terminal !! Windows
+$ winget install clarinet
+```
+
+```terminal !! Cargo
+$ sudo apt install build-essential pkg-config libssl-dev
+```
+
+
+
+### Package Install
+
+You can use `package-install` as a language to get a picker for JS package managers.
+
+```package-install
+@stacks/connect
+```
+
+### Opting out of the terminal component
+
+To use features from the normal codeblock component, you can still use languages like `sh` or `bash` or even `txt`.
+
+```sh Terminal -w
+# !tooltip[/v0.27.0/] You can change the v0.27.0 version that is available on the releases page.
+$ wget -nv download/v0.27.0/clarinet-linux-x64-glibc.tar.gz -O clarinet-linux-x64.tar.gz
+```
diff --git a/content/docs/guides/no-loss-lottery.mdx b/content/docs/guides/no-loss-lottery.mdx
index 198eda8f2..1bc5a4e33 100644
--- a/content/docs/guides/no-loss-lottery.mdx
+++ b/content/docs/guides/no-loss-lottery.mdx
@@ -45,7 +45,6 @@ Key data variables include `lotteryPool` for tracking stacked assets, `totalYiel
Next, define an NFT to represent a ticket and a map to store participant information.
```clarity
-// [!code word:LotteryTicket]
(define-map Participants
{ participant: principal }
{ ticketId: uint, amount: uint, cycle: uint, ticketExpirationAtCycle: uint, isWinner: bool }
@@ -178,13 +177,13 @@ This process ensures that participants can claim their rewards and that winners
To test the contracts, use the following steps inside of `clarinet console`:
-```console
-::advance_chain_tip 700000
-::set_tx_sender
-(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.no-loss-lottery-pool roll-the-dice "mia" u500 none)
-::advance_chain_tip 2000
-(contract-call? 'SP8A9HZ3PKST0S42VM9523Z9NV42SZ026V4K39WH.ccd002-treasury-mia-stacking deposit-stx u5000000000)
-(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.no-loss-lottery-pool claim "mia" u17)
+```terminal
+$ ::advance_chain_tip 700000
+$ ::set_tx_sender
+$ (contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.no-loss-lottery-pool roll-the-dice "mia" u500 none)
+$ ::advance_chain_tip 2000
+$ (contract-call? 'SP8A9HZ3PKST0S42VM9523Z9NV42SZ026V4K39WH.ccd002-treasury-mia-stacking deposit-stx u5000000000)
+$ (contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.no-loss-lottery-pool claim "mia" u17)
```
To bootstrap the CityCoins contracts, follow these steps:
diff --git a/content/docs/guides/sync-a-bitcoin-node.mdx b/content/docs/guides/sync-a-bitcoin-node.mdx
index 2de2491fe..b3c01de2a 100644
--- a/content/docs/guides/sync-a-bitcoin-node.mdx
+++ b/content/docs/guides/sync-a-bitcoin-node.mdx
@@ -45,7 +45,7 @@ Now navigate to your `bitcoin.conf` file, which is located in your `/path/to/bit
In this example, it would look like this:
-```console title="bitcoin.conf"
+```bash bitcoin.conf
datadir=/Volumes/SSD/bitcoin-data/
```
@@ -53,10 +53,8 @@ datadir=/Volumes/SSD/bitcoin-data/
You can override the default configuration with the following, including the path to where you will be storing all of the Bitcoin data once it starts syncing:
-```console title="bitcoin.conf"
-# [!code word:rpcuser]
-# [!code word:rpcpassword]
-datadir=/your-path-to/bitcoin-data/ # [!code highlight]
+```bash
+datadir=/your-path-to/bitcoin-data/
server=1
rpcuser=devnet
rpcpassword=devnet
@@ -94,8 +92,8 @@ With a finished `bitcoin.conf` file, it's time to start up your node.
This takes the form of `path/to/bitcoind -conf=path/to/bitcoin.conf`, which in this example looks like:
-```console
-/Volumes/SSD/bitcoin-25.0/bin/bitcoind -conf=/Volumes/SSD/bitcoin-25.0/bitcoin.conf
+```terminal
+$ /Volumes/SSD/bitcoin-25.0/bin/bitcoind -conf=/Volumes/SSD/bitcoin-25.0/bitcoin.conf
```
After running this command, you will see `zmq_url` entries in your console's stdout, displaying ZeroMQ logs from your Bitcoin node. Congrats! You're now syncing!
@@ -111,8 +109,8 @@ It might take anywhere from a few hours to a few days to run and fully sync, dep
To shut down your node safely, use the `bitcoin-cli` executable, located inside of the `bin` directory, and run the `stop` command:
-```console
-/path/to/bitcoin-cli \
+```terminal
+$ /path/to/bitcoin-cli \
--conf=/path/to/bitcoin.conf \
--rpcuser={{your-rpc-username}} \
--rpcpassword={{your-rpc-password}} stop
diff --git a/content/docs/guides/sync-a-stacks-node.mdx b/content/docs/guides/sync-a-stacks-node.mdx
index f6f725b90..ea318d44a 100644
--- a/content/docs/guides/sync-a-stacks-node.mdx
+++ b/content/docs/guides/sync-a-stacks-node.mdx
@@ -21,17 +21,17 @@ In this guide, you will learn how to:
Clone the Stacks blockchain Docker repository from GitHub:
-```console title="Terminal"
-git clone https://github.com/blockstack/stacks-blockchain-docker.git
-cd stacks-blockchain-docker
+```terminal
+$ git clone https://github.com/blockstack/stacks-blockchain-docker.git
+$ cd stacks-blockchain-docker
```
## Start the service
Inside of the `stacks-blockchain-docker` directory, run the following command to start the Stacks node:
-```console title="Terminal"
-./manage.sh -n -a start
+```terminal
+$ ./manage.sh -n -a start
```
The `` placeholder used below can be replaced with one of:
@@ -44,8 +44,8 @@ The `` placeholder used below can be replaced with one of:
To follow the logs for the Stacks node, run the following command:
-```console title="Terminal"
-./manage.sh -n -a logs
+```terminal
+$ ./manage.sh -n -a logs
```
For networks other than `mocknet`, downloading the initial headers can take several minutes. Until the headers are downloaded, the `/v2/info` endpoints won't return any data.
diff --git a/content/docs/stacks/api/accounts/assets.mdx b/content/docs/stacks/api/accounts/assets.mdx
index 662b812a1..44fa66d7a 100644
--- a/content/docs/stacks/api/accounts/assets.mdx
+++ b/content/docs/stacks/api/accounts/assets.mdx
@@ -90,8 +90,8 @@ returned data representing the state at that point in time, rather than the curr
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/assets?limit=20&offset=42000&unanchored=true&until_block=60000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/assets?limit=20&offset=42000&unanchored=true&until_block=60000"
```
diff --git a/content/docs/stacks/api/accounts/balances.mdx b/content/docs/stacks/api/accounts/balances.mdx
index dff2a7cf9..aabdefb5f 100644
--- a/content/docs/stacks/api/accounts/balances.mdx
+++ b/content/docs/stacks/api/accounts/balances.mdx
@@ -74,8 +74,8 @@ returned data representing the state up until that point in time, rather than th
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/balances?unanchored=true&until_block=60000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/balances?unanchored=true&until_block=60000"
```
diff --git a/content/docs/stacks/api/accounts/inbound-stx-transfers.mdx b/content/docs/stacks/api/accounts/inbound-stx-transfers.mdx
index f030e712e..595d9fe52 100644
--- a/content/docs/stacks/api/accounts/inbound-stx-transfers.mdx
+++ b/content/docs/stacks/api/accounts/inbound-stx-transfers.mdx
@@ -96,8 +96,8 @@ returned data representing the state up until that point in time, rather than th
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/stx_inbound?limit=0&offset=42000&height=0&unanchored=true&until_block=60000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/stx_inbound?limit=0&offset=42000&height=0&unanchored=true&until_block=60000"
```
diff --git a/content/docs/stacks/api/accounts/latest-nonce.mdx b/content/docs/stacks/api/accounts/latest-nonce.mdx
index c374634c8..ace705b94 100644
--- a/content/docs/stacks/api/accounts/latest-nonce.mdx
+++ b/content/docs/stacks/api/accounts/latest-nonce.mdx
@@ -72,8 +72,8 @@ Optionally get the nonce at a given block hash. Note - Use either of the query p
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/nonces?block_height=66119&block_hash=0x72d53f3cba39e149dcd42708e535bdae03d73e60d2fe853aaf61c0b392f521e9"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/nonces?block_height=66119&block_hash=0x72d53f3cba39e149dcd42708e535bdae03d73e60d2fe853aaf61c0b392f521e9"
```
diff --git a/content/docs/stacks/api/accounts/nft-events.mdx b/content/docs/stacks/api/accounts/nft-events.mdx
index cb5dbe54a..7ea2f2187 100644
--- a/content/docs/stacks/api/accounts/nft-events.mdx
+++ b/content/docs/stacks/api/accounts/nft-events.mdx
@@ -5,7 +5,7 @@ toc: false
---
import { Root, API, APIExample } from '@/components/layout';
-import { APIInfo, Property } from 'fumadocs-ui/components/api'
+import { APIInfo, Property } from 'fumadocs-openapi/ui'
import { Badge } from '@/components/ui/badge';
import { Tabs, Tab } from 'fumadocs-ui/components/tabs'
import { Tabs as UITabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
@@ -76,8 +76,8 @@ Returned data representing the state up until that point in time, rather than th
-```bash title="Terminal"
-curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/nft_events"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/nft_events"
```
diff --git a/content/docs/stacks/api/accounts/stx-balances.mdx b/content/docs/stacks/api/accounts/stx-balances.mdx
index 53b1ba2e8..7959d01fa 100644
--- a/content/docs/stacks/api/accounts/stx-balances.mdx
+++ b/content/docs/stacks/api/accounts/stx-balances.mdx
@@ -74,8 +74,8 @@ returned data representing the state up until that point in time, rather than th
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/stx?unanchored=true&until_block=60000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/stx?unanchored=true&until_block=60000"
```
diff --git a/content/docs/stacks/api/accounts/transaction-with-transfers.mdx b/content/docs/stacks/api/accounts/transaction-with-transfers.mdx
index fc9b8fb66..c99539a96 100644
--- a/content/docs/stacks/api/accounts/transaction-with-transfers.mdx
+++ b/content/docs/stacks/api/accounts/transaction-with-transfers.mdx
@@ -69,8 +69,8 @@ Transaction id
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/address/SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE/0x34d79c7cfc2fe525438736733e501a4bf0308a5556e3e080d1e2c0858aad7448/with_transfers"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/address/SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE/0x34d79c7cfc2fe525438736733e501a4bf0308a5556e3e080d1e2c0858aad7448/with_transfers"
```
diff --git a/content/docs/stacks/api/accounts/transactions-with-transfers.mdx b/content/docs/stacks/api/accounts/transactions-with-transfers.mdx
index 577143552..7dd840c4b 100644
--- a/content/docs/stacks/api/accounts/transactions-with-transfers.mdx
+++ b/content/docs/stacks/api/accounts/transactions-with-transfers.mdx
@@ -98,8 +98,8 @@ returned data representing the state up until that point in time, rather than th
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions_with_transfers?limit=20&offset=10&height=66119&unanchored=true&until_block=60000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions_with_transfers?limit=20&offset=10&height=66119&unanchored=true&until_block=60000"
```
diff --git a/content/docs/stacks/api/accounts/transactions.mdx b/content/docs/stacks/api/accounts/transactions.mdx
index 9b93343ba..1324de296 100644
--- a/content/docs/stacks/api/accounts/transactions.mdx
+++ b/content/docs/stacks/api/accounts/transactions.mdx
@@ -105,8 +105,8 @@ returned data representing the state up until that point in time, rather than th
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions?limit=42000&offset=42000&height=42000&unanchored=true&until_block=60000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions?limit=42000&offset=42000&height=42000&unanchored=true&until_block=60000"
```
diff --git a/content/docs/stacks/api/blocks/average-times.mdx b/content/docs/stacks/api/blocks/average-times.mdx
index 6de640c32..b0a665b78 100644
--- a/content/docs/stacks/api/blocks/average-times.mdx
+++ b/content/docs/stacks/api/blocks/average-times.mdx
@@ -46,8 +46,8 @@ Retrieves average block times (in seconds)
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/blocks/average-times"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/blocks/average-times"
```
diff --git a/content/docs/stacks/api/blocks/block-by-burn-block-hash.mdx b/content/docs/stacks/api/blocks/block-by-burn-block-hash.mdx
index d7b6414ea..f131a8d3a 100644
--- a/content/docs/stacks/api/blocks/block-by-burn-block-hash.mdx
+++ b/content/docs/stacks/api/blocks/block-by-burn-block-hash.mdx
@@ -51,8 +51,8 @@ Retrieves block details of a specific block for a given burnchain block hash
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/block/by_burn_block_hash/%7Bburn_block_hash%7D"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/block/by_burn_block_hash/%7Bburn_block_hash%7D"
```
diff --git a/content/docs/stacks/api/blocks/block-by-burn-block-height.mdx b/content/docs/stacks/api/blocks/block-by-burn-block-height.mdx
index 48a651efb..f99b40d54 100644
--- a/content/docs/stacks/api/blocks/block-by-burn-block-height.mdx
+++ b/content/docs/stacks/api/blocks/block-by-burn-block-height.mdx
@@ -51,8 +51,8 @@ Retrieves block details of a specific block for a given burn chain height
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/block/by_burn_block_height/%7Bburn_block_height%7D"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/block/by_burn_block_height/%7Bburn_block_height%7D"
```
diff --git a/content/docs/stacks/api/blocks/block-by-hash.mdx b/content/docs/stacks/api/blocks/block-by-hash.mdx
index 7135d5022..8f34541f5 100644
--- a/content/docs/stacks/api/blocks/block-by-hash.mdx
+++ b/content/docs/stacks/api/blocks/block-by-hash.mdx
@@ -51,8 +51,8 @@ Retrieves block details of a specific block for a given chain height. You can us
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/block/%7Bhash%7D"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/block/%7Bhash%7D"
```
diff --git a/content/docs/stacks/api/blocks/block-by-height.mdx b/content/docs/stacks/api/blocks/block-by-height.mdx
index d41f6d7f9..ac3678840 100644
--- a/content/docs/stacks/api/blocks/block-by-height.mdx
+++ b/content/docs/stacks/api/blocks/block-by-height.mdx
@@ -52,8 +52,8 @@ Retrieves block details of a specific block at a given block height
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/block/by_height/%7Bheight%7D"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/block/by_height/%7Bheight%7D"
```
diff --git a/content/docs/stacks/api/blocks/get-block.mdx b/content/docs/stacks/api/blocks/get-block.mdx
index ccf9e14df..6035dcb24 100644
--- a/content/docs/stacks/api/blocks/get-block.mdx
+++ b/content/docs/stacks/api/blocks/get-block.mdx
@@ -54,8 +54,8 @@ filter by block height, hash, index block hash or the constant `latest` to filte
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/blocks/42000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/blocks/42000"
```
diff --git a/content/docs/stacks/api/blocks/get-blocks-by-burn-block.mdx b/content/docs/stacks/api/blocks/get-blocks-by-burn-block.mdx
index 61fca06cc..43dad5dc9 100644
--- a/content/docs/stacks/api/blocks/get-blocks-by-burn-block.mdx
+++ b/content/docs/stacks/api/blocks/get-blocks-by-burn-block.mdx
@@ -72,8 +72,8 @@ index of first burn block to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/burn-blocks/42000/blocks?limit=20&offset=0"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/burn-blocks/42000/blocks?limit=20&offset=0"
```
diff --git a/content/docs/stacks/api/blocks/get-blocks.mdx b/content/docs/stacks/api/blocks/get-blocks.mdx
index 221ca96bd..c49bd756b 100644
--- a/content/docs/stacks/api/blocks/get-blocks.mdx
+++ b/content/docs/stacks/api/blocks/get-blocks.mdx
@@ -65,8 +65,8 @@ index of first burn block to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/blocks?limit=20&offset=0"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/blocks?limit=20&offset=0"
```
diff --git a/content/docs/stacks/api/blocks/recent-blocks.mdx b/content/docs/stacks/api/blocks/recent-blocks.mdx
index 85b8f1cbf..0941b0f23 100644
--- a/content/docs/stacks/api/blocks/recent-blocks.mdx
+++ b/content/docs/stacks/api/blocks/recent-blocks.mdx
@@ -72,8 +72,8 @@ index of first block to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/block?limit=20&offset=42000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/block?limit=20&offset=42000"
```
diff --git a/content/docs/stacks/api/burn-blocks/get-burn-block.mdx b/content/docs/stacks/api/burn-blocks/get-burn-block.mdx
index 4b0f81c01..015a02f03 100644
--- a/content/docs/stacks/api/burn-blocks/get-burn-block.mdx
+++ b/content/docs/stacks/api/burn-blocks/get-burn-block.mdx
@@ -53,8 +53,8 @@ filter by burn block height, hash, or the constant `latest` to filter for the mo
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/burn-blocks/42000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/burn-blocks/42000"
```
diff --git a/content/docs/stacks/api/burn-blocks/get-burn-blocks.mdx b/content/docs/stacks/api/burn-blocks/get-burn-blocks.mdx
index 13142564b..3865e7534 100644
--- a/content/docs/stacks/api/burn-blocks/get-burn-blocks.mdx
+++ b/content/docs/stacks/api/burn-blocks/get-burn-blocks.mdx
@@ -67,8 +67,8 @@ index of first burn block to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/burn-blocks?limit=20&offset=42000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/burn-blocks?limit=20&offset=42000"
```
diff --git a/content/docs/stacks/api/client/accounts/get-assets.mdx b/content/docs/stacks/api/client/accounts/get-assets.mdx
index 813835284..53453e14e 100644
--- a/content/docs/stacks/api/client/accounts/get-assets.mdx
+++ b/content/docs/stacks/api/client/accounts/get-assets.mdx
@@ -5,7 +5,7 @@ toc: false
---
import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
+import { Property } from 'fumadocs-openapi/ui'
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
@@ -42,8 +42,7 @@ Optional overrides for the request initialization settings.
- ```ts twoslash
- // @noErrors
+ ```ts
import { Configuration, AccountsApi } from '@stacks/blockchain-api-client';
const apiConfig = new Configuration({
@@ -61,7 +60,7 @@ Optional overrides for the request initialization settings.
- ```ts twoslash
+ ```ts
import {
UserSession,
makeAuthRequest,
@@ -171,10 +170,7 @@ Decrypts user data for secure storage.
- ```ts twoslash
- // @noErrors
- // [!code word:isSignInPending]
- // [!code word:handlePendingSignIn]
+ ```ts
const isPending = userSession.isSignInPending();
if (isPending) {
@@ -185,16 +181,12 @@ Decrypts user data for secure storage.
```
- ```ts twoslash
- // @noErrors
- // [!code word:isUserSignedIn]
+ ```ts
const isSignedIn = userSession.isUserSignedIn();
```
- ```ts twoslash
- // @noErrors
- // [!code word:loadUserData]
+ ```ts
const isSignedIn = userSession.isUserSignedIn();
if (isSignedIn) {
@@ -204,27 +196,21 @@ Decrypts user data for secure storage.
```
- ```ts twoslash
- // @noErrors
- // [!code word:signUserOut]
+ ```ts
function logout() {
userSession.signUserOut();
}
```
- ```ts twoslash
- // @noErrors
- // [!code word:encryptContent]
+ ```ts
const message = 'My secret message';
const cipherText = await userSession.encryptContent(message);
```
- ```ts twoslash
- // @noErrors
- // [!code word:decryptContent]
+ ```ts
const message = 'My secret message';
const cipherText = await userSession.encryptContent(message);
diff --git a/content/docs/stacks/api/client/index.mdx b/content/docs/stacks/api/client/index.mdx
index e8b2db5e6..2d8fc25c8 100644
--- a/content/docs/stacks/api/client/index.mdx
+++ b/content/docs/stacks/api/client/index.mdx
@@ -12,8 +12,7 @@ The `@stacks/blockchain-api-client` library provides a robust interface for inte
The client includes automatically generated HTTP API methods, comprehensive Schemas for Clarity smart contract values, and a WebSocket client for real-time data streaming.
-```ts twoslash
-// @noErrors
+```ts
import { AccountsApi } from '@stacks/blockchain-api-client';
const accounts = new AccountsApi(apiConfig);
diff --git a/content/docs/stacks/api/concepts/nonce-handling.mdx b/content/docs/stacks/api/concepts/nonce-handling.mdx
index e00933938..6f61434ed 100644
--- a/content/docs/stacks/api/concepts/nonce-handling.mdx
+++ b/content/docs/stacks/api/concepts/nonce-handling.mdx
@@ -6,10 +6,8 @@ description: Learn how to handle nonces on Stacks.
In order to prevent "stuck" transactions, you must track the next available nonce for principals issuing transactions. The
Stacks Blockchain API provides an endpoint to make nonce handling simpler when using the following command:
-```bash
-# for mainnet, remove `.testnet`
-# replace with your STX address
-curl 'https://api.testnet.hiro.so/extended/v1/address//nonces'
+```terminal
+$ curl 'https://api.testnet.hiro.so/extended/v1/address//nonces'
```
```json
@@ -21,8 +19,8 @@ curl 'https://api.testnet.hiro.so/extended/v1/address//nonces'
}
```
-The `possible_next_nonce` property is the predicted nonce required for subsequent transactions, which is derived from inspecting the latest transaction nonces from anchor blocks, microblocks, and the mempool.
+The `possible_next_nonce` property is the nonce suggested for a given principal's next transaction. It is derived as the next integer to the largest nonce found in blocks and mempool. It does not take into account missing nonces.
-The `detected_missing_nonces` property finds any non-contiguous nonces after inspecting transactions from anchor blocks, microblocks, and the mempool. For example, if the latest anchor/microblock transaction nonce for an account is 5, but the next nonce in the mempool is 7, then it indicates that something likely went wrong with transaction with nonce 6 (either it was not created or broadcasted correctly by a client, or it was dropped for whatever reason). This is a strong indication that the mempool transaction with nonce 7 will never be mined since the previous nonce is missing.
+The `detected_missing_nonces` property finds any non-contiguous nonces after inspecting transactions from blocks and the mempool. For example, for a given principal, if the latest transaction included in a block has a nonce of 5, and the's only one transaction in the mempool with nonce 7, then it indicates that something likely went wrong with transaction with nonce 6 (either it was not created or broadcasted correctly by a client, or it was dropped for whatever reason). This is a strong indication that the mempool transaction with nonce 7 will never be mined since the previous nonce is missing.
-Clients that continue to broadcast transactions with the `possible_next_nonce` property of 8, then 9, then 10, will likely result in all of their pending/mempool transactions never going through.
+Clients that continue to broadcast transactions with the `possible_next_nonce` property of 8, then 9, then 10, will likely result in all of their pending/mempool transactions never going through. For all transactions go through, clients should first use any missing nonces before using the suggested `possible_next_nonce`.
diff --git a/content/docs/stacks/api/faucets/stx.mdx b/content/docs/stacks/api/faucets/stx.mdx
index 12dd65619..8ea882f36 100644
--- a/content/docs/stacks/api/faucets/stx.mdx
+++ b/content/docs/stacks/api/faucets/stx.mdx
@@ -60,8 +60,8 @@ This is a testnet only endpoint. This endpoint will not work on the mainnet.
-```bash
-curl -X POST "https://api.testnet.hiro.so/extended/v1/faucets/stx"
+```terminal
+$ curl -X POST "https://api.testnet.hiro.so/extended/v1/faucets/stx"
```
diff --git a/content/docs/stacks/api/fees/fee-rate.mdx b/content/docs/stacks/api/fees/fee-rate.mdx
index a6fd4bb41..18adec385 100644
--- a/content/docs/stacks/api/fees/fee-rate.mdx
+++ b/content/docs/stacks/api/fees/fee-rate.mdx
@@ -58,8 +58,8 @@ A serialized transaction
-```bash
-curl -X POST "https://api.hiro.so/extended/v1/fee_rate" \
+```terminal
+$ curl -X POST "https://api.hiro.so/extended/v1/fee_rate" \
-d '{
"transaction": "string"
}'
diff --git a/content/docs/stacks/api/index.mdx b/content/docs/stacks/api/index.mdx
index e968703ad..9194edb6f 100644
--- a/content/docs/stacks/api/index.mdx
+++ b/content/docs/stacks/api/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: Query the Stacks blockchain with the Stacks Blockchain API.
-toc: false
---
import { SecondaryCard } from '@/components/card';
@@ -30,7 +29,6 @@ If you're looking for direct access to the Stacks node, including the ability to
title="Get data from a block"
description="Retrieves a block by its height or hash."
/>
-
## Related tools
diff --git a/content/docs/stacks/api/info/circulating-stx-supply-in-plain-text.mdx b/content/docs/stacks/api/info/circulating-stx-supply-in-plain-text.mdx
index b6273c1e5..fee827a27 100644
--- a/content/docs/stacks/api/info/circulating-stx-supply-in-plain-text.mdx
+++ b/content/docs/stacks/api/info/circulating-stx-supply-in-plain-text.mdx
@@ -46,8 +46,8 @@ Retrieves the STX tokens currently in circulation that have been unlocked as pla
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/stx_supply/circulating/plain"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/stx_supply/circulating/plain"
```
diff --git a/content/docs/stacks/api/info/legacy-total-and-unlocked-stx-supply.mdx b/content/docs/stacks/api/info/legacy-total-and-unlocked-stx-supply.mdx
index 8d6f6e86e..223228c4e 100644
--- a/content/docs/stacks/api/info/legacy-total-and-unlocked-stx-supply.mdx
+++ b/content/docs/stacks/api/info/legacy-total-and-unlocked-stx-supply.mdx
@@ -60,8 +60,8 @@ Supply details are queried from specified block height. If the block height is n
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/stx_supply/legacy_format?height=200"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/stx_supply/legacy_format?height=200"
```
diff --git a/content/docs/stacks/api/info/network-block-time.mdx b/content/docs/stacks/api/info/network-block-time.mdx
index ce0860661..4a37c5c0f 100644
--- a/content/docs/stacks/api/info/network-block-time.mdx
+++ b/content/docs/stacks/api/info/network-block-time.mdx
@@ -46,8 +46,8 @@ Retrieves the target block times for mainnet and testnet. The block time is hard
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/info/network_block_times"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/info/network_block_times"
```
diff --git a/content/docs/stacks/api/info/network-given-block-time.mdx b/content/docs/stacks/api/info/network-given-block-time.mdx
index b045805be..297578c02 100644
--- a/content/docs/stacks/api/info/network-given-block-time.mdx
+++ b/content/docs/stacks/api/info/network-given-block-time.mdx
@@ -57,8 +57,8 @@ the target block time for a given network (testnet, mainnet).
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/info/network_block_time/mainnet"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/info/network_block_time/mainnet"
```
diff --git a/content/docs/stacks/api/info/status.mdx b/content/docs/stacks/api/info/status.mdx
index 1403daf75..2cdb7e737 100644
--- a/content/docs/stacks/api/info/status.mdx
+++ b/content/docs/stacks/api/info/status.mdx
@@ -46,8 +46,8 @@ Retrieves the running status of the Stacks Blockchain API, including the server
-```bash
-curl -X GET "https://api.hiro.so/extended"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended"
```
diff --git a/content/docs/stacks/api/info/total-and-unlocked-stx-supply.mdx b/content/docs/stacks/api/info/total-and-unlocked-stx-supply.mdx
index 363a0f795..f2ad807e8 100644
--- a/content/docs/stacks/api/info/total-and-unlocked-stx-supply.mdx
+++ b/content/docs/stacks/api/info/total-and-unlocked-stx-supply.mdx
@@ -56,8 +56,8 @@ Supply details are queried from specified block height. If the block height is n
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/stx_supply"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/stx_supply"
```
diff --git a/content/docs/stacks/api/info/total-stx-supply-in-plain-text.mdx b/content/docs/stacks/api/info/total-stx-supply-in-plain-text.mdx
index a48b6678c..c43e3f576 100644
--- a/content/docs/stacks/api/info/total-stx-supply-in-plain-text.mdx
+++ b/content/docs/stacks/api/info/total-stx-supply-in-plain-text.mdx
@@ -50,8 +50,8 @@ This uses the estimated future total supply for the year 2050.
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/stx_supply/total/plain"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/stx_supply/total/plain"
```
diff --git a/content/docs/stacks/api/mempool/transaction-fee-priorities.mdx b/content/docs/stacks/api/mempool/transaction-fee-priorities.mdx
index d2ab62214..1e04567b8 100644
--- a/content/docs/stacks/api/mempool/transaction-fee-priorities.mdx
+++ b/content/docs/stacks/api/mempool/transaction-fee-priorities.mdx
@@ -47,8 +47,8 @@ Returns estimated fee priorities (in micro-STX) for all transactions that are cu
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/mempool/fees"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/mempool/fees"
```
diff --git a/content/docs/stacks/api/names/historical-zonefile.mdx b/content/docs/stacks/api/names/historical-zonefile.mdx
index eb3442a92..f2e5f812b 100644
--- a/content/docs/stacks/api/names/historical-zonefile.mdx
+++ b/content/docs/stacks/api/names/historical-zonefile.mdx
@@ -65,8 +65,8 @@ zone file hash
-```bash
-curl -X GET "https://api.hiro.so/v1/names/muneeb.id/zonefile/b100a68235244b012854a95f9114695679002af9"
+```terminal
+$ curl -X GET "https://api.hiro.so/v1/names/muneeb.id/zonefile/b100a68235244b012854a95f9114695679002af9"
```
diff --git a/content/docs/stacks/api/names/name-details.mdx b/content/docs/stacks/api/names/name-details.mdx
index afbbb09d3..456a2805c 100644
--- a/content/docs/stacks/api/names/name-details.mdx
+++ b/content/docs/stacks/api/names/name-details.mdx
@@ -57,8 +57,8 @@ fully-qualified name
-```bash
-curl -X GET "https://api.hiro.so/v1/names/muneeb.id"
+```terminal
+$ curl -X GET "https://api.hiro.so/v1/names/muneeb.id"
```
diff --git a/content/docs/stacks/api/names/name-subdomains.mdx b/content/docs/stacks/api/names/name-subdomains.mdx
index 75bfb69e3..ee76f0ad5 100644
--- a/content/docs/stacks/api/names/name-subdomains.mdx
+++ b/content/docs/stacks/api/names/name-subdomains.mdx
@@ -55,8 +55,8 @@ fully-qualified name
-```bash
-curl -X GET "https://api.hiro.so/v1/names/id.blockstack/subdomains"
+```terminal
+$ curl -X GET "https://api.hiro.so/v1/names/id.blockstack/subdomains"
```
diff --git a/content/docs/stacks/api/names/name-zonefile.mdx b/content/docs/stacks/api/names/name-zonefile.mdx
index bc4fb4be3..d365f796b 100644
--- a/content/docs/stacks/api/names/name-zonefile.mdx
+++ b/content/docs/stacks/api/names/name-zonefile.mdx
@@ -57,8 +57,8 @@ fully-qualified name
-```bash
-curl -X GET "https://api.hiro.so/v1/names/bar.test/zonefile"
+```terminal
+$ curl -X GET "https://api.hiro.so/v1/names/bar.test/zonefile"
```
diff --git a/content/docs/stacks/api/names/names.mdx b/content/docs/stacks/api/names/names.mdx
index 76180bd05..29e4e3cd3 100644
--- a/content/docs/stacks/api/names/names.mdx
+++ b/content/docs/stacks/api/names/names.mdx
@@ -57,8 +57,8 @@ names are defaulted to page 1 with 100 results. You can query specific page resu
-```bash
-curl -X GET "https://api.hiro.so/v1/names?page=22"
+```terminal
+$ curl -X GET "https://api.hiro.so/v1/names?page=22"
```
diff --git a/content/docs/stacks/api/names/namespace-names.mdx b/content/docs/stacks/api/names/namespace-names.mdx
index f02f07171..d089c684b 100644
--- a/content/docs/stacks/api/names/namespace-names.mdx
+++ b/content/docs/stacks/api/names/namespace-names.mdx
@@ -67,8 +67,8 @@ namespace values are defaulted to page 1 with 100 results. You can query specifi
-```bash
-curl -X GET "https://api.hiro.so/v1/namespaces/id/names?page=22"
+```terminal
+$ curl -X GET "https://api.hiro.so/v1/namespaces/id/names?page=22"
```
diff --git a/content/docs/stacks/api/names/namespaces.mdx b/content/docs/stacks/api/names/namespaces.mdx
index 1fd9e51d9..ca9fe2bfa 100644
--- a/content/docs/stacks/api/names/namespaces.mdx
+++ b/content/docs/stacks/api/names/namespaces.mdx
@@ -46,8 +46,8 @@ Retrieves a list of all namespaces known to the node.
-```bash
-curl -X GET "https://api.hiro.so/v1/namespaces"
+```terminal
+$ curl -X GET "https://api.hiro.so/v1/namespaces"
```
diff --git a/content/docs/stacks/api/names/owned-by-address.mdx b/content/docs/stacks/api/names/owned-by-address.mdx
index d2c324ea2..09610a239 100644
--- a/content/docs/stacks/api/names/owned-by-address.mdx
+++ b/content/docs/stacks/api/names/owned-by-address.mdx
@@ -64,8 +64,8 @@ the address to lookup
-```bash
-curl -X GET "https://api.hiro.so/v1/addresses/bitcoin/1QJQxDas5JhdiXhEbNS14iNjr8auFT96GP"
+```terminal
+$ curl -X GET "https://api.hiro.so/v1/addresses/bitcoin/1QJQxDas5JhdiXhEbNS14iNjr8auFT96GP"
```
diff --git a/content/docs/stacks/api/non-fungible-tokens/history.mdx b/content/docs/stacks/api/non-fungible-tokens/history.mdx
index 5d4dc17c4..4f1c5fdd8 100644
--- a/content/docs/stacks/api/non-fungible-tokens/history.mdx
+++ b/content/docs/stacks/api/non-fungible-tokens/history.mdx
@@ -102,8 +102,8 @@ whether or not to include the complete transaction metadata instead of just `tx_
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tokens/nft/history?asset_identifier=SP2X0TZ59D5SZ8ACQ6YMCHHNR2ZN51Z32E2CJ173.the-explorer-guild%3A%3AThe-Explorer-Guild&value=0x0100000000000000000000000000000803&limit=50&offset=42000&unanchored=true&tx_metadata=false"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tokens/nft/history?asset_identifier=SP2X0TZ59D5SZ8ACQ6YMCHHNR2ZN51Z32E2CJ173.the-explorer-guild%3A%3AThe-Explorer-Guild&value=0x0100000000000000000000000000000803&limit=50&offset=42000&unanchored=true&tx_metadata=false"
```
diff --git a/content/docs/stacks/api/non-fungible-tokens/holdings.mdx b/content/docs/stacks/api/non-fungible-tokens/holdings.mdx
index 924b8be2b..0fe127495 100644
--- a/content/docs/stacks/api/non-fungible-tokens/holdings.mdx
+++ b/content/docs/stacks/api/non-fungible-tokens/holdings.mdx
@@ -103,8 +103,8 @@ whether or not to include the complete transaction metadata instead of just `tx_
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tokens/nft/holdings?principal=SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S.marketplace-v3&asset_identifiers=SPQZF23W7SEYBFG5JQ496NMY0G7379SRYEDREMSV.Candy%3A%3Acandy&limit=50&offset=42000&unanchored=true&tx_metadata=false"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tokens/nft/holdings?principal=SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S.marketplace-v3&asset_identifiers=SPQZF23W7SEYBFG5JQ496NMY0G7379SRYEDREMSV.Candy%3A%3Acandy&limit=50&offset=42000&unanchored=true&tx_metadata=false"
```
diff --git a/content/docs/stacks/api/non-fungible-tokens/mints.mdx b/content/docs/stacks/api/non-fungible-tokens/mints.mdx
index 511f9a748..1f9d209df 100644
--- a/content/docs/stacks/api/non-fungible-tokens/mints.mdx
+++ b/content/docs/stacks/api/non-fungible-tokens/mints.mdx
@@ -94,8 +94,8 @@ whether or not to include the complete transaction metadata instead of just `tx_
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tokens/nft/mints?asset_identifier=SP2X0TZ59D5SZ8ACQ6YMCHHNR2ZN51Z32E2CJ173.the-explorer-guild%3A%3AThe-Explorer-Guild&limit=50&offset=42000&unanchored=true&tx_metadata=false"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tokens/nft/mints?asset_identifier=SP2X0TZ59D5SZ8ACQ6YMCHHNR2ZN51Z32E2CJ173.the-explorer-guild%3A%3AThe-Explorer-Guild&limit=50&offset=42000&unanchored=true&tx_metadata=false"
```
diff --git a/content/docs/stacks/api/proof-of-transfer/cycle.mdx b/content/docs/stacks/api/proof-of-transfer/cycle.mdx
index ab53ad7b4..d471cd8f4 100644
--- a/content/docs/stacks/api/proof-of-transfer/cycle.mdx
+++ b/content/docs/stacks/api/proof-of-transfer/cycle.mdx
@@ -55,8 +55,8 @@ PoX cycle number
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/pox/cycles/56"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/pox/cycles/56"
```
diff --git a/content/docs/stacks/api/proof-of-transfer/cycles.mdx b/content/docs/stacks/api/proof-of-transfer/cycles.mdx
index 525b5b275..88c874747 100644
--- a/content/docs/stacks/api/proof-of-transfer/cycles.mdx
+++ b/content/docs/stacks/api/proof-of-transfer/cycles.mdx
@@ -66,8 +66,8 @@ index of first cycle to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/pox/cycles?limit=20&offset=20"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/pox/cycles?limit=20&offset=20"
```
diff --git a/content/docs/stacks/api/proof-of-transfer/signer-in-cycle.mdx b/content/docs/stacks/api/proof-of-transfer/signer-in-cycle.mdx
index bbcce0eaf..e5ca9ce59 100644
--- a/content/docs/stacks/api/proof-of-transfer/signer-in-cycle.mdx
+++ b/content/docs/stacks/api/proof-of-transfer/signer-in-cycle.mdx
@@ -63,8 +63,8 @@ Signer key
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/pox/cycles/56/signers/0x038e3c4529395611be9abf6fa3b6987e81d402385e3d605a073f42f407565a4a3d"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/pox/cycles/56/signers/0x038e3c4529395611be9abf6fa3b6987e81d402385e3d605a073f42f407565a4a3d"
```
diff --git a/content/docs/stacks/api/proof-of-transfer/signers-in-cycle.mdx b/content/docs/stacks/api/proof-of-transfer/signers-in-cycle.mdx
index b772b0a63..4bb6f888c 100644
--- a/content/docs/stacks/api/proof-of-transfer/signers-in-cycle.mdx
+++ b/content/docs/stacks/api/proof-of-transfer/signers-in-cycle.mdx
@@ -55,8 +55,8 @@ PoX cycle number
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/pox/cycles/56/signers"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/pox/cycles/56/signers"
```
diff --git a/content/docs/stacks/api/proof-of-transfer/stackers-for-signer-in-cycle.mdx b/content/docs/stacks/api/proof-of-transfer/stackers-for-signer-in-cycle.mdx
index 9733634a7..55b2e08ed 100644
--- a/content/docs/stacks/api/proof-of-transfer/stackers-for-signer-in-cycle.mdx
+++ b/content/docs/stacks/api/proof-of-transfer/stackers-for-signer-in-cycle.mdx
@@ -63,8 +63,8 @@ Signer key
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/pox/cycles/56/signers/0x038e3c4529395611be9abf6fa3b6987e81d402385e3d605a073f42f407565a4a3d/stackers"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/pox/cycles/56/signers/0x038e3c4529395611be9abf6fa3b6987e81d402385e3d605a073f42f407565a4a3d/stackers"
```
diff --git a/content/docs/stacks/api/search/search-by-id.mdx b/content/docs/stacks/api/search/search-by-id.mdx
index 5ee98e8cd..6973534d9 100644
--- a/content/docs/stacks/api/search/search-by-id.mdx
+++ b/content/docs/stacks/api/search/search-by-id.mdx
@@ -63,8 +63,8 @@ This includes the detailed data for purticular hash in the response
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/search/0xcf8b233f19f6c07d2dc1963302d2436efd36e9afac127bf6582824a13961c06d?include_metadata=true"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/search/0xcf8b233f19f6c07d2dc1963302d2436efd36e9afac127bf6582824a13961c06d?include_metadata=true"
```
diff --git a/content/docs/stacks/api/smart-contracts/by-trait.mdx b/content/docs/stacks/api/smart-contracts/by-trait.mdx
index 9931af49c..10ed114a5 100644
--- a/content/docs/stacks/api/smart-contracts/by-trait.mdx
+++ b/content/docs/stacks/api/smart-contracts/by-trait.mdx
@@ -65,8 +65,8 @@ index of first contract event to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/contract/by_trait?trait_abi=string&limit=0&offset=0"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/contract/by_trait?trait_abi=string&limit=0&offset=0"
```
diff --git a/content/docs/stacks/api/smart-contracts/events.mdx b/content/docs/stacks/api/smart-contracts/events.mdx
index 7cfb747de..f6261e146 100644
--- a/content/docs/stacks/api/smart-contracts/events.mdx
+++ b/content/docs/stacks/api/smart-contracts/events.mdx
@@ -80,8 +80,8 @@ Include transaction data from unanchored (i.e. unconfirmed) microblocks
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/contract/SP6P4EJF0VG8V0RB3TQQKJBHDQKEF6NVRD1KZE3C.satoshibles/events?limit=0&offset=42000&unanchored=true"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/contract/SP6P4EJF0VG8V0RB3TQQKJBHDQKEF6NVRD1KZE3C.satoshibles/events?limit=0&offset=42000&unanchored=true"
```
diff --git a/content/docs/stacks/api/smart-contracts/info.mdx b/content/docs/stacks/api/smart-contracts/info.mdx
index 987a4231f..b2fe5f2b3 100644
--- a/content/docs/stacks/api/smart-contracts/info.mdx
+++ b/content/docs/stacks/api/smart-contracts/info.mdx
@@ -47,8 +47,8 @@ Retrieves details of a contract with a given `contract_id`
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/contract/%7Bcontract_id%7D"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/contract/%7Bcontract_id%7D"
```
diff --git a/content/docs/stacks/api/smart-contracts/status.mdx b/content/docs/stacks/api/smart-contracts/status.mdx
index 511172d23..fed279814 100644
--- a/content/docs/stacks/api/smart-contracts/status.mdx
+++ b/content/docs/stacks/api/smart-contracts/status.mdx
@@ -57,8 +57,8 @@ contract ids to fetch status for
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/smart-contracts/status?contract_id=SPQZF23W7SEYBFG5JQ496NMY0G7379SRYEDREMSV.Candy"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/smart-contracts/status?contract_id=SPQZF23W7SEYBFG5JQ496NMY0G7379SRYEDREMSV.Candy"
```
diff --git a/content/docs/stacks/api/stacking-pool/members.mdx b/content/docs/stacks/api/stacking-pool/members.mdx
index 059889ea5..9b33cb578 100644
--- a/content/docs/stacks/api/stacking-pool/members.mdx
+++ b/content/docs/stacks/api/stacking-pool/members.mdx
@@ -92,8 +92,8 @@ number of items to skip
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/pox4/SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP/delegations?unanchored=false&limit=5"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/pox4/SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP/delegations?unanchored=false&limit=5"
```
diff --git a/content/docs/stacks/api/stacking-rewards/recent-burnchain-reward-recipient.mdx b/content/docs/stacks/api/stacking-rewards/recent-burnchain-reward-recipient.mdx
index 726628789..b8235e8ef 100644
--- a/content/docs/stacks/api/stacking-rewards/recent-burnchain-reward-recipient.mdx
+++ b/content/docs/stacks/api/stacking-rewards/recent-burnchain-reward-recipient.mdx
@@ -70,8 +70,8 @@ index of first rewards to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/burnchain/rewards/36hQtSEXBMevo5chpxhfAGiCTSC34QKgda?limit=0&offset=42000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/burnchain/rewards/36hQtSEXBMevo5chpxhfAGiCTSC34QKgda?limit=0&offset=42000"
```
diff --git a/content/docs/stacks/api/stacking-rewards/recent-burnchain-reward-recipients.mdx b/content/docs/stacks/api/stacking-rewards/recent-burnchain-reward-recipients.mdx
index 08c8e4916..764f6b51f 100644
--- a/content/docs/stacks/api/stacking-rewards/recent-burnchain-reward-recipients.mdx
+++ b/content/docs/stacks/api/stacking-rewards/recent-burnchain-reward-recipients.mdx
@@ -65,8 +65,8 @@ index of first rewards to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/burnchain/rewards?limit=96&offset=42000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/burnchain/rewards?limit=96&offset=42000"
```
diff --git a/content/docs/stacks/api/stacking-rewards/recent-reward-slot-holder-entries.mdx b/content/docs/stacks/api/stacking-rewards/recent-reward-slot-holder-entries.mdx
index d46825c18..bbc009f8a 100644
--- a/content/docs/stacks/api/stacking-rewards/recent-reward-slot-holder-entries.mdx
+++ b/content/docs/stacks/api/stacking-rewards/recent-reward-slot-holder-entries.mdx
@@ -70,8 +70,8 @@ index of the first items to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/burnchain/reward_slot_holders/36hQtSEXBMevo5chpxhfAGiCTSC34QKgda?limit=0&offset=42000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/burnchain/reward_slot_holders/36hQtSEXBMevo5chpxhfAGiCTSC34QKgda?limit=0&offset=42000"
```
diff --git a/content/docs/stacks/api/stacking-rewards/recent-reward-slot-holders.mdx b/content/docs/stacks/api/stacking-rewards/recent-reward-slot-holders.mdx
index 0bbb25859..32fc8f5ac 100644
--- a/content/docs/stacks/api/stacking-rewards/recent-reward-slot-holders.mdx
+++ b/content/docs/stacks/api/stacking-rewards/recent-reward-slot-holders.mdx
@@ -65,8 +65,8 @@ index of the first items to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/burnchain/reward_slot_holders?limit=96&offset=42000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/burnchain/reward_slot_holders?limit=96&offset=42000"
```
diff --git a/content/docs/stacks/api/stacking-rewards/total-burnchain-rewards-for-recipient.mdx b/content/docs/stacks/api/stacking-rewards/total-burnchain-rewards-for-recipient.mdx
index 8f07cbcdd..4295d5182 100644
--- a/content/docs/stacks/api/stacking-rewards/total-burnchain-rewards-for-recipient.mdx
+++ b/content/docs/stacks/api/stacking-rewards/total-burnchain-rewards-for-recipient.mdx
@@ -55,8 +55,8 @@ Reward recipient address. Should either be in the native burnchain's format (e.g
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/burnchain/rewards/36hQtSEXBMevo5chpxhfAGiCTSC34QKgda/total"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/burnchain/rewards/36hQtSEXBMevo5chpxhfAGiCTSC34QKgda/total"
```
diff --git a/content/docs/stacks/api/tokens/holders.mdx b/content/docs/stacks/api/tokens/holders.mdx
index 4ecebdbba..3ac6aa743 100644
--- a/content/docs/stacks/api/tokens/holders.mdx
+++ b/content/docs/stacks/api/tokens/holders.mdx
@@ -54,8 +54,8 @@ fungible token identifier
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tokens/ft/string/holders"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tokens/ft/string/holders"
```
diff --git a/content/docs/stacks/api/transactions/address-transactions.mdx b/content/docs/stacks/api/transactions/address-transactions.mdx
index 9bc2d2b3c..5933e33fa 100644
--- a/content/docs/stacks/api/transactions/address-transactions.mdx
+++ b/content/docs/stacks/api/transactions/address-transactions.mdx
@@ -75,8 +75,8 @@ Index of first transaction to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/addresses/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions?limit=20&offset=10"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/addresses/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions?limit=20&offset=10"
```
diff --git a/content/docs/stacks/api/transactions/details-for-transactions.mdx b/content/docs/stacks/api/transactions/details-for-transactions.mdx
index 780b157eb..110f026c0 100644
--- a/content/docs/stacks/api/transactions/details-for-transactions.mdx
+++ b/content/docs/stacks/api/transactions/details-for-transactions.mdx
@@ -51,8 +51,8 @@ If using TypeScript, import typings for this response from our types package:
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tx/multiple"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tx/multiple"
```
diff --git a/content/docs/stacks/api/transactions/dropped-mempool-transactions.mdx b/content/docs/stacks/api/transactions/dropped-mempool-transactions.mdx
index 85d6c1a4f..34766c500 100644
--- a/content/docs/stacks/api/transactions/dropped-mempool-transactions.mdx
+++ b/content/docs/stacks/api/transactions/dropped-mempool-transactions.mdx
@@ -71,8 +71,8 @@ index of first mempool transaction to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tx/mempool/dropped?limit=96&offset=42000"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tx/mempool/dropped?limit=96&offset=42000"
```
diff --git a/content/docs/stacks/api/transactions/events-for-an-address-transaction.mdx b/content/docs/stacks/api/transactions/events-for-an-address-transaction.mdx
index c33ae6ede..4d575981e 100644
--- a/content/docs/stacks/api/transactions/events-for-an-address-transaction.mdx
+++ b/content/docs/stacks/api/transactions/events-for-an-address-transaction.mdx
@@ -81,8 +81,8 @@ Index of first event to fetch
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/addresses/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions/0x0a411719e3bfde95f9e227a2d7f8fac3d6c646b1e6cc186db0e2838a2c6cd9c0/events?limit=20&offset=10"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/addresses/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions/0x0a411719e3bfde95f9e227a2d7f8fac3d6c646b1e6cc186db0e2838a2c6cd9c0/events?limit=20&offset=10"
```
diff --git a/content/docs/stacks/api/transactions/get-raw-transaction.mdx b/content/docs/stacks/api/transactions/get-raw-transaction.mdx
index f40993965..b37a25071 100644
--- a/content/docs/stacks/api/transactions/get-raw-transaction.mdx
+++ b/content/docs/stacks/api/transactions/get-raw-transaction.mdx
@@ -48,8 +48,8 @@ Retrieves a hex encoded serialized transaction for a given ID
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tx/%7Btx_id%7D/raw"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tx/%7Btx_id%7D/raw"
```
diff --git a/content/docs/stacks/api/transactions/get-transaction.mdx b/content/docs/stacks/api/transactions/get-transaction.mdx
index b3036981c..8350835b0 100644
--- a/content/docs/stacks/api/transactions/get-transaction.mdx
+++ b/content/docs/stacks/api/transactions/get-transaction.mdx
@@ -59,8 +59,8 @@ Transaction ID
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tx/{tx_id}"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tx/{tx_id}"
```
diff --git a/content/docs/stacks/api/transactions/mempool-transactions.mdx b/content/docs/stacks/api/transactions/mempool-transactions.mdx
index eddc43823..197cc61cd 100644
--- a/content/docs/stacks/api/transactions/mempool-transactions.mdx
+++ b/content/docs/stacks/api/transactions/mempool-transactions.mdx
@@ -120,8 +120,8 @@ Include transaction data from unanchored (i.e. unconfirmed) microblocks
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tx/mempool?sender_address=SP1GPBP8NBRXDRJBFQBV7KMAZX1Z7W2RFWJEH0V10&recipient_address=string&address=string&order_by=fee&order=asc&limit=20&offset=42000&unanchored=true"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tx/mempool?sender_address=SP1GPBP8NBRXDRJBFQBV7KMAZX1Z7W2RFWJEH0V10&recipient_address=string&address=string&order_by=fee&order=asc&limit=20&offset=42000&unanchored=true"
```
diff --git a/content/docs/stacks/api/transactions/recent-transactions.mdx b/content/docs/stacks/api/transactions/recent-transactions.mdx
index 9cb824c5e..5a1e71223 100644
--- a/content/docs/stacks/api/transactions/recent-transactions.mdx
+++ b/content/docs/stacks/api/transactions/recent-transactions.mdx
@@ -166,8 +166,8 @@ Include transaction data from unanchored (i.e. unconfirmed) microblocks
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tx?limit=100&offset=42000&type=coinbase&from_address=string&to_address=string&sort_by=burn_block_time&start_time=1704067200&end_time=1706745599&contract_id=SP000000000000000000002Q6VF78.pox-4&function_name=delegate-stx&nonce=123&order=desc&unanchored=true"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tx?limit=100&offset=42000&type=coinbase&from_address=string&to_address=string&sort_by=burn_block_time&start_time=1704067200&end_time=1706745599&contract_id=SP000000000000000000002Q6VF78.pox-4&function_name=delegate-stx&nonce=123&order=desc&unanchored=true"
```
diff --git a/content/docs/stacks/api/transactions/statistics-for-mempool-transactions.mdx b/content/docs/stacks/api/transactions/statistics-for-mempool-transactions.mdx
index c45d2eb37..c22306e75 100644
--- a/content/docs/stacks/api/transactions/statistics-for-mempool-transactions.mdx
+++ b/content/docs/stacks/api/transactions/statistics-for-mempool-transactions.mdx
@@ -48,8 +48,8 @@ All results broken down by transaction type and percentiles (p25, p50, p75, p95)
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tx/mempool/stats"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tx/mempool/stats"
```
diff --git a/content/docs/stacks/api/transactions/transaction-events.mdx b/content/docs/stacks/api/transactions/transaction-events.mdx
index cf879d55d..16c09d990 100644
--- a/content/docs/stacks/api/transactions/transaction-events.mdx
+++ b/content/docs/stacks/api/transactions/transaction-events.mdx
@@ -85,8 +85,8 @@ Filter the events on event type
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/tx/events?tx_id=string&address=ST1HB64MAJ1MBV4CQ80GF01DZS4T1DSMX20ADCRA4&limit=100&offset=42000&type=stx_lock"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/tx/events?tx_id=string&address=ST1HB64MAJ1MBV4CQ80GF01DZS4T1DSMX20ADCRA4&limit=100&offset=42000&type=stx_lock"
```
diff --git a/content/docs/stacks/api/transactions/transactions-by-block.mdx b/content/docs/stacks/api/transactions/transactions-by-block.mdx
index 44a06168c..a97518193 100644
--- a/content/docs/stacks/api/transactions/transactions-by-block.mdx
+++ b/content/docs/stacks/api/transactions/transactions-by-block.mdx
@@ -54,8 +54,8 @@ filter by block height, hash, index block hash or the constant `latest` to filte
-```bash
-curl -X GET "https://api.hiro.so/extended/v2/blocks/42000/transactions"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v2/blocks/42000/transactions"
```
diff --git a/content/docs/stacks/api/transactions/transactions-for-address.mdx b/content/docs/stacks/api/transactions/transactions-for-address.mdx
index afb0b552a..c394b180f 100644
--- a/content/docs/stacks/api/transactions/transactions-for-address.mdx
+++ b/content/docs/stacks/api/transactions/transactions-for-address.mdx
@@ -82,8 +82,8 @@ Include transaction data from unanchored (i.e. unconfirmed) microblocks
-```bash
-curl -X GET "https://api.hiro.so/extended/v1/address/SP197DVH8KTJGX4STM61QN0WJV8Y9QJWXV83ZGNR9/mempool?limit=90&offset=42000&unanchored=true"
+```terminal
+$ curl -X GET "https://api.hiro.so/extended/v1/address/SP197DVH8KTJGX4STM61QN0WJV8Y9QJWXV83ZGNR9/mempool?limit=90&offset=42000&unanchored=true"
```
diff --git a/content/docs/stacks/api/txs.mdx b/content/docs/stacks/api/txs.mdx
index 7bd46909b..a3df08f80 100644
--- a/content/docs/stacks/api/txs.mdx
+++ b/content/docs/stacks/api/txs.mdx
@@ -26,10 +26,10 @@ Stacks supports a set of different transaction types:
| **Type** | **Value** | **Description** |
| :----------------- | :------------------- | :--------------- |
-| Coinbase | `coinbase` | The first transaction in a new block. |
-| Token transfer | `token_transfer` | Asset transfer from a sender to a recipient. |
-| Contract deploy | `smart_contract` | Contract instantiation. |
-| Contract call | `contract_call` | Contract call for a public, non read-only function. |
+| Coinbase | _json`"coinbase"`_ | The first transaction in a new block. |
+| Token transfer | _json`"token_transfer"`_ | Asset transfer from a sender to a recipient. |
+| Contract deploy | _json`"smart_contract"`_ | Contract instantiation. |
+| Contract call | _json`"contract_call"`_ | Contract call for a public, non read-only function. |
A sample of each transaction type can be found in the [Stacks Blockchain API response definition for transactions](https://docs.hiro.so/api#operation/get_transaction_by_id).
@@ -316,8 +316,8 @@ console.log(serializedTx);
The preceding method returns the following string:
-```bash
-8080000000040015c31b8c1c11c515e244b75806bac48d1399c77500000000000000000000000000000000000127e88a68dce8689fc94ff4c186bf8966f8d544c5129ff84d95a2459b5e8e7c39430388f6c8f85cce8c9ce5e6ec1e157116ca4a67d65ab53768b25d5fb5831939030200000000000516df0ba3e79792be7be5e50a370289accfc8c9e03200000000000f424068656c6c6f20776f726c640000000000000000000000000000000000000000000000
+```terminal
+$ 8080000000040015c31b8c1c11c515e244b75806bac48d1399c77500000000000000000000000000000000000127e88a68dce8689fc94ff4c186bf8966f8d544c5129ff84d95a2459b5e8e7c39430388f6c8f85cce8c9ce5e6ec1e157116ca4a67d65ab53768b25d5fb5831939030200000000000516df0ba3e79792be7be5e50a370289accfc8c9e03200000000000f424068656c6c6f20776f726c640000000000000000000000000000000000000000000000
```
Transaction IDs are generated by hashing the raw transaction with [sha512/256](https://eprint.iacr.org/2010/548.pdf)
@@ -411,9 +411,8 @@ A sponsored transaction is one where a second signer sets and pays the transacti
With a serialized transaction in the [raw format](#raw-format), it can be broadcast to the network using the [`POST /v2/transactions`](/stacks/api/transactions/broadcast-transaction) endpoint:
-```bash
-# for mainnet, replace `testnet` with `mainnet`
-curl --location --request POST 'https://api.testnet.hiro.so/v2/transactions' \
+```terminal
+$ curl --location --request POST 'https://api.testnet.hiro.so/v2/transactions' \
--header 'Content-Type: application/octet-stream' \
--data-raw ''
```
@@ -473,9 +472,8 @@ The API can be easily consumed using a generated [JS client library](https://hir
Recent transactions can be obtained through the [`GET /extended/v1/tx`](/stacks/api/transactions/recent-transactions) endpoint:
-```bash
-# for mainnet, replace `testnet` with `mainnet`
-curl 'https://api.testnet.hiro.so/extended/v1/tx'
+```terminal
+$ curl 'https://api.testnet.hiro.so/extended/v1/tx'
```
Sample response:
@@ -511,9 +509,8 @@ Sample response:
Mempool (registered, but not processed) transactions can be obtained using the [`GET /extended/v1/tx/mempool`](/stacks/api/transactions/mempool-transactions) endpoint:
-```bash
-# for mainnet, replace `testnet` with `mainnet`
-curl 'https://api.testnet.hiro.so/extended/v1/tx/mempool'
+```terminal
+$ curl 'https://api.testnet.hiro.so/extended/v1/tx/mempool'
```
Sample response:
@@ -550,18 +547,16 @@ The `memo` field is represented as a hexadecimal string of a byte buffer
Recent transactions can be filtered by [transaction type](#types) using the `type` query parameter:
-```bash
-# for mainnet, replace `testnet` with `mainnet`
-curl 'https://api.testnet.hiro.so/extended/v1/tx/?type=contract_call'
+```terminal
+$ curl 'https://api.testnet.hiro.so/extended/v1/tx/?type=contract_call'
```
#### Get transaction by ID
A specific transaction can be obtained using the [`GET /extended/v1/tx/`](/stacks/api/transactions/get-transaction) endpoint:
-```bash
-# for mainnet, replace `testnet` with `mainnet`
-curl 'https://api.testnet.hiro.so/extended/v1/tx/'
+```terminal
+$ curl 'https://api.testnet.hiro.so/extended/v1/tx/'
```
Sample response:
diff --git a/content/docs/stacks/api/usage.mdx b/content/docs/stacks/api/usage.mdx
index f9410d500..968df1a11 100644
--- a/content/docs/stacks/api/usage.mdx
+++ b/content/docs/stacks/api/usage.mdx
@@ -15,8 +15,8 @@ https://api.mainnet.hiro.so
To make a request to the Stacks API, you can paste the `curl` command below in your terminal.
-```bash title="Terminal"
-curl -L 'https://api.hiro.so/extended' \
+```terminal
+$ curl -L 'https://api.hiro.so/extended' \
-H 'Accept: application/json'
```
@@ -24,10 +24,10 @@ curl -L 'https://api.hiro.so/extended' \
If you are using an `api-key`, you will need to replace `$HIRO_API_KEY` with your secret API key.
-```bash title="Terminal"
-curl -L 'https://api.hiro.so/extended' \
--H 'Accept: application/json' \
--H 'X-API-Key: $HIRO_API_KEY' # [!code highlight]
+```terminal
+$ curl -L 'https://api.hiro.so/extended' \
+ -H 'Accept: application/json' \
+ -H 'X-API-Key: $HIRO_API_KEY'
```
### Response codes
diff --git a/content/docs/stacks/archive/guides/stacks-api.mdx b/content/docs/stacks/archive/guides/stacks-api.mdx
index f2e5c97bb..1c1dffc71 100644
--- a/content/docs/stacks/archive/guides/stacks-api.mdx
+++ b/content/docs/stacks/archive/guides/stacks-api.mdx
@@ -71,9 +71,9 @@ or the most recent upload for a particular version:
1. Download the archive and shasum for the appropriate network and restoration method.
1. [Verify the archive](/stacks/archive/guides/verify-archive-data) with the shasum.
1. Import the archive file into a running Postgres database (may take up to an hour depending on database specs and tuning):
- ```console
- export PGPASSWORD=
- pg_restore --username postgres --verbose --jobs 4 --dbname stacks_blockchain_api /path/to/archive/file
+ ```terminal
+ $ export PGPASSWORD=
+ $ pg_restore --username postgres --verbose --jobs 4 --dbname stacks_blockchain_api /path/to/archive/file
```
1. Launch the Stacks Blockchain API service.
1. Verify the dataset is being used by comparing your nodes [local block height](http://localhost:3999/extended/v1/status) with [Hiro's](https://api.hiro.so/extended/v1/status). If the block height matches or is close to Hiro's block height, the restoration was successful.
@@ -85,9 +85,8 @@ or the most recent upload for a particular version:
1. Download the archive and shasum for the appropriate network and restoration method.
1. [Verify the archive](/stacks/archive/guides/verify-archive-data) with the shasum.
1. Extract the archive into the desired directory:
- ```console
- # Target directory must already exist
- gzip -d --stdout > /path/to/extracted/file
+ ```terminal
+ $ gzip -d --stdout > /path/to/extracted/file
```
1. [Follow these directions](https://github.com/hirosystems/stacks-blockchain-api#export-and-import) to process and import the events in the TSV file into your Postgres database.
1. Launch the Stacks Blockchain API service.
diff --git a/content/docs/stacks/archive/guides/stacks-blockchain.mdx b/content/docs/stacks/archive/guides/stacks-blockchain.mdx
index 2d0f342f4..ebee2dd4a 100644
--- a/content/docs/stacks/archive/guides/stacks-blockchain.mdx
+++ b/content/docs/stacks/archive/guides/stacks-blockchain.mdx
@@ -30,9 +30,8 @@ or the most recent upload for a particular version:
1. Download the archive and shasum for the appropriate network.
1. [Verify the archive](/stacks/archive/guides/verify-archive-data) with the shasum.
1. Extract the archive into the desired directory:
- ```console
- # Target directory must already exist
- tar -zxvf -C /target/directory
+ ```terminal
+ $ tar -zxvf -C /target/directory
```
1. [Configure the `working_dir` property](https://docs.stacks.co/docs/nodes-and-miners/stacks-node-configuration#node) in your Stacks blockchain node Config.toml file to match the directory you extracted the archive to.
1. Launch your Stacks blockchain node. You can use [one of these example configuration files](https://github.com/stacks-network/stacks-blockchain/tree/master/testnet/stacks-node/conf) as a reference.
diff --git a/content/docs/stacks/archive/guides/token-metadata-api.mdx b/content/docs/stacks/archive/guides/token-metadata-api.mdx
index 1cff6cabe..eb7a8a0b1 100644
--- a/content/docs/stacks/archive/guides/token-metadata-api.mdx
+++ b/content/docs/stacks/archive/guides/token-metadata-api.mdx
@@ -36,9 +36,9 @@ or the most recent upload for a particular version:
1. Download the archive and shasum for the appropriate network.
1. [Verify the archive](/stacks/archive/guides/verify-archive-data) with the shasum.
1. Import the archive file into a running Postgres database (may take up to an hour depending on database specs and tuning):
- ```console
- export PGPASSWORD=
- pg_restore --username postgres --verbose --jobs 4 --dbname token_metadata_api /path/to/archive/file
+ ```terminal
+ $ export PGPASSWORD=
+ $ pg_restore --username postgres --verbose --jobs 4 --dbname token_metadata_api /path/to/archive/file
```
1. Launch the Token Metadata API service.
1. Verify the restoration was successful by viewing the [total number of tokens and contracts tracked in the service.](http://localhost:3000/metadata) If the total number of each property is greater than zero, the restoration was successful.
diff --git a/content/docs/stacks/archive/guides/verify-archive-data.mdx b/content/docs/stacks/archive/guides/verify-archive-data.mdx
index 0b22283e1..2861e3130 100644
--- a/content/docs/stacks/archive/guides/verify-archive-data.mdx
+++ b/content/docs/stacks/archive/guides/verify-archive-data.mdx
@@ -8,14 +8,12 @@ As some of the archives are quite large, this is useful to ensure the file you'v
After downloading an archive file and its associated shasum file, you can verify the integrity of the archive file like so:
-```console
-echo "$(cat | awk '{print $1}') " | shasum --check
+```terminal
+$ echo "$(cat | awk '{print $1}') " | shasum --check
: OK
-# Example
-echo "$(cat mainnet-stacks-blockchain-api-latest.sha256 | awk '{print $1}') mainnet-stacks-blockchain-api-latest.gz" | shasum --check
+$ echo "$(cat mainnet-stacks-blockchain-api-latest.sha256 | awk '{print $1}') mainnet-stacks-blockchain-api-latest.gz" | shasum --check
-# If the integrity check succeeds, a log will be printed indicating so
mainnet-stacks-blockchain-api-latest.gz: OK
# Otherwise a log will be printed indicating failure
diff --git a/content/docs/stacks/archive/index.mdx b/content/docs/stacks/archive/index.mdx
index 488a93bd1..c936cb161 100644
--- a/content/docs/stacks/archive/index.mdx
+++ b/content/docs/stacks/archive/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: The Hiro Archive is a series of data snapshots for services in the Stacks ecosystem.
-toc: false
---
import { Button } from "@/components/ui/button"
diff --git a/content/docs/stacks/chainhook/concepts/predicate-design.mdx b/content/docs/stacks/chainhook/concepts/predicate-design.mdx
index fff7133b0..305c29243 100644
--- a/content/docs/stacks/chainhook/concepts/predicate-design.mdx
+++ b/content/docs/stacks/chainhook/concepts/predicate-design.mdx
@@ -3,10 +3,10 @@ title: Predicate design
description: Predicates are the building blocks of Chainhook.
---
-The core design of Chainhook revolves around the concept of predicates. Each individual Chainhook has a customizable predicate that specifies what the Bitcoin or Stacks blockchain data you are scanning for.
+The core design of Chainhook revolves around the concept of predicates. Each individual chainhook has a customizable predicate that specifies what Bitcoin or Stacks blockchain data you are scanning for.
- Commands outlined here will require that you have installed Chainhook [directly](/stacks/chainhook/installation).
+ Commands outlined here will require that you have [installed Chainhook directly](/stacks/chainhook/installation) first.
## Predicate design
@@ -14,7 +14,7 @@ Below is the general strucure of the `predicate` JSON with its primary elements.
- Chainhook will evaluate the predicate against the specfied blockchain specified in `chain`.
- The `uuid` will be returned in the Chainhook payload, providing a record of the predicate that triggers it.
-- Identify your predicate for your DApp using `name` and `version`.
+- Identify your predicate for your app using `name` and `version`.
```json
{
@@ -63,8 +63,6 @@ The `networks` element contains an object who's key determines the blockchain ne
The `predicate` identifies what data you want Chainhook to scan for using the `scope` define within the `if_this` specification. Additional arguments specific to the `scope` will also be passed here.
```json
- // [!code word:if_this]
- // [!code word:scope]
{
"if_this": {
"scope": "contract_call",
@@ -84,8 +82,6 @@ Chainhook delivers the payload when it is triggered by your `predicate` using th
When choosing to use file_append, specify the path where Chainhook will post the payload data.
```json
-// [!code word:then_that]
-// [!code word:file_append]
{
"then_that": {
"file_append": {
@@ -98,8 +94,6 @@ When choosing to use file_append, specify the path where Chainhook will post the
When using `http_post`, specify the endpoint's `url` and `authorization_header`.
```json
-// [!code word:then_that]
-// [!code word:http_post]
{
"then_that": {
"http_post": {
@@ -119,46 +113,46 @@ When using `http_post`, specify the endpoint's `url` and `authorization_header`.
- ```json
- {
- "chain": "bitcoin",
- "uuid": "1",
- "name": "Wrap BTC",
- "version": 1,
- "networks": {
- "testnet": {
- "if_this": {
- "scope": "ordinals_protocol",
- "operation": "inscription_feed"
- },
- "then_that": {
- "http_post": {
- "url": "http://localhost:3000/api/v1/ordinals",
- "authorization_header": "Bearer cn389ncoiwuencr"
- }
- },
- "start_block": 10200
- // Additional configurations
+ ```json
+ {
+ "chain": "bitcoin",
+ "uuid": "1",
+ "name": "Wrap BTC",
+ "version": 1,
+ "networks": {
+ "testnet": {
+ "if_this": {
+ "scope": "ordinals_protocol",
+ "operation": "inscription_feed"
},
- "mainnet": {
- "if_this": {
- "scope": "ordinals_protocol",
- "operation": "inscription_feed"
- },
- "then_that": {
- "http_post": {
- "url": "http://my-protocol.xyz/api/v1/ordinals",
- "authorization_header": "Bearer cn389ncoiwuencr"
- }
- },
- "start_block": 90232
- // Additional configurations
- }
+ "then_that": {
+ "http_post": {
+ "url": "http://localhost:3000/api/v1/ordinals",
+ "authorization_header": "Bearer cn389ncoiwuencr"
+ }
+ },
+ "start_block": 10200
+ // Additional configurations
+ },
+ "mainnet": {
+ "if_this": {
+ "scope": "ordinals_protocol",
+ "operation": "inscription_feed"
+ },
+ "then_that": {
+ "http_post": {
+ "url": "http://my-protocol.xyz/api/v1/ordinals",
+ "authorization_header": "Bearer cn389ncoiwuencr"
+ }
+ },
+ "start_block": 90232
+ // Additional configurations
}
}
- ```
+ }
+ ```
-
+
The following additional configurations can be used to improve the performance of Chainhook by preventing a full scan of the blockchain.
@@ -332,8 +326,8 @@ When using `http_post`, specify the endpoint's `url` and `authorization_header`.
/>
","status":200}
```
You can also run the Chainhook service by passing multiple predicates: `chainhook service start --predicate-path=predicate_1.json --predicate-path=predicate_2.json --config-path=Chainhook.toml`
diff --git a/content/docs/stacks/chainhook/guides/chainhook-as-a-service.mdx b/content/docs/stacks/chainhook/guides/chainhook-as-a-service.mdx
index 27d76f9ec..7af882a29 100644
--- a/content/docs/stacks/chainhook/guides/chainhook-as-a-service.mdx
+++ b/content/docs/stacks/chainhook/guides/chainhook-as-a-service.mdx
@@ -21,8 +21,8 @@ In this section, you will configure Chainhook to match the network configuration
Next, you will generate a `Chainhook.toml` file to connect Chainhook with your bitcoind node. Navigate to the directory where you want to generate the `Chainhook.toml` file and use the following command in your terminal:
-```console title="Terminal"
-chainhook config generate --mainnet
+```terminal
+$ chainhook config generate --mainnet
```
Several network parameters in the generated `Chainhook.toml` configuration file need to match those in the `bitcoin.conf` file created earlier in the [setting up a Bitcoin node](/guides/sync-a-bitcoin-node) section. Update the following parameters accordingly:
@@ -89,14 +89,13 @@ These predicates are where you specify the `if_this / then_that` pattern to trig
To generate a sample JSON file with predicates, execute the following command in your terminal:
-```console title="Terminal"
-chainhook predicates new stacking-pool.json --bitcoin
+```terminal
+$ chainhook predicates new stacking-pool.json --bitcoin
```
Replace the contents of the `stacking-pool.json` file with the following:
```json
-// [!code word: file_append]
{
"chain": "bitcoin",
"uuid": "1",
@@ -130,8 +129,8 @@ You can get blockchain height and current block by referring to the [Stacks Expl
Now, use the following command to scan the blocks based on the predicates defined in the `stacking-pool.json` file.
-```console title="Terminal"
-chainhook predicates scan stacking-pool.json --config-path=./Chainhook.toml
+```terminal
+$ chainhook predicates scan stacking-pool.json --config-path=./Chainhook.toml
```
The output of the above command will be a text file `bitcoin-transactions.txt` generated based on the predicate definition.
@@ -140,14 +139,13 @@ The output of the above command will be a text file `bitcoin-transactions.txt` g
Now you will generate another sample predicate, but this time you will send the payload to an API endpoint:
-```console title="Terminal"
-chainhook predicates new stacking-pool-api.json --bitcoin
+```terminal
+$ chainhook predicates new stacking-pool-api.json --bitcoin
```
Replace the contents of the `stacking-pool-api.json` file with the following:
```json
-// [!code word: http_post]
{
"chain": "bitcoin",
"uuid": "2",
@@ -179,8 +177,8 @@ The `start_block` is a required field when using the `http_post` `then_that` pre
Once you are finished setting up your endpoint, use the following command to scan the blocks based on the predicates defined in the `stacking-pool-api.json` file.
-```console title="Terminal"
-chainhook predicates scan stacking-pool-api.json --config-path=./Chainhook.toml
+```terminal
+$ chainhook predicates scan stacking-pool-api.json --config-path=./Chainhook.toml
```
The above command posts events to the URL `http://localhost:3000/events`, mentioned in the JSON file.
@@ -193,8 +191,8 @@ You can start a Chainhook service with an existing predicate. You can also dynam
Initiate the chainhook service by passing the predicate path to the command as shown below:
-```console title="Terminal"
-chainhook service start --predicate-path=stacking-pool-api.json --config-path=Chainhook.toml
+```terminal
+$ chainhook service start --predicate-path=stacking-pool-api.json --config-path=Chainhook.toml
```
The above command registers the predicate based on the predicate definition in the `stacking-pool-api.json` file.
@@ -217,104 +215,23 @@ database_uri = "redis://localhost:6379/"
If you have an instance of Redis running locally, you can now start the Chainhook service by running the following command:
-```console title="Terminal"
-chainhook service start --config-path=Chainhook.toml
+```terminal
+$ chainhook service start --config-path=Chainhook.toml
```
To dynamically register a new predicate, send a POST request to the running predicate registration server at `localhost:20456/v1/chainhooks`.
-```console title="Terminal"
-curl -X POST \
+Use the following `curl` command template as an example:
+
+```terminal
+$ curl -X POST \
-H "Content-Type: application/json" \
- -d '{
- "chain": "bitcoin",
- "uuid": "3",
- "name": "Ordinals",
- "version": 1,
- "networks": {
- "mainnet": {
- "start_block": 777534,
- "if_this": {
- "scope": "ordinals_protocol",
- "operation": "inscription_feed"
- },
- "then_that": {
- "http_post": {
- "url": "http://localhost:3000/events",
- "authorization_header": "12345"
- }
- }
- }
- }
- }' \
+ -d @predicate.json \
http://localhost:20456/v1/chainhooks
-```
-
-The sample response should look like this:
-```jsonc
-{
- "chainhook": {
- "predicate": {
- "operation": "inscription_feed",
- "scope": "ordinals_protocol",
- },
- "uuid": "1",
- },
- "apply": [
- {
- "block_identifier": {
- "hash": "0x00000000000000000003e3e2ffd3baaff2cddda7d12e84ed0ffe6f7778e988d4",
- "index": 777534,
- },
- "metadata": {},
- "parent_block_identifier": {
- "hash": "0x0000000000000000000463a1034c59e6dc94c7e52855582af11882743b86e2a7",
- "index": 777533,
- },
- "timestamp": 1676923039,
- "transactions": [
- {
- "transaction_identifier": {
- "hash": "0xca20efe5e4d71c16cd9b8dfe4d969efdd225ef0a26136a6a4409cb3afb2e013e",
- },
- "metadata": {
- "ordinal_operations": [
- {
- "inscription_revealed": {
- "content_bytes": "",
- "content_length": 12293,
- "content_type": "image/jpeg",
- "inscriber_address": "bc1punnjva5ayg84kf5tmvx265uwvp8py3ux24skz43aycj5rzdgzjfq0jxsuc",
- "inscription_fee": 64520,
- "inscription_id": "ca20efe5e4d71c16cd9b8dfe4d969efdd225ef0a26136a6a4409cb3afb2e013ei0",
- "inscription_number": 0,
- "inscription_output_value": 10000,
- "ordinal_block_height": 543164,
- "ordinal_number": 1728956147664701,
- "ordinal_offset": 1147664701,
- "satpoint_post_inscription": "ca20efe5e4d71c16cd9b8dfe4d969efdd225ef0a26136a6a4409cb3afb2e013e:0:0",
- "transfers_pre_inscription": 0,
- },
- },
- ],
- "proof": null,
- },
- "operations": [],
- // Other transactions
- },
- ],
- },
- ],
- "rollback": [],
-}
+{"result":"","status":200}
```
-To better understand the output of the above JSON file, let's break down some of the details:
-
-- The `apply` payload includes the block header and the transactions that triggered the predicate.
-- The `rollback` payload includes the block header and the transactions that triggered the predicate for a past block that is no longer part of the canonical chain and must be reverted. (Note: this is a chief component of Chainhook's reorg-aware functionality. Chainhook maintains rollback data for blocks near the chaintip.)
-
You can also run chainhook service by passing multiple predicates, ie `chainhook service start --predicate-path=predicate_1.json --predicate-path=predicate_2.json --config-path=Chainhook.toml`
diff --git a/content/docs/stacks/chainhook/guides/observing-contract-calls.mdx b/content/docs/stacks/chainhook/guides/observing-contract-calls.mdx
index d45a4374e..53974a9b5 100644
--- a/content/docs/stacks/chainhook/guides/observing-contract-calls.mdx
+++ b/content/docs/stacks/chainhook/guides/observing-contract-calls.mdx
@@ -11,7 +11,7 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
-The `contract_call` predicate scope is designed to target direct function calls within a smart contract. When triggered, Chainhook will return a payload with transaction data detailing the on-chain events contained in these functions.
+The _json`contract_call`_ predicate scope is designed to target direct function calls within a smart contract. When triggered, Chainhook will return a payload with transaction data detailing the on-chain events contained in these functions.
In this guide, you will learn how to:
@@ -33,8 +33,8 @@ The `predicate` is your main interface for querying the Chainhook data indexer.
For the Stacks blockchain, run the following command to generate a `predicate` template:
-```console
-chainhook predicates new contract-call-chainhook.json --stacks
+```terminal
+$ chainhook predicates new contract-call-chainhook.json --stacks
```
@@ -52,9 +52,7 @@ To begin, you need to configure the `predicate` to target the voting contract:
- Specify `testnet` in the network object.
- Set the `start_block` property to 21443This value represents the block height that our voting contract was deployed at..
-```json title="contract-call-chainhook.json"
-// [!code word:networks]
-// [!code word:start_block]
+```json contract-call-chainhook.json
{
"chain": "stacks",
"uuid": "1",
@@ -75,9 +73,7 @@ Next, define the scope of the `predicate` within the `if_this` specification.
The `contract_call` scope allows Chainhook to observe blockchain data when the specified function is directly called from its contract.
-```json title="contract-call-chainhook.json"
-// [!code word:if_this]
-// [!code word:contract_call]
+```json contract-call-chainhook.json
{
"if_this": {
"scope": "contract_call",
@@ -100,8 +96,7 @@ Finally, define how Chainhook delivers the payload when it is triggered by your
Using `file_append`, specify the path where Chainhook will post the payload data.
-```json title="contract-call-chainhook.json"
-// [!code word:file_append]
+```json contract-call-chainhook.json
{
"then_that": {
"file_append": {
@@ -158,8 +153,8 @@ Chainhook will track events where this function is directly invoked and deliver
To scan the Stacks blockchain using your predicate, run the following command, replacing `/path/to/contract-call-chainhook.json` with the actual path to your `contract-call-chainhook.json` file:
-```console
-chainhook predicates scan /path/to/contract-call-chainhook.json --testnet
+```terminal
+$ chainhook predicates scan /path/to/contract-call-chainhook.json --testnet
```
@@ -171,12 +166,11 @@ chainhook predicates scan /path/to/contract-call-chainhook.json --testnet
## Return contract data with the Clarity function
-The `cast-vote` function records a vote by storing the address that calls it. It also logs relevant data using the `print` function, which can be useful for when you want to track additional on-chain events that are not part of the built-in Clarity functions.
+The _clarity`cast-vote`_ function records a vote by storing the address that calls it. It also logs relevant data using the _clarity`print`_ function, which can be useful for when you want to track additional on-chain events that are not part of the built-in Clarity functions.
When you examine the `payload`, this is the data you will look for.
-```clarity title="simple-vote-v0.clar"
-// [!code word:cast-vote]
+```clarity simple-vote-v0.clar
(define-public (cast-vote)
(begin
;; Check if the voter has already voted.
@@ -213,9 +207,7 @@ When triggered by your predicate, the `payload` returned by Chainhook is a stand
Within the `apply` arrays element, the `block_identifer` object gives us the `index` for the observed block height.
-```json title="contract-call-payload.json"
-// [!code word:block_identifier]
-// [!code word:index]
+```json contract-call-payload.json
"block_identifier": {
"hash": "0x4d88015a6df9ec4f6df875941d87337ce64f8d51608563f80b6e27adeb327e4d",
"index": 21544
@@ -232,8 +224,7 @@ Within the `apply` arrays element, the `block_identifer` object gives us the `in
We can retrieve the `stacks_block_hash` by navigating to the `apply` arrays object `metadata` element. This hash will match the block hash display in the Stacks Explorer.
-```json title="contract-call-payload.json"
-// [!code word:stacks_block_hash]
+```json contract-call-payload.json
"apply": [
{
"metadata": {
@@ -245,7 +236,7 @@ We can retrieve the `stacks_block_hash` by navigating to the `apply` arrays obje
There is also a `timestamp` value returned in the `apply` array. This UNIX time stamp represents the initiation of the Stacks block.
-```json title="contract-call-payload.json"
+```json contract-call-payload.json
"timestamp": 1722208524
```
@@ -282,7 +273,7 @@ To find this data, we start with the `apply` array element of the `payload` obje
Once the `transaction` object is returned, we can begin examining the important data elements this object contains. The first element, `transaction_identifier`, includes a hash value that uniquely identifies your transaction.
-```json title="contract-call-payload.json"
+```json contract-call-payload.json
"transaction_identifier": {
"hash": "0x98195af8f888d2f9ca3462c41c1691e7798ea6d9e5e3afe42955c0921f981f2c"
}
@@ -292,7 +283,7 @@ Next, focus on the `metadata` object within your `contract_call` data. It's cruc
Utilize the `success` object to assess transaction success and extract the `sender` of the transaction and the `result` returned by the contract.
-```json title="contract-call-payload.json"
+```json contract-call-payload.json
"metadata": {
"success": true,
"sender": "STJ81C2WPQHFB6XTG518JKPABWM639R2X37VFKJV",
@@ -308,8 +299,7 @@ Moving forward, examine the `kind` object and its components within your `contra
In this case, the `cast-vote` function accepts no arguments, resulting in an empty `args` array.
-```json title="contract-call-payload.json"
-// [!code word:kind]
+```json contract-call-payload.json
{
"metadata":
"kind": {
@@ -326,8 +316,7 @@ In the `metadata` object's `receipt`, the `events` array holds the key data for
Since the `cast-vote` function uses a `print` statement, the events array will contain `topic` and `value` keys representing the data output.
-```json title="contract-call-payload.json"
-// [!code word:receipt]
+```json contract-call-payload.json
{
"metadata":
"receipt": {
diff --git a/content/docs/stacks/chainhook/guides/register-chainhooks-on-devnet.mdx b/content/docs/stacks/chainhook/guides/register-chainhooks-on-devnet.mdx
index f9ccf335f..073f37802 100644
--- a/content/docs/stacks/chainhook/guides/register-chainhooks-on-devnet.mdx
+++ b/content/docs/stacks/chainhook/guides/register-chainhooks-on-devnet.mdx
@@ -40,24 +40,28 @@ For examples on how to define your predicates, refer to the [scopes](/stacks/cha
## Start devnet
-To start devnet, run the `clarinet devnet start` command from the root of your project directory. Running this command will begin a local Chainhook service in the background that automatically registers your Chainhook files within the project directory against the network.
+To start devnet, run the _`clarinet devnet start`_ command from the root of your project directory. Running this command will begin a local Chainhook service in the background that automatically registers your Chainhook files within the project directory against the network.
## Confirm registration
Once your devnet starts, the Chainhook service initiates the registration process. You'll know that the registration of your Chainhooks was successful by checking the confirmation message in your terminal:
-```console
+```terminal
+$ clarinet devnet start
+# ...
INFO Feb 5 15:20:07.233382 2 chainhooks registered
```
-If you do not see this message at the top of your `clarinet devnet start` logs, verify that you are using `clarinet` version 2.1.0 or higher.
+If you do not see this message at the top of your _`clarinet devnet start`_ logs, verify that you are using `clarinet` version 2.1.0 or higher.
## Working with chainhooks
-With these steps completed, your chainhooks are ready to trigger whenever local contract actions occur. You can monitor your network activity locally, through the `clarinet devnet start` terminal, to confirm chainhooks execution as you further develop and test your smart contracts. When an action occurs, you should see something like this:
+With these steps completed, your chainhooks are ready to trigger whenever local contract actions occur. You can monitor your network activity locally, through the _`clarinet devnet start` terminal, to confirm chainhooks execution as you further develop and test your smart contracts. When an action occurs, you should see something like this:
-```console
+```terminal
+$ clarinet devnet start
+# ...
INFO Feb 5 15:21:07.233382 1 hooks triggered
```
-At this point, you can verify the payload for that action depending on whether you are expecting an `http_post` or `file_append` result from your `then_that` configuration.
+At this point, you can verify the payload for that action depending on whether you are expecting an _json`http_post`_ or _json`file_append`_ result from your _json`then_that`_ configuration.
diff --git a/content/docs/stacks/chainhook/index.mdx b/content/docs/stacks/chainhook/index.mdx
index 356e80e1c..57c881bee 100644
--- a/content/docs/stacks/chainhook/index.mdx
+++ b/content/docs/stacks/chainhook/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: Chainhook enables you to target events on the Bitcoin and Stacks blockchain important to your use case in order to trigger actions based on those events.
-toc: false
---
import { SecondaryCard } from '@/components/card';
diff --git a/content/docs/stacks/chainhook/installation.mdx b/content/docs/stacks/chainhook/installation.mdx
index 91024f2c1..df6870beb 100644
--- a/content/docs/stacks/chainhook/installation.mdx
+++ b/content/docs/stacks/chainhook/installation.mdx
@@ -6,34 +6,34 @@ toc: false
- ```console title="Terminal"
- brew install chainhook
+ ```terminal
+ $ brew install chainhook
```
- ```console title="Terminal"
- sudo snap install chainhook
+ ```terminal
+ $ sudo snap install chainhook
```
- ```console title="PowerShell"
- winget install HiroSystems.Chainhook
+ ```terminal
+ $ winget install HiroSystems.Chainhook
```
Clone the [Chainhook Repo](https://github.com/hirosystems/chainhook):
- ```console title="Terminal"
- git clone https://github.com/hirosystems/chainhook.git
+ ```terminal
+ $ git clone https://github.com/hirosystems/chainhook.git
```
Navigate to the root directory and run `cargo chainhook-install`:
- ```console title="Terminal"
- cd chainhook && cargo chainhook-install
+ ```terminal
+ $ cd chainhook && cargo chainhook-install
```
diff --git a/content/docs/stacks/chainhook/meta.json b/content/docs/stacks/chainhook/meta.json
index d4936f3fe..1a0ce2b79 100644
--- a/content/docs/stacks/chainhook/meta.json
+++ b/content/docs/stacks/chainhook/meta.json
@@ -8,11 +8,6 @@
"quickstart",
"---Concepts---",
"concepts/predicate-design",
- "concepts/general-configration",
- "concepts/if-this-specification",
- "concepts/then-that-specification",
- "concepts/stacks-predicate-configurations",
- "concepts/bitcoin-predicate-configurations",
"---Guides---",
"guides/register-chainhooks-on-devnet",
"guides/chainhook-as-a-service",
diff --git a/content/docs/stacks/chainhook/quickstart.mdx b/content/docs/stacks/chainhook/quickstart.mdx
index 377da1adc..11b392059 100644
--- a/content/docs/stacks/chainhook/quickstart.mdx
+++ b/content/docs/stacks/chainhook/quickstart.mdx
@@ -16,8 +16,8 @@ Check out the [run Chainhook as a service](/stacks/chainhook/guides/chainhook-as
To generate a predicate file, use the `predicates new` command. This command generates a template that you can use to help set up your own predicate.
- ```console title="Terminal"
- chainhook predicates new stx-transfer.json --stacks
+ ```terminal
+ $ chainhook predicates new stx-transfer.json --stacks
```
@@ -32,7 +32,6 @@ Check out the [run Chainhook as a service](/stacks/chainhook/guides/chainhook-as
To do this, update your `if_this` construct in your `stx-transfer.json` file.
```json title="stx-transfer.json"
- // [!code word:stx_event]
{
"if_this": {
"scope": "stx_event",
@@ -78,8 +77,8 @@ Check out the [run Chainhook as a service](/stacks/chainhook/guides/chainhook-as
With your updated predicate file, you can now use the `predicate scan` command to scan for `stx_event` transactions.
- ```console title="Terminal"
- chainhook predicates scan /path/to/stx-transfer.json --mainnet
+ ```terminal
+ $ chainhook predicates scan /path/to/stx-transfer.json --mainnet
```
diff --git a/content/docs/stacks/chainhook/references/scopes/bitcoin.mdx b/content/docs/stacks/chainhook/references/scopes/bitcoin.mdx
index ae2cff059..3130e23cf 100644
--- a/content/docs/stacks/chainhook/references/scopes/bitcoin.mdx
+++ b/content/docs/stacks/chainhook/references/scopes/bitcoin.mdx
@@ -5,7 +5,7 @@ toc: false
---
import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
+import { Property } from 'fumadocs-openapi/ui'
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Badge } from '@/components/ui/badge';
@@ -51,11 +51,10 @@ The `equals` property is a 32 byte hex encoded type used to specify the exact tr
```json
- // [!code word:txid]
{
"if_this": {
"scope": "txid",
- "equals": "0xfaaac1833dc4883e7ec28f61e35b41f896c395f8d288b1a177155de2abd6052f" // [!code highlight]
+ "equals": "0xfaaac1833dc4883e7ec28f61e35b41f896c395f8d288b1a177155de2abd6052f"
}
}
```
@@ -110,12 +109,11 @@ The `operation` property is used to identify the Bitcoin operation that will tri
```json
- // [!code word:outputs]
{
"if_this": {
"scope": "outputs",
- "op_return": { // [!code highlight]
- "equals": "0xbtc21000042stx016" // [!code highlight]
+ "op_return": {
+ "equals": "0xbtc21000042stx016"
}
}
}
@@ -140,12 +138,11 @@ The `operation` property is used to identify the Bitcoin operation that will tri
```json
- // [!code word:outputs]
{
"if_this": {
"scope": "outputs",
- "p2kph": { // [!code highlight]
- "equals": "0xbtc21000042stx016" // [!code highlight]
+ "p2kph": {
+ "equals": "0xbtc21000042stx016"
}
}
}
@@ -164,12 +161,11 @@ The `operation` property is used to identify the Bitcoin operation that will tri
```json
- // [!code word:outputs]
{
"if_this": {
"scope": "outputs",
- "p2sh": { // [!code highlight]
- "equals": "0xbtc21000042stx016" // [!code highlight]
+ "p2sh": {
+ "equals": "0xbtc21000042stx016"
}
}
}
@@ -188,12 +184,11 @@ The `operation` property is used to identify the Bitcoin operation that will tri
```json
- // [!code word:outputs]
{
"if_this": {
"scope": "outputs",
- "p2wpkh": { // [!code highlight]
- "equals": "0xbtc21000042stx016" // [!code highlight]
+ "p2wpkh": {
+ "equals": "0xbtc21000042stx016"
}
}
}
@@ -212,12 +207,11 @@ The `operation` property is used to identify the Bitcoin operation that will tri
```json
- // [!code word:outputs]
{
"if_this": {
"scope": "outputs",
- "p2wsh": { // [!code highlight]
- "equals": "0xbtc21000042stx016" // [!code highlight]
+ "p2wsh": {
+ "equals": "0xbtc21000042stx016"
}
}
}
@@ -236,13 +230,12 @@ The `operation` property is used to identify the Bitcoin operation that will tri
```json
- // [!code word:outputs]
{
"if_this": {
"scope": "outputs",
"descriptor": {
- "expression": "wpkh(tprv8ZgxMBicQKsPePxn6j3TjvB2MBzQkuhGgc6oRh2WZancZQgxktcnjZJ44XdsRiw3jNkbVTK9JW6KFHvnRKgAMtSyuBevMJprSkZ4PTfmTgV/84'/1'/0'/0/*)", // [!code highlight]
- "range": [0, 3] // [!code highlight]
+ "expression": "wpkh(tprv8ZgxMBicQKsPePxn6j3TjvB2MBzQkuhGgc6oRh2WZancZQgxktcnjZJ44XdsRiw3jNkbVTK9JW6KFHvnRKgAMtSyuBevMJprSkZ4PTfmTgV/84'/1'/0'/0/*)",
+ "range": [0, 3]
}
}
}
@@ -325,11 +318,10 @@ The `operation` property is used to identify the Stacks operation that will trig
```json
- // [!code word:stacks_protocol]
{
"if_this": {
"scope": "stacks_protocol",
- "operation": "block_committed" // [!code highlight]
+ "operation": "block_committed"
}
}
```
@@ -337,11 +329,10 @@ The `operation` property is used to identify the Stacks operation that will trig
```json
- // [!code word:stacks_protocol]
{
"if_this": {
"scope": "stacks_protocol",
- "operation": "leader_registered" // [!code highlight]
+ "operation": "leader_registered"
}
}
```
@@ -349,11 +340,10 @@ The `operation` property is used to identify the Stacks operation that will trig
```json
- // [!code word:stacks_protocol]
{
"if_this": {
"scope": "stacks_protocol",
- "operation": "inscription_feed" // [!code highlight]
+ "operation": "inscription_feed"
}
}
```
@@ -365,11 +355,10 @@ The `operation` property is used to identify the Stacks operation that will trig
```json
- // [!code word:stacks_protocol]
{
"if_this": {
"scope": "stacks_protocol",
- "operation": "stx_transferred" // [!code highlight]
+ "operation": "stx_transferred"
}
}
```
@@ -377,11 +366,10 @@ The `operation` property is used to identify the Stacks operation that will trig
```json
- // [!code word:stacks_protocol]
{
"if_this": {
"scope": "stacks_protocol",
- "operation": "stx_locked" // [!code highlight]
+ "operation": "stx_locked"
}
}
```
diff --git a/content/docs/stacks/chainhook/references/scopes/stacks.mdx b/content/docs/stacks/chainhook/references/scopes/stacks.mdx
index f74b6a561..d130f1172 100644
--- a/content/docs/stacks/chainhook/references/scopes/stacks.mdx
+++ b/content/docs/stacks/chainhook/references/scopes/stacks.mdx
@@ -5,7 +5,7 @@ toc: false
---
import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
+import { Property } from 'fumadocs-openapi/ui'
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Badge } from '@/components/ui/badge';
@@ -44,11 +44,10 @@ The `equals` property is a 32 bytes hex encoded type used to specify the exact t
```json
- // [!code word:txid]
{
"if_this": {
"scope": "txid",
- "equals": "0xfaaac1833dc4883e7ec28f61e35b41f896c395f8d288b1a177155de2abd6052f" // [!code highlight]
+ "equals": "0xfaaac1833dc4883e7ec28f61e35b41f896c395f8d288b1a177155de2abd6052f"
}
}
```
@@ -114,44 +113,40 @@ The `between` property specifies a range of block heights to match, inclusive of
```json
- // [!code word:block_height]
{
"if_this": {
"scope": "block_height",
- "equals": 141200 // [!code highlight]
+ "equals": 141200
}
}
```
```json
- // [!code word:block_height]
{
"if_this": {
"scope": "block_height",
- "higher_than": 10000 // [!code highlight]
+ "higher_than": 10000
}
}
```
```json
- // [!code word:block_height]
{
"if_this": {
"scope": "block_height",
- "lower_than": 10000 // [!code highlight]
+ "lower_than": 10000
}
}
```
```json
- // [!code word:block_height]
{
"if_this": {
"scope": "block_height",
- "between": [0, 10000] // [!code highlight]
+ "between": [0, 10000]
}
}
```
@@ -199,24 +194,22 @@ The `actions` property specifies the types of token actions to observe, such as
```json
- // [!code word:ft_transfer]
{
"if_this": {
"scope": "ft_transfer",
"asset_identifier": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.cbtc-token::cbtc",
- "actions": ["transfer"] // [!code highlight]
+ "actions": ["transfer"]
}
}
```
- // [!code word:ft_transfer]
```json
{
"if_this": {
"scope": "ft_transfer",
"asset_identifier": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.cbtc-token::cbtc",
- "actions": ["mint", "transfer", "burn"] // [!code highlight]
+ "actions": ["mint", "transfer", "burn"]
}
}
```
@@ -264,24 +257,22 @@ The `actions` property specifies the types of NFT actions to observe, such as `m
```json
- // [!code word:nft_transfer]
{
"if_this": {
"scope": "nft_transfer",
"asset_identifier": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.monkey-sip09::monkeys",
- "actions": ["mint"] // [!code highlight]
+ "actions": ["mint"]
}
}
```
```json
- // [!code word:nft_transfer]
{
"if_this": {
"scope": "nft_transfer",
"asset_identifier": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.monkey-sip09::monkeys",
- "actions": ["mint", "transfer", "burn"] // [!code highlight]
+ "actions": ["mint", "transfer", "burn"]
}
}
```
@@ -323,22 +314,20 @@ The `actions` property specifies the types of STX token actions to observe, such
```json
- // [!code word:stx_transfer]
{
"if_this": {
"scope": "stx_transfer",
- "actions": ["transfer"] // [!code highlight]
+ "actions": ["transfer"]
}
}
```
```json
- // [!code word:stx_transfer]
{
"if_this": {
"scope": "stx_transfer",
- "actions": ["mint", "transfer", "burn", "lock"] // [!code highlight]
+ "actions": ["mint", "transfer", "burn", "lock"]
}
}
```
@@ -392,24 +381,22 @@ The `matches_regex` property is used for matching an event that regex matches wi
```json
- // [!code word:print_event]
{
"if_this": {
"scope": "print_event",
"contract_identifier": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.monkey-sip09",
- "contains": "monkey" // [!code highlight]
+ "contains": "monkey"
}
}
```
```json
- // [!code word:print_event]
{
"if_this": {
"scope": "print_event",
"contract_identifier": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.monkey-sip09",
- "matches_regex": "(?:^|\\W)monkey(?:$|\\W)" // [!code highlight]
+ "matches_regex": "(?:^|\\W)monkey(?:$|\\W)"
}
}
```
@@ -454,12 +441,11 @@ The `method` property specifies the specific method within the contract to obser
```json
- // [!code word:contract_call]
{
"if_this": {
"scope": "contract_call",
"contract_identifier": "SP000000000000000000002Q6VF78.pox",
- "method": "stack-stx" // [!code highlight]
+ "method": "stack-stx"
}
}
```
@@ -507,22 +493,20 @@ The `implement_trait` property specifies the contract trait to observe.
```json
- // [!code word:contract_deployment]
{
"if_this": {
"scope": "contract_deployment",
- "deployer": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM" // [!code highlight]
+ "deployer": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM"
}
}
```
```json
- // [!code word:contract_deployment]
{
"if_this": {
"scope": "contract_deployment",
- "implement_trait": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.sip09-protocol" // [!code highlight]
+ "implement_trait": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.sip09-protocol"
}
}
```
diff --git a/content/docs/stacks/clarinet-js-sdk/guides/integration-testing.mdx b/content/docs/stacks/clarinet-js-sdk/guides/integration-testing.mdx
index 5eda158c6..95bf87afd 100644
--- a/content/docs/stacks/clarinet-js-sdk/guides/integration-testing.mdx
+++ b/content/docs/stacks/clarinet-js-sdk/guides/integration-testing.mdx
@@ -19,21 +19,21 @@ In this guide, you will:
Start by creating a new Clarinet project. This command will create a new directory named `defi` and set up a basic Clarinet project inside it.
-```console title="Terminal"
-clarinet new stx-defi
-cd stx-defi
+```terminal
+$ clarinet new stx-defi
+$ cd stx-defi
```
After changing into your project directory, run `npm install` to install the package dependencies for testing.
-```console title="Terminal"
-npm install
+```terminal
+$ npm install
```
We are going to use the same `defi` contract that we used in the [unit testing guide](/stacks/clarinet-js-sdk/guides/unit-testing), but with some additional functionality - the ability to `borrow` STX from the contract. If you don't have this project set up already, follow the steps below:
-```console title="Terminal"
-clarinet contract new defi
+```terminal
+$ clarinet contract new defi
```
Then, inside your `defi.clar` file, copy and paste the following contract code:
@@ -206,14 +206,14 @@ These custom matchers and simnet methods are powerful tools and allow you to sim
To run your tests, use:
-```console title="Terminal"
-npm run test
+```terminal
+$ npm run test
```
To generate a coverage report, use:
-```console title="Terminal"
-npm run coverage
+```terminal
+$ npm run coverage
```
This will run your tests and produce a detailed coverage report, helping you identify any untested parts of your contract.
diff --git a/content/docs/stacks/clarinet-js-sdk/guides/migrate-to-the-clarinet-sdk.mdx b/content/docs/stacks/clarinet-js-sdk/guides/migrate-to-the-clarinet-sdk.mdx
index 506021004..73562daac 100644
--- a/content/docs/stacks/clarinet-js-sdk/guides/migrate-to-the-clarinet-sdk.mdx
+++ b/content/docs/stacks/clarinet-js-sdk/guides/migrate-to-the-clarinet-sdk.mdx
@@ -18,8 +18,8 @@ This guide is for projects that have been created with Clarinet v1 and do not ha
Inside your Clarinet v1 project, run the following command to initialise NPM and Vitest. It will also create a sample test file.
-```console title="Terminal"
-npx @hirosystems/clarinet-sdk@latest
+```terminal
+$ npx @hirosystems/clarinet-sdk@latest
```
Follow the prompts to initialise NPM and Vitest, this can take a few seconds.
@@ -33,7 +33,7 @@ It can safely be deleted.
## Unit test for counter example
-```ts title="tests/counter.test.ts"
+```ts tests/counter.test.ts
import { Cl } from '@stacks/transactions';
import { describe, expect, it } from 'vitest';
@@ -71,8 +71,8 @@ describe('test `increment` public function', () => {
To run the test, go back to your console and run the `test` command using your preferred package manager. It should display a report telling you that tests succeeded.
-```console title="Terminal"
-npm test
+```terminal
+$ npm test
```
diff --git a/content/docs/stacks/clarinet-js-sdk/guides/unit-testing.mdx b/content/docs/stacks/clarinet-js-sdk/guides/unit-testing.mdx
index 6fa211cd1..ac6298787 100644
--- a/content/docs/stacks/clarinet-js-sdk/guides/unit-testing.mdx
+++ b/content/docs/stacks/clarinet-js-sdk/guides/unit-testing.mdx
@@ -19,21 +19,21 @@ In this guide, you will:
Start by creating a new project with the Clarinet CLI. The command below will create a project structure inside of `defi` with the necessary files and folders, including the Clarinet JS SDK already set up for testing.
-```console title="Terminal"
-clarinet new stx-defi
-cd stx-defi
+```terminal
+$ clarinet new stx-defi
+$ cd stx-defi
```
After changing into your project directory, run `npm install` to install the package dependencies for testing.
-```console title="Terminal"
-npm install
+```terminal
+$ npm install
```
Since the smart contract code is out of scope for this guide, we are going to use a pre-existing contract. First, generate a new file using the `clarinet contract new` command in order to set up your project with the necessary configuration and test files.
-```console title="Terminal"
-clarinet contract new defi
+```terminal
+$ clarinet contract new defi
```
Now, inside your `defi.clar` file, copy and paste the following contract code:
@@ -198,14 +198,14 @@ By following these steps, our test comprehensively verifies that the `deposit` f
To run your tests, use:
-```console title="Terminal"
-npm run test
+```terminal
+$ npm run test
```
To generate a coverage report, use:
-```console title="Terminal"
-npm run coverage
+```terminal
+$ npm run coverage
```
This will run your tests and produce a detailed coverage report, helping you identify any untested parts of your contract.
diff --git a/content/docs/stacks/clarinet-js-sdk/index.mdx b/content/docs/stacks/clarinet-js-sdk/index.mdx
index 2bccd75b6..3a946a3fa 100644
--- a/content/docs/stacks/clarinet-js-sdk/index.mdx
+++ b/content/docs/stacks/clarinet-js-sdk/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: The Clarinet JS SDK is a JavaScript library used to write unit tests for Clarity smart contracts.
-toc: false
---
import { SecondaryCard } from '@/components/card';
diff --git a/content/docs/stacks/clarinet-js-sdk/quickstart.mdx b/content/docs/stacks/clarinet-js-sdk/quickstart.mdx
index 7fa743370..452ec8196 100644
--- a/content/docs/stacks/clarinet-js-sdk/quickstart.mdx
+++ b/content/docs/stacks/clarinet-js-sdk/quickstart.mdx
@@ -37,7 +37,7 @@ Check out the [methods](/stacks/clarinet-js-sdk/references/methods) page for the
```ts title="counter.test.ts"
import { describe, expect, it } from "vitest";
- import { Cl } from "@stacks/transactions"; // [!code highlight]
+ import { Cl } from "@stacks/transactions";
```
The `Cl` namespace simplifies the process of creating and handling Clarity values. This functionality is particularly useful in testing environments where developers need to simulate contract interactions accurately.
@@ -48,8 +48,7 @@ Check out the [methods](/stacks/clarinet-js-sdk/references/methods) page for the
For most test cases, you'll want to retrieve an account from the network in order to interact with your smart contracts. The following code uses the `getAccounts` method to achieve this.
- ```ts title="counter.test.ts"
- // [!code word:getAccounts]
+ ```ts counter.test.ts
import { describe, expect, it } from "vitest";
import { Cl } from "@stacks/transactions";
@@ -72,10 +71,10 @@ Check out the [methods](/stacks/clarinet-js-sdk/references/methods) page for the
Now that you understand the key components for writing tests, start by writing a test that ensures the `counter` contract has been deployed.
- ```ts title="counter.test.ts"
+ ```ts counter.test.ts
describe("counter contract", () => {
it("ensures the contract is deployed", () => {
- const contractSource = simnet.getContractSource("counter"); // [!code highlight]
+ const contractSource = simnet.getContractSource("counter");
expect(contractSource).toBeDefined();
});
});
@@ -86,11 +85,11 @@ Check out the [methods](/stacks/clarinet-js-sdk/references/methods) page for the
Now it's time to call a public function and assert the result. The count-up function is expected to increment the count of the user's principal by 1. Write a test to ensure this behaves as expected.
- ```ts title="counter.test.ts"
+ ```ts counter.test.ts
describe("counter contract", () => {
it("increments the count of the user's principal by 1", () => {
const countUpCall = simnet.callPublicFn("counter", "count-up", [], wallet);
- expect(countUpCall.result).toBeOk(Cl.bool(true)); // [!code highlight]
+ expect(countUpCall.result).toBeOk(Cl.bool(true));
const getCountCall = simnet.callReadOnlyFn(
"counter",
@@ -98,7 +97,7 @@ Check out the [methods](/stacks/clarinet-js-sdk/references/methods) page for the
[Cl.principal(wallet)],
wallet
);
- expect(getCountCall.result).toBeUint(1); // [!code highlight]
+ expect(getCountCall.result).toBeUint(1);
});
});
```
@@ -114,9 +113,9 @@ Check out the [methods](/stacks/clarinet-js-sdk/references/methods) page for the
Every generated project comes with a package.json file that contains the necessary dependencies and scripts to run your tests.
- ```json title="package.json"
+ ```json package.json
"scripts": {
- "test": "vitest run", // [!code highlight]
+ "test": "vitest run",
"test:report": "vitest run -- --coverage --costs",
"test:watch": "chokidar \"tests/**/*.ts\" \"contracts/**/*.clar\" -c \"npm run test:report\""
}
@@ -124,8 +123,8 @@ Check out the [methods](/stacks/clarinet-js-sdk/references/methods) page for the
You can now run your tests, with your preferred package manager, by executing the following command:
- ```console
- npm run test
+ ```terminal
+ $ npm run test
```
@@ -133,10 +132,10 @@ Check out the [methods](/stacks/clarinet-js-sdk/references/methods) page for the
Clarinet can automatically also produce a code coverage report and cost analysis on the test you ran.
- ```json title="package.json"
+ ```json package.json
"scripts": {
"test": "vitest run",
- "test:report": "vitest run -- --coverage --costs", // [!code highlight]
+ "test:report": "vitest run -- --coverage --costs",
"test:watch": "chokidar \"tests/**/*.ts\" \"contracts/**/*.clar\" -c \"npm run test:report\""
}
```
@@ -162,7 +161,7 @@ Check out the [methods](/stacks/clarinet-js-sdk/references/methods) page for the
The `costs-reports.json` file will output the cost analysis for every function ran in your tests. Since the `count-up` function was used in our test, this is how the cost analysis output would look like for that function:
- ```json title="costs-reports.json"
+ ```json costs-reports.json
{
"test_name": "tests/counter.test.ts__counter contract__increments the count of the user's principal by 1",
"contract_id": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.counter",
@@ -191,14 +190,14 @@ Check out the [methods](/stacks/clarinet-js-sdk/references/methods) page for the
To access and read the `lcov.info` file in a human-readable format, we can first install the `lcov` [package](https://github.com/linux-test-project/lcov) that helps generate a graphical front-end for coverage testing tools.
- ```console title="Terminal"
- brew install lcov
+ ```terminal
+ $ brew install lcov
```
Then we'll run the `genhtml` command below with the following options. This command and its options will generate the actual html file, add in additional branch coverage, and will automatically store the files in a new folder called `coverage`.
- ```console title="Terminal"
- genhtml lcov.info --branch-coverage -o coverage
+ ```terminal
+ $ genhtml lcov.info --branch-coverage -o coverage
```
You can then navigate into the new `coverage` folder and run the command `open index.html` to view your coverage report. In addition, a summary of the coverage report will be outputted in the terminal.
diff --git a/content/docs/stacks/clarinet-js-sdk/references/custom-matchers.mdx b/content/docs/stacks/clarinet-js-sdk/references/custom-matchers.mdx
index daf45832c..5eeb90948 100644
--- a/content/docs/stacks/clarinet-js-sdk/references/custom-matchers.mdx
+++ b/content/docs/stacks/clarinet-js-sdk/references/custom-matchers.mdx
@@ -4,28 +4,18 @@ description: A set of Vitest matchers that can be used to make assertions on Cla
toc: false
---
-import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
-
-import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Badge } from '@/components/ui/badge';
-
-import { InlineCode } from '@/components/inline-code';
-
-## Installation
-
-```console
-npx @hirosystems/clarinet-sdk
-```
+import { Root, API, APIExample, Property, Info } from '@/components/layout';
+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
-
+
-
+
-
`toHaveClarityType`
+# `toHaveClarityType`
Check that a value has the right Clarity type, without checking its value.
@@ -37,7 +27,7 @@ The Clarity type that the expected value should have.
-
+
@@ -48,9 +38,7 @@ The Clarity type that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toHaveClarityType]
+ ```ts
const { result } = simnet.callPublicFn(
'counter',
'increment',
@@ -63,14 +51,13 @@ The Clarity type that the expected value should have.
- ```clarity title="counter.clar"
- // [!code word:increment]
+ ```clarity counter.clar
(define-data-var count uint u0)
(define-public (increment)
(begin
(var-set count (+ (var-get count) u1))
- (ok (var-get count)) // [!code highlight]
+ (ok (var-get count))
)
)
```
@@ -88,11 +75,11 @@ The Clarity type that the expected value should have.
-
+
-
+
-
`toBeOk`
+# `toBeOk`
Check that a response is `(ok )` and has the expected value. Any Clarity value can be passed.
@@ -104,7 +91,7 @@ The `ClarityValue` that the expected value should have.
-
+
@@ -115,9 +102,7 @@ The `ClarityValue` that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeOk]
+ ```ts
const { result } = simnet.callPublicFn(
'counter',
'increment',
@@ -130,14 +115,13 @@ The `ClarityValue` that the expected value should have.
- ```clarity title="counter.clar"
- // [!code word:increment]
+ ```clarity counter.clar
(define-data-var count uint u0)
(define-public (increment)
(begin
(var-set count (+ (var-get count) u1))
- (ok (var-get count)) // [!code highlight]
+ (ok (var-get count))
)
)
```
@@ -155,11 +139,11 @@ The `ClarityValue` that the expected value should have.
-
+
-
+
-
`toBeErr`
+# `toBeErr`
Check that a response is `(err )` and has the expected value. Any Clarity value can be passed.
@@ -171,7 +155,7 @@ The `ClarityValue` that the expected value should have.
-
+
@@ -182,9 +166,7 @@ The `ClarityValue` that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeErr]
+ ```ts
const { result } = simnet.callPublicFn(
'counter',
'add',
@@ -197,8 +179,7 @@ The `ClarityValue` that the expected value should have.
- ```clarity title="counter.clar"
- // [!code word:add]
+ ```clarity counter.clar
(define-constant TOO_BIG u10)
(define-data-var count uint u0)
@@ -210,7 +191,7 @@ The `ClarityValue` that the expected value should have.
(var-set count new-count)
(ok (var-get count))
)
- (err u500) // [!code highlight]
+ (err u500)
)
)
)
@@ -230,11 +211,11 @@ The `ClarityValue` that the expected value should have.
-
+
-
+
-
`toBeSome`
+# `toBeSome`
Check that a response is `(some )` and has the expected value. Any Clarity value can be passed.
@@ -246,7 +227,7 @@ The `ClarityValue` that the expected value should have.
-
+
@@ -257,9 +238,7 @@ The `ClarityValue` that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeSome]
+ ```ts
const { result } = simnet.callReadOnlyFn(
'pool',
'get-participant',
@@ -272,8 +251,7 @@ The `ClarityValue` that the expected value should have.
- ```clarity title="pool.clar"
- // [!code word:get-participant]
+ ```clarity pool.clar
(define-map Participants principal bool)
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
@@ -281,8 +259,8 @@ The `ClarityValue` that the expected value should have.
(map-get? ParticipantStatus who)
)
- (map-set Participants 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5 true) // [!code highlight]
- (map-set ParticipantStatus 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5 { enrollmentBlock: u1, contributionAmount: u19000000 }) // [!code highlight]
+ (map-set Participants 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5 true)
+ (map-set ParticipantStatus 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5 { enrollmentBlock: u1, contributionAmount: u19000000 })
```
@@ -298,15 +276,15 @@ The `ClarityValue` that the expected value should have.
-
+
-
+
-
`toBeNone`
+# `toBeNone`
Check that a response is `(none)`.
-
+
@@ -317,9 +295,7 @@ Check that a response is `(none)`.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeNone]
+ ```ts
const { result } = simnet.callReadOnlyFn(
'pool',
'get-participant',
@@ -332,8 +308,7 @@ Check that a response is `(none)`.
- ```clarity title="pool.clar"
- // [!code word:get-participant]
+ ```clarity pool.clar
(define-map Participants principal bool)
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
@@ -355,11 +330,11 @@ Check that a response is `(none)`.
-
+
-
+
-
`toBeBool`
+# `toBeBool`
Asserts the value of Clarity boolean (`true` or `false`).
@@ -371,7 +346,7 @@ The `boolean` that the expected value should have.
-
+
@@ -382,9 +357,7 @@ The `boolean` that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeBool]
+ ```ts
const { result } = simnet.callReadOnlyFn(
'pool',
'has-contributed',
@@ -397,15 +370,14 @@ The `boolean` that the expected value should have.
- ```clarity title="pool.clar"
- // [!code word:has-contributed]
+ ```clarity pool.clar
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
(define-read-only (has-contributed (who principal))
(is-some (get contributionAmount (map-get? ParticipantStatus who)))
)
- (map-set ParticipantStatus tx-sender { enrollmentBlock: u1, contributionAmount: u19000000 }) // [!code highlight]
+ (map-set ParticipantStatus tx-sender { enrollmentBlock: u1, contributionAmount: u19000000 })
```
@@ -421,11 +393,10 @@ The `boolean` that the expected value should have.
-
-
-
+
-
`toBeInt`
+
+# `toBeInt`
Asserts the value of a Clarity integer.
@@ -437,7 +408,7 @@ The `integer` that the expected value should have.
-
+
@@ -448,9 +419,7 @@ The `integer` that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeInt]
+ ```ts
const { result } = simnet.callReadOnlyFn(
'counter',
'increment',
@@ -463,14 +432,13 @@ The `integer` that the expected value should have.
- ```clarity title="counter.clar"
- // [!code word:increment]
+ ```clarity counter.clar
(define-data-var count int 0)
(define-public (increment)
(begin
(var-set count (+ (var-get count) 1))
- (ok (var-get count)) // [!code highlight]
+ (ok (var-get count))
)
)
```
@@ -488,11 +456,11 @@ The `integer` that the expected value should have.
-
+
-
+
-
`toBeUint`
+# `toBeUint`
Asserts the value of a Clarity unsigned integer.
@@ -504,7 +472,7 @@ The `unsigned integer` that the expected value should have.
-
+
@@ -515,9 +483,7 @@ The `unsigned integer` that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeUint]
+ ```ts
const { result } = simnet.callReadOnlyFn(
'counter',
'increment',
@@ -530,14 +496,13 @@ The `unsigned integer` that the expected value should have.
- ```clarity title="counter.clar"
- // [!code word:increment]
+ ```clarity counter.clar
(define-data-var count uint u0)
(define-public (increment)
(begin
(var-set count (+ (var-get count) u1))
- (ok (var-get count)) // [!code highlight]
+ (ok (var-get count))
)
)
```
@@ -555,11 +520,11 @@ The `unsigned integer` that the expected value should have.
-
+
-
+
-
`toBeAscii`
+# `toBeAscii`
Asserts the value of a Clarity string-ascii.
@@ -571,7 +536,7 @@ The `string` that the expected value should have.
-
+
@@ -582,9 +547,7 @@ The `string` that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeAscii]
+ ```ts
const { result } = simnet.callReadOnlyFn(
'hello-world',
'say-hi',
@@ -597,10 +560,9 @@ The `string` that the expected value should have.
- ```clarity title="hello-world.clar"
- // [!code word:say-hi]
+ ```clarity hello-world.clar
(define-read-only (say-hi)
- "Hello World" // [!code highlight]
+ "Hello World"
)
```
@@ -617,11 +579,11 @@ The `string` that the expected value should have.
-
+
-
+
-
`toBeUtf8`
+# `toBeUtf8`
Asserts the value of a Clarity string-utf8.
@@ -633,7 +595,7 @@ The `string` that the expected value should have.
-
+
@@ -644,9 +606,7 @@ The `string` that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeUtf8]
+ ```ts
const { result } = simnet.callReadOnlyFn(
'hello-world',
'say-hi',
@@ -659,10 +619,9 @@ The `string` that the expected value should have.
- ```clarity title="hello-world.clar"
- // [!code word:say-hi]
+ ```clarity hello-world.clar
(define-read-only (say-hi)
- u"Hello World" // [!code highlight]
+ u"Hello World"
)
```
@@ -679,11 +638,11 @@ The `string` that the expected value should have.
-
+
-
+
-
`toBePrincipal`
+# `toBePrincipal`
Asserts the value of a Clarity principal.
@@ -697,7 +656,7 @@ The `string` that the expected value should have.
-
+
@@ -711,9 +670,7 @@ The `string` that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBePrincipal]
+ ```ts
const deployer = simnet.deployer;
expect(Cl.standardPrincipal(deployer)).toBePrincipal(deployer);
@@ -728,10 +685,8 @@ The `string` that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBePrincipal]
- const contract = `${simnet.deployer}.hello-world`; // [!code highlight]
+ ```ts
+ const contract = `${simnet.deployer}.hello-world`;
expect(Cl.contractPrincipal(contract)).toBePrincipal(contract);
```
@@ -750,11 +705,11 @@ The `string` that the expected value should have.
-
+
-
+
-
`toBeBuff`
+# `toBeBuff`
Asserts the value of a Clarity buffer. It takes an ArrayBuffer as an input.
@@ -772,7 +727,7 @@ The `Uint8Array` buffer that the expected value should have.
-
+
@@ -789,9 +744,7 @@ The `Uint8Array` buffer that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeBuff]
+ ```ts
const { result } = simnet.callReadOnlyFn(
'helpers',
'get-byte-array',
@@ -805,12 +758,11 @@ The `Uint8Array` buffer that the expected value should have.
- ```clarity title="helpers.clar"
- // [!code word:get-byte-array]
+ ```clarity helpers.clar
(define-constant BUFFER 0x01020304)
(define-read-only (get-byte-array)
- BUFFER // [!code highlight]
+ BUFFER
)
```
@@ -822,11 +774,7 @@ The `Uint8Array` buffer that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeBuff]
- // [!code word:bufferFromAscii]
- // [!code word:bufferFromUtf8]
+ ```ts
import { Cl } from '@stacks/transactions';
const { result } = simnet.callReadOnlyFn(
@@ -843,12 +791,11 @@ The `Uint8Array` buffer that the expected value should have.
- ```clarity title="helpers.clar"
- // [!code word:get-btc-buffer]
+ ```clarity helpers.clar
(define-constant ASCII_BTC 0x627463)
(define-read-only (get-btc-buffer)
- ASCII_BTC // [!code highlight]
+ ASCII_BTC
)
```
@@ -860,10 +807,7 @@ The `Uint8Array` buffer that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeBuff]
- // [!code word:bufferFromHex]
+ ```ts
import { Cl } from '@stacks/transactions';
const { result } = simnet.callReadOnlyFn(
@@ -882,12 +826,11 @@ The `Uint8Array` buffer that the expected value should have.
- ```clarity title="helpers.clar"
- // [!code word:get-tx-hash]
+ ```clarity helpers.clar
(define-constant TX_HASH 0x73e951acd451060f13bdab7bd947136efd80511309a295e876a682ab8a423a7e)
(define-read-only (get-tx-hash)
- TX_HASH // [!code highlight]
+ TX_HASH
)
```
@@ -904,11 +847,11 @@ The `Uint8Array` buffer that the expected value should have.
-
+
-
+
-
`toBeList`
+# `toBeList`
Asserts the value of a Clarity list containing an array of Clarity values.
@@ -920,7 +863,7 @@ The `Uint8Array` buffer that the expected value should have.
-
+
@@ -931,9 +874,7 @@ The `Uint8Array` buffer that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBelist]
+ ```ts
import { Cl } from '@stacks/transactions';
const { result } = simnet.callReadOnlyFn(
@@ -954,8 +895,7 @@ The `Uint8Array` buffer that the expected value should have.
- ```clarity title="helpers.clar"
- // [!code word:get-addresses]
+ ```clarity helpers.clar
(define-read-only (get-addresses)
(list
'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
@@ -978,11 +918,11 @@ The `Uint8Array` buffer that the expected value should have.
-
+
-
+
-
`toBeTuple`
+# `toBeTuple`
Asserts the value of a Clarity tuple.
@@ -994,7 +934,7 @@ The `object` of Clarity values that the expected value should have.
-
+
@@ -1005,9 +945,7 @@ The `object` of Clarity values that the expected value should have.
- ```ts twoslash
- // @noErrors
- // [!code word:toBeTuple]
+ ```ts
import { Cl } from '@stacks/transactions';
const { result } = simnet.callReadOnlyFn(
@@ -1025,8 +963,7 @@ The `object` of Clarity values that the expected value should have.
- ```clarity title="pool.clar"
- // [!code word:get-participant-data]
+ ```clarity pool.clar
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
(define-read-only (get-participant (who principal))
@@ -1040,7 +977,7 @@ The `object` of Clarity values that the expected value should have.
}
)
- (map-set ParticipantStatus tx-sender { enrollmentBlock: u1, contributionAmount: u19000000 }) // [!code highlight]
+ (map-set ParticipantStatus tx-sender { enrollmentBlock: u1, contributionAmount: u19000000 })
```
@@ -1056,4 +993,4 @@ The `object` of Clarity values that the expected value should have.
-
+
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet-js-sdk/references/methods.mdx b/content/docs/stacks/clarinet-js-sdk/references/methods.mdx
index 715489499..061197a34 100644
--- a/content/docs/stacks/clarinet-js-sdk/references/methods.mdx
+++ b/content/docs/stacks/clarinet-js-sdk/references/methods.mdx
@@ -4,32 +4,20 @@ description: The Clarinet JS SDK provides several methods that can be used to in
toc: false
---
-import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
-
-import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Badge } from '@/components/ui/badge';
+import { Root, API, APIExample, Property, Info } from '@/components/layout';
+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
-import { InlineCode } from '@/components/inline-code';
-
-## Installation
-
-```package-install
-@hirosystems/clarinet-sdk @stacks/transactions
-```
-
-
-
-
+
-
+
-
`getAccounts`
+# `getAccounts`
Retrieve a list of all Stacks addresses configured within the project, including wallets, deployers, and faucets.
-
+
@@ -43,9 +31,7 @@ Retrieve a list of all Stacks addresses configured within the project, including
- ```ts twoslash
- // @noErrors
- // [!code word:getAccounts]
+ ```ts
const accounts = simnet.getAccounts();
```
@@ -67,18 +53,17 @@ Retrieve a list of all Stacks addresses configured within the project, including
```
- ```console
+ ```ts
getAccounts(): Map
```
- ```ts twoslash
- // @noErrors
+ ```ts
const accounts = simnet.getAccounts();
- const wallet = accounts.get('wallet_1')!; // [!code highlight]
+ const wallet = accounts.get('wallet_1')!;
```
@@ -88,7 +73,7 @@ Retrieve a list of all Stacks addresses configured within the project, including
```
- ```console
+ ```ts
getAccounts(): Map
```
@@ -100,15 +85,15 @@ Retrieve a list of all Stacks addresses configured within the project, including
-
+
-
+
-
`getAssetsMap`
+# `getAssetsMap`
Retrieve a list of asset balances associated with Stacks addresses, including fungible and non-fungible tokens.
-
+
@@ -117,23 +102,21 @@ Retrieve a list of asset balances associated with Stacks addresses, including fu
Getting STX account balances
-
- Filtering for a specific account
- Getting ft balancesGetting nft balances
+
+ Filtering for an account
+
- ```ts twoslash
- // @noErrors
- // [!code word:getAssetsMap]
+ ```ts
const assets = simnet.getAssetsMap();
- const stxBalances = assets.get('STX')!; // [!code highlight]
+ const stxBalances = assets.get('STX')!;
```
@@ -154,30 +137,7 @@ Retrieve a list of asset balances associated with Stacks addresses, including fu
```
- ```console
- getAssetsMap(): Map>
- ```
-
-
-
-
-
- ```ts twoslash
- // @noErrors
- const assets = simnet.getAssetsMap();
- const stxBalances = assets.get('STX')!;
-
- const deployerBalance = stxBalances.get('ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM')!; // [!code highlight]
- ```
-
-
-
```ts
- 100000000000000n
- ```
-
-
- ```console
getAssetsMap(): Map>
```
@@ -185,9 +145,7 @@ Retrieve a list of asset balances associated with Stacks addresses, including fu
- ```ts twoslash
- // @noErrors
- // [!code word:sbtc]
+ ```ts
const contractName = 'token';
const sourceCode = `
(define-fungible-token sbtc)
@@ -203,7 +161,7 @@ Retrieve a list of asset balances associated with Stacks addresses, including fu
const assets = simnet.getAssetsMap();
- const tokenBalance = assets.get('.token.sbtc')!; // [!code highlight]
+ const tokenBalance = assets.get('.token.sbtc')!;
```
@@ -215,7 +173,7 @@ Retrieve a list of asset balances associated with Stacks addresses, including fu
```
- ```console
+ ```ts
getAssetsMap(): Map>
```
@@ -223,9 +181,7 @@ Retrieve a list of asset balances associated with Stacks addresses, including fu
- ```ts twoslash
- // @noErrors
- // [!code word:ticket]
+ ```ts
const contractName = 'nft';
const sourceCode = `
(define-non-fungible-token ticket uint)
@@ -241,7 +197,7 @@ Retrieve a list of asset balances associated with Stacks addresses, including fu
const assets = simnet.getAssetsMap();
- const nftBalance = assets.get('.nft.ticket')!; // [!code highlight]
+ const nftBalance = assets.get('.nft.ticket')!;
```
@@ -253,7 +209,29 @@ Retrieve a list of asset balances associated with Stacks addresses, including fu
```
- ```console
+ ```ts
+ getAssetsMap(): Map>
+ ```
+
+
+
+
+
+ ```ts
+ const assets = simnet.getAssetsMap();
+ const stxBalances = assets.get('STX')!;
+
+ const deployerBalance = stxBalances.get('ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM')!;
+ ```
+
+
+
+ ```ts
+ 100000000000000n
+ ```
+
+
+ ```ts
getAssetsMap(): Map>
```
@@ -267,11 +245,11 @@ Retrieve a list of asset balances associated with Stacks addresses, including fu
-
+
-
+
-
`getDataVar`
+# `getDataVar`
Get the value of a `data-var` defined in a contract.
@@ -289,7 +267,7 @@ The name of the `data-var` for the contract.
Example: `count`
-
+
@@ -303,19 +281,17 @@ The name of the `data-var` for the contract.
- ```ts twoslash
- // @noErrors
- // [!code word:getDataVar]
+ ```ts
const currentCount = simnet.getDataVar('counter', 'count');
```
- ```clarity title="counter.clar"
- (define-data-var count uint u0) // [!code highlight]
+ ```clarity counter.clar
+ (define-data-var count uint u0)
(define-data-var contractOwner principal tx-sender)
- (var-set count (+ (var-get count) u1)) // [!code highlight]
+ (var-set count (+ (var-get count) u1))
(var-set contractOwner 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5)
```
@@ -328,7 +304,7 @@ The name of the `data-var` for the contract.
```
- ```console
+ ```ts
getDataVar(contract: string, dataVar: string): ClarityValue
```
@@ -336,24 +312,22 @@ The name of the `data-var` for the contract.
- ```ts twoslash
- // @noErrors
- // [!code word:cvToValue]
+ ```ts
import { cvToValue } from '@stacks/transactions';
const contractOwner = simnet.getDataVar("counter", "contractOwner");
- const response = cvToValue(contractOwner); // [!code highlight]
+ const response = cvToValue(contractOwner);
```
- ```clarity title="counter.clar"
+ ```clarity counter.clar
(define-data-var count uint u0)
- (define-data-var contractOwner principal tx-sender) // [!code highlight]
+ (define-data-var contractOwner principal tx-sender)
(var-set count (+ (var-get count) u1))
- (var-set contractOwner 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5) // [!code highlight]
+ (var-set contractOwner 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5)
```
@@ -362,7 +336,7 @@ The name of the `data-var` for the contract.
```
- ```console
+ ```ts
getDataVar(contract: string, dataVar: string): ClarityValue
```
@@ -374,11 +348,11 @@ The name of the `data-var` for the contract.
-
+
-
+
-
`getMapEntry`
+# `getMapEntry`
Get the value of a map entry by its key. Note that this method will always return an optional value `some` or `none`, just like Clarity `map-get?`.
@@ -399,10 +373,12 @@ The name of the map within the contract.
The key to access the value in the map.
-Example: `Cl.standardPrincipal('ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5')`
+Example: `Cl.standardPrincipal(
+ 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5'
+)`
-
+
@@ -416,9 +392,7 @@ The key to access the value in the map.
- ```ts twoslash
- // @noErrors
- // [!code word:getMapEntry]
+ ```ts
import { Cl } from '@stacks/transactions';
const accounts = simnet.getAccounts();
@@ -433,8 +407,8 @@ The key to access the value in the map.
- ```clarity title="pool.clar"
- (define-map Participants principal bool) // [!code highlight]
+ ```clarity pool.clar
+ (define-map Participants principal bool)
(map-set Participants 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5 true)
```
@@ -450,7 +424,7 @@ The key to access the value in the map.
```
- ```console
+ ```ts
getMapEntry(
contract: string,
mapName: string,
@@ -462,9 +436,7 @@ The key to access the value in the map.
- ```ts twoslash
- // @noErrors
- // [!code word:cvToValue]
+ ```ts
import { Cl, cvToValue } from '@stacks/transactions';
const accounts = simnet.getAccounts();
@@ -476,13 +448,13 @@ The key to access the value in the map.
Cl.standardPrincipal(wallet)
);
- const response = cvToValue(hasParticipated); // [!code highlight]
+ const response = cvToValue(hasParticipated);
```
- ```clarity title="pool.clar"
- (define-map Participants principal bool) // [!code highlight]
+ ```clarity pool.clar
+ (define-map Participants principal bool)
(map-set Participants 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5 true)
```
@@ -496,7 +468,7 @@ The key to access the value in the map.
```
- ```console
+ ```ts
getMapEntry(
contract: string,
mapName: string,
@@ -513,11 +485,11 @@ The key to access the value in the map.
-
+
-
+
-
`callReadOnlyFn`
+# `callReadOnlyFn`
Call read-only functions exposed by a contract.
@@ -540,7 +512,9 @@ The name of the read-only function within the contract.
The arguments to pass to the read-only function. If no arguments are needed, pass an empty array.
-Example: `[Cl.standardPrincipal('ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5')]`
+Example: `[Cl.standardPrincipal(
+ 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5'
+)]`
@@ -549,7 +523,7 @@ The Stacks address of the sender.
Example: `ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM`
-
+# `callPublicFn`
Call public functions exposed by a contract.
@@ -873,7 +836,9 @@ The name of the public function within the contract.
The arguments to pass to the public function. If no arguments are needed, pass an empty array.
-Example: `[Cl.standardPrincipal('ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5')]`
+Example: `[Cl.standardPrincipal(
+ 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5'
+)]`
@@ -882,7 +847,7 @@ The Stacks address of the sender.
Example: `ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM`
-
+
@@ -899,9 +864,7 @@ The Stacks address of the sender.
- ```ts twoslash
- // @noErrors
- // [!code word:callPublicFn]
+ ```ts
import { Cl } from '@stacks/transactions';
const accounts = simnet.getAccounts();
@@ -914,13 +877,12 @@ The Stacks address of the sender.
wallet
);
- const response = registerParticipant.result; // [!code highlight]
+ const response = registerParticipant.result;
```
- ```clarity title="pool.clar"
- // [!code word:register-participant]
+ ```clarity pool.clar
(define-map Participants principal bool)
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
@@ -966,9 +928,7 @@ The Stacks address of the sender.
- ```ts twoslash
- // @noErrors
- // [!code word:cvToValue]
+ ```ts
import { Cl, cvToValue } from '@stacks/transactions';
const accounts = simnet.getAccounts();
@@ -981,13 +941,12 @@ The Stacks address of the sender.
wallet
);
- const response = cvToValue(registerParticipant.result); // [!code highlight]
+ const response = cvToValue(registerParticipant.result);
```
- ```clarity title="pool.clar"
- // [!code word:register-participant]
+ ```clarity pool.clar
(define-map Participants principal bool)
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
@@ -1031,10 +990,7 @@ The Stacks address of the sender.
- ```ts twoslash
- // @noErrors
- // [!code word:cvToValue]
- // [!code word:ClarityValue]
+ ```ts
import { Cl, cvToValue, type ClarityValue } from '@stacks/transactions';
const accounts = simnet.getAccounts();
@@ -1048,14 +1004,13 @@ The Stacks address of the sender.
);
const eventValues = registerParticipant.events.map((event) =>
- cvToValue(event.data.value as ClarityValue) // [!code highlight]
+ cvToValue(event.data.value as ClarityValue)
);
```
- ```clarity title="pool.clar"
- // [!code word:register-participant]
+ ```clarity pool.clar
(define-map Participants principal bool)
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
@@ -1063,7 +1018,7 @@ The Stacks address of the sender.
(begin
(map-set Participants who true)
(map-set ParticipantStatus who { enrollmentBlock: block-height, contributionAmount: u0 })
- (print { message: "Registered", who: who, at: block-height }) // [!code highlight]
+ (print { message: "Registered", who: who, at: block-height })
(ok true)
)
)
@@ -1116,11 +1071,11 @@ The Stacks address of the sender.
-
+
-
+
-
`callPrivateFn`
+# `callPrivateFn`
Call private functions exposed by a contract.
@@ -1145,7 +1100,9 @@ The name of the private function within the contract.
The arguments to pass to the private function. If no arguments are needed, pass an empty array.
-Example: `[Cl.standardPrincipal('ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5')]`
+Example: `[Cl.standardPrincipal(
+ 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5'
+)]`
@@ -1154,7 +1111,7 @@ The Stacks address of the sender.
Example: `ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM`
-
+
@@ -1168,9 +1125,7 @@ The Stacks address of the sender.
- ```ts twoslash
- // @noErrors
- // [!code word:callPrivateFn]
+ ```ts
import { Cl } from '@stacks/transactions';
const accounts = simnet.getAccounts();
@@ -1184,13 +1139,12 @@ The Stacks address of the sender.
wallet
);
- const response = rewardParticipantPoints.result; // [!code highlight]
+ const response = rewardParticipantPoints.result;
```
- ```clarity title="pool.clar"
- // [!code word:reward-participant-points]
+ ```clarity pool.clar
(define-map Participants principal bool)
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
(define-map ParticipantPoints principal int)
@@ -1240,9 +1194,7 @@ The Stacks address of the sender.
- ```ts twoslash
- // @noErrors
- // [!code word:cvToValue]
+ ```ts
import { Cl, cvToValue } from '@stacks/transactions';
const accounts = simnet.getAccounts();
@@ -1256,13 +1208,12 @@ The Stacks address of the sender.
wallet
);
- const response = cvToValue(registerParticipant.result); // [!code highlight]
+ const response = cvToValue(registerParticipant.result);
```
- ```clarity title="pool.clar"
- // [!code word:reward-participant-points]
+ ```clarity pool.clar
(define-map Participants principal bool)
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
(define-map ParticipantPoints principal int)
@@ -1319,11 +1270,11 @@ The Stacks address of the sender.
-
+
-
+
-
`transferSTX`
+# `transferSTX`
Transfer STX from one address to another. The amount transferred is in `uSTX`.
@@ -1349,7 +1300,7 @@ The Stacks address of the sender.
Example: `ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM`
-
+
@@ -1366,9 +1317,7 @@ The Stacks address of the sender.
- ```ts twoslash
- // @noErrors
- // [!code word:transferSTX]
+ ```ts
const accounts = simnet.getAccounts();
const recipient = accounts.get('wallet_1')!;
@@ -1423,9 +1372,7 @@ The Stacks address of the sender.
- ```ts twoslash
- // @noErrors
- // [!code word:cvToValue]
+ ```ts
import { cvToValue } from '@stacks/transactions';
const accounts = simnet.getAccounts();
@@ -1437,7 +1384,7 @@ The Stacks address of the sender.
simnet.deployer
);
- const response = cvToValue(transfer.result); // [!code highlight]
+ const response = cvToValue(transfer.result);
```
@@ -1467,8 +1414,7 @@ The Stacks address of the sender.
- ```ts twoslash
- // @noErrors
+ ```ts
const accounts = simnet.getAccounts();
const recipient = accounts.get('wallet_1')!;
@@ -1478,7 +1424,7 @@ The Stacks address of the sender.
simnet.deployer
);
- const events = transfer.events.map((event) => event); // [!code highlight]
+ const events = transfer.events.map((event) => event);
```
@@ -1520,11 +1466,11 @@ The Stacks address of the sender.
-
+
-
+
-
`deployContract`
+# `deployContract`
Deploy a contract to simnet.
@@ -1556,7 +1502,7 @@ The Stacks address of the sender.
Example: `ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM`
-
+
@@ -1573,10 +1519,7 @@ The Stacks address of the sender.
- ```ts twoslash
- // @noErrors
- // [!code word:cvToValue]
- // [!code word:deployContract]
+ ```ts
import { cvToValue } from '@stacks/transactions';
const sourceCode = '(define-read-only (say-hi) (ok "Hello World"))';
@@ -1588,7 +1531,7 @@ The Stacks address of the sender.
simnet.deployer
);
- const response = cvToValue(contract.result); // [!code highlight]
+ const response = cvToValue(contract.result);
```
@@ -1616,9 +1559,7 @@ The Stacks address of the sender.
- ```ts twoslash
- // @noErrors
- // [!code word:cvToValue]
+ ```ts
import { cvToValue } from '@stacks/transactions';
const sourceCode = '(define-read-only (say-hi) (ok "Hello World"))';
@@ -1626,11 +1567,11 @@ The Stacks address of the sender.
const contract = simnet.deployContract(
'hello-world',
sourceCode,
- { clarityVersion: 2 }, // [!code highlight]
+ { clarityVersion: 2 },
simnet.deployer
);
- const response = cvToValue(contract.result); // [!code highlight]
+ const response = cvToValue(contract.result);
```
@@ -1658,9 +1599,7 @@ The Stacks address of the sender.
- ```ts twoslash
- // @noErrors
- // [!code word:cvToValue]
+ ```ts
import { cvToValue } from '@stacks/transactions';
const sourceCode = '(define-read-only (say-hi) (ok "Hello World"))';
@@ -1672,7 +1611,7 @@ The Stacks address of the sender.
simnet.deployer
);
- const sayHi = simnet.callReadOnlyFn("hello-world", "say-hi", [], simnet.deployer); // [!code highlight]
+ const sayHi = simnet.callReadOnlyFn("hello-world", "say-hi", [], simnet.deployer);
const response = sayHi.result
```
@@ -1710,11 +1649,11 @@ The Stacks address of the sender.
-
+
-
+
-
`mineBlock`
+# `mineBlock`
The `callPublicFn`, `transferSTX`, and `deployContract` methods all mine one block with only one transaction. It can also be useful to mine a block with multiple transactions.
@@ -1739,7 +1678,7 @@ An array of transactions to be included in the block.
Example: `[tx.transferSTX(100, recipient, sender), ...]`
-
+
@@ -1750,10 +1689,7 @@ An array of transactions to be included in the block.
- ```ts twoslash
- // @noErrors
- // [!code word:tx]
- // [!code word:mineBlock]
+ ```ts
import { tx } from '@hirosystems/clarinet-sdk';
import { Cl, cvToValue } from '@stacks/transactions';
@@ -1774,9 +1710,7 @@ An array of transactions to be included in the block.
- ```clarity title="counter.clar"
- // [!code word:increment]
- // [!code word:add]
+ ```clarity counter.clar
(define-data-var count uint u0)
(define-public (increment)
@@ -1840,17 +1774,17 @@ An array of transactions to be included in the block.
-
+
-
+
-
`mineEmptyBlock`
+# `mineEmptyBlock`
Mine one empty block and increase the block height by one.
Returns the new block height.
-
+# `mineEmptyBlocks`
Mine multiple empty blocks to reach a certain block height.
@@ -1907,7 +1839,7 @@ The number of empty blocks to mine. This parameter is optional.
Example: `5`
-
+
@@ -1921,13 +1853,10 @@ The number of empty blocks to mine. This parameter is optional.
- ```ts twoslash
- // @noErrors
- // [!code word:mineEmptyBlocks]
- // [!code word:5]
+ ```ts
simnet.mineEmptyBlocks(5);
- const response = simnet.blockHeight; // [!code highlight]
+ const response = simnet.blockHeight;
```
@@ -1944,12 +1873,10 @@ The number of empty blocks to mine. This parameter is optional.
- ```ts twoslash
- // @noErrors
- // [!code word:mineEmptyBlocks]
+ ```ts
simnet.mineEmptyBlocks();
- const response = simnet.blockHeight; // [!code highlight]
+ const response = simnet.blockHeight;
```
@@ -1971,11 +1898,11 @@ The number of empty blocks to mine. This parameter is optional.
-
+
-
+
-
`runSnippet`
+# `runSnippet`
Execute arbitrary Clarity code directly, which allows you to test and interact with smart contract functions without deploying them.
@@ -1987,7 +1914,7 @@ The Clarity code snippet to be executed.
Example: `(define-read-only (get-balance) (ok stx-balance))`
-
+
@@ -2001,17 +1928,14 @@ The Clarity code snippet to be executed.
- ```ts twoslash
- // @noErrors
- // [!code word:runSnippet]
- // [!code word:prettyPrint]
+ ```ts
import { Cl } from '@stacks/transactions';
const codeSnippet = simnet.runSnippet(
'(stx-account tx-sender)'
);
- const response = Cl.prettyPrint(codeSnippet, 2); // [!code highlight]
+ const response = Cl.prettyPrint(codeSnippet, 2);
```
@@ -2032,9 +1956,7 @@ The Clarity code snippet to be executed.
- ```ts twoslash
- // @noErrors
- // [!code word:cvToValue]
+ ```ts
import { cvToValue } from "@stacks/transactions";
const accounts = simnet.getAccounts();
@@ -2044,7 +1966,7 @@ The Clarity code snippet to be executed.
`(stx-transfer? u19000000 tx-sender '${recipient})`
);
- const response = cvToValue(codeSnippet); // [!code highlight]
+ const response = cvToValue(codeSnippet);
```
@@ -2069,17 +1991,17 @@ The Clarity code snippet to be executed.
-
+
-
+
-
`getContractsInterfaces`
+# `getContractsInterfaces`
Returns the interfaces of the project contracts as a Map of Contracts, with the keys being the contract addresses.
These interfaces contain information such as the available `functions`, `data-vars`, `maps`, `NFTs`, and `FTs` defined in the contract.
-
+
@@ -2093,17 +2015,15 @@ These interfaces contain information such as the available `functions`, `data-va
- ```ts twoslash
- // @noErrors
- // [!code word:getContractsInterfaces]
+ ```ts
const contractInterfaces = simnet.getContractsInterfaces();
- const response = contractInterfaces.get(`${simnet.deployer}.pool`); // [!code highlight]
+ const response = contractInterfaces.get(`${simnet.deployer}.pool`);
```
- ```clarity title="pool.clar"
+ ```clarity pool.clar
(define-map Participants principal bool)
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
@@ -2162,18 +2082,15 @@ These interfaces contain information such as the available `functions`, `data-va
- ```ts twoslash
- // @noErrors
+ ```ts
const poolContract = contractInterfaces.get(`${simnet.deployer}.pool`);
- const response = poolContract?.functions; // [!code highlight]
+ const response = poolContract?.functions;
```
- ```clarity title="pool.clar"
- // [!code word:get-participant]
- // [!code word:is-active]
+ ```clarity pool.clar
(define-map Participants principal bool)
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
@@ -2219,11 +2136,11 @@ These interfaces contain information such as the available `functions`, `data-va
-
+
-
+
-
`getContractSource`
+# `getContractSource`
Get the source code of a contract as a string.
@@ -2235,7 +2152,7 @@ The identifier of the contract for which the source code is requested.
Example: `pool`
-
+
@@ -2246,15 +2163,13 @@ The identifier of the contract for which the source code is requested.
- ```ts twoslash
- // @noErrors
- // [!code word:getContractSource]
+ ```ts
const contractSource = simnet.getContractSource('pool');
```
- ```clarity title="pool.clar"
+ ```clarity pool.clar
(define-map Participants principal bool)
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
@@ -2268,7 +2183,7 @@ The identifier of the contract for which the source code is requested.
```
- ```console
+ ```clarity
(define-map Participants principal bool)
(define-map ParticipantStatus principal { enrollmentBlock: uint, contributionAmount: uint })
@@ -2294,11 +2209,11 @@ The identifier of the contract for which the source code is requested.
-
+
-
+
-
`getContractAST`
+# `getContractAST`
Get the full AST (Abstract Syntax Tree) of a Clarity contract.
@@ -2312,7 +2227,7 @@ The identifier of the contract for which the AST (Abstract Syntax Tree) is reque
Example: `pool`
-
+
@@ -2323,9 +2238,7 @@ The identifier of the contract for which the AST (Abstract Syntax Tree) is reque
- ```ts twoslash
- // @noErrors
- // [!code word:getContractAST]
+ ```ts
const contractAST = simnet.getContractAST('pool');
```
@@ -2370,6 +2283,4 @@ The identifier of the contract for which the AST (Abstract Syntax Tree) is reque
-
-
-
+
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet-js-sdk/references/properties.mdx b/content/docs/stacks/clarinet-js-sdk/references/properties.mdx
index 1a2968e0b..687910400 100644
--- a/content/docs/stacks/clarinet-js-sdk/references/properties.mdx
+++ b/content/docs/stacks/clarinet-js-sdk/references/properties.mdx
@@ -4,32 +4,22 @@ description: The Clarinet JS SDK provides properties that can be used to interac
toc: false
---
-import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
-
-import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Badge } from '@/components/ui/badge';
-
-import { InlineCode } from '@/components/inline-code';
-
-## Installation
-
-```package-install
-@hirosystems/clarinet-sdk
-```
+import { Root, API, APIExample, Property, Info } from '@/components/layout';
+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
-
+
-
+
-
`blockHeight`
+# `blockHeight`
Returns the current block height of simnet.
-
+
@@ -40,9 +30,7 @@ Returns the current block height of simnet.
- ```ts twoslash
- // [!code word:blockHeight]
- // @noErrors
+ ```ts
const currentBlockHeight = simnet.blockHeight;
```
@@ -60,15 +48,15 @@ Returns the current block height of simnet.
-
+
-
+
-
`deployer`
+# `deployer`
Returns the default deployer address as defined in the project file.
-
+
@@ -82,9 +70,7 @@ Returns the default deployer address as defined in the project file.
- ```ts twoslash
- // @noErrors
- // [!code word:deployer]
+ ```ts
const currentDeployerAddress = simnet.deployer;
```
@@ -97,9 +83,8 @@ Returns the default deployer address as defined in the project file.
- ```ts twoslash
- // @noErrors
- simnet.deployer = 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5'; // [!code highlight]
+ ```ts
+ simnet.deployer = 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5';
const newDeployer = simnet.deployer
```
@@ -117,17 +102,17 @@ Returns the default deployer address as defined in the project file.
-
+
-
+
-
`currentEpoch`
+# `currentEpoch`
Returns the current epoch of simnet.
This represents the Stacks blockchain's progress through discrete time periods, cycles, or upgrades.
-
+
@@ -138,9 +123,7 @@ This represents the Stacks blockchain's progress through discrete time periods,
- ```ts twoslash
- // @noErrors
- // [!code word:currentEpoch]
+ ```ts
const epoch = simnet.currentEpoch;
```
@@ -158,4 +141,4 @@ This represents the Stacks blockchain's progress through discrete time periods,
-
+
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet-js-sdk/references/simnet.mdx b/content/docs/stacks/clarinet-js-sdk/references/simnet.mdx
index 9b31b4dd7..98fa21ee8 100644
--- a/content/docs/stacks/clarinet-js-sdk/references/simnet.mdx
+++ b/content/docs/stacks/clarinet-js-sdk/references/simnet.mdx
@@ -4,28 +4,21 @@ description: The Simnet class is the main entry point for the Clarinet JS SDK. I
toc: false
---
-import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
-import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
-
-import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+} from "@/components/ui/accordion"
import { Badge } from '@/components/ui/badge';
+import { Root, API, APIExample, Property, Info } from '@/components/layout';
+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
-import { InlineCode } from '@/components/inline-code';
-
-## Installation
-
-```package-install
-@hirosystems/clarinet-sdk
-```
-
-
-
-
+
-
+
-
`initSimnet`
+# `initSimnet`
The `initSimnet` function initializes a simulated network. It will often be the first function you call when using the SDK.
@@ -37,49 +30,44 @@ The `manifestPath` is the path to the `Clarinet.toml` manifest file.
-
+
-
-
-
-
- Creating a new instance of simnet
-
-
- With a custom config path
-
-
-
- ```ts twoslash
- // [!code word:initSimnet]
- // @noErrors
- import { initSimnet } from '@hirosystems/clarinet-sdk';
-
- const simnet = await initSimnet();
- ```
-
-
- ```ts twoslash
- // @noErrors
- // [!code word:'./config/Clarinet.toml']
- import { initSimnet } from '@hirosystems/clarinet-sdk';
-
- const simnet = await initSimnet('./config/Clarinet.toml');
- ```
-
-
-
-
-
- ```console
- initSimnet(manifestPath?: string): Promise
- ```
+
+
+
+ Creating a new instance of simnet
+
+
+ With a custom config path
+
+
+
+ ```ts
+ import { initSimnet } from '@hirosystems/clarinet-sdk';
+
+ const simnet = await initSimnet();
+ ```
+
+
+ ```ts
+ import { initSimnet } from '@hirosystems/clarinet-sdk';
+
+ const simnet = await initSimnet('./config/Clarinet.toml');
+ ```
+
+
+
+
+
+ Schema
+
+ ```ts
+ initSimnet(manifestPath?: string): Promise
+ ```
+
+
-
-
-
-
-
-
+
+
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet/concepts/deployment-plan.mdx b/content/docs/stacks/clarinet/concepts.mdx
similarity index 54%
rename from content/docs/stacks/clarinet/concepts/deployment-plan.mdx
rename to content/docs/stacks/clarinet/concepts.mdx
index 5620f65be..213a42302 100644
--- a/content/docs/stacks/clarinet/concepts/deployment-plan.mdx
+++ b/content/docs/stacks/clarinet/concepts.mdx
@@ -1,18 +1,31 @@
---
-title: Deployment plans
-description: Deployment plans are reproducible deployment steps that publish a collection of on-chain transactions and one or more contracts to a network.
+title: Concepts
+description: Learn about the concepts behind Clarinet.
---
+## Network types
+
+Clarinet supports different network types to cater to various development and testing needs:
+
+| Network | Description | Use case
+| -------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
+| `simnet` | Optimized for fast feedback loops, introspection, and portability. | Ideal for initial development and unit-testing. |
+| `devnet` | Local Stacks and Bitcoin nodes running on Docker for faster feedback loops. | Use for integration tests or local frontend development. |
+| `testnet` | A pre-production network that offers a realistic environment for testing. | Ideal for final testing before deploying to Mainnet. |
+| `mainnet` | The production network where real transactions occur. | Use when you're ready to deploy your smart contract to production. |
+
+## Deployment plans
+
The default deployment plan of every Clarinet project is contained within specifications set inside certain files. In addition to this default deployment plan, the user can manually configure each plan, adding additional transactions or contract calls across multiple Stacks or Bitcoin blocks.
You can commit, audit, and test contracts without including any secrets in the deployment plan, and you can share these contracts without exposing any sensitive information.
-## Deployment plan primitives
+### Primitives
| Transaction primitive | Typical usage |
-| :----------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| Publish contracts | Deploy a contract to an in-memory simulated Stacks chain. Deploy to a public testnet or mainnet. Deploy an external contract to your local network for testing. |
+| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Publish contracts | Deploy contracts to an in-memory simulated Stacks chain, public networks like testnet and mainnet, or deploy external contracts to your local network for testing purposes. |
| Call contract functions | Call a contract deployed to any of your local devnets or public networks. |
| Send BTC | Perform a simple bitcoin transfer from a p2pkh address to a p2pkh address. |
| Wait for block | Test or automate contract deployment across multiple Stacks or Bitcoin blocks. |
-| Send STX | Send stacks to an address or contract. |
+| Send STX | Send stacks to an address or contract. |
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet/concepts/network-types.mdx b/content/docs/stacks/clarinet/concepts/network-types.mdx
deleted file mode 100644
index cadfc15cf..000000000
--- a/content/docs/stacks/clarinet/concepts/network-types.mdx
+++ /dev/null
@@ -1,13 +0,0 @@
----
-title: Network types
-description: Overview of the different network types and their use cases.
----
-
-Clarinet supports different network types to cater to various development and testing needs:
-
-| Network | Description | Use case
-| -------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
-| `simnet` | Optimized for fast feedback loops, introspection, and portability. | Ideal for initial development and unit-testing. |
-| `devnet` | Local Stacks and Bitcoin nodes running on Docker for faster feedback loops. | Use for integration tests or local frontend development. |
-| `testnet` | A pre-production network that offers a realistic environment for testing. | Ideal for final testing before deploying to Mainnet. |
-| `mainnet` | The production network where real transactions occur. | Use when you're ready to deploy your smart contract to production. |
diff --git a/content/docs/stacks/clarinet/guides/add-a-contract.mdx b/content/docs/stacks/clarinet/guides/add-a-contract.mdx
index da0478684..912c5ce19 100644
--- a/content/docs/stacks/clarinet/guides/add-a-contract.mdx
+++ b/content/docs/stacks/clarinet/guides/add-a-contract.mdx
@@ -7,8 +7,8 @@ import { File, Folder, Files } from 'fumadocs-ui/components/files';
To add a new contract, run the `clarinet contract new` command, along with your contract name, inside your project.
-```console title="Terminal"
-clarinet contract new my-contract
+```terminal
+$ clarinet contract new my-contract
```
## Project structure
diff --git a/content/docs/stacks/clarinet/guides/create-a-new-project.mdx b/content/docs/stacks/clarinet/guides/create-a-new-project.mdx
index 7af20ef22..f750e1a2f 100644
--- a/content/docs/stacks/clarinet/guides/create-a-new-project.mdx
+++ b/content/docs/stacks/clarinet/guides/create-a-new-project.mdx
@@ -4,22 +4,29 @@ description: Once you install Clarinet, you can use Clarinet to create a new pro
---
import { File, Folder, Files } from 'fumadocs-ui/components/files';
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@/components/ui/tooltip"
-To create a new project, run the `clarinet new` command along with your project name.
-
-```console title="Terminal"
-clarinet new my-project
+Create a new Clarinet project with the basic directory structure and configuration files:
+
+```terminal
+$ clarinet new my-project
+[32mCreate directory[0m [1mmy-project[0m
+[32mCreate directory[0m [1mcontracts[0m
+[32mCreate directory[0m [1msettings[0m
+[32mCreate directory[0m [1mtests[0m
+[32mCreate file[0m [1mClarinet.toml[0m
+[32mCreate file[0m [1msettings/Mainnet.toml[0m
+[32mCreate file[0m [1msettings/Testnet.toml[0m
+[32mCreate file[0m [1msettings/Devnet.toml[0m
+[32mCreate directory[0m [1m.vscode[0m
+[32mCreate file[0m [1m.vscode/settings.json[0m
+[32mCreate file[0m [1m.vscode/tasks.json[0m
+[32mCreate file[0m [1m.gitignore[0m
+[32mCreate file[0m [1m.gitattributes[0m
+[32mCreate file[0m [1mpackage.json[0m
+[32mCreate file[0m [1mtsconfig.json[0m
+[32mCreate file[0m [1mvitest.config.js[0m
```
-
-## Project structure
-
-**Clarinet** will create a project directory with the following directory layout:
+This will create a project directory with the following directory layout:
@@ -36,7 +43,6 @@ clarinet new my-project
-The `Clarinet.toml` file contains configuration for the smart contracts in your project. When you create contracts in your project, Clarinet will automatically add them to this file.
-
-The `settings/Devnet.toml` file contains configuration for accounts in the Clarinet console, including the seed phrases and initial balances for a set of out-of-the-box wallets that you can use for testing in the devnet environment. Note: the initial balances for these wallets are in microSTX`uSTX`, or microSTX, which is the smallest unit representation of STX. 1 STX = 1,000,000,000 `uSTX`..
+The _txt`Clarinet.toml`_ file contains configuration for the smart contracts in your project. When you create contracts in your project, Clarinet will automatically add them to this file.
+The _txt`settings/Devnet.toml`_ file contains configuration for accounts in the Clarinet console, including the seed phrases and initial balances for a set of out-of-the-box wallets that you can use for testing in the devnet environment.
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet/guides/create-deployment-plans.mdx b/content/docs/stacks/clarinet/guides/create-deployment-plans.mdx
index bd2b34a0f..419294713 100644
--- a/content/docs/stacks/clarinet/guides/create-deployment-plans.mdx
+++ b/content/docs/stacks/clarinet/guides/create-deployment-plans.mdx
@@ -1,8 +1,9 @@
---
-title: Customizing deployment plans
-description: Learn how to customize your deployment plans.
+title: Create deployment plans
+description: Learn how to create deployment plans.
---
+import { Clarinet, Js } from '@/components/ui/icon';
import {
Tooltip,
TooltipContent,
@@ -10,6 +11,7 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
+
Deployment plans minimize the inherent complexity of deployments, such as smart contract dependencies and interactions, transaction chaining limits, deployment costs, and more. Deployment plans ensure reproducible deployments, a critical workflow for testing purposes.
In this guide, you will learn how to:
@@ -27,14 +29,13 @@ Clarinet uses a deployment plan for every deployment—whether for a basic `simn
You can view the current deployment plan saved to disk at any time with the following command (specifying the network `simnet`, `devnet`, `testnet`, `mainnet`)
-```console title="Terminal"
-// [!code word:deployments generate]
-clarinet deployments generate --
+```terminal
+$ clarinet deployments generate --
```
Upon this command, your project's default deployment plan, a `.yaml` file (for example, `default.devnet-plan.yaml`), is generated from your project specifications and contracts. Here, for example, is the deployment plan for [the counter smart contract](/stacks/clarinet/quickstart) used in our quickstart guide:
-```yaml title="deployments/default.devnet-plan.yaml"
+```yaml deployments/default.devnet-plan.yaml
---
id: 0
name: Devnet deployment
@@ -71,11 +72,11 @@ Specifications in the `Devnet.toml` file you can change include:
- Stacking orders
- Specifying derivation path of a given account:
-```toml title="settings/devnet.toml"
+```toml settings/devnet.toml
[accounts.deployer]
mnemonic = ""
balance = 100_000_000_000_000
-derivation = "m/44'/5757'/0'/0/2" // [!code highlight]
+derivation = "m/44'/5757'/0'/0/2"
```
## Adding project contract requirements
@@ -84,9 +85,8 @@ Your project can reference a smart contract that already exists on the blockchai
For example, [Stacks Improvement Proposal 009](https://github.com/stacksgov/sips/blob/main/sips/sip-010/sip-010-fungible-token-standard.md) specifies a trait reference for all non-fungible tokens. Instead of redeploying this trait as a separate contract each time a new NFT collection is published, you can reference the contract directly within deployment plans with the following Clarinet command, including the contract principal reference:
-```console title="Terminal"
-// [!code word:requirements add]
-clarinet requirements add SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait
+```terminal
+$ clarinet requirements add SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait
```
This command updates a Clarinet project's deployment plan for use in development.
@@ -231,14 +231,18 @@ This cBTC smart contract application has a [devnet deployment plan](https://gith
## Next steps
- }
+ href="/stacks/clarinet/guides/cli-commands/run-a-local-devnet"
title="Run a local devnet"
description="Learn how to run a local devnet."
+ tag='Clarinet'
/>
- }
href="/stacks/clarinet-js-sdk/references/simnet"
title="Simnet reference"
description="Learn how to use simnet with the Clarinet JS SDK."
+ tag='Clarinet JS SDK'
/>
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet/guides/debug-a-contract.mdx b/content/docs/stacks/clarinet/guides/debug-a-contract.mdx
index 61c0cc2f6..4664e38ed 100644
--- a/content/docs/stacks/clarinet/guides/debug-a-contract.mdx
+++ b/content/docs/stacks/clarinet/guides/debug-a-contract.mdx
@@ -3,15 +3,24 @@ title: Debug a contract
description: Step through and debug your contracts inside the command line.
---
+import { Clarinet, Js } from '@/components/ui/icon';
import { File, Folder, Files } from 'fumadocs-ui/components/files';
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@/components/ui/tooltip"
-To debug a contract, let's take the simple `counter` contract from the [Clarinet quickstart](/stacks/clarinet/quickstart) as an example.
+Inside the console, you can use these debugging commands:
+
+```terminal
+$ ::trace (contract-call? .my-contract my-function)
+$ ::debug (contract-call? .my-contract my-function)
+$ break my-function
+```
+
+Debug navigation commands:
+- _console`step`_ or _console`s`_ - Step into
+- _console`finish`_ or _console`f`_ - Step out
+- _console`next`_ or _console`n`_ - Step over
+- _console`continue`_ or _console`c`_ - Continue execution
+
+Let's take the clarity_`counter`_ contract as an example:
```clarity
(define-map Counters principal uint)
@@ -25,48 +34,42 @@ To debug a contract, let's take the simple `counter` contract from the [Clarinet
)
```
-To initiate a debug session for this contract, first run the `clarinet console` command inside your project.
-
-```console title="Terminal"
-clarinet console
-```
+### Trace
-## Trace
+The _console`::trace`_ command expects an expression, so make a _clarity`contract-call?`_ with our _clarity`count-up`_ function and see what happens.
-The `::trace` command expects an expression, so make a `contract-call?` with our `count-up` function and see what happens.
-
-```console title="Terminal"
-::trace (contract-call? .counter count-up)
+```terminal
+$ ::trace (contract-call? .counter count-up)
+(contract-call? .counter count-up) [30m[0m
+( get-count tx-sender ) [30mcounter:4:38[0m
+ [31m↳ args:[0m [1mST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM[0m
+ [34mu0[0m
+[34m(ok true)[0m
```
-We should see a complete trace of our `get-count` function call, outputting the arguments that were passed in (`tx-sender`) and return value (`u0`).
-
-Here's an example response from the `::trace` command:
-```console
-(contract-call? .counter count-up)
-├── ( get-count tx-sender ) counter:8:38
-│ │ ↳ args: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
-│ └ u0
-└ (ok true)
-```
+### Breakpoints
-If we were to run this command again, we should see the return value go from `u0` to `u1`.
+You can also set a breakpoint at a specific line to better understand what's happening in your contract.
-## Breakpoints
+With `::debug`, you can add breakpoints at a specific line of a contract or function to better understand what's happening in your contracts.
-You also might want to **set a breakpoint** at a specific line to better understand what's happening in your contract.
-
-With `::debug`, you can add **breakpoints** at a specific line of a contract or function to better understand what's happening in your contracts.
+```clarity
+(define-map Counters principal uint)
-To illustrate the power of breakpoints, first add a couple new functions to your contract:
+(define-read-only (get-count (who principal))
+ (default-to u0 (map-get? Counters who))
+)
-```clarity
-;; Existing contract code...
+(define-public (count-up)
+ (ok (map-set Counters tx-sender (+ (get-count tx-sender) u1)))
+)
+;; !mark(1:3)
(define-public (count-twice)
(double)
)
+;; !mark(1:6)
(define-private (double)
(begin
(unwrap-panic (count-up))
@@ -75,13 +78,12 @@ To illustrate the power of breakpoints, first add a couple new functions to your
)
```
-Now add a breakTo add a breakpoint, use the `break` or `b` command. on the `count-up` function when calling the new `double` function.
-
-```console title="Terminal"
-::debug (contract-call? .counter count-twice)
-break count-up
+```terminal
+$ ::debug (contract-call? .counter count-twice)
+$ break count-up
```
+
To step through these breakpoints, you can use one of the following commands:
@@ -91,4 +93,30 @@ To step through these breakpoints, you can use one of the following commands:
- **Continue (`continue` or `c`)**: Continue execution until hitting a breakpoint or completing execution.
-Using the `continue` command, the breakpoint you set in the `double` function will trigger twice due to two `count-up` calls, which enables you to do variable and map analysis.
+Using the _console`continue`_ command, the breakpoint you set in the _clarity`double`_ function will trigger twice due to two _clarity`count-up`_ calls, which enables you to do variable and map analysis.
+
+## Next steps
+
+
+ }
+ href="/stacks/clarinet/guides/cli-commands/validate-a-contract"
+ title="Validate a contract"
+ description="Learn how to validate a contract."
+ tag='Clarinet'
+ />
+ }
+ href="/stacks/clarinet/guides/estimate-costs"
+ title="Estimate costs for a contract"
+ description="Learn how to estimate costs for a contract."
+ tag='Clarinet'
+ />
+ }
+ href="/stacks/clarinet-js-sdk/quickstart"
+ title="Write tests for your smart contracts"
+ description="Learn how to write unit tests using the Clarinet JS SDK."
+ tag='Clarinet JS SDK'
+ />
+
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet/guides/deploy-a-contract.mdx b/content/docs/stacks/clarinet/guides/deploy-a-contract.mdx
index 741c11820..e5242dcc5 100644
--- a/content/docs/stacks/clarinet/guides/deploy-a-contract.mdx
+++ b/content/docs/stacks/clarinet/guides/deploy-a-contract.mdx
@@ -3,32 +3,83 @@ title: Deploy a contract
description: Use Clarinet to publish your contracts to the devnet, testnet, or mainnet networks.
---
-import { File, Folder, Files } from 'fumadocs-ui/components/files';
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@/components/ui/tooltip"
-
-The first step to deploying your contracts is to generate a deployment plan.
-
-```console title="Terminal"
-clarinet deployment generate --testnet
+Generate a deployment plan:
+
+```terminal
+$ clarinet deployments generate --
+```
+Supported networks: console`devnet`_, console`testnet`_, console`mainnet`_
+
+Deploy contracts:
+
+```terminal
+$ clarinet deployments apply --
```
-
-These are `yaml` files for creating reproducible deployment steps that publish a collection of on-chain transactions and contracts to a networkAvailable network flags are `--devnet`, `--testnet`, and `--mainnet`.
-
+## Add Contract Requirements
+Add external contract dependencies:
+
+```terminal
+$ clarinet requirements add
+```
+
+Example:
+```terminal
+$ clarinet requirements add SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait
+```
-## Deploy
+## Deployment Plan Transactions
+
+Your deployment plans can include various transaction types:
+
+### Contract Operations
+```yaml
+- contract-publish:
+ contract-name: my-contract
+ expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
+ cost: 5960
+ path: contracts/my-contract.clar
+ clarity-version: 2
+
+- contract-call:
+ contract-id: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.my-contract
+ expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
+ method: my-function
+ parameters: []
+ cost: 5960
+```
+
+### Asset Transfers
+```yaml
+- stx-transfer:
+ expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
+ recipient: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.my-contract
+ mstx-amount: 1000
+ memo: '0x01'
+ cost: 10000
+
+- btc-transfer:
+ expected-sender: mjSrB3wS4xab3kYqFktwBzfTdPg367ZJ2d
+ recipient: bcrt1qnxknq3wqtphv7sfwy07m7e4sr6ut9yt6ed99jg
+ sats-amount: 100000000
+ sats-per-byte: 10
+```
-Once you've reviewed your deployment plan at `deployments/-plan.yaml`, you can use the `apply` command to handle the deployments of your contracts.
+### Simnet Operations
+```yaml
+- emulated-contract-publish:
+ contract-name: my-contract
+ emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
+ path: contracts/my-contract.clar
+ clarity-version: 2
-```console title="Terminal"
-clarinet deployment apply --testnet
+- emulated-contract-call:
+ contract-id: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.my-contract
+ emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
+ method: my-function
+ parameters: []
```
-
-Check out the [create deployment plans](/stacks/clarinet/guides/create-deployment-plans) guide to learn more on how to customize your deployment plans.
-
+
+For functions that take no arguments or read-only functions, use an empty parameters list: `parameters: []`
+
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet/guides/estimate-costs.mdx b/content/docs/stacks/clarinet/guides/estimate-costs.mdx
index 95461b8a7..f0fbc775e 100644
--- a/content/docs/stacks/clarinet/guides/estimate-costs.mdx
+++ b/content/docs/stacks/clarinet/guides/estimate-costs.mdx
@@ -3,6 +3,7 @@ title: Estimating contract costs
description: Analyze execution costs pertaining to your contract.
---
+import { API, Clarinet, Js } from '@/components/ui/icon';
import { File, Folder, Files } from "fumadocs-ui/components/files"
Transactions on the Stacks blockchain comes with execution costs that can dictate transaction fees for your users. To analyze the execution costs of your contract's functions, let's continue with the simple `counter` contract from the [Clarinet quickstart](/stacks/clarinet/quickstart) as an example.
@@ -21,22 +22,16 @@ Transactions on the Stacks blockchain comes with execution costs that can dictat
To start analyzing execution costs, first run the `clarinet console` command inside your project.
-```console title="Terminal"
-clarinet console
+```terminal
+$ clarinet console
```
## Get Costs
The `::get_costs ` command in the Clarinet console will display the cost analysis of the given expression as well as the return value of the given expression. The `::get_costs` command expects an expression, so make a `contract-call?` with our `count-up` function and see what happens.
-```console title="Terminal"
-::get_costs (contract-call? .counter count-up)
-```
-
-We should see a chart breaking down the different types of execution costs in the console. Here's the execution cost analysis returned from running the above command:
-
-```console
->> ::get_costs (contract-call? .counter count-up)
+```terminal
+$ ::get_costs (contract-call? .counter count-up)
+----------------------+-------------+----------------+-----------------+
| | Consumed | Limit | Percentage |
+----------------------+-------------+----------------+-----------------+
@@ -74,8 +69,8 @@ The percentage column shows what percentage of the execution costs your expressi
You can toggle the cost analysis to always be displayed after every expression execution in the console by toggling this feature on with the command `::toggle_costs`.
-```console title="Terminal"
-::toggle_costs
+```terminal
+$ ::toggle_costs
```
To turn it off, just run the `::toggle_costs` command again.
@@ -83,3 +78,27 @@ To turn it off, just run the `::toggle_costs` command again.
Check out the Clarity Book section on [runtime cost analysis](https://book.clarity-lang.org/ch12-00-runtime-cost-analysis.html) to read up on cost optimization techniques and recommendations.
To see how you can run automated cost analysis on your unit tests, check out our [quickstart](/stacks/clarinet-js-sdk/quickstart#run-your-tests-with-code-coverage-and-cost-analysis) section for the Clarinet JS SDK.
+
+
+ }
+ href="/stacks/clarinet/guides/cli-commands/validate-a-contract"
+ title="Validate a contract"
+ description="Learn how to validate a contract."
+ tag='Clarinet'
+ />
+ }
+ href="/stacks/rpc-api/fees/estimate"
+ title="Get fee estimates for a transaction"
+ description="Learn how to fetch transaction costs."
+ tag='API'
+ />
+ }
+ href="/stacks/clarinet-js-sdk/quickstart"
+ title="Write tests for your smart contracts"
+ description="Learn how to write unit tests using the Clarinet JS SDK."
+ tag='Clarinet JS SDK'
+ />
+
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet/guides/run-a-local-devnet.mdx b/content/docs/stacks/clarinet/guides/run-a-local-devnet.mdx
index 964c92f56..970a558c0 100644
--- a/content/docs/stacks/clarinet/guides/run-a-local-devnet.mdx
+++ b/content/docs/stacks/clarinet/guides/run-a-local-devnet.mdx
@@ -3,22 +3,13 @@ title: Run a local devnet
description: Integrate your contracts with a local development environment.
---
-import { ImageZoom } from 'fumadocs-ui/components/image-zoom';
-import ClarinetDevnetStart from '@/public/clarinet-devnet-start.png';
+Launch a local development network with all required services:
-To run a local devnet, run the `clarinet devnet start` command.
-
-```console title="Terminal"
-clarinet devnet start
+```terminal
+$ clarinet devnet start
```
- This section requires that you have Docker running locally. To install, refer to the [Docker documentation](/guides/installing-docker).
-
-## Under the hood
-
-This command spins up several containers for various services such as a Stacks and Bitcoin node, the Stacks API, and more.
-
-These containers work together to provide all the necessary services for running a local development environment, allowing you to test and interact with your smart contracts locally.
+Requires Docker to be running locally. See [installing Docker](/guides/install-docker) guide for more information.
If you are getting `error: clarinet was unable to create network`, make sure you have a container service running locally.
diff --git a/content/docs/stacks/clarinet/guides/start-a-development-console.mdx b/content/docs/stacks/clarinet/guides/start-a-development-console.mdx
new file mode 100644
index 000000000..76f0b3405
--- /dev/null
+++ b/content/docs/stacks/clarinet/guides/start-a-development-console.mdx
@@ -0,0 +1,14 @@
+---
+title: Start development console
+description: Launch the Clarinet console for interactive development.
+---
+
+import { File, Folder, Files } from 'fumadocs-ui/components/files';
+
+Launch the Clarinet console for interactive development:
+
+```terminal
+$ clarinet console
+```
+
+This commands starts a new interactive REPL session so you can interact with your contracts.
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet/guides/validate-a-contract.mdx b/content/docs/stacks/clarinet/guides/validate-a-contract.mdx
index 4661d15f7..a7a152f4d 100644
--- a/content/docs/stacks/clarinet/guides/validate-a-contract.mdx
+++ b/content/docs/stacks/clarinet/guides/validate-a-contract.mdx
@@ -4,35 +4,18 @@ description: Clarinet provides syntax and semantics checkers for the smart contr
---
import { File, Folder, Files } from 'fumadocs-ui/components/files';
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@/components/ui/tooltip"
-To verify your contracts, run the `clarinet check` command inside your project.
+Validate the syntax and semantics of your contracts:
-```console title="Terminal"
-clarinet check
+```terminal
+$ clarinet check
+[32m✔[0m [1m1 contract checked[0m
+$ clarinet check path/to/my-contract.clar
+[32m✔[0m [1m1 contract checked[0m
```
-## Configuration
-
-**Clarinet** uses the `Clarinet.toml` file to locate and analyze all the contracts in the project. If the Clarity code is valid, the command will indicate success with the response below.
-
-```console title="Terminal"
-✔ 2 contracts checked
-```
+This command uses the _txt`Clarinet.toml`_ file to locate and analyze all the contracts in the project. If the Clarity code is valid, the command will indicate success with the response below.
-The `clarinet check` command may also report warnings indicating the code is valid.
-
-
-If you want to check the syntax of just a single file in your project, you can use the command below.
-
-```console title="Terminal"
-clarinet check
-```
-
-With this command, `Clarinet` will report syntactical errors, but it does not perform type-checking or other semantic checks as that would require the full contextBecause it only looks at this one contract, Clarinet would need the full context to perform a complete check. for a comprehensive analysis.
\ No newline at end of file
+The _console`clarinet check`_ command may also report warnings indicating the code is valid.
+
\ No newline at end of file
diff --git a/content/docs/stacks/clarinet/index.mdx b/content/docs/stacks/clarinet/index.mdx
index 8a39d64c0..417459d58 100644
--- a/content/docs/stacks/clarinet/index.mdx
+++ b/content/docs/stacks/clarinet/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: Clarinet is a local development environment that offers everything you need to create, test, and deploy smart contracts on Stacks.
-toc: false
---
import { ArrowUpRight } from "lucide-react";
@@ -17,7 +16,86 @@ Using a simple command line interface, Clarinet enables you to build and iterate
You can code with Clarity syntax supportUsing the [Clarity VSCode extension](https://marketplace.visualstudio.com/items?itemName=HiroSystems.clarity-lsp#:~:text=This%20VS%20Code%20extension%20brings,safety%20checks%2C%20debugger%20and%20more), run tests, debug your code line by line, and deploy your contracts to a local Stacks blockchain environment to rapidly iterate on your code. Clarinet can also be used as a hosted service in the cloud via the [Hiro Platform](/stacks/platform).
-To get started, check out our [installation guide](/stacks/clarinet/installation).
+## Installation
+
+
+
+ ```terminal
+ $ brew install clarinet
+ ```
+
+
+
+ ```terminal
+ $ winget install clarinet
+ ```
+
+
+
+ ```terminal
+ $ wget -nv https://github.com/hirosystems/clarinet/releases/download/v0.27.0/clarinet-linux-x64-glibc.tar.gz -O clarinet-linux-x64.tar.gz
+ $ tar -xf clarinet-linux-x64.tar.gz
+ $ chmod +x ./clarinet
+ $ mv ./clarinet /usr/local/bin
+ ```
+
+
+ You may receive security errors when running the pre-compiled binary. To resolve the security warning, use the command below and replace the path `/usr/local/bin/clarinet` with your local binary file.
+
+ ```terminal
+ $ xattr -d com.apple.quarantine /usr/local/bin/clarinet
+ ```
+
+
+
+
+ ```terminal
+ $ sudo apt install build-essential pkg-config libssl-dev
+ ```
+
+
+ If you choose this option, please be aware that you must first install Rust. For more information on installing Rust, please see the Install Rust page for access to Cargo, the Rust package manager.
+
+
+
Build Clarinet
+
+ Once you have installed Clarinet using Cargo, you can build Clarinet from the source using Cargo with the following commands:
+
+ ```terminal
+ $ git clone https://github.com/hirosystems/clarinet.git --recursive
+ $ cd clarinet
+ $ cargo clarinet-install
+ ```
+
+ By default, you will be placed in our development branch, `develop`, with code that has not yet been released.
+
+ - If you plan to submit any code changes, this is the right branch for you.
+ - If you prefer the latest stable version, switch to the main branch by entering the command below.
+
+ ```terminal
+ $ git checkout main
+ ```
+
+ If you have previously checked out the source, ensure you have the latest code (including submodules) before building using this command:
+
+ ```terminal
+ $ git checkout main
+ $ git pull
+ $ git submodule update --recursive
+ ```
+
+
+
+
+## Set up shell completions
+
+Clarinet already has many different commands built in. Therefore, enabling tab completion in your shell may be useful. Using the command below, you can use `clarinet` to generate the shell completion scripts for many common shells.
+
+```terminal
+$ clarinet completions (bash|elvish|fish|powershell|zsh)
+```
+
+After generating the file, you can refer to the documentation for your shell to determine where this file should be moved to and what other steps may be necessary to enable tab completion for `clarinet`.
## Guides
@@ -27,11 +105,6 @@ To get started, check out our [installation guide](/stacks/clarinet/installation
title="Create a new contract"
description="Add new contracts to your project and have them automatically configured in your project file."
/>
-
-
## Related tools
diff --git a/content/docs/stacks/clarinet/installation.mdx b/content/docs/stacks/clarinet/installation.mdx
deleted file mode 100644
index e4abb6e77..000000000
--- a/content/docs/stacks/clarinet/installation.mdx
+++ /dev/null
@@ -1,84 +0,0 @@
----
-title: Installation
-description: Clarinet was developed to be environment-agnostic. Below are the different ways to install and build Clarinet on your machine.
-toc: false
----
-
-
-
- ```console title="Terminal"
- brew install clarinet
- ```
-
-
-
- ```console title="Terminal"
- winget install clarinet
- ```
-
-
-
- ```console title="Terminal"
- # note: you can change the v0.27.0 version that is available on the releases page.
- wget -nv https://github.com/hirosystems/clarinet/releases/download/v0.27.0/clarinet-linux-x64-glibc.tar.gz -O clarinet-linux-x64.tar.gz
- tar -xf clarinet-linux-x64.tar.gz
- chmod +x ./clarinet
- mv ./clarinet /usr/local/bin
- ```
-
-
- You may receive security errors when running the pre-compiled binary. To resolve the security warning, use the command below and replace the path `/usr/local/bin/clarinet` with your local binary file.
-
- ```console
- xattr -d com.apple.quarantine /usr/local/bin/clarinet
- ```
-
-
-
-
- ```console title="Terminal"
- # Using Debian or Ubuntu-based distributions
- sudo apt install build-essential pkg-config libssl-dev
- ```
-
-
- If you choose this option, please be aware that you must first install Rust. For more information on installing Rust, please see the Install Rust page for access to Cargo, the Rust package manager.
-
-
-
Build Clarinet
-
- Once you have installed Clarinet using Cargo, you can build Clarinet from the source using Cargo with the following commands:
-
- ```console title="Terminal"
- git clone https://github.com/hirosystems/clarinet.git --recursive
- cd clarinet
- cargo clarinet-install
- ```
-
- By default, you will be placed in our development branch, `develop`, with code that has not yet been released.
-
- - If you plan to submit any code changes, this is the right branch for you.
- - If you prefer the latest stable version, switch to the main branch by entering the command below.
-
- ```console title="Terminal"
- git checkout main
- ```
-
- If you have previously checked out the source, ensure you have the latest code (including submodules) before building using this command:
-
- ```console title="Terminal"
- git checkout maingit pull
- git submodule update --recursive
- ```
-
-
-
-## Set up shell completions
-
-Clarinet already has many different commands built in. Therefore, enabling tab completion in your shell may be useful. Using the command below, you can use `clarinet` to generate the shell completion scripts for many common shells.
-
-```console title="Terminal"
-clarinet completions (bash|elvish|fish|powershell|zsh)
-```
-
-After generating the file, you can refer to the documentation for your shell to determine where this file should be moved to and what other steps may be necessary to enable tab completion for `clarinet`.
diff --git a/content/docs/stacks/clarinet/meta.json b/content/docs/stacks/clarinet/meta.json
index e8bf930ed..ce65026d8 100644
--- a/content/docs/stacks/clarinet/meta.json
+++ b/content/docs/stacks/clarinet/meta.json
@@ -4,19 +4,9 @@
"pages": [
"---Clarinet---",
"index",
- "installation",
"quickstart",
- "---Concepts---",
- "concepts/network-types",
- "concepts/deployment-plan",
+ "concepts",
"---Guides---",
- "guides/create-a-new-project",
- "guides/add-a-contract",
- "guides/validate-a-contract",
- "guides/debug-a-contract",
- "guides/estimate-costs",
- "guides/run-a-local-devnet",
- "guides/deploy-a-contract",
- "guides/create-deployment-plans"
+ "...guides"
]
}
diff --git a/content/docs/stacks/clarinet/quickstart.mdx b/content/docs/stacks/clarinet/quickstart.mdx
index 5104a0bae..98719103a 100644
--- a/content/docs/stacks/clarinet/quickstart.mdx
+++ b/content/docs/stacks/clarinet/quickstart.mdx
@@ -3,10 +3,9 @@ title: Quickstart
description: Learn how to create a simple counter contract using Clarinet.
---
-import { ChevronRight, Code, Terminal } from 'lucide-react';
+import { Clarinet, Js } from '@/components/ui/icon';
import { File, Folder, Files } from 'fumadocs-ui/components/files';
import { Steps, Step } from 'fumadocs-ui/components/steps';
-import { SmallCard } from '@/components/card';
In this quickstart guide, you will write a simple counter contract with Clarity. Throughout this tutorial, you'll learn how to generate a new project, create a smart contract, and validate your smart contract code using the Clarinet CLI.
@@ -18,22 +17,29 @@ Check out the [create a new project](/stacks/clarinet/guides/create-a-new-projec
## Generate your counter project
- Start by creating a new Clarinet project. This command will create a new directory named `counter` and set up a basic Clarinet project inside it.
-
- ```console title="Terminal"
- // [!code word:clarinet new]
- clarinet new counter
- ```
-
- Navigate to the newly created directory:
-
- ```console title="Terminal"
- cd counter
+ Start by creating a new Clarinet project. This command will create a new directory named _console`counter`_ and set up a basic Clarinet project inside it.
+
+ ```terminal
+ $ clarinet new counter
+ [32mCreate directory[0m [1mcounter[0m
+ [32mCreate directory[0m [1mcontracts[0m
+ [32mCreate directory[0m [1msettings[0m
+ [32mCreate directory[0m [1mtests[0m
+ [32mCreate file[0m [1mClarinet.toml[0m
+ [32mCreate file[0m [1msettings/Mainnet.toml[0m
+ [32mCreate file[0m [1msettings/Testnet.toml[0m
+ [32mCreate file[0m [1msettings/Devnet.toml[0m
+ [32mCreate directory[0m [1m.vscode[0m
+ [32mCreate file[0m [1m.vscode/settings.json[0m
+ [32mCreate file[0m [1m.vscode/tasks.json[0m
+ [32mCreate file[0m [1m.gitignore[0m
+ [32mCreate file[0m [1m.gitattributes[0m
+ [32mCreate file[0m [1mpackage.json[0m
+ [32mCreate file[0m [1mtsconfig.json[0m
+ [32mCreate file[0m [1mvitest.config.js[0m
```
- You should see the following files and folders:
-
-
+
@@ -47,40 +53,21 @@ Check out the [create a new project](/stacks/clarinet/guides/create-a-new-projec
-
-
- The `--stacks` flag is required and allows you to specify the network to scan. Other options include `--bitcoin`.
-
## Create a counter contract
- Inside your project, create your first contract. This command will create an empty `counter.clar` file in the **contracts** folder as well as a `counter.test.ts` file in the `tests` folder.
-
- ```console title="Terminal"
- // [!code word:clarinet contract new]
- clarinet contract new counter
+ Inside your project directory, run _console`clarinet contract new counter`_ to create your contract. This will generate and update the proper files for writing and testing your code.
+
+ ```terminal
+ $ cd counter
+ $ clarinet contract new counter
+ [32mCreated file[0m [1mcontracts/counter.clar[0m
+ [32mCreated file[0m [1mtests/counter.test.ts[0m
+ [33mUpdated Clarinet.toml[0m [1mwith contract counter[0m
```
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- It also updates the `Clarinet.toml` file inside your project with the necessary settings.
-
- ```toml title="Clarinet.toml"
- // [!code word:contracts.counter]
+ ```toml Clarinet.toml
[contracts.counter]
path = 'contracts/counter.clar'
clarity_version = 2
@@ -90,13 +77,13 @@ Check out the [create a new project](/stacks/clarinet/guides/create-a-new-projec
## Variables and functions
- In Clarity, you can define variables and functions to store and manipulate data. Inside your `contracts/counter.clar` file:
+ Inside your _txt`contracts/counter.clar`_ file:
- 1. Define a map called `Counters` to store the count associated with each user.
- 2. Define a public function called `count-up` that increments the count of the user who calls it.
- 3. Add a read-only function called `get-count` that returns the count of the user who calls it.
+ 1. Define a map called _clarity`Counters`_ to store the count associated with each user.
+ 2. Define a public function called _clarity`count-up`_ that increments the count of the user who calls it.
+ 3. Add a read-only function called _clarity`get-count`_ that returns the count of the user who calls it.
- ```clarity title="counter.clar"
+ ```clarity counter.clar -c
(define-map Counters principal uint)
(define-public (count-up)
@@ -113,47 +100,53 @@ Check out the [create a new project](/stacks/clarinet/guides/create-a-new-projec
Now it's time to validate your contract. This command will check your contract for errors and typos.
- ```console title="Terminal"
- // [!code word:check]
- clarinet check
+ ```terminal
+ $ clarinet check
+ [32m✔[0m [1m1 contract checked[0m
```
- Once your contract is validated, you can interact with it in a local REPL with the following steps:
+ Once your contract is validated, you can interact with it locally with the _console`clarinet console`_ inside your project directory.
- 1. Run `clarinet console` from the terminal inside of your project.
- ```console title="Terminal"
- // [!code word:console]
- clarinet console
- ```
- 2. Call your contract by running `(contract-call? .counter count-up)`.
- ```clarity
- (contract-call? .counter count-up)
+ ```terminal
+ $ clarinet console
```
- 3. Verify the count of the user has been incremented by calling the `get-count` function with the `tx-sender` as the argument.
- ```clarity
- (contract-call? .counter get-count tx-sender)
+
+ Here are some example interactions you can perform with your contract:
+
+ 1. Call the _clarity`count-up`_ function on your contract to increment the count.
+ 2. Verify the count of the user has been incremented by calling the _clarity`get-count`_ function with the _clarity`tx-sender`_ as the argument.
+
+ ```terminal
+ $ (contract-call? .counter count-up)
+ [32m(ok true)[0m
+ $ (contract-call? .counter get-count tx-sender)
+ [32mu1[0m
```
----
-
## Next steps
- }
+ href="/stacks/clarinet/guides/cli-commands"
+ title="CLI Commands"
+ description="Learn how to use the Clarinet CLI to interact with your contracts."
+ tag='Clarinet'
+ />
+ }
+ href="/http://localhost:3000/stacks/clarinet/guides/cli-commands#start-local-devnet"
title="Run a local devnet"
description="Learn how to set up and run a local development network for your project."
+ tag='Clarinet'
/>
- }
href="/stacks/clarinet-js-sdk/quickstart"
- title="Testing with the Clarinet JS SDK"
- description="Learn how to test your smart contracts using the Clarinet JS SDK."
- />
-
-
+
\ No newline at end of file
diff --git a/content/docs/stacks/clarity/index.mdx b/content/docs/stacks/clarity/index.mdx
index af481e752..cbe05b0c3 100644
--- a/content/docs/stacks/clarity/index.mdx
+++ b/content/docs/stacks/clarity/index.mdx
@@ -1,7 +1,6 @@
---
title: Introduction
description: Explore and master Clarity's built-in functions for smart contract development.
-toc: false
---
import { Code } from 'lucide-react';
diff --git a/content/docs/stacks/connect/guides/authenticate-users.mdx b/content/docs/stacks/connect/guides/authenticate-users.mdx
index d7e2e56f6..ad3a5fc22 100644
--- a/content/docs/stacks/connect/guides/authenticate-users.mdx
+++ b/content/docs/stacks/connect/guides/authenticate-users.mdx
@@ -31,7 +31,7 @@ In this guide, you will learn how to:
After installing the `@stacks/connect` package, initiate a `userSession` with the following permission scopes.
-```ts twoslash
+```ts
import { AppConfig, UserSession } from '@stacks/connect';
const appConfig = new AppConfig(['store_write', 'publish_data']);
@@ -64,8 +64,7 @@ Create an `authenticate` function that will call `showConnect`, triggering the p
-```ts twoslash
-// @noErrors
+```ts
function authenticate() {
showConnect({
appDetails: {
@@ -95,7 +94,7 @@ After initiating the authentication process, you will most likely need to handle
1. Check if there is a pending sign-in using the `isSignInPending` method of the `userSession` object.
2. If there is a pending sign-in, handle it by calling `handlePendingSignIn` which processes the sign-in and then utilizes the `userData` returned in a promise.
-```tsx twoslash
+```tsx
import { AppConfig, UserSession, showConnect } from '@stacks/connect';
const appConfig = new AppConfig(['store_write', 'publish_data']);
diff --git a/content/docs/stacks/connect/guides/sign-messages.mdx b/content/docs/stacks/connect/guides/sign-messages.mdx
index 9282f4763..7966ffe50 100644
--- a/content/docs/stacks/connect/guides/sign-messages.mdx
+++ b/content/docs/stacks/connect/guides/sign-messages.mdx
@@ -45,8 +45,7 @@ Users must authenticate to an app before you request message signing. Users can
To prompt users to log in, use the `showConnect` function from the `@stacks/connect` package:
-```ts twoslash
-// @noErrors
+```ts
import { AppConfig, UserSession, showConnect } from '@stacks/connect';
const appConfig = new AppConfig(['store_write', 'publish_data']);
@@ -71,9 +70,7 @@ function authenticate() {
Call the `openSignatureRequestPopup` function provided by the `@stacks/connect` package to trigger the display of the message signing prompt:
-```ts twoslash
-// @noErrors
-// [!code word:openSignatureRequestPopup]
+```ts
import { openSignatureRequestPopup } from '@stacks/connect';
import { StacksTestnet } from '@stacks/network';
@@ -96,7 +93,6 @@ openSignatureRequestPopup({
All of the methods included on this page accept a `network` option. By default, Connect uses a `testnet` network option. You can import a network configuration from the [`@stacks/network`](/stacks/stacks.js/packages/network) package:
```ts
-// [!code word:mainnet]
import { StacksTestnet, StacksMainnet } from '@stacks/network';
const testnet = new StacksTestnet();
@@ -133,9 +129,7 @@ The `openSignatureRequestPopup` method from `@stacks/connect` allows you to spec
You can get the signature of the message via the arguments passed to `onFinish`. Your callback will be fired with a single `data` argument:
-```ts twoslash
-// @noErrors
-// [!code word:data]
+```ts
const onFinish = (data: SignatureData) => {
const { signature, publicKey } = data;
@@ -157,9 +151,7 @@ export interface SignatureData {
When you verify a signature, you're confirming that the message was indeed created by the claimed sender and that it hasn't been altered since it was signed. To do this, use the `verifyMessageSignatureRsv` function from the `@stacks/encryption` package:
-```ts twoslash
-// @noErrors
-// [!code word:verifyMessageSignatureRsv]
+```ts
import type { SignatureData } from '@stacks/connect';
import { verifyMessageSignatureRsv } from '@stacks/encryption';
@@ -176,7 +168,7 @@ openSignatureRequestPopup({
const { signature, publicKey } = data;
const verified = verifyMessageSignatureRsv({ message, publicKey, signature });
if (verified) {
- /* your logic here */ // [!code highlight]
+ /* your logic here */
}
},
});
diff --git a/content/docs/stacks/connect/guides/sign-transactions.mdx b/content/docs/stacks/connect/guides/sign-transactions.mdx
index d0bdb2c6a..b0b90ce75 100644
--- a/content/docs/stacks/connect/guides/sign-transactions.mdx
+++ b/content/docs/stacks/connect/guides/sign-transactions.mdx
@@ -38,7 +38,7 @@ Install the required packages to start building and broadcasting transactions.
Users must authenticate to an app before prompting them to sign and broadcast transactions to the Stacks blockchain with an authenticator such as the [Leather](https://leather.io/install-desktop) wallet.
-```ts twoslash
+```ts
import { AppConfig, UserSession } from '@stacks/connect';
const appConfig = new AppConfig(['store_write', 'publish_data']);
@@ -66,8 +66,7 @@ There are three types of transactions: **STX transfers**, **contract deployments
To prompt the user to transfer STX, call the `openSTXTransfer` function provided by the `@stacks/connect` package to trigger the display of a transaction signing prompt for transferring STX:
- ```ts twoslash
- // @noErrors
+ ```ts
import { openSTXTransfer } from '@stacks/connect';
import { StacksTestnet } from '@stacks/network';
@@ -93,8 +92,7 @@ There are three types of transactions: **STX transfers**, **contract deployments
To prompt the user to deploy a smart contract, call the `openContractDeploy` function provided by the `@stacks/connect` package to trigger the display of a transaction signing prompt for deploying a smart contract:
- ```ts twoslash
- // @noErrors
+ ```ts
import { openContractDeploy } from '@stacks/connect';
const codeBody = '(begin (print "hello, world"))';
@@ -132,8 +130,7 @@ There are three types of transactions: **STX transfers**, **contract deployments
To execute this function, invoke the `openContractCall` method.
- ```ts twoslash
- // @noErrors
+ ```ts
import { openContractCall } from '@stacks/connect';
import {
uintCV,
@@ -201,9 +198,7 @@ All of the methods included on this page accept a `network` option. By default,
- ```ts twoslash
- // @noErrors
- // [!code word:mainnet]
+ ```ts
import { openContractCall } from '@stacks/connect';
import { StacksMainnet } from '@stacks/network';
diff --git a/content/docs/stacks/connect/index.mdx b/content/docs/stacks/connect/index.mdx
index a38411478..87e6685a7 100644
--- a/content/docs/stacks/connect/index.mdx
+++ b/content/docs/stacks/connect/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: A JavaScript library for authenticating users as well as signing transactions and messages.
-toc: false
---
import { SecondaryCard } from '@/components/card';
diff --git a/content/docs/stacks/connect/packages/connect.mdx b/content/docs/stacks/connect/packages/connect.mdx
index b46eb8e1c..50a9264f7 100644
--- a/content/docs/stacks/connect/packages/connect.mdx
+++ b/content/docs/stacks/connect/packages/connect.mdx
@@ -5,7 +5,7 @@ toc: false
---
import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
+import { Property } from 'fumadocs-openapi/ui'
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
@@ -717,7 +717,7 @@ const myPostCondition = makeStandardSTXPostCondition(
> For more examples on constructing different kinds of post-conditions read the [Post-Conditions Guide of Stacks.js](https://github.com/hirosystems/stacks.js/tree/main/packages/transactions#post-conditions).
-##### Post-Condition Modes
+#### Post-Condition Modes
If post-conditions `postConditions: [ ... ]` are specified, they will ALWAYS be checked by blockchain nodes.
If ANY conditions fails, the transaction will fail.
@@ -743,35 +743,35 @@ openSignatureRequestPopup({ ...opts }, LeatherProvider);
openStructuredDataSignatureRequestPopup({ ...opts }, LeatherProvider);
```
-### 🤔 Pitfalls
+### Pitfalls
- Connect can currently not set manual nonces, since this is not supported by wallets.
- For some projects it might be necessary to also install the `regenerator-runtime` package. `npm install --save-dev regenerator-runtime`. This is a build issue of older versions of `@stacks/connect`.
-### 📚 Method Parameters
+### Method Parameters
A glossary of the most common options of `openSTXTransfer` and `openContractCall`
-### `openSTXTransfer` _Required_
+#### `openSTXTransfer` *required
-| | Description | Type | Example |
-| :---------- | :------------------------------------ | :-------------------------------- | :-------------------------------------------- |
+| Option | Description | Type | Example |
+| ----------- | ------------------------------------- | --------------------------------- | --------------------------------------------- |
| `recipient` | The recipient (STX principal) address | `string` | `'ST39MJ145BR6S8C315AG2BD61SJ16E208P1FDK3AK'` |
| `amount` | The amount (in micro-STX) to transfer | Integer (e.g. `number`, `bigint`) | `10000` |
-### `openContractCall` _Required_
+#### `openContractCall` *required
-| | Description | Type | Example |
-| :---------------- | :----------------------------------------------- | :---------------------- | :-------------------------------------------- |
-| `contractAddress` | The (STX contract) address of the smart contract | `string` | `'ST39MJ145BR6S8C315AG2BD61SJ16E208P1FDK3AK'` |
-| `contractName` | The contract name | `string` | `'example-contract'` |
+| Option | Description | Type | Example |
+| ------------------- | ----------------------------------------------- | ---------------------- | --------------------------------------------- |
+| `contractAddress` | The (STX contract) address of the smart contract | `string` | `'ST39MJ145BR6S8C315AG2BD61SJ16E208P1FDK3AK'` |
+| `contractName` | The contract name | `string` | `'example-contract'` |
| `functionName` | The contract function name | `string` | `'vote'` |
| `functionArgs` | The contract function arguments | Array of Clarity Values | `[]`, `[uintCV(100)]` |
-### _Optional_
+#### _Optional_
-| | Default | Description | Type | Example |
-| :------------------ | :------------------ | :-------------------------------------------------------------------------- | :------------------------------------------------------------------------------ | :------------------------ |
+| Option | Default | Description | Type | Example |
+| ------------------- | ------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------- |
| `network` | Mainnet | The network to broadcast the transaction to | [StacksNetwork](https://stacks.js.org/classes/network.StacksNetwork.html) | `new StacksMainnet()` |
| `anchorMode` | Any | The type of block the transaction should be mined in | [AnchorMode Enum](https://stacks.js.org/enums/transactions.AnchorMode.html) | `AnchorMode.OnChainOnly` |
| `memo` | _Empty_ `''` | The memo field (used for additional data) | `string` | `'a memo'` |
diff --git a/content/docs/stacks/connect/quickstart.mdx b/content/docs/stacks/connect/quickstart.mdx
index d0d0372d1..3c62ed63e 100644
--- a/content/docs/stacks/connect/quickstart.mdx
+++ b/content/docs/stacks/connect/quickstart.mdx
@@ -32,9 +32,7 @@ For a deeper dive into the authentication process, check out the [authenticate u
Add a reusable `UserSession` instance to your project. This will allow your app to store authentication state in `localStorage`.
- ```ts twoslash title="session.ts"
- // @noErrors
- // [!code word:userSession]
+ ```ts session.ts
import { AppConfig, UserSession } from '@stacks/connect';
const appConfig = new AppConfig(['store_write', 'publish_data']);
@@ -50,9 +48,7 @@ For a deeper dive into the authentication process, check out the [authenticate u
Using the `showConnect` function, you can prompt the user to select a wallet to connect to your app.
- ```tsx twoslash title="connect.ts"
- // @noErrors
- // [!code word:showConnect]
+ ```tsx connect.ts
import { showConnect } from '@stacks/connect';
import { userSession } from './session';
@@ -82,9 +78,7 @@ For a deeper dive into the authentication process, check out the [authenticate u
To prompt the user for a STX transfer call, use the `openSTXTransfer` function.
- ```tsx twoslash title="transfer.ts"
- // @noErrors
- // [!code word:openSTXTransfer]
+ ```tsx transfer.ts
import { openSTXTransfer } from '@stacks/connect';
import { StacksTestnet } from '@stacks/network';
import { userSession } from './session';
diff --git a/content/docs/stacks/get-started.mdx b/content/docs/stacks/get-started.mdx
index 6bc9a5c3f..566d3d918 100644
--- a/content/docs/stacks/get-started.mdx
+++ b/content/docs/stacks/get-started.mdx
@@ -8,7 +8,6 @@ toc: false
import { Database, Ticket } from 'lucide-react';
import { Blockchain, BitcoinIcon, Clarinet, Container, DAO, Js, Plant, Shapes, StacksIcon } from '@/components/ui/icon';
import { SecondaryCard, SmallCard } from '@/components/card';
-import { SectionHeader } from '@/components/layout/section-header';
---
diff --git a/content/docs/stacks/hacks/build-a-custom-api.mdx b/content/docs/stacks/hacks/build-a-custom-api.mdx
index bcdd9c614..9bb5a983f 100644
--- a/content/docs/stacks/hacks/build-a-custom-api.mdx
+++ b/content/docs/stacks/hacks/build-a-custom-api.mdx
@@ -3,6 +3,8 @@ title: Build a custom blockchain API
description: Learn how to build a custom API with Chainhook.
---
+import { HackBadge } from "@/components/badge";
+
## Introduction
In the previous hacks, you built some pretty complex smart contracts. But building a robust UI/UX around these smart contracts and their on-chain data can be challenging due to the nature of blockchains.
@@ -97,8 +99,8 @@ app.post("/api/events", async (req, res) => {
For the next section, you will need to expose your local server via `https` so that Chainhook can deliver the `payload`. To do that, run the following command:
-```console
-npx localtunnel --port
+```terminal
+$ npx localtunnel --port
```
> _**Note**_
@@ -183,15 +185,11 @@ Congratulations on reaching this point! You now have all the building blocks nee
The following challenges are additional features you can implement to further explore building on Stacks. Feel free to add any other features you want.
-
- Starter
-
+
**Create more than 1 chainhook**: Don't stop at just 1! Follow the process above to create more than 1 chainhook for your dApp and parse the data accordingly.
-
- Intermediate
-
+
**Create consumer-facing API endpoints**: Up until now, we've shown you how to capture and process the initial `payload` data sent from a chainhook. However, to provide a robust user experience, you'll want to do more than just output raw data. The challenge here is to create additional API endpoints that present the filtered and extracted data from the initial `/api/events` payload in a consumer-friendly format. This could involve adding a database layer for organizing the data, adding additional context, or transforming the data to match the needs of your application's frontend. For a quick db setup, you can try using something like [Supabase](https://supabase.com/docs/guides/getting-started/quickstarts/reactjs).
@@ -220,8 +218,6 @@ app.post("/api/events", async (req, res) => {
})
```
-
- Advanced
-
+
**UI integration**: The final challenge is to integrate your consumer-facing API into your frontend. This involves taking the data you've processed and organized in your API and displaying it in a meaningful and user-friendly way in your application. This could involve creating dynamic components that update in response to new data, adding interactive elements that allow users to explore the data, or incorporating visualizations to help users understand the data.
diff --git a/content/docs/stacks/hacks/build-a-decentralized-grants-program.mdx b/content/docs/stacks/hacks/build-a-decentralized-grants-program.mdx
index 3969a0e6f..d25c6ad66 100644
--- a/content/docs/stacks/hacks/build-a-decentralized-grants-program.mdx
+++ b/content/docs/stacks/hacks/build-a-decentralized-grants-program.mdx
@@ -3,6 +3,8 @@ title: Build a decentralized grants program
description: Learn how to build a decentralized grants program with governance, submissions, and voting.
---
+import { HackBadge } from "@/components/badge";
+
## Introduction
Welcome to a world where funding for innovative projects is fluid and controlled by a community of token holders, not just a select few. This is the value proposition of a decentralized grants program. In this guide, you will build such a program using the [ExecutorDAO](https://github.com/MarvinJanssen/executor-dao) protocol on the Stacks blockchain.
@@ -42,9 +44,9 @@ Start by setting up your development environment. We've prepared a repository th
To clone the repository, open your terminal and run the following command:
-```console
-git clone https://github.com/hirosystems/hiro-hacks-template.git
-cd hiro-hacks-template
+```terminal
+$ git clone https://github.com/hirosystems/hiro-hacks-template.git
+$ cd hiro-hacks-template
```
## Establishing your core contract
@@ -55,14 +57,13 @@ Traits in Clarity define a set of functions that a contract must implement. In t
In your project's directory, run the following command:
-```console
-clarinet contract new extension-trait && clarinet contract new proposal-trait
+```terminal
+$ clarinet contract new extension-trait && clarinet contract new proposal-trait
```
Now in your contracts, respectively, add the following code:
-```clarity
-;; extension-trait.clar
+```clarity extension-trait.clar
(define-trait extension-trait
(
(callback (principal (buff 34)) (response bool uint))
@@ -70,8 +71,7 @@ Now in your contracts, respectively, add the following code:
)
```
-```clarity
-;; proposal-trait.clar
+```clarity proposal-trait.clar
(define-trait proposal-trait
(
(execute (principal) (response bool uint))
@@ -81,15 +81,15 @@ Now in your contracts, respectively, add the following code:
Now that you've defined how your set of functions must be implemented, you can begin to create your core contract. First run the following command:
-```console
-clarinet contract new core
+```terminal
+$ clarinet contract new core
```
This will create a new contract in the `contracts` directory called `core.clar`.
Inside your `core.clar` contract, add the two trait contracts you've just created from the steps above:
-```clarity
+```clarity core.clar
(use-trait proposal-trait .proposal-trait.proposal-trait)
(use-trait extension-trait .extension-trait.extension-trait)
```
@@ -98,7 +98,7 @@ Inside your `core.clar` contract, add the two trait contracts you've just create
Next, you need to define some basic error handling and variables for managing your contracts:
-```clarity
+```clarity core.clar
(define-constant ERR_UNAUTHORIZED (err u1000))
(define-constant ERR_ALREADY_EXECUTED (err u1001))
(define-constant ERR_INVALID_EXTENSION (err u1002))
@@ -114,7 +114,7 @@ These constants represent error codes that the contract can return. The variable
The `is-self-or-extension` function is a private function that checks if the caller of a function is the contract itself or an authorized extension:
-```clarity
+```clarity core.clar
(define-private (is-self-or-extension)
(ok (asserts! (or (is-eq tx-sender (as-contract tx-sender)) (is-extension contract-caller)) ERR_UNAUTHORIZED))
)
@@ -132,7 +132,7 @@ The `is-self-or-extension` function is a private function that checks if the cal
Here's a function to enable or disable an extension (`set-extension`):
-```clarity
+```clarity core.clar
(define-public (set-extension (extension principal) (enabled bool))
(begin
(try! (is-self-or-extension))
@@ -146,7 +146,7 @@ Here's a function to enable or disable an extension (`set-extension`):
The `execute` function allows for the execution of a proposal:
-```clarity
+```clarity core.clar
(define-public (execute (proposal ) (sender principal))
(begin
(try! (is-self-or-extension))
@@ -163,7 +163,7 @@ This function checks if the caller is authorized, inserts the proposal into the
The `construct` function is used to bootstrap the grants program:
-```clarity
+```clarity core.clar
(define-public (construct (proposal ))
(let
(
@@ -182,7 +182,7 @@ This function checks if the caller is the executive, sets the executive to the c
The request-extension-callback function allows an extension to request a callback:
-```clarity
+```clarity core.clar
(define-public (request-extension-callback (extension ) (memo (buff 34)))
(let
(
@@ -205,8 +205,8 @@ In this section, you will create your first `extension`, a non-transferable memb
To create your membership token, navigate to your project's directory and run the following command:
-```console
-clarinet contract new membership-token
+```terminal
+$ clarinet contract new membership-token
```
This will create a new contract in the contracts directory called `membership-token.clar`.
@@ -217,7 +217,7 @@ Let's walk through the key components of this contract.
The contract defines some constants and variables:
-```clarity
+```clarity membership-token.clar
(define-constant ERR_UNAUTHORIZED (err u2000))
(define-constant ERR_NOT_TOKEN_OWNER (err u2001))
(define-constant ERR_MEMBERSHIP_LIMIT_REACHED (err u2002))
@@ -236,7 +236,7 @@ These constants represent error codes that the contract can return. The variable
The `is-dao-or-extension`, function is a private function that checks if the caller of a function is the core contract itself or an authorized extension:
-```clarity
+```clarity membership-token.clar
(define-public (is-dao-or-extension)
(ok (asserts! (or (is-eq tx-sender .core) (contract-call? .core is-extension contract-caller)) ERR_UNAUTHORIZED))
)
@@ -248,7 +248,7 @@ This function will allow you to distribute (or burn) tokens to new members, gran
The contract provides functions to `mint` and `burn` tokens:
-```clarity
+```clarity membership-token.clar
(define-public (mint (amount uint) (recipient principal))
(begin
(try! (is-dao-or-extension))
@@ -270,7 +270,7 @@ These functions check if the caller is authorized and then mint or burn the spec
The contract provides functions to get the token's name (`get-name`), symbol (`get-symbol`), decimals (`get-decimals`), balance (`get-balance`), total supply (`get-total-supply`), and URI (`get-token-uri`):
-```clarity
+```clarity membership-token.clar
(define-read-only (get-name)
(ok (var-get tokenName))
)
@@ -306,8 +306,8 @@ In this section, you will create your second `extension`, a proposal submission
To create your proposal submission contract, navigate to your project's directory and run the following command:
-```console
-clarinet contract new proposal-submission
+```terminal
+$ clarinet contract new proposal-submission
```
This will create a new contract in the contracts directory called proposal-submission.clar.
@@ -318,14 +318,14 @@ Let's walk through the key components of this contract.
First, you need to implement the `extension-trait` and use the `proposal-trait`:
-```clarity
+```clarity proposal-submission.clar
(impl-trait .extension-trait.extension-trait)
(use-trait proposal-trait .proposal-trait.proposal-trait)
```
Next, define some constants that represent error codes:
-```clarity
+```clarity proposal-submission.clar
(define-constant ERR_UNAUTHORIZED (err u3000))
(define-constant ERR_UNKNOWN_PARAMETER (err u3001))
```
@@ -334,13 +334,13 @@ Next, define some constants that represent error codes:
First, define a map to store the parameters of your contract:
-```clarity
+```clarity proposal-submission.clar
(define-map parameters (string-ascii 34) uint)
```
Set the proposal-duration parameter to a default value. This value represents the duration of a proposal in blocks. For example, if a block is mined approximately every 10 minutes, a proposal-duration of 1440 would be approximately 10 days.
-```clarity
+```clarity proposal-submission.clar
(map-set parameters "proposal-duration" u1440) ;; ~10 days based on a ~10 minute block time.
```
@@ -348,7 +348,7 @@ Set the proposal-duration parameter to a default value. This value represents th
The `is-dao-or-extension` function is a private function that checks if the caller of a function is the core contract itself or an authorized extension:
-```clarity
+```clarity proposal-submission.clar
(define-public (is-dao-or-extension)
(ok (asserts! (or (is-eq tx-sender .core) (contract-call? .core is-extension contract-caller)) ERR_UNAUTHORIZED))
)
@@ -358,7 +358,7 @@ The `is-dao-or-extension` function is a private function that checks if the call
The get-parameter function is a read-only function that returns the value of a parameter:
-```clarity
+```clarity proposal-submission.clar
(define-read-only (get-parameter (parameter (string-ascii 34)))
(ok (unwrap! (map-get? parameters parameter) ERR_UNKNOWN_PARAMETER))
)
@@ -368,7 +368,7 @@ The get-parameter function is a read-only function that returns the value of a p
The propose function allows anyone to propose a grant:
-```clarity
+```clarity proposal-submission.clar
(define-public (propose (proposal ) (title (string-ascii 50)) (description (string-utf8 500)))
(begin
(contract-call? .proposal-voting add-proposal
@@ -390,7 +390,7 @@ This function calls the add-proposal function of the proposal-voting contract, p
The callback function allows the core contract to request a callback:
-```clarity
+```clarity proposal-submission.clar
(define-public (callback (sender principal) (memo (buff 34)))
(ok true)
)
@@ -404,8 +404,8 @@ In this section, you will create your third extension, a proposal voting contrac
To create your proposal voting contract, navigate to your project's directory and run the following command:
-```console
-clarinet contract new proposal-voting
+```terminal
+$ clarinet contract new proposal-voting
```
This will create a new contract in the contracts directory called proposal-voting.clar.
@@ -416,14 +416,14 @@ Let's walk through the key components of this contract.
First, you need to implement the extension-trait and use the proposal-trait:
-```clarity
+```clarity proposal-voting.clar
(impl-trait .extension-trait.extension-trait)
(use-trait proposal-trait .proposal-trait.proposal-trait)
```
Next, define some constants that represent error codes:
-```clarity
+```clarity proposal-voting.clar
(define-constant ERR_UNAUTHORIZED (err u3000))
(define-constant ERR_PROPOSAL_ALREADY_EXECUTED (err u3002))
(define-constant ERR_PROPOSAL_ALREADY_EXISTS (err u3003))
@@ -440,7 +440,7 @@ Next, define some constants that represent error codes:
You need to define a map to store the proposals and another map to store the total votes of each member:
-```clarity
+```clarity proposal-voting.clar
(define-map proposals
principal
{
@@ -462,7 +462,7 @@ You need to define a map to store the proposals and another map to store the tot
The `is-dao-or-extension` function is a private function that checks if the caller of a function is the core contract itself or an authorized extension:
-```clarity
+```clarity proposal-voting.clar
(define-public (is-dao-or-extension)
(ok (asserts! (or (is-eq tx-sender .core) (contract-call? .core is-extension contract-caller)) ERR_UNAUTHORIZED))
)
@@ -472,7 +472,7 @@ The `is-dao-or-extension` function is a private function that checks if the call
The add-proposal function allows the core contract or an authorized extension to add a new proposal:
-```clarity
+```clarity proposal-voting.clar
(define-public (add-proposal (proposal ) (data {end-block-height: uint, proposer: principal, title: (string-ascii 50), description: (string-utf8 500)}))
(begin
(try! (is-dao-or-extension))
@@ -487,7 +487,7 @@ The add-proposal function allows the core contract or an authorized extension to
The vote function allows a token holder to vote on a proposal. It checks if the voter has at least 1 membership-token:
-```clarity
+```clarity proposal-voting.clar
(define-public (vote (amount uint) (for bool) (proposal principal))
(let
(
@@ -516,7 +516,7 @@ The vote function allows a token holder to vote on a proposal. It checks if the
The `conclude` function allows the core contract or an authorized extension to conclude a proposal:
-```clarity
+```clarity proposal-voting.clar
(define-public (conclude (proposal ))
(let
(
@@ -539,7 +539,7 @@ This function concludes a proposal. It first retrieves the proposal data and che
The callback function allows the core contract to request a callback:
-```clarity
+```clarity proposal-voting.clar
(define-public (callback (sender principal) (memo (buff 34)))
(ok true)
)
@@ -551,27 +551,19 @@ Congratulations! You've successfully created the foundations for a decentralized
The following challenges are additional features you can implement to continue building and sharpening your skills.
-
- Starter
-
+
**Initialize your grants program**: Now that you have your core extension contracts, you can initialize the project. The way you do this is through the `construct` function you wrote inside your `core.clar` contract. Create your first proposal enabling your extensions (`membership-token`, `proposal-submission`, `proposal-voting`) and distribute the initial token allocation to addresses responsible for voting on grants. If you need a little more guidance, check out the example [here](https://github.com/MarvinJanssen/executor-dao/blob/main/contracts/proposals/edp000-bootstrap.clar).
-
- Starter
-
+
**Create grant proposals**: After initializing your grants program, the next step is to create grant proposals. This involves using the `propose` function in the `proposal-submission` contract. This function allows anyone to propose a grant, which will then be voted on by the token holders. The proposal includes details such as the title, description, and the proposal contract. Once a proposal is submitted, it can be voted on during the voting period defined by the `proposal-duration` parameter.
-
- Intermediate
-
+
**Implement milestone-based funding**: To implement milestone-based funding, you'll need to create a new extension contract that tracks the progress of each grant proposal. This extension will manage the milestones for each grant, allowing funds to be released as each milestone is achieved. To enable this extension, you'll need to create a proposal using the propose function in the `proposal-submission` contract. Once enabled, the milestone-based funding extension will provide a more structured and accountable way to distribute funds, ensuring that the grant recipients are making progress before they receive their next round of funding.
-
- Advanced
-
+
**UI integration**: Using the provided starter template, integrate your contracts using Stacks.js. This will allow users to submit proposals, vote on them, and view the status of their proposals directly from the UI.
diff --git a/content/docs/stacks/hacks/build-a-friend-tech-clone.mdx b/content/docs/stacks/hacks/build-a-friend-tech-clone.mdx
index 14c313bcb..15392e2f6 100644
--- a/content/docs/stacks/hacks/build-a-friend-tech-clone.mdx
+++ b/content/docs/stacks/hacks/build-a-friend-tech-clone.mdx
@@ -3,6 +3,8 @@ title: Build a Friend.tech clone
description: Learn how to build a decentralized social network.
---
+import { HackBadge } from "@/components/badge";
+
## Introduction
What if we could gamify—and reward—being a friend? That's the idea behind Friend.tech, the decentralized social network that took Web3 by storm. In this hack, you'll recreate Friend.tech on the Stacks blockchain.
@@ -17,9 +19,9 @@ Start by setting up your development environment. We've prepared a repository th
To clone the repository, open your terminal and run the following command:
-```console
-git clone https://github.com/hirosystems/hiro-hacks-template.git
-cd hiro-hacks-template
+```terminal
+$ git clone https://github.com/hirosystems/hiro-hacks-template.git
+$ cd hiro-hacks-template
```
## Create your contract
@@ -28,8 +30,8 @@ Before you begin, we're assuming that you have `clarinet` installed and a basic
To create your contract, navigate to your project's directory and run the following command:
-```console
-clarinet contract new keys
+```terminal
+$ clarinet contract new keys
```
This will create a new contract in the `contracts` directory called `keys.clar`.
@@ -44,7 +46,7 @@ This will create a new contract in the `contracts` directory called `keys.clar`.
Inside your `keys.clar` contract, you need to keep track of the balance of `keys` for each user (or _holder_) and the total supply of `keys` for each subject. You can do this using Clarity's `define-map` function:
-```clarity
+```clarity keys.clar
(define-map keysBalance { subject: principal, holder: principal } uint)
(define-map keysSupply { subject: principal } uint)
```
@@ -55,7 +57,7 @@ The `keysBalance` stores each holder's `key` balance for a given subject and the
The next thing you need to do is define a function that calculates the price of `keys` for a given a `supply` and `amount`. You can do this by defining a `get-price` function:
-```clarity
+```clarity keys.clar
(define-read-only (get-price (supply uint) (amount uint))
(let (
(base-price u10) ;; Base price per key in micro-STX
@@ -80,7 +82,7 @@ These functions form the core of the contract's operations, enabling users to ma
Let's first take a look at the `buy-keys` function:
-```clarity
+```clarity keys.clar
(define-public (buy-keys (subject principal) (amount uint))
(let
(
@@ -112,7 +114,7 @@ This function allows subjects to create their first `keys`, initiating their sup
Next up, the `sell-keys` function:
-```clarity
+```clarity keys.clar
(define-public (sell-keys (subject principal) (amount uint))
(let
(
@@ -146,7 +148,7 @@ This is more or less the same logic as the `buy-keys` function, but instead you
Now that you have the ability to buy and sell `keys`, you need a way to verify if a user is a keyholder. You can do this by defining an `is-keyholder` read-only function:
-```clarity
+```clarity keys.clar
(define-read-only (is-keyholder (subject principal) (holder principal))
(>= (default-to u0 (map-get? keysBalance { subject: subject, holder: holder })) u1)
)
@@ -158,13 +160,13 @@ This function checks if the `keysBalance` for a given `subject` and `holder` is
Make sure your contract is valid and doesn't have any errors. To do this, run the following command:
-```console
-clarinet check
+```terminal
+$ clarinet check
```
Next, check some of your contract functionality inside `clarinet console`:
-```clarity
+```clarity keys.clar
;; Get the price of 100 keys when the supply is 0
(contract-call? .keys get-price u0 u100) ;; u10010
@@ -183,13 +185,11 @@ Congratulations! You've successfully created your contract. You've laid the grou
The following challenges are additional features you can implement to keep learning and building on Stacks.
-
- Starter
-
+
**Balance and supply query functions**: Add two new read-only functions: `get-keys-balance` and `get-keys-supply`. These functions will provide valuable information to users about the distribution and availability of `keys`, and can be used in various parts of your application to display this information to users.
-```clarity
+```clarity keys.clar
(define-read-only (get-keys-balance (subject principal) (holder principal))
;; Return the keysBalance for the given subject and holder
)
@@ -199,13 +199,11 @@ The following challenges are additional features you can implement to keep learn
)
```
-
- Starter
-
+
**Price query functions**: Add two new read-only functions: `get-buy-price` and `get-sell-price`. These helper functions will allow users to query the current price for buying or selling a specific amount of `keys` for a given `subject`.
-```clarity
+```clarity keys.clar
(define-read-only (get-buy-price (subject principal) (amount uint))
;; Implement buy price logic
)
@@ -215,25 +213,21 @@ The following challenges are additional features you can implement to keep learn
)
```
-
- Intermediate
-
+
**Fee management**: When a user buys or sells `keys`, you might want to introduce a fee, either at the protocol or subject level that can be distributed accordingly. Add a `protocolFeePercent` and/or `subjectFeePercent` variable, as well as a destination Stacks principal `protocolFeeDestination` for this new revenue. Now make sure to update the `buy-keys` and `sell-keys` functions to incorporate these fees and `stx-transfer?` into the buying and selling logic.
-```clarity
+```clarity keys.clar
;; Change the fee values as you wish
(define-data-var protocolFeePercent uint u200) ;; or subjectFeePercent
(define-data-var protocolFeeDestination principal tx-sender)
```
-
- Intermediate
-
+
**Access control**: In a real-world application, you might need to adjust the `protocolFeePercent`, `subjectFeePercent`, or `protocolFeeDestination` values over time. However, you wouldn't want just anyone to be able to make these changes. This is where access control comes in. Specifically, you should add a set-fee function (or functions) that allows only a designated `contractOwner` to change the `protocolFeePercent`, `subjectFeePercent`, or `protocolFeeDestination` values.
-```clarity
+```clarity keys.clar
(define-public (set-protocol-fee-percent (feePercent uint))
;; Check if the caller is the contractOwner
;; Update the protocolFeePercent value
@@ -242,9 +236,7 @@ The following challenges are additional features you can implement to keep learn
Think about how you can verify whether the caller of the function is indeed the `contractOwner`. Also, consider what kind of feedback the function should give when someone else tries to call it. Test your implementation to ensure it works as expected.
-
- Intermediate
-
+
**UI integration**: Using the provided [starter template](#clone-the-starter-template), integrate your contract using [Stacks.js](/stacks/stacks.js). For example, if you were calling the `is-keyholder` function, your code might look something like this:
@@ -274,9 +266,7 @@ By using a similar pattern to the code above, you will be able to **show/hide ch
>
> If you are planning to experiment with your contract on `devnet`, make sure to run `clarinet devnet start` [to deploy and test your contract locally](/stacks/clarinet/guides/run-a-local-devnet). You can then use the `devnet` network when calling your contract in the [Leather wallet](https://leather.io/install-extension).
-
- Advanced
-
+
**Message signature**: To further enhance the security and authenticity of your app, try to implemement a _login_ feature using [message signing](/stacks/connect/guides/sign-messages).
diff --git a/content/docs/stacks/hacks/index.mdx b/content/docs/stacks/hacks/index.mdx
index 63089a21b..2ff869574 100644
--- a/content/docs/stacks/hacks/index.mdx
+++ b/content/docs/stacks/hacks/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: A series of coding challenges to sharpen your skills.
-toc: false
---
import { Code } from 'lucide-react';
diff --git a/content/docs/stacks/index.mdx b/content/docs/stacks/index.mdx
index 286611108..a65dca30f 100644
--- a/content/docs/stacks/index.mdx
+++ b/content/docs/stacks/index.mdx
@@ -11,7 +11,7 @@ import { MessageCircle, Braces, ChevronRight, Code, Database, Play, Rocket, Star
import { API, Backend, BugIcon, Clarinet, Cloud, Chainhook, Frontend, Hiro, Js, Newspaper, Pulse, QuestionIcon } from '@/components/ui/icon';
import heroImage from '@/public/stacks-hero.svg';
-
---
diff --git a/content/docs/stacks/nakamoto/guides/clarinet.mdx b/content/docs/stacks/nakamoto/guides/clarinet.mdx
index b37b3aeaf..f0949dde9 100644
--- a/content/docs/stacks/nakamoto/guides/clarinet.mdx
+++ b/content/docs/stacks/nakamoto/guides/clarinet.mdx
@@ -5,31 +5,23 @@ description: Discover Clarinet upgrades related to the Nakamoto release.
## Setting up a project for Nakamoto
-As of [Clarinet 2.9.0](https://github.com/hirosystems/clarinet/releases/tag/v2.9.0), devnet can run
-the latest Stacks blockchain version, enabling Nakamoto and support Clarity 3 contracts.
+As of [version 2.11.0](https://github.com/hirosystems/clarinet/releases/tag/v2.11.0), Clarinet runs
+in epoch 3.0 (Nakamoto) by default.
-Once the devnet reaches the right block height, (Bitcoin block #108 by default), it will deploy the
-`pox-4.clar` contract and run in Epoch 2.5. From there, Clarinet will send `stack-stx` and
-`stack-extend` requests to the new PoX contract. In Nakamoto mode, devnet has 2 signers. Eventually,
-you can observe the `vote-for-aggregate-public-key` transactions that they send.
+- Contracts are set to be deployed in epoch 3.0 and support Clarity 3.
+- The Devnet runs the latest Stacks blockchain version by default, enabling Nakamoto and support
+ Clarity 3 contracts.
-By default, the Devnet will not get to Epoch 3.0 ("Nakamoto activation" with fast blocks). For that,
-the `epoch_3_0` height as to be set manually in the `Devnet.toml` file. Using one of your Clarinet
-projects, or a new one (with `$ clarinet new `), update the `settings/Devnet.toml`
-with the following settings:
+Once the Devnet reaches the right block height, (Bitcoin block #108 by default), it will deploy the
+_`pox-4.clar`_ contract and run in Epoch 2.5. From there, Clarinet will send _`stack-stx`_ and
+_`stack-extend`_ requests to the new PoX contract. Eventually, you can observe the
+_`vote-for-aggregate-public-key`_ transactions that they send.
-```toml
-# settings/Devnet.toml
-[devnet]
-epoch_3_0 = 144
-
-stacks_node_image_url = "quay.io/hirosystems/stacks-node:devnet2.9.0-epoch3.0"
-stacks_signer_image_url = "quay.io/hirosystems/stacks-signer:devnet2.9.0-epoch3.0"
-```
+**At Bitcoin block #142, the Devnet will switch the epoch 3.0.**
-At the end of the `Devnet.toml` file, you must make sure that the `pox_stacking_orders` are properly
+At the end of the _`Devnet.toml`_ file, you must make sure that the _`pox_stacking_orders`_ are properly
set. You should have 3 stacking orders from 3 different accounts. All should start at **cycle 1**
-and take at least **2 slots**. You also need to enable the auto-extends property. Becasue Nakamoto
+and take at least **2 slots**. You also need to enable the _`auto-extend`_ property. Because Nakamoto
relies on the Stackers to sign blocks, these settings ensure that there are engouh stacked STX for
each cycles. Here is what it looks like by default in new projects:
@@ -72,8 +64,8 @@ clarity_version = 3
epoch = 3.0
```
-Start devnet with `clarinet devnet start`, you should see epoch 3.0 and fast blocks at Bitcoin
-block 144.
+Start Devnet with `clarinet devnet start`, you should see epoch 3.0 and fast blocks at Bitcoin
+block 142.
Clarity 3 introduces two new keywords after the Nakamoto hard fork:
@@ -81,7 +73,7 @@ Clarity 3 introduces two new keywords after the Nakamoto hard fork:
- `tenure-height`: Returns the number of tenures passed.
- `stacks-block-height`: Returns the current Stacks block height.
-Note: `block-height` is deprecated.
+Note: `block-height` is removed.
For more details on these and other Clarity keywords, see the [Clarity Keywords Reference](https://docs.stacks.co/reference/keywords).
-
+
\ No newline at end of file
diff --git a/content/docs/stacks/nakamoto/index.mdx b/content/docs/stacks/nakamoto/index.mdx
index 1102e7dfd..bea5cba74 100644
--- a/content/docs/stacks/nakamoto/index.mdx
+++ b/content/docs/stacks/nakamoto/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: Discover updates to Hiro tools related to the Nakamoto upgrade.
-toc: false
---
Nakamoto is an upcoming upgrade to Stacks that brings faster blocks and paves the way for sBTC. [Start here](https://docs.stacks.co/nakamoto-upgrade/nakamoto-upgrade-start-here) if you need an overview of how Nakamoto impacts the network. This document is about how Nakamoto impacts your applications and Hiro tooling specifically.
diff --git a/content/docs/stacks/platform-api/chainhooks/create.mdx b/content/docs/stacks/platform-api/chainhooks/create.mdx
index 2ffe821c7..3e6eb6f4d 100644
--- a/content/docs/stacks/platform-api/chainhooks/create.mdx
+++ b/content/docs/stacks/platform-api/chainhooks/create.mdx
@@ -94,8 +94,8 @@ Hiro API key
-```bash
-curl -X POST "https://api.platform.hiro.so/v1/ext/{apiKey}/chainhooks" \
+```terminal
+$ curl -X POST "https://api.platform.hiro.so/v1/ext/{apiKey}/chainhooks" \
-d '{chainhookPredicate}'
```
diff --git a/content/docs/stacks/platform-api/chainhooks/delete.mdx b/content/docs/stacks/platform-api/chainhooks/delete.mdx
index 1fc7663d2..3e37ef0aa 100644
--- a/content/docs/stacks/platform-api/chainhooks/delete.mdx
+++ b/content/docs/stacks/platform-api/chainhooks/delete.mdx
@@ -62,8 +62,8 @@ Chainhook UUID
-```bash
-curl -X DELETE "https://api.platform.hiro.so/v1/ext/{apiKey}/chainhooks/{chainhookUuid}"
+```terminal
+$ curl -X DELETE "https://api.platform.hiro.so/v1/ext/{apiKey}/chainhooks/{chainhookUuid}"
```
diff --git a/content/docs/stacks/platform-api/chainhooks/get.mdx b/content/docs/stacks/platform-api/chainhooks/get.mdx
index b6aafe0be..4ab3ae2a5 100644
--- a/content/docs/stacks/platform-api/chainhooks/get.mdx
+++ b/content/docs/stacks/platform-api/chainhooks/get.mdx
@@ -63,8 +63,8 @@ Chainhook UUID
-```bash
-curl -X GET "https://api.platform.hiro.so/v1/ext/{apiKey}/chainhooks/{chainhookUuid}"
+```terminal
+$ curl -X GET "https://api.platform.hiro.so/v1/ext/{apiKey}/chainhooks/{chainhookUuid}"
```
diff --git a/content/docs/stacks/platform-api/chainhooks/list.mdx b/content/docs/stacks/platform-api/chainhooks/list.mdx
index 20798762a..a4850ae2a 100644
--- a/content/docs/stacks/platform-api/chainhooks/list.mdx
+++ b/content/docs/stacks/platform-api/chainhooks/list.mdx
@@ -50,8 +50,8 @@ import {
-```bash
-curl -X GET "https://api.platform.hiro.so/v1/ext/{apiKey}/chainhooks"
+```terminal
+$ curl -X GET "https://api.platform.hiro.so/v1/ext/{apiKey}/chainhooks"
```
diff --git a/content/docs/stacks/platform-api/chainhooks/update.mdx b/content/docs/stacks/platform-api/chainhooks/update.mdx
index 7ed2d53d7..903f68933 100644
--- a/content/docs/stacks/platform-api/chainhooks/update.mdx
+++ b/content/docs/stacks/platform-api/chainhooks/update.mdx
@@ -72,8 +72,8 @@ Chainhook UUID
-```bash
-curl -X PUT "https://api.platform.hiro.so/v1/ext/{apiKey}/chainhooks/{chainhookUuid}" \
+```terminal
+$ curl -X PUT "https://api.platform.hiro.so/v1/ext/{apiKey}/chainhooks/{chainhookUuid}" \
-d 'string'
```
diff --git a/content/docs/stacks/platform-api/devnet/bitcoin-node.mdx b/content/docs/stacks/platform-api/devnet/bitcoin-node.mdx
index 782bca5a0..253be449f 100644
--- a/content/docs/stacks/platform-api/devnet/bitcoin-node.mdx
+++ b/content/docs/stacks/platform-api/devnet/bitcoin-node.mdx
@@ -66,8 +66,8 @@ The path (endpoint) for the Bitcoin node RPC
-```bash
-curl -X GET "https://api.platform.hiro.so/v1/ext/{apiKey}/bitcoin-node/extended/v1/tx"
+```terminal
+$ curl -X GET "https://api.platform.hiro.so/v1/ext/{apiKey}/bitcoin-node/extended/v1/tx"
```
@@ -162,8 +162,8 @@ The path (endpoint) for the Bitcoin node RPC
-```bash
-curl -X POST "https://api.platform.hiro.so/v1/ext/{apiKey}/bitcoin-node/rest/chaininfo"
+```terminal
+$ curl -X POST "https://api.platform.hiro.so/v1/ext/{apiKey}/bitcoin-node/rest/chaininfo"
```
diff --git a/content/docs/stacks/platform-api/devnet/stacks-blockchain-api.mdx b/content/docs/stacks/platform-api/devnet/stacks-blockchain-api.mdx
index 9811d108c..46488207b 100644
--- a/content/docs/stacks/platform-api/devnet/stacks-blockchain-api.mdx
+++ b/content/docs/stacks/platform-api/devnet/stacks-blockchain-api.mdx
@@ -66,8 +66,8 @@ The path (endpoint) for the Stacks Blockchain API
-```bash
-curl -X GET "https://api.platform.hiro.so/v1/ext/{apiKey}/stacks-blockchain-api/extended/v1/tx"
+```terminal
+$ curl -X GET "https://api.platform.hiro.so/v1/ext/{apiKey}/stacks-blockchain-api/extended/v1/tx"
```
@@ -162,8 +162,8 @@ The path (endpoint) for the Stacks Blockchain API
-```bash
-curl -X POST "https://api.platform.hiro.so/v1/ext/{apiKey}/stacks-blockchain-api/v2/transactions"
+```terminal
+$ curl -X POST "https://api.platform.hiro.so/v1/ext/{apiKey}/stacks-blockchain-api/v2/transactions"
```
diff --git a/content/docs/stacks/platform-api/devnet/start.mdx b/content/docs/stacks/platform-api/devnet/start.mdx
index d7da1b472..6119895c5 100644
--- a/content/docs/stacks/platform-api/devnet/start.mdx
+++ b/content/docs/stacks/platform-api/devnet/start.mdx
@@ -74,8 +74,8 @@ Project name
-```bash
-curl -X PUT -F "file=@default.devnet-plan.json" "https://api.platform.hiro.so/v1/ext/{apiKey}/devnet/{projectName}"
+```terminal
+$ curl -X PUT -F "file=@default.devnet-plan.json" "https://api.platform.hiro.so/v1/ext/{apiKey}/devnet/{projectName}"
```
diff --git a/content/docs/stacks/platform-api/devnet/stop.mdx b/content/docs/stacks/platform-api/devnet/stop.mdx
index 578abc111..e67da7cc4 100644
--- a/content/docs/stacks/platform-api/devnet/stop.mdx
+++ b/content/docs/stacks/platform-api/devnet/stop.mdx
@@ -54,8 +54,8 @@ Hiro API key
-```bash
-curl -X DELETE "https://api.platform.hiro.so/v1/ext/{apiKey}/devnet"
+```terminal
+$ curl -X DELETE "https://api.platform.hiro.so/v1/ext/{apiKey}/devnet"
```
diff --git a/content/docs/stacks/platform-api/index.mdx b/content/docs/stacks/platform-api/index.mdx
index 72e4e56f2..88ef20db0 100644
--- a/content/docs/stacks/platform-api/index.mdx
+++ b/content/docs/stacks/platform-api/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: Leverage programmatic API access in order to seamlessly interact with devnet and manage chainhooks.
-toc: false
---
import { SecondaryCard } from '@/components/card';
diff --git a/content/docs/stacks/platform/guides/connect-desktop-to-cloud.mdx b/content/docs/stacks/platform/guides/connect-desktop-to-cloud.mdx
index a63cef8d2..35e4bfae7 100644
--- a/content/docs/stacks/platform/guides/connect-desktop-to-cloud.mdx
+++ b/content/docs/stacks/platform/guides/connect-desktop-to-cloud.mdx
@@ -11,16 +11,16 @@ The Hiro Platform now supports local development, allowing you to use your prefe
First, you need to check if you already have an existing SSH key on your device. This is often located in `~/.ssh/id_ed25519.pub`. You can view your SSH keys by running the following command in your terminal:
-```console title="Terminal"
-ls -al ~/.ssh
+```terminal
+$ ls -al ~/.ssh
```
Look for the file ending in `.pub`, which contains your public key.
If you don't have an SSH key, you can generate one by running the following command in your terminal:
-```console title="Terminal"
-ssh-keygen -t ed25519
+```terminal
+$ ssh-keygen -t ed25519
```
You'll then be prompted to enter a passphrase. You can choose to leave that blank. You should now have a `id_ed25519.pub` file, which contains your new public SSH key.
@@ -31,20 +31,20 @@ Next, you need to provide your public key to the Hiro Platform. You can do this
For Mac, use:
-```
-cat ~/.ssh/id_ed25519.pub | pbcopy
+```terminal
+$ cat ~/.ssh/id_ed25519.pub | pbcopy
```
For Windows, use:
-```
-type %userprofile%\.ssh\id_ed25519.pub | clip
+```terminal
+$ type %userprofile%\.ssh\id_ed25519.pub | clip
```
For Linux, use:
-```
-cat ~/.ssh/id_ed25519.pub | xclip -selection clipboard
+```terminal
+$ cat ~/.ssh/id_ed25519.pub | xclip -selection clipboard
```
You'll also need to provide a nickname for your connected device, such as 'MacBook Pro'. This will help you identify the device in the future.
@@ -55,7 +55,7 @@ To enable SSH access and Git authentication to your Hiro Platform workspace, you
Here are the lines you need to add:
-```console
+```bash
Host *.ssh.platform.hiro.so
User hiro
StrictHostKeyChecking no
@@ -120,8 +120,8 @@ If you prefer using the command line for your development work, you can also con
2. Enter the following command:
-```console title="Terminal"
-ssh hiro@
+```terminal
+$ ssh hiro@
```
Replace `hiro@` with your actual workspace URL.
@@ -136,8 +136,8 @@ Remember, to ensure a smooth connection, your public SSH key must be registered
Emacs has built-in support for SSH through the Tramp mode. To open a file over SSH, use the following command:
-```console
-C-x C-f /ssh:hiro@:/path/to/project
+```terminal
+$ C-x C-f /ssh:hiro@:/path/to/project
```
Replace `hiro@` with your workspace url, and `/path/to/project` with the path to the project you want to open.
diff --git a/content/docs/stacks/platform/guides/contract-monitoring.mdx b/content/docs/stacks/platform/guides/contract-monitoring.mdx
index a9603f37d..af3fa1adb 100644
--- a/content/docs/stacks/platform/guides/contract-monitoring.mdx
+++ b/content/docs/stacks/platform/guides/contract-monitoring.mdx
@@ -66,8 +66,7 @@ If you've specified a webhook to send an alert to an API endpoint, then the aler
- ```json title="sample-alert-payload.json"
- // [!code word:tx_status]
+ ```json sample-alert-payload.json
{
"tx_id": "0xa7f511b3f379efef6fe71d0de57712ed13a89c5b6e24dd049eb2cc9a7c24fcb5",
"nonce": 5,
diff --git a/content/docs/stacks/platform/index.mdx b/content/docs/stacks/platform/index.mdx
index bb0cc5113..4c75ef892 100644
--- a/content/docs/stacks/platform/index.mdx
+++ b/content/docs/stacks/platform/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: A cloud-based development environment to kickstart your app development on Stacks.
-toc: false
---
import Link from "next/link";
diff --git a/content/docs/stacks/rpc-api/accounts/info.mdx b/content/docs/stacks/rpc-api/accounts/info.mdx
index 3202d0594..11525e77f 100644
--- a/content/docs/stacks/rpc-api/accounts/info.mdx
+++ b/content/docs/stacks/rpc-api/accounts/info.mdx
@@ -73,8 +73,8 @@ The Stacks chain tip to query from. If tip == latest, the query will be run from
-```bash
-curl -X GET "http://localhost:20443/v2/accounts/string?proof=0&tip=string"
+```terminal
+$ curl -X GET "http://localhost:20443/v2/accounts/string?proof=0&tip=string"
```
diff --git a/content/docs/stacks/rpc-api/blocks/block-proposal.mdx b/content/docs/stacks/rpc-api/blocks/block-proposal.mdx
index d4df5a008..4ae7a3157 100644
--- a/content/docs/stacks/rpc-api/blocks/block-proposal.mdx
+++ b/content/docs/stacks/rpc-api/blocks/block-proposal.mdx
@@ -61,8 +61,8 @@ Used by stackers to validate a proposed Stacks block from a miner.
-```bash
-curl -X POST "http://localhost:20443/v2/block_proposal" \
+```terminal
+$ curl -X POST "http://localhost:20443/v2/block_proposal" \
-d '{
"block": "string",
"chain_id": 0
diff --git a/content/docs/stacks/rpc-api/burn-ops/get-burn-operations.mdx b/content/docs/stacks/rpc-api/burn-ops/get-burn-operations.mdx
index df9f9969e..2d324008e 100644
--- a/content/docs/stacks/rpc-api/burn-ops/get-burn-operations.mdx
+++ b/content/docs/stacks/rpc-api/burn-ops/get-burn-operations.mdx
@@ -60,8 +60,8 @@ name of the burnchain operation type
-```bash
-curl -X GET "http://localhost:20443/v2/burn_ops/0/string"
+```terminal
+$ curl -X GET "http://localhost:20443/v2/burn_ops/0/string"
```
diff --git a/content/docs/stacks/rpc-api/fees/estimate.mdx b/content/docs/stacks/rpc-api/fees/estimate.mdx
index 094234194..c6fcf5699 100644
--- a/content/docs/stacks/rpc-api/fees/estimate.mdx
+++ b/content/docs/stacks/rpc-api/fees/estimate.mdx
@@ -121,8 +121,8 @@ this fee amount by:
-```bash
-curl -X POST "http://localhost:20443/v2/fees/transaction" \
+```terminal
+$ curl -X POST "http://localhost:20443/v2/fees/transaction" \
-d '{
"transaction_payload": "string",
"estimated_len": 0
diff --git a/content/docs/stacks/rpc-api/fees/transfer-estimate.mdx b/content/docs/stacks/rpc-api/fees/transfer-estimate.mdx
index 8704f0650..c9dc84332 100644
--- a/content/docs/stacks/rpc-api/fees/transfer-estimate.mdx
+++ b/content/docs/stacks/rpc-api/fees/transfer-estimate.mdx
@@ -46,8 +46,8 @@ Get an estimated fee rate for STX transfer transactions. This a a fee rate / byt
-```bash
-curl -X GET "http://localhost:20443/v2/fees/transfer"
+```terminal
+$ curl -X GET "http://localhost:20443/v2/fees/transfer"
```
diff --git a/content/docs/stacks/rpc-api/index.mdx b/content/docs/stacks/rpc-api/index.mdx
index 3e41f6968..5f161987b 100644
--- a/content/docs/stacks/rpc-api/index.mdx
+++ b/content/docs/stacks/rpc-api/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: Query the Stacks Node RPC API, interact with smart contracts, and broadcast transactions all via a familiar REST interface.
-toc: false
---
import { SecondaryCard } from '@/components/card';
diff --git a/content/docs/stacks/rpc-api/info/core-api.mdx b/content/docs/stacks/rpc-api/info/core-api.mdx
index 48e120471..6bd346d8d 100644
--- a/content/docs/stacks/rpc-api/info/core-api.mdx
+++ b/content/docs/stacks/rpc-api/info/core-api.mdx
@@ -46,8 +46,8 @@ Get Core API information
-```bash
-curl -X GET "http://localhost:20443/v2/info"
+```terminal
+$ curl -X GET "http://localhost:20443/v2/info"
```
diff --git a/content/docs/stacks/rpc-api/names/name-price.mdx b/content/docs/stacks/rpc-api/names/name-price.mdx
index 8eba22e32..43cbf5612 100644
--- a/content/docs/stacks/rpc-api/names/name-price.mdx
+++ b/content/docs/stacks/rpc-api/names/name-price.mdx
@@ -55,8 +55,8 @@ the name to query price information for
-```bash
-curl -X GET "https://api.hiro.so/v2/prices/names/muneeb.id"
+```terminal
+$ curl -X GET "https://api.hiro.so/v2/prices/names/muneeb.id"
```
diff --git a/content/docs/stacks/rpc-api/names/namespace-price.mdx b/content/docs/stacks/rpc-api/names/namespace-price.mdx
index ca744cbbb..9e6311ec3 100644
--- a/content/docs/stacks/rpc-api/names/namespace-price.mdx
+++ b/content/docs/stacks/rpc-api/names/namespace-price.mdx
@@ -55,8 +55,8 @@ the namespace to fetch price for
-```bash
-curl -X GET "https://api.hiro.so/v2/prices/namespaces/id"
+```terminal
+$ curl -X GET "https://api.hiro.so/v2/prices/namespaces/id"
```
diff --git a/content/docs/stacks/rpc-api/pox/pox-details.mdx b/content/docs/stacks/rpc-api/pox/pox-details.mdx
index 5082390a8..0b48d5c3e 100644
--- a/content/docs/stacks/rpc-api/pox/pox-details.mdx
+++ b/content/docs/stacks/rpc-api/pox/pox-details.mdx
@@ -54,8 +54,8 @@ The Stacks chain tip to query from. If tip == latest, the query will be run from
-```bash
-curl -X GET "http://localhost:20443/v2/pox?tip=string"
+```terminal
+$ curl -X GET "http://localhost:20443/v2/pox?tip=string"
```
diff --git a/content/docs/stacks/rpc-api/pox/stacker-set.mdx b/content/docs/stacks/rpc-api/pox/stacker-set.mdx
index 5ebcf6aab..f519f1771 100644
--- a/content/docs/stacks/rpc-api/pox/stacker-set.mdx
+++ b/content/docs/stacks/rpc-api/pox/stacker-set.mdx
@@ -58,8 +58,8 @@ reward cycle number
-```bash
-curl -X GET "http://localhost:20443/v2/stacker_set/0"
+```terminal
+$ curl -X GET "http://localhost:20443/v2/stacker_set/0"
```
diff --git a/content/docs/stacks/rpc-api/smart-contracts/constants.mdx b/content/docs/stacks/rpc-api/smart-contracts/constants.mdx
index 6dcf64e1c..372d571fe 100644
--- a/content/docs/stacks/rpc-api/smart-contracts/constants.mdx
+++ b/content/docs/stacks/rpc-api/smart-contracts/constants.mdx
@@ -77,8 +77,8 @@ The Stacks chain tip to query from. If tip == latest, the query will be run from
-```bash
-curl -X POST "http://localhost:20443/v2/constant_val/string/string/string?tip=string"
+```terminal
+$ curl -X POST "http://localhost:20443/v2/constant_val/string/string/string?tip=string"
```
diff --git a/content/docs/stacks/rpc-api/smart-contracts/interface.mdx b/content/docs/stacks/rpc-api/smart-contracts/interface.mdx
index c03193b66..68155e077 100644
--- a/content/docs/stacks/rpc-api/smart-contracts/interface.mdx
+++ b/content/docs/stacks/rpc-api/smart-contracts/interface.mdx
@@ -46,8 +46,8 @@ Get contract interface using a `contract_address` and `contract name`
-```bash
-curl -X GET "http://localhost:20443/v2/contracts/interface/%7Bcontract_address%7D/%7Bcontract_name%7D"
+```terminal
+$ curl -X GET "http://localhost:20443/v2/contracts/interface/%7Bcontract_address%7D/%7Bcontract_name%7D"
```
diff --git a/content/docs/stacks/rpc-api/smart-contracts/map-entry.mdx b/content/docs/stacks/rpc-api/smart-contracts/map-entry.mdx
index f841e2d80..52a35dc6b 100644
--- a/content/docs/stacks/rpc-api/smart-contracts/map-entry.mdx
+++ b/content/docs/stacks/rpc-api/smart-contracts/map-entry.mdx
@@ -94,8 +94,8 @@ The Stacks chain tip to query from. If tip == latest, the query will be run from
-```bash
-curl -X POST "http://localhost:20443/v2/map_entry/string/string/string?proof=0&tip=string" \
+```terminal
+$ curl -X POST "http://localhost:20443/v2/map_entry/string/string/string?proof=0&tip=string" \
-d 'string'
```
diff --git a/content/docs/stacks/rpc-api/smart-contracts/read-only.mdx b/content/docs/stacks/rpc-api/smart-contracts/read-only.mdx
index 3545a7971..70de2e41b 100644
--- a/content/docs/stacks/rpc-api/smart-contracts/read-only.mdx
+++ b/content/docs/stacks/rpc-api/smart-contracts/read-only.mdx
@@ -93,8 +93,8 @@ The Stacks chain tip to query from. If tip == latest, the query will be run from
-```bash
-curl -X POST "http://localhost:20443/v2/contracts/call-read/string/string/string?tip=string" \
+```terminal
+$ curl -X POST "http://localhost:20443/v2/contracts/call-read/string/string/string?tip=string" \
-d '{
"sender": "SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info",
"arguments": [
diff --git a/content/docs/stacks/rpc-api/smart-contracts/source.mdx b/content/docs/stacks/rpc-api/smart-contracts/source.mdx
index 1c134a97c..5b2906aaa 100644
--- a/content/docs/stacks/rpc-api/smart-contracts/source.mdx
+++ b/content/docs/stacks/rpc-api/smart-contracts/source.mdx
@@ -46,8 +46,8 @@ Returns the Clarity source code of a given contract, along with the block height
-```bash
-curl -X GET "http://localhost:20443/v2/contracts/source/%7Bcontract_address%7D/%7Bcontract_name%7D"
+```terminal
+$ curl -X GET "http://localhost:20443/v2/contracts/source/%7Bcontract_address%7D/%7Bcontract_name%7D"
```
diff --git a/content/docs/stacks/rpc-api/smart-contracts/traits.mdx b/content/docs/stacks/rpc-api/smart-contracts/traits.mdx
index 9c8d170bc..4d8b9dd09 100644
--- a/content/docs/stacks/rpc-api/smart-contracts/traits.mdx
+++ b/content/docs/stacks/rpc-api/smart-contracts/traits.mdx
@@ -46,8 +46,8 @@ Determine whether or not a specified trait is implemented (either explicitly or
-```bash
-curl -X GET "http://localhost:20443/v2/traits/%7Bcontract_address%7D/%7Bcontract_name%7D/%7Btrait_contract_address%7D/%7Btrait_contract_name%7D/%7Btrait_name%7D"
+```terminal
+$ curl -X GET "http://localhost:20443/v2/traits/%7Bcontract_address%7D/%7Bcontract_name%7D/%7Btrait_contract_address%7D/%7Btrait_contract_name%7D/%7Btrait_name%7D"
```
diff --git a/content/docs/stacks/rpc-api/smart-contracts/variables.mdx b/content/docs/stacks/rpc-api/smart-contracts/variables.mdx
index bbd30e6b7..5ce13db30 100644
--- a/content/docs/stacks/rpc-api/smart-contracts/variables.mdx
+++ b/content/docs/stacks/rpc-api/smart-contracts/variables.mdx
@@ -78,8 +78,8 @@ When supplied `0`, will return the JSON object _without_ the `proof` field.
-```bash
-curl -X GET "http://localhost:20443/v2/data_var/string/string/string"
+```terminal
+$ curl -X GET "http://localhost:20443/v2/data_var/string/string/string"
```
diff --git a/content/docs/stacks/rpc-api/transactions/broadcast-transaction.mdx b/content/docs/stacks/rpc-api/transactions/broadcast-transaction.mdx
index b41117267..09a02725f 100644
--- a/content/docs/stacks/rpc-api/transactions/broadcast-transaction.mdx
+++ b/content/docs/stacks/rpc-api/transactions/broadcast-transaction.mdx
@@ -55,8 +55,8 @@ Broadcast raw transactions on the network. You can use the [@stacks/transactions
-```bash
-curl -X POST "http://localhost:20443/v2/transactions" \
+```terminal
+$ curl -X POST "http://localhost:20443/v2/transactions" \
-d 'string'
```
diff --git a/content/docs/stacks/rpc-api/v3/nakamoto-block.mdx b/content/docs/stacks/rpc-api/v3/nakamoto-block.mdx
index b7568fdf3..ac195c5a9 100644
--- a/content/docs/stacks/rpc-api/v3/nakamoto-block.mdx
+++ b/content/docs/stacks/rpc-api/v3/nakamoto-block.mdx
@@ -55,8 +55,8 @@ The block's ID hash
-```bash
-curl -X GET "http://localhost:20443/v3/blocks/string"
+```terminal
+$ curl -X GET "http://localhost:20443/v3/blocks/string"
```
diff --git a/content/docs/stacks/rpc-api/v3/tenure-blocks.mdx b/content/docs/stacks/rpc-api/v3/tenure-blocks.mdx
index 841e0c566..edfeb621f 100644
--- a/content/docs/stacks/rpc-api/v3/tenure-blocks.mdx
+++ b/content/docs/stacks/rpc-api/v3/tenure-blocks.mdx
@@ -46,8 +46,8 @@ Fetch a sequence of Nakamoto blocks in a tenure. The blocks will be served in o
-```bash
-curl -X GET "http://localhost:20443/v3/tenures/%7Bblock_id%7D"
+```terminal
+$ curl -X GET "http://localhost:20443/v3/tenures/%7Bblock_id%7D"
```
diff --git a/content/docs/stacks/rpc-api/v3/tenure-metadata.mdx b/content/docs/stacks/rpc-api/v3/tenure-metadata.mdx
index ca187ff47..5eaf9d430 100644
--- a/content/docs/stacks/rpc-api/v3/tenure-metadata.mdx
+++ b/content/docs/stacks/rpc-api/v3/tenure-metadata.mdx
@@ -46,8 +46,8 @@ Fetch metadata about the ongoing Nakamoto tenure. This information is sufficient
-```bash
-curl -X GET "http://localhost:20443/v3/tenures/info"
+```terminal
+$ curl -X GET "http://localhost:20443/v3/tenures/info"
```
diff --git a/content/docs/stacks/stacks.js/concepts/accounts-and-addresses.mdx b/content/docs/stacks/stacks.js/concepts/accounts-and-addresses.mdx
index fb13adb68..1c0bcf701 100644
--- a/content/docs/stacks/stacks.js/concepts/accounts-and-addresses.mdx
+++ b/content/docs/stacks/stacks.js/concepts/accounts-and-addresses.mdx
@@ -16,7 +16,6 @@ Testnet: `ST2F4BK4GZH6YFBNHYDDGN4T1RKBA7DA1BJZPJEJJ`
### Using Stacks Connect
```ts
-// [!code word:user.profile.stxAddress.mainnet]
import { showConnect } from '@stacks/connect';
showConnect({
@@ -33,7 +32,6 @@ showConnect({
### Using a seed phrase / mnemonic / private key
```ts
-// [!code word:privateKeyToAddress]
import { randomSeedPhrase, generateWallet, privateKeyToAddress } from "@stacks/wallet-sdk";
const seed = randomSeedPhrase();
@@ -50,7 +48,6 @@ const address = privateKeyToAddress(wallet.accounts[0].stxPrivateKey, 'mainnet')
### Using a public key
```ts
-// [!code word:publicKeyToAddress]
import { publicKeyToAddress } from '@stacks/transactions';
const address = publicKeyToAddress(publicKey, 'mainnet');
diff --git a/content/docs/stacks/stacks.js/concepts/broadcasting.mdx b/content/docs/stacks/stacks.js/concepts/broadcasting.mdx
index 2acbe3c13..5de53dcac 100644
--- a/content/docs/stacks/stacks.js/concepts/broadcasting.mdx
+++ b/content/docs/stacks/stacks.js/concepts/broadcasting.mdx
@@ -7,8 +7,7 @@ description: Learn how to broadcast transactions to the Stacks network.
A finalized transaction can be broadcasted to the network or serialized (to a byte representation) using Stacks.js.
-```ts twoslash
-// @noErrors
+```ts
import { bytesToHex } from '@stacks/common';
import {
makeSTXTokenTransfer,
diff --git a/content/docs/stacks/stacks.js/guides/broadcast-transactions.mdx b/content/docs/stacks/stacks.js/guides/broadcast-transactions.mdx
index 57efda068..6441e98fa 100644
--- a/content/docs/stacks/stacks.js/guides/broadcast-transactions.mdx
+++ b/content/docs/stacks/stacks.js/guides/broadcast-transactions.mdx
@@ -58,9 +58,7 @@ There are three types of transactions:
To transfer STX, use the `makeSTXTokenTransfer` function provided by the `@stacks/transactions` package:
- ```ts twoslash title="stx-transfer.ts"
- // @noErrors
- // [!code word:makeSTXTokenTransfer]
+ ```ts stx-transfer.ts
import { AnchorMode, makeSTXTokenTransfer, broadcastTransaction } from "@stacks/transactions";
import { StacksDevnet } from "@stacks/network";
@@ -82,9 +80,7 @@ There are three types of transactions:
To deploy a contract, use the `makeContractDeploy` function provided by the `@stacks/transactions` package:
- ```ts twoslash title="contract-deploy.ts"
- // @noErrors
- // [!code word:makeContractDeploy]
+ ```ts contract-deploy.ts
import { makeContractDeploy, broadcastTransaction, AnchorMode } from '@stacks/transactions';
import { StacksTestnet, StacksMainnet } from '@stacks/network';
@@ -106,9 +102,7 @@ There are three types of transactions:
To execute a contract function, use the `makeContractCall` function provided by the `@stacks/transactions` package:
- ```ts twoslash title="function-call.ts"
- // @noErrors
- // [!code word:makeContractCall]
+ ```ts function-call.ts
import {
makeContractCall,
broadcastTransaction,
@@ -155,9 +149,7 @@ After building the transaction, broadcast it to the Stacks blockchain network us
1. Pass in the transaction object you created in the previous step to the `broadcastTransaction` function.
2. Handle the response by logging the response object.
-```tsx twoslash
-// @noErrors
-// [!code word:broadcastTransaction]
+```tsx
import { broadcastTransaction } from '@stacks/transactions';
const broadcastResponse = await broadcastTransaction(transaction);
@@ -169,8 +161,7 @@ This code sends the signed transaction to the Stacks blockchain. The `broadcastT
Handle the transaction results by checking the transaction status and responding accordingly.
-```ts twoslash
-// @noErrors
+```ts
if (broadcastResponse.success) {
console.log('Transaction successful with ID:', broadcastResponse.txid);
} else {
diff --git a/content/docs/stacks/stacks.js/guides/post-conditions.mdx b/content/docs/stacks/stacks.js/guides/post-conditions.mdx
index 29c896f70..b17468a6b 100644
--- a/content/docs/stacks/stacks.js/guides/post-conditions.mdx
+++ b/content/docs/stacks/stacks.js/guides/post-conditions.mdx
@@ -32,9 +32,7 @@ Post-conditions can be added to contract calls and FT/NFT transfers to ensure as
For instance, the following post-condition ensures that the principal initiating the transaction must send exactly 1000 uSTX, or else the transaction will abort.
-```ts twoslash
-// @noErrors
-// [!code word:Pc]
+```ts
import { Pc } from '@stacks/transactions';
const postCondition = Pc.principal('STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6')
@@ -74,9 +72,7 @@ const postCondition = Pc.principal('STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6')
When creating a transaction, the mode of the transaction can be set to `Allow` or `Deny` to specify whether unspecified asset transfers are permitted.
-```ts twoslash
-// @noErrors
-// [!code word:PostConditionMode]
+```ts
import { PostConditionMode } from '@stacks/transactions';
const tx = await makeContractCall({
@@ -98,9 +94,7 @@ Legacy methods and enums can be used interchangeably with the builder methods.
If you prefer the legacy methods over the `Pc` builder approach, you can import them from the `@stacks/transactions` package.
-```ts twoslash
-// @noErrors
-// [!code word:createSTXPostCondition]
+```ts
import { createSTXPostCondition, FungibleConditionCode } from '@stacks/transactions';
const postCondition = createSTXPostCondition(
@@ -130,9 +124,7 @@ Construct a post-condition for a certain amount of uSTX to be sent.
- ```ts twoslash
- // @noErrors
- // [!code word:willSendEq]
+ ```ts
import { Pc } from '@stacks/transactions';
const postCondition = Pc.principal('STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6')
@@ -141,9 +133,7 @@ Construct a post-condition for a certain amount of uSTX to be sent.
```
- ```ts twoslash
- // @noErrors
- // [!code word:Equal]
+ ```ts
import { createSTXPostCondition, FungibleConditionCode } from '@stacks/transactions';
const postCondition = createSTXPostCondition(
@@ -161,9 +151,7 @@ Construct a post-condition for a certain amount of a specific FT to be sent.
- ```ts twoslash
- // @noErrors
- // [!code word:willSendGte]
+ ```ts
import { Pc } from '@stacks/transactions';
const postCondition = Pc.principal('STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6.token-ft')
@@ -172,9 +160,7 @@ Construct a post-condition for a certain amount of a specific FT to be sent.
```
- ```ts twoslash
- // @noErrors
- // [!code word:GreaterEqual]
+ ```ts
import { createSTXPostCondition, FungibleConditionCode } from '@stacks/transactions';
const postCondition = createSTXPostCondition(
@@ -193,9 +179,7 @@ Construct a post-condition for sending / not-sending a specific NFT.
- ```ts twoslash
- // @noErrors
- // [!code word:willNotSendAsset]
+ ```ts
import { Pc } from '@stacks/transactions';
const postCondition = Pc.principal('STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6')
@@ -204,9 +188,7 @@ Construct a post-condition for sending / not-sending a specific NFT.
```
- ```ts twoslash
- // @noErrors
- // [!code word:DoesNotSend]
+ ```ts
import { createNonFungiblePostCondition, NonFungibleConditionCode } from '@stacks/transactions';
const postCondition = createNonFungiblePostCondition(
diff --git a/content/docs/stacks/stacks.js/guides/use-with-react-native.mdx b/content/docs/stacks/stacks.js/guides/use-with-react-native.mdx
index 1fbd4daff..9fc9977ba 100644
--- a/content/docs/stacks/stacks.js/guides/use-with-react-native.mdx
+++ b/content/docs/stacks/stacks.js/guides/use-with-react-native.mdx
@@ -27,8 +27,8 @@ In this guide, you will learn how to:
Start by creating a new Expo project using `create-expo-app`.
-```console title="Terminal"
-npx create-expo-app@latest
+```terminal
+$ npx create-expo-app@latest
```
This will generate a boilerplate Expo project. You can run the project with `npm start` and connect a mobile device for previewing via the shown QR code.
@@ -37,20 +37,20 @@ This will generate a boilerplate Expo project. You can run the project with `npm
Install Stacks.js libraries along with other dependencies needed for polyfilling browser-specific and NodeJS-specific APIs.
-```console title="Terminal"
-npm install @stacks/transactions @stacks/wallet-sdk
-npm install --save-dev buffer process react-native-get-random-values text-encoding readable-stream crypto-browserify @peculiar/webcrypto
+```terminal
+$ npm install @stacks/transactions @stacks/wallet-sdk
+$ npm install --save-dev buffer process react-native-get-random-values text-encoding readable-stream crypto-browserify @peculiar/webcrypto
```
## Add NodeJS polyfills
Modify the project's Metro configuration to include polyfills for missing NodeJS modules.
-```console title="Terminal"
-npx expo customize metro.config.js
+```terminal
+$ npx expo customize metro.config.js
```
-```js title="metro.config.js"
+```js metro.config.js
const { getDefaultConfig } = require("expo/metro-config");
const config = getDefaultConfig(__dirname);
@@ -71,7 +71,7 @@ Update the Expo entry point to include polyfills.
2. Create `index.js` file
3. Update the `package.json`
-```js title="polyfill.js"
+```js polyfill.js
import { Buffer } from "buffer/";
import process from "process";
import "react-native-get-random-values";
@@ -83,7 +83,7 @@ global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
```
-```js title="index.js"
+```js index.js
import "./polyfill";
import { Crypto } from "@peculiar/webcrypto";
@@ -92,8 +92,8 @@ Object.assign(global.crypto, new Crypto());
import "expo-router/entry";
```
-```json title="package.json"
-"main": "index.js", // [!code highlight]
+```json package.json
+"main": "index.js",
```
@@ -104,8 +104,7 @@ Ensure that the polyfills live in their own file as specified to avoid any runti
Edit the `app/(tabs)/index.tsx` file to integrate Stacks.js functionalities, starting with the imports.
-```tsx twoslash title="app/(tabs)/index.tsx"
-// @noErrors
+```tsx app/(tabs)/index.tsx
import {
TransactionVersion,
getAddressFromPrivateKey,
@@ -117,8 +116,7 @@ import { useState } from "react";
Now you can start to manage the state as follows:
-```tsx twoslash title="app/(tabs)/index.tsx"
-// @noErrors
+```tsx app/(tabs)/index.tsx
export default function HomeScreen() {
const [mnemonic, setMnemonic] = useState("...");
const [wallet, setWallet] = useState(null);
@@ -128,8 +126,7 @@ export default function HomeScreen() {
Next, to generate a wallet and sign a transaction:
-```tsx twoslash title="app/(tabs)/index.tsx"
-// @noErrors
+```tsx app/(tabs)/index.tsx
const generate = async () => {
const mnemonic = generateSecretKey();
setMnemonic(mnemonic);
@@ -155,8 +152,7 @@ const generate = async () => {
And lastly, to integrate the UI:
-```tsx twoslash title="app/(tabs)/index.tsx"
-// @noErrors
+```tsx app/(tabs)/index.tsx
Seed Phrase{mnemonic}
diff --git a/content/docs/stacks/stacks.js/index.mdx b/content/docs/stacks/stacks.js/index.mdx
index e442c2775..1632ea6d5 100644
--- a/content/docs/stacks/stacks.js/index.mdx
+++ b/content/docs/stacks/stacks.js/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: A collection of JavaScript libraries to build web applications on Stacks.
-toc: false
---
import { Globe } from 'lucide-react';
@@ -13,13 +12,12 @@ Stacks.js is separated into many smaller packages, which can be installed indivi
For more details, check out out our [installation guide](./stacks.js/installation).
-}
href="/stacks/connect"
title="Build a Stacks web app"
description="Integrate Stacks.js into your web apps with Stacks Connect."
- className="relative bg-gradient-to-r from-[hsl(var(--border)/1)] via-sky-500/30 to-sky-500/50 border-none hover:bg-gradient-to-r hover:from-border hover:to-[#59564F] dark:hover:to-[#c0bdb4]"
- innerClassName='bg-gradient-to-tr from-transparent to-sky-500/20'
+ tag="Stacks Connect"
/>
## Guides
diff --git a/content/docs/stacks/stacks.js/installation.mdx b/content/docs/stacks/stacks.js/installation.mdx
index b2a546bcf..1a4e407d3 100644
--- a/content/docs/stacks/stacks.js/installation.mdx
+++ b/content/docs/stacks/stacks.js/installation.mdx
@@ -1,7 +1,6 @@
---
title: Installation
description: Installing Stacks.js packages.
-toc: false
---
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
diff --git a/content/docs/stacks/stacks.js/packages/common.mdx b/content/docs/stacks/stacks.js/packages/common.mdx
index ee020c755..562cf2802 100644
--- a/content/docs/stacks/stacks.js/packages/common.mdx
+++ b/content/docs/stacks/stacks.js/packages/common.mdx
@@ -5,7 +5,7 @@ toc: false
---
import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
+import { Property } from 'fumadocs-openapi/ui'
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
diff --git a/content/docs/stacks/stacks.js/packages/network.mdx b/content/docs/stacks/stacks.js/packages/network.mdx
index bf8eef0de..e4969c41b 100644
--- a/content/docs/stacks/stacks.js/packages/network.mdx
+++ b/content/docs/stacks/stacks.js/packages/network.mdx
@@ -5,7 +5,7 @@ toc: false
---
import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
+import { Property } from 'fumadocs-openapi/ui'
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
@@ -55,7 +55,6 @@ console.log(STACKS_MAINNET);
## Network usage in transaction building
```ts
-// [!code word:network\:]
import { STACKS_MAINNET } from '@stacks/network';
import { makeSTXTokenTransfer } from '@stacks/transactions';
diff --git a/content/docs/stacks/stacks.js/packages/transactions.mdx b/content/docs/stacks/stacks.js/packages/transactions.mdx
index 8db50e129..10710f0d6 100644
--- a/content/docs/stacks/stacks.js/packages/transactions.mdx
+++ b/content/docs/stacks/stacks.js/packages/transactions.mdx
@@ -5,7 +5,7 @@ toc: false
---
import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
+import { Property } from 'fumadocs-openapi/ui'
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
@@ -284,24 +284,15 @@ const result = await callReadOnlyFunction(options);
Building transactions that call functions in deployed clarity contracts requires you to construct valid Clarity Values to pass to the function as arguments. The [Clarity type system](https://github.com/stacksgov/sips/blob/master/sip/sip-002-smart-contract-language.md#clarity-type-system) contains the following types:
-- `(tuple (key-name-0 key-type-0) (key-name-1 key-type-1) ...)`
- - a typed tuple with named fields.
-- `(list max-len entry-type)`
- - a list of maximum length max-len, with entries of type entry-type
-- `(response ok-type err-type)`
- - object used by public functions to commit their changes or abort. May be returned or used by other functions as well, however, only public functions have the commit/abort behavior.
-- `(optional some-type)`
- - an option type for objects that can either be (some value) or none
-- `(buff max-len)`
- - byte buffer or maximum length max-len.
-- `principal`
- - object representing a principal (whether a contract principal or standard principal).
-- `bool`
- - boolean value ('true or 'false)
-- `int`
- - signed 128-bit integer
-- `uint`
- - unsigned 128-bit integer
+- `(tuple (key-name-0 key-type-0) (key-name-1 key-type-1) ...)` : a typed tuple with named fields.
+- `(list max-len entry-type)` : a list of maximum length max-len, with entries of type entry-type
+- `(response ok-type err-type)` : object used by public functions to commit their changes or abort. May be returned or used by other functions as well, however, only public functions have the commit/abort behavior.
+- `(optional some-type)` : an option type for objects that can either be (some value) or none
+- `(buff max-len)` : byte buffer or maximum length max-len.
+- `principal` : object representing a principal (whether a contract principal or standard principal).
+- `bool` : boolean value (`true` or `false`)
+- `int` : signed 128-bit integer
+- `uint`: unsigned 128-bit integer
This library contains Typescript types and classes that map to the Clarity types, in order to make it easy to construct well-typed Clarity values in Javascript. These types all extend the abstract class `ClarityValue`.
diff --git a/content/docs/stacks/stacks.js/quickstart.mdx b/content/docs/stacks/stacks.js/quickstart.mdx
index 58475c5f7..f13dab27b 100644
--- a/content/docs/stacks/stacks.js/quickstart.mdx
+++ b/content/docs/stacks/stacks.js/quickstart.mdx
@@ -40,9 +40,7 @@ Check out the [reference page](/stacks/stacks.js/packages/transactions) for `@st
The `senderKey` is the private key of the sender's wallet.
- ```ts twoslash title="stx-transfer.ts"
- // @noErrors
- // [!code word:makeSTXTokenTransfer]
+ ```ts stx-transfer.ts
import { AnchorMode, makeSTXTokenTransfer, broadcastTransaction } from "@stacks/transactions";
import { StacksDevnet } from "@stacks/network";
@@ -80,9 +78,7 @@ Check out the [reference page](/stacks/stacks.js/packages/transactions) for `@st
Once you've constructed a valid transaction, you can broadcast it to the network using the `broadcastTransaction` function.
- ```ts twoslash title="stx-transfer.ts"
- // @noErrors
- // [!code word:broadcastTransaction]
+ ```ts stx-transfer.ts
import { AnchorMode, makeSTXTokenTransfer, broadcastTransaction } from "@stacks/transactions";
import { StacksDevnet } from "@stacks/network";
diff --git a/content/docs/stacks/stacks.js/roadmap.mdx b/content/docs/stacks/stacks.js/roadmap.mdx
index 21e7f9423..468f64377 100644
--- a/content/docs/stacks/stacks.js/roadmap.mdx
+++ b/content/docs/stacks/stacks.js/roadmap.mdx
@@ -6,13 +6,11 @@ description: Discover the future of Stacks.js.
Read about what's new in the latest version of Stacks.js.
This version comes with a lot of improvements and new features, but it also adds some breaking changes.
-
Want to use these latest features? Install packages using the `latest` tag:
```package-install
-@stacks/transactions@latest
+@stacks/{common,network,transactions}@latest
```
-
### Strings
_aka, reducing wrapper types and magic numbers_
@@ -33,23 +31,18 @@ This makes them easier to inspect and diff.
Clarity example, [Read more](#clarity-representation)
```ts
-// [!code word:OLD]
-// [!code word:NEW]
-// OLD:
+// !diff -
{ type: 1, value: 12n }
-
-// NEW:
+// !diff +
{ type: "uint", value: "12" }
```
Private key example, [Read more](/stacks/stacks.js/concepts/private-keys)
```ts
-// [!code word:OLD]
-// [!code word:NEW]
signMessageHashRsv({
- // OLD:
+ // !diff -
privateKey: createStacksPrivateKey("f5a3...2801"), // { compressed: true, data: [245,163,...] }
- // NEW:
+ // !diff +
privateKey: "f5a3...2801"
})
```
@@ -73,19 +66,13 @@ In most cases, developers shouldn't need the `@stacks/network` package anymore.
The `network` parameter can be used with string literals: `'mainnet'`, `'testnet'`, `'devnet'`, `'mocknet'`.
```ts
-// [!code word:OLD]
-// [!code word:NEW]
-// OLD:
import { StacksTestnet } from '@stacks/network';
makeSTXTokenTransfer({
- network: new StacksTestnet(), // [!code highlight]
- // ...
-});
-
-// NEW:
-makeSTXTokenTransfer({
- network: 'testnet' // [!code highlight]
+ // !diff -
+ network: new StacksTestnet(),
+ // !diff +
+ network: 'testnet'
// ...
});
```
@@ -103,12 +90,14 @@ The `client` parameter can be any object-like structure containing a `baseUrl` a
The following diffs show examples of how to migrate to the new pattern.
-```diff
+```ts
const transaction = await makeSTXTokenTransfer({
- // ...
-- network: new StacksTestnet({ url: "mynode-optional.com", fetchFn: myFetch }), // optional options
-+ network: 'testnet', // optional, defaults to 'mainnet'
-+ client: { baseUrl: "mynode-optional.com", fetch: myFetchOptional } // optional, defaults inferred from network
+// !diff -
+network: new StacksTestnet({ url: "mynode-optional.com", fetchFn: myFetch }),
+// !diff +
+network: 'testnet', // optional, defaults to 'mainnet'
+// !diff +
+client: { baseUrl: "mynode-optional.com", fetch: myFetchOptional } // optional, defaults inferred from network
});
```
@@ -116,19 +105,20 @@ The `client` property is also part of the network object.
You can still keep ONE single network object for your whole application.
```ts
-// [!code word:OLD]
-// [!code word:NEW]
-// OLD:
+// !diff -
import { StacksTestnet } from '@stacks/network';
-
-const network = new StacksTestnet({ url: "https://mynode.com", fetchFn: myFetch });
-
-// NEW:
+// !diff +
import { STACKS_TESTNET } from '@stacks/network';
+// !diff -
+const network = new StacksTestnet({ url: "https://mynode.com", fetchFn: myFetch });
+// !diff +
const network = {
+ // !diff +
...STACKS_TESTNET, // extending a static object
+ // !diff +
client: { baseUrl: "https://mynode.com", fetch: myFetch }
+ // !diff +
};
```
@@ -139,7 +129,6 @@ The naming is consistent across the board and uses `A To B` naming.
For example, if we have a private key and want to get the address, we can use the `privateKeyToAddress` function.
```ts
-// [!code word:privateKeyToAddress]
import { privateKeyToAddress } from "@stacks/transactions";
const privateKey = "f5a3...2801";
@@ -173,21 +162,29 @@ The property holding the value of the data type is now called `value` in all cas
Previously, there was a mix of `value`, `list`, `buffer` etc.
For `bigint` values, the type of the `value` property is a now `string`, for better serialization compatibility.
-```diff
+```ts
{
-- type: 1,
-+ type: "uint",
-- value: 12n,
-+ value: "12",
+ // !diff -
+ type: 1,
+ // !diff +
+ type: "uint",
+ // !diff -
+ value: 12n,
+ // !diff +
+ value: "12",
}
```
-```diff
+```ts
{
-- type: 11,
-+ type: "list",
-- list: [ ... ],
-+ value: [ ... ],
+ // !diff -
+ type: 11,
+ // !diff +
+ type: "list",
+ // !diff -
+ list: [ ... ],
+ // !diff +
+ value: [ ... ],
}
```
diff --git a/content/docs/stacks/stacks.js/v6/network.mdx b/content/docs/stacks/stacks.js/v6/network.mdx
index 10628eeb8..3d2191f16 100644
--- a/content/docs/stacks/stacks.js/v6/network.mdx
+++ b/content/docs/stacks/stacks.js/v6/network.mdx
@@ -5,7 +5,7 @@ toc: false
---
import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
+import { Property } from 'fumadocs-openapi/ui'
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
diff --git a/content/docs/stacks/stacks.js/v6/transactions.mdx b/content/docs/stacks/stacks.js/v6/transactions.mdx
index 659ba6cc2..e7c1809a3 100644
--- a/content/docs/stacks/stacks.js/v6/transactions.mdx
+++ b/content/docs/stacks/stacks.js/v6/transactions.mdx
@@ -5,7 +5,7 @@ toc: false
---
import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
+import { Property } from 'fumadocs-openapi/ui'
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
@@ -854,24 +854,15 @@ const result = await callReadOnlyFunction(options);
Building transactions that call functions in deployed clarity contracts requires you to construct valid Clarity Values to pass to the function as arguments. The [Clarity type system](https://github.com/stacksgov/sips/blob/master/sip/sip-002-smart-contract-language.md#clarity-type-system) contains the following types:
-- `(tuple (key-name-0 key-type-0) (key-name-1 key-type-1) ...)`
- - a typed tuple with named fields.
-- `(list max-len entry-type)`
- - a list of maximum length max-len, with entries of type entry-type
-- `(response ok-type err-type)`
- - object used by public functions to commit their changes or abort. May be returned or used by other functions as well, however, only public functions have the commit/abort behavior.
-- `(optional some-type)`
- - an option type for objects that can either be (some value) or none
-- `(buff max-len)`
- - byte buffer or maximum length max-len.
-- `principal`
- - object representing a principal (whether a contract principal or standard principal).
-- `bool`
- - boolean value ('true or 'false)
-- `int`
- - signed 128-bit integer
-- `uint`
- - unsigned 128-bit integer
+- `(tuple (key-name-0 key-type-0) (key-name-1 key-type-1) ...)` : a typed tuple with named fields.
+- `(list max-len entry-type)` : a list of maximum length max-len, with entries of type entry-type
+- `(response ok-type err-type)` : object used by public functions to commit their changes or abort. May be returned or used by other functions as well, however, only public functions have the commit/abort behavior.
+- `(optional some-type)` : an option type for objects that can either be (some value) or none
+- `(buff max-len)` : byte buffer or maximum length max-len.
+- `principal` : object representing a principal (whether a contract principal or standard principal).
+- `bool` : boolean value (`true` or `false`)
+- `int` : signed 128-bit integer
+- `uint`: unsigned 128-bit integer
This library contains Typescript types and classes that map to the Clarity types, in order to make it easy to construct well-typed Clarity values in Javascript. These types all extend the abstract class `ClarityValue`.
diff --git a/content/docs/stacks/token-metadata-api/client/index.mdx b/content/docs/stacks/token-metadata-api/client/index.mdx
index a72f2dcf0..79190e2b9 100644
--- a/content/docs/stacks/token-metadata-api/client/index.mdx
+++ b/content/docs/stacks/token-metadata-api/client/index.mdx
@@ -12,8 +12,7 @@ The `@stacks/blockchain-api-client` library provides a robust interface for inte
The client includes automatically generated HTTP API methods, comprehensive Schemas for Clarity smart contract values, and a WebSocket client for real-time data streaming.
-```ts twoslash
-// @noErrors
+```ts
import { AccountsApi } from '@stacks/blockchain-api-client';
const accounts = new AccountsApi(apiConfig);
diff --git a/content/docs/stacks/token-metadata-api/client/tokens/get-ft-metadata.mdx b/content/docs/stacks/token-metadata-api/client/tokens/get-ft-metadata.mdx
index 031dcabc3..f059f0b91 100644
--- a/content/docs/stacks/token-metadata-api/client/tokens/get-ft-metadata.mdx
+++ b/content/docs/stacks/token-metadata-api/client/tokens/get-ft-metadata.mdx
@@ -5,7 +5,7 @@ toc: false
---
import { Root, API, APIExample } from '@/components/layout';
-import { Property } from 'fumadocs-ui/components/api'
+import { Property } from 'fumadocs-openapi/ui'
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
@@ -42,8 +42,7 @@ Optional overrides for the request initialization settings.
- ```tsx twoslash
- // @noErrors
+ ```tsx
import { Configuration, AccountsApi } from '@stacks/blockchain-api-client';
const apiConfig = new Configuration({
@@ -61,7 +60,7 @@ Optional overrides for the request initialization settings.
- ```tsx twoslash
+ ```tsx
import {
UserSession,
makeAuthRequest,
@@ -171,10 +170,7 @@ Decrypts user data for secure storage.
- ```tsx twoslash
- // @noErrors
- // [!code word:isSignInPending]
- // [!code word:handlePendingSignIn]
+ ```tsx
const isPending = userSession.isSignInPending();
if (isPending) {
@@ -185,16 +181,12 @@ Decrypts user data for secure storage.
```
- ```tsx twoslash
- // @noErrors
- // [!code word:isUserSignedIn]
+ ```tsx
const isSignedIn = userSession.isUserSignedIn();
```
- ```tsx twoslash
- // @noErrors
- // [!code word:loadUserData]
+ ```tsx
const isSignedIn = userSession.isUserSignedIn();
if (isSignedIn) {
@@ -204,27 +196,21 @@ Decrypts user data for secure storage.
```
- ```tsx twoslash
- // @noErrors
- // [!code word:signUserOut]
+ ```tsx
function logout() {
userSession.signUserOut();
}
```
- ```tsx twoslash
- // @noErrors
- // [!code word:encryptContent]
+ ```tsx
const message = 'My secret message';
const cipherText = await userSession.encryptContent(message);
```
- ```tsx twoslash
- // @noErrors
- // [!code word:decryptContent]
+ ```tsx
const message = 'My secret message';
const cipherText = await userSession.encryptContent(message);
diff --git a/content/docs/stacks/token-metadata-api/index.mdx b/content/docs/stacks/token-metadata-api/index.mdx
index 7022f1459..459c83300 100644
--- a/content/docs/stacks/token-metadata-api/index.mdx
+++ b/content/docs/stacks/token-metadata-api/index.mdx
@@ -1,7 +1,6 @@
---
title: Overview
description: Fetch data for any fungible, non-fungible, and semi-fungible token on Stacks.
-toc: false
---
import { SecondaryCard } from '@/components/card';
diff --git a/content/docs/stacks/token-metadata-api/info/status.mdx b/content/docs/stacks/token-metadata-api/info/status.mdx
index 2e117391d..e8f8c9153 100644
--- a/content/docs/stacks/token-metadata-api/info/status.mdx
+++ b/content/docs/stacks/token-metadata-api/info/status.mdx
@@ -46,8 +46,8 @@ Displays the status of the API and its current workload
-```bash
-curl -X GET "https://api.hiro.so/metadata/v1/"
+```terminal
+$ curl -X GET "https://api.hiro.so/metadata/v1/"
```
diff --git a/content/docs/stacks/token-metadata-api/tokens/fungible-token-metadata.mdx b/content/docs/stacks/token-metadata-api/tokens/fungible-token-metadata.mdx
index 596be917b..7096972b6 100644
--- a/content/docs/stacks/token-metadata-api/tokens/fungible-token-metadata.mdx
+++ b/content/docs/stacks/token-metadata-api/tokens/fungible-token-metadata.mdx
@@ -68,8 +68,8 @@ Principal for the contract which owns the SIP-010 token
-```bash
-curl -X GET "https://api.hiro.so/metadata/v1/ft/SP32XCD69XPS3GKDEXAQ29PJRDSD5AR643GNEEBXZ.fari-token?locale=string"
+```terminal
+$ curl -X GET "https://api.hiro.so/metadata/v1/ft/SP32XCD69XPS3GKDEXAQ29PJRDSD5AR643GNEEBXZ.fari-token?locale=string"
```
diff --git a/content/docs/stacks/token-metadata-api/tokens/fungible-tokens.mdx b/content/docs/stacks/token-metadata-api/tokens/fungible-tokens.mdx
index 4cb7b74b7..70f803879 100644
--- a/content/docs/stacks/token-metadata-api/tokens/fungible-tokens.mdx
+++ b/content/docs/stacks/token-metadata-api/tokens/fungible-tokens.mdx
@@ -96,8 +96,8 @@ Results order
-```bash
-curl -X GET "https://api.hiro.so/metadata/v1/ft?name=string&symbol=string&address=SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9&offset=0&limit=1&order_by=name&order=asc"
+```terminal
+$ curl -X GET "https://api.hiro.so/metadata/v1/ft?name=string&symbol=string&address=SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9&offset=0&limit=1&order_by=name&order=asc"
```
diff --git a/content/docs/stacks/token-metadata-api/tokens/non-fungible-token-metadata.mdx b/content/docs/stacks/token-metadata-api/tokens/non-fungible-token-metadata.mdx
index d52d2f7b6..4089ca51d 100644
--- a/content/docs/stacks/token-metadata-api/tokens/non-fungible-token-metadata.mdx
+++ b/content/docs/stacks/token-metadata-api/tokens/non-fungible-token-metadata.mdx
@@ -76,8 +76,8 @@ Token ID to retrieve
-```bash
-curl -X GET "https://api.hiro.so/metadata/v1/nft/SP497E7RX3233ATBS2AB9G4WTHB63X5PBSP5VGAQ.boomboxes-cycle-12/35?locale=string"
+```terminal
+$ curl -X GET "https://api.hiro.so/metadata/v1/nft/SP497E7RX3233ATBS2AB9G4WTHB63X5PBSP5VGAQ.boomboxes-cycle-12/35?locale=string"
```
diff --git a/content/docs/stacks/token-metadata-api/tokens/semi-fungible-token-metadata.mdx b/content/docs/stacks/token-metadata-api/tokens/semi-fungible-token-metadata.mdx
index 5db27d276..0016d1d1c 100644
--- a/content/docs/stacks/token-metadata-api/tokens/semi-fungible-token-metadata.mdx
+++ b/content/docs/stacks/token-metadata-api/tokens/semi-fungible-token-metadata.mdx
@@ -76,8 +76,8 @@ Token ID to retrieve
-```bash
-curl -X GET "https://api.hiro.so/metadata/v1/sft/SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.key-alex-autoalex-v1/35?locale=string"
+```terminal
+$ curl -X GET "https://api.hiro.so/metadata/v1/sft/SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.key-alex-autoalex-v1/35?locale=string"
```
diff --git a/content/docs/stacks/token-metadata-api/usage.mdx b/content/docs/stacks/token-metadata-api/usage.mdx
index 2118d986a..989a2aae3 100644
--- a/content/docs/stacks/token-metadata-api/usage.mdx
+++ b/content/docs/stacks/token-metadata-api/usage.mdx
@@ -7,17 +7,16 @@ description: Go over the multiple ways to make requests to the Token Metadata AP
To make a request to the Stacks API, you can paste the `curl` command below in your terminal.
-```console title="Terminal"
-curl -L 'https://api.hiro.so/metadata/v1/' \
--H 'Accept: application/json'
+```terminal
+$ curl -L 'https://api.hiro.so/metadata/v1/' -H 'Accept: application/json'
```
If you are using an `api-key`, you will need to replace `$HIRO_API_KEY` with your secret API key.
-```console title="Terminal"
-curl -L 'https://api.hiro.so/metadata/v1/' \
--H 'Accept: application/json' \
--H 'X-API-Key: $HIRO_API_KEY' # [!code highlight]
+```terminal
+$ curl -L 'https://api.hiro.so/metadata/v1/' \
+ -H 'Accept: application/json' \
+ -H 'X-API-Key: $HIRO_API_KEY'
```
You should get a response back that resembles the following:
@@ -53,8 +52,7 @@ We also maintain a standalone API client that you can use to make requests to th
Example usage:
-```ts twoslash
-// @noErrors
+```ts
import { Configuration, TokensApi } from "@hirosystems/token-metadata-api-client";
const config: Configuration = {}
diff --git a/hooks/use-mobile.tsx b/hooks/use-mobile.tsx
new file mode 100644
index 000000000..2b0fe1dfe
--- /dev/null
+++ b/hooks/use-mobile.tsx
@@ -0,0 +1,19 @@
+import * as React from "react"
+
+const MOBILE_BREAKPOINT = 768
+
+export function useIsMobile() {
+ const [isMobile, setIsMobile] = React.useState(undefined)
+
+ React.useEffect(() => {
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
+ const onChange = () => {
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
+ }
+ mql.addEventListener("change", onChange)
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
+ return () => mql.removeEventListener("change", onChange)
+ }, [])
+
+ return !!isMobile
+}
diff --git a/utils/cn.ts b/lib/utils.ts
similarity index 68%
rename from utils/cn.ts
rename to lib/utils.ts
index abdb16cd2..a5ef19350 100644
--- a/utils/cn.ts
+++ b/lib/utils.ts
@@ -1,5 +1,4 @@
-// lib/utils.ts
-import clsx, { ClassValue } from "clsx";
+import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
diff --git a/mdx-components.tsx b/mdx-components.tsx
index 8c495997b..e831a4ef4 100644
--- a/mdx-components.tsx
+++ b/mdx-components.tsx
@@ -1,52 +1,40 @@
import type { MDXComponents } from "mdx/types";
import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
import { Callout } from "@/components/callout";
+import { Cards, Card, SecondaryCard } from "@/components/card";
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
import { TypeTable } from "fumadocs-ui/components/type-table";
import defaultComponents from "fumadocs-ui/mdx";
-import {
- CodeBlock,
- type CodeBlockProps,
- Pre,
-} from "fumadocs-ui/components/codeblock";
-import type { ReactNode } from "react";
-import { Popup, PopupContent, PopupTrigger } from "fumadocs-ui/twoslash/popup";
-import { cn } from "./utils/cn";
-
-const shortcuts: Record = {
- stacks: "./content/docs/stacks/props.ts",
- ordinals: "./content/docs/bitcoin/props.ts",
-};
+import { docskit } from "@/components/docskit/components";
+import { CustomTable as Table, TableProps } from "@/components/table";
+import { OrderedList, UnorderedList } from "@/components/lists";
export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...defaultComponents,
- Popup,
- PopupContent,
- PopupTrigger,
- pre: ({ title, className, icon, allowCopy, ...props }: CodeBlockProps) => (
-
-
-
- ),
- Tabs,
- Tab,
- Callout,
- TypeTable,
Accordion,
Accordions,
- InstallTabs: ({
- items,
- children,
- }: {
- items: string[];
- children: ReactNode;
- }) => (
-
- {children}
-
- ),
blockquote: (props) => {props.children},
+ Callout,
+ Cards,
+ Card,
+ SecondaryCard,
+ code: (props) => (
+
+ ),
+ hr: (props) => (
+
+ ),
+ Tab,
+ Tabs,
+ table: (props: TableProps) =>