0.1.4 • Published 5 years ago
@phantomchain/core-graphql v0.1.4
)
PHANTOM Core - GraphQL
Installation
yarn add @phantomchain/core-graphql
Configuration
module.exports = {
enabled: !process.env.PHANTOM_GRAPHQL_DISABLED,
host: process.env.PHANTOM_GRAPHQL_HOST || '0.0.0.0',
port: process.env.PHANTOM_GRAPHQL_PORT || 4005,
path: '/graphql',
graphiql: true,
}
Usage
You can play with the data using the GraphQL Playground, or programmatically posting querys directly to the endpoint. By default the endpoint is http://0.0.0.0:4005/graphql
, but can be changed in your configuration.
Query Examples
Get first blocks
{
blocks(orderBy: { field: "height", direction: ASC }) {
id
payloadHash
height
numberOfTransactions
}
}
Get the list of transactions from a specific block
{
block(id: "13114381566690093367") {
timestamp
generatorPublicKey
transactions {
id
type
amount
}
}
}
Get the recipient info of each transaction
{
block(id: "13114381566690093367") {
generatorPublicKey
transactions {
id
recipient {
address
balance
}
}
}
}
Security
If you discover a security vulnerability within this package, please send an e-mail to security@phantom.org. All security vulnerabilities will be promptly addressed.