Skip to content

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

Notifications You must be signed in to change notification settings

TreasureProject/treasure-governance-staking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •