Giter VIP home page Giter VIP logo

sway-farm's Introduction

sway-farm

A simple farming game written in Sway.

Running Locally

Make sure you have fuelup installed and are using the beta-5 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:

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.

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

Run the command below in the main project folder to start a local node.

fuel-core run --db-type in-memory --chain ./chainConfig.json

Next, in the contract folder, run the command below to deploy the contract to your local node.

forc deploy --unsigned

In your wallet, add a network with http://127.0.0.1:4000/graphql and switch to that network.

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.

npx fuels typegen -i ../contract/out/debug/*-abi.json -o ./src/contracts

sway-farm's People

Contributors

bitzoic avatar brandonsurh avatar calldelegation avatar sarahschwartz avatar

Stargazers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.