🚀FarScores & FarBoosts

Learn how to fetch the FarScores, FarBoosts, FarRank of a Farcaster member. In addition, you can also fetch a user's TVL and how much it impacts a member's FarBoosts.

Every Farcaster Member earns a FarScore based on their relative influence in the Farcaster network and each FarScore user can be increased by earning FarBoosts, which consequently can also increase a Farcaster Member's FarRank.

Every 1 point on FarBoosts is earned by contributing 100,000 Moxie into your total locked value (TVL) to the Moxie protocol.

To learn more about FarScores & FarBoosts, click here.

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 The FarScores Of A User

You can get the FarScores of a user by using the Socials API and inputting the user's FID in userId input:

Try Demo

Code

query MyQuery{
  Socials(
    input: {
      filter: {
        dappName: {_eq: farcaster},
        userId: {_eq: "3"}
      },
      blockchain: ethereum
    }
  ) {
    Social {
      farcasterScore {
        farScore # Get the FarScore here
      }
    }
  }
}

Get The FarScores Of A User Without Any FarBoosts

You can get the original FarScores of a user without any FarBoosts by using the Socials API and inputting the user's FID in userId input to fetch the farScore and farBoost field:

Try Demo

Show me the FarScore & Farboosts of FID 3

Code

query MyQuery{
  Socials(
    input: {
      filter: {
        dappName: {_eq: farcaster},
        userId: {_eq: "3"}
      },
      blockchain: ethereum
    }
  ) {
    Social {
      farcasterScore {
        farScore
        farBoost
      }
    }
  }
}

To get the original FarScore without any FarBoosts, simply substract farScore to farBoost.

Get The Percentage Of Increase Of User's FarScore From FarBoosts

You can get the percentage of increase from FarBoosts by using the Socials API and inputting the user's FID in userId input to fetch the farScore and farBoost field:

Try Demo

Show me the FarScore & Farboosts of FID 3

Code

query MyQuery{
  Socials(
    input: {
      filter: {
        dappName: {_eq: farcaster},
        userId: {_eq: "3"}
      },
      blockchain: ethereum
    }
  ) {
    Social {
      farcasterScore {
        farScore
        farBoost
      }
    }
  }
}

To get the percentage of increase, simply divide farBoost by farScore and multiply it by 100%.

Get The FarRank Of A User

You can get the FarRank of a user by using the Socials API and inputting the user's FID in userId input:

Try Demo

Show me the FarRank of FID 3

Code

query MyQuery{
  Socials(
    input: {
      filter: {
        dappName: {_eq: farcaster},
        userId: {_eq: "3"}
      },
      blockchain: ethereum
    }
  ) {
    Social {
      farcasterScore {
        farRank
      }
    }
  }
}

Get The FarBoost Of A User

You can get the FarBoost of a user by using the Socials API and inputting the user's FID in userId input:

Try Demo

Show me the Farboost of FID 3

Code

query MyQuery{
  Socials(
    input: {
      filter: {
        dappName: {_eq: farcaster},
        userId: {_eq: "3"}
      },
      blockchain: ethereum
    }
  ) {
    Social {
      farcasterScore {
        farBoost
      }
    }
  }
}

Get The FarBoost Of A User Gained Only From TVL

You can get the FarBoost of a user gained only from TVL by using the Socials API and inputting the user's FID in userId input:

Try Demo

Show me the TVL Boosts of FID 3

Code

query MyQuery{
  Socials(
    input: {
      filter: {
        dappName: {_eq: farcaster},
        userId: {_eq: "3"}
      },
      blockchain: ethereum
    }
  ) {
    Social {
      farcasterScore {
        tvlBoost
      }
    }
  }
}

Get The TVL Of A User

You can get the TVL of a user in the Moxie protocol by using the Socials API and inputting the user's FID in userId input:

Try Demo

Show me the TVL of FID 3

Code

query MyQuery{
  Socials(
    input: {
      filter: {
        dappName: {_eq: farcaster},
        userId: {_eq: "3"}
      },
      blockchain: ethereum
    }
  ) {
    Social {
      farcasterScore {
        tvl
      }
    }
  }
}

The value returned in tvl will be in wei. Therefore, you should divide the number by 10^18 to get the real value.

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

Was this helpful?