Code Monkey home page Code Monkey logo

mstable-questbook's Introduction

mStable QuestBook

GraphQL API for checking and signing mStable Quests

Quickstart

  1. Install Firebase tools

  2. Firebase login

firebase login
  1. Set project (optional)
firebase use ropsten
  1. Go to functions module
cd functions
  1. Get environment variables locally
firebase functions:config:get > .runtimeconfig.json
  1. Install, then build and run with emulators
yarn
yarn serve

Deployment

# From the root of the projecet
firebase use production
firebase deploy

Environment variables

See the Firebase documentation for instructions on how to set the config.

API

query Quest($id: ID!, $account: ID!) {
    quest(id: $id) {
        id
        metadata {
            title
            description
        }
        submission(account: $account) {
            complete
            progress
            signature
        }
    }
}

mutation Submit($id: ID! $account: ID!) {
    submitQuest(id: $id, account: $account) {
        complete
        progress
        signature
    }
}

Defining quests

Quests are defined programmatically; to add a new quest, copy an example and create a PR.

Quests need to have unique IDs; the numeric ID of the quest on-chain.

See src/quests/certifiedWhale.ts for an example.

Data sources

Quest checker functions have access to the data sources that the Apollo server uses. These can be used like so:

const certifiedWhale: QuestChecker = async (dataSources, account) => {
  const balance = await dataSources.stakedToken.contract.balanceOf(account)
  // ...do something with the balance
}

Data sources can be added as-needed; just extend Apollo's DataSource class (or find an existing implentation) and add them to the Apollo server's dataSources prop.

mstable-questbook's People

Contributors

jameslefrere avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

isabella232

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.