Skip to content

Latest commit

 

History

History
210 lines (157 loc) · 3.94 KB

xmtp.md

File metadata and controls

210 lines (157 loc) · 3.94 KB
description layout
Learn how check if a solana address has enabled XMTP or not.
title description tableOfContents outline pagination
visible
true
visible
true
visible
true
visible
visible
true

📬 XMTP

Table Of Contents

In this guide, you will learn how to use Airstack to check if a Solana address has XMTP enabled.

Pre-requisites

  • An Airstack account
  • Basic knowledge of GraphQL

Get Started

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.

Check Solana Address Has XMTP Enabled

Simply use the following query to check if a solana address has enabled XMTP or not with this example of a user that has an XMTP:

Try Demo

{% embed url="https://app.airstack.xyz/query/mGXyVnJfRe" %} Check if GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV has XMTP enabled {% endembed %}

Code

{% tabs %} {% tab title="Query" %}

query MyQuery {
  XMTPs(
    input: {
      blockchain: ALL
      filter: { owner: { _eq: "GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV" } }
    }
  ) {
    XMTP {
      isXMTPEnabled
    }
  }
}

{% endtab %}

{% tab title="Response" %}

{
  "data": {
    "XMTPs": {
      "XMTP": [
        {
          "isXMTPEnabled": true
        }
      ]
    }
  }
}

{% endtab %} {% endtabs %}

Developer Support

If you have any questions or need help regarding checking whether a solana address has XMTP enabled or not, please join our Airstack's Telegram group.

More Resources