Skip to content

Commit db50558

Browse files
committed
Merging with master
2 parents 1ccbf62 + dadc576 commit db50558

File tree

127 files changed

+1642
-231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1642
-231
lines changed

.changeset/gorgeous-plants-tap.md

Lines changed: 0 additions & 5 deletions
This file was deleted.
File renamed without changes.

CONTRIBUTING.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
---
2-
layout: default
3-
title: "Contributing"
4-
nav_order: -3
5-
---
6-
7-
# Contributing
1+
## 💚 Contributing To Fuel TypeScript SDK
82

93
Thanks for your interest in contributing to the Fuel TypeScript SDK!
104

apps/docs-snippets/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# @fuel-ts/docs-snippets
2+
3+
## 0.40.0
4+
5+
## 0.40.0
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[workspace]
2+
members = [
3+
"counter",
4+
"log-values",
5+
"echo-values",
6+
"simple-token",
7+
"simple-token-abi",
8+
"return-context",
9+
"token-depositor",
10+
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[project]
2+
authors = ["FuelLabs"]
3+
entry = "main.sw"
4+
license = "Apache-2.0"
5+
name = "counter"
6+
7+
[dependencies]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
contract;
2+
3+
abi Counter {
4+
#[storage(read)]
5+
fn get_count() -> u64;
6+
7+
#[storage(write, read)]
8+
fn increment_count(amount: u64) -> u64;
9+
}
10+
11+
storage {
12+
count: u64 = 0,
13+
}
14+
15+
impl Counter for Contract {
16+
#[storage(read)]
17+
fn get_count() -> u64 {
18+
storage.count
19+
}
20+
21+
#[storage(write, read)]
22+
fn increment_count(amount: u64) -> u64 {
23+
storage.count += amount;
24+
storage.count
25+
}
26+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[project]
2+
authors = ["FuelLabs"]
3+
entry = "main.sw"
4+
license = "Apache-2.0"
5+
name = "echo-values"
6+
7+
[dependencies]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// #region understanding-fuel-binary-file
2+
contract;
3+
4+
abi EchoValues {
5+
fn echo_u8(value: u8) -> u8;
6+
7+
fn echo_str_8(value: str[8]) -> str[8];
8+
}
9+
10+
impl EchoValues for Contract {
11+
fn echo_u8(value: u8) -> u8 {
12+
value
13+
}
14+
15+
fn echo_str_8(value: str[8]) -> str[8] {
16+
value
17+
}
18+
}
19+
// #endregion understanding-fuel-binary-file
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { readFileSync } from 'fs';
2+
import { join } from 'path';
3+
4+
export enum SnippetContractEnum {
5+
COUNTER = 'counter',
6+
ECHO_VALUES = 'echo-values',
7+
RETURN_CONTEXT = 'return-context',
8+
LOG_VALUES = 'log-values',
9+
SIMPLE_TOKEN = 'simple-token',
10+
TOKEN_DEPOSITOR = 'token-depositor',
11+
}
12+
13+
const getSnippetContractPath = (contract: SnippetContractEnum) =>
14+
join(__dirname, contract, 'out', 'debug');
15+
16+
const getSnippetContractAbiPath = (contract: SnippetContractEnum) =>
17+
join(getSnippetContractPath(contract), `${contract}-abi.json`);
18+
19+
const getSnippetContractBinPath = (contract: SnippetContractEnum) =>
20+
join(getSnippetContractPath(contract), `${contract}.bin`);
21+
22+
export const getSnippetContractArtifacts = (contract: SnippetContractEnum) => {
23+
const abi = JSON.parse(readFileSync(getSnippetContractAbiPath(contract), 'utf-8'));
24+
const bin = readFileSync(getSnippetContractBinPath(contract));
25+
26+
return {
27+
abi,
28+
bin,
29+
};
30+
};

0 commit comments

Comments
 (0)