3

Code:

contract="0xdAC17F958D2ee523a2206206994597C13D831ec7"

query = """
($contract: Int!) {
 token(id:$contract){
   name
   symbol
   decimals
   derivedETH
   tradeVolumeUSD
   totalLiquidity
 }
}
"""

variables = {
    "contract": contract
}

data = client.execute(query=query, variables=variables)

Error:

{'errors': [{'locations': [{'column': 1, 'line': 2}], 'message': 'Unexpected `([Punctuator]`\nExpected `{`, `query`, `mutation`, `subscription` or `fragment`'}]}

I've tried reformatting a number of ways and I cannot get this error to go away! Help!

Paul Verest
  • 60,022
  • 51
  • 208
  • 332
Marcus
  • 63
  • 1
  • 3

1 Answers1

1

Your GraphQL query must start with a query:

query($someVar: String!) {
  someQuery(someArg: $someVar) {
     ...
  }
}
Icebreaker454
  • 1,031
  • 7
  • 12