0.2.0 • Published 2 years ago

@dipdup/mempool v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Mempool indexer

Tests Docker images Made With License: MIT

Selective Tezos mempool indexer based on DipDup framework.

Configuration

Fully compatible with DipDup YAML configuration file format.
Mempool indexer reuses datasources, contracts, database, hasura sections, and reads its own settings from mempool top-level section.

Read more in the docs.

GQL Client

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://api.dipdup.net/mempool/graphql',
    subscription: {
        url: "wss://api.dipdup.net/mempool/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),
    })