listAddressMessages Query
Parameters
address
string
REQUIRED
The address for which the messages is to be fetched
Returns
data
object
The data object which contains the following fields:
blocks
object
The object that holds information about the queried block
amount
string
The amount of the message
sender
string
The address of the sender who initiated the message
recipient
string
The address of the recipient of the message (in this case, the address you queried
nonce
string
A unique identifier or counter associated with the message
data
string
Optional additional data included in the message
Request
curl --location 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "query": "query MessageInfo($address: Address) { messages(owner: $address, first: 5) { nodes { amount sender recipient nonce data daHeight } } }", "variables": { "address": "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07" } }'
const MESSAGE_INFO_QUERY = ` query MessageInfo($address: Address) { messages(owner: $address, first: 5) { nodes { amount sender recipient nonce data daHeight } } } `; const QUERY_VARIABLES = { address: '0xce9f8d9367fc4671c0ececce7ab603f6f75d1e66082a82ad12ecdc219b308820', }; const fetchMessageInfo = async () => { try { const response = await fetch('https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify({ query: MESSAGE_INFO_QUERY, variables: QUERY_VARIABLES, }), }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const result = await response.json(); console.log('Messages:', result.data.messages.nodes); } catch (error) { console.error('Error fetching messages:', error); } }; fetchMessageInfo();
const myHeaders = new Headers(); myHeaders.append("Accept", "application/json"); myHeaders.append("Content-Type", "application/json"); const raw = JSON.stringify({ "query": "query MessageInfo($address: Address) { messages(owner: $address, first: 5) { nodes { amount sender recipient nonce data daHeight } } }", "variables": { "address": "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07" } }); const requestOptions = { method: "POST", headers: myHeaders, body: raw, redirect: "follow" }; fetch("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql", requestOptions) .then((response) => response.text()) .then((result) => console.log(result)) .catch((error) => console.error(error));
const { ApolloClient, InMemoryCache, gql } = require('@apollo/client/core'); const fetch = require('cross-fetch'); const client = new ApolloClient({ uri: 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', cache: new InMemoryCache(), fetch: fetch, headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' } }); const MESSAGE_INFO_QUERY = gql` query MessageInfo($address: Address) { messages(owner: $address, first: 5) { nodes { amount sender recipient nonce data daHeight } } } `; const variables = { address: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07" }; client.query({ query: MESSAGE_INFO_QUERY, variables: variables }) .then(result => { console.log('Message Information:', JSON.stringify(result.data, null, 2)); }) .catch(error => console.error('Error:', error));
import requests import json url = "https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql" payload = json.dumps({ "query": "query MessageInfo($address: Address) { messages(owner: $address, first: 5) { nodes { amount sender recipient nonce data daHeight } } }", "variables": { "address": "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07" } }) headers = { 'Accept': 'application/json', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text)
require "uri" require "json" require "net/http" url = URI("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["Accept"] = "application/json" request["Content-Type"] = "application/json" request.body = JSON.dump({ "query": "query MessageInfo(\$address: Address) { messages(owner: \$address, first: 5) { nodes { amount sender recipient nonce data daHeight } } }", "variables": { "address": "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07" } }) response = https.request(request) puts response.read_body
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free