-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dipdup-net:master' into feat/hasura-config
- Loading branch information
Showing
12 changed files
with
3,879 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,5 @@ vendor/ | |
*.db | ||
dipdup.yml | ||
|
||
dist/ | ||
dist/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}) | ||
``` |
Oops, something went wrong.