Hey guys
I’m trying to make graphql request to get all the call transactions of my contract (preferably by function method) but to no avail
Can you help me, please?
I’m use this playground
https://node-beta-2.fuel.network/playground
Hey guys
I’m trying to make graphql request to get all the call transactions of my contract (preferably by function method) but to no avail
Can you help me, please?
I’m use this playground
https://node-beta-2.fuel.network/playground
There currently isn’t a way to use this endpoint to filter transactions by contract.
You can find more information about what you can do with the node graphql API here: https://graphql-docs.fuel.network/
Do you mean that there is no way to get all transactions by contract address?
Any transaction has inputContracts
field
We need just make a query that will give you all of the transactions with id of our contract in inputContracts
list
You can fetch all transactions and sort them by input contract on your end, but the API doesn’t offer this type of filtering. The indexer would be more suited for this use case.
Why didn’t they do that? Isn’t it feasible?
Maybe I can help make it happen?
This is a serious omission without which it will be very difficult to develop defi projects
I don’t have any context about why, but you’re welcome to create an issue or add a PR here: GitHub - FuelLabs/fuel-core: Rust full node implementation of the Fuel v2 protocol.
Ok thanks
Will try to fix it
Can you please explain me if I understand it correct
I just don’t have big experience with using graphql, sorry
If I want to open graphql playground that will work for any provided node link ( in my case this is https://node-beta-2.fuel.network/graphql) it will use provided before schema that can be found on SCHEMA tab in interface.
So here is the thing that I have found. To get last created transactions on node I can use this query
query Transactions{
transactions(last: 5) {
nodes {
id
inputContracts {id}
}
}
}
and it will give me something like this
{
"data": {
"transactions": {
"nodes": [
{
"id": "0x041a434b652bd82fa5247739281f91a8b87827728a56fe749646814ac69f9870",
"inputContracts": []
},
{
"id": "0x8f2f0fb38b7e6aeda12e90ac05a19c7a6a6bfb2aff98a996615e4c0d541aa26a",
"inputContracts": null
},
{
"id": "0x959eb55fc0a8027e585af2bd1fdf8c71cc7f50014f07d51a382df3d7f28d4d80",
"inputContracts": []
},
{
"id": "0x0d8a3e9da2170c3cb543e11d74723e81af3bc7f784e86cc12e0c83143529fd6c",
"inputContracts": null
},
{
"id": "0x240d7120652b0a11b6c20e3e8b6bb339758c45296af5991085af65bb6d5e22e4",
"inputContracts": [
{
"id": "0x4dedaf6440ad4e2506c75cde1eeafa8d12716d0f00149ccf819ccb92e6483d64"
}
]
}
]
}
}
}
But I don’t understand how to create query right to have input that will give me array of nodes that have inputContracts
object with specified id
field for me. For instance id = "“0x4dedaf6440ad4e2506c75cde1eeafa8d12716d0f00149ccf819ccb92e6483d64"”
Is it even possible or I can only use params that I can pass via transactions function arguments?
It is not possible right now for this version of the API. You can see all of the filter parameters available in the playground under “Arguments”.
Do you know about beta3?
Is there any way to get all the call transactions of my contract?
There isn’t any change to the API for this, but the indexer team just added a feature to easily do this with the indexer. You can check that out here: Call - The Fuel Indexer Service
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.