The Toolkit exposes a URQL client that can be used to query the Arweave GraphQL API.
Usage
const res = await toolkit.gql.query(query, variables).toPromise();
- query:
string
: The GraphQL query string.
- variables:
object
: The variables for the query.
Example
const query = `
query MyQuery($id: ID!) {
transaction(id: $id) {
id
owner {
address
}
fee {
ar
}
}
}
`;
const variables = {
id: 'QJRUEcVHqNxVX5PNfzIpBSgWJlFwhQ3RmWdYEohrbwo',
};
const res = await toolkit.gql.query(query, variables).toPromise();
console.log(res?.data);
Response:
{
"transaction": {
"id": "QJRUEcVHqNxVX5PNfzIpBSgWJlFwhQ3RmWdYEohrbwo",
"owner": { "address": "uk9eBF_jieshHtXfC9d1p81OHYJT8bTHazhfruLBCTA" },
"fee": { "ar": "0.000000000000" }
}
}