0

I am using the graph and am looking to get NFT meta data via ipfs in a transfer event. Everything works as expected unless I try to fetch meta data via ipfs

The schema looks like

type Example @entity {
  id: ID!
  createdAtTimeStamp: BigInt!
  contentURI: String!
  tokenId: BigInt!
  name: String!
  description: String!
  image: String!
  externalURL: String!
}

and the transfer event

const IPFSHASH = "EXAMPLE_IPFS_HASH";

export function handleTransfer(event: TransferEvent): void {

  let example = Example.load(event.params.tokenId.toString());

  if (!example) {
    example = new Example(event.params.tokenId.toString());
    example.createdAtTimeStamp = event.block.timestamp;
    example.tokenId = event.params.tokenId;

    let exampleContract = ExampleContract.bind(event.address);

    example.contentURI = exampleContract.tokenURI(event.params.tokenId);
    const ipfsUrl = "/" + event.params.tokenId.toString() + ".json";

    let metadata = ipfs.cat(ipfshash + token.tokenURI);
if(metadata) {

.....
}

}

And I cannot get it to compile correctly whenever I use the ipfs lib from the graph with error Failed to compile data source mapping: Subgraph Studio does not support mappings with ipfs methods.

1 Answer 1

0

According to the docs, the Graph Network does not yet support ipfs.cat and ipfs.map, and developers should not deploy subgraphs using that functionality to the network via the Studio.

See: https://thegraph.com/docs/en/developing/creating-a-subgraph/

1
  • Correct, however it can be achieved with the hosted services and in your subgraph.yaml ipfsOnEthereumContracts Commented Sep 29, 2022 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.