Skip to content

Commit

Permalink
Merge pull request #60 from FuelLabs/sarah/bump
Browse files Browse the repository at this point in the history
chore: bump to testnet
  • Loading branch information
sarahschwartz authored May 29, 2024
2 parents a88f590 + 1449600 commit f3b7883
Show file tree
Hide file tree
Showing 34 changed files with 5,096 additions and 3,604 deletions.
46 changes: 15 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,29 @@ A simple farming game written in Sway.

## Running Locally

Make sure you have `fuelup` installed and are using the `beta-5` toolchain.
Make sure you have [`fuelup`](https://docs.fuel.network/guides/installation/) installed and are using the `latest` toolchain.

Install the Fuel Wallet extension and copy your wallet address. In the frontend folder, open the `src/App.tsx` file and add the following lines using your Fuel wallet address:

```javascript
const myWallet = new WalletLocked("fuel123....");
console.log("WALLET:", myWallet.address.toB256());
```

Run the frontend locally with `npm start`, and check your console to see your Fuel wallet address in B256 format. Copy this address and update the `owner` field as shown below in the `chainConfig.json` file so that your wallet will have test funds.
Install a Fuel-compatible wallet extension and copy your wallet address in b256 format (it should start with `0x` instead of `fuel`). In the frontend folder, open the `src/chainConfig.json` file and edit line 7 to use your address. This step will make sure your wallet has test funds on your local network.

```json
"initial_state": {
"coins": [
{
"owner": "0x_YOUR_FUEL_WALLET_ADDRESS",
"amount": "0x00000000FFFFFFFF",
"asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
]
},
{
"owner": "0xYOUR_ADDRESS_HERE",
"amount": "0x00000000FFFFFFFF",
"asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
```

Run the command below in the main project folder to start a local node.
Run the command below inside the `frontend` folder to start a local node, generate TypeScript types, and deploy the contract locally:

```shell
fuel-core run --db-type in-memory --chain ./chainConfig.json
```sh
cd frontend
npx fuels dev
```

Next, in the `contract` folder, run the command below to deploy the contract to your local node.
You should see the message `🎉 Dev completed successfully!`.

```shell
forc deploy --unsigned
```

In your wallet, add a network with `http://127.0.0.1:4000/graphql` and switch to that network.
Next, run the frontend locally with `npm start`.

The contract ID should match the `CONTRACT_ID` in `frontend/src/constants.ts`. If you update the contract and the contract ID changes, you must update it here and run the command below in the `frontend` folder to generate new types.
The contract ID will automatically be updated, but the asset ID won't, so you'll have to make sure that is updated everytime the contract redeploys.

```shell
npx fuels typegen -i ../contract/out/debug/*-abi.json -o ./src/contracts
```
Make sure your wallet is also connected to your local network instead of the testnet.
46 changes: 0 additions & 46 deletions chainConfig.json

This file was deleted.

Loading

0 comments on commit f3b7883

Please sign in to comment.