{"id":31923319,"url":"https://github.com/fuellabs/sway-libs","last_synced_at":"2026-02-16T09:04:22.880Z","repository":{"id":45386185,"uuid":"513319916","full_name":"FuelLabs/sway-libs","owner":"FuelLabs","description":"Libraries for the Sway Language","archived":false,"fork":false,"pushed_at":"2025-09-15T10:51:10.000Z","size":8665,"stargazers_count":148,"open_issues_count":30,"forks_count":67,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-09-15T12:27:46.581Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.fuel.network/docs/sway-libs/","language":"Sway","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FuelLabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/contributing-book/.gitignore","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-07-12T23:28:43.000Z","updated_at":"2025-09-15T10:47:15.000Z","dependencies_parsed_at":"2023-02-15T12:46:18.110Z","dependency_job_id":"aa4055b3-0fae-464b-b2df-5705730f6658","html_url":"https://github.com/FuelLabs/sway-libs","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"purl":"pkg:github/FuelLabs/sway-libs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway-libs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway-libs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway-libs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway-libs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FuelLabs","download_url":"https://codeload.github.com/FuelLabs/sway-libs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway-libs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017229,"owners_count":26086016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-13T23:49:18.234Z","updated_at":"2026-02-16T09:04:22.873Z","avatar_url":"https://github.com/FuelLabs.png","language":"Sway","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cpicture\u003e\n        \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs/sway-libs-logo-dark-theme.png\"\u003e\n        \u003cimg alt=\"SwayLibs logo\" width=\"400px\" src=\"docs/sway-libs-logo-light-theme.png\"\u003e\n    \u003c/picture\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/FuelLabs/sway-libs/actions/workflows/ci.yml\" alt=\"CI\"\u003e\n        \u003cimg src=\"https://github.com/FuelLabs/sway-libs/actions/workflows/ci.yml/badge.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/forc/0.70.2\" alt=\"forc\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/forc-v0.70.2-orange\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"./LICENSE\" alt=\"forc\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/FuelLabs/sway-libs\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://discord.gg/xfpK4Pe\"\u003e\n        \u003cimg src=\"https://img.shields.io/discord/732892373507375164?color=6A7EC2\u0026logo=discord\u0026logoColor=ffffff\u0026labelColor=6A7EC2\u0026label=Discord\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Overview\n\nThe purpose of this repository is to contain libraries which users can import and use that are not part of the standard library.\n\nThese libraries contain helper functions and other tools valuable to blockchain development.\n\n\u003e **NOTE:**\n\u003e Sway is a language under heavy development therefore the libraries may not be the most ergonomic. Over time they should receive updates / improvements in order to demonstrate how Sway can be used in real use cases.\n\n## Sway Libs Docs Hub\n\nPlease refer to the [Sway Libs Docs Hub](https://docs.fuel.network/docs/sway-libs/) for documentation for a general overview on Sway Libs and how to implement libraries.\n\n\u003c!---\nUncomment this when https://github.com/FuelLabs/sway/pull/7229 is merged.\n## Library Docs\n\nFor implementation details on the libraries please see the [Sway Libs Docs]().\n---\u003e\n\n## Libraries\n\n#### Assets\n\n- [Native Asset](https://docs.fuel.network/docs/sway-libs/asset/) provides helper functions for the [SRC-20](https://docs.fuel.network/docs/sway-standards/src-20-native-asset/), [SRC-3](https://docs.fuel.network/docs/sway-standards/src-3-minting-and-burning/), and [SRC-7](https://docs.fuel.network/docs/sway-standards/src-7-asset-metadata/) standards.\n\n#### Access Control and Security\n\n- [Ownership](https://docs.fuel.network/docs/sway-libs/ownership/) is used to apply restrictions on functions such that only a **single** user may call them.\n- [Admin](https://docs.fuel.network/docs/sway-libs/admin/) is used to apply restrictions on functions such that only a select few users may call them like a whitelist.\n- [Pausable](https://docs.fuel.network/docs/sway-libs/pausable/) allows contracts to implement an emergency stop mechanism.\n- [Reentrancy](https://docs.fuel.network/docs/sway-libs/reentrancy/) is used to detect and prevent reentrancy attacks.\n\n#### Cryptography\n\n- [Bytecode](https://docs.fuel.network/docs/sway-libs/bytecode/) is used for on-chain verification and computation of bytecode roots for contracts and predicates.\n- [Merkle Proof](https://docs.fuel.network/docs/sway-libs/merkle/) is used to verify Binary and Sparse Merkle Trees computed off-chain.\n\n#### Math\n\n- [Signed Integers](https://docs.fuel.network/docs/sway-libs/signed_integers/) is an interface to implement signed integers.\n\n\u003e **NOTE:**\n\u003e The Fixed Point Number library has been deprecated pending a re-write.\n\n#### Data Structures\n\n- [Queue](https://docs.fuel.network/docs/sway-libs/queue/) is a linear data structure that provides First-In-First-Out (FIFO) operations.\n\n#### Upgradability Libraries\n\n- [Upgradability](https://docs.fuel.network/docs/sway-libs/upgradability/) provides functions that can be used to implement contract upgrades via simple upgradable proxies.\n\n## Using a library\n\nTo import any library, a dependency should be added to the project's `Forc.toml` file under `[dependencies]`.\n\n```sway\n[dependencies]\nexample = \"0.0.0\"\n```\n\nThe library you wish to use may be added as a dependency with the `forc add` command. For example, to import the Ownership Library, use the following `forc` command:\n\n```bash\nforc add ownership@0.26.0\n```\n\n\u003e **NOTE:** Be sure to set the version to the latest release.\n\nYou may then import your desired library in your Sway Smart Contract as so:\n\n```sway\nuse \u003clibrary\u003e::\u003clibrary_function\u003e;\n```\n\nFor example, to import the `only_owner()` function use the following statement:\n\n```sway\nuse ownership::only_owner;\n```\n\nFor more information about implementation please refer to the [Sway Libs Docs Hub](https://docs.fuel.network/docs/sway-libs/)\n\n## Running Tests\n\nThere are two sets of tests that should be run: inline tests and sdk-harness tests. Please make sure you are using `forc v0.70.2` and `fuel-core v0.47.1`. You can check what version you are using by running the `fuelup show` command.\n\nMake sure you are in the source directory of this repository `sway-libs/\u003cyou are here\u003e`.\n\nRun the inline tests:\n\n```bash\nforc test --path libs --release --locked\n```\n\nOnce these tests have passed, run the sdk-harness tests:\n\n```bash\nforc test --path tests --release --locked \u0026\u0026 cargo test --manifest-path tests/Cargo.toml\n```\n\n\u003e **NOTE:**\n\u003e This may take a while depending on your hardware, future improvements to Sway will decrease build times. After this has been run once, individual test projects may be built on their own to save time.\n\nAny instructions related to using a specific library should be found within the README.md of that library.\n\n\u003e **NOTE:**\n\u003e All projects currently use `forc v0.70.2`, `fuels-rs v0.70.0` and `fuel-core v0.47.1`.\n\n## Contributing\n\nCheck out the [contributing book](https://fuellabs.github.io/sway-libs/contributing-book/index.html) for more info!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuellabs%2Fsway-libs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuellabs%2Fsway-libs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuellabs%2Fsway-libs/lists"}