Skip to content

Commit df0bf5b

Browse files
authored
Merge branch 'master' into master
2 parents 6453274 + 8d0a439 commit df0bf5b

File tree

9 files changed

+113
-45
lines changed

9 files changed

+113
-45
lines changed

.github/workflows/guides.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
- "counter-dapp"
4646
- "intro to sway"
4747
- "intro to predicates"
48+
- "quickstart"
4849

4950
steps:
5051
# SETUP

docs/guides/docs/contract-quickstart/index.mdx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,32 @@ Getting started with Fuel as a smart contract developer is as simple as:
5656

5757
Run the command below to generate a counter contract in Sway:
5858

59+
{/* TODO: Replace when forc template command is stable
60+
5961
```sh
6062
forc template --template-name counter counter-contract
6163
```
6264
65+
*/}
66+
67+
{/*TODO: Remove when forc template command is stable*/}
68+
69+
<TestAction
70+
id="create-contract-project"
71+
action={{
72+
name: 'runCommand',
73+
commandFolder: 'guides-testing/'
74+
}}
75+
/>
76+
77+
<CodeImport
78+
file="../counter-dapp/building-a-smart-contract.mdx"
79+
comment="new_forc_contract"
80+
commentType="{/*"
81+
lang="sh"
82+
trim="true"
83+
/>
84+
6385
The contract will be in the `src/main.sw` file.
6486

6587
<TextImport
@@ -76,8 +98,35 @@ To build a contract, move inside the `counter-contract` folder:
7698
cd counter-contract
7799
```
78100

101+
{/*TODO: Remove when forc template command is stable*/}
102+
103+
Copy and paste the code below into your `src/main.sw` file
104+
105+
<TestAction
106+
id="copy-contract"
107+
action={{
108+
name: 'writeToFile',
109+
filepath: 'guides-testing/counter-contract/src/main.sw'
110+
}}
111+
/>
112+
113+
<CodeImport
114+
file="../../examples/counter-dapp/counter-contract/src/main.sw"
115+
comment="all"
116+
commentType="/*"
117+
lang="sway"
118+
/>
119+
79120
Next, run the `forc build` command:
80121

122+
<TestAction
123+
id="build-contract"
124+
action={{
125+
name: 'runCommand',
126+
commandFolder: 'guides-testing/counter-contract'
127+
}}
128+
/>
129+
81130
```sh
82131
forc build
83132
```

docs/guides/docs/counter-dapp/building-a-smart-contract.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,14 @@ action={{
8383
}}
8484
/>
8585

86+
{/*ANCHOR: new_forc_contract*/}
87+
8688
```sh
8789
forc new counter-contract
8890
```
8991

92+
{/*ANCHOR_END: new_forc_contract*/}
93+
9094
You will get this output:
9195

9296
```sh

scripts/update-nightly/versions.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ export function getExistingVersions() {
88
rust: getRustSDKVersion(false),
99
ts: getTSSDKVersion(false),
1010
wallet: getWalletVersion(false),
11-
// TODO: uncomment when sway-libs is bumped to 0.22.0
12-
// sway_libs: getSwayLibsVersion(false),
11+
sway_libs: getSwayLibsVersion(false),
1312
sway_standards: getSwayStandardsVersion(false),
1413
};
1514
versions.nightly = {
1615
forc: getForcVersion(true),
1716
rust: getRustSDKVersion(true),
1817
ts: getTSSDKVersion(true),
1918
wallet: getWalletVersion(true),
20-
// sway_libs: getSwayLibsVersion(true),
19+
sway_libs: getSwayLibsVersion(true),
2120
sway_standards: getSwayStandardsVersion(true),
2221
};
2322

src/config/versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"rust": "0.63.0",
55
"ts": "0.89.1",
66
"wallet": "0.21.0",
7-
"sway_libs": "0.21.0",
7+
"sway_libs": "0.22.0",
88
"sway_standards": "0.5.0"
99
}
1010
}

src/lib/versions.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,10 @@ function getForcVersion(docsDir: string) {
6363
}
6464

6565
function getSwayLibsVersion(docsDir: string) {
66-
// TODO: uncomment this once sway-libs 0.22.0 is released
67-
// const filedir = join(docsDir, 'sway-libs/Cargo.toml');
68-
// const file = fs.readFileSync(filedir, 'utf-8');
69-
// const tomfile = toml.parse(file);
70-
// const version = tomfile.package.version;
71-
const version = '0.21.0';
66+
const filedir = join(docsDir, 'sway-libs/Cargo.toml');
67+
const file = fs.readFileSync(filedir, 'utf-8');
68+
const tomfile = toml.parse(file);
69+
const version = tomfile.package.version;
7270
return {
7371
name: 'sway-libs',
7472
category: 'Sway Libraries',

tests/test.spec.ts

Lines changed: 50 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
1-
import { test } from './utils/fixtures';
2-
import { runTest } from './utils/runTest';
3-
import { setupFolders, startServers, stopServers } from './utils/setup';
4-
import { useFuelWallet } from './utils/wallet';
1+
import { test } from "./utils/fixtures";
2+
import { runTest } from "./utils/runTest";
3+
import { setupFolders, startServers, stopServers } from "./utils/setup";
4+
import { useFuelWallet } from "./utils/wallet";
55

6-
test.describe('Guides', () => {
7-
test('counter-dapp', async ({ context, extensionId, page }) => {
8-
const CONTRACT_PAGE_URL = 'guides/counter-dapp/building-a-smart-contract';
9-
const FRONTEND_PAGE_URL = 'guides/counter-dapp/building-a-frontend';
6+
test.describe("Guides", () => {
7+
test("quickstart", async ({ context, extensionId, page }) => {
8+
const CONTRACT_QUICKSTART_PAGE_URL = "guides/contract-quickstart";
109

1110
// SETUP
1211
stopServers();
1312
await useFuelWallet(context, extensionId, page);
14-
await setupFolders('fuel-project');
13+
await setupFolders("fuel-project");
14+
await startServers(page);
15+
16+
// TEST CONTRACT QUICKSTART
17+
await runTest(page, context, CONTRACT_QUICKSTART_PAGE_URL);
18+
19+
// SHUT DOWN
20+
stopServers();
21+
// context.close();
22+
});
23+
24+
test("counter-dapp", async ({ context, extensionId, page }) => {
25+
const CONTRACT_PAGE_URL = "guides/counter-dapp/building-a-smart-contract";
26+
const FRONTEND_PAGE_URL = "guides/counter-dapp/building-a-frontend";
27+
28+
// SETUP
29+
stopServers();
30+
await useFuelWallet(context, extensionId, page);
31+
await setupFolders("fuel-project");
1532
await startServers(page);
1633

1734
// TEST CONTRACT
@@ -25,22 +42,22 @@ test.describe('Guides', () => {
2542
// context.close();
2643
});
2744

28-
test('intro to sway', async ({ context, extensionId, page }) => {
29-
const PREREQUISITES_PAGE_URL = 'guides/intro-to-sway/prerequisites';
30-
const IMPORTS_PAGE_URL = 'guides/intro-to-sway/contract-imports';
31-
const STRUCTS_PAGE_URL = 'guides/intro-to-sway/contract-structs';
32-
const ABI_PAGE_URL = 'guides/intro-to-sway/contract-abi';
33-
const STORAGE_PAGE_URL = 'guides/intro-to-sway/contract-storage';
34-
const ERRORS_PAGE_URL = 'guides/intro-to-sway/contract-errors';
35-
const FUNCTIONS_PAGE_URL = 'guides/intro-to-sway/contract-functions';
36-
const CHECKPOINT_PAGE_URL = 'guides/intro-to-sway/checkpoint';
37-
const FUELS_RS_PAGE_URL = 'guides/intro-to-sway/rust-sdk';
38-
const FUELS_TS_PAGE_URL = 'guides/intro-to-sway/typescript-sdk';
45+
test("intro to sway", async ({ context, extensionId, page }) => {
46+
const PREREQUISITES_PAGE_URL = "guides/intro-to-sway/prerequisites";
47+
const IMPORTS_PAGE_URL = "guides/intro-to-sway/contract-imports";
48+
const STRUCTS_PAGE_URL = "guides/intro-to-sway/contract-structs";
49+
const ABI_PAGE_URL = "guides/intro-to-sway/contract-abi";
50+
const STORAGE_PAGE_URL = "guides/intro-to-sway/contract-storage";
51+
const ERRORS_PAGE_URL = "guides/intro-to-sway/contract-errors";
52+
const FUNCTIONS_PAGE_URL = "guides/intro-to-sway/contract-functions";
53+
const CHECKPOINT_PAGE_URL = "guides/intro-to-sway/checkpoint";
54+
const FUELS_RS_PAGE_URL = "guides/intro-to-sway/rust-sdk";
55+
const FUELS_TS_PAGE_URL = "guides/intro-to-sway/typescript-sdk";
3956

4057
// SETUP
4158
stopServers();
4259
await useFuelWallet(context, extensionId, page);
43-
await setupFolders('fuel-project');
60+
await setupFolders("fuel-project");
4461
await startServers(page);
4562

4663
// TEST CONTRACT
@@ -60,25 +77,25 @@ test.describe('Guides', () => {
6077
// context.close();
6178
});
6279

63-
test('intro to predicates', async ({ context, extensionId, page }) => {
64-
const PREREQUISITES_PAGE_URL = 'guides/intro-to-predicates/prerequisites';
65-
const PREDICATE_ROOT_PAGE_URL = 'guides/intro-to-predicates/predicate-root';
66-
const IMPORTS_PAGE_URL = 'guides/intro-to-predicates/imports';
67-
const CONFIGURABLES_PAGE_URL = 'guides/intro-to-predicates/configurables';
80+
test("intro to predicates", async ({ context, extensionId, page }) => {
81+
const PREREQUISITES_PAGE_URL = "guides/intro-to-predicates/prerequisites";
82+
const PREDICATE_ROOT_PAGE_URL = "guides/intro-to-predicates/predicate-root";
83+
const IMPORTS_PAGE_URL = "guides/intro-to-predicates/imports";
84+
const CONFIGURABLES_PAGE_URL = "guides/intro-to-predicates/configurables";
6885
const SIGNATURE_VERIFICATION_PAGE_URL =
69-
'guides/intro-to-predicates/signature-verification';
70-
const MAIN_PAGE_URL = 'guides/intro-to-predicates/main';
71-
const CHECKPOINT_PAGE_URL = 'guides/intro-to-predicates/checkpoint';
86+
"guides/intro-to-predicates/signature-verification";
87+
const MAIN_PAGE_URL = "guides/intro-to-predicates/main";
88+
const CHECKPOINT_PAGE_URL = "guides/intro-to-predicates/checkpoint";
7289
const SCRIPT_DEBUG_PAGE_URL =
73-
'guides/intro-to-predicates/debugging-with-scripts';
90+
"guides/intro-to-predicates/debugging-with-scripts";
7491
const SCRIPT_LOGS_PAGE_URL =
75-
'guides/intro-to-predicates/debugging-with-scripts-rust';
76-
const FUELS_RS_PAGE_URL = 'guides/intro-to-predicates/rust-sdk';
92+
"guides/intro-to-predicates/debugging-with-scripts-rust";
93+
const FUELS_RS_PAGE_URL = "guides/intro-to-predicates/rust-sdk";
7794

7895
// SETUP
7996
stopServers();
8097
await useFuelWallet(context, extensionId, page);
81-
await setupFolders('fuel-project');
98+
await setupFolders("fuel-project");
8299
await startServers(page);
83100

84101
// TEST CONTRACT

0 commit comments

Comments
 (0)