Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docs (links, shield, examples) #579

Merged
merged 8 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<h1 align="center" style="margin-top: 12px !important">Starknet Devnet RS</h1>

<p align="center" dir="auto">
<a href="https://crates.io/crates/starknet-devnet" target="_blank">
<img src="https://img.shields.io/crates/v/starknet-devnet?color=yellow" style="max-width: 100%;">
</a>
<a href="https://hub.docker.com/r/shardlabs/starknet-devnet-rs/tags" target="_blank">
<img src="https://img.shields.io/badge/dockerhub-images-important.svg?logo=Docker" style="max-width: 100%;">
</a>
Expand All @@ -16,7 +19,7 @@

A local testnet for Starknet... in Rust!

### Features
## Features

- [Forking](https://0xspaceshard.github.io/starknet-devnet-rs/docs/forking) - interact with contracts deployed on mainnet or testnet
- [Account impersonation](https://0xspaceshard.github.io/starknet-devnet-rs/docs/account-impersonation)
Expand All @@ -31,6 +34,10 @@ A local testnet for Starknet... in Rust!

Find the official documentation [here](https://0xspaceshard.github.io/starknet-devnet-rs/).

## starknet-devnet-js

Simplify the installation, spawning and usage of Devnet in your tests by relying on the official JavaScript wrapper. Read more [here](https://github.com/0xspaceShard/starknet-devnet-js).

## ✏️ Contributing

We ❤️ and encourage all contributions and thank all the [contributors](https://github.com/0xSpaceShard/starknet-devnet-rs/graphs/contributors)!
Expand Down
16 changes: 12 additions & 4 deletions website/docs/api.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 3
---

# API

## JSON-RPC API
Expand All @@ -10,17 +14,21 @@ Unlike Pythonic Devnet, which also supported Starknet's gateway and feeder gatew

### Devnet API

Devnet has many additional features which are available via their own endpoints and JSON-RPC, which are all mentioned throughout the documentation.
Devnet has many additional features which are available via their own endpoints and JSON-RPC, which are all mentioned throughout the documentation. New features are only supported as part of the JSON-RPC API. Older non-RPC requests are still supported, but considered deprecated - they will be removed in the future, except the [healthcheck endpoint](#healthcheck).

#### Healthcheck

To check if a Devnet instance is alive, send an HTTP request `GET /is_alive`. If alive, the Devnet will reply with a `200 OK` and an appropriate message.

## Interacting with Devnet in JavaScript and TypeScript

To interact with Devnet using the [Devnet API](#devnet-api), you can use [`starknet-devnet-js`](https://github.com/0xSpaceShard/starknet-devnet-js/). This can be especially useful in achieving [L1-L2 communication](./postman.md#l1-l2-interaction-via-postman).
To spawn Devnet and interact with it using the [Devnet API](#devnet-api), you can use [`starknet-devnet-js`](https://github.com/0xSpaceShard/starknet-devnet-js/). This can be especially useful in achieving [L1-L2 communication](./postman.md#l1-l2-interaction-via-postman).

To interact with Devnet usings the [Starknet API](#starknet-api), use [starknet.js](https://www.starknetjs.com/).
To interact with Devnet using the [Starknet API](#starknet-api), use [starknet.js](https://www.starknetjs.com/).

## Config API

To retrieve the current configuration of Devnet, send a `GET` request to `/config` or `JSON-RPC` request with method name `devnet_getConfig`. Example response is attached below. It can be interpreted as a JSON mapping of CLI input parameters, both specified and default ones, with some irrelevant parameters omitted. So use `starknet-devnet --help` to better understand the meaning of each value, though keep in mind that some of the parameters have slightly modified names.
To retrieve the current configuration of Devnet, as specified via [CLI](running/cli.md) and later requests, send a `GET` request to `/config` or `JSON-RPC` request with method name `devnet_getConfig`. Example response is attached below. It can be interpreted as a JSON mapping of CLI input parameters, both specified and default ones, with some irrelevant parameters omitted. So use `starknet-devnet --help` to better understand the meaning of each value, though keep in mind that some of the parameters have slightly modified names.

```json
{
Expand Down
3 changes: 3 additions & 0 deletions website/docs/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Examples

Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test).
2 changes: 1 addition & 1 deletion website/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ You may now proceed with [running Devnet](./running/install) and checking out th

# Limits

As mentioned [here](https://docs.starknet.io/tools/limits-and-triggers/), Starknet currently has a number of limits in place in order to keep the network stable and optimized for the best performance. Devnet uses the limits defined on that page, and for block-level limits, values defined [here (provided by the Blockifier team)](https://github.com/0xSpaceShard/starknet-devnet-rs/blob/main/crates/starknet-devnet-core/src/utils.rs). The block-level limits are considered only when executing transactions, not when constructing the blocks themselves. I.e. if a transaction's usage of a resource exceeds its defined block-level limit, it will be reverted; but if the cumulative usage of all transactions in a block of one resource exceeds the block limit, the block will still be generated.
As mentioned [here](https://docs.starknet.io/tools/limits-and-triggers/), "Starknet currently has a number of limits in place in order to keep the network stable and optimized for the best performance." Devnet uses the limits defined on that page and, for block-level limits, values defined [here (provided by the Blockifier team)](https://github.com/0xSpaceShard/starknet-devnet-rs/blob/main/crates/starknet-devnet-core/src/utils.rs). The block-level limits are considered only when executing transactions, not when constructing the blocks themselves. I.e. if a transaction's usage of a resource exceeds its defined block-level limit, it will be reverted; but if the cumulative usage of all transactions in a block of one resource exceeds the block limit, the block will still be generated.
2 changes: 1 addition & 1 deletion website/docs/running/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 2.3

# CLI options

Configure your Devnet instance by specifying CLI parameters on startup.
Configure your Devnet instance by specifying CLI parameters on startup. To read more about HTTP and logging configuration, check out the [server config](../server-config) page.

## Help

Expand Down
14 changes: 12 additions & 2 deletions website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ const config: Config = {
position: 'left',
label: 'Docs',
},
{
type: 'doc',
position: 'left',
docId: 'examples',
label: 'Examples',
},
{
type: 'docsVersionDropdown',
position: 'left',
Expand Down Expand Up @@ -97,7 +103,7 @@ const config: Config = {
items: [
{
label: 'Discord',
href: 'https://discordapp.com/channels/793094838509764618/985824027950055434',
href: 'https://discord.com/channels/793094838509764618/1270120259659239424',
},
{
label: 'Starknet',
Expand All @@ -109,9 +115,13 @@ const config: Config = {
title: 'More',
items: [
{
label: 'GitHub',
label: 'Source code',
href: GITHUB_REPO_URL,
},
{
label: 'starknet-devnet-js',
href: 'https://github.com/0xspaceShard/starknet-devnet-js',
},
],
},
],
Expand Down
7 changes: 0 additions & 7 deletions website/src/pages/markdown-page.md

This file was deleted.

3 changes: 3 additions & 0 deletions website/versioned_docs/version-0.1.2/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Examples

Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test).