MCPcopy Index your code
hub / github.com/FuelLabs/sway

github.com/FuelLabs/sway @v0.71.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.71.2 ↗ · + Follow
7,789 symbols 32,585 edges 760 files 1,941 documented · 25%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Sway

build crates.io docs twitter discord

Sway is a language developed for the Fuel blockchain. It is heavily inspired by Rust and aims to bring modern language development and performance to the blockchain ecosystem.

Documentation

For user documentation, including installing release builds, see the Sway Book: https://fuellabs.github.io/sway/latest/.

For Sway Standard library documentation, see: https://fuellabs.github.io/sway/master/std/

Also view the technical reference for the Sway programming language: https://fuellabs.github.io/sway/master/reference/

Building from Source

This section is for developing the Sway compiler and toolchain. For developing contracts and using Sway, see the above documentation section.

Dependencies

Sway is built in Rust. To begin, install the Rust toolchain following instructions at https://www.rust-lang.org/tools/install. Then configure your Rust toolchain to use Rust stable:

rustup default stable

If not already done, add the Cargo bin directory to your PATH by adding the following line to ~/.profile and restarting the shell session.

export PATH="${HOME}/.cargo/bin:${PATH}"

Building Forc

Clone the repository and build the Sway toolchain:

git clone git@github.com:FuelLabs/sway.git
cd sway
cargo build

Confirm the Sway toolchain built successfully:

cargo run --bin forc -- --help

All other scripts/commands

For all other scripts and commands use https://github.com/casey/just:

> just --list
Available recipes:
    [automation]
    update-contract-ids
    update-fuel-dependencies

    [benchmark]
    benchmark
    benchmark-tests
    collect-gas-usage

    [build]
    build-highlightjs
    build-prism
    generate-sway-lib-std

    [ci]
    ci-check
    install-ci-check

    [test]
    test-forc-fmt-check-panic

Contributing to Sway

We welcome contributions to Sway!

Please see the Contributing To Sway section of the Sway book for guidelines and instructions to help you get started.

Extension points exported contracts — how you extend this code

LeafSpans (Interface)
While searching for a structure we need the possible places that structure can be placed inside the code `leaf_spans` co [75 …
swayfmt/src/utils/map/byte_span.rs
Parse (Interface)
The `Parse` trait is used to parse tokens from an AST during traversal. [107 implementers]
sway-lsp/src/traverse/mod.rs
Renderable (Interface)
Something that can be rendered to HTML. [15 implementers]
forc-plugins/forc-doc/src/render/mod.rs
AnalysisResultT (Interface)
Result of an analysis. Specific result must be downcasted to. [6 implementers]
sway-ir/src/pass_manager.rs
TyDeclParsedType (Interface)
This trait is used to associate a typed declaration node with its corresponding parsed declaration node by way of an ass [14 …
sway-core/src/language/ty/declaration/declaration.rs
Pin (Interface)
Pin this source at a specific "version", return the local directory to fetch into. [5 implementers]
forc-pkg/src/source/mod.rs
Named (Interface)
(no doc) [26 implementers]
sway-types/src/ident.rs
TyElementsMatcher (Interface)
Matches for typed tree elements of type `T` located **directly** within the typed tree element `self`. The matched elem [4 …
forc-plugins/forc-migrate/src/matching/mod.rs

Core symbols most depended-on inside this repo

clone
called by 2260
sway-core/src/decl_engine/id.rs
clone
called by 1806
sway-types/src/source_engine.rs
into
called by 1201
sway-core/src/decl_engine/id.rs
to_string
called by 1178
swayfmt/src/formatter/shape.rs
iter
called by 878
sway-core/src/semantic_analysis/ast_node/expression/match_expression/analysis/patstack.rs
map
called by 696
sway-core/src/concurrent_slab.rs
push
called by 649
sway-utils/src/mapped_stack.rs
emit_err
called by 627
sway-error/src/handler.rs

Shape

Method 3,978
Function 2,584
Class 805
Enum 325
Interface 97

Languages

Rust97%
TypeScript3%

Modules by API surface

sway-core/src/type_system/engine.rs116 symbols
forc-pkg/src/pkg.rs105 symbols
swayfmt/tests/mod.rs103 symbols
sway-ir/src/irtype.rs103 symbols
sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs93 symbols
sway-ir/src/instruction.rs88 symbols
sway-core/src/ir_generation/function.rs87 symbols
forc-pkg/src/manifest/mod.rs86 symbols
forc-plugins/forc-doc/src/static.files/highlight.js85 symbols
docs/reference/theme/highlight.js85 symbols
docs/book/theme/highlight.js85 symbols
sway-core/src/transform/attribute.rs84 symbols

For agents

$ claude mcp add sway \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact