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 3179fbd commit 636bd5d
Show file tree
Hide file tree
Showing 6 changed files with 3,846 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16

- name: Install dependencies
run: npm install

- name: Build packages
run: npm run build

- name: Setup npm
run: npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}"

- name: Publish to npmjs
run: npm publish --access public

- name: Publish GitHub release
uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
# Dependency directories (remove the comment below to include it)
vendor/
.env*
script.py
script.py
dist/
node_modules/
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ mempool:
cd cmd/mempool && go run . -c ../../build/dipdup.mainnet.yml

local:
docker-compose -f docker-compose.yml up -d --build
docker-compose -f docker-compose.yml up -d --build
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,60 @@ 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](https://docs.dipdup.net/config-file-reference/plugins/mempool).

## 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:
```js
import { createClient } from '@dipdup/mempool'

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

#### Query

```js
import { everything } from '@dipdup/mempool'

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

#### Subscription (live query)

```js
import { everything } from '@dipdup/mempool'

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

0 comments on commit 636bd5d

Please sign in to comment.