GithubHelp home page GithubHelp logo

treasureproject / treasure-governance-staking Goto Github PK

View Code? Open in Web Editor NEW
0.0 5.0 1.0 1.18 MB

Temporary site for staking MAGIC to earning gMAGIC voting power used in TreasureDAO Snapshot voting.

Home Page: https://governance-staking.treasure.lol

Shell 0.18% TypeScript 92.38% CSS 3.31% JavaScript 1.56% Dockerfile 2.57%
dao web3

treasure-governance-staking's Introduction

TreasureDAO Governance Staking

Temporary site for staking MAGIC to earning gMAGIC voting power used in TreasureDAO Snapshot voting.

Tech Stack

  • Remix
  • Tailwind CSS
  • GraphQL Codegen
  • wagmi
  • react-hot-toast
  • Deployment on fly.io

Development

npm run dev

Open up localhost:3000 and you should be ready to go!

Working with graphQL

If you are fetching data from an external GraphQL endpoint, first add your endpoint in .env.

Write your query inside app.queries.ts. Theres an example in there. When you're done, run npm run codegen. Your autogenerated code will appear under the same file, /graphql

Then create a file called api.server.ts under utils. Naming it with a server prefix will tell Remix to not bundle that file in client JavaScript.

Something like this:

import { GraphQLClient } from "graphql-request";

import { getSdk as getExchangeSdk } from "~/graphql/exchange.generated";

// Passing URL here, since you'd want to have different endpoints depending on production or not
export const exchangeSdk = (url: string) =>
  getExchangeSdk(new GraphQLClient(url, { fetch }));

Now you can use this in your loaders, where it will fetch from that endpoint and server side render your app.

ex.

import { exchangeSdk } from "~/utils.api.server";

export const loader: LoaderFunction = async () => {
  const sdk = exchangeSdk(url);

  return json<LoaderData>({
    data: await sdk.hello(),
  });
};

// then use it client like this:
export default function Index() {
  const data = useLoaderData<typeof loader>();

  return <div>{data.hello}</div>;
}

Deployment

  1. run fly launch and configure the repo for fly.io deployement

  2. npm run deploy

treasure-governance-staking's People

Contributors

alecananian avatar jcheese1 avatar karelvuong avatar antlion12 avatar

Watchers

 avatar Yuri Visser avatar Wyatt Mufson 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.