listLatestBlocks Query
參數
區塊
整數
必填
載入中...
退貨
資料
物件
載入中...
區塊
物件
載入中...
節點
陣列
載入中...
id
字串
載入中...
交易
陣列
載入中...
id
字串
載入中...
inputAssetIds
陣列
載入中...
輸入
陣列
載入中...
__typename
字串
載入中...
所有者
字串
載入中...
utxoId
字串
載入中...
金額
字串
載入中...
assetId
字串
載入中...
輸出
陣列
載入中...
__typename
字串
載入中...
inputIndex
字串
載入中...
balanceRoot
字串
載入中...
stateRoot
字串
載入中...
至
字串
載入中...
金額
字串
載入中...
assetId
字串
載入中...
請求
1curl --location 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql' \2--header 'Accept: application/json' \3--標頭 '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--標頭 '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) {4節點 {5id6transactions {7id8inputAssetIds9inputs {10__typename11... 在 InputCoin 上 {12所有者13utxoId14金額15assetId16}17... 在 InputContract 上 {18utxoId19contractId20}21... 在 InputMessage 上 {22寄件人23收件人24金額25資料26}27}28輸出 {29__typename30... 在 CoinOutput 上 {31至32金額33assetId34}35... 在 ContractOutput 上 {36inputIndex37balanceRoot38stateRoot39}40... 在 ChangeOutput {41至42金額43assetId44}45... 在 VariableOutput 上 {46至47金額48assetId49}50... 在 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 (錯誤) {81console.error('Error fetching latest blocks:', error);82}83};8485fetchLatestBlocks();86
1const LATEST_BLOCKS_QUERY = `2query LatestBlocks {3blocks(last: 5) {4節點 {5id6transactions {7id8inputAssetIds9inputs {10__typename11... 在 InputCoin 上 {12所有者13utxoId14金額15assetId16}17... 在 InputContract 上 {18utxoId19contractId20}21... 在 InputMessage 上 {22寄件人23收件人24金額25資料26}27}28輸出 {29__typename30... 在 CoinOutput 上 {31至32金額33assetId34}35... 在 ContractOutput 上 {36inputIndex37balanceRoot38stateRoot39}40... 在 ChangeOutput {41至42金額43assetId44}45... 在 VariableOutput 上 {46至47金額48assetId49}50... 在 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 (錯誤) {81console.error('Error fetching latest blocks:', error);82}83};8485fetchLatestBlocks();86
1const myHeaders = new Headers();2myHeaders.追加("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正文: 原始,13重定向: 「追蹤」14};1516取得(「https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql」, requestOptions)17.接著((回應) => 回應.文字())18.接著((結果) => 控制台.log(結果))19.catch((錯誤) => 控制台.錯誤(錯誤));
1const myHeaders = new Headers();2myHeaders.追加("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正文: 原始,13重定向: 「追蹤」14};1516取得(「https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql」, requestOptions)17.接著((回應) => 回應.文字())18.接著((結果) => 控制台.log(結果))19.catch((錯誤) => 控制台.錯誤(錯誤));
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 InMemoryCache(),7fetch: fetch,8headers: {9「接受」: 'application/json',10「Content-Type」: 'application/json'11}12});1314const LATEST_BLOCKS_QUERY = gql`15query LatestBlocks {16blocks(last: 5) {17節點 {18id19transactions {20id21inputAssetIds22inputs {23__typename24... on InputCoin {25所有者26utxoId27金額28assetId29}30... on InputContract {31utxoId32contractId33}34... on InputMessage {35寄件人36收件人37金額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.catchcatch(錯誤 => console.錯誤('錯誤:', 錯誤));
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 InMemoryCache(),7fetch: fetch,8headers: {9「接受」: 'application/json',10「Content-Type」: 'application/json'11}12});1314const LATEST_BLOCKS_QUERY = gql`15query LatestBlocks {16blocks(last: 5) {17節點 {18id19transactions {20id21inputAssetIds22inputs {23__typename24... on InputCoin {25所有者26utxoId27金額28assetId29}30... on InputContract {31utxoId32contractId33}34... on InputMessage {35寄件人36收件人37金額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.catchcatch(錯誤 => console.錯誤('錯誤:', 錯誤));
1匯入 請求2import json34網址 = "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 json34網址 = "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需要 "uri"2require "json"3需要 "net/http"45網址 = URI("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql")67https = 網::HTTP.new(url.主機, url.port)8https.use_ssl = true910請求 = 淨::HTTP::POST.new(網址)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
1需要 "uri"2require "json"3需要 "net/http"45網址 = URI("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql")67https = 網::HTTP.new(url.主機, url.port)8https.use_ssl = true910請求 = 淨::HTTP::POST.new(網址)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