getChainName Query
Parameters
This method does not accept any parameters
Returns
data
object
Loading...
chain
object
Loading...
name
string
Loading...
Request
1curl --location 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql' \2--header 'Accept: application/json' \3--header 'Content-Type: application/json' \4--data '{5"query": "{ chain{name}} "6}'
1curl --location 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql' \2--header 'Accept: application/json' \3--header 'Content-Type: application/json' \4--data '{5"query": "{ chain{name}} "6}'
1const CHAIN_NAME_QUERY = `2query {3chain {4name5}6}7`;89const fetchChainName = async (): Promise<void> => {10try {11const response = await fetch('https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', {12method: 'POST',13headers: {14'Accept': 'application/json',15'Content-Type': 'application/json',16},17body: JSON.stringify({18query: CHAIN_NAME_QUERY,19}),20});2122if (!response.ok) {23throw new Error(`HTTP error! status: ${response.status}`);24}2526const result = await response.json();27console.log('Chain Name:', result.data.chain.name);28} catch (error) {29console.error('Error fetching chain name:', error);30}31};3233fetchChainName();34
1const CHAIN_NAME_QUERY = `2query {3chain {4name5}6}7`;89const fetchChainName = async (): Promise<void> => {10try {11const response = await fetch('https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', {12method: 'POST',13headers: {14'Accept': 'application/json',15'Content-Type': 'application/json',16},17body: JSON.stringify({18query: CHAIN_NAME_QUERY,19}),20});2122if (!response.ok) {23throw new Error(`HTTP error! status: ${response.status}`);24}2526const result = await response.json();27console.log('Chain Name:', result.data.chain.name);28} catch (error) {29console.error('Error fetching chain name:', error);30}31};3233fetchChainName();34
1const myHeaders = new Headers();2myHeaders.append("Accept", "application/json");3myHeaders.append("Content-Type", "application/json");45const raw = JSON.stringify({6"query": "{ chain{name}} "7});89const requestOptions = {10method: "POST",11headers: myHeaders,12body: raw,13redirect: "follow"14};1516fetch("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql", requestOptions)17.then((response) => response.text())18.then((result) => console.log(result))19.catch((error) => console.error(error));
1const myHeaders = new Headers();2myHeaders.append("Accept", "application/json");3myHeaders.append("Content-Type", "application/json");45const raw = JSON.stringify({6"query": "{ chain{name}} "7});89const requestOptions = {10method: "POST",11headers: myHeaders,12body: raw,13redirect: "follow"14};1516fetch("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql", requestOptions)17.then((response) => response.text())18.then((result) => console.log(result))19.catch((error) => console.error(error));
1const { ApolloClient, InMemoryCache, gql } = require('@apollo/client/core');2const fetch = require('cross-fetch');34const client = new ApolloClient({5uri: 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql',6cache: new InMemoryCache(),7fetch: fetch,8headers: {9'Accept': 'application/json',10'Content-Type': 'application/json'11}12});1314const CHAIN_NAME_QUERY = gql`15{16chain {17name18}19}20`;2122client.query({23query: CHAIN_NAME_QUERY24})25.then(result => {26console.log('Chain Name:', result.data.chain.name);27})28.catch(error => console.error('Error:', error));
1const { ApolloClient, InMemoryCache, gql } = require('@apollo/client/core');2const fetch = require('cross-fetch');34const client = new ApolloClient({5uri: 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql',6cache: new InMemoryCache(),7fetch: fetch,8headers: {9'Accept': 'application/json',10'Content-Type': 'application/json'11}12});1314const CHAIN_NAME_QUERY = gql`15{16chain {17name18}19}20`;2122client.query({23query: CHAIN_NAME_QUERY24})25.then(result => {26console.log('Chain Name:', result.data.chain.name);27})28.catch(error => console.error('Error:', error));
1import requests2import json34url = "https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql"56payload = json.dumps({7"query": "{chain{name}} "8})9headers = {10'Accept': 'application/json',11'Content-Type': 'application/json'12}1314response = requests.request("POST", url, headers=headers, data=payload)1516print(response.text)17
1import requests2import json34url = "https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql"56payload = json.dumps({7"query": "{chain{name}} "8})9headers = {10'Accept': 'application/json',11'Content-Type': 'application/json'12}1314response = requests.request("POST", url, headers=headers, data=payload)1516print(response.text)17
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql")67https = Net::HTTP.new(url.host, url.port)8https.use_ssl = true910request = Net::HTTP::Post.new(url)11request["Accept"] = "application/json"12request["Content-Type"] = "application/json"13request.body = JSON.dump({14"query": "{chain{name}} "15})1617response = https.request(request)18puts response.read_body19
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql")67https = Net::HTTP.new(url.host, url.port)8https.use_ssl = true910request = Net::HTTP::Post.new(url)11request["Accept"] = "application/json"12request["Content-Type"] = "application/json"13request.body = JSON.dump({14"query": "{chain{name}} "15})1617response = https.request(request)18puts response.read_body19
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free