getBlockInfo Query
Paramètres
Cette méthode n'accepte aucun paramètre
Retours
données
objet
Chargement en cours...
block
objet
Chargement en cours...
id
chaîne de caractères
Chargement en cours...
hauteur
chaîne de caractères
Chargement en cours...
transactions
tableau
Chargement en cours...
id
chaîne de caractères
Chargement en cours...
Demande
1curl --location 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql' \2--header 'Accept: application/json' \3--en-tête 'Content-Type: application/json' \4--données '{5"query": "query BlockById($id: BlockId!) { block(id: $id) { id height transactions { id } } }",6"variables": {7"id": "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad"8}9}'
1curl --location 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql' \2--header 'Accept: application/json' \3--en-tête 'Content-Type: application/json' \4--données '{5"query": "query BlockById($id: BlockId!) { block(id: $id) { id height transactions { id } } }",6"variables": {7"id": "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad"8}9}'
1const BLOCK_QUERY = `2query {3block(id: "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad") {4id5hauteur6transactions {7id8}9}10}11`;1213const fetchBlockInfo = async (): Promise<void> => {14essayer {15const response = await fetch('https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', {16method: 'POST',17headers: {18'Accept': 'application/json',19'Content-Type': 'application/json',20},21body: JSON.stringify({22query: BLOCK_QUERY,23}),24});2526if (!response.ok) {27throw new Error(`HTTP error! status: ${response.status}`);28}2930const result = await response.json();31console.log('Block ID:', result.data.block.id);32console.log('Block Height:', result.data.block.height);33console.log('Transactions:', result.data.block.transactions.map((tx: any) => tx.id));34} catch (erreur) {35console.error('Error fetching block info:', error);36}37};3839fetchBlockInfo();40
1const BLOCK_QUERY = `2query {3block(id: "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad") {4id5hauteur6transactions {7id8}9}10}11`;1213const fetchBlockInfo = async (): Promise<void> => {14essayer {15const response = await fetch('https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', {16method: 'POST',17headers: {18'Accept': 'application/json',19'Content-Type': 'application/json',20},21body: JSON.stringify({22query: BLOCK_QUERY,23}),24});2526if (!response.ok) {27throw new Error(`HTTP error! status: ${response.status}`);28}2930const result = await response.json();31console.log('Block ID:', result.data.block.id);32console.log('Block Height:', result.data.block.height);33console.log('Transactions:', result.data.block.transactions.map((tx: any) => tx.id));34} catch (erreur) {35console.error('Error fetching block info:', error);36}37};3839fetchBlockInfo();40
1const myHeaders = new Headers();2myHeaders.append("Accept", "application/json");3myHeaders.ajouter(« Content-Type », « application/json »);45const brut = JSON.stringify({6"query": "query BlockById($id: BlockId!) { block(id: $id) { id height transactions { id } } }",7"variables": {8"id": "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad"9}10});1112const requestOptions = {13méthode: « POST »,14en-têtes: myHeaders,15corps: brut,16redirection: « suivre »17};1819fetch("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql", requestOptions)20.puis((réponse) => réponse.texte())21.puis((résultat) => console.log(résultat))22.catch((erreur) => console.erreur(erreur));
1const myHeaders = new Headers();2myHeaders.append("Accept", "application/json");3myHeaders.ajouter(« Content-Type », « application/json »);45const brut = JSON.stringify({6"query": "query BlockById($id: BlockId!) { block(id: $id) { id height transactions { id } } }",7"variables": {8"id": "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad"9}10});1112const requestOptions = {13méthode: « POST »,14en-têtes: myHeaders,15corps: brut,16redirection: « suivre »17};1819fetch("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql", requestOptions)20.puis((réponse) => réponse.texte())21.puis((résultat) => console.log(résultat))22.catch((erreur) => console.erreur(erreur));
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 BLOCK_BY_ID_QUERY = gql`15query BlockById($id: BlockId!) {16block(id: $id) {17id18hauteur19transactions {20id21}22}23}24`;2526const variables = {27id: "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad"28};2930client.query({31query: BLOCK_BY_ID_QUERY,32variables: variables33})34.then(result => {35console.log(JSON.stringify(result.data, null, 2));36})37.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 BLOCK_BY_ID_QUERY = gql`15query BlockById($id: BlockId!) {16block(id: $id) {17id18hauteur19transactions {20id21}22}23}24`;2526const variables = {27id: "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad"28};2930client.query({31query: BLOCK_BY_ID_QUERY,32variables: variables33})34.then(result => {35console.log(JSON.stringify(result.data, null, 2));36})37.catch(error => console.error('Error:', error));
1import demandes2import json34url = "https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql"56charge utile = json.dumps({7"query": "query BlockById($id: BlockId!) { block(id: $id) { id height transactions { id } } }",8"variables": {9"id": "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad"10}11})12en-têtes = {13'Accept': 'application/json',14« Content-Type »: 'application/json'15}1617réponse = demandes.demande(« POST », url, en-têtes=en-têtes, données=charge utile)1819imprimer(réponse.texte)20
1import demandes2import json34url = "https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql"56charge utile = json.dumps({7"query": "query BlockById($id: BlockId!) { block(id: $id) { id height transactions { id } } }",8"variables": {9"id": "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad"10}11})12en-têtes = {13'Accept': 'application/json',14« Content-Type »: 'application/json'15}1617réponse = demandes.demande(« POST », url, en-têtes=en-têtes, données=charge utile)1819imprimer(réponse.texte)20
1nécessite « uri »2require « json »3nécessite « net/http »45url = URI("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql")67https = Net::HTTP.new(url.serveur, url.port)8https.use_ssl = true910demande = Net::HTTP::POST.nouveau(URL)11demande[« Accepter »] = « application/json »12demande[« Content-Type »] = « application/json »13demande.corps = JSON.dump({14"query": "query BlockById(\$id: BlockId\!) { block(id: \$id) { id height transactions { id } } }",15"variables": {16"id": "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad"17}18})1920réponse = https.requête(requête)21affiche la réponse.read_body22
1nécessite « uri »2require « json »3nécessite « net/http »45url = URI("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql")67https = Net::HTTP.new(url.serveur, url.port)8https.use_ssl = true910demande = Net::HTTP::POST.nouveau(URL)11demande[« Accepter »] = « application/json »12demande[« Content-Type »] = « application/json »13demande.corps = JSON.dump({14"query": "query BlockById(\$id: BlockId\!) { block(id: \$id) { id height transactions { id } } }",15"variables": {16"id": "0x37f8a43bc7a5c0460bd7478a41f191a74dfb3685f00e48a316d8406658dc0dad"17}18})1920réponse = https.requête(requête)21affiche la réponse.read_body22
Vous n'avez pas encore de compte ?
Créez votreendpoint Quicknode endpoint quelques secondes et commencez à développer
Commencez gratuitement