GraphQL Server
Last updated
Was this helpful?
Was this helpful?
❯ curl -X POST http://localhost:8545/graphql -H "Content-Type: application/json" --data '{ "query": "query { block { number } }" }'
{"data":{"block":{"number":"0x5b9d65"}}}❯ curl -X POST http://localhost:8545/graphql -H "Content-Type: application/json" --data '@block-num.query'const { request, gql } = require('graphql-request');
const query = gql`
query blockInfo($number: Long) {
block(number: $number) {
hash
stateRoot
}
}
`;
request('http://localhost:8545/graphql', query, { number: '6004067' })
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});transaction(hash: "0xdad") {
from {
balance
}
}transaction(hash: "0xdad") {
from(block: 6004067) {
balance
}
}