Skip to content

Instantly share code, notes, and snippets.

@gnidan gnidan/concept-query.graphql Secret
Last active Jul 11, 2019

Embed
What would you like to do?
Introducing Truffle DB (supplementary material)
# concept: example query
# looks up specific information about the deployed KittySharesToken contract
{
network(name: "mainnet") {
contract(name: "KittySharesToken") {
name
abi {
json # e.g. [{"constant":false,"inputs":[{"name":"n",...}],...]"
}
deployed {
address # e.g. "0x8009bE70a9c2bcc7E29eF63dcEFdd92794f46be3"
constructor {
arguments # e.g. { name: "KittyShares", symbol: "🐱" }
}
}
}
}
}
{
"data": {
"artifacts": {
"contract": {
"name": "MagicSquare",
"abi": {
"json": "[{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"generateMagicSquare\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getSquare\",\"outputs\":[{\"components\":[{\"name\":\"rows\",\"type\":\"uint256[][]\"},{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"square\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]"
}
}
}
}
}
{
"name": "MagicSquare"
}
query GetNameAndAbi($name: String!) {
artifacts {
contract(name: $name) {
name
abi {
json
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.