IPFS
While working with contract/token metadata, a typical scenario is to fetch it from IPFS. DipDup has a separate datasource to perform such requests via IPFS gateways.
dipdup.yaml
datasources:
ipfs:
kind: ipfs
url: https://ipfs.filebase.io/ipfs
url defaults to the public Filebase gateway shown above. It is meant for testing and light usage and allows about 200 requests per minute. For production, point url to your own gateway, such as Rainbow or Kubo (e.g. http://127.0.0.1:8080/ipfs), or to a dedicated gateway of an IPFS pinning provider.
You can use this datasource within any callback. Output is either JSON or binary data.
ipfs = ctx.get_ipfs_datasource('ipfs')
file = await ipfs.get('bafybeifx7yeb55armcsxwwitkymga5xf53dxiarykms3ygqic223w5sk3m')
assert file[:5].decode() == 'Hello'
file = await ipfs.get('QmSgSC7geYH3Ae4SpUHy4KutxqNH9ESKBGXoCN4JQdbtEz/package.json')
assert file['name'] == 'json-buffer'
Help and tips -> Join our Discord
Ideas or suggestions -> Issue Tracker
GraphQL IDE -> Open Playground