Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wiwichips/dcp-echoes

Simple wrapper for dcp-client which makes it easier to require. (Note: it will forcibly spawn a process briefly)
https://github.com/wiwichips/dcp-echoes

Last synced: 2 days ago
JSON representation

Simple wrapper for dcp-client which makes it easier to require. (Note: it will forcibly spawn a process briefly)

Awesome Lists containing this project

README

        

# dcp-echoes

A simple wrapper for the [dcp-client](https://www.npmjs.com/package/dcp-client) DCP SDK intended to make it easier to use in NodeJS.

## Usage

Require dcp-client as many times as you want just like any other npm package!

`dcp-echoes` uses `dcp-client` as a peer dependency, in simple configurations, it will use the `dcp-client` specified in your project's `package.json`. This may cause problems with more complex project dependencies.

Install `dcp-client` and `dcp-echoes`:
```
npm i dcp-client
npm i dcp-echoes
```

Require `dcp-echoes` as many times as you please:
```js
const { wallet, compute } = require('dcp-echoes');
const protocol = require('dcp-echoes').protocol;
const job = require('dcp-echoes').job;
```

## Note

Be warned, dcp-echoes invokes the initialization function for dcp-client.
This means your code will break if you attempt to re-initialize dcp-client.

```js
const wallet = require('dcp-echos').wallet;
const compute = require('dcp-echos').compute;
const dcp = require('dcp-client').initSync(); // THROWS AN ERROR ):
```

However, you are free to require dcp-echos after you have invoked dcp-client's initialization function.

```js
const dcp1 = require('dcp-client').initSync();
const dcp2 = require('dcp-echoes'); // works fine (:
```

# Disclaimer

This code is not endorsed or supported by Distributive. I did this for my own use. Use at your own risk.