How can I query outside data in mapping.ts? F.e. IPFS json-data

Hi!
To reduce the amount of data on-chain, I created a field in my smart contract which is a string, that points to a json object. But I still want the data in this json to be indexable, so I would like to query the url in my mapping.ts. Then I could unwrap the JSON into an object and save it on the graph.

I tried to use axios, but I can’t import it, is there any proper way to query outside data?

Thanks!

Hi @mhaas
You can currently fetch files from IPFS in your mappings: documentation.

There is work in progress to offer more robust support for this: GIP: File data sources

In general questions about subgraph development are best asked in the Graph Protocol Discord

Thanks!

Thanks for the response!
Now that I implement it, when I try to deploy it, this happens:

Subgraph Studio does not support mappings with ipfs methods.
Please remove all instances of ipfs.cat and ipfs.map from

Does ipfs only work on self-host?

You can deploy IPFS subgraphs to the Hosted Service (they are not currently supported on the Studio)

Thanks!
I just deployed it on the hosted-service, but I am getting this error:

Failed ipfs.cat, returning `null`, error: error sending request for url (http://10.0.1.215/api/v0/object/stat?arg=XXXXXXX

Is there a way that I can define my own ipfs-node instead 10.0.1.215?

Hey @mhaas - questions about subgraph development are best asked in the Graph Protocol Discord, in the #subgraph-development or #hosted-service channel