-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
165 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# CDN Usage (browser only) | ||
|
||
```html | ||
<script type="module"> | ||
import { | ||
Wallet, | ||
Provider, | ||
} from "https://cdnjs.cloudflare.com/ajax/libs/fuels/{{fuels}}/browser.mjs"; | ||
const main = async () => { | ||
const provider = await Provider.create( | ||
"https://mainnet.fuel.network/v1/graphql", | ||
); | ||
const { name } = provider.getChain(); | ||
console.log(name); | ||
}; | ||
main(); | ||
</script> | ||
``` |
10 changes: 0 additions & 10 deletions
10
apps/docs/src/guide/getting-started/connecting-to-a-local-node.md
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
apps/docs/src/guide/getting-started/connecting-to-network.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Connecting to the Network | ||
|
||
After [installing](./installation.md) the `fuels` package, it's easy to connect to the Network: | ||
|
||
<<< @./snippets/connecting-to-network.ts#main{ts:line-numbers} | ||
|
||
# RPC URLs | ||
|
||
These are our official RPC URLs: | ||
|
||
| Mainnet | Testnet | | ||
| ----------------------------------------- | ----------------------------------------- | | ||
| `https://mainnet.fuel.network/v1/graphql` | `https://testnet.fuel.network/v1/graphql` | | ||
|
||
# Resources | ||
|
||
You can also access all our apps directly: | ||
|
||
| | Mainnet | Testnet | | ||
| -------- | ------------------------------------------ | ------------------------------------------ | | ||
| Faucet | — | https://faucet-testnet.fuel.network/ | | ||
| Explorer | https://app.fuel.network | https://app-testnet.fuel.network | | ||
| Bridge | https://app.fuel.network/bridge | https://app-testnet.fuel.network/bridge | | ||
| GraphQL | https://mainnet.fuel.network/v1/playground | https://testnet.fuel.network/v1/playground | | ||
|
||
# More | ||
|
||
If you want to connect to `localhost`, check this: | ||
|
||
- [Running a local Fuel node](./running-local-node.md) |
22 changes: 0 additions & 22 deletions
22
apps/docs/src/guide/getting-started/connecting-to-testnet.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
# Further Resources | ||
|
||
For a more in-depth, step-by-step guide on working with the wider Fuel ecosystem, check out the [Developer Quickstart](https://docs.fuel.network/guides/quickstart/). This guide covers: | ||
For a more in-depth, step-by-step guide on working with the wider Fuel ecosystem, check out the [Developer Quickstart](https://docs.fuel.network/guides/quickstart/), which covers: | ||
|
||
1. Installing all tools needed to develop with the Fuel ecosystem. | ||
|
||
2. Writing your first Sway Project. | ||
|
||
3. Deploying your contract. | ||
|
||
4. Building a simple front-end dApp to interact with your deployed contract. | ||
1. Installing all tools needed to develop with the Fuel ecosystem | ||
1. Writing your first Sway Project | ||
1. Deploying your contract | ||
1. Building a simple front-end dApp to interact with your deployed contract |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
# Getting Started | ||
|
||
This guide will walk you through the process of setting up and using the Fuels-ts library in your front-end project. | ||
Welcome to `fuels` Typescript SDK! | ||
|
||
We prepared a couple guides to walk you through your first steps: | ||
|
||
1. [Installation](/guide/getting-started/installation) | ||
1. [Connecting to the Network](/guide/getting-started/connecting-to-network) | ||
1. [Running a local Fuel node](/guide/getting-started/running-local-node) | ||
1. [React Example](/guide/getting-started/react-example) | ||
1. [CDN Usage](/guide/getting-started/cdn-usage) | ||
1. [Further Resources](/guide/getting-started/further-resources) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# React Example | ||
|
||
<!-- TODO: Create properly code snippet on new package: `app/react-app` after https://github.com/FuelLabs/fuels-ts/pull/827 got merged --> | ||
|
||
```tsx | ||
import { BN, Provider, Wallet } from "fuels"; | ||
import { useEffect, useState } from "react"; | ||
|
||
function App() { | ||
const [balance, setBalance] = useState(0); | ||
|
||
useEffect(() => { | ||
const main = async () => { | ||
const provider = await Provider.create( | ||
"https://mainnet.fuel.network/v1/graphql", | ||
); | ||
|
||
const wallet = Wallet.fromAddress("0x...", provider); | ||
const { balances } = await wallet.getBalances(); | ||
|
||
setBalance(new BN(balances[0].amount).toNumber()); | ||
}; | ||
|
||
main(); | ||
}, []); | ||
|
||
return <div>My Balance: {balance}</div>; | ||
} | ||
|
||
export default App; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Running a local Fuel node | ||
|
||
Remember to first install the [Fuel Toolchain](https://docs.fuel.network/guides/installation/). | ||
|
||
Then check the command self documentation: | ||
|
||
::: code-group | ||
|
||
```sh-vue [Fuel Binary] | ||
fuel-core | ||
``` | ||
|
||
<!-- ```sh-vue [Forc] | ||
forc node | ||
``` --> | ||
|
||
```sh-vue [TS SDK] | ||
fuels node | ||
``` | ||
|
||
::: | ||
|
||
Check also the online docs: | ||
|
||
| | Command | Documentation | | ||
| ----------- | ------------ | ------------------------------------------------------------------------------------------------------ | | ||
| Fuel Binary | `fuel-core` | [docs](https://docs.fuel.network/guides/running-a-node/running-a-local-node/) — Running a local node | | ||
| TS SDK | `fuels node` | [docs](https://docs.fuel.network/docs/fuels-ts/fuels-cli/commands/#fuels-node) — Using the `fuels` CLI | | ||
|
||
<!-- | Forc | `forc node` | [docs](https://docs.fuel.network/docs/forc/commands/forc_node/) | --> | ||
|
||
# Testing Utilities | ||
|
||
You can run a Fuel node from within your `.ts` unit tests: | ||
|
||
- [Launching a test node](../testing/launching-a-test-node.md) | ||
|
||
# Developer Utilities | ||
|
||
Configure your project for the `fuels` CLI using a `fuels.config.ts` file: | ||
|
||
- [Using the `fuels init` command](../fuels-cli/commands.md#fuels-init) | ||
|
||
It makes development easier with a hot-reload experience: | ||
|
||
- [Using the `fuels dev` command](../fuels-cli/commands.md#fuels-dev) |
6 changes: 4 additions & 2 deletions
6
...arted/snippets/connecting-to-localnode.ts → ...started/snippets/connecting-to-network.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
apps/docs/src/guide/getting-started/snippets/connecting-to-testnet.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.