Skip to content

Latest commit

 

History

History
60 lines (47 loc) · 1.36 KB

README.md

File metadata and controls

60 lines (47 loc) · 1.36 KB

Mempool GQL client

npm version Made With License: MIT

Autogenerated typed Mempool SDK with a built-in GQL client.

Installation

npm i @dipdup/mempool

Usage

First of all you need to create an instance of mempool client:

import { createClient } from '@dipdup/mempool'

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

Query

import { everything } from '@dipdup/mempool'

client.chain.query
    .transaction({
        where: { 
            destination: { _eq: 'KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton' }
        },
        limit: 10
    })
    .get({ ...everything })
    .then(txs => console.log)

Subscription (live query)

import { everything } from '@dipdup/mempool'

const { unsubscribe } = client.chain.subscription
    .transaction({
        where: { 
            destination: { _eq: 'KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton' }
        }
    })
    .get({ ...everything })
    .subscribe({
        next: (tx) => console.log(tx),
    })