|
1 |
| -<picture> |
2 |
| - <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/FuelLabs/fuels-ts/master/apps/docs/src/public/fuels-ts-logo-dark.png"> |
3 |
| - <img alt="Fuels-ts SDK logo" width="400px" src="https://raw.githubusercontent.com/FuelLabs/fuels-ts/master/apps/docs/src/public/fuels-ts-logo-light.png"> |
4 |
| -</picture> |
| 1 | +# fuels-ts |
5 | 2 |
|
6 |
| -**fuels-ts** is a library for interacting with **Fuel v2**. |
| 3 | +Typescript SDK for Fuel. |
7 | 4 |
|
8 | 5 | [](https://github.com/FuelLabs/fuels-ts/actions/workflows/test.yaml)
|
9 |
| -[](https://www.npmjs.com/package/fuels) |
10 | 6 | [](https://docs.fuel.network/docs/fuels-ts/)
|
| 7 | +[](https://www.npmjs.com/package/fuels) |
11 | 8 | [](https://discord.gg/xfpK4Pe)
|
12 | 9 |
|
13 |
| -# Resources |
14 |
| - |
15 |
| -The [documentation](https://docs.fuel.network/docs/fuels-ts/) site is your main stop for resources. |
| 10 | +# Install ([docs](https://docs.fuel.network/docs/fuels-ts/getting-started/installation)) |
16 | 11 |
|
17 |
| -- [Quickstart](https://docs.fuel.network/docs/intro/quickstart-contract/) |
18 |
| -- [Documentation](https://docs.fuel.network/docs/fuels-ts/) |
19 |
| - - [Wallets](https://docs.fuel.network/docs/fuels-ts/wallets/) |
20 |
| - - [Contracts](https://docs.fuel.network/docs/fuels-ts/contracts/) |
21 |
| - - [Scripts](https://docs.fuel.network/docs/fuels-ts/scripts/) |
22 |
| - - [Predicates](https://docs.fuel.network/docs/fuels-ts/predicates/) |
23 |
| - - [ABI Typegen](https://docs.fuel.network/docs/fuels-ts/fuels-cli/abi-typegen/) |
24 |
| -- [Contributing](https://github.com/FuelLabs/fuels-ts/blob/master/CONTRIBUTING.md) |
25 |
| -- [The Fuel Forum](https://forum.fuel.network/) |
26 |
| -- [The Fuel Ecosystem](#the-fuel-ecosystem) |
27 |
| - |
28 |
| -# Install |
29 |
| - |
30 |
| -```sh |
| 12 | +```console |
31 | 13 | npm install fuels --save
|
32 | 14 | ```
|
33 | 15 |
|
34 |
| -> If you are a Windows user, you will need to be running Windows Subsystem for Linux (WSL) to install and use the Fuel toolchain, including the TypeScript SDK. We don't support Windows natively at this time. |
| 16 | +# Connect ([docs](https://docs.fuel.network/docs/fuels-ts/getting-started/connecting-to-the-network/)) |
35 | 17 |
|
36 |
| -# Import |
37 |
| - |
38 |
| -Simple example usages. |
| 18 | +| Network | URL | |
| 19 | +| --------- | --------------------------------------------------------------------------------------------------------------- | |
| 20 | +| Mainnet | `https://mainnet.fuel.network/v1/graphql` | |
| 21 | +| Testnet | `https://testnet.fuel.network/v1/graphql` | |
| 22 | +| Localhost | [Running a local Fuel node](https://docs.fuel.network/docs/fuels-ts/getting-started/running-a-local-fuel-node/) | |
39 | 23 |
|
40 | 24 | ```ts
|
41 |
| -import { Wallet } from "fuels"; |
| 25 | +import { Provider } from 'fuels'; |
42 | 26 |
|
43 |
| -// Random Wallet |
44 |
| -console.log(Wallet.generate()); |
| 27 | +const NETWORK_URL = 'https://mainnet.fuel.network/v1/graphql'; |
45 | 28 |
|
46 |
| -// Using privateKey Wallet |
47 |
| -console.log(new Wallet("0x0000...0000")); |
48 |
| -``` |
| 29 | +const provider = await Provider.create(NETWORK_URL); |
49 | 30 |
|
50 |
| -# CLI |
| 31 | +const chainId = provider.getChainId(); |
| 32 | +const gasConfig = provider.getGasConfig(); |
| 33 | +const baseAssetId = provider.getBaseAssetId(); |
51 | 34 |
|
52 |
| -Fuels include some utility commands via built-in CLI tool. |
| 35 | +console.log({ chainId, gasConfig, baseAssetId }); |
| 36 | +``` |
53 | 37 |
|
54 |
| -Check the [docs](https://docs.fuel.network/docs/fuels-ts/) for more info. |
| 38 | +# Create a new dApp ([docs](https://docs.fuel.network/docs/fuels-ts/creating-a-fuel-dapp/)) |
55 | 39 |
|
56 | 40 | ```console
|
57 |
| -$ npm add fuels |
58 |
| -$ npx fuels --help |
59 |
| -Usage: fuels [options] [command] |
| 41 | +$ npm create fuels |
| 42 | + |
| 43 | +◇ What is the name of your project? # |
| 44 | +│ my-fuel-project |
| 45 | +└ |
| 46 | + |
| 47 | +⚡️ Success! Created a fullstack Fuel dapp at: my-fuel-project. |
| 48 | +``` |
60 | 49 |
|
61 |
| -Options: |
62 |
| - -D, --debug Enables verbose logging (default: false) |
63 |
| - -S, --silent Omit output messages (default: false) |
64 |
| - -v, --version Output the version number |
65 |
| - -h, --help Display help |
| 50 | +# Enjoy the `fuels` CLI ([docs](https://docs.fuel.network/docs/fuels-ts/fuels-cli/)) |
| 51 | + |
| 52 | +```console |
| 53 | +$ npm install fuels --save |
| 54 | +$ npm fuels --help |
66 | 55 |
|
67 | 56 | Commands:
|
68 |
| - init [options] Create a sample `fuel.config.ts` file |
69 |
| - node [options] Start a Fuel node |
70 |
| - dev [options] Start a Fuel node and run build + deploy on every file change |
71 |
| - build [options] Build Sway programs and generate Typescript for them |
72 |
| - deploy [options] Deploy contracts to the Fuel network |
73 |
| - typegen [options] Generate Typescript from Sway ABI JSON files |
74 |
| - versions Check for version incompatibilities |
75 |
| - help [command] Display help for command |
| 57 | + init [options] Create a sample `fuel.config.ts` file |
| 58 | + build [options] Build Sway programs and generate Typescript for them |
| 59 | + deploy [options] Deploy contracts to the Fuel network |
| 60 | + dev [options] Start a Fuel node with hot-reload capabilities |
| 61 | + node [options] Start a Fuel node using project configs |
| 62 | + typegen [options] Generate Typescript from Sway ABI JSON files |
| 63 | + versions [options] Check for version incompatibilities |
| 64 | + help [command] Display help for command |
76 | 65 | ```
|
77 | 66 |
|
78 |
| -# The Fuel Ecosystem |
| 67 | +In-depth docs: |
| 68 | +- [`fuels init`](https://docs.fuel.network/docs/fuels-ts/fuels-cli/commands#fuels-init) — Creates a new `fuels.config.ts` file |
| 69 | +- [`fuels build`](https://docs.fuel.network/docs/fuels-ts/fuels-cli/commands#fuels-build) — Build `forc` workspace and generate Typescript types for everything |
| 70 | +- [`fuels deploy`](https://docs.fuel.network/docs/fuels-ts/fuels-cli/commands#fuels-deploy) — Deploy workspace contracts and save their IDs to JSON file |
| 71 | +- [`fuels dev`](https://docs.fuel.network/docs/fuels-ts/fuels-cli/commands#fuels-dev) — Start a Fuel node with hot-reload capabilities |
| 72 | + |
| 73 | + |
| 74 | +# Official Docs |
| 75 | + |
| 76 | +- Install The Fuel Toolchain — https://docs.fuel.network/guides/installation/ |
| 77 | +--- |
| 78 | +- Typescript SDK — https://docs.fuel.network/docs/fuels-ts |
| 79 | +- Fuel Wallet SDK — https://docs.fuel.network/docs/wallet |
| 80 | +- Rust SDK — https://docs.fuel.network/docs/fuels-rs |
| 81 | +- GraphQL Playground — https://docs.fuel.network/docs/graphql |
| 82 | +--- |
| 83 | +- Forc — https://docs.fuel.network/docs/forc |
| 84 | +- Sway — https://docs.fuel.network/docs/sway |
| 85 | +- Fuel Core — https://github.com/FuelLabs/fuel-core |
| 86 | +- Fuel VM — https://docs.fuel.network/docs/specs/fuel-vm |
| 87 | +- Fuel Specs — https://docs.fuel.network/docs/specs |
| 88 | + |
| 89 | +# Apps & Ecosystem |
| 90 | + |
| 91 | +- Fuel Bridge — https://app.fuel.network/bridge |
| 92 | +- Block Explorer — https://app.fuel.network |
| 93 | +- Ecosystem Apps — https://app.fuel.network/ecosystem |
| 94 | + |
| 95 | +# Get in Touch |
| 96 | + |
| 97 | +- `Forum` — https://forum.fuel.network |
| 98 | +- `Discord` — https://discord.gg/xfpK4Pe |
| 99 | + |
| 100 | + |
| 101 | +# Contribute |
79 | 102 |
|
80 |
| -Learn more about the Fuel Ecosystem. |
| 103 | +- [./CONTRIBUTING.md](https://github.com/FuelLabs/fuels-ts/blob/master/CONTRIBUTING.md) |
81 | 104 |
|
82 |
| -- [🌴 Sway](https://docs.fuel.network/docs/sway/) — The new language, empowering everyone to build reliable and efficient smart contracts |
83 |
| -- [🧰 Forc](https://docs.fuel.network/docs/forc/) — The Fuel toolbox: _Build, deploy and manage your sway projects_ |
84 |
| -- [⚙️ Fuel Core](https://github.com/FuelLabs/fuel-core) — The new FuelVM, a blazingly fast blockchain VM |
85 |
| -- [🔗 Fuel Specs](https://github.com/FuelLabs/fuel-specs) — The Fuel protocol specifications |
86 |
| -- [💼 Fuels Wallet](https://github.com/FuelLabs/fuels-wallet) — The Official Fuels Wallet |
87 |
| -- [🦀 Rust SDK](https://github.com/FuelLabs/fuels-rs) — A robust SDK in rust |
88 |
| -- [⚡ Fuel Network](https://fuel.network/) — The project |
89 |
| -- [📚 The Fuel Forum](https://forum.fuel.network/) — Ask questions, get updates, and contribute to a modular future |
90 | 105 |
|
91 | 106 | # License
|
92 | 107 |
|
|
0 commit comments