@dipdup/metadata
v0.1.0
Published
GQL client for Tezos contract & token metadata API
Downloads
5
Readme
Metadata indexer
Selective Tezos metadata indexer based on DipDup framework.
Supported features:
- TZIP-16 contract metadata
- TZIP-12 token metadata
- IPFS file pinning
- Token thumbnails generating (and uploading to AWS)
- Elasicsearch mode
Configuration
Fully compatible with DipDup YAML configuration file format.
Metadata indexer reuses datasources
, contracts
, database
, hasura
sections, and reads its own settings from metadata
top-level section.
Read more in the docs.
GQL client
Installation
npm i @dipdup/metadata
Usage
First of all you need to create an instance of metadata client:
import { createClient } from '@dipdup/metadata'
const client = createClient({
url: 'http://metadata.dipdup.net/v1/graphql',
subscription: {
url: "wss://metadata.dipdup.net/v1/graphql"
}
});
Query
import { everything } from '@dipdup/metadata'
client.chain.query
.token_metadata({
where: {
contract: { _eq: 'KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton' },
token_id: { _eq: 100000 }
}
})
.get({ ...everything })
.then(res => console.log)
Subscription (live query)
const { unsubscribe } = client.chain.subscription
.token_metadata({
where: {
contract: { _eq: 'KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton' },
created_at: { _gt: '2021-07-06T00:00:00' }
}
})
.get({ ...everything })
.subscribe({
next: res => console.log
})
Maintenance
Refetch recent metadata
This is not a permanent solution, rather an ad-hoc command to fix recent fetch errors. Adjust the data accordingly or remove time condition.
UPDATE token_metadata
SET retry_count=0, status=1
WHERE created_at > 1646082000 AND metadata ISNULL