Sway编程语言-更新中(The Sway Programming Language-Updatin
  • Sway编程语言(The Sway Programming Language)
  • 1. 导言(Introduction)
    • 1.1 安装(Installation)
    • 1.2 Sway快速入门 (Sway Quickstart)
    • 1.3 Fuel工具链 (The Fuel Toolchain)
    • 1.4 一个Forc项目 (A Forc Project)
    • 1.5 标准库 (Standard Library)
  • 2. 示例(Example)
    • 2.1计数器(Counter)
    • 2.2子货币(Subcurrency)
    • 2.3 FizzBuzz
    • 2.4 钱包智能合约(Wallet Smart Contract)
  • 3.Sway编程类型(Sway Program Types)
    • 3.1 合约(Contracts)
    • 3.2 库 (Libraries)
    • 3.3 脚本(Scripts)
    • 3.4 谓词 (Predicates)
  • 4. Sway语言基础 (Sway Language basics)
    • 4.1 变量 (Variables)
    • 4.2 内置类型(Built-in Types)
    • 4.3 常用库类型(Commonly Used Library Types)
    • 4.4 区块链类 (Blockchain Types)
    • 4.5 函数 (Functions)
    • 4.6 结构、元祖和穷举 (Structs, Tuples, and Enums)
    • 4.7 方法和关联函数 (Methods and Associated Functions)
    • 4.8 注释和日志 (Comments and Logging)
    • 4.9 控制流 (Control Flow)
  • 5. 用Sway部署区块链 (Blockchain Development with Sway)
    • 5.1 哈希和加密学 (Hashing and Cryptography)
    • 5.2 合约存储(Contract Storage)
    • 5.3 函数纯度 (Function Purity)
    • 5.4 标识符(Identifiers)
    • 5.5 原生资产(Native Assets)
    • 5.6 访问控制 (Access Control)
    • 5.7 调用合约(Calling Contracts)
  • 6. 高级概念 (Advanced Concepts)
    • 6.1 高级类型 (Advanced Types)
    • 6.2 通用类型 (Generic Types)
    • 6.3 特征 (Traits)
    • 6.4 集 (Assembly)
  • 7. 一般集聚 (Common Collections)
    • 7.1 堆上的向量(Vectors on the Heap)
    • 7.2 存储向量 (Storage Vectors)
    • 7.3 存储映射 (Storage Maps)
  • 8.测试(Testing)
    • 8.1 单元测试(Unit Testing)
    • 8.2 用Rust来测试 (Testing with Rust)
  • 9.应用前端开发 (Application Frontend Development)
    • 9.1 TypeScript SDK
  • 10.Sway应用(Sway Reference)
    • 10.1 编译器内部函数(Compiler Intrinsics)
    • 10.2 属性(Attributes)
    • 10.3 风格向导(Style Guide)
    • 10.4 已知各类问题(Known Issues and Workarounds)
    • 10.5 与Solidity的不同之处 (Differences From Solidity)
    • 10.6 与Rust的不同之处 (Differences From Rust)
    • 10.7 向Sway贡献 (Contributing To Sway)
  • 11. Forc引用 (Forc Reference)
    • 11.1清单参考 (Manifest Reference)
    • 11.2 工作区(Workspaces)
    • 11.3 依赖(Dependencies)
    • 11.4 命令(Commands)
      • 11.4.1 forc-addr2line
      • 11.4.2 forc-build
      • 11.4.3 forc-check
Powered by GitBook
On this page
  • 构建和设置开发工作区 (Building and setting up a development workspace)
  • 获取存储库 (Getting the repository)
  • 构建和测试 (Building and testing)
  • 寻找一些可以做的事情 (Finding something to work on)
  • 贡献流程 (Contribution flow)
  1. 10.Sway应用(Sway Reference)

10.7 向Sway贡献 (Contributing To Sway)

Previous10.6 与Rust的不同之处 (Differences From Rust)Next11. Forc引用 (Forc Reference)

Last updated 1 year ago

Thanks for your interest in contributing to Sway! This document outlines the process for installing and setting up the Sway toolchain for development, as well as some conventions on contributing to Sway.

感谢您有兴趣为 Sway 做出贡献!本文档概述了安装和设置 Sway 工具链以进行开发的过程,以及一些为 Sway 做出贡献的约定。

If you run into any difficulties getting started, you can always ask questions on our .

如果您在入门时遇到任何困难,可以随时在我们的 上提问。

构建和设置开发工作区 (Building and setting up a development workspace)

See the section for instructions on installing and setting up the Sway toolchain.

有关安装和设置 Sway 工具链的说明,请参阅部分。

获取存储库 (Getting the repository)

  1. Visit the repo and fork the project. 访问 Sway 存储库并分叉该项目。

  2. Then clone your forked copy to your local machine and get to work. 然后将您的分叉副本克隆到本地计算机并开始工作。

git clone https://github.com/FuelLabs/sway
cd sway

构建和测试 (Building and testing)

The following steps will run the sway test suite and ensure that everything is set up correctly.

以下步骤将运行 sway 测试套件并确保一切设置正确。

First, open a new terminal and start fuel-core with:

首先,打开一个新终端并启动fuel-core:

fuel-core

Then open a second terminal, cd into the sway repo and run:

然后打开第二个终端,进入sway存储库并运行:

cargo run --bin test

After the test suite runs, you should see:

测试套件运行后,您应该看到:

Tests passed.
_n_ tests run (0 skipped)

Congratulations! You've now got everything setup and are ready to start making contributions.

恭喜!现在您已完成所有设置并准备好开始做出贡献。

寻找一些可以做的事情 (Finding something to work on)

There are many ways in which you may contribute to the Sway project, some of which involve coding knowledge and some which do not. A few examples include:

您可以通过多种方式为 Sway 项目做出贡献,其中一些涉及编码知识,另一些则不需要。一些例子包括:

  • Reporting bugs 报告错误

  • Adding documentation to the Sway book 向 Sway 书中添加文档

  • Adding new features or bugfixes for which there is already an open issue 添加已存在未决问题的新功能或错误修复

  • Making feature requests 提出功能请求

If you are planning something big, for example, related to multiple components or changes current behaviors, make sure to open an issue to discuss with us before starting on the implementation.

如果您正在计划一些大的事情,例如与多个组件相关或更改当前行为,请务必在开始实施之前提出问题与我们讨论。

贡献流程 (Contribution flow)

This is a rough outline of what a contributor's workflow looks like:

这是贡献者工作流程的粗略轮廓:

  • Make sure what you want to contribute is already tracked as an issue.

    • We may discuss the problem and solution in the issue.

  • 确保您想要贡献的内容已作为问题进行跟踪。

    • 我们可以讨论问题中的问题和解决方案。

  • Create a Git branch from where you want to base your work. This is usually master.

  • 从您想要作为工作基础的位置创建一个 Git 分支。这通常是大师。

  • Write code, add test cases, and commit your work.

  • 编写代码、添加测试用例并提交您的工作。

  • Run tests and make sure all tests pass.

  • 运行测试并确保所有测试都通过。

  • If the PR contains any breaking changes, add the breaking label to your PR.

  • 如果 PR 包含任何重大更改,请将重大更改标签添加到您的 PR 中。

  • Push your changes to a branch in your fork of the repository and submit a pull request.

    • Make sure mention the issue, which is created at step 1, in the commit message.

  • 将您的更改推送到存储库分支中的分支并提交pull请求。

    • 确保在提交消息中提及在步骤 1 中创建的问题。

  • Your PR will be reviewed and some changes may be requested.

    • Once you've made changes, your PR must be re-reviewed and approved.

    • If the PR becomes out of date, you can use GitHub's 'update branch' button.

    • If there are conflicts, you can merge and resolve them locally. Then push to your PR branch. Any changes to the branch will require a re-review.

  • 您的 PR 将被审核,并且可能会要求进行一些更改。

    • 一旦您做出更改,您的 PR 必须重新审核并获得批准。

    • 如果 PR 过时,您可以使用 GitHub 的“更新分支”按钮。

    • 如果有冲突,可以在本地合并并解决。然后推送到您的 PR 分支。对分支机构的任何更改都需要重新审查。

  • Our CI system (Github Actions) automatically tests all authorized pull requests.

  • 我们的 CI 系统(Github Actions)自动测试所有授权的pull请求。

  • Use Github to merge the PR once approved.

  • 获得批准后,使用 Github 合并 PR。

Thanks for your contributions! 感谢您的贡献!

链接问题 (Linking issues)

Pull requests should be linked to at least one issue in the same repo.

pull请求应链接到同一存储库中的至少一个问题。

If the pull request resolves the relevant issues, and you want GitHub to close these issues automatically after it merged into the default branch, you can use the syntax (KEYWORD #ISSUE-NUMBER) like this:

如果pull请求解决了相关问题,并且您希望 GitHub 在合并到默认分支后自动关闭这些问题,您可以使用如下语法 (KEYWORD #ISSUE-NUMBER):

close #123

If the pull request links an issue but does not close it, you can use the keyword ref like this: 如果pull请求链接了一个问题但没有关闭它,您可以使用关键字ref,如下所示:

ref #456

Multiple issues should use full syntax for each issue and separate by a comma, like:

多个问题应该对每个问题使用完整的语法并用逗号分隔,例如:

close #123, ref #456

Check out our , or issues to find a suitable task.

查看我们的 , or 问题,找到合适的任务。

Discourse
Discourse
introduction
简介
Sway
Help Wanted
Sway Book
Good First Issue
需要帮助 Help Wanted
Sway手册 Sway Book
好的初次问题 Good First Issue