đŸĻ¸Moxie Heroes

Learn how to fetch all the Farcaster users that are currently designated as Moxie Heroes and the variable boost they received on their FarScore.

Moxie Heroes are designated each week based on their prior week's quality and diversity of engagement. Every week Moxie Heroes get a variable boost to their FarScore based on their existing score.

Heroes can keep these powers for themselves or transfer to another user. Heroes' superpowers last for a full week. A new set of heroes is launched each week based on previous week diversity and quality of engagement. It will be rotated so no one is hero in consecutive weeks.

Table Of Contents

Pre-requisites

  • An Airstack API key. To access this, you'll need to hold at least 1 /airstack Channel Fan Token.

  • Basic knowledge of GraphQL

Get Started

JavaScript/TypeScript/Python

If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:

React

npm install @airstack/airstack-react

Node

npm install @airstack/node

Then, add the following snippets to your code:

import { init, useQuery } from "@airstack/airstack-react";

init("YOUR_AIRSTACK_API_KEY");

const query = `YOUR_QUERY`; // Replace with GraphQL Query

const Component = () => {
  const { data, loading, error } = useQuery(query);

  if (data) {
    return <p>Data: {JSON.stringify(data)}</p>;
  }

  if (loading) {
    return <p>Loading...</p>;
  }

  if (error) {
    return <p>Error: {error.message}</p>;
  }
};

Other Programming Languages

To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.

Get All The Current Moxie Heroes

You can get the Farcaster users that are currently Moxie Heroes by using the FarScores API and configure the API by setting the heroBoost filter to greater than 0 to only fetch those with Hero boost:

Try Demo

Code

query MyQuery {
  FarScores(
    input: {
      filter: {
        # Only get user that have hero boost
        heroBoost: {_gt: 0}
      },
      limit: 200
    }
  ) {
    FarScore {
      farScore
      heroBoost
      social {
        profileName
        fid: userId
      }
    }
  }
}

Get The Moxie Hero Multiplier Of A User

You can get the Moxie Hero Multiplier by using the Socials API and inputting the user's FID in userId input and first getting the Moxie Hero Boost:

Try Demo

Code

query MyQuery {
  Socials(
    input: {
      filter: {
        dappName: {_eq: farcaster},
        userId: {_eq: "488178"}
      },
      blockchain: ethereum
    }
  ) {
    Social {
      userId
      profileName
      farcasterScore {
        farBoost
        farRank
        farScore
        farScoreRaw
        heroBoost
        liquidityBoost
        powerBoost
        tvl
        tvlBoost
      }
    }
  }
}

Once you get the Moxie Hero boost of the user, you can use the formula here to get the multiplier.

Developer Support

If you have any questions or need help regarding fetching FarScore & FarBoosts data, please join our Airstack's Telegram group.

More Resources

Last updated