How to pass an array of Strings as a variable?
mgpai22 opened this issue · 1 comments
mgpai22 commented
Hello, I cannot perform my query due to this error: gql.transport.exceptions.TransportQueryError: {'message': 'Variable "$addresses" of required type "[String!]!" was not provided
This is my code:
query_1 = """
query Query($address: String, $addresses: [String!]!, $take: Int, $skip: Int) {
addresses(addresses: $addresses) {
boxesCount
}
boxes(address: $address, take: $take, skip: $skip) {
value
additionalRegisters
transaction {
inputs {
box {
address
}
}
}
spentBy {
boxId
}
boxId
}
}
"""
list_1 = ["3WwuG9amNVDwkJdgT5Ce7aJCfeoafVmd9tag9AEiAZwgPi7pYX3w"]
params = {
"$address": "3WwdXmYP39DLmDWJ6grH9ArXbWuCt2uGAh46VTfeGPrHKJJY6cSJ",
"$addresses": list_1,
"$take": 50,
"$skip": 10
}
# Provide a GraphQL query
query = gql(query_1)
# Execute the query on the transport
result = client.execute(query, variable_values=params)
print(result)
mgpai22 commented
The problem was the $
in my params