listLatestBlocks Query
参数
块
整数
必填
正在加载...
退货
数据
对象
正在加载...
块
对象
正在加载...
nodes
数组
正在加载...
id
字符串
正在加载...
交易
数组
正在加载...
id
字符串
正在加载...
inputAssetIds
数组
正在加载...
inputs
数组
正在加载...
__typename
字符串
正在加载...
owner
字符串
正在加载...
utxoId
字符串
正在加载...
金额
字符串
正在加载...
assetId
字符串
正在加载...
outputs
数组
正在加载...
__typename
字符串
正在加载...
inputIndex
字符串
正在加载...
balanceRoot
字符串
正在加载...
stateRoot
字符串
正在加载...
到
字符串
正在加载...
金额
字符串
正在加载...
assetId
字符串
正在加载...
请求
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": "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--header '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 {5id6交易 {7id8inputAssetIds9inputs {10__typename11... on InputCoin {12owner13utxoId14金额15assetId16}17... on InputContract {18utxoId19contractId20}21... on InputMessage {22sender23recipient24金额25数据26}27}28outputs {29__typename30... on CoinOutput {31到32金额33assetId34}35... on ContractOutput {36inputIndex37balanceRoot38stateRoot39}40... on ChangeOutput {41到42金额43assetId44}45... on VariableOutput {46到47金额48assetId49}50... on ContractCreated {51合同52stateRoot53}54}55}56}57}58}59`;6061const fetchLatestBlocks = async () => {62试一试 {63const response = await fetch('https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', {64方法: 'POST',65headers: {66“接受”: 'application/json',67“Content-Type”: 'application/json',68},69body: JSON.stringify({70query: LATEST_BLOCKS_QUERY,71}),72});7374如果 (!响应.ok) {75throw new Error(`HTTP error! status: ${response.status}`);76}7778const 结果 = await response.json();79console.log('Latest Blocks:', result.data.blocks.nodes);80} catch (error) {81console.error('Error fetching latest blocks:', error);82}83};8485fetchLatestBlocks();86
1const LATEST_BLOCKS_QUERY = `2query LatestBlocks {3blocks(last: 5) {4nodes {5id6交易 {7id8inputAssetIds9inputs {10__typename11... on InputCoin {12owner13utxoId14金额15assetId16}17... on InputContract {18utxoId19contractId20}21... on InputMessage {22sender23recipient24金额25数据26}27}28outputs {29__typename30... on CoinOutput {31到32金额33assetId34}35... on ContractOutput {36inputIndex37balanceRoot38stateRoot39}40... on ChangeOutput {41到42金额43assetId44}45... on VariableOutput {46到47金额48assetId49}50... on ContractCreated {51合同52stateRoot53}54}55}56}57}58}59`;6061const fetchLatestBlocks = async () => {62试一试 {63const response = await fetch('https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', {64方法: 'POST',65headers: {66“接受”: 'application/json',67“Content-Type”: 'application/json',68},69body: JSON.stringify({70query: LATEST_BLOCKS_QUERY,71}),72});7374如果 (!响应.ok) {75throw new Error(`HTTP error! status: ${response.status}`);76}7778const 结果 = await response.json();79console.log('Latest Blocks:', result.data.blocks.nodes);80} catch (error) {81console.error('Error fetching latest blocks:', error);82}83};8485fetchLatestBlocks();86
1const myHeaders = new Headers();2myHeaders.append("Accept", "application/json");3myHeaders.追加("Content-Type", "application/json");45const raw = 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 = {10方法: "POST",11标题: myHeaders,12正文: raw,13重定向: "follow"14};1516fetch(“https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql”, requestOptions)17.然后((响应) => 响应.文本())18.然后((结果) => 控制台.log(result))19.catch((error) => 控制台.错误(error));
1const myHeaders = new Headers();2myHeaders.append("Accept", "application/json");3myHeaders.追加("Content-Type", "application/json");45const raw = 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 = {10方法: "POST",11标题: myHeaders,12正文: raw,13重定向: "follow"14};1516fetch(“https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql”, requestOptions)17.然后((响应) => 响应.文本())18.然后((结果) => 控制台.log(result))19.catch((error) => 控制台.错误(error));
1const { ApolloClient, InMemoryCache, gql } = require('@apollo/client/core');2const fetch = require('cross-fetch');34const 客户端 = new ApolloClient({5uri: “https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql”,6缓存: new 内存缓存(),7fetch: fetch,8headers: {9“接受”: '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 {25owner26utxoId27金额28assetId29}30... on InputContract {31utxoId32contractId33}34... on InputMessage {35sender36recipient37金额38数据39}40}41outputs {42__typename43... on CoinOutput {44到45金额46assetId47}48... on ContractOutput {49inputIndex50balanceRoot51stateRoot52}53... on ChangeOutput {54到55金额56assetId57}58... on VariableOutput {59到60金额61assetId62}63... on ContractCreated {64合同65stateRoot66}67}68}69}70}71}72`;7374客户.查询({75query: LATEST_BLOCKS_QUERY76})77.然后(结果 => {78console.log('Latest Blocks:', JSON.stringify(result.data, null, 2));79})80.catch(error => 控制台.error('错误:', 错误));
1const { ApolloClient, InMemoryCache, gql } = require('@apollo/client/core');2const fetch = require('cross-fetch');34const 客户端 = new ApolloClient({5uri: “https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql”,6缓存: new 内存缓存(),7fetch: fetch,8headers: {9“接受”: '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 {25owner26utxoId27金额28assetId29}30... on InputContract {31utxoId32contractId33}34... on InputMessage {35sender36recipient37金额38数据39}40}41outputs {42__typename43... on CoinOutput {44到45金额46assetId47}48... on ContractOutput {49inputIndex50balanceRoot51stateRoot52}53... on ChangeOutput {54到55金额56assetId57}58... on VariableOutput {59到60金额61assetId62}63... on ContractCreated {64合同65stateRoot66}67}68}69}70}71}72`;7374客户.查询({75query: LATEST_BLOCKS_QUERY76})77.然后(结果 => {78console.log('Latest Blocks:', JSON.stringify(result.data, null, 2));79})80.catch(error => 控制台.error('错误:', 错误));
1导入 请求2import json34url = "https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql"56有效载荷 = 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})9标题 = {10“接受”: 'application/json',11“Content-Type”: 'application/json'12}1314回复 = 请求.请求("POST", url, headers=headers, data=有效载荷)1516打印(响应.text)17
1导入 请求2import json34url = "https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql"56有效载荷 = 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})9标题 = {10“接受”: 'application/json',11“Content-Type”: 'application/json'12}1314回复 = 请求.请求("POST", url, headers=headers, data=有效载荷)1516打印(响应.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.主机, url.端口)8https.use_ssl = true910请求 = Net::HTTP::POST.new(url)11请求[“接受”] = "application/json"12请求["Content-Type"] = "application/json"13请求.请求体 = 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})1617回复 = https.请求(请求)18返回响应.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.主机, url.端口)8https.use_ssl = true910请求 = Net::HTTP::POST.new(url)11请求[“接受”] = "application/json"12请求["Content-Type"] = "application/json"13请求.请求体 = 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})1617回复 = https.请求(请求)18返回响应.read_body19