You can query the world using a GraphQL client such as Insomnia or Postman, alternatively you can write code to query the GraphQL API. Below are some examples of how to do this in different programming languages.
JavaScript
Install the graphql-request library:
pnpm install graphql-request
Then you can use the following code to query for all killmail objects:
const{GraphQLClient,gql}=require('graphql-request');// 1. Ensure the endpoint is correct (Sui often updates these)
constclient=newGraphQLClient('https://graphql.testnet.sui.io/graphql');constquery=gql`
query GetAllKillmailObjects {
# 'first' is usually mandatory for pagination
objects(
first: 20,
filter: { type: "0x28b497559d65ab320d9da4613bf2498d5946b2c0ae3597ccfda3072ce127448c::killmail::Killmail" }
) {
nodes {
address
version
digest
asMoveObject {
contents {
json # Returns the fields of the Move struct as a JSON object
}
}
}
}
}
`;client.request(query).then((data)=>console.log(JSON.stringify(data,null,2))).catch((err)=>console.error("Query Error:",err));
Python
Install the gql library:
pip install gql
Then you can use the following code to query for all killmail objects:
fromgqlimportgql,Clientfromgql.transport.requestsimportRequestsHTTPTransportimportjson# 1. Setup the transport with the Sui Testnet endpointtransport=RequestsHTTPTransport(url='https://graphql.testnet.sui.io/graphql',verify=True,retries=3,)# 2. Create the clientclient=Client(transport=transport,fetch_schema_from_transport=False)# 3. Define the query (using a multi-line string)query=gql("""
query GetAllKillmailObjects {
objects(
first: 20,
filter: { type: "0x28b497559d65ab320d9da4613bf2498d5946b2c0ae3597ccfda3072ce127448c::killmail::Killmail" }
) {
nodes {
address
version
digest
asMoveObject {
contents {
json
}
}
}
}
}
""")try:# 4. Execute the requestresponse=client.execute(query)# 5. Print the formatted JSON resultprint(json.dumps(response,indent=2))exceptExceptionase:print(f"Query failed: {e}")
GraphQL Queries
Query for all killmail objects
queryGetAllKillmailObjects{objects(filter:{type:"0x28b497559d65ab320d9da4613bf2498d5946b2c0ae3597ccfda3072ce127448c::killmail::Killmail"}){nodes{address# The Sui Object IDversiondigestasMoveObject{contents{json# This contains the killer_id, victim_id, loss_type, etc.}}}}}
Query a Storage Inventory
query{object(address:"0x481413ce66410a2192c14158bdc29bdc634c6d513412fdcfdc1760647f2dd15b"){addressasMoveObject{contents{type{repr}json# Look here for 'inventory' or 'storage' fields}dynamicFields{nodes{name{type{repr}json}value{...onMoveValue{json# Individual item stacks often appear here}}}}}}}
Query the items in an inventory:
query{object(address:"0x6d5462992e7459da24b3b498fb2a25aec443886791321ffc469126a9ff50a462"){addressasMoveObject{contents{type{repr}# Look for 'inventory' or 'storage' keys in this JSON outputjson}# EVE Frontier SSUs often use Dynamic Fields for item stacksdynamicFields{nodes{name{type{repr}json# This will likely show the Item ID/Type}value{...onMoveValue{json# This will show the quantity and other item metadata}}}}}}}