FuelLabs / fuels-ts

Fuel Network Typescript SDK
https://docs.fuel.network/docs/fuels-ts/
Apache License 2.0
44.1k stars 1.34k forks source link

Add `Getting started` tutorial to docs with a simple example Dapp #259

Closed luizstacio closed 2 years ago

luizstacio commented 2 years ago

How to create a Dapp

Ref.: https://github.com/FuelLabs/swayswap

camsjams commented 2 years ago

Would this live within the fuels-ts repo?

camsjams commented 2 years ago

It was decided to store this on https://github.com/FuelLabs/sway-applications for now

luizstacio commented 2 years ago

@camsjams I think would be nice to add a link for this demo on the fuels-ts docs also

camsjams commented 2 years ago

Set up on here: https://github.com/FuelLabs/sway-applications/pull/61

@luizstacio @AlicanC @pedronauck @QuinnLee Here are two tutorials I made: Counter: https://github.com/FuelLabs/sway-applications/tree/more-getting-started/tutorials/counter

Todo List: https://github.com/FuelLabs/sway-applications/tree/more-getting-started/tutorials/todo (this one can be improved later once this feature is enabled: https://github.com/FuelLabs/sway/issues/1626)

AlicanC commented 2 years ago

Would be cool if we had some CodeSandbox links like: https://codesandbox.io/s/currying-flower-gjpiik?file=/src/App.tsx

People could click a link and start hacking on the example right away. I can't think of any easier way to experience Fuel as a developer TBH. I'd say fuels-ts has the power and responsibility to be the fastest and easiest way to hack on Fuel. We can really shine here!

See: https://codesandbox.io/docs/importing#import-from-github See: https://codesandbox.io/docs/configuration

camsjams commented 2 years ago

I like that idea and can do that also. The only question I'd have is for the Provider and wallet, would it just use some default to allow developers a fast track on Code Sandbox without having to setup a wallet with coins and contract?

AlicanC commented 2 years ago

The Provider can point to the official testnet deployment. (Not sure what the URL for that is ATM. Infra should know.)

For the wallet, we could just generate a random one and store it in LocalStorage. I don't know how we would do fauceting though. We could maybe copy the fauceting code from SwaySwap. One thing I don't like about that is we would need to add Google reCAPTCHA to these projects. Maybe that's okay since we won't need it when we have a web wallet.

luizstacio commented 2 years ago

We are looking for a codes andbox to only play with fuels-ts SDK or also Contracts?

camsjams commented 2 years ago

For now just the SDK, see options, building off of what @AlicanC mentioned

  1. Use testnet Provider, with contract and wallet already created
    • If every user shared the same Wallet, a single user could somehow use up all of the coins and break that wallet (however unlikely)
  2. Create a provider and mechanisms for a Faucet
    • There would likely need to be a captcha