listLatestBlocks Query
Paramètres
bloc
entier
OBLIGATOIRE
Chargement...
Renvoie
données
objet
Chargement...
blocs
objet
Chargement...
nodes
tableau
Chargement...
ID
chaîne de caractères
Chargement...
transactions
tableau
Chargement...
ID
chaîne de caractères
Chargement...
inputAssetIds
tableau
Chargement...
inputs
tableau
Chargement...
__typename
chaîne de caractères
Chargement...
propriétaire
chaîne de caractères
Chargement...
utxoId
chaîne de caractères
Chargement...
montant
chaîne de caractères
Chargement...
assetId
chaîne de caractères
Chargement...
outputs
tableau
Chargement...
__typename
chaîne de caractères
Chargement...
inputIndex
chaîne de caractères
Chargement...
balanceRoot
chaîne de caractères
Chargement...
stateRoot
chaîne de caractères
Chargement...
to
chaîne de caractères
Chargement...
montant
chaîne de caractères
Chargement...
assetId
chaîne de caractères
Chargement...
Requête
1curl --location 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql' \2--en-tête 'Accept: application/json' \3--header 'Content-Type: application/json' \4--data '{5"query": "query LatestBlocks { blocks(last: 5) { nodes { id transactions { id inputAssetIds inputs { __typename ... on InputCoin { owner utxoId amount assetId } ... on InputContract { utxoId contractId } ... on InputMessage { sender recipient amount data } } outputs { __typename ... on CoinOutput { to amount assetId } ... on ContractOutput { inputIndex balanceRoot stateRoot } ... on ChangeOutput { to amount assetId } ... on VariableOutput { to amount assetId } ... on ContractCreated { contract stateRoot } } } } } }"6}'
1curl --location 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql' \2--en-tête 'Accept: application/json' \3--header 'Content-Type: application/json' \4--data '{5"query": "query LatestBlocks { blocks(last: 5) { nodes { id transactions { id inputAssetIds inputs { __typename ... on InputCoin { owner utxoId amount assetId } ... on InputContract { utxoId contractId } ... on InputMessage { sender recipient amount data } } outputs { __typename ... on CoinOutput { to amount assetId } ... on ContractOutput { inputIndex balanceRoot stateRoot } ... on ChangeOutput { to amount assetId } ... on VariableOutput { to amount assetId } ... on ContractCreated { contract stateRoot } } } } } }"6}'
1const LATEST_BLOCKS_QUERY = `2query LatestBlocks {3blocks(last: 5) {4nodes {5ID6transactions {7ID8inputAssetIds9inputs {10__typename11... on InputCoin {12propriétaire13utxoId14montant15assetId16}17... on InputContract {18utxoId19contractId20}21... on InputMessage {22expéditeur23destinataire24montant25données26}27}28outputs {29__typename30... on CoinOutput {31to32montant33assetId34}35... on ContractOutput {36inputIndex37balanceRoot38stateRoot39}40... on ChangeOutput {41to42montant43assetId44}45... on VariableOutput {46to47montant48assetId49}50... on ContractCreated {51contrat52stateRoot53}54}55}56}57}58}59`;6061const fetchLatestBlocks = async () => {62essayer {63const response = await fetch('https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', {64méthode: « POST »,65headers: {66« Accepter »: 'application/json',67« Content-Type »: 'application/json',68},69body: JSON.stringify({70query: LATEST_BLOCKS_QUERY,71}),72});7374si (!réponse.ok) {75throw new Error(`HTTP error! status: ${response.status}`);76}7778const résultat = await response.json();79console.log('Latest Blocks:', result.data.blocks.nodes);80} catch (erreur) {81console.error('Error fetching latest blocks:', error);82}83};8485fetchLatestBlocks();86
1const LATEST_BLOCKS_QUERY = `2query LatestBlocks {3blocks(last: 5) {4nodes {5ID6transactions {7ID8inputAssetIds9inputs {10__typename11... on InputCoin {12propriétaire13utxoId14montant15assetId16}17... on InputContract {18utxoId19contractId20}21... on InputMessage {22expéditeur23destinataire24montant25données26}27}28outputs {29__typename30... on CoinOutput {31to32montant33assetId34}35... on ContractOutput {36inputIndex37balanceRoot38stateRoot39}40... on ChangeOutput {41to42montant43assetId44}45... on VariableOutput {46to47montant48assetId49}50... on ContractCreated {51contrat52stateRoot53}54}55}56}57}58}59`;6061const fetchLatestBlocks = async () => {62essayer {63const response = await fetch('https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', {64méthode: « POST »,65headers: {66« Accepter »: 'application/json',67« Content-Type »: 'application/json',68},69body: JSON.stringify({70query: LATEST_BLOCKS_QUERY,71}),72});7374si (!réponse.ok) {75throw new Error(`HTTP error! status: ${response.status}`);76}7778const résultat = await response.json();79console.log('Latest Blocks:', result.data.blocks.nodes);80} catch (erreur) {81console.error('Error fetching latest blocks:', error);82}83};8485fetchLatestBlocks();86
1const myHeaders = new Headers();2myHeaders.append("Accept", "application/json");3mesEnTêtes.ajouter("Content-Type", "application/json");45const brut = JSON.stringify({6"query": "query LatestBlocks { blocks(last: 5) { nodes { id transactions { id inputAssetIds inputs { __typename ... on InputCoin { owner utxoId amount assetId } ... on InputContract { utxoId contractId } ... on InputMessage { sender recipient amount data } } outputs { __typename ... on CoinOutput { to amount assetId } ... on ContractOutput { inputIndex balanceRoot stateRoot } ... on ChangeOutput { to amount assetId } ... on VariableOutput { to amount assetId } ... on ContractCreated { contract stateRoot } } } } } }"7});89const requestOptions = {10méthode: « POST »,11headers: myHeaders,12body: raw,13redirect: "follow"14};1516récupérer(« 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");3mesEnTêtes.ajouter("Content-Type", "application/json");45const brut = JSON.stringify({6"query": "query LatestBlocks { blocks(last: 5) { nodes { id transactions { id inputAssetIds inputs { __typename ... on InputCoin { owner utxoId amount assetId } ... on InputContract { utxoId contractId } ... on InputMessage { sender recipient amount data } } outputs { __typename ... on CoinOutput { to amount assetId } ... on ContractOutput { inputIndex balanceRoot stateRoot } ... on ChangeOutput { to amount assetId } ... on VariableOutput { to amount assetId } ... on ContractCreated { contract stateRoot } } } } } }"7});89const requestOptions = {10méthode: « POST »,11headers: myHeaders,12body: raw,13redirect: "follow"14};1516récupérer(« 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(),7récupérer: récupérer,8headers: {9« Accepter »: 'application/json',10« Content-Type »: 'application/json'11}12});1314const LATEST_BLOCKS_QUERY = gql`15query LatestBlocks {16blocks(last: 5) {17nodes {18ID19transactions {20ID21inputAssetIds22inputs {23__typename24... on InputCoin {25propriétaire26utxoId27montant28assetId29}30... on InputContract {31utxoId32contractId33}34... on InputMessage {35expéditeur36destinataire37montant38données39}40}41outputs {42__typename43... on CoinOutput {44to45montant46assetId47}48... on ContractOutput {49inputIndex50balanceRoot51stateRoot52}53... on ChangeOutput {54to55montant56assetId57}58... on VariableOutput {59to60montant61assetId62}63... on ContractCreated {64contrat65stateRoot66}67}68}69}70}71}72`;7374client.requête({75query: LATEST_BLOCKS_QUERY76})77.puis(résultat => {78console.log('Latest Blocks:', JSON.stringify(result.data, null, 2));79})80.catch(erreur => console.erreur('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(),7récupérer: récupérer,8headers: {9« Accepter »: 'application/json',10« Content-Type »: 'application/json'11}12});1314const LATEST_BLOCKS_QUERY = gql`15query LatestBlocks {16blocks(last: 5) {17nodes {18ID19transactions {20ID21inputAssetIds22inputs {23__typename24... on InputCoin {25propriétaire26utxoId27montant28assetId29}30... on InputContract {31utxoId32contractId33}34... on InputMessage {35expéditeur36destinataire37montant38données39}40}41outputs {42__typename43... on CoinOutput {44to45montant46assetId47}48... on ContractOutput {49inputIndex50balanceRoot51stateRoot52}53... on ChangeOutput {54to55montant56assetId57}58... on VariableOutput {59to60montant61assetId62}63... on ContractCreated {64contrat65stateRoot66}67}68}69}70}71}72`;7374client.requête({75query: LATEST_BLOCKS_QUERY76})77.puis(résultat => {78console.log('Latest Blocks:', JSON.stringify(result.data, null, 2));79})80.catch(erreur => console.erreur('Erreur :', erreur));
1import requests2import json34url = « https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql »56payload = json.dumps({7"query": "query LatestBlocks { blocks(last: 5) { nodes { id transactions { id inputAssetIds inputs { __typename ... on InputCoin { owner utxoId amount assetId } ... on InputContract { utxoId contractId } ... on InputMessage { sender recipient amount data } } outputs { __typename ... on CoinOutput { to amount assetId } ... on ContractOutput { inputIndex balanceRoot stateRoot } ... on ChangeOutput { to amount assetId } ... on VariableOutput { to amount assetId } ... on ContractCreated { contract stateRoot } } } } } }"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": "query LatestBlocks { blocks(last: 5) { nodes { id transactions { id inputAssetIds inputs { __typename ... on InputCoin { owner utxoId amount assetId } ... on InputContract { utxoId contractId } ... on InputMessage { sender recipient amount data } } outputs { __typename ... on CoinOutput { to amount assetId } ... on ContractOutput { inputIndex balanceRoot stateRoot } ... on ChangeOutput { to amount assetId } ... on VariableOutput { to amount assetId } ... on ContractCreated { contract stateRoot } } } } } }"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": "query LatestBlocks { blocks(last: 5) { nodes { id transactions { id inputAssetIds inputs { __typename ... on InputCoin { owner utxoId amount assetId } ... on InputContract { utxoId contractId } ... on InputMessage { sender recipient amount data } } outputs { __typename ... on CoinOutput { to amount assetId } ... on ContractOutput { inputIndex balanceRoot stateRoot } ... on ChangeOutput { to amount assetId } ... on VariableOutput { to amount assetId } ... on ContractCreated { contract stateRoot } } } } } }"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": "query LatestBlocks { blocks(last: 5) { nodes { id transactions { id inputAssetIds inputs { __typename ... on InputCoin { owner utxoId amount assetId } ... on InputContract { utxoId contractId } ... on InputMessage { sender recipient amount data } } outputs { __typename ... on CoinOutput { to amount assetId } ... on ContractOutput { inputIndex balanceRoot stateRoot } ... on ChangeOutput { to amount assetId } ... on VariableOutput { to amount assetId } ... on ContractCreated { contract stateRoot } } } } } }"15})1617response = https.request(request)18puts response.read_body19
Vous n'avez pas encore de compte ?
Créez votre endpoint Quicknode en quelques secondes et commencez à développer
Commencez gratuitement