MCPcopy Index your code
hub / github.com/FuelLabs/sway-farm

github.com/FuelLabs/sway-farm @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
123 symbols 293 edges 45 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

sway-farm

A simple farming game written in Sway.

Running Locally

Make sure you have fuelup installed and are using the latest toolchain.

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.

{
  "owner": "0xYOUR_ADDRESS_HERE",
  "amount": "0x00000000FFFFFFFF",
  "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
},

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

cd frontend
npx fuels dev

You should see the message 🎉 Dev completed successfully!.

Next, run the frontend locally with npm start.

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.

Make sure your wallet is also connected to your local network instead of the testnet.

Extension points exported contracts — how you extend this code

MobileControlsProps (Interface)
(no doc)
frontend/src/components/MobileControls.tsx
MobileButtonProps (Interface)
(no doc)
frontend/src/components/MobileControls.tsx
GardenTileProps (Interface)
(no doc)
frontend/src/components/GardenTile.tsx
CameraProps (Interface)
(no doc)
frontend/src/components/Camera.tsx
GardenProps (Interface)
(no doc)
frontend/src/components/Garden.tsx

Core symbols most depended-on inside this repo

updatePageNum
called by 15
frontend/src/components/Game.tsx
useTransaction
called by 5
frontend/src/hooks/useTransaction.ts
getRecaptchaToken
called by 4
frontend/src/hooks/usePaymaster.ts
updatePlayerPosition
called by 3
frontend/src/components/Player.tsx
getBalance
called by 3
frontend/src/components/show/ShowCoins.tsx
convertTime
called by 2
frontend/src/constants.ts
updateTileState
called by 2
frontend/src/components/GardenTile.tsx
encodePosition
called by 2
frontend/src/components/Player.tsx

Shape

Function 88
Interface 21
Class 6
Enum 4
Method 4

Languages

TypeScript100%

Modules by API surface

frontend/src/components/Player.tsx12 symbols
frontend/src/sway-api/contracts/FarmContract.ts8 symbols
frontend/src/hooks/usePaymaster.ts7 symbols
frontend/src/components/Game.tsx7 symbols
frontend/src/components/modals/SellItem.tsx6 symbols
frontend/src/components/modals/PlantModal.tsx6 symbols
frontend/src/components/modals/HarvestModal.tsx6 symbols
frontend/src/components/modals/BuySeeds.tsx6 symbols
frontend/src/components/NewPlayer.tsx6 symbols
frontend/src/constants.ts5 symbols
frontend/src/components/MobileControls.tsx5 symbols
frontend/src/sway-api/contracts/FarmContractFactory.ts4 symbols

For agents

$ claude mcp add sway-farm \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact