description | layout | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn how to fetch user's Moxie claim details, which includes data such as the amount of Moxie that user has claimed, is claimable by user, or still in the claiming process. |
|
Moxie provide everyday rewards for users on Farcaster and through Moxie's cast action, user is able to claim these rewards every 24 hour periods.
With the FarcasterMoxieClaimDetails
API, you will be able to get the claim details of a Farcaster user broken down to, claimable amount, claimed amount, and processed amount.
For more details, check out the use cases below.
- Get The Accumulated Amount Oof Moxie Everyday Rewards Claimable by Certain User
- Get The Total Amount If Moxie Everyday Rewards Claimed By Certain User
- Get The Amount Of Moxie In Process Of Being Claimed By Certain User
- An Airstack account
- Basic knowledge of GraphQL
JavaScript/TypeScript/Python
If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:
{% tabs %} {% tab title="npm" %} React
npm install @airstack/airstack-react
Node
npm install @airstack/node
{% endtab %}
{% tab title="yarn" %} React
yarn add @airstack/airstack-react
Node
yarn add @airstack/node
{% endtab %}
{% tab title="pnpm" %} React
pnpm install @airstack/airstack-react
Node
pnpm install @airstack/node
{% endtab %}
{% tab title="pip" %}
pip install airstack
{% endtab %} {% endtabs %}
Then, add the following snippets to your code:
{% tabs %} {% tab title="React" %}
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>;
}
};
{% endtab %}
{% tab title="Node" %}
import { init, fetchQuery } from "@airstack/node";
init("YOUR_AIRSTACK_API_KEY");
const query = `YOUR_QUERY`; // Replace with GraphQL Query
const { data, error } = await fetchQuery(query);
console.log("data:", data);
console.log("error:", error);
{% endtab %}
{% tab title="Python" %}
import asyncio
from airstack.execute_query import AirstackClient
api_client = AirstackClient(api_key="YOUR_AIRSTACK_API_KEY")
query = """YOUR_QUERY""" # Replace with GraphQL Query
async def main():
execute_query_client = api_client.create_execute_query_object(
query=query)
query_response = await execute_query_client.execute_query()
print(query_response.data)
asyncio.run(main())
{% endtab %} {% endtabs %}
Other Programming Languages
To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.
You can use FarcasterMoxieClaimDetails
to fetch the amount of Moxie claimable by a certain Farcaster user by providing the FID of the user to the fid
input filter:
{% embed url="https://app.airstack.xyz/query/Eqk4qTh5Wo" %} Show me the amount of Moxie available for claim for FID 602 {% endembed %}
{% tabs %} {% tab title="Query" %}
query MyQuery {
FarcasterMoxieClaimDetails(
input: {
filter: {
fid: {
_eq: "602" # Specify user's FID here
}
},
blockchain: ALL
}
) {
FarcasterMoxieClaimDetails {
availableClaimAmount
availableClaimAmountInWei
}
}
}
{% endtab %}
{% tab title="Response" %}
{
"data": {
"FarcasterMoxieClaimDetails": {
"FarcasterMoxieClaimDetails": [
{
"availableClaimAmount": 30239.014380375822,
"availableClaimAmountInWei": "30239014380375823000000"
}
]
}
}
}
{% endtab %} {% endtabs %}
You can use FarcasterMoxieClaimDetails
to fetch the amount of Moxie claimed by a certain Farcaster user by providing the FID of the user to the fid
input filter:
{% embed url="https://app.airstack.xyz/query/d8fxrTivTH" %} Show me the amount of Moxie claimed by FID 602 {% endembed %}
{% tabs %} {% tab title="Query" %}
query MyQuery {
FarcasterMoxieClaimDetails(
input: {
filter: {
fid: {
_eq: "602" # Specify user's FID here
}
},
blockchain: ALL
}
) {
FarcasterMoxieClaimDetails {
claimedAmount
claimedAmountInWei
}
}
}
{% endtab %}
{% tab title="Response" %}
{
"data": {
"FarcasterMoxieClaimDetails": {
"FarcasterMoxieClaimDetails": [
{
"claimedAmount": 360579.2465510323,
"claimedAmountInWei": "360579246551032300000000"
}
]
}
}
}
{% endtab %} {% endtabs %}
You can use FarcasterMoxieClaimDetails
to fetch the amount of Moxie in the process of being claimed by a certain Farcaster user by providing the FID of the user to the fid
input filter:
{% hint style="info" %} If you have Moxie stuck in the claimed process for a very long time, feel free to reach out to the Airstack team at /airstack Warpcast channel. {% endhint %}
{% embed url="https://app.airstack.xyz/query/mVXWdMA58f" %} Show me the amount of Moxie in process of being claimed by FID 602 {% endembed %}
{% tabs %} {% tab title="Query" %}
query MyQuery {
FarcasterMoxieClaimDetails(
input: {
filter: {
fid: {
_eq: "602" # Specify user's FID here
}
},
blockchain: ALL
}
) {
FarcasterMoxieClaimDetails {
processingAmount
processingAmountInWei
}
}
}
{% endtab %}
{% tab title="Response" %}
{
"data": {
"FarcasterMoxieClaimDetails": {
"FarcasterMoxieClaimDetails": [
{
"processingAmount": 0,
"processingAmountInWei": "0"
}
]
}
}
}
{% endtab %} {% endtabs %}
If you have any questions or need help regarding fetching Moxie claim details of Farcaster users, please join our Airstack's Telegram group.