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

add docs CI, rename docs README to index #4874

Merged
merged 16 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from 11 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
15 changes: 15 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Docs

on:
push:
branches:
- master
pull_request:
release:
types: [published]

jobs:
test:
uses: FuelLabs/github-actions/.github/workflows/mdbook-docs.yml@master
with:
docs-src-path: 'docs/book/src'
22 changes: 0 additions & 22 deletions .github/workflows/markdown-lint.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"default": true # Default state for all rules
"MD013": false # Disable rule for line length
"MD033": false # Disable rule banning inline HTML
"MD033": false # Disable rule banning inline HTML
2 changes: 1 addition & 1 deletion .markdownlintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Licenses for `forc doc` assets

forc-plugins/forc-doc/src/licenses/SourceSerif4-LICENSE.md
forc-plugins/forc-doc/src/licenses/SourceSerif4-LICENSE.md
2 changes: 1 addition & 1 deletion docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Summary

[The Sway Programming Language](./README.md)
[The Sway Programming Language](./index.md)

- [Introduction](./introduction/index.md)
- [Installation](./introduction/installation.md)
Expand Down
4 changes: 2 additions & 2 deletions docs/book/src/advanced/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ trait Trait {
}
```

The initializer expression of an [associated constants](../basic/constants.md#associated-constants) in a trait definition may be omitted to indicate that each implementation of the `trait` for a given type must specify an initializer:
The initializer expression of an [associated constants](../basics/constants.md#associated-constants) in a trait definition may be omitted to indicate that each implementation of the `trait` for a given type must specify an initializer:

```sway
trait Trait {
const ID: u32;
}
```

Check the `associated consts` section on [constants](../basic/constants.md) page.
Check the `associated consts` section on [constants](../basics/constants.md) page.

## Use Cases

Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/basics/commonly_used_library_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Type `Option` represents an optional value: every `Option` is either `Some` and
- Initial values where `None` can be used as an initializer.
- Return value for otherwise reporting simple errors, where `None` is returned on error.

The implementation of `Option` matches on the variant: if it's `Ok` it returns the inner value, if it's `None`, it [reverts](https://github.com/FuelLabs/fuel-specs/blob/master/src/vm/instruction_set.md#rvrt-revert).
The implementation of `Option` matches on the variant: if it's `Ok` it returns the inner value, if it's `None`, it [reverts](https://github.com/FuelLabs/fuel-specs/blob/master/src/fuel-vm/instruction-set.md#rvrt-revert).
<!-- option:example:end -->

```sway
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/basics/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Get started with the basics of Sway:
- [Methods and Associated Functions](./methods_and_associated_functions.md)
- [Constants](./constants.md)
- [Comments and Logging](./comments_and_logging.md)
- [Control Flow](./control_flow.mdz)
- [Control Flow](./control_flow.md)
1 change: 0 additions & 1 deletion docs/book/src/forc/commands/forc_deploy.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/book/src/forc/commands/forc_run.md

This file was deleted.

10 changes: 5 additions & 5 deletions docs/book/src/forc/plugins/forc_client/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you want to run `fuel-core` with UTXO validation, you can pass `--utxo-valida

To install `forc-wallet` please refer to `forc-wallet`'s [github repo](https://github.com/FuelLabs/forc-wallet#forc-wallet).

1. Construct the transaction by using either `forc deploy` or `forc run`. To do so simply run `forc deploy` or `forc run` with your desired parameters. For a list of parameters please refer to the [forc-deploy](./forc_deploy) or [forc-run](./forc_run) section of the book. Once you run either command you will be asked the address of the wallet you are going to be signing with. After the address is given the transaction will be generated and you will be given a transaction ID. At this point CLI will actively wait for you to insert the signature.
1. Construct the transaction by using either `forc deploy` or `forc run`. To do so simply run `forc deploy` or `forc run` with your desired parameters. For a list of parameters please refer to the [forc-deploy](./forc_deploy.md) or [forc-run](./forc_run.md) section of the book. Once you run either command you will be asked the address of the wallet you are going to be signing with. After the address is given the transaction will be generated and you will be given a transaction ID. At this point CLI will actively wait for you to insert the signature.
2. Take the transaction ID generated in the first step and sign it with `forc wallet sign --account <account_index> tx-id <transaction_id>`. This will generate a signature.
3. Take the signature generated in the second step and provide it to `forc-deploy` (or `forc-run`). Once the signature is provided, the signed transaction will be submitted.

Expand Down Expand Up @@ -50,16 +50,16 @@ forc wallet account <account_index>

## Interacting with the testnet

While using `forc-deploy` or `forc-run` to interact with the testnet you need to pass the testnet end point with `--url`
While using `forc-deploy` or `forc-run` to interact with the testnet you need to pass the testnet end point with `--node-url`

```sh
forc-deploy --url https://node-beta-1.fuel.network/graphql:443
forc-deploy --node-url https://beta-3.fuel.network/graphql
```

Since deploying and running projects on the testnet cost gas, you will need coins to pay for them. You can get some using the [testnet faucet](https://faucet-beta-1.fuel.network/).
Since deploying and running projects on the testnet cost gas, you will need coins to pay for them. You can get some using the [testnet faucet](https://faucet-beta-3.fuel.network/).

Also the default value of the "gas price" parameter is 0 for both `forc-deploy` and `forc-run`. Without changing it you will get an error complaining about gas price being too low. While using testnet you can pass `--gas-price 1` to overcome this issue. So a complete command for deploying to the testnet would look like:

```sh
forc-deploy --url https://node-beta-1.fuel.network/graphql:443 --gas-price 1
forc-deploy --node-url https://beta-3.fuel.network/graphql --gas-price 1
```
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/book/src/introduction/sway_quickstart.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Sway Quickstart

Check out the <a target="_blank" rel="noopener noreferrer" href="https://fuelbook.fuel.network/master/quickstart/developer-quickstart.html">Developer Quickstart Guide</a> for a step-by-step guide on building a fullstack dapp on Fuel. The guide will walk you through writing a smart contract, setting up a wallet, and building a frontend to interact with your contract.
Check out the [Developer Quickstart Guide](https://fuelbook.fuel.network/master/quickstart/developer-quickstart.html) for a step-by-step guide on building a fullstack dapp on Fuel. The guide will walk you through writing a smart contract, setting up a wallet, and building a frontend to interact with your contract.
2 changes: 1 addition & 1 deletion docs/book/src/lsp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ In this documentation, you will find detailed information about how to set up Sw
Whether you are a beginner or an experienced Sway developer, this documentation aims to be your go-to resource for understanding and maximizing the capabilities of Sway LSP. So let's dive in and unlock the full potential of the Sway programming language with Sway LSP!

- [Installation](./installation.md)
- [Features](./lsp/features.md)
- [Features](./features.md)
8 changes: 3 additions & 5 deletions docs/book/src/sway-program-types/libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Libraries in Sway are files used to define new common behavior.
<!-- library:example:end -->

The most prominent example of this is the [Sway Standard Library](../introduction/standard_library.html) that is made implicitly available to all Forc projects created using `forc new`.
The most prominent example of this is the [Sway Standard Library](../introduction/standard_library.md) that is made implicitly available to all Forc projects created using `forc new`.

## Writing Libraries

Expand All @@ -20,7 +20,7 @@ library;
// library code
```

A good reference library to use when learning library design is the [Sway Standard Library](../introduction/standard_library.html). For example, the standard library offers an [implementation](https://github.com/FuelLabs/sway/blob/master/sway-lib-std/src/option.sw) of `enum Option<T>` which is a generic type that represents either the existence of a value using the variant `Some(..)` or a value's absence using the variant `None`. The [Sway file implementing `Option<T>`](https://github.com/FuelLabs/sway/blob/master/sway-lib-std/src/option.sw) has the following structure:
A good reference library to use when learning library design is the [Sway Standard Library](../introduction/standard_library.md). For example, the standard library offers an [implementation](https://github.com/FuelLabs/sway/blob/master/sway-lib-std/src/option.sw) of `enum Option<T>` which is a generic type that represents either the existence of a value using the variant `Some(..)` or a value's absence using the variant `None`. The [Sway file implementing `Option<T>`](https://github.com/FuelLabs/sway/blob/master/sway-lib-std/src/option.sw) has the following structure:

- The `library` keyword:

Expand Down Expand Up @@ -192,14 +192,12 @@ Some Sway Libraries to try out:

- [Binary Merkle Proof](https://github.com/FuelLabs/sway-libs/tree/master/libs/merkle_proof)
- [Non-Fungible Token](https://github.com/FuelLabs/sway-libs/tree/master/libs/nft)
- [String](https://github.com/FuelLabs/sway-libs/tree/master/libs/string)
- [Signed Integers](https://github.com/FuelLabs/sway-libs/tree/master/libs/signed_integers)
- [Unsigned Fixed Point Number](https://github.com/FuelLabs/sway-libs/tree/master/libs/fixed_point)
- [StorageMapVec](https://github.com/FuelLabs/sway-libs/tree/master/libs/storagemapvec)

### Example

You can import and use a Sway Library such as the [NFT](https://github.com/FuelLabs/sway-libs/tree/master/sway_libs/src/nft) library just like any other external library.
You can import and use a Sway Library such as the [NFT](https://github.com/FuelLabs/sway-libs/tree/master/libs/nft/src) library just like any other external library.

```sway
use sway_libs::nft::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cargo

Cargo can be used to install the Sway toolchain with various [`plugins`](../../forc/plugins/index.md).
Cargo can be used to install the Sway toolchain with various [`plugins`](https://fuellabs.github.io/sway/master/book/forc/plugins/index.html).

## Dependencies

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ The supported operating systems include Linux and macOS; however, Windows is [`u

`Cargo` may be used instead of [`Fuelup`](fuelup.md); however, the user needs to manage the toolchain themselves.

The advantage of using `Cargo` is the installation of [`plugins`](../../forc/plugins/index.md) that have not been added into [`Fuelup`](fuelup.md).
The advantage of using `Cargo` is the installation of [`plugins`](https://fuellabs.github.io/sway/master/book/forc/plugins/index.html) that have not been added into [`Fuelup`](fuelup.md).
sdankel marked this conversation as resolved.
Show resolved Hide resolved

The disadvantage occurs when [`Fuelup`](fuelup.md) and `Cargo` are used in tandem because the latest [`plugins`](../../forc/plugins/index.md) may not be recognized.
The disadvantage occurs when [`Fuelup`](fuelup.md) and `Cargo` are used in tandem because the latest [`plugins`](https://fuellabs.github.io/sway/master/book/forc/plugins/index.html) may not be recognized.

## Source

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `Sway toolchain` can be built directly from the [`Sway repository`](https://

## Installation & Updating

In the root of the repository `/sway/<here>` build [`forc`](../../forc/commands/index.md) with the following command:
In the root of the repository `/sway/<here>` build [`forc`](https://fuellabs.github.io/sway/master/book/forc/commands/index.html) with the following command:
sdankel marked this conversation as resolved.
Show resolved Hide resolved

```bash
cargo build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A constant in Sway is similar to a variable; however, there are a few differences:

- Constants are always evaluated at compile-time
- Constants can be declared both inside of a [function](../index.md) and at global / `impl` scope.
- Constants can be declared both inside of a [function](../functions/index.md) and at global / `impl` scope.
- The `mut` keyword cannot be used with constants.

## Associated Constants
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Smart Contracts

A smart contract is a piece of bytecode that can be deployed to a blockchain via a [transaction](https://github.com/FuelLabs/fuel-specs/blob/master/src/protocol/tx_format/index.md).
A smart contract is a piece of bytecode that can be deployed to a blockchain via a [transaction](https://github.com/FuelLabs/fuel-specs/blob/master/src/tx-format/index.md).

It can be called in the same way that an API may be called to perform computation and store and retrieve data from a database.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Predicates can neither read from nor write to any contract state. Moreover, they

## Transfer Coins to a Predicate

In Fuel, coins can be sent to an address uniquely representing a particular predicate's bytecode (the bytecode root, calculated [here](https://github.com/FuelLabs/fuel-specs/blob/master/src/protocol/id/contract.md)).
In Fuel, coins can be sent to an address uniquely representing a particular predicate's bytecode (the bytecode root, calculated [here](https://github.com/FuelLabs/fuel-specs/blob/master/src/identifiers/contract-id.md)).

## Spending Predicate Coins

The coin UTXOs become spendable not on the provision of a valid signature, but rather if the supplied predicate both has a root that matches their owner, and [evaluates](https://github.com/FuelLabs/fuel-specs/blob/master/src/vm/index.md#predicate-verification) to `true`.
The coin UTXOs become spendable not on the provision of a valid signature, but rather if the supplied predicate both has a root that matches their owner, and [evaluates](https://github.com/FuelLabs/fuel-specs/blob/master/src/fuel-vm/index.md#predicate-verification) to `true`.

If a predicate reverts, or tries to access impure VM opcodes, the evaluation is automatically `false`.

Expand All @@ -22,7 +22,7 @@ Predicates may introspect the transaction spending their coins (inputs, outputs,

## Example

Similar to a [script](script.md), a predicate consists of a single `main()` function which can take any number of arguments but must return a [Boolean](../built-ins/boolean.md). In order for the predicate to be valid, the returned [Boolean]((../built-ins/boolean.md)) value must be `true`.
Similar to a [script](script.md), a predicate consists of a single `main()` function which can take any number of arguments but must return a [Boolean](../built-ins/boolean.md). In order for the predicate to be valid, the returned [Boolean](../built-ins/boolean.md) value must be `true`.

```sway
{{#include ../../../code/language/program-types/predicates/simple_predicate/src/main.sw}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Predicates

A [predicate](../../language/program-types/predicate.md) does not have any side effects because it is pure and thus it cannot create [receipts](https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/abi.md#receipt).
A [predicate](../../language/program-types/predicate.md) does not have any side effects because it is pure and thus it cannot create [receipts](https://github.com/FuelLabs/fuel-specs/blob/master/src/abi/receipts.md).

Since there are no receipts they cannot use logging nor create a stack backtrace for debugging. This means that there is no way to debug them aside from using a single-stepping [debugger](https://github.com/FuelLabs/fuel-debugger).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ With that regard in mind, the account based approach can be partially replicated

The following sections will take a look at how an asset can be:

- [`Minted`](mint.md) (created)
- [`Minted`](mint/index.md) (created)
- [`Burned`](burn.md) (destroyed)
- [`Transferred`](transfer/index.md) (sent)

Expand Down
2 changes: 1 addition & 1 deletion forc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Forc stands for Fuel Orchestrator. Forc provides a variety of tools and commands

Find out everything you need to know about Forc under [its chapter in the Sway book][1].

[1]: https://fuellabs.github.io/sway/master/forc
[1]: https://fuellabs.github.io/sway/master/book/forc/index.html
2 changes: 1 addition & 1 deletion scripts/mdbook-forc-documenter/examples/forc_deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ You can use `forc deploy`, which triggers a contract deployment transaction and

Alternatively, you can deploy your Sway contract programmatically using [fuels-rs](https://github.com/FuelLabs/fuels-rs), our Rust SDK.

You can find an example within our [fuels-rs book](https://fuellabs.github.io/fuels-rs/latest/getting-started/basics.html#deploying-a-sway-contract).
You can find an example within our [fuels-rs book](https://rust.fuel.network/latest/).
2 changes: 1 addition & 1 deletion templates/sway-test-rs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ testing within an existing Sway project.
This template is designed for Rust developers who wish to test integration of
their Rust application and Sway code.

See the [Testing with Rust](https://fuellabs.github.io/sway/master/testing/testing-with-rust.html) chapter of [the Sway
See the [Testing with Rust](https://fuellabs.github.io/sway/master/book/testing/testing-with-rust.html) chapter of [the Sway
sarahschwartz marked this conversation as resolved.
Show resolved Hide resolved
Book](https://fuellabs.github.io/sway/master) for a thorough guide on how to
use this template.
2 changes: 1 addition & 1 deletion test/src/sdk-harness/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ After a successful build of all the projects:
cargo test
```

For more on the usage of Forc for testing, see: <https://fuellabs.github.io/sway/latest/forc/commands/forc_test.html>
For more on the usage of Forc for testing, see: <https://fuellabs.github.io/sway/master/book/forc/commands/forc_test.html>