2021-04-08 10:15:30 -03:00
|
|
|
# Mempool JS API
|
2021-02-08 16:54:37 -03:00
|
|
|
|
2021-04-17 00:20:32 -03:00
|
|
|
[](https://www.npmjs.org/package/@mempool/mempool.js)
|
|
|
|
[](https://david-dm.org/mempool/mempool.js#info=dependencies)
|
2021-04-17 00:34:47 -03:00
|
|
|
[](https://snyk.io/test/github/mempool/mempool.js)
|
2021-04-14 17:27:28 -03:00
|
|
|
[](https://opensource.org/licenses/MIT)
|
2021-02-08 16:54:37 -03:00
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
NPM package module for Mempool APIs.
|
2021-02-08 16:54:37 -03:00
|
|
|
|
2021-04-17 00:34:47 -03:00
|
|
|
Documentation: [https://mempool.tools/mempoolJS](https://mempool.tools/mempoolJS)
|
2021-04-17 00:20:32 -03:00
|
|
|
|
|
|
|
---
|
2021-02-08 16:54:37 -03:00
|
|
|
|
2021-04-08 10:15:30 -03:00
|
|
|
## **Installation**
|
|
|
|
|
|
|
|
### **ES Modules**
|
2021-02-08 16:54:37 -03:00
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
Install the npm module.
|
2021-02-08 16:54:37 -03:00
|
|
|
|
|
|
|
```bash
|
2021-04-08 10:15:30 -03:00
|
|
|
# npm
|
2021-04-17 00:20:32 -03:00
|
|
|
$ npm install @mempool/mempool.js --save
|
2021-04-08 10:15:30 -03:00
|
|
|
|
|
|
|
# yarn
|
2021-04-17 00:20:32 -03:00
|
|
|
$ yarn add @mempool/mempool.js
|
2021-02-08 16:54:37 -03:00
|
|
|
```
|
|
|
|
|
2021-04-17 00:34:47 -03:00
|
|
|
Or if you're not into package management, just [download a ZIP](https://github.com/mempool/mempool.js/archive/refs/heads/main.zip) file.
|
2021-02-08 16:54:37 -03:00
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
Import the module.
|
2021-04-08 10:15:30 -03:00
|
|
|
|
|
|
|
```js
|
2021-04-17 00:20:32 -03:00
|
|
|
import mempoolJS from '@mempool/mempool.js';
|
2021-04-10 12:30:24 -03:00
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
// default mempool.space endpoints
|
|
|
|
const { bitcoin, bisq, liquid } = mempoolJS();
|
2021-02-08 16:54:37 -03:00
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
// (alternative) your custom endpoints
|
|
|
|
const { bitcoin, bisq, liquid } = mempoolJS({
|
|
|
|
homespace: 'mempool.space',
|
2021-04-08 10:15:30 -03:00
|
|
|
});
|
|
|
|
```
|
2021-02-08 16:54:37 -03:00
|
|
|
|
2021-04-08 10:15:30 -03:00
|
|
|
### **CommonJS**
|
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
Include the line below in the `head` tag of your html file.
|
2021-04-10 12:30:24 -03:00
|
|
|
|
|
|
|
```html
|
|
|
|
<script type="text/javascript" src="https://mempool.space/mempool.js"></script>
|
|
|
|
```
|
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
Call `mempoolJS` function to access the API methods.
|
2021-04-08 10:15:30 -03:00
|
|
|
|
|
|
|
```js
|
2021-04-14 17:27:28 -03:00
|
|
|
// default mempool.space endpoints
|
|
|
|
const { bitcoin, bisq, liquid } = mempoolJS();
|
2021-02-08 16:54:37 -03:00
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
// (alternative) your custom endpoints
|
|
|
|
const { bitcoin, bisq, liquid } = mempoolJS({
|
|
|
|
homespace: 'mempool.space',
|
2021-02-08 16:54:37 -03:00
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
---
|
2021-02-09 16:22:48 -03:00
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
## **Features**
|
|
|
|
|
|
|
|
- [Bitcoin](./README-bitcoin.md)
|
|
|
|
- [Addresses](./README-bitcoin.md#get-address)
|
|
|
|
- [Blocks](./README-bitcoin.md#get-blocks)
|
|
|
|
- [Fees](./README-bitcoin.md#get-fees)
|
|
|
|
- [Mempool](./README-bitcoin.md#get-mempool)
|
|
|
|
- [Transactions](./README-bitcoin.md#get-transactions)
|
|
|
|
- [Websocket Client](./README-bitcoin.md#Websocket-Client)
|
|
|
|
- [Websocket Server](./README-bitcoin.md#Websocket-Server)
|
|
|
|
- [Bisq](./README-bisq.md#get-address)
|
|
|
|
- [Addresses](./README-bisq.md#get-address)
|
|
|
|
- [Blocks](./README-bisq.md#get-blocks)
|
|
|
|
- [Statistics](./README-bisq.md#get-statistics)
|
|
|
|
- [Transactions](./README-bisq.md#get-transactions)
|
|
|
|
- [Liquid](./README-liquid.md#get-address)
|
|
|
|
- [Addresses](./README-liquid.md#get-address)
|
|
|
|
- [Assets](./README-liquid.md#get-address)
|
|
|
|
- [Blocks](./README-liquid.md#get-address)
|
|
|
|
- [Fees](./README-liquid.md#get-address)
|
|
|
|
- [Mempool](./README-liquid.md#get-address)
|
|
|
|
- [Transactions](./README-liquid.md#get-address)
|
|
|
|
- [Websocket Client](./README-liquid.md#Websocket-Client)
|
|
|
|
- [Websocket Server](./README-liquid.md#Websocket-Server)
|
2021-02-09 16:22:48 -03:00
|
|
|
|
2021-02-08 16:54:37 -03:00
|
|
|
---
|
|
|
|
|
2021-04-08 10:15:30 -03:00
|
|
|
## **Contributing**
|
2021-02-08 16:54:37 -03:00
|
|
|
|
|
|
|
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
2021-04-08 10:15:30 -03:00
|
|
|
## **License** [MIT](https://choosealicense.com/licenses/mit/)
|