Skip to content

Commit

Permalink
Reaedy
Browse files Browse the repository at this point in the history
  • Loading branch information
calldelegation committed Nov 21, 2023
1 parent 4065d98 commit 257d4ce
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 23 deletions.
4 changes: 2 additions & 2 deletions docs/guides/docs/guides.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"tags": ["Getting Started", "Full Stack"]
},
"intro_to_sway": {
"title": "Introduction to Sway",
"title": "Introduction to Sway for Javascript developers",
"description": "Learn Sway fundamentals by building a marketplace dApp.",
"featured": false,
"tags": []
"tags": ["Full Stack"]
},
"running_a_node": {
"title": "Running a Node",
Expand Down
4 changes: 3 additions & 1 deletion docs/guides/docs/intro-to-sway/checkpoint.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
title: Checkpoint
category: Intro to Sway
parent:
label: Guides
label: All Guides
link: /guides
---

# Checkpoint

## Sway Contract Checkpoint

If you have followed the previous steps correctly your `main.sw` marketplace contract should look like this:
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/docs/intro-to-sway/contract-errors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Errors
category: Intro to Sway
parent:
label: Guides
label: All Guides
link: /guides
---

## Defining Error Handling
# Defining Error Handling

Enumerations, commonly referred to as enums, are a type that can represent one of several possible variants. Within our contract, we can employ enums to craft custom error messages, facilitating more precise error handling within functions.

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/docs/intro-to-sway/contract-functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Functions
category: Intro to Sway
parent:
label: Guides
label: All Guides
link: /guides
---

## Defining the Contract Functions
# Defining the Contract Functions

Finally, it's time to compose our contract functions. Begin by copying and pasting the ABI we outlined earlier. It's crucial to ensure that the functions within the contract *exactly* align with the ABI; otherwise, the compiler will generate an error. Now, substitute the semicolons at the conclusion of each function with curly brackets. Also, modify `abi SwayStore` to `impl SwayStore for Contract`, as demonstrated below:

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/docs/intro-to-sway/contract-imports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Imports
category: Intro to Sway
parent:
label: Guides
label: All Guides
link: /guides
---

## Imports
# Imports

The [Sway standard library](https://fuellabs.github.io/sway/master/std/) provides several utility types and methods we can use in our contract. To import a library, you can use the `use` keyword and `::`, also called a namespace qualifier, to chain library names like this:

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/docs/intro-to-sway/contract-storage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Storage
category: Intro to Sway
parent:
label: Guides
label: All Guides
link: /guides
---

## Defining The Storage Block
# Defining The Storage Block

Next, we'll introduce the storage block. This is where you store all persistent state variables in your contract.

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/docs/intro-to-sway/contract-structs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Structs
category: Intro to Sway
parent:
label: Guides
label: All Guides
link: /guides
---

## Defining an Item Struct
# Defining an Item Struct

Struct is short for structure, which is a data structure similar to an object in JavaScript. You define a struct with the `struct` keyword in Sway and define the fields of a struct inside curly brackets.

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/docs/intro-to-sway/explore-fuel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Explore Fuel
category: Intro to Sway
parent:
label: Guides
label: All Guides
link: /guides
---

## Congrats on completing the intro to Sway! 🎉
# Congrats on completing the intro to Sway guide! 🎉

Encountering issues? A useful initial step is to align your code with the repository's and address any discrepancies. Check out the project's repository [here](https://github.com/FuelLabs/intro-to-sway/tree/main). 🔍

Expand Down
6 changes: 5 additions & 1 deletion docs/guides/docs/intro-to-sway/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Intro to Sway
category: Intro to Sway
parent:
label: Guides
label: All Guides
link: /guides
---

Expand All @@ -15,6 +15,10 @@ Within this tutorial, we will be crafting a Sway contract for an online marketpl
1. Sellers can list products.
2. Buyers can purchase those products.

<Box.Centered>
![intro to sway app](/images/intro-to-sway.gif)
</Box.Centered>

One of the compelling features of smart contracts is their immutability and permissionless nature. This ensures that no single entity can modify or adjust the rules of the marketplace after its deployment. For instance, once a product is listed in the contract, the deployer cannot suddenly alter its status. Similarly, if a commission amount is hardcoded into the contract, it remains fixed, preventing any changes to the commission charged for products.

Furthermore, the contract remains open for interaction by anyone. This universality allows any individual to engage with the marketplace using their custom frontend without requiring permission.
Expand Down
4 changes: 3 additions & 1 deletion docs/guides/docs/intro-to-sway/prerequisites.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
title: Prerequisites
category: Intro to Sway
parent:
label: Guides
label: All Guides
link: /guides
---

# Prerequisites

## Installation

<TextImport
Expand Down
6 changes: 3 additions & 3 deletions docs/guides/docs/intro-to-sway/rust-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
title: Rust Testing
category: Intro to Sway
parent:
label: Guides
label: All Guides
link: /guides
---

## Testing the contract
# Testing the contract

### Generating a Test Template in Rust
## Generating a Test Template in Rust

To create your own test template using Rust, follow these steps with `cargo-generate` in the contract project directory:

Expand Down
6 changes: 3 additions & 3 deletions docs/guides/docs/intro-to-sway/typescript-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
title: Typescript Frontend
category: Intro to Sway
parent:
label: Guides
label: All Guides
link: /guides
---

## Building the Frontend
# Building the Frontend

### Setup
## Setup

Initialize a new React app with TypeScript in the same parent folder as your contract using the command below.

Expand Down
Binary file added public/images/intro-to-sway.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 257d4ce

Please sign in to comment.