๐Ÿ“ฆ FuelLabs / fuels-ts

๐Ÿ“„ README.md ยท 109 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109# fuels-ts

Typescript SDK for Fuel.

[![test](https://github.com/FuelLabs/fuels-ts/actions/workflows/test.yaml/badge.svg)](https://github.com/FuelLabs/fuels-ts/actions/workflows/test.yaml)
[![docs](https://img.shields.io/badge/docs-fuels.ts-brightgreen.svg?style=flat)](https://docs.fuel.network/docs/fuels-ts/)
[![npm](https://img.shields.io/npm/v/fuels)](https://www.npmjs.com/package/fuels)
[![discord](https://img.shields.io/badge/chat%20on-discord-orange?&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/xfpK4Pe)

# Install ([docs](https://docs.fuel.network/docs/fuels-ts/getting-started/installation))

```console
npm install fuels --save
```

# Connect ([docs](https://docs.fuel.network/docs/fuels-ts/getting-started/connecting-to-the-network/))

| Network   | URL                                                                                                              |
| --------- | --------------------------------------------------------------------------------------------------------------- |
| Mainnet   | `https://mainnet.fuel.network/v1/graphql`                                                                       |
| Testnet   | `https://testnet.fuel.network/v1/graphql`                                                                       |
| Localhost | [Running a local Fuel node](https://docs.fuel.network/docs/fuels-ts/getting-started/running-a-local-fuel-node/) |

```ts
import { Provider } from 'fuels';

const NETWORK_URL = 'https://mainnet.fuel.network/v1/graphql';

const provider = new Provider(NETWORK_URL);

const chainId = await provider.getChainId();
const gasConfig = await provider.getGasConfig();
const baseAssetId = await provider.getBaseAssetId();

console.log({ chainId, gasConfig, baseAssetId });
```

# Create a new dApp ([docs](https://docs.fuel.network/docs/fuels-ts/creating-a-fuel-dapp/))

```console
$ npm create fuels

โ—‡ What is the name of your project? #
โ”‚ my-fuel-project
โ””

โšก๏ธ Success! Created a fullstack Fuel dapp at: my-fuel-project.
```

# Enjoy the `fuels` CLI ([docs](https://docs.fuel.network/docs/fuels-ts/fuels-cli/))

```console
$ npm install fuels --save
$ npm fuels --help

Commands:
  init [options]      Create a sample `fuel.config.ts` file
  build [options]     Build Sway programs and generate Typescript for them
  deploy [options]    Deploy contracts to the Fuel network
  dev [options]       Start a Fuel node with hot-reload capabilities
  node [options]      Start a Fuel node using project configs
  typegen [options]   Generate Typescript from Sway ABI JSON files
  versions [options]  Check for version incompatibilities
  help [command]      Display help for command
```

In-depth docs:
- [`fuels init`](https://docs.fuel.network/docs/fuels-ts/fuels-cli/commands#fuels-init) โ€” Creates a new `fuels.config.ts` file
- [`fuels build`](https://docs.fuel.network/docs/fuels-ts/fuels-cli/commands#fuels-build) โ€” Build `forc` workspace and generate Typescript types for everything
- [`fuels deploy`](https://docs.fuel.network/docs/fuels-ts/fuels-cli/commands#fuels-deploy) โ€” Deploy workspace contracts and save their IDs to JSON file
- [`fuels dev`](https://docs.fuel.network/docs/fuels-ts/fuels-cli/commands#fuels-dev) โ€” Start a Fuel node with hot-reload capabilities


# Official Docs

- Install The Fuel Toolchain โ€” https://docs.fuel.network/guides/installation/
---
- Typescript SDK โ€” https://docs.fuel.network/docs/fuels-ts
- Fuel Wallet SDK โ€” https://docs.fuel.network/docs/wallet
- Rust SDK โ€” https://docs.fuel.network/docs/fuels-rs
- GraphQL Playground โ€” https://docs.fuel.network/docs/graphql
---
- Forc โ€” https://docs.fuel.network/docs/forc
- Sway โ€” https://docs.fuel.network/docs/sway
- Fuel Core โ€” https://github.com/FuelLabs/fuel-core
- Fuel VM โ€” https://docs.fuel.network/docs/specs/fuel-vm
- Fuel Specs โ€” https://docs.fuel.network/docs/specs

# Apps & Ecosystem

- Fuel Bridge โ€” https://app.fuel.network/bridge
- Block Explorer โ€” https://app.fuel.network
- Ecosystem Apps โ€” https://app.fuel.network/ecosystem

# Get in Touch

- `Forum` โ€” https://forum.fuel.network
- `Discord` โ€” https://discord.gg/xfpK4Pe


# Contribute

- [./CONTRIBUTING.md](https://github.com/FuelLabs/fuels-ts/blob/master/CONTRIBUTING.md)


# License

The primary license for this repo is `Apache 2.0`, see [`LICENSE`](https://github.com/FuelLabs/fuels-ts/blob/master/LICENSE).