Skip to content

Commit

Permalink
Add npm workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kus committed May 4, 2022
1 parent 49f3218 commit cde60eb
Show file tree
Hide file tree
Showing 6 changed files with 3,836 additions and 115 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ vendor/
*.db
dipdup.yml

dist/
dist/
node_modules/
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Metadata indexer reuses `datasources`, `contracts`, `database`, `hasura` section

Read more [in the docs](https://docs.dipdup.net/plugins/metadata).

## GQL client

```
npm i @dipdup/metadata
```

Read [how to use](./client/README.md) the GraphQL client for the Metadata service.

## Maintenance

### Refetch recent metadata
Expand Down
59 changes: 59 additions & 0 deletions build/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Metadata GQL client

[![npm version](https://badge.fury.io/js/%40dipdup%2Fmetadata.svg)](https://badge.fury.io/js/%40dipdup%2Fmetadata)
[![Made With](https://img.shields.io/badge/made%20with-dipdup-blue.svg?)](https://dipdup.net)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Autogenerated typed TZIP-16/TZIP-21 Metadata SDK with a built-in GQL client.

## Installation

```
npm i @dipdup/metadata
```

## Usage

First of all you need to create an instance of metadata client:
```js
import { createClient } from '@dipdup/metadata'

const client = createClient({
url: 'http://metadata.dipdup.net/v1/graphql',
subscription: {
url: "wss://metadata.dipdup.net/v1/graphql"
}
});
```

#### Query

```js
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)

```js
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
})
```
Loading

0 comments on commit cde60eb

Please sign in to comment.